Ch 28: Foundational Network Programmability Concepts Flashcards
T/F: Python is considered one of the most difficult programming languages to learn and adopt.
False.
Python is one of the easier programming languages to learn and adopt.
To authenticate with Cisco’s DNA Center, which type of HTTP request method must be used?
a. PUT
b. PATCH
c. GET
d. POST
e. HEAD
d.
To authenticate to the Cisco DNA Center controller, a POST operation must be used. This is because the login credentials need to be sent to the controller to be verified.
What does CRUD stand for?
- CREATE, RESTORE, UPDATE, DELETE
- CREATE, READ, UPDATE, DELETE
- CREATE, RETRIEVE, UPDATE, DELETE
- CREATE, RECEIVE, UPLOAD, DOWNLOAD
- CREATE, RECEIVE, UPLOAD, DELETE
2.
CRUD stands for CREATE, READ, UPDATE, and DELETE. These are the common actions associated with the manipulation of data. For example, a database uses these actions.
When using the Cisco vManage Authentication API, what is the Headers Content- Type that is used?
- MD5
- X-Auth-Token
- SSH
- x-www-form-urlencoded
- JSON
4.
Cisco vManage uses the Headers Content-Type x-www-form-urlencoded.
X-Auth-Token is for Cisco DNA Center.
Which of the following is in JSON data format?
a. {
“user”: “root”,
“father”: “Jason”,
“mother”: “Jamie”,
“friend”: “Luke”
}
b.
root
Jason
Jamie
Luke
c. root
Jason
Jamie
Luke
d. [users[root|Jason|Jamie|Luke]]
A.
A JSON data format is built from key/value pairs. For example, “father”: “Jason” is a key/value pair, where father is the key, and Jason is the value.
What is the HTTP status code for Unauthorized?
a. 201
b. 400
c. 401
d. 403
e. 404
c.
The HTTP status code 401 means Unauthorized—referring to incorrect login credentials or not having valid authentication to a destination. The following table lists more HTTP status codes.
In Python, why would you use three quotation marks in a row? (Choose two.)
- To begin a multiple-line string
- To start a function
- To represent a logical OR
- To end a multiple-line string
- To call a reusable line of code
1 and 4.
Python uses quotation marks in a row to begin and end a multiple-line string, such as for a long comment.
Which of the following is a Python dictionary?
a.
dnac = {
“host”: “sandboxdnac.cisco.com”, “port”: 443,
“username”: “devnetuser”, “password”: “Cisco123!”
}
b.
[users[root|Jason|Jamie|Luke]]
c.
def dnac\_login(host, username, password): url = "https://{}/api/system/v1/auth/token".
format(host)
response = requests.request(“POST”, url, auth=HTTPBasicAuth(username, password),
headers=headers, verify=False) return response.json()[“Token”]
d.
print(dnac_devices)
A.
Python uses curly braces ({}) as one way to signify a dictionary.
Which of the following are Python functions? (Choose two.)
a.
dnac = {
“host”: “sandboxdnac.cisco.com”, “port”: 443,
“username”: “devnetuser”, “password”: “Cisco123!”
}
b.
[users[root|Jason|Jamie|Luke]]
c.
def dnac\_login(host, username, password): url = "https://{}/api/system/v1/auth/token".
format(host)
response = requests.request(“POST”, url,
auth=HTTPBasicAuth(username, password),
headers=headers, verify=False) return response.json()[“Token”]
d.
print(dnac_devices)
C and D.
Functions can be defined or can already exist within Python. print is a default function, whereas dnac_login is a custom created function.
When using the Cisco DNA Center Token API, what authentication method is used?
- MD5
- X-Auth-Token
- SSH
- Basic authentication
- JSON
4.
Cisco DNA Center uses basic authentication for the initial authentication method.
The Headers Content-Type X-Auth-Token is used to send the token back to Cisco DNA Center for future API calls.
JSON is the data format of the requests and responses.
What is the DevNet Community page used for? (Choose two.)
- To ask questions
- To exchange code
- To access learning labs
- To access DevNet ambassadors and evangelists
- To get news on local DevNet events
1 and 4.
The DevNet Community page is a safe place to interact with other developers and ask questions. DevNet ambassadors and evangelists monitor the page and respond to inquiries and questions.
When using GitHub, what is the purpose of a repository? (Choose three.)
- Provides a place to store a developer’s code
- Provides a place to store music and photos
- Gives the option to share a developer’s code with other users
- Provides documentation on code examples
- Offers a sandbox to test custom code
A, C, and D.
GitHub is a place to store and share code with other developers as well as provide documentation for that code.
Why is using the command-line interface (CLI) to configure a large number of devices considered difficult to scale? (Choose two.)
- The CLI is prone to human error and misconfiguration.
- The CLI is quick and efficient for configuring many devices simultaneously.
- Telnet access to the CLI is best practice.
- The command line is used on a device-by-device basis.
- Using APIs is considered a legacy method of configuration.
A and D.
The CLI is difficult to scale when configuring multiple devices at the same time. This is because the CLI is designed for configuration of a single device on a device-by-device basis. Although scripting can help with some of the burden, it is not the best method for scaling. Consistency in configuration from device to device also becomes more difficult to manage as a network grows.
Which of the following are part of the YANG model? (Choose two.)
a. Type
b. Leaf
c. Container
d. String
e. Method
B and C.
Leaf and Container are parts of a YANG model. A container can hold multiple leafs.
YANG (Yet Another Next Generation) is a data modeling language for the definition of data sent over network management protocols such as the NETCONF and RESTCONF.
The YANG data modeling language is maintained by the NETMOD working group in the Internet Engineering Task Force (IETF) and was published as RFC 6020 in October 2010. The data modeling language can be used to model both configuration data as well as state data of network elements. Furthermore, YANG can be used to define the format of event notifications emitted by network elements and it allows data modelers to define the signature of remote procedure calls that can be invoked on network elements via the NETCONF protocol. The language, being protocol independent, can then be converted into any encoding format, e.g. XML or JSON, that the network configuration protocol supports.
YANG is a modular language representing data structures in an XML tree format. The data modeling language comes with a number of built-in data types. Additional application specific data types can be derived from the built-in data types. More complex reusable data structures can be represented as groupings. YANG data models can use XPATH expressions to define constraints on the elements of a YANG data model.
What are the two most important APIs in network automation, to Cisco at least?
There are multiple different types of APIs. However, the focus of this chapter is on two of the most common APIs: the Northbound and Southbound APIs.
The following sections explain the differences between the two through the lens of network automation.
Figure 28-1 illustrates the basic operations of Northbound and Southbound APIs.