---
hostname:Router-1interfaces:
- name:GigabitEthernet0/0ip:192.168.1.1enabled:trueospf_areas:2# More human-readable than JSON# Indentation = structure
JSON rules to remember: Keys must be strings (in quotes). Values can be string, number, boolean (true/false), array [], or object {}. Trailing commas are NOT allowed (unlike Python dicts).
REST APIs
Representational State Transfer β the language of modern network controllers
REST APIs allow software to interact with network devices and controllers using standard HTTP methods. No CLI needed β just HTTP requests returning JSON.
200 OKRequest succeeded201 CreatedResource created (POST)204 No ContentSuccess, nothing returned400 Bad RequestInvalid syntax401 UnauthorizedBad/missing credentials403 ForbiddenNo permission404 Not FoundResource doesn't exist500 Server ErrorProblem on server side
Python for Network Automation
Netmiko simplifies SSH to network devices from Python
from netmiko import ConnectHandler
commands = ['interface GigabitEthernet0/1',
'description Configured by Python',
'ip address 10.0.0.1 255.255.255.0',
'no shutdown',
]with ConnectHandler(**device) as conn:
conn.send_config_set(commands)
conn.save_config() # wr mem
NAPALM (Network Automation and Programmability Abstraction Layer with Multivendor support) is another popular library. It abstracts vendor differences β the same Python code works on Cisco, Juniper, Arista, etc.
Ansible for Network Automation
Agentless, YAML-based β the most widely used network automation tool
Ansible is agentless β no software needed on network devices. It connects via SSH. Playbooks define WHAT to do (YAML files), inventory defines WHO to do it on.
Idempotency: Ansible modules check current state before making changes. Running a playbook twice doesn't cause double-changes β if the config already matches, Ansible skips it. This is a key advantage over raw scripts.
NETCONF & YANG
The "SSH of automation" β structured, transactional device management
NETCONF (RFC 6241) β A protocol for network device management. Runs over SSH (port 830). Uses XML for data encoding. Supports transactions (commit/rollback).
PortTCP 830 (over SSH)
FormatXML
Operationsget, get-config, edit-config, commit
YANG (Yet Another Next Generation) β A data modeling language. Defines the structure and constraints of configuration and state data. Think of it as the "schema" for NETCONF data.
RESTCONF (RFC 8040) is the REST-based equivalent of NETCONF β uses HTTP methods and JSON/XML instead of SSH and XML.
SDN β Software Defined Networking
Separating the control plane from the data plane
Traditional networks run both the control plane (routing decisions) and data plane (forwarding) on every device. SDN centralizes the control plane in a controller.
β²Application LayerNorthbound API
Network applications (security policies, traffic engineering, monitoring dashboards) communicate with the controller via northbound APIs (typically REST). Example: Cisco APIC, DNA Center applications.
β²Control LayerController (Brain)
The SDN controller maintains a global view of the network topology. Makes forwarding decisions and pushes them down to devices. Examples: OpenDaylight, Cisco APIC, DNA Center, Open vSwitch (OVS).
β²Infrastructure LayerSouthbound API
Physical and virtual network devices (switches, routers). Receive forwarding instructions from the controller via southbound APIs. OpenFlow is the classic southbound protocol. NETCONF/RESTCONF also used.
Cisco DNA Center: Enterprise SDN controller. Provides intent-based networking (IBN) β you define the intent ("users in Finance VLAN can access only Finance servers") and DNA Center translates that to device config.
Overlay vs Underlay: The physical network (underlay) carries the virtual tunnels (overlay). VXLAN is the most common overlay protocol in data centers.
Automation Drills
Network automation is heavily tested on the CCNA β know your APIs, formats, and tools.
30s
QUESTION 1 / 16
Loadingβ¦
β 0β 0π₯ 0
Automation Flashcards
Click to flip. Arrow keys and spacebar work too.
CONCEPT
Loadingβ¦
Click to reveal answer
Loadingβ¦
1 / 1
Automation Labs
Study these code patterns β the CCNA exam tests automation concepts, not running code.
Lab A β Parse JSON API Response in Python
Understand how to work with REST API responses
1
Make a REST API call with Python requests library
import requests, json
url = "https://sandboxdnac.cisco.com/api/v1/network-device"
headers = {"X-Auth-Token":"your_token_here"}
response = requests.get(url, headers=headers, verify=False)
data = response.json()
# response.status_code β 200# data["response"] β list of device dictsfor device in data["response"]:
print(device["hostname"], device["managementIpAddress"])
import json
data = json.loads(json_string) # parse JSON string# Extract only UP interfaces
up_ips = [
iface["ip"]
for iface in data["interfaces"]
if iface["status"] == "up"]
print(up_ips)
# ['192.168.1.1', '10.0.0.1']