Tag Archives: Python

Based on the output below, which Python code shows the value of the “upTime” key?

A. json_data = response.json() print(json_data[‘response’][0][‘upTime’]) B. json_data = response.json() print(json_data[response][0][upTime]) C. json_data = json.loads(response.text) print(json_data[‘response’][‘family’][‘upTime’]) D. json_data = response.json() print(json_data[‘response’][family][‘upTime’]) Answer: Option C. Explanation:  No answer description available for this question Show AnswerDiscussion The post Based on the output below, which Python code shows the value of the “upTime” key? appeared first on Majanto.

Which outcome is achieved with this Python code? client.connect (ip, port= 22, username= usr, password= pswd ) stdin, stdout, stderr = client.exec_command ( ‘show ip bgp 192.168.101.0 bestpathn ‘ ) print (stdout)

A. connects to a Cisco device using SSH and exports the BGP table for the prefix B. displays the output of the show command in a formatted way C. connects to a Cisco device using SSH and exports the routing table information D. connects to a Cisco device using Telnet and exports the routing table information Answer: Option… Read More »

Which line must be added in the Python function to return the JSON object {“cat_9k”: “FXS1932Q2SE”}?

A. return (json.dumps({d[‘hostname’]: dfserialNumber’] for d in json.loads(testJsonX’response’]})) B. return (json.dumps({for d in json.loads(testjson)[‘respcnse’]: d[‘hostname’]: dfserialNumber’]})) C. return (json.loads({d[‘hostname’]: d[‘serialNumber’] for c in json.dumps(test_json)[‘response’})) D. return (json.loads({for d in json.dumps(testjson)[‘respcnse’]: d[‘hostname’]: dfserialNumber’]})) Answer: Option D. Explanation:  No answer description available for this question Show AnswerDiscussion The post Which line must be added in the Python function to return… Read More »

Which code results in the working Python script displaying a list of network devices from the Cisco DNA Center?

Refer to the exhibit. Which code results in the working Python script displaying a list of network devices from the Cisco DNA Center? A. network_device_list(dnac[“host”], dnac[“username”],dnac[“password”]) login = dnac_login(dnac) print(dnac_devices) B. login = dnac_login(dnac[“host”], dnac[“username”], dnac[“password”]) network_device_list(dnac, login) print(dnac_devices) C. login = dnac_login(dnac[“host”], dnac[“username”], dnac[“password”]) network_device_list(dnac, login) for item in dnac_devices: print(dnac_devices.item) D. network_device_list(dnac[“host”], dnac[“username”], dnac[“password”]) login =… Read More »

An engineer plans to use Python to convert text files that contain device information to JSON Drag and drop the code snippets from the bottom onto the blanks in the code to construct the request. Not all options are used.

An engineer plans to use Python to convert text files that contain device information to JSON Drag and drop the code snippets from the bottom onto the blanks in the code to construct the request. Not all options are used. Select and Place: Answer: Explanation:  No answer description available for this question Show AnswerDiscussion The post An engineer… Read More »

Which two Python libraries are used to write a script to retrieve network device information using RESTCONF? (Choose two.)

A. PySNMP B. requests C. ncclient D. YANG E. json Answer: Option B, E. Explanation:  No answer description available for this question Show AnswerDiscussion The post Which two Python libraries are used to write a script to retrieve network device information using RESTCONF? (Choose two.) appeared first on Majanto.

An engineer is deploying a Python script to manage network devices through SSH. Which library based on Paramiko is used?

A. sshmiko B. paramiko.agent C. libssh2 D. netmiko Answer: Option D. Explanation:  Reference: https://pynet.twb-tech.com/blog/automation/netmiko.html Show AnswerDiscussion The post An engineer is deploying a Python script to manage network devices through SSH. Which library based on Paramiko is used? appeared first on Majanto.

A Python script is created to add a new device on Cisco NSO using RESTCONF API. The device is added successfully, but a 405 Method Not Allowed RESTCONF error code has received as the line to fetch SSH keys runs. Which code is missing to complete the script?

Refer to the exhibit. A Python script is created to add a new device on Cisco NSO using RESTCONF API. The device is added successfully, but a 405 Method Not Allowed RESTCONF error code has received as the line to fetch SSH keys runs. Which code is missing to complete the script? A. response = requests.put(baseUriOperation + “/devices/device=ios-device/ssh/fetch-host-keys”,… Read More »

The automation engineer must replace device configuration using RESTCONF. How is this configured using the Python library Requests?

A. delete() B. post() C. put() D. patch() Answer: Option C. Explanation:  Reference: https://www.cisco.com/c/en/us/td/docs/ios-xml/ios/prog/configuration/166/b_166_programmability_cg/restconf_prog_int.html Show AnswerDiscussion The post The automation engineer must replace device configuration using RESTCONF. How is this configured using the Python library Requests? appeared first on Majanto.

Cisco SD-WAN deployment must be troubleshooted using vManage APIs. A call to vEdge Hardware Health API returns the data in the exhibit (only a portion is shown). If this JSON is converted to a Python dictionary and assigned to the variable “d”, how the status is accessed that is indicated on line 16?

Refer to the exhibit. Cisco SD-WAN deployment must be troubleshooted using vManage APIs. A call to vEdge Hardware Health API returns the data in the exhibit (only a portion is shown). If this JSON is converted to a Python dictionary and assigned to the variable “d”, how the status is accessed that is indicated on line 16? A.… Read More »