nerdexam
Cisco

350-501 · Question #414

Refer to the exhibit. To optimize network operations, the senior architect created this Python 3.9 script for network automation tasks and to leverage Ansible 4.0 playbooks. Devices in the network…

The correct answer is B. The script leverages REST API calls and configures interface GigabitEthernet0/1 with IP address. The Python script is designed to leverage RESTCONF API calls with Basic Authentication to configure interface GigabitEthernet0/1 on a network device with a specific IP address and netmask.

Automation and Assurance

Question

Refer to the exhibit. To optimize network operations, the senior architect created this Python 3.9 script for network automation tasks and to leverage Ansible 4.0 playbooks. Devices in the network support only RFC 2617-based authentication. What does the script do?

Exhibit

350-501 question #414 exhibit

Options

  • AThe script performs a configuration sanity check on the device with IP address 172.168.211.65
  • BThe script leverages REST API calls and configures interface GigabitEthernet0/1 with IP address
  • CThe script parses the JSON response from the router at IP address 172.168 211.65 and checks if
  • DThe script logs in via SSH and configures interface GigabitEthernet0/1 with IP address 10

How the community answered

(59 responses)
  • A
    3% (2)
  • B
    71% (42)
  • C
    8% (5)
  • D
    17% (10)

Why each option

The Python script is designed to leverage RESTCONF API calls with Basic Authentication to configure interface GigabitEthernet0/1 on a network device with a specific IP address and netmask.

AThe script performs a configuration sanity check on the device with IP address 172.168.211.65

The script is clearly building a configuration payload for an interface, not performing a 'sanity check,' which would typically involve retrieving data and validating it.

BThe script leverages REST API calls and configures interface GigabitEthernet0/1 with IP addressCorrect

The script's url points to a RESTCONF endpoint (/restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet0%2F1) for configuring an interface, and the payload contains a JSON structure that specifies the IP address 10.10.10.1/24 for GigabitEthernet0/1. The Authorization: Basic header with a Base64 encoded username/password indicates it uses REST API calls with RFC 2617-based authentication to configure the interface.

CThe script parses the JSON response from the router at IP address 172.168 211.65 and checks if

While the script uses JSON, it's constructing a configuration payload to send, not primarily parsing a JSON response to check a condition.

DThe script logs in via SSH and configures interface GigabitEthernet0/1 with IP address 10

The url clearly indicates a RESTCONF API endpoint (HTTP/HTTPS), not an SSH connection, and the payload is JSON for an interface configuration, not commands to be sent over SSH.

Concept tested: RESTCONF for network device configuration

Source: https://www.cisco.com/c/en/us/td/docs/ios-xml/ios/prog/configuration/1612/b_programmability_1612_cg/restconf_support.html

Topics

#Network Automation#REST API#HTTP Basic Authentication#Python Scripting

Community Discussion

No community discussion yet for this question.

Full 350-501 Practice