Why APIs and not loose scripts
Scripts are easy and fun to create, but hard to maintain. Good scripts rely on APIs, and that brings three benefits:
APIs use HTTP verbs and a data model. Diagram: The House of Routing.
- Abstraction: a programmable API is abstracted from the complexities of the implementation.
- Data specification: it offers a structure or schema (data model). Since the network is treated as a distributed database, it is called a «distributed schema».
- Data access: a standard framework to read and manipulate the device’s data.
Specify in models
An API is built on the idea of «specifying in models»: the semantics (meaning of the objects), the syntax (writing rules), the structure (object architecture) and the constraints (what you can and cannot do). The key is that the implementation be based on standardization.
Applying APIs in a production network is a project with phases: initial (identification and standardization), execution (API and automation tools) and administration (monitoring and optimization via IBN or orchestrators). In short, it is a migration from the CLI to a data model.
What you take away
- Good scripts rely on APIs: abstraction, data specification and access.
- The network is treated as a distributed database («distributed schema»).
- An API specifies the object’s semantics, syntax, structure and constraints.
- Applying APIs is a project: migrating from the CLI to a data model (data-model-driven).
Now you will see the heart of all this: data modeling.
Challenge
Answer before opening the solution.
1. What must good scripts rely on, and why?
On APIs, because they give abstraction, data specification and a standard access; loose scripts are hard to maintain.
2. Why is the network called a «distributed schema»?
Because it is treated as a distributed database whose data model describes its objects.
3. Name two of the four elements of «specifying in models».
Semantics, syntax, structure and constraints of the programmable object (any two).
4. In short, what is applying APIs in a production network?
A project to migrate from the CLI to a data model (data-model-driven), based on standardization.
Resources
Links to go deeper outside this portal.
From the author
- Jesús Espinoza’s SDN series (7 posts)medium.com
- The House of Routing · Academythehouseofrouting.com
Documentation and practice
- Cisco DevNet: APIs, sandboxes and automationdeveloper.cisco.com
- Cisco: what is SDNcisco.com
- Ansible: agentless automationansible.com
Source and credits. Course built from Jesús Espinoza’s «Fundamentals of Network Programmability» material (The House of Routing), paraphrased and expanded. Text written with AI assistance; original diagrams by The House of Routing. Checked against Cisco’s official documentation and industry standards.