Using NETCONF and ncclient to retrieve the running configuration
So far, we have only established a connection to our device, but we have not actually retrieved any configuration data. This is about to change in this recipe. Using NETCONF and ncclient
, we are now going to establish a connection to our network device and retrieve the currently running configuration. This configuration will be in the form of an XML file that represents the running configuration of our device according to the format defined in the YANG modules for our device.
Getting ready
Open your code editor and create a file called get_running.py
. Next, in your Terminal, navigate to the same directory that you just created the get_running.py
file in.
You'll also need the login information of a networking device that supports the NETCONF protocol.
How to do it…
To establish a connection to your device and retrieve the currently running configuration in XML format, follow these steps:
- ...