Automation and Programmability Flashcards
What does REST stand for?
Representational State Transfer
What are the 6 guidelines of a REST API? (The top 3 are most important to network developers)
1.) Client/Server Separation
2.) Stateless
3.) Cacheable
4.) Uniform Interface
5.) Layered System (separation of concerns)
6.) Code On Demand
Given the following URL, identify the Protocol, the Server, the Resource and the Parameter: https://domain.com/api/v1/servers?=windows
protocol = “https”
server = “domain.com”
resource = “/api/v1/servers”
parameter = “?=windows”
What are the HTTP verbs to Create, Read, Update, and Delete (CRUD)?
Create - POST
Read - GET
Update - PATCH (or PUT)
Delete - DELETE
What is the meaning of the following HTTP response codes:
- 1xx (100)
- 2xx (200)
- 3xx (300)
- 4xx (400)
- 5xx (500)
1xx - Informational
2xx - Successful
3xx - Redirect
4xx - Client error
5xx - Server Error
What is the difference between HTTP 401 and 403 codes?
401 (Unauthorized) - Not authenticated
403 (Forbidden) - Authenticated, but not permitted to access the resource
What is the HTTP response code of 201?
Created (Success) - Note the response BODY may not include any content
What are the three most popular data serialization languages?
XML
JSON
YAML
What is one security issue related to a well documented API?
Reverse Engineering
What are some common methods to secure a REST API?
- Use SSL for connection
- Maintain Statelessness (do not keep sessions open)
- Use authentication
- Use authorization
- Rate limits (Brute Force Protection)
What are the most common methods to authenticate to an API?
- Basic Authentication (Username : Password)
- API Key
- Token-Based (token refresh)
What is YANG?
Industry Standard for how data models are structured in Netconf payloads - a data modeling Language
What are the 4 primary elements to a YANG model?
Module > Container > List > Leaf
What is the URL to fetch capabilities from a Cisco IOS-XE device using RESTconf?
https://DEVICENAME/restconf/data/netconf-state/capabilities
What is it called when a network vendor creates their own YANG data models for their hardware?
Native (Data Models)
Using Python, define a string called name with the value of Bob.
name = “bob”
Using Python, define an integer named quantity with the value of 100
quantity = 100
Using Python, define a boolean called isEnabled with the value of true.
isEnabled = True
Using Python, define a list called ip_addresses with any three IP addresses in the list.
ip_addresses = [“10.10.10.1”, “192.168,44,12”, “172.16.21.9”]
Using Python, define a tuple called ip_addresses with any three IP addresses in the tuple.
ip_addresses = (“10.10.10.1”, “192.168,44,12”, “172.16.21.9”)
What is the difference between a tuple and a list?
Tuple is immutable meaning that the values cannot be changed.
Using Python, define a dictionary with any three IP addresses that use the names R1, R2, and R3 as the keys for the IP addresses.
ip_addresses = {“R1”: “10.10.10.1”, “R2”: “192.168,44,12”, “R3”: “172.16.21.9”}
Using Python, define an If/Else statement that looks to see if variables named r1, r2, or r3 has an IP address of “10.1.1.1”?
if r1 == “10.1.1.1”:
print(“Yes!)
elif r2 == “10.1.1.1”:
print(“Yes!)
elif r3 == “10.1.1.1”:
print(“Yes!”)
else:
print(“No!”)
Using Python, define a loop that continues to execute as long as the value for isEnabled is true
while isEnabled == true:
print(“Still enabled…”)
Using Python, define a for loop that prints all the IP addresses in a list called ip_addresses
for ip_add in ip_addresses:
print(ip_add)
Using Python, define a loop using the range keyword that prints the numbers 0 to 19
for x in range(20):
print(x)
Using Python, define a function that takes an IP address as an argument and adds it to a list of ip_addresses. Then call the function and pass a value.
def append_ip(ip_address):
ip_addresses.append(ip_address)
print(ip_address + “ added to the list”)
append_ip(“10.1.1.1”)
Using Python, define a class named Server with attributes of ip_address and os_version with a function called boot that just prints a simple message.
class Server():
ip_address = “10.10.10.1”
os_version = “Windows 2016”
def boot(self): print("The server is booting!")
How does SD-WAN vManage use REST APIs?
For admins to program vManage policies using scripts.
How does SD-WAN vManage use NETCONF?
To push policy from vManage to vSmart
In DNA Center, what are the Northbound, Southbond, Westbound, and Eastbound APIs used for?
Northbound - Intent API; DNA Center Config
Southbound - Multivendor SDKs for underlay (NETconf)
Eastbound - Events and Notifications (Webhooks)
Westbound - Integrations (ITSM, Monitoring, Assurance)
What are the commands to enable RESTCONF and NETCONF on a Cisco device?
R1(config)# ip http secure-server
R1(config)# restconf
What is the URL to access RESTCONF IETF Interface data on a Cisco Device?
https://{ip-address}/restconf/data/ietf-interfaces:interfaces
What is the basic command to begin creating an EEM applet on a Cisco device?
R1(config)# event manager applet NAME
What are some events an EEM applet can use to trigger an action?
- CLI pattern via regex
- Syslog event pattern
- SNMP OID
- Timer (CRON Job)
What is the command to create an EEM event?
R1(config-applet)# event {{type}} {{options}}
What is the command to create an EEM action?
R1(config-applet)# action WORD {{type}} {{options}}
What is the best practice for an EEM action WORD?
To use incremental numbers, often times incrementing by 0.5 such as: “action 1.0”, “action 1.5”, “action 2.0”, etc.
What are the common types of EEM actions that could be executed?
- Commit a CLI command (or series of commands)
- Enter a Syslog message
- Use programmatical logic (loops, if-else, etc)
- SNMP events
- Reload
What is the command to fire a EEM event on demand?
R1# event manager run NAME
What command will show all valid EEM applets?
R1# show event manager policy registered
When using ansible, what is the command to invoke the ping module?
ansible device_group_name -m ping
When using ansible, what is the command to run a playbook?
ansible-playbook my_playbook.yaml
What does it mean that Ansible uses “Idempotency”?
It only commits a change when it sees a change is needed.
In ansible, what are the three tiers of configuration you will find in a playbook?
Playbook > Plays > Tasks
What are a couple major differences between Ansible and Puppet?
- Ansible pushes configuration, while Puppet uses a “pull” model
- Ansible is Agentless while Puppet uses Agents
NOTE: Puppet Bolt is Agentless - Ansible only pushes changes while Puppet holds full configurations
- Ansible is Python-based, Puppet is Ruby-based
- Ansible uses playbooks while Puppet uses a Database
- Puppet is preferred for Configuration Management (DevOps)
When using Puppet, what are the Tiers of configuration elements called?
Module > Manifest(s) > Classes > Resources
What are some key characteristics of Chef?
- Ruby-based
- Agent-Based
- Configuration uses “pull” model
- Admin client is called a “Knife”
When using Chef, what are the Tiers of configuration elements called?
Bookshelf > Cookbook > Recipes > Resources
What are some key characteristics of SaltStack?
- Python-based (can interact with Master using Python)
- Agent-based
- uses Zero MQ (very fast messaging platform)
- Instructions sent in YAML
- Event Driven
Which of these Automation Tools are Agent-Based and which are Agentless? (Puppet, Puppet Bolt, Chef, Ansible, SaltStack, SaltStack SSH
Agent-Based: Puppet, Chef, SaltStack
Agentless: Ansible, Puppet Bolt, SaltStack SSH
Which two Automation Tools use YAML?
Ansible and SaltStack