cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
458
Views
1
Helpful
1
Replies

Difference in deleting static route on XR between 0.5.1 and 0.7.0

dvulovic
Cisco Employee
Cisco Employee

Below is the simple Python code that should deletes static route on IOS XR:


    def create_RouterStatic_obj(arg_prefix,arg_prefixlen,arg_nexthop):


        router_static = Cisco_IOS_XR_ip_static_cfg.RouterStatic()


        vrf_unicast = router_static.default_vrf.address_family.vrfipv4.vrf_unicast

        vrf_prefix = vrf_unicast.vrf_prefixes.VrfPrefix()

        vrf_prefix.prefix = arg_prefix

        vrf_prefix.prefix_length = arg_prefixlen

        vrf_next_hop_next_hop_address = vrf_prefix.vrf_route.vrf_next_hop_table.VrfNextHopNextHopAddress()

        vrf_next_hop_next_hop_address.next_hop_address = arg_nexthop

        vrf_prefix.vrf_route.vrf_next_hop_table.vrf_next_hop_next_hop_address.append(vrf_next_hop_next_hop_address)

        vrf_unicast.vrf_prefixes.vrf_prefix.append(vrf_prefix)


        return router_static

    def delete_static_route(arg_prefix,arg_prefixlen,arg_nexthop):


        router_static = create_RouterStatic_obj(arg_prefix,arg_prefixlen,arg_nexthop)


        xr.ydk_crud.delete(xr.ydk_provider, router_static.default_vrf.address_family.vrfipv4.vrf_unicast.vrf_prefixes.vrf_prefix[0])


On YDK 0.5.1 it worked correctly, with following NETCONF message being sent:


<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:88ecc19c-3c07-4bb7-945d-cae4f3c1c810">

  <edit-config>

    <target>

      <candidate/>

    </target>

    <config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">

      <router-static xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ip-static-cfg">

        <default-vrf>

          <address-family>

            <vrfipv4>

              <vrf-unicast>

                <vrf-prefixes>

                  <vrf-prefix xc:operation="delete">

                    <prefix>13.11.11.0</prefix>

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

                    <vrf-route>

                      <vrf-next-hop-table>

                        <vrf-next-hop-next-hop-address>

                          <next-hop-address>100.100.100.100</next-hop-address>

                        </vrf-next-hop-next-hop-address>

                      </vrf-next-hop-table>

                    </vrf-route>

                  </vrf-prefix>

                </vrf-prefixes>

              </vrf-unicast>

            </vrfipv4>

          </address-family>

        </default-vrf>

      </router-static>

    </config>

  </edit-config>

</rpc>


However, on YDK 7.0 it deletes all static routes. Message sent reveals that "delete" is now in the <router-static> level:


<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">

<edit-config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">

  <target>

    <candidate/>

  </target>

  <error-option>rollback-on-error</error-option>

  <config><router-static xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ip-static-cfg" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" nc:operation="delete">

  <default-vrf>

    <address-family>

      <vrfipv4>

        <vrf-unicast>

          <vrf-prefixes>

            <vrf-prefix>

              <prefix>13.11.11.0</prefix>

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

              <vrf-route>

                <vrf-next-hop-table>

                  <vrf-next-hop-next-hop-address>

                    <next-hop-address>100.100.100.100</next-hop-address>

                  </vrf-next-hop-next-hop-address>

                </vrf-next-hop-table>

              </vrf-route>

            </vrf-prefix>

          </vrf-prefixes>

        </vrf-unicast>

      </vrfipv4>

    </address-family>

  </default-vrf>

</router-static>

</config>

</edit-config>

</rpc>


Is this a bug in YDK-Py or client code should be changed?

1 Reply 1

abhirame
Cisco Employee
Cisco Employee

The client code needs to be changed. Please see this example for how to delete lists in YDK 0.7.+ :

http://ydk.cisco.com/py/docs/guides/crud_guide.html#deleting-a-list