You are on page 1of 18

Cisco CCNP & CCIE Enterprise Core - ENCOR 350-401

CHAPTER 7
AUTOMATION

1
Cisco CCNP & CCIE Enterprise Core - ENCOR 350-401

CHAPTER7: AUTOMATION
- Chapter’s Agenda:
7.1 Interpret basic Python components and scripts
7.2 Construct valid JSON encoded file
7.3 Describe the high-level principles and benefits of a data modeling language, such as YANG
7.4 Describe APIs for Cisco DNA Center and vManage
7.5 Interpret REST API response codes and results in payload using Cisco DNA Center and RESTCONF
7.6 Construct EEM applet to automate configuration, troubleshooting, or data collection
7.7 Compare agent vs. agentless orchestration tools, such as Chef, Puppet, Ansible, and SaltStack

2
Cisco CCNP & CCIE Enterprise Core - ENCOR 350-401

7.1 Python

- programming language
- source-free
- object-oriented
- simple understandable text
- standard-library

- Python Components
- PRINT
- to show any result of any program or process
- python will print whatever inside a (" ") or (‘ ‘)
- ignoring the () and " ''
- COMMENT
- a note for the programmer only to read or memorize
- python will print nothing of the comment
- # sign refers to a comment on the right

3
Cisco CCNP & CCIE Enterprise Core - ENCOR 350-401

- VARIABLES
- a storage of data to refer to
- must start with an alphabetic letter
- case sensitive
- INPUT
- requires a user to execute an input
- CONDITIONALS
- if statement
- controls an execution based on a condition
- multiple conditions can occur
- resulting in multiple executions
- this will require using “else-if”
- AKA “elif”
- LOOPS
- execute a series of codes multiple times, automatically

4
Cisco CCNP & CCIE Enterprise Core - ENCOR 350-401

- LOGICAL OPERATORS
- and, or, not
- and (all the statements must be true)
- or (at least one statement must be true)
- not (one statement that must not be true)

5
Cisco CCNP & CCIE Enterprise Core - ENCOR 350-401

7.2 Java-Script Object Notation (JSON)

- a programming language used to create APIs


- used by REST-Based APIs
- human-readable
- lightweight
- the “Object” is about
- a container that encloses “one-or-more” {name:value} pairs
- also called a “key-value pairs”

- JSON Values
- always surrounded by a curly bracket { }
- name:value pairs
- a string must be enclosed with double quotes “ ”
- like = {“name”:”III”, “job”:”channel”, “location”:”YouTube”}
6
Cisco CCNP & CCIE Enterprise Core - ENCOR 350-401

- the pairs values types


- String:String
- the name is a string, also the value is a string
- {“name”:”III”}
- String:Number
- the value won’t need a double quote
- {“Count”:10}
- String:Arrays
- for a range of values
- {“Class”:[A, B, C, D]}
- String:Booleans
- True/False case
- the value won’t need a double quote
- {“Direct”:False}
- Null

- {“Route”:Null}

7
Cisco CCNP & CCIE Enterprise Core - ENCOR 350-401

7.3 Data Modeling

- creating a unified and standardized models to express data


- across multiple vendors, multiple platforms
- a software can remotely log in to a device
- and push a model containing configuration
- the unified models should be compatible
with multiple vendors, multiple platforms
- achieving the same target on all the platforms

- YET ANOTHER NEXT GENERATION (YANG)


- a language for building those data models
- data models created by YANG
- are named "YANG Modules"

8
Cisco CCNP & CCIE Enterprise Core - ENCOR 350-401

- YANG components
- containers
- like creating an empty folder
- that still requires to be filled with data
- leafs
- the data that fills a container
- can either be configurable specs or just informational
* the YANG modules are built-in in the devices

9
Cisco CCNP & CCIE Enterprise Core - ENCOR 350-401

7.4 Application Programming Interface

- the transformers that are transforming everything from


