Shopping cart

Subtotal:

$0.00

200-301 Automation and Programmability

Automation and Programmability

Detailed list of 200-301 knowledge points

Automation and Programmability Detailed Explanation

Automation and programmability are essential for modern networking, enabling faster deployments, reduced human error, and centralized management.

Part 1: Software-Defined Networking (SDN)

6.1.1 What is SDN?

SDN stands for Software-Defined Networking, a modern approach to networking that separates:

  1. Control Plane: Where decisions are made about how traffic is handled.
    • Example: Determining the best path for data packets.
  2. Data Plane: Where traffic is forwarded based on the decisions from the control plane.
    • Example: Actual packet forwarding through switches and routers.

In traditional networks, both planes are integrated into devices, making management complex. SDN separates these planes, allowing for centralized control.

6.1.2 Benefits of SDN

  1. Centralized Management:

    • Control the entire network from a central controller, like a "command center."
    • Example: Configuring multiple switches simultaneously from one location.
  2. Dynamic Network Configurations:

    • Quickly adapt to changes like adding new devices or applications.
    • Example: Automatically rerouting traffic during link failure.
  3. Improved Scalability:

    • Easily manage and scale large networks without manual reconfiguration.
  4. Programmability:

    • Use APIs to automate tasks, reducing manual effort and errors.

6.1.3 How SDN Works

  1. Applications:

    • Network management tools or custom applications that use SDN to make decisions.
    • Example: A traffic monitoring app that reroutes congested paths.
  2. Controller:

    • Centralized brain of the network, making decisions and sending instructions to devices.
    • Example: OpenDaylight, Cisco APIC.
  3. Network Devices:

    • Routers, switches, or firewalls that handle actual data forwarding based on controller instructions.

6.1.4 SDN Example

Suppose you have three switches, and you want to configure a VLAN across all of them. Without SDN, you'd configure each switch manually. With SDN, you can:

  1. Use a centralized controller.
  2. Define the VLAN once in the controller.
  3. Automatically apply the configuration to all switches.

Part 2: Network Automation Tools

6.2.1 What is Network Automation?

Network automation uses tools or scripts to perform tasks like device configuration, monitoring, and troubleshooting without manual intervention.

6.2.2 Popular Network Automation Tools

  1. Ansible:

    • Agentless: Does not require software installation on devices.
    • Uses YAML Playbooks: Human-readable scripts for configuration.

    Ansible Example:
    Configure a VLAN on a Cisco switch.

    - name: Configure a switch
     hosts: switches
     tasks:
       - name: Configure VLAN
         ios_config:
           lines:
             - vlan 10
             - name Sales
    

    Steps:

    1. Define the hosts file with the switch's IP addresses.

    2. Run the playbook:

      ansible-playbook configure_vlan.yaml
      
  2. Python Scripting with Netmiko:

    • What is Netmiko?: A Python library for SSH-based automation.

    • Example: Retrieve the interface status of a Cisco router.

      from netmiko import ConnectHandler
      
      device = {
         "device_type": "cisco_ios",
         "ip": "192.168.1.1",
         "username": "admin",
         "password": "cisco123"
      }
      
      net_connect = ConnectHandler(**device)
      output = net_connect.send_command("show ip interface brief")
      print(output)
      

Steps:

  1. Install Netmiko:

    pip install netmiko
    
  2. Run the script to fetch interface details.

Part 3: REST APIs

6.3.1 What is a REST API?

REST (Representational State Transfer) APIs allow network devices to be programmatically managed using HTTP methods like:

  • GET: Retrieve information.
  • POST: Add new data or configurations.
  • PUT: Update existing configurations.
  • DELETE: Remove configurations.

REST APIs are commonly used in SDN controllers and modern network devices.

6.3.2 Why Use REST APIs?

  1. Automation:
    • Perform tasks programmatically, reducing manual effort.
  2. Integration:
    • Combine network management with other IT systems (e.g., monitoring tools).
  3. Flexibility:
    • Control devices from scripts or applications.

6.3.3 Example of a REST API Call

Suppose you want to retrieve the interface status of a router using a REST API.

GET Request Example:

  1. Use the following HTTP request:

    GET http://router/api/interfaces
    
  2. Example Python Script:

    import requests
    
    url = "http://192.168.1.1/api/interfaces"
    headers = {
       "Content-Type": "application/json",
       "Authorization": "Bearer YOUR_ACCESS_TOKEN"
    }
    
    response = requests.get(url, headers=headers)
    print(response.json())
    

    Steps:

    1. Replace YOUR_ACCESS_TOKEN with the actual API token.
    2. Run the script to get the interface details.

6.3.4 Verifying REST API Connectivity

  • Test API Access: Use tools like Postman to manually send API requests.

  • Check Device API Settings:

    show restconf
    

Automation and Programmability (Additional Content)

1. Southbound Protocol – OpenFlow

OpenFlow is one of the first and most well-known southbound protocols in SDN architecture. It defines how the SDN controller communicates with network devices (e.g., switches, routers) to install forwarding rules.

Key Characteristics:

  • Used by SDN controllers to direct packet forwarding decisions on OpenFlow-compatible switches.

  • The controller sends flow entries to the devices that specify how to handle traffic.

  • Enables centralized control and dynamic traffic management.

