Automation impact, controller-based networking, SDN architecture: overlay/underlay/fabric, northbound/southbound APIs, AI/ML in network ops

Cisco CCNA Preparation · lesson 33 of 36 · 25 min

REST APIs — Representational State Transfer

REST APIs are the standard way applications interact with SDN controllers and network devices. REST uses HTTP/HTTPS and is stateless — each request contains all information needed.

HTTP Verbs (CRUD operations):

GET — Read/retrieve a resource. No body. Example: GET /api/v1/devices returns a list of devices.

POST — Create a new resource. Body contains the new resource data.

PUT — Update/replace an existing resource entirely.

PATCH — Partially update an existing resource.

DELETE — Remove a resource.

HTTP Status Codes: 200 OK, 201 Created, 400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found, 500 Internal Server Error.

JSON — Data Encoding for APIs

JSON (JavaScript Object Notation) is the most common data format for REST APIs. It is human-readable and lightweight.

JSON structure: objects (key-value pairs in curly braces), arrays (ordered lists in square brackets), strings (in quotes), numbers, booleans (true/false), null.

Example JSON response from a network API:

{ "hostname": "R1", "interfaces": [ { "name": "GigabitEthernet0/0", "ip": "192.168.1.1", "status": "up" } ], "version": "17.3.1" }

YAML is an alternative encoding (used by Ansible) — more human-readable but less common in REST APIs. XML is used by NETCONF/RESTCONF.

Ansible — Agentless Configuration Management

Ansible automates network device configuration using playbooks (YAML files describing desired state). Key concepts:

Agentless — no software installed on managed devices. Uses SSH (or NETCONF/RESTCONF for network devices).

Playbook — YAML file containing one or more plays. Each play targets a group of hosts and runs tasks.

Inventory — file listing managed hosts and groups.

Module — pre-built unit of work (e.g., ios_config for Cisco IOS, nxos_vlan for NX-OS).

Idempotent — running a playbook multiple times produces the same result. Only makes changes when needed.

Ansible is push-based — the control node pushes configuration to managed nodes.

Terraform — Infrastructure as Code

Terraform provisions and manages infrastructure using declarative configuration files (HCL — HashiCorp Configuration Language). Key concepts:

Declarative — you describe the desired end state; Terraform figures out how to get there.

Provider — plugin that interacts with an API (AWS, Azure, Cisco ACI, NSO).

State file — tracks current infrastructure state. Terraform compares desired state (config) to current state to determine changes.

Plan → Apply workflow: terraform plan (preview changes) → terraform apply (execute changes).

Terraform is pull-based in some workflows but primarily push-based from the control node.

Ansible vs Terraform: Ansible excels at configuration management (what runs on devices); Terraform excels at provisioning infrastructure (creating/destroying resources).

CCNA Exam Focus

The CCNA exam tests conceptual understanding of automation tools — not deep scripting. Know: Ansible is agentless/YAML/push-based; Terraform is declarative/HCL/infrastructure provisioning; REST APIs use HTTP verbs; JSON is the primary data format.

Key Terms

Key Terms

Knowledge Check — 12 Questions

Automation — REST APIs, JSON, Ansible, Terraform

Which HTTP verb is used to retrieve a resource without modifying it?

  • POST
  • PUT
  • GET
  • DELETE

Answer: GET
GET retrieves a resource. It is read-only and idempotent — calling it multiple times has no side effects.

Which HTTP verb creates a new resource?

  • GET
  • POST
  • PUT
  • PATCH

Answer: POST
POST creates a new resource. It is not idempotent — calling it twice creates two resources.

HTTP status code 404 means:

  • Success
  • Created
  • Not Found
  • Server Error
  • Answer: Not Found

404 Not Found means the requested resource does not exist on the server. JSON data is structured using:

  • XML tags
  • Key-value pairs in curly braces and arrays in square brackets
  • YAML indentation
  • CSV columns
  • Answer: Key-value pairs in curly braces and arrays in square brackets

JSON uses { } for objects (key-value pairs) and [ ] for arrays. Ansible is described as agentless because:

  • It does not use YAML
  • No software needs to be installed on managed devices
  • It only works with cloud infrastructure
  • It uses a pull model
  • Answer: No software needs to be installed on managed devices

Ansible connects to managed devices via SSH (or APIs) — no agent software is required on the target.

Ansible playbooks are written in which format?

  • JSON
  • XML
  • YAML
  • HCL

Answer: YAML
Ansible playbooks use YAML (Yet Another Markup Language) — human-readable and indentation-based.

Terraform uses which configuration language?

  • YAML
  • JSON
  • Python
  • HCL (HashiCorp Configuration Language)

Answer: HCL (HashiCorp Configuration Language)
Terraform uses HCL — a declarative language designed to be human-readable and machine-parseable.

An idempotent operation produces the same result regardless of how many times it is executed.

  • True
  • False

Answer: True
Idempotency means repeated execution has no additional effect — critical for safe automation.

Which Ansible component lists the managed hosts and groups?

  • Playbook
  • Module
  • Inventory
  • Role

Answer: Inventory
The Ansible inventory file (or dynamic inventory) lists all managed hosts and organizes them into groups.

Terraform’s “plan” command does what?

  • Applies changes immediately
  • Previews what changes will be made without executing them
  • Destroys all infrastructure
  • Generates SSH keys

Answer: Previews what changes will be made without executing them
terraform plan shows a diff between desired state and current state — a dry run before applying.

Which data encoding format is used by NETCONF?

  • JSON
  • YAML
  • XML
  • CSV

Answer: XML
NETCONF uses XML-encoded RPCs. RESTCONF supports both JSON and XML.

The primary difference between Ansible and Terraform is:

  • Ansible uses HCL; Terraform uses YAML
  • Ansible excels at configuration management; Terraform at infrastructure provisioning
  • Terraform is agentless; Ansible requires agents
  • They are identical tools

Answer: Ansible excels at configuration management; Terraform at infrastructure provisioning Ansible configures what runs on existing devices; Terraform creates/destroys infrastructure resources.


Previous lesson: GRE tunnels, DMVPN overview, SSL/TLS VPN concepts
Back to Cisco CCNA Preparation
Next lesson: REST APIs (CRUD, HTTP verbs, data encoding), Ansible and Terraform, JSON-encoded data