200-901 · Question #617
Refer to the exhibit. A network engineer is creating a Python script to programmatically save network device configurations. Which code snippet must be placed onto the blank in the code?
The correct answer is C. restconf. The Python script uses RESTCONF to programmatically communicate with network devices via HTTP-based REST calls, saving device configurations through standard HTTP methods against YANG-modeled data.
Question
Refer to the exhibit. A network engineer is creating a Python script to programmatically save network device configurations. Which code snippet must be placed onto the blank in the code?
Exhibit
Options
- Aself.save
- B{self.headers}
- Crestconf
- Dnetconf
How the community answered
(27 responses)- A7% (2)
- B4% (1)
- C89% (24)
Why each option
The Python script uses RESTCONF to programmatically communicate with network devices via HTTP-based REST calls, saving device configurations through standard HTTP methods against YANG-modeled data.
self.save is not a recognized protocol identifier or URL path component - it references a Python instance method name and has no meaning in the context of constructing a RESTCONF or NETCONF request URL.
{{self.headers}} is a Jinja2-style template placeholder for HTTP request headers, not a protocol path segment - headers are passed as a separate parameter to the HTTP request function, not embedded in the URL.
RESTCONF is an HTTP-based protocol that provides a RESTful interface to YANG-modeled network data, using standard HTTP methods such as GET, PUT, POST, and PATCH. In Python scripts targeting Cisco IOS-XE or similar devices, the URL path includes '/restconf/data/' to access and modify configuration datastores. Placing 'restconf' in the blank correctly constructs the API path used by the requests library to reach the device's configuration endpoints.
NETCONF uses XML-encoded RPCs transported over SSH on port 830, requiring the ncclient library and a completely different code structure than an HTTP-based REST call, so it cannot be substituted into a REST URL path.
Concept tested: RESTCONF API path construction in Python scripts
Source: https://developer.cisco.com/docs/restconf/
Topics
Community Discussion
No community discussion yet for this question.