The Application to the controllers, and vice-versa
- those will be called “Northbound API”
- also transforms everything from the controller to the network
Devices, and vice-versa
- the “Southbound API”

- so, it’s a code


- written by a language
- that language encodes data into an API
- it uses the Server/Client relation
- in the Northbound (Controller = Server, Application = Client)
- in the Southbound (Network Device = Server, Controller = Client)
10
Cisco CCNP & CCIE Enterprise Core - ENCOR 350-401

- API types
- Internal API
- between applications
- like transferring data from HTML to PDF
- Web-Service API
- exchanging data between remote devices
- Uses IP address
- like REST-Based API

11
Cisco CCNP & CCIE Enterprise Core - ENCOR 350-401

- Representational State Transfer APIs (REST-Based APIs)

- the most common type of web-service API


- mostly found in the Northbound
- utilizes HTTP verbs (GET, PUT, POST, DELETE)
- while a REST API is in developing, a developer would use
A CRUD to develop the API’s HTTP verbs
- CRUD = Create, Read, Update, and Delete
- most common languages used to encode data in a REST-Based API
Are (XML, and JSON)
- encoding means standardizing a data structure between the app,
Controller, and nodes

** Cisco vManage is the Dashboard of Cisco DNA Center

12
Cisco CCNP & CCIE Enterprise Core - ENCOR 350-401

7.5 REST-API response codes

- for every nourthbound, REST-API being sent from an API application to a client
- a response code will be replied back to the application
- indicating the status of API health and
if it reached the other side properly or not
- most common response codes can be:

CCNP and CCIE Enterprise Core ENCOR 350-401 Official Cert

- postman, is an API application


Guide

- can push API' to a client


- and shows the response code and payload of every API
- all of that in JSON
13
Cisco CCNP & CCIE Enterprise Core - ENCOR 350-401

7.6 Embedded Event Manager (EEM)

- Cisco policy system


- monitors and reacts
- event part, cause to trigger the Cisco IOS to react
- reaction part to start behaving immediately
- components
- server
- an internal Cisco IOS component
- monitors based on variety of supported features/protocols
- creates its own login session and implement configuration
- like any engineer logging in and configuring manually
- BUT, it's automatic
- event detectors
- watchers, opened eyes to detect a specific event

14
Cisco CCNP & CCIE Enterprise Core - ENCOR 350-401

- compatible with a range of protocols and features:

CCNP and CCIE Enterprise Core ENCOR 350-401 Official Cert


Guide

15
Cisco CCNP & CCIE Enterprise Core - ENCOR 350-401

- policy
- policy (reaction): either applet or script
- applets:
- create a small policy application
- applet with event detectors will monitor for an event to occur
- then the applet will paste a config
- it also can pop-up a message
- or send you a notification (by E-Mail)

16
Cisco CCNP & CCIE Enterprise Core - ENCOR 350-401

7.7 Orchestration Tools

- Automation and Scripting Programs


- can be installed on a server already operating an OS
- login and automate config on devices
- can store the config and push it later
- either scripts, IOS, YAML, Ruby, or GUI !!

- Master/Agent Relation
- each component should be installed on its side
- agent mostly is built-in
- some programs are agentless
- just directly pushes the config to the nodes
- push, to send immediately or at a schedule
- pull, a client asks if there is a change periodically
17
Cisco CCNP & CCIE Enterprise Core - ENCOR 350-401

- Puppet and Chef uses the “Pull” model


- utilizes Ruby language
- Agents
- config file of puppet is named "Manifest"
- config file of chef is a per vendor
- cookbooks that include recipes
- Ansible and SaltStack uses the “Push” model
- utilizes YAML language
- Salt is Agent, while Ansible is Agentless
- Ansible can SSH to the nodes and push the script
- config file of Ansible is named “module”
- a playbooks in Ansible controls and automate the modules
- SaltStack is faster, more secured, more compatible,
no plugins required, but utilizes more resources

18

You might also like