cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1011
Views
6
Helpful
5
Replies

how to obtain route tags via Netconf/YANG from IOS-XE box?

Hi, I have an ASR903 with IOS XE 17.06.03.

I am trying to find the nearest router that is advertising its loopback to ISIS with a specific route tag.

So far I can read the route-table via the ietf-routing module, but the output does not include tags. The ISIS libraries do not include routes other than configuration of static routes and connected interfaces, or I don't see that.

Will someone give me a hand? Thanks!

edit - CLI equivalent of what I am looking for: sh ip route tag 490001

 

5 Replies 5

Marcel Zehnder
Spotlight
Spotlight

Hi

This should be possible via native XE module.

tag.png

Query prefix by tag (1984):

 

with manager.connect(host=host, username=username, password=password, hostkey_verify=False) as m:
    reply = m.get(filter=("xpath", "/native/ip/route/ip-route-interface-forwarding-list/fwd-list[tag=1984]"))
    pp(reply.data_xml)

 

Result

 

<?xml version="1.0" encoding="UTF-8"?>
<data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
  <native xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-native">
    <ip>
      <route>
        <ip-route-interface-forwarding-list>
          <prefix>9.9.9.9</prefix>
          <mask>255.255.255.255</mask>
          <fwd-list>
            <fwd>10.90.255.1</fwd>
            <tag>1984</tag>
          </fwd-list>
        </ip-route-interface-forwarding-list>
      </route>
    </ip>
  </native>
</data>

 

Not 100% sure, if it's exactly what your looking for, but I hope it helps as a starting point.

Marcel, thanks a lot.

I should have maybe written clearer that I am looking for the state information, find a route from current RIB. What you wrote me is from the configuration of the box.

CLI equivalent to my request is: sh ip route tag 490001

Anyway, since we're at the "native" library, would you say it is a good way of configuring things? That I create one request to configure many things because thanks to this native library, all things have a common root? Is there a best practice here for IOS-XE?

E.g. for IOS-XR they say that there are old libraries and new libraries marked as "-um-" which stands for unified data models...

Sorry, that was kind of a hasty answer - it would actually be clear what you are looking for. I checked again the modules and didn't find a match for operstate route tag info.

Regarding the "native" library: In a perfect world we would use only IETF and openconfig modules, this would result in vendor neutral code - however in real-life it's often easier to use vendor modules. I go with a "whatever it takes" approach and use a mix of the native, IETF, openconfig modules depending on the use/business case - however, that's my personal opinion and no official best practices recommendation.

Follow-up: There is a draft (proposed standard) published regarding this topic: https://datatracker.ietf.org/doc/draft-ietf-rtgwg-yang-rib-extend/

 

Thank you for your answers. I appreciate that I could run this through another live and experienced person and I am hopefully not overlooking a simple solution. I will go with CLI if someone else doesn't find a solution. But this is not preferrable because I am planning - and I will try hard - to do the actual configuration over Netconf, just the fact collection part will include CLI...