📘Cisco DevNet Associate (200-901 DEVASC)
This topic in the Cisco DevNet Associate (200-901 DEVASC) exam focuses on understanding how Python scripts automate network tasks by interacting with Cisco platforms through APIs.
You are not expected to memorize full Python programs, but you must be able to recognize the workflow of an automation script and understand what each step of the script is doing.
The most common APIs used in the exam include:
- Cisco Application Centric Infrastructure (ACI) API
- Cisco Meraki Dashboard API
- Cisco DNA Center API
- RESTCONF
A Python script typically communicates with these systems using REST APIs and exchanges data in JSON format.
1. What is Workflow Automation in a Python Script?
A workflow is the sequence of steps performed by a script to complete a task.
In network automation, a Python script usually follows a structured process:
- Import required libraries
- Define API endpoint information
- Authenticate with the system
- Send an API request
- Receive and process the response
- Perform the automated task
- Display or store results
The exam may show you a Python code snippet, and you must identify which step of the workflow it represents.
2. Typical Python Automation Workflow
A Python automation script interacting with Cisco APIs generally follows this workflow:
Start Script
↓
Import Python Libraries
↓
Define API Endpoint (URL)
↓
Authenticate (Token / Credentials)
↓
Send API Request (GET / POST / PUT / DELETE)
↓
Receive JSON Response
↓
Process Data
↓
Perform Network Operation
↓
Display or Store Output
↓
End Script
Understanding this flow is very important for the DEVASC exam.
3. Step 1 – Import Required Python Libraries
The script first imports Python modules used for HTTP communication.
Common libraries include:
- requests – used to send API calls
- json – used to handle JSON data
Example:
import requests
import json
Purpose:
- Allows the script to communicate with network controllers using REST APIs.
- Enables the script to send and receive JSON data.
Exam Tip:
If you see import requests, it usually indicates the script will call a REST API.
4. Step 2 – Define API Endpoint
The script defines the URL of the API endpoint.
Example:
https://dnacenter.example.com/dna/intent/api/v1/network-device
The endpoint identifies:
- The controller platform
- The specific resource being accessed
Example tasks:
| Controller | Example API Function |
|---|---|
| ACI | Retrieve tenant information |
| Meraki | List organization networks |
| DNA Center | Retrieve network devices |
| RESTCONF | Get router configuration |
Exam Tip:
If you see URL variables, the script is preparing API communication.
Example:
url = "https://api.meraki.com/api/v1/networks"
5. Step 3 – Authentication
Most Cisco APIs require authentication before accessing resources.
Common authentication methods:
| Method | Used By |
|---|---|
| API Key | Meraki |
| Token-based authentication | DNA Center |
| Username / Password | ACI |
| HTTP authentication | RESTCONF |
Example (Meraki API):
headers = {
"X-Cisco-Meraki-API-Key": "API_KEY"
}
Example (DNA Center token request):
POST /dna/system/api/v1/auth/token
The API returns a token, which the script uses in future requests.
Workflow step:
Authenticate → Receive Token → Use Token in API Requests
Exam Tip:
If a script retrieves auth/token, it is performing authentication.
6. Step 4 – Sending API Requests
Once authenticated, the Python script sends HTTP requests to the controller.
Common HTTP methods:
| Method | Purpose |
|---|---|
| GET | Retrieve data |
| POST | Create new resource |
| PUT | Update existing resource |
| DELETE | Remove resource |
Example Python request:
response = requests.get(url, headers=headers)
This means:
- The script sends a GET request
- The controller returns network information
7. Step 5 – Receiving API Response
The controller responds with JSON data.
Example response:
{
"hostname": "Switch1",
"managementIpAddress": "10.1.1.10",
"type": "Cisco Catalyst"
}
The Python script converts this JSON data:
data = response.json()
Purpose:
- Allows Python to read and process the returned data.
8. Step 6 – Processing the Data
The script then extracts the needed information.
Example:
for device in data["response"]:
print(device["hostname"])
This step allows the script to:
- Filter results
- Extract specific fields
- Perform logic operations
Examples of processing tasks:
- Count devices
- Identify device status
- Extract IP addresses
- Check configuration values
9. Step 7 – Perform Automated Action
After analyzing data, the script may perform network automation tasks.
Examples:
| Platform | Automation Task |
|---|---|
| ACI | Create a tenant |
| Meraki | Create a network |
| DNA Center | Deploy configuration |
| RESTCONF | Modify router configuration |
Example POST request:
requests.post(url, json=payload, headers=headers)
Where payload contains configuration data.
Example payload:
{
"name": "Branch-Switch",
"role": "access"
}
10. Step 8 – Display or Store Results
The script usually prints results or stores them.
Example:
print(response.status_code)
print(response.json())
Possible outputs:
- Configuration success message
- Device inventory list
- Network status information
Results may also be:
- Saved to a file
- Logged for monitoring
- Sent to another automation system
11. Example Automation Workflow
Example scenario in an IT environment:
A Python script automates device inventory retrieval from Cisco DNA Center.
Workflow:
- Import libraries
- Authenticate with DNA Center
- Obtain authentication token
- Send GET request to device API
- Receive JSON response
- Extract device hostname and IP address
- Print the device list
Workflow representation:
Python Script
↓
Authenticate to DNA Center
↓
Get Token
↓
GET /network-device
↓
Receive JSON Data
↓
Parse Device Information
↓
Display Device Inventory
12. Example RESTCONF Automation Workflow
Using RESTCONF, a script may automate router configuration retrieval.
Workflow:
Python Script
↓
Authenticate to Router
↓
Send RESTCONF GET Request
↓
Retrieve Interface Configuration
↓
Parse JSON Data
↓
Display Interface Details
Example request:
GET /restconf/data/ietf-interfaces:interfaces
13. Common Automation Tasks in Cisco APIs
Python scripts commonly automate tasks such as:
Device Inventory Collection
Retrieving devices from controllers.
Example:
- Switch list
- Router inventory
- Access point details
Network Configuration
Scripts can configure network settings.
Examples:
- VLAN configuration
- Access policy deployment
- Network creation
Monitoring and Status Checks
Scripts collect operational data.
Examples:
- Device health
- Interface statistics
- Client connectivity
Policy Automation
Controllers apply network policies.
Examples:
- Security policy deployment
- Application policy updates
- Network segmentation rules
14. Recognizing Workflow in the Exam
The DEVASC exam may show a Python script snippet, and you must identify the workflow step.
Example:
| Code | Workflow Step |
|---|---|
import requests | Import libraries |
url = "https://api.meraki.com" | Define API endpoint |
POST /auth/token | Authentication |
requests.get() | Send API request |
response.json() | Parse response |
print(data) | Display results |
15. Key Cisco Platforms Used in Automation
Cisco Application Centric Infrastructure (ACI)
Used for data center network automation.
Automation tasks include:
- Tenant creation
- Application policy configuration
- Endpoint monitoring
Cisco Meraki Dashboard API
Cloud-managed network platform.
Automation tasks:
- Network creation
- Device configuration
- Client monitoring
Cisco DNA Center
Enterprise network automation and management platform.
Automation tasks:
- Device inventory
- Configuration deployment
- Network assurance monitoring
RESTCONF
Protocol used to manage network devices using YANG data models.
Automation tasks:
- Router configuration
- Interface monitoring
- Network state retrieval
16. Key Exam Points to Remember
For the Cisco DevNet Associate (200-901 DEVASC) exam, remember:
1. Python scripts automate network workflows using APIs.
2. Most scripts follow this sequence:
Import Libraries
Define API Endpoint
Authenticate
Send Request
Receive JSON Response
Process Data
Perform Action
Display Results
3. Common HTTP methods
- GET
- POST
- PUT
- DELETE
4. Data format used
- JSON
5. Cisco APIs used in the exam
- Cisco ACI API
- Cisco Meraki API
- Cisco DNA Center API
- RESTCONF
17. Simple Summary
A Python automation script using Cisco APIs works by:
- Connecting to a network controller
- Authenticating to access the API
- Sending requests to retrieve or modify data
- Processing the response
- Performing automated network tasks
This automation reduces manual configuration and allows programmable network management.
