DevNet Associate (DEVASC) v1.0Infrastructure and AutomationEasy

A network automation script needs to retrieve the running configuration from a Cisco device using NETCONF. The script will then parse this configuration to extract specific interface details. Which Python library is commonly used for interacting with NETCONF-enabled devices and executing operations like retrieving configuration?

  1. Arequests
  2. Bparamiko
  3. Cnetmiko
  4. Dncclient
Show answer & explanation

Correct answer: D. ncclient

ncclient is a Python library specifically designed for interacting with NETCONF-enabled devices. It provides an API to send NETCONF RPCs (like <get-config>) and receive responses, simplifying the automation of configuration retrieval and management.

Why the other options are wrong

  • A. The 'requests' library is used for making HTTP requests, not directly for NETCONF interactions.
  • B. Paramiko is a low-level SSH library, which Netmiko builds upon, but it doesn't provide NETCONF-specific functionalities directly.
  • C. Netmiko is used for SSH-based command-line interaction (screen scraping) with network devices, not for structured NETCONF calls.

ncclient Python Library

ncclient is a Python library that provides an easy-to-use API for client-side interactions with NETCONF servers. It handles the underlying XML-based communication, allowing developers to focus on the NETCONF operations and data.

  • Python library for NETCONF
  • Simplifies RPC creation and parsing
  • Handles XML encoding/decoding
  • Supports various NETCONF operations (get, get-config, edit-config)
  • Widely used for network automation with NETCONF

Memory trick: NCClient: Network Config Client, the Python NETCONF gem.

More Infrastructure and Automation questions