Traditionally, network devices are configured manually using the Command Line Interface (CLI). This method is:
Time-consuming
Error-prone
Not scalable for large networks
| Approach | Description | Pros | Cons |
|---|---|---|---|
| CLI | Manual entry of commands | Familiar, direct | Not scalable, high chance of error |
| APIs | Scripts send instructions via standard interfaces | Fast, consistent, automatable | Requires programming knowledge |
| Benefit | Explanation |
|---|---|
| Consistency | Automation ensures the same config is applied everywhere |
| Speed | Multiple devices configured at once |
| Reduced Human Error | Eliminates typos and misconfigurations |
| Scalability | Easily manages hundreds or thousands of devices |
| Documentation | Scripts act as self-documenting change logs |
APIs (Application Programming Interfaces) allow programs to interact with network devices just like a human would via CLI — but faster, safer, and more scalable.
Uses standard HTTP methods:
GET = retrieve data
POST = create a resource
PUT = update a resource
DELETE = remove a resource
Returns data in JSON or XML format
Stateless (each request is independent)
GET https://dnac.example.com/api/v1/network-device
This fetches information about network devices from Cisco DNA Center.
| Feature | RESTCONF | NETCONF |
|---|---|---|
| API Type | RESTful (HTTP) | XML RPC over SSH |
| Format | YANG + JSON/XML | YANG + XML |
| Protocol | HTTP/HTTPS | SSH |
| Use Case | Readable, web-style APIs | Structured configuration management |
GET https://router.example.com/restconf/data/ietf-interfaces:interfaces
<rpc>
<get-config>
...
</get-config>
</rpc>
These APIs are especially useful in software-defined networking and network orchestration.
Modern network automation depends on standardized data models and formats to represent and exchange configuration and operational data between systems.
YANG is a data modeling language used primarily with NETCONF and RESTCONF.
It defines how data is structured (like a blueprint).
It helps ensure consistent data models across devices and vendors.
| Purpose | Example |
|---|---|
| Define device config structure | Interface name, IP address |
| Enable validation | Ensures values are within expected range |
| Drive APIs | NETCONF & RESTCONF both rely on YANG |
container interface {
leaf name { type string; }
leaf ip-address { type inet:ipv4-address; }
}
This defines an interface object with name and ip-address.
Lightweight
Human-readable
Used in REST APIs
{
"hostname": "R1",
"ip": "192.168.1.1"
}
More verbose than JSON
Used in NETCONF
Better for structured and hierarchical data
<device>
<hostname>R1</hostname>
<ip>192.168.1.1</ip>
</device>
Indentation-based (like Python)
Used in Ansible playbooks
Easier to read than JSON or XML for configs
- name: Configure interface
ios_config:
lines:
- interface Gig1
- description Configured by Ansible
| Format | Readability | Use Case | Example Tool |
|---|---|---|---|
| JSON | High | REST APIs | Postman, DNA Center |
| XML | Moderate | NETCONF | NETCONF agents |
| YAML | Very High | Automation scripts | Ansible |
| YANG | N/A (not data) | Model definition | NETCONF, RESTCONF |
These tools allow engineers to automate device configurations across multiple devices consistently, quickly, and with rollback capabilities. They reduce the need to log in to each device manually.
Ansible is an open-source automation engine used for configuration management, software deployment, and task automation. It is agentless, meaning it does not require any software to be installed on network devices.
| Feature | Benefit |
|---|---|
| Agentless | Uses SSH to connect; no software needed on the device |
| Uses YAML | Simple, readable syntax (called “playbooks”) |
| Modules | Supports Cisco-specific modules like ios_config, ios_command |
| Idempotent | Re-running the same playbook won't reapply unchanged configs |
- name: Configure interface
hosts: routers
gather_facts: no
connection: network_cli
tasks:
- name: Add description to Gig1
ios_config:
lines:
- interface GigabitEthernet1
- description Configured by Ansible
| Module | Description |
|---|---|
| ios_config | Sends configuration commands |
| ios_command | Executes show/debug commands |
| ios_facts | Gathers interface/OS/version facts |
| ios_banner | Configures login banners |
Puppet and Chef are configuration management tools mostly used in server environments, not primarily for network devices.
Declarative model (define desired state, Puppet ensures it)
Uses agents installed on managed nodes
Common in Linux and cloud server environments
Ruby-based configuration scripts
Also agent-based
Used more by DevOps teams than network engineers
| Reason | Explanation |
|---|---|
| Agents not supported | Most switches/routers don't allow custom agent installation |
| Focus | More server-oriented than network-oriented |
| Complexity | Higher learning curve and setup overhead compared to Ansible |
| Tool | Use Case | Agent Required? | Language/Format |
|---|---|---|---|
| Ansible | Network device config | No | YAML |
| Puppet | Server config (mostly) | Yes | Puppet DSL |
| Chef | Server/app deployment | Yes | Ruby DSL |
Python is a powerful, human-readable programming language that’s widely used for network automation because of its simplicity, vast libraries, and community support.
| Advantage | Explanation |
|---|---|
| Readable | Easy to learn and maintain |
| Multi-vendor | Works across Cisco, Juniper, Arista, etc. |
| Library support | Many modules created specifically for network tasks |
| Integrates with APIs | Can easily call REST APIs for DNA Center, Meraki, etc. |
Built on Paramiko
Simplifies SSH connections to network devices
Includes built-in support for Cisco IOS, NX-OS, ASA, and many others
Lower-level SSH library for Python
Allows custom control over SSH sessions
Used internally by tools like Netmiko
Unified API to manage different vendors (Cisco, Juniper, etc.)
Can retrieve and push configurations
Offers functions like get_facts(), compare_config(), load_merge_candidate()
Here’s a script that connects to a Cisco router and runs show ip interface brief.
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)
| Line | Function |
|---|---|
ConnectHandler |
Establishes SSH session |
send_command() |
Sends a CLI command |
print(output) |
Displays the result in the console |
Interface IP-Address OK? Method Status Protocol
GigabitEthernet0/0 192.168.1.1 YES manual up up
GigabitEthernet0/1 unassigned YES unset administratively down down
| Library | Function | Ideal Use |
|---|---|---|
| Netmiko | SSH automation | CLI-driven devices |
| Paramiko | Custom SSH sessions | Low-level control |
| NAPALM | Multi-vendor automation | Config validation and pushing |
Cisco DNA Center (DNAC) is a centralized, intent-based controller used to automate and manage enterprise networks. Its APIs allow external applications and scripts to interact with and control the network programmatically.
IBN focuses on what you want the network to do, not how it’s done.
Instead of configuring individual CLI commands, you:
Define the desired outcome (intent)
DNA Center translates that into device-specific configurations
Verifies and maintains the intent using real-time data and telemetry
| Use Case | Description |
|---|---|
| Inventory | Retrieve info about all network devices |
| Configuration Templates | Deploy standard configs to multiple devices |
| Topology Discovery | See how devices are physically/logically connected |
| Path Trace | Visualize traffic paths end-to-end |
| Client Health Analytics | Monitor endpoint performance and connectivity |
To interact with DNAC's REST APIs, you must authenticate using Bearer tokens.
Send a POST request with username/password
Receive an access token
Use the token in all future requests via HTTP Authorization header
import requests
import json
url = "https://dnac.example.com/dna/system/api/v1/auth/token"
headers = {"Content-Type": "application/json"}
auth = ("admin", "password")
response = requests.post(url, auth=auth, headers=headers, verify=False)
token = response.json()["Token"]
headers = {
"Content-Type": "application/json",
"X-Auth-Token": token
}
url = "https://dnac.example.com/dna/intent/api/v1/network-device"
response = requests.get(url, headers=headers, verify=False)
print(response.json())
[
{
"hostname": "Switch-1",
"managementIpAddress": "10.10.20.1",
"platformId": "C9300-24UX"
}
]
| Feature | Purpose |
|---|---|
| Token-based Auth | Secure access to REST API |
| Intent APIs | Device config, monitoring, templates |
| Programmability | Enables automation, compliance checks, and provisioning |
Modern networks must be proactive, not reactive. Traditional polling methods (like SNMP) are often too slow and inefficient to detect real-time issues. Telemetry pushes data continuously, giving real-time visibility into the network.
Model-Driven Telemetry is a push-based method for exporting telemetry data from network devices to external collectors (e.g., monitoring or analytics platforms).
| Method | Description | Limitation |
|---|---|---|
| Polling (SNMP) | NMS asks device for data periodically | Delays, CPU overhead |
| Streaming (Telemetry) | Device sends data in real time | Lower delay, more scalable |
| Benefit | Description |
|---|---|
| Low latency | Near real-time updates |
| Efficiency | Reduces polling load |
| Structured data | Works with YANG models |
| Customizable | You choose which data to export and how often |
| Protocol | Description |
|---|---|
| gRPC (Google Remote Procedure Call) | Lightweight, high-performance protocol for telemetry |
| Kafka | Event streaming platform for high-volume, real-time data |
| InfluxDB | Time-series database — perfect for telemetry metrics |
| Grafana | Dashboard/visualization platform for InfluxDB and others |
Router collects telemetry data
Exports it using gRPC protocol
Data is received and stored in InfluxDB
Visualized using Grafana
Monitor CPU and interface utilization every second
Stream updates to InfluxDB
Display live graphs of trends and thresholds using Grafana
| Component | Role |
|---|---|
| gRPC | Sends telemetry data |
| YANG | Defines data structure |
| InfluxDB | Stores telemetry data |
| Grafana | Displays visual dashboards |
This section highlights real-world applications of automation in enterprise networks. These are the kinds of tasks that automation tools and APIs make faster, safer, and more consistent — reducing human error and manual effort.
Automatically apply initial configuration to new devices the moment they connect to the network.
Cisco PnP (Plug and Play): Zero-touch deployment for IOS devices
Ansible or DNA Center API to apply baseline configs
A new switch is powered on → it gets IP via DHCP → connects to DNA Center → downloads its pre-defined configuration template.
Automatically compare device configurations to golden templates or security baselines to detect unauthorized changes.
NAPALM: compare_config() function
Ansible: check_mode to preview changes
DNA Center APIs: Config audits and compliance scans
Daily job scans all routers → flags a device with outdated SNMP community string or missing password encryption.
Apply configuration updates (or rollbacks) across multiple devices in a controlled and automated way.
Ansible Playbooks: Push changes to dozens of devices in parallel
Python scripts with Netmiko/NAPALM
DNA Center Templates for atomic rollback
An update breaks connectivity. A rollback playbook automatically restores previous config to all affected switches.
Automatically reroute traffic in SD-WAN based on application performance metrics like latency, jitter, or loss.
Cisco vManage (Viptela SD-WAN)
Performance SLAs tied to policy-based routing
APIs for monitoring and tuning path selection
Voice traffic is automatically shifted from a congested MPLS link to an internet tunnel without human intervention.
| Use Case | Description | Tools Involved |
|---|---|---|
| Auto-Provisioning | Zero-touch config of new devices | Cisco PnP, DNA Center |
| Compliance Check | Detect config drift | NAPALM, Ansible, DNA APIs |
| Rollback / Patch | Automate large config changes | Ansible, Python, DNA |
| SD-WAN Optimization | App-aware traffic routing | vManage, policy APIs |
Ansible roles help organize playbooks into reusable, modular components.
Role Directory Example:
roles/
configure_router/
tasks/
handlers/
vars/
templates/
tasks/: contains main task definitions (e.g., main.yml)
handlers/: triggered by tasks on change
vars/: stores variable definitions
templates/: for Jinja2 templates
Use Case: Simplifies code reuse across multiple projects.
Instead of static hosts files, dynamic inventory pulls host data from:
Cloud APIs (AWS, Azure, GCP)
Databases or custom scripts
Service registries (e.g., NetBox)
ansible-inventory --list -i aws_ec2.yml
Dynamic inventory enables real-time scaling and accuracy.
--check: Runs playbook in dry-run mode. Shows what would change.
--diff: Shows line-by-line config difference.
ansible-playbook play.yml --check --diff
Helpful for audit compliance and pre-deployment validation.
Avoid crashes by using try-except blocks.
try:
response = requests.get(url)
except requests.exceptions.RequestException as e:
print(f"Request failed: {e}")
Essential for stable automation scripts.
Check HTTP response status:
if response.status_code == 200:
print("Success")
else:
print(f"Failed with code {response.status_code}")
Ensures API responses are validated before processing.
Instead of print statements:
import logging
logging.basicConfig(filename='script.log', level=logging.INFO)
logging.info("Task started")
Supports log levels: DEBUG, INFO, WARNING, ERROR
Useful for debugging, auditing, and postmortem analysis
Allows parameterized script execution:
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--device", required=True)
args = parser.parse_args()
Run with:
python script.py --device 192.168.1.1
Makes scripts reusable across devices or environments.
Always check token validity:
if token_expired():
refresh_token()
Build automated re-authentication logic for long-lived automation jobs.
Instead of verify=False (not secure), use:
verify='/path/to/cacert.pem'
Enforces certificate-based trust, protects against MITM attacks.
Use backoff strategies:
for attempt in range(3):
response = requests.get(url)
if response.status_code == 429:
time.sleep(2 ** attempt)
else:
break
429 = Too Many Requests
Helps handle API burst limits and network jitter
Enable external systems to receive event notifications:
Device down
Client health degraded
Policy violation
These can trigger automated remediation scripts or ServiceNow tickets.
Use placeholders in templates:
interface {{ interface_name }}
description {{ description }}
Populate dynamically via API or inventory.
Enhances scalability and customization in deployments.
DNA Center can trigger or update tickets in IT systems:
Auto-generate incident from network event
Link remediation results back to ticket
Support full lifecycle automation
Flow:
Cisco Device → gRPC → Collector → InfluxDB → Grafana
This architecture shows how telemetry data is streamed, stored, and visualized.
gRPC Network Management Interface
Successor to NETCONF/RESTCONF
Supports streaming and configuration
Widely used in modern, vendor-neutral telemetry setups
| Mode | Description |
|---|---|
| OnChange | Sends data only when value changes |
| Periodic | Sends data at fixed intervals (e.g., every 10 seconds) |
Knowing the mode improves resource planning and performance tuning.
Discover Devices: via Cisco DNA Center API
Push Config: via Ansible or Template API
Verify State: using Python/Ansible validation playbooks
Compliance Check: NAPALM compare_config()
Log/Report: Push results to log or dashboard
This structure enables repeatable and auditable automation pipelines.
Apply DevOps principles to networks:
Git: Source control for templates and playbooks
Jenkins: Automate:
Playbook testing (--check)
Deployment triggers (e.g., after approval)
Compliance validation post-deployment
This elevates network automation maturity for enterprise-grade environments.
What is the difference between agent-based and agentless orchestration tools?
Agent-based tools require software agents installed on managed devices, while agentless tools communicate directly using standard protocols.
Agent-based orchestration systems deploy a small program on each managed device to execute tasks and report results. This allows detailed control but requires additional software management. Agentless tools, such as Ansible, interact with devices through existing protocols like SSH or APIs without installing agents. This approach simplifies deployment and reduces maintenance overhead. However, it may provide fewer advanced capabilities compared to agent-based solutions in certain environments.
Demand Score: 63
Exam Relevance Score: 80
What role does YANG play in network automation?
YANG defines structured data models used to represent network configuration and operational data.
YANG provides a standardized way to model network device configurations and state information. These models define how configuration parameters are organized and how they can be accessed through automation protocols such as NETCONF or RESTCONF. By using YANG models, network automation tools can interact with devices in a predictable and structured way. A common misconception is that YANG itself performs automation; in reality, it only defines the data structure used by automation systems.
Demand Score: 66
Exam Relevance Score: 84
What is the purpose of REST APIs in Cisco network automation platforms?
REST APIs allow external applications to programmatically interact with network controllers and devices.
Representational State Transfer (REST) APIs use standard HTTP methods such as GET, POST, PUT, and DELETE to access or modify network resources. Cisco platforms like DNA Center expose REST APIs so administrators or automation scripts can retrieve information, deploy configurations, and monitor network status programmatically. This enables integration with automation frameworks, orchestration tools, and custom scripts. Engineers commonly use REST APIs with Python libraries to automate repetitive network tasks.
Demand Score: 64
Exam Relevance Score: 82