Ch 28: Foundational Network Programmability Concepts Flashcards

1
Q

T/F: Python is considered one of the most difficult programming languages to learn and adopt.

A

False.

Python is one of the easier programming languages to learn and adopt.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

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

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does CRUD stand for?

  1. CREATE, RESTORE, UPDATE, DELETE
  2. CREATE, READ, UPDATE, DELETE
  3. CREATE, RETRIEVE, UPDATE, DELETE
  4. CREATE, RECEIVE, UPLOAD, DOWNLOAD
  5. CREATE, RECEIVE, UPLOAD, DELETE
A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

When using the Cisco vManage Authentication API, what is the Headers Content- Type that is used?

  1. MD5
  2. X-Auth-Token
  3. SSH
  4. x-www-form-urlencoded
  5. JSON
A

4.

Cisco vManage uses the Headers Content-Type x-www-form-urlencoded.

X-Auth-Token is for Cisco DNA Center.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

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.

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the HTTP status code for Unauthorized?

a. 201
b. 400
c. 401
d. 403
e. 404

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

In Python, why would you use three quotation marks in a row? (Choose two.)

  1. To begin a multiple-line string
  2. To start a function
  3. To represent a logical OR
  4. To end a multiple-line string
  5. To call a reusable line of code
A

1 and 4.

Python uses quotation marks in a row to begin and end a multiple-line string, such as for a long comment.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

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

A.

Python uses curly braces ({}) as one way to signify a dictionary.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

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)

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

When using the Cisco DNA Center Token API, what authentication method is used?

  1. MD5
  2. X-Auth-Token
  3. SSH
  4. Basic authentication
  5. JSON
A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the DevNet Community page used for? (Choose two.)

  1. To ask questions
  2. To exchange code
  3. To access learning labs
  4. To access DevNet ambassadors and evangelists
  5. To get news on local DevNet events
A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

When using GitHub, what is the purpose of a repository? (Choose three.)

  1. Provides a place to store a developer’s code
  2. Provides a place to store music and photos
  3. Gives the option to share a developer’s code with other users
  4. Provides documentation on code examples
  5. Offers a sandbox to test custom code
A

A, C, and D.

GitHub is a place to store and share code with other developers as well as provide documentation for that code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Why is using the command-line interface (CLI) to configure a large number of devices considered difficult to scale? (Choose two.)

  1. The CLI is prone to human error and misconfiguration.
  2. The CLI is quick and efficient for configuring many devices simultaneously.
  3. Telnet access to the CLI is best practice.
  4. The command line is used on a device-by-device basis.
  5. Using APIs is considered a legacy method of configuration.
A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Which of the following are part of the YANG model? (Choose two.)

a. Type
b. Leaf
c. Container
d. String
e. Method

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are the two most important APIs in network automation, to Cisco at least?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Typically, when a network operator logs into a controller to manage the network, the information that is being passed from the management software is leveraging a _______________ API.

A

Typically, when a network operator logs into a controller to manage the network, the information that is being passed from the management software is leveraging a Northbound REST-based API.

17
Q

If a network operator makes a change to a switch’s configuration in the management software of the controller, those changes are then pushed down to the individual devices by using a ____________ API.

A

If a network operator makes a change to a switch’s configuration in the management software of the controller, those changes are then pushed down to the individual devices by using a Southbound API.

These devices can be routers, switches, or even wireless access points.

18
Q

What is a RESTful API?

A

Representational State Transfer (REST) APIs

An API that uses REST is often referred to a RESTful API.

RESTful APIs use HTTP methods to gather and manipulate data. Because there is a defined structure for how HTTP works, it offers a consistent way to interact with APIs from multiple vendors. REST uses different HTTP functions to interact with the data. Table 28-3 lists some of the most common HTTP functions and their associated use cases.

19
Q

What are the functions of these HTTP methods?

  1. GET
  2. POST
  3. PUT
  4. PATCH
  5. DELETE
A

See attached table.

20
Q

What are the CRUD functions?

A

HTTP functions are similar to the functions that most applications or databases use to store or alter data—whether the data is stored in a database or within the application. These functions are called “CRUD” functions. CRUD is an acronym that stands for CREATE, READ, UPDATE, and DELETE. For example, in a SQL database, the CRUD functions are used to interact with or manipulate the data stored in the database.

Table 28-4 lists the CRUD functions and their associated actions and use cases.

21
Q

What is XML?

A

Extensible Markup Language (XML). This format may look familiar, as it is the same format that is commonly used when constructing web services. XML is a tag-based language, and a tag must begin with a < symbol and end with a > symbol. For example, a start tag named interface would be represented as <interface>.</interface>

