Junos Automation (Scripting)
Highlighted
Junos Automation (Scripting)

Possible to get more and more info from ISIS DB via RPC

‎03-12-2019 11:18 PM

Hi,

 

Im opening new subject related to my previous question about retrived isis database information via rpc.

I have check from the raw output of entry below ..that also have info of address-prefix and from show isis database extensive or using | display xml...more info like IP address, Neighbor IP address, router-id, max-bandwidth

Extended IS Reachability TLV, Type: 22, Length: 99
    IS extended neighbor: r0.00, Metric: default 10 SubTLV len: 88
      IP address: 11.1.1.2
      Neighbor's IP address: 11.1.1.1
      Local interface index: 333, Remote interface index: 342
      Current reservable bandwidth:
        Priority 0 : 1000Mbps
        Priority 1 : 1000Mbps
        Priority 2 : 1000Mbps
        Priority 3 : 1000Mbps
        Priority 4 : 1000Mbps
        Priority 5 : 1000Mbps
        Priority 6 : 1000Mbps
        Priority 7 : 1000Mbps
Maximum reservable bandwidth: 1000Mbps
      Maximum bandwidth: 1000Mbps
      Administrative groups:  0 <none>
P2P IPV6 Adj-SID - Flags:0xf0(F:1,B:1,V:1,L:1,S:0,P:0), Weight:0, Label: 401
      P2P IPv6 Adj-SID:     401, Weight:   0, Flags: FBVL--
      P2P IPV4 Adj-SID - Flags:0x70(F:0,B:1,V:1,L:1,S:0,P:0), Weight:0, Label: 400
      P2P IPv4 Adj-SID:     400, Weight:   0, Flags: -BVL--
    Extended IS Reachability TLV, Type: 22, Length: 144
    IS extended neighbor: r1.06, Metric: default 10 SubTLV len: 133
      IP address: 12.1.1.1
      Local interface index: 336, Remote interface index: 0
      Current reservable bandwidth:
        Priority 0 : 1000Mbps
        Priority 1 : 1000Mbps
        Priority 2 : 1000Mbps
        Priority 3 : 1000Mbps
        Priority 4 : 1000Mbps
        Priority 5 : 1000Mbps
        Priority 6 : 1000Mbps
        Priority 7 : 1000Mbps
      Maximum reservable bandwidth: 1000Mbps
      Maximum bandwidth: 1000Mbps

 

Based on the sample code below I able to get nodes (hostname) and links (local hostname, neighbor hostname, metric).

graph={'nodes': [], 'links': []}

for entry in result.xpath("isis-database[level='2']/isis-database-entry"):
        lspid = entry.findtext("lsp-id")
        node=lspid[:-3]
        if not node.endswith(".00"):
                node="_"+node;
        if not node in graph['nodes']:
                graph['nodes'].append(node)
        for neighbor in entry.xpath("isis-neighbor"):
                neighborid = neighbor.findtext("is-neighbor-id")
                metric = neighbor.findtext("metric")
                topology = neighbor.findtext("isis-topology-id")
                #if topology=="" or topology=="IPV4 Unicast":
                if topology is None:
                   if not neighborid.endswith(".00"):
                        neighborid="_"+neighborid;
                   if not neighborid in graph['nodes']:
                        graph['nodes'].append(neighborid)
                   graph['links'].append([node, neighborid, metric])

Please advise how could i retrieve more info and add those in the code above. Thank you for your attention and your good support.

 

 

3 REPLIES 3
Junos Automation (Scripting)

Re: Possible to get more and more info from ISIS DB via RPC

‎03-13-2019 01:27 AM

Hi jar,

 

Its better you mention what information you're unable to get, so someone could help out.  There's a lot of info for each ISIS database entry.

 

