cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
926
Views
0
Helpful
1
Replies

Netconf - How to get Interface Statistics?

NetDevOp
Beginner
Beginner

I can't seem to get interface statistics from IOS XR devices... I've tried a few different filters but the only result is null.

 

 

A similar method to get NTP status works.

 

Here is the python code:

from ncclient import manager
import xmltodict
import json

ncm = manager.connect(host='10.10.10.1', port=830, username='cisco',
password='cisco123', device_params={'name': 'iosxr'}, timeout=100)



print(ncm.connected)



vf = """

<filter type="subtree">
<interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
<interfaces-state>
</interfaces-state>
</interfaces>
</filter>"""


software_data = ncm.get(vf)

software_json = xmltodict.parse(str(software_data))

print(json.dumps(software_json['rpc-reply'], indent=2))

I've also tried filters using ifoper-mgr, like this:

vf = """
<filter type="subtree">
 <ifmgr-oper xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ifmgr-oper">
  <interface-properties> 
   <data-nodes/>
  </interface-properties>
 </ifmgr-oper>
</filter>
""" 

 

1 REPLY 1

alexstev
Cisco Employee
Cisco Employee

 

Hello @NetDevOp,

 

I want to make sure you're aware of the following free resource on DevNet:

 

 

 

 

With these IOS XR Sandboxes, you can 'test drive APIs at every layer of the IOS XR network stack from model-driven YANG manageability APIs and ZTP hooks for CLI automation to highly performant Service-Layer APIs at the infrastructure layer – all just a click away. This sandbox provides access to two IOS XRv9000 instances along with a development environment (devbox) to install and utilize tools of your choice to interact with IOS XR.'

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: