How to retrieve the interface configuration
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2016 07:25 PM
How to retrieve the interface configuration??
I saw the "nc-read-xr-ifmgr-cfg-11-ydk.py", the process is just "pass"
def process_interface_configurations(interface_configurations):
"""Process data in interface_configurations object."""
pass
I tried to modified a bit but I got the response "None".
def process_interface_configurations(interface_configurations):
"""Process data in interface_configurations object."""
int=interface_configurations.InterfaceConfiguration()
print ('interface name: ',int.interface_name)
I believe it should be a list of configuration... but don't know how it should be...
any sample can be reference???
Thanks a lot!!
- Labels:
-
YANG Development Kit (YDK)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2017 06:59 AM
Hey Anton,
Unfortunately, I do not have IOS-XR. I uploaded my sample script at https://github.com/snakeskinsalamander/Netconf-example just in case. It is using an always-on XE on devnet sandbox though. I think it would work, or at least it would be the same concept.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2017 07:08 AM
Hey Anton... you can play around with the details of the 'omg' variable used by the filter... but this is as simple as I could make a call to get interface information into an XML output using Python and the ncclient.
#!/usr/bin/env python
import sys
from ncclient import manager
from lxml import etree
if __name__ == '__main__':
omg = '<interface-configurations xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ifmgr-cfg"/>'
m = manager.connect(host="my.router.com",
port="830",
username="me",
password="password",
device_params={'name':"csr"})
data = m.get_config("running",'<filter>'+omg+'</filter>')
print etree.tostring(etree.fromstring(data.xml), pretty_print=True)
I took this right from the #10 example above.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2017 05:58 AM
Hi guys thanks a lot for your reply. Sharing with you bgp oper filter which is working for me. It takes just VRF names, networks and route targets from bgp instance. I am using it as "subtree" filter with single tag when I am interesting to get some information from device.Do you happen to know if there is another syntax/functionality for the filtering? I know there is also xpath possibility but seems IOXR doesnt support xpath capability on 6.1.2 version
filter = '''<bgp xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ipv4-bgp-oper">
<instances>
<instance>
<instance-name>default</instance-name>
<instance-active>
<vrfs>
<vrf>
<vrf-name/>
<afs>
<af>
<af-name>ipv4-unicast</af-name>
<networks>
<network>
<network/>
<local-process-instance-path>
<attributes-after-policy-in>
<common-attributes>
<extended-community/>
</common-attributes>
</attributes-after-policy-in>
</local-process-instance-path>
</network>
</networks>
</af>
</afs>
</vrf>
</vrfs>
</instance-active>
</instance>
</instances>
</bgp>
'''
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2017 06:04 AM
Anton,
When dealing with netconf/yang on IOS-XR, subtree filtering is the only query syntax supported. No timelines for support of XPath filtering at this time, and no other standardised alternative.
Cheers,
Einar

- « Previous
-
- 1
- 2
- Next »