##
Automation & APIs
Modern networks are programmed, not typed. The data formats, APIs and tools that make it happen.
// network APIs & models
- REST: HTTP CRUD over JSON, stateless
- NETCONF: XML over SSH (port 830)
- RESTCONF: REST-style over HTTP
- YANG: data model for config & state
- gNMI: streaming telemetry over gRPC
// SDN
- Separates control plane from data plane
- A central controller programs the devices
- Northbound API (apps) / Southbound API (devices)
- Intent-based networking automates policy
// IaC principles
- Idempotent — re-running yields the same state
- Declarative (desired state) vs imperative (steps)
- Store configs in Git — GitOps source of truth
- CI/CD pipeline tests config before pushing
- Render → deploy → verify, automatically
# Python — push config with netmiko
from netmiko import ConnectHandler
dev = {"device_type":"cisco_ios","host":"10.0.0.1",
"username":"admin","password":"***"}
with ConnectHandler(**dev) as c:
c.send_config_set(["interface Gi0/1",
"description uplink","no shutdown"])
print(c.send_command("show ip int brief")) # RESTCONF — read interfaces (JSON over HTTPS)
curl -sk -u admin:*** \
-H "Accept: application/yang-data+json" \
https://10.0.0.1/restconf/data/ietf-interfaces:interfaces