cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
703
Views
3
Helpful
9
Replies

Netconf query timeout when querying prefixes in vrf

nkhambal10
Level 1
Level 1

Hi,

Running this query results in a timeout. I queried with or without neighbor element, however, results are the same. Any workaround to not time out? Route scale is about 12K routes inside the VRF table.

Neighbors Configured: 6 Established: 5

Address-Family Prefixes Paths PathElem Prefix Path PathElem
Memory Memory Memory
IPv4 Unicast 12609 24999 12609 1.78MB 2.10MB 1.29MB
Imported 24171 2.03MB
IPv6 Unicast 12883 26808 12883 1.97MB 2.25MB 1.31MB
Imported 24769 2.08MB
------------------------------------------------------------------------------
Total 25492 51807 25492 3.75MB 4.35MB 2.60MB
 <filter>
<bgp xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ipv4-bgp-oper">
<instances>
<instance>
<instance-active>
<vrfs>
<vrf>
<vrf-name>XXXVRF</vrf-name>
<afs>
<af>
<af-name>ipv4-unicast</af-name>
<networks/>
</af>
</afs>
<neighbors>
<neighbor>
<neighbor-address>XXX.0.20.193</neighbor-address>
</neighbor>
</neighbors>
</vrf>
</vrfs>
</instance-active>
</instance>
</instances>
</bgp>
</filter>
9 Replies 9

Wondering with so many routes, this is timing out - might be worth looking at setting the netconf session values https://www.cisco.com/c/en/us/td/docs/routers/asr9000/software/asr9k-r6-2/sysman/command/reference/b-system-management-cr-asr9000-62x/b-sysman-cr-asr9k-61x_chapter_010011.html - i think there is no default set up. Anything in the device logs?

 

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

Marcel Zehnder
Spotlight
Spotlight

Hi 

I had a similar issue in a Python script with ncclient - for ncclient there's a timeout parameter - should also be the case for any other library/tool:

 

with manager.connect(
 host=dev.get("host"),
 port=830,
 username=dev.get("user"), 
 password=dev.get("password"),
 hostkey_verify=False,
 timeout=300, # in seconds for large transitions
) as m:

 

 

nkhambal10
Level 1
Level 1

I have 600 secs (10 mins) timeout configured for netconf session and it seems I am able to get response almost always consistently in 8 mins.. I wonder why it takes so long and if there is a better query to fetch the data that doesn't take so long. I am trying to query the received routes for a BGP neighbor. I couldn't find the appropriate query to fetch per-neighbor table. So I have to fetch the full table and parse it to find out the routes received from neighbor and are marked as the best. A bit of a long winded approach. Anyone knows any better query to do the job?

 

conn = manager.connect(host=host,
port=830,
username=uName,
password=uPassWd,
allow_agent=False,
look_for_keys=False,
hostkey_verify=False,
timeout=600,
device_params={'name':'iosxr',"timeout": 300})
 

 

Marcel Zehnder
Spotlight
Spotlight

I've tested this in my lab and I'm able to get the networks on a per neighbor basis with the following filter (neighbor=192.168.84.2/vrf=TEST):

 <bgp xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ipv4-bgp-oper">
        <instances>
          <instance>
            <instance-active>
              <vrfs>
                <vrf>
                  <vrf-name>TEST</vrf-name>
                  <afs>
                    <af>
                      <af-name>ipv4-unicast</af-name>
                      <path-table>
                        <path>
                          <neighbor-address>192.168.84.2</neighbor-address>
                        </path>
                      </path-table>
                    </af>
                  </afs>
                </vrf>
              </vrfs>
            </instance-active>
          </instance>
        </instances>
      </bgp>

I tried this query on my lab router but I get a time out after waiting for 10 mins (session timeout value). It seems it still scans the whole RIB for the vrf to pick and send the routes with certain neighbor value. 

miket9
Level 1
Level 1

@nkhambal10 Any luck with this one?
@Marcel Zehnder, Will appreciate your help, I'm trying to fetch the as-path when filtering the output by IP (aka 'show ip bgp X.X.X.X) instead of getting the whole RIB. 

Thanks.

Hi @miket9 which OS? XE or XR?

Hi @Marcel Zehnder, XR.

Marcel Zehnder
Spotlight
Spotlight

@miket9 The following is working in my lab.
1.) Get AS_PATH info for 10.1.1.1/32 prefix in the global BGP process (aka default VRF)
Filter:

<bgp xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ipv4-bgp-oper">
  <instances>
    <instance>
      <instance-active>
        <vrfs>
          <vrf>
            <vrf-name>default</vrf-name>
            <afs>
              <af>
                <af-name>ipv4-unicast</af-name>
                <path-table>
                  <path>
                    <network>10.1.1.1</network>
                    <prefix-length>32</prefix-length>
                    <attributes-after-policy-in>
                      <common-attributes>
                        <as-path/>
                      </common-attributes>
                    </attributes-after-policy-in>
                  </path>
                </path-table>
              </af>
            </afs>
          </vrf>
        </vrfs>
      </instance-active>
    </instance>
  </instances>
