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

[l3vpn yang model and xml template help]

Carlos A. Silva
Level 3
Level 3

Hi, I'm trying to build a model for L3VPN provisioning with options. Options are: CE bgp routing and CE static routing.

Here's a snippet of my yang model. You'll see later on that variables like "intf-number" and "wan-ip-address" are being used properly, but variables within the "static" list are not. Or at least is not what I expected to happen and someone might offer me an explanation. I must add I'm a newbie, so please be patient.

[snip]

  leaf intf-number {
    tailf:info "GigabitEthernet Interface ID";
    mandatory true;
    type string {
      pattern "[0-9]{1,2}(/[0-9]{1,2}){1,4}";
    }
  }

  leaf wan-ip-address {
    tailf:info "IP Address of WAN Interface (X.X.X.X)";
    mandatory true;
    type inet:ipv4-address {
      pattern "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+";
    }
  }

[snip]

  leaf routing-protocol {
    tailf:info "PE<-->CE Routing Protocol";
    mandatory true;
    type enumeration {
      enum bgp;
      enum static;
    }
  }

  list static  {
    tailf:info "Static Route for VRF";
    key static-prefix;
    when "../routing-protocol='static'";

    leaf static-prefix  {
      tailf:info "Static Route Prefix";
      mandatory true;
      type inet:ipv4-address;
    }

    leaf static-mask {
      tailf:info "Static Route Mask";
      mandatory true;
      type inet:ipv4-address;
    }

[snip]

Here's an extract of the XML template I'm using and that I expect the "static" list to fill out.

    


<ip xmlns="http://tail-f.com/ned/cisco-ios-xr">

      <route tags='merge' when="{routing-protocol='static'}">

        <vrf>

          <name>{/vpn-name}</name>

          <dest>{/static-prefix}</dest>

          <dest-mask>{/static-mask}</dest-mask>

          <forwarding-address>{/static-next-hop}</forwarding-address>

        </vrf>

      </route>

    </ip>

Here's what you see in the tail-f cli.

admin@ncs(config)# services fullvpn test routing-protocol static static 1.1.1.0 static-mask 255.255.255.0 static-next-hop 172.16.1.2
Value for 'vpn-name' (): test
Value for 'vpn-id' (): 1
Value for 'vlan-id' (): 1
Value for 'device' [IOS-0,IOS-1,XR-0,XR-1,...]: XR-0
Value for 'intf-number' (): 0/0/0/0
Value for 'wan-ip-address' (): 172.16.1.1
admin@ncs(config-static-1.1.1.0)# commit dry-run outformat xml


<device>

             <name>XR-0</name>

             <config>

               <vrf xmlns="http://tail-f.com/ned/cisco-ios-xr">

                 <vrf-list>

                   <name>test</name>

                   <address-family>

                     <ipv4>

                       <unicast>

                         <import>

                           <route-target>

                             <address-list>

                               <name>1:1</name>

                             </address-list>

                           </route-target>

                         </import>

                         <export>

                           <route-target>

                             <address-list>

                               <name>1:1</name>

                             </address-list>

                           </route-target>

                         </export>

                       </unicast>

                     </ipv4>

                   </address-family>

                 </vrf-list>

               </vrf>

               <ip xmlns="http://tail-f.com/ned/cisco-ios-xr">

                 <route>

                   <vrf>

                     <name>test</name>

                   </vrf>

                 </route>

               </ip>

               <interface xmlns="http://tail-f.com/ned/cisco-ios-xr">

                 <GigabitEthernet-subinterface>

                   <GigabitEthernet>

                     <id>0/0/0/0.1</id>

                     <ipv4>

                       <address>

                         <ip>172.16.1.1</ip>

                         <mask>255.255.255.252</mask>

                       </address>

                     </ipv4>

                     <vrf>test</vrf>

                     <encapsulation>

                       <dot1q>

                         <vlan-id>1</vlan-id>

                       </dot1q>

                     </encapsulation>

                   </GigabitEthernet>

                 </GigabitEthernet-subinterface>

               </interface>

               <router xmlns="http://tail-f.com/ned/cisco-ios-xr">

                 <bgp>

                   <bgp-no-instance>

                     <id>1</id>

                     <vrf>

                       <name>test</name>

                       <rd>1:1</rd>

                       <address-family>

                         <ipv4>

                           <unicast>

                             <redistribute>

                               <connected/>

                               <static/>

                             </redistribute>

                           </unicast>

                         </ipv4>

                       </address-family>

                     </vrf>

                   </bgp-no-instance>

                 </bgp>

               </router>

             </config>

           </device>

         </devices>

         <services xmlns="http://tail-f.com/ns/ncs">

           <fullvpn xmlns="http://com/example/fullvpn">

             <name>test</name>

             <vpn-name>test</vpn-name>

             <vpn-id>1</vpn-id>

             <vlan-id>1</vlan-id>

             <device>XR-0</device>

             <intf-number>0/0/0/0</intf-number>

             <wan-ip-address>172.16.1.1</wan-ip-address>

             <routing-protocol>static</routing-protocol>

             <static>

               <static-prefix>1.1.1.0</static-prefix>

               <static-mask>255.255.255.0</static-mask>

               <static-next-hop>172.16.1.2</static-next-hop>

             </static>

           </fullvpn>

         </services>

 

admin@ncs(config-static-1.1.1.0)#

As you can see, the XR static ip route (see lines for static route configuration) is not filling out properly and the template uses only the variables that are outside of the static list node. Yet the services template at the very end sees the correct values in the variables (see xml services portion at the end). Everything else seems to work well and as expected.

Any advice would be appreciated.

Thanks,
c.

1 Reply 1

MichaelXing2019
Level 1
Level 1

Hi Carlos, I do not have an answer to your question but have a question for you.

I am wondering how to do you validate your XML template against your YANG model?

How do you make sure your XML template is correct?

Thanks.