01-17-2019 03:58 PM
Hello, I have been trying to get my head around using NETCONF/YANG with IOS-XE. I am particularly interested in polling data. I have enabled Cisco ODM on my device and I show polling is set up. My question is, how to I get to this data via a RPC call? I cannot find any examples anywhere.
They documentation states this: After operational data polling is enabled, send a <get> RPC to obtain the operational data. Use the parser-to-YANG model mapping to determine which operational YANG model should be used to retrieve the operational data.
I am unsure what or how to use a parser-to-YANG model mapping. Any tips would be appreciated.
Thanks
Dave P
01-18-2019 09:57 AM
This doesn't directly answer your question, but I would recommend using yang-explorer to find out the rpc message being sent to the router. This will help you understand how to translate that to python code etc later on if you are writing a script.
i'm assuming you have a yang file that models the information you are trying to query, load up the yang file to
yang-explorer, then generate/send an rpc call from yang explorer to any endpoint running IOS XE.
i found it to be very helpful, below is the install link.
https://github.com/CiscoDevNet/yang-explorer
01-18-2019 02:27 PM
Thanks. I have been using Yang-Explorer. Unfortunately I haven't had a lot of luck yet. I just get back empty data sets. ODM polling is enabled and i can get a list of what it is polling, just not sure how to get that stats.
01-22-2019 10:54 AM
Just to follow up. I believe I figured out the RPC call for the information I am trying to get. The switches just do not return any data. I am trying to get the mac-address-table. I have verified polling is enabled for this parser. I have tried on 2 different platforms: 4500-X running 3.9.2 and a 3650-X running 16.3.6.
Below is the RPC-GET and the reply
<rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<get>
<filter>
<mac-address-table xmlns="urn:cisco:params:xml:ns:yang:cisco-mac-address-table"/>
</filter>
</get>
</rpc>
REPLY:
rpc-reply message-id="urn:uuid:666d06ae-aaa1-4bb4-b526-501a148fc088" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
<data/>
</rpc-reply>
01-22-2019 05:32 PM
did you configure these commands on the switches ?
configure terminal
netconf-yang cisco-odm polling-enable
netconf-yang cisco-odm actions "insert operation name"
mode poll
01-23-2019 09:36 AM
Yes. Here is the running config on my switch. Getting the interface-state works, but not LLDP-state or the mac-address-table
netconf-yang cisco-odm actions parse.showInterfaces
polling-interval 12000
netconf-yang cisco-odm actions parse.showMacAddTable
polling-interval 12000
netconf-yang cisco-odm actions parse.showLLDPneighbors
polling-interval 12000
netconf-yang cisco-odm polling-enable
netconf-yang
01-23-2019 02:09 PM
yeah, i getting the same result. when sending mac-address-table RPC.
testing on IOS XE 16.6 and ISR 4431
what yang model are you using ? to generate this RPC call
<rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<get>
<filter>
<mac-address-table xmlns="urn:cisco:params:xml:ns:yang:cisco-mac-address-table"/>
</filter>
</get>
</rpc>
01-24-2019 09:17 AM
01-24-2019 10:44 AM
can you try using Cisco-IOS-XE-lldp-oper model
you can find it in the yangModels repo, download and unzip
https://github.com/YangModels/yang
under vendor/cisco/xe and pick version folder
see if you have any luck with that model in getting lldap information.
01-24-2019 11:14 AM
Same empty reply.
<rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<get>
<filter>
<lldp-entries xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-lldp-oper"/>
</filter>
</get>
</rpc>
<rpc-reply message-id="urn:uuid:2d67366f-d927-48d2-a375-8c8a6354c067" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
<data/>
</rpc-reply>
01-28-2019 07:45 AM
I don't know what to try out next to be honest. I'm also new with using the yang models etc.
01-29-2019 04:21 PM
Thanks for the help. I don't think getting state info from a device is 100% there yet.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide