Network Automation & Programmability Flashcards
Issues with Traditional Network Management
Configuring 1 device at a time is consuming/inefficient
Increases likelihood of typos/mistakes
Individual edits to multiple devices by separate engineers over time with little version control leads to configuration drift (non-standardized configs)
Having non-standardized configs and accessing one device at a time is also inefficient for troubleshooting
Network Automation Uses
Device config
Initial device provisioning
Software version control
Collecting stats from devices
Compliance verification
Reports
Troubleshooting
Network Automation Benefits
Enables automation which reduces human to machine interaction
–Greatly reduces the chance of human error
Modern tools have been built with monitoring, configuration, & troubleshooting in mind
It is much more scalable than configuring one device at a time
Network programmability can provide configuration version control
–Software version control as well
Troubleshooting is more efficient with a system-wide view & correlation between events
Events & error codes can be acted on programmatically
Improving configuration & troubleshooting efficiency reduces operational expenses
Network Automation Assurance
Ensure devices have a standardized config
Provide reports & correct exceptions
Provide correlation between events on different devices
Automatically take corrective action on events & error codes
Automation Methods
There are multiple methods to automate network management:
Python, NETCONF, RESTCONF, Ansible, Puppet, SDN, Cisco DNA center
Not all methods are supported by all devices
Choose the method most suitable for your environment/skills
Python for Network Programmability
Relatively easy to learn with many training resources
Human readable
Open source
Cross OS compatible
Easy to find network automation code samples
Git
A distributed version control system for tracking changes in source code & files
Typically used for software development but can provide version control for any type of files
With most client-server version control systems, the code has to be “checked out” and can only be worked on by one dev at a time
Every Git directory on every computer is a full-fledged repository with complete history and full version-tracking abilities
—Because of this, the code can be worked on by multiple devs
Organizations typically designate one repository as the master copy
GitHub
A Git repository hosting service which adds many of its own features
Repositories can be public or private
Repositories can be copied between users
Task management tools are available
Control mechanisms provide security & resolve conflicts
CI/CD
CI (Continuous Integration)
CD (Continuous Delivery/Deployment)
A set or operating principles & practices that enable app development teams to deliver code changes more frequently & reliably
Frequent changes are more efficient than rolling them up into large change windows
Automation of building/testing/deployment
Implementation = CI/CD pipeline
Tools such as Jenkins & Travis CI aid management of the pipeline
Data Serialization
The process of converting structured data to a standardized format that allows sharing or storage of the data in a form that allows recovery of its original structure
Allows transfer of the data between different systems, apps, & programming languages
XML, JSON, & YAML are human & machine readable, plain text data encoding formats
Data formats are mostly interchangeable
Which one to use depends on the support in the system being used, & which is easiest
JSON
JavaScript Object Notation:
First standardized in 2013
Easier for humans to read & work with than XML
Can be imported directly into JS
White space has no special meaning
RESTful APIs often use JSON
JSON Data Types: Object
An unordered collection of key/value pairs
Describe what the object is
Surrounded by curly braces {}
Keys must be strings, & values must be a valid JASON data type
Keys & values are separated by a colon
Each key/value pair is separated by a comma
JSON Data Types: Array
An ordered list of values
Surrounded by square brackets []
Values must be a valid JSON data type
JSON Data Types: String
Alphanumeric string of characters
“Name” : ”GigabitEthernet1”
JSON Data Types: Number
“Input Errors” : 3
JSON Data Types: Boolean
“Enabled” : true
A true/false statement
JSON Data Types: Null
“Msec” : null
XML
eXtensible Markup Language:
Standardized in 1998
Designed to describe & transfer data, while HTML is focused on displaying data
White space has no special meaning
value contained within objects
YAML
(Often used in ____, ___, & ___)
(also what does it start with)
YAML Aint Markup Language:
Often used in Python, Perl, & Ansible
Designed to be easily read by humans
White space = important
Anything at a common indentation level is considered related at the same level
Starts with —
Key: value representation
- indicates a list
Ansible playbooks use YAML
API
Application Programming Interface:
A way for computer programs to communicate directly with another program
Typically used to perform CRUD operations
Two main API types for web services
—SOAP
—REST
NETCONF and RESTCONF are APIs specifically designed to work with network services
CRUD
Create, Read, Update, Delete:
When we are building APIs, we want our models to provide four basic types of functionality
The model must be able to Create, Read, Update, and Delete resources
SOAP
Transport is __
Data Format is __
Simple Object Access Protocol:
Standard communication protocol system that permits processes using different OSs to communicate
Transport is typically HTTP(S)
Data format is always XML
Has strict standards to adhere to
REST
Transport:
Data:
Representational State Transfer:
An architecture, not a protocol
Gives guidelines for the structure & organization of an API
Supports any transport & data format
HTTP(S) transport & JSON (or XML) data formats are commonly used
Typically faster performance & easier to work with than SOAP
REST Constraints
Client-server architecture: the client sends a request, server sends response
Uniform Interface: provides simplicity
Statelessness: no client context is stored on the server between requests
Cacheability: responses must define themselves as either cacheable or non-cacheable
Layered system: any intermediary devices such as load balancers must be transparent to the client/server
Code on demand (optional): servers can temporarily extend or customize the functionality of a client by transferring executable code
REST Request URL
Request method must be sent (Get, Post, etc)
Headers with key:value pair info about the request can be added
Accept:application/json, credentials
Post, Put, & Patch requests include data in the body
https://demo.flackbox.com/api/running/aaa/users/neil?dryrun
demo.flackbox.com = Target Host
/api/running/aaa/users/neil = Resource
?dryrun = Parameters (optional)
REST Response Codes
1xx: Informational
2xx: Success
–200: OK
–201: Created
–204: No Content (deleted)
3xx: Redirection
4xx: Client Error
–400: Bad request/malformed syntax
–401: Unauthorized
–403: Forbidden
–404: Not Found
5xx: Server Error
–500: Internal Server Error
Responses to Get requests include data in the body
Headers can also be included in the response
Data Models
A well understood & agreed upon method to describe something
YANG
Yet Another Next Generation:
A data modeling language which provides a standardized way to represent the operational & config data of a network device
It can be used both internally & when packaged for transmission
Refer to diagram on study guide