Quick and dirty NETCONF python scripts

Started by wintermute000, May 29, 2018, 03:52:46 AM

Previous topic - Next topic

wintermute000




https://github.com/wintermute000/csr-netconf-config


NETCONF python scripts to get and edit config - tested on CSR1000V IOS-XE 16.5+


csr-netconf-get-config.py
csr-netconf-edit-config
requires: ncclient



csr-netconf-get-config.py:
Usage
Uses ncclient to connect and pull raw NETCONF XML configuration using get-config operation.
Raw output saved to [hostname].config.xml - includes full NETCONF XML wrappers ( etc.)
Use parameter to input the XML filter - defaults to "< native > < /native >" as per IOS-XE native YANG model



csr-netconf-edit-config.py:
Usage
Uses ncclient to connect and edit NETCONF XML configuration using edit-config operation.
Builds proper NETCONF payload by wrapping "config" tag around input XML
Use parameter to input the appropriate tag that includes the appropriate input XML element - e.g. use 'native' for IOS-XE native YANG model container - do this if you only want to send a sub-section (tag) of a larger XML configuration