Another XML rule is that a section that is started must also be ended. So, if a start tag is called <interface>, the section needs to be closed by using an accompanying end tag. The end tag must be the same as the string of the start tag preceded by /. For example, the end tag for <interface> would be </interface>. Inside the start tag and end tag, you can use different code and parameters.</interface>

Example 28-1 shows a snippet of XML output with both start and end tags as well as some configuration parameters.

22
Q

What is JSON?

A

JavaScript Object Notation (JSON). Although JSON has not been around as long as XML, it is taking the industry by storm, and some say that it will soon replace XML. The reason this data format is gaining popularity is that it can be argued that JSON is much easier to work with than XML.

It is simple to read and create, and the way the data is structured is much cleaner. JSON stores all its information in key/value pairs.

As with XML, JSON is easier to read if the data is indented. However, even without indentation, JSON is extremely easy to read. As the name suggests, JSON uses objects for its format. Each JSON object starts with a { and ends with a }. (These are commonly referred to as curly braces.)

Example 28-3 shows how JSON can be used to represent the same username example shown for XML in Example 28-1. You can see that it has four separate key/value pairs, one for each user’s name.

23
Q

What are the following HTTP status codes?

  1. 200
  2. 201
  3. 400
  4. 401
  5. 403
  6. 404
A

See attached diagram.

24
Q

The Cisco DNA Center controller expects all incoming data from the REST API to be in _______ format.

A

The Cisco DNA Center controller expects all incoming data from the REST API to be in JSON format.

25
Q

The _____________ function is used to send the credentials to the Cisco DNA Center controller.

A

The HTTP POST function is used to send the credentials to the Cisco DNA Center controller.

26
Q

What does the vManage controller issue commands to?

A

Cisco SD-WAN (specifically, the vManage controller is the API interface)

27
Q

See attached image. What is the meaning of this block of code? What language is it written in?

A

This is YANG.

The YANG model in Example 28-6 can be read as follows: There is a list of interfaces. Of the available interfaces, there is a specific interface that has three configurable speeds. Those speeds are 10 Mbps, 100 Mbps, and auto, as listed in the leaf named speed.

The leaf named observed-speed cannot be configured due to the config false command. This is because as the leaf is named, the speeds in this leaf are what was auto-detected (observed); hence, it is not a configurable leaf. This is because it represents the auto-detected value on the interface, not a configurable value.

28
Q

What is SOAP?

A

SOAP, or the Simple Object Access Protocol is a protocol used by Web services to communicate. SOAP uses XML to encode a message.

SOAP is a lightweight protocol intended for exchanging structured information in a decentralized, distributed environment. SOAP uses XML technologies to define an extensible messaging framework, which provides a message construct that can be exchanged over a variety of underlying protocols. The underlying application-layer protocols used are for transport, and content negotiation -for example HTTP and Remote procedure call. The most common combination is to use SOAP with HTTP and TCP.

The framework has been designed to be independent of any particular programming model and other implementation specific semantics.

29
Q

What is NETCONF?

A

NETCONF, defined in RFC 4741 and RFC 6241, is an IETF standard protocol that uses the YANG data models to communicate with the various devices on the network.

NETCONF usually runs over SSH, TLS. Some of the key differences between SNMP and NETCONF are listed in Table 28-6. One of the most important differences is that SNMP can’t distinguish between configuration data and operational data, but NETCONF can.

Another key differentiator is that NETCONF uses paths to describe resources, whereas SNMP uses object identifiers (OIDs). A NETCONF path can be similar to interfaces/interface/eth0, which is much more descriptive than what you would expect from SNMP. The following is a list of some of the common use cases for NETCONF:

  • Collecting the status of specific fields
  • Changing the configuration of specific fields
  • Taking administrative actions
  • Sending event notifications
  • Backing up and restoring configurations
  • Testing configurations before finalizing the transaction
30
Q

T/F: Confguration changes in NETCONF are all or nothing.

A

True.

Transactions indeed are all or nothing. There is no order of operations transaction. This means there is no part of the configuration that is done first; the configuration is deployed all at the same time. Transactions are processed in the same order every time on every device.

Transactions, when deployed, run in a parallel state and do not have any impact on each other. Parallel transactions touching different areas of the configuration on a device do not overwrite or interfere with each other. They also do not impact each other if the same transaction is run against multiple devices.

31
Q

Example 28-7 provides an example of a NETCONF element from RFC 4741. What does this NETCONF output read as?

A

Example 28-7 provides an example of a NETCONF element from RFC 4741. This NETCONF output can be read as follows: There is an XML list of users named users. In that list, there are individual users named Dave, Rafael, and Dirk.