nerdexam
Cisco

300-435 · Question #35

Refer to the exhibit. An engineer creates a Python scripts using ncclient to display interface information. The code must be completed so that it can be tested. Which expression completes the…

The correct answer is B. intf_config. Assuming the intf variable is a dictionary representing a single interface, and its state is stored under a key literally named intf_config, then intf['intf_config'] would retrieve the state.

Device-Level Network Automation

Question

Refer to the exhibit. An engineer creates a Python scripts using ncclient to display interface information. The code must be completed so that it can be tested. Which expression completes the highlighted section in the format call?

Options

  • Aintf_info
  • Bintf_config
  • Cintf_get
  • Dintf_config[0]

How the community answered

(31 responses)
  • A
    3% (1)
  • B
    87% (27)
  • C
    3% (1)
  • D
    6% (2)

Why each option

Assuming the `intf` variable is a dictionary representing a single interface, and its state is stored under a key literally named `intf_config`, then `intf['intf_config']` would retrieve the state.

Aintf_info

`intf_info` is not a standard key name for interface state within a dictionary parsed from NETCONF data, making it an unlikely completion.

Bintf_configCorrect

Given the Python format call `state=intf[?]`, if the dictionary `intf` (representing a single interface) contains a key named `intf_config` whose value is the operational state, then `intf['intf_config']` correctly completes the expression.

Cintf_get

`intf_get` is not a standard key name for interface state within a dictionary parsed from NETCONF data; it more closely resembles a variable name for a retrieval operation.

Dintf_config[0]

`intf_config[0]` refers to the first element of a variable named `intf_config` and cannot be a key used to access a value within the `intf` dictionary itself.

Concept tested: Python dictionary access for NETCONF parsed data

Topics

#ncclient#NETCONF#Python scripting#Network programmability

Community Discussion

No community discussion yet for this question.

Full 300-435 Practice