Identify the workflow being automated by a Python script that uses Cisco APIs including ACI, Meraki, Cisco DNA Center, and RESTCONF

📘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:

  1. Import required libraries
  2. Define API endpoint information
  3. Authenticate with the system
  4. Send an API request
  5. Receive and process the response
  6. Perform the automated task
  7. 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:

ControllerExample API Function
ACIRetrieve tenant information
MerakiList organization networks
DNA CenterRetrieve network devices
RESTCONFGet 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:

MethodUsed By
API KeyMeraki
Token-based authenticationDNA Center
Username / PasswordACI
HTTP authenticationRESTCONF

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:

MethodPurpose
GETRetrieve data
POSTCreate new resource
PUTUpdate existing resource
DELETERemove 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:

PlatformAutomation Task
ACICreate a tenant
MerakiCreate a network
DNA CenterDeploy configuration
RESTCONFModify 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:

  1. Import libraries
  2. Authenticate with DNA Center
  3. Obtain authentication token
  4. Send GET request to device API
  5. Receive JSON response
  6. Extract device hostname and IP address
  7. 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:

CodeWorkflow Step
import requestsImport libraries
url = "https://api.meraki.com"Define API endpoint
POST /auth/tokenAuthentication
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:

  1. Connecting to a network controller
  2. Authenticating to access the API
  3. Sending requests to retrieve or modify data
  4. Processing the response
  5. Performing automated network tasks

This automation reduces manual configuration and allows programmable network management.

Buy Me a Coffee