</bgp>

Result:

<data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
  <bgp xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ipv4-bgp-oper">
   <instances>
    <instance>
     <instance-name>default</instance-name>
     <instance-active>
      <vrfs>
       <vrf>
        <vrf-name>default</vrf-name>
        <afs>
         <af>
          <af-name>ipv4-unicast</af-name>
          <path-table>
           <path>
            <network>10.1.1.1</network>
            <prefix-length>32</prefix-length>
           </path>
           <path>
            <rd>0:0:0</rd>
            <network>10.1.1.1</network>
            <prefix-length>32</prefix-length>
            <neighbor-address>192.168.84.1</neighbor-address>
            <route-type>used</route-type>
            <source-rd>0:0:0</source-rd>
            <orig-source-rd>0:0:0</orig-source-rd>
            <path-id>0</path-id>
            <attributes-after-policy-in>
             <common-attributes>
              <as-path>65423</as-path>
             </common-attributes>
            </attributes-after-policy-in>
           </path>
          </path-table>
         </af>
        </afs>
       </vrf>
      </vrfs>
     </instance-active>
    </instance>
   </instances>
  </bgp>
 </data>

2.) Get AS_PATH info for all prefixes
Filter:

<bgp xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ipv4-bgp-oper">
  <instances>
    <instance>
      <instance-active>
        <vrfs>
          <vrf>
            <vrf-name>default</vrf-name>
            <afs>
              <af>
                <af-name>ipv4-unicast</af-name>
                <path-table>
                  <path>
                    <attributes-after-policy-in>
                      <common-attributes>
                        <as-path/>
                      </common-attributes>
                    </attributes-after-policy-in>
                  </path>
                </path-table>
              </af>
            </afs>
          </vrf>
        </vrfs>
      </instance-active>
    </instance>
  </instances>
</bgp>

Result:

<data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
  <bgp xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ipv4-bgp-oper">
   <instances>
    <instance>
     <instance-name>default</instance-name>
     <instance-active>
      <vrfs>
       <vrf>
        <vrf-name>default</vrf-name>
        <afs>
         <af>
          <af-name>ipv4-unicast</af-name>
          <path-table>
           <path>
            <rd>0:0:0</rd>
            <network>10.1.1.1</network>
            <prefix-length>32</prefix-length>
            <neighbor-address>192.168.84.1</neighbor-address>
            <route-type>used</route-type>
            <source-rd>0:0:0</source-rd>
            <orig-source-rd>0:0:0</orig-source-rd>
            <path-id>0</path-id>
            <attributes-after-policy-in>
             <common-attributes>
              <as-path>65423</as-path>
             </common-attributes>
            </attributes-after-policy-in>
           </path>
           <path>
            <rd>0:0:0</rd>
            <network>10.1.1.2</network>
            <prefix-length>32</prefix-length>
            <neighbor-address>192.168.84.1</neighbor-address>
            <route-type>used</route-type>
            <source-rd>0:0:0</source-rd>
            <orig-source-rd>0:0:0</orig-source-rd>
            <path-id>0</path-id>
            <attributes-after-policy-in>
             <common-attributes>
              <as-path>65423</as-path>
             </common-attributes>
            </attributes-after-policy-in>
           </path>
           <path>
            <rd>0:0:0</rd>
            <network>10.1.1.3</network>
            <prefix-length>32</prefix-length>
            <neighbor-address>192.168.84.1</neighbor-address>
            <route-type>used</route-type>
            <source-rd>0:0:0</source-rd>
            <orig-source-rd>0:0:0</orig-source-rd>
            <path-id>0</path-id>
            <attributes-after-policy-in>
             <common-attributes>
              <as-path>65423</as-path>
             </common-attributes>
            </attributes-after-policy-in>
           </path>
           <path>
            <rd>0:0:0</rd>
            <network>10.90.255.0</network>
            <prefix-length>24</prefix-length>
            <neighbor-address>192.168.84.1</neighbor-address>
            <route-type>used</route-type>
            <source-rd>0:0:0</source-rd>
            <orig-source-rd>0:0:0</orig-source-rd>
            <path-id>0</path-id>
            <attributes-after-policy-in>
             <common-attributes>
              <as-path>65423</as-path>
             </common-attributes>
            </attributes-after-policy-in>
           </path>
           <path>
            <rd>0:0:0</rd>
            <network>192.168.84.0</network>
            <prefix-length>30</prefix-length>
            <neighbor-address>192.168.84.1</neighbor-address>
            <route-type>used</route-type>
            <source-rd>0:0:0</source-rd>
            <orig-source-rd>0:0:0</orig-source-rd>
            <path-id>0</path-id>
            <attributes-after-policy-in>
             <common-attributes>
              <as-path>65423</as-path>
             </common-attributes>
            </attributes-after-policy-in>
           </path>
          </path-table>
         </af>
        </afs>
       </vrf>
      </vrfs>
     </instance-active>
    </instance>
   </instances>
  </bgp>
 </data>

Hope this helps as a starting point.