Example Use Case:

In an SDN network, when a switch receives a packet with no matching rule, it forwards the packet to the controller for instructions (packet-in message). The controller then responds with a flow-mod message to define future handling of similar packets.

2. RESTCONF and NETCONF

2.1 NETCONF (Network Configuration Protocol)

  • XML-based protocol used to retrieve and edit configuration data on network devices.

  • Built on top of SSH.

  • Works well with YANG data models to structure configuration data.

2.2 RESTCONF

  • A RESTful API (HTTP-based) interface that exposes YANG-modeled configuration and state data.

  • Supported on Cisco IOS XE and other modern devices.

  • Cisco’s implementation of RESTful network management.

Comparison:

Feature NETCONF RESTCONF
Format XML JSON or XML
Transport SSH HTTPS (HTTP REST interface)
Data Model YANG YANG
Use Case Precise config retrieval Web-friendly API access

3. JSON Data Format Overview

JSON (JavaScript Object Notation) is a lightweight, human-readable format used for data interchange, especially in REST APIs.

Basic Example:

{
  "interface": {
    "name": "GigabitEthernet0/1",
    "enabled": true,
    "ip": {
      "address": "192.168.1.1",
      "netmask": "255.255.255.0"
    }
  }
}

Why JSON in Networking?

  • REST APIs return data in JSON for easy parsing and readability.

  • Widely supported by Python, JavaScript, and network automation tools.

4. API Authentication Mechanisms

APIs require secure access control. CCNA candidates should recognize the following basic authentication methods:

4.1 Token-Based Authentication

  • The client authenticates once and receives a token.

  • All subsequent API calls include the token in the Authorization header.

Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

4.2 Basic Authentication

  • The username and password are base64-encoded and sent with every request.
Authorization: Basic YWRtaW46Y2lzY28=

Security Note: Basic Auth should always be used with HTTPS to protect credentials.

5. Automation Tools: Ansible vs. Python

Both Ansible and Python scripting are used in network automation but serve different purposes and styles.

5.1 Ansible (Declarative Automation)

  • Agentless: Uses SSH, no software needed on devices.

  • Uses YAML playbooks to describe desired configurations.

  • Best suited for bulk device configuration and repetitive tasks.

Example Playbook:

- name: Configure VLAN
  hosts: switches
  tasks:
    - name: Create VLAN 10
      ios_config:
        lines:
          - vlan 10
          - name Sales

5.2 Python with Netmiko or NAPALM (Imperative Automation)

  • Offers fine-grained logic and control.

  • Suitable for custom workflows, decision-making, and error handling.

  • Requires programming knowledge but provides more flexibility.

Example (Using Netmiko):

from netmiko import ConnectHandler

device = {
  "device_type": "cisco_ios",
  "ip": "192.168.1.1",
  "username": "admin",
  "password": "cisco123"
}

net_connect = ConnectHandler(**device)
output = net_connect.send_command("show ip interface brief")
print(output)

Comparison Summary:

Tool Approach Use Case Best For
Ansible Declarative Large-scale deployments Simplifying repetitive tasks
Python Imperative Custom logic and scripting Advanced, conditional workflows

Summary of Key Additions

Topic What You Should Know for CCNA
OpenFlow Southbound SDN protocol used between controller and devices
RESTCONF / NETCONF Cisco-supported config protocols; RESTCONF is HTTP-based
JSON REST APIs return data in JSON; know syntax and usage
API Authentication Token-based and Basic Auth – secure access to APIs
Ansible vs Python Know when to use each tool; Ansible = simple bulk ops, Python = custom logic

Frequently Asked Questions

What is the key architectural difference between traditional networking and controller-based networking?

Answer:

Controller-based networking separates the control plane from individual network devices and centralizes it in a controller.

Explanation:

In traditional networking, each device independently makes forwarding and control decisions using distributed protocols. In controller-based networking, the control plane is centralized within a software controller that manages the network devices. The controller communicates with devices using southbound APIs and provides centralized policy management. This architecture simplifies network configuration, enables automation, and allows administrators to manage large networks more efficiently through centralized orchestration.

Demand Score: 72

Exam Relevance Score: 86

Which HTTP method is commonly used in REST APIs to retrieve data from a server?

Answer:

GET.

Explanation:

REST APIs use standard HTTP methods to perform operations on network resources. The GET method retrieves information from a server without modifying the resource. Other HTTP verbs include POST for creating resources, PUT for updating existing resources, and DELETE for removing them. These methods form the basis of CRUD operations used in network automation systems and management platforms that interact with devices programmatically.

Demand Score: 68

Exam Relevance Score: 84

Which configuration management tool uses playbooks written in YAML to automate network device configuration?

Answer:

Ansible.

Explanation:

Ansible is a widely used automation tool that allows administrators to manage and configure network devices using playbooks written in YAML. These playbooks define tasks such as configuring interfaces, deploying policies, or updating firmware. Ansible communicates with devices over standard protocols like SSH and does not require agents installed on managed devices. This approach simplifies automation and allows consistent configuration deployment across multiple network devices.

Demand Score: 65

Exam Relevance Score: 83

200-301 Training Course