Cisco CCNA (200-301)Automation and ProgrammabilityEasy
A network engineer is troubleshooting an issue where a Python script, designed to retrieve interface status from a Cisco IOS XE device via its RESTCONF API, is failing. The script uses HTTP GET requests to the device's API endpoint. Upon inspecting the device's configuration, the engineer finds that the `restconf` command is present, but no specific port is configured. Which of the following is the most likely reason for the script's failure?
- AThe RESTCONF service is not enabled on the device.
- BThe Python script is attempting to use NETCONF instead of RESTCONF.
- CThe script is using an incorrect authentication method for RESTCONF.
- DThe device's firewall is blocking HTTP GET requests to the RESTCONF port.
Show answer & explanationAnswer & explanation
Correct answer: A. The RESTCONF service is not enabled on the device.
For RESTCONF to be operational on a Cisco IOS XE device, the 'restconf' service must be explicitly enabled. Simply having the 'restconf' command available does not mean it's active and listening for API calls.
Why the other options are wrong
- B. The question explicitly states the script uses RESTCONF via HTTP GET requests, making this option unlikely to be the most likely reason for failure.
- C. While possible, the question implies a foundational issue with service availability, not authentication. Authentication is typically handled after a connection is established.
- D. This is a possibility, but the primary issue in this scenario is implied to be the service itself not being active, as indicated by the 'restconf' command being present but no port configured (implying it's not even listening).
Cisco IOS XE RESTCONF Enablement
To use RESTCONF on a Cisco IOS XE device, the feature must be explicitly enabled in the configuration, typically via the 'restconf' command in global configuration mode.
- Enables interaction with device using RESTful API over HTTP/HTTPS.
- Requires `restconf` command in global config mode.
- Often uses default HTTPS port 443, but can be configured.
- Provides programmatic access to YANG data models.
Memory trick: RESTCONF needs to be 'REST-ing' on the device, not just 'present'.