cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
4762
Views
0
Helpful
11
Replies

NETCONF operational data example

Dave Phillips
Level 1
Level 1

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 

11 Replies 11

Mamdouh Elgamal
Level 1
Level 1

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

 

 

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.

 

 

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>

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
 

 

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

 

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>

I am using the cisco-mac-address-table yang model.  I had to pull it off the switch as is doesn't seem to be available in the repos.

 

I am also using cisco-lldp-state for the lldp model.

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.

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>

I don't know what to try out next to be honest. I'm also new with using the yang models etc.

Thanks for the help.  I don't think getting state info from a device is 100% there yet.

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: