cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
411
Views
0
Helpful
1
Replies
Highlighted

kindly let us know xml filter is correct or wrong for the cli

kindly let us know xml filter is correct or wrong for the corresponding cli

we are using ncclient to get xml output from cisco router

RP/0/RP0/CPU0:dedsdf1001jl1#show bgp ipv4 labeled-unicast neighbors 10.80.68.67 advertised-routes 

Wed May 10 05:07:24.387 EDT

Network            Next Hop        From            AS Path

10.0.6.0/32        10.60.63.61     10.61.0.229     ?

10.0.6.1/32        10.60.63.61     10.61.0.229     ?

def read(host, user, password):

    try:

        with manager.connect(host=host,  username=user, password=password, look_for_keys=False,timeout=100) as m:

            bgp_filter = '''

      <bgp xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ipv4-bgp-oper">

        <instances>

          <instance>

            <instance-name>default</instance-name>

            <instance-active>

              <default-vrf>

                <afs>

                  <af>

                    <af-name>ipv4-labeled-unicast</af-name>

                    <advertised-path-xr>

                     <advertised-path>

                        <neighbor-address/>

                        <path-information>

                          <bgp-prefix>

                            <prefix>

                              <afi/>

                              <ipv4-address/>

                            </prefix>

                          </bgp-prefix>

                          <neighbor-address>

                            <afi/>

                            <ipv4-address/>

                          </neighbor-address>

                          <next-hop>

                            <afi/>

                            <ipv4-address/>

                          </next-hop>

                        </path-information>

                      </advertised-path>

                    </advertised-path-xr>

                  </af>

                </afs>

              </default-vrf>

            </instance-active>

          </instance>

        </instances>

      </bgp>

                    '''

            cisco_bgp = m.get(('subtree', bgp_filter))

            print (cisco_bgp)

  


  

We are not getting exact next-hop out put with the above xml-filter . kindly let us know the same

Thanks

Jay

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Beginner

Hi Jay,

The request looks correct to me, but there is a different table for advertised paths (which includes ad paths). Below is a sample request. Could you please try this:

<get>

<filter type="subtree">

  <bgp xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ipv4-bgp-oper">

   <instances>

    <instance>

     <instance-name>default</instance-name>

      <instance-active>

       <default-vrf>

        <afs>

         <af>

          <af-name>ipv4-unicast</af-name>

           <advertised-paths>

            <advertised-path>

             <paths>

              <neighbor-address-xr/>

              <path-information>

               <bgp-prefix>

                <prefix>

                 <afi/>

                 <ipv4-address/>

                </prefix>

               </bgp-prefix>

               <neighbor-address>

                <afi/>

                <ipv4-address/>

               </neighbor-address>

               <next-hop>

                <afi/>

                <ipv4-address/>

               </next-hop>

              </path-information>

             </paths>

            </advertised-path>

           </advertised-paths>

          </af>

         </afs>

        </default-vrf>

       </instance-active>

     </instance>

   </instances>

</bgp>

</filter>

</get>

---------- OUTPUT ----

----------- Received from NETCONF agent --------------

#1340

<?xml version="1.0"?>

<rpc-reply message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">

<data>

  <bgp xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ipv4-bgp-oper">

   <instances>

    <instance>

     <instance-name>default</instance-name>

     <instance-active>

      <default-vrf>

       <afs>

        <af>

         <af-name>ipv4-unicast</af-name>

         <advertised-paths>

          <advertised-path>

           <rd>0000000000000000</rd>

           <network>0d000100</network>

           <prefix-length>24</prefix-length>

           <neighbor-address>10.10.10.1</neighbor-address>

           <paths>

            <neighbor-address-xr>

             <afi>ipv4</afi>

             <ipv4-address>10.10.10.1</ipv4-address>

            </neighbor-address-xr>

            <path-information>

             <bgp-prefix>

              <prefix>

               <afi>ipv4</afi>

               <ipv4-address>13.0.1.0</ipv4-address>

              </prefix>

             </bgp-prefix>

             <neighbor-address>

              <afi>ipv4</afi>

              <ipv4-address>0.0.0.0</ipv4-address>

             </neighbor-address>

             <next-hop>

              <afi>ipv4</afi>

              <ipv4-address>10.10.10.2</ipv4-address>

             </next-hop>

            </path-information>

           </paths>

          </advertised-path>

#165

         </advertised-paths>

        </af>

       </afs>

      </default-vrf>

     </instance-active>

    </instance>

   </instances>

  </bgp>

</data>

</rpc-reply>

##

View solution in original post

1 REPLY 1
Highlighted
Beginner

Hi Jay,

The request looks correct to me, but there is a different table for advertised paths (which includes ad paths). Below is a sample request. Could you please try this:

<get>

<filter type="subtree">

  <bgp xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ipv4-bgp-oper">

   <instances>

    <instance>

     <instance-name>default</instance-name>

      <instance-active>

       <default-vrf>

        <afs>

         <af>

          <af-name>ipv4-unicast</af-name>

           <advertised-paths>

            <advertised-path>

             <paths>

              <neighbor-address-xr/>

              <path-information>

               <bgp-prefix>

                <prefix>

                 <afi/>

                 <ipv4-address/>

                </prefix>

               </bgp-prefix>

               <neighbor-address>

                <afi/>

                <ipv4-address/>

               </neighbor-address>

               <next-hop>

                <afi/>

                <ipv4-address/>

               </next-hop>

              </path-information>

             </paths>

            </advertised-path>

           </advertised-paths>

          </af>

         </afs>

        </default-vrf>

       </instance-active>

     </instance>

   </instances>

</bgp>

</filter>

</get>

---------- OUTPUT ----

----------- Received from NETCONF agent --------------

#1340

<?xml version="1.0"?>

<rpc-reply message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">

<data>

  <bgp xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ipv4-bgp-oper">

   <instances>

    <instance>

     <instance-name>default</instance-name>

     <instance-active>

      <default-vrf>

       <afs>

        <af>

         <af-name>ipv4-unicast</af-name>

         <advertised-paths>

          <advertised-path>

           <rd>0000000000000000</rd>

           <network>0d000100</network>

           <prefix-length>24</prefix-length>

           <neighbor-address>10.10.10.1</neighbor-address>

           <paths>

            <neighbor-address-xr>

             <afi>ipv4</afi>

             <ipv4-address>10.10.10.1</ipv4-address>

            </neighbor-address-xr>

            <path-information>

             <bgp-prefix>

              <prefix>

               <afi>ipv4</afi>

               <ipv4-address>13.0.1.0</ipv4-address>

              </prefix>

             </bgp-prefix>

             <neighbor-address>

              <afi>ipv4</afi>

              <ipv4-address>0.0.0.0</ipv4-address>

             </neighbor-address>

             <next-hop>

              <afi>ipv4</afi>

              <ipv4-address>10.10.10.2</ipv4-address>

             </next-hop>

            </path-information>

           </paths>

          </advertised-path>

#165

         </advertised-paths>

        </af>

       </afs>

      </default-vrf>

     </instance-active>

    </instance>

   </instances>

  </bgp>

</data>

</rpc-reply>

##

View solution in original post

Content for Community-Ad
Cisco Community October 2020 Spotlight Award Winners
This widget could not be displayed.