labroot> show isis database extensive | display xml
<rpc-reply xmlns:junos="http://xml.juniper.net/junos/17.3R2/junos">
<isis-database-information xmlns="http://xml.juniper.net/junos/17.3R2/junos-routing" junos:style="extensive">
<isis-database>
<level>1</level>
<isis-database-entry>
<lsp-id>.00-00</lsp-id>
<sequence-number>0xc5</sequence-number>
<checksum>0xaf0c</checksum>
<remaining-lifetime>2173</remaining-lifetime>
<isis-node-segment>
</isis-node-segment>
<isis-neighbor>
<isis-topology-id>IPV6 Unicast</isis-topology-id>
<is-neighbor-id>PDL9104CRT4.PECD.ASR22.03.00</is-neighbor-id>
<metric>10</metric>
<two-way-lsp-id>PDL9104CRT4.PECD.ASR22.03.00-00</two-way-lsp-id>
<firstfrag-lsp-id>PDL9104CRT4.PECD.ASR22.03.00-00</firstfrag-lsp-id>
</isis-neighbor>
<isis-prefix xmlns="http://xml.juniper.net/junos/17.3R2/junos-routing" junos:style="normal">
<protocol-name>IP</protocol-name>
<isis-topology-id>IPV4 Unicast</isis-topology-id>
<address-prefix>0.0.0.0/0</address-prefix>
<metric>0</metric>
<prefix-flag>Internal</prefix-flag>
<prefix-status>up</prefix-status>
</isis-prefix>
<isis-prefix xmlns="http://xml.juniper.net/junos/17.3R2/junos-routing" junos:style="normal">
<protocol-name>IP</protocol-name>
<isis-topology-id>IPV4 Unicast</isis-topology-id>
<address-prefix>11.0.0.0/24</address-prefix>
<metric>10</metric>
<prefix-flag>Internal</prefix-flag>
<prefix-status>up</prefix-status>
</isis-prefix>
<isis-prefix xmlns="http://xml.juniper.net/junos/17.3R2/junos-routing" junos:style="normal">
<protocol-name>IP</protocol-name>
<isis-topology-id>IPV4 Unicast</isis-topology-id>
<address-prefix>100.100.100.0/24</address-prefix>
<metric>0</metric>
<prefix-flag>Internal</prefix-flag>
<prefix-status>up</prefix-status>
</isis-prefix>
<isis-prefix xmlns="http://xml.juniper.net/junos/17.3R2/junos-routing" junos:style="normal">
<protocol-name>V6</protocol-name>
<isis-topology-id>IPV6 Unicast</isis-topology-id>
<address-prefix>2001:558:22:8209::/64</address-prefix>
<metric>10</metric>
<prefix-flag>Internal</prefix-flag>
<prefix-status>up</prefix-status>
</isis-prefix>
<isis-prefix xmlns="http://xml.juniper.net/junos/17.3R2/junos-routing" junos:style="normal">
<protocol-name>V6</protocol-name>
<isis-topology-id>IPV6 Unicast</isis-topology-id>
<address-prefix>2001:dead:beef::10/128</address-prefix>
<metric>0</metric>
<prefix-flag>External</prefix-flag>
<prefix-status>up</prefix-status>
</isis-prefix>
<isis-header>
<lsp-id>.00-00</lsp-id>
<pdu-length>165</pdu-length>
<allocated-length>1492</allocated-length>
<router-id>68.86.2.195</router-id>
<remaining-lifetime>2173</remaining-lifetime>
<level>1</level>
<interface-index>0</interface-index>
<estimated-free-bytes>1277</estimated-free-bytes>
<actual-free-bytes>1327</actual-free-bytes>
<lsdb-timer-type>Aging</lsdb-timer-type>
<lsdb-expiration-time>2173</lsdb-expiration-time>
<protocol>IP, IPv6</protocol>
</isis-header>
<isis-packet>
<lsp-id>.00-00</lsp-id>
<pdu-length>165</pdu-length>
<pdu-lifetime>3998</pdu-lifetime>
<checksum>0xaf0c</checksum>
<sequence-number>0xc5</sequence-number>
<lsp-attributes>0x3 &lt;L1 L2&gt;</lsp-attributes>
<nlp-id>0x83</nlp-id>
<lsp-length>27</lsp-length>
<pdu-version>1</pdu-version>
<system-id-length>0</system-id-length>
<isis-packet-type>18</isis-packet-type>
<packet-version>1</packet-version>
<maximum-area>0</maximum-area>
</isis-packet>
<isis-tlv heading=" TLVs:">
<area-address-tlv>
<address>49.0000</address>
<tlv-length>3</tlv-length>
</area-address-tlv>
<lsp-buffer-size-tlv>
<lsp-buffer-size>1492</lsp-buffer-size>
</lsp-buffer-size-tlv>
<protocols-tlv>
<protocol>Speaks: IP</protocol>
<protocol>Speaks: IPV6</protocol>
</protocols-tlv>
<mt-tlv>
<mtid>Topology: unicast</mtid>
<mtid>Topology: ipv6 unicast</mtid>
</mt-tlv>
<router-id-tlv>
<router-id>68.86.2.195</router-id>
</router-id-tlv>
<ipaddress-tlv>
<address>68.86.2.195</address>
</ipaddress-tlv>
<reachability-tlv heading="IS neighbor:">
<isis-topology-id>IPV6 Unicast</isis-topology-id>
<address-prefix>PDL9104CRT4.PECD.ASR22.03.00</address-prefix>
<metric>10</metric>
</reachability-tlv>
<ip-prefix-tlv heading="IP extended prefix:">
<address-prefix>11.0.0.0/24</address-prefix>
<metric>10</metric>
<prefix-status>up</prefix-status>
</ip-prefix-tlv>
<ipv6-reachability-tlv heading="IPv6 prefix:">
<isis-topology-id>IPV6 Unicast</isis-topology-id>
<ipv6-address>2001:558:22:8209::/64</ipv6-address>
<metric>10</metric>
</ipv6-reachability-tlv>
<ipv6-reachability-tlv heading="IPv6 prefix:">
<isis-topology-id>IPV6 Unicast</isis-topology-id>
<ipv6-address>2001:dead:beef::10/128</ipv6-address>
<metric>0</metric>
<prefix-extern/>
</ipv6-reachability-tlv>
<ip-prefix-tlv heading="IP extended prefix:">
<address-prefix>0.0.0.0/0</address-prefix>
<metric>0</metric>
<prefix-status>up</prefix-status>
</ip-prefix-tlv>
<ip-prefix-tlv heading="IP extended prefix:">
<address-prefix>100.100.100.0/24</address-prefix>
<metric>0</metric>
<prefix-status>up</prefix-status>
</ip-prefix-tlv>
<rtr-capability-tlv heading="Router Capability: ">
<router-id>68.86.2.195</router-id>
<rtr-cap-flags>0x00</rtr-cap-flags>
</rtr-capability-tlv>
<authentication-tlv>
<tlv-length>17</tlv-length>
</authentication-tlv>
</isis-tlv>
<transmission-status>
<message>No queued transmissions</message>
</transmission-status>
</isis-database-entry>

 

Hope this helps.

Regards,
-r.

--------------------------------------------------

If this solves your problem, please mark this post as "Accepted Solution."
Kudos are always appreciated Smiley Happy.

 

Junos Automation (Scripting)

Re: Possible to get more and more info from ISIS DB via RPC

‎03-13-2019 01:59 AM

Hi Sir,

For now i have list of nodes hostname and list of links (hostnames and matric)  and would like to add info of routerid and ipaddress (local and neighbor) and link bandwidth.

 

Info such as below;

1. address-prefix
2. router-id/address
3. maximum bandwidth

 

Perhaps I could have details of nodes and links as below based on the data provided by isis database

Nodes
   hostname: node1
   local ip: 1.1.1.1
   neighbor ip: 1.1.1.2
Links
   source: node1
   destination: node2
matric: 120 bandwidth: 1000Mbps

Appreciate and thank you sir.

Junos Automation (Scripting)

Re: Possible to get more and more info from ISIS DB via RPC

‎03-14-2019 06:26 PM
Hi..im still no luck extract those info...any ideas to do it..thanks