Thursday, August 16, 2018

Struggling to get structured XML output from network devices

I have been working with NETCONF for most of the day, and despite my most sincere efforts I cannot seem to get a simple show command to work. I have started working with ncclient which is a python library for NETCONF.

I have been trying to connect to a Cisco CMTS (CBR8) running IOS-XE, with unfortunately does not seem to support the newest iteration of Cisco's API, just the old NETCONF. (Frustrating!)

m = manager.connect(host='10.0.0.1', port=22, username='admin', password='admin', hostkey_verify=False, device_params={'name':'iosxe'}) >>> for c in m.server_capabilities: ... print c ... urn:ietf:params:netconf:capability:url:1.0 urn:cisco:params:netconf:capability:pi-data-model:1.0 urn:ietf:params:netconf:base:1.0 urn:ietf:params:netconf:capability:startup:1.0 urn:cisco:params:netconf:capability:notification:1.0 urn:ietf:params:netconf:capability:writeable-running:1.0 >>> c = m.dispatch('show inventory') Traceback (most recent call last): <removed for brevity> ValueError: Invalid tag name u'show inventory' 

I am not sure what I should be doing here I have been googling for an hour and I am just not putting it together.

Do you guys have any better strategies for this? I am determined not to resort to screen scrapes and ugly regex in 2018. 'tis the era of the API surely there is something better!!



No comments:

Post a Comment