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

Service model context setting issue

previousqna
Level 5
Level 5

I have a pretty simple L2VPN service model that I’m trying to debug but having a problem. The problem is I reference the interface name under bridge-domain and it inserts the interface from both links into each device config.

Below is

  • The config
  • Commit dryrun including a snipet from debug template
  • Yang file
  • Xml template

Config –

admin@ncs(config)# show conf

services l2vpnSRservice customer-400

bridge-group-name  customers

bridge-domain-name customer-400

vpn-id             400

signaling-protocol ldp

rd-id              1.1.1.1:400

rt-id              1.1.1.1:400

link asr-9001-a

intf-number 0/0/0/1.400

  vlan-id     400

!

link asr-9001-b

intf-number 0/0/0/0.400

  vlan-id     400

The problem is I reference the interface name under bridge-domain and it inserts the interface from both links – highlighted in read below –

Commit dryrun –

admin@ncs(config)# commit dry-run

cli {

    local-node {

        data  devices {

                  device asr-9001-a {

config {

cisco-ios-xr:interface {

GigabitEthernet-subinterface {

             +                    GigabitEthernet 0/0/0/1.400 {

             +                        mode l2transport;

             +                        encapsulation {

             +                            dot1q {

             +                                vlan-id [ 400 ];

             +                            }

             +                        }

             +                        rewrite {

             +                            ingress {

             +                                tag {

             +                                    pop 1;

             +                                    mode symmetric;

             +                                }

             +                            }

             +                        }

             +                    }

                              }

}

cisco-ios-xr:l2vpn {

bridge {

                                  group customers {

             +                        bridge-domain customer-400 {

            + interface GigabitEthernet0/0/0/0.400;

             +                            interface GigabitEthernet0/0/0/1.400;

             +                            vfi customer-400 {

             +                                vpn-id 400;

             +                                autodiscovery {

             +                                    bgp {

             +                                        rd 1.1.1.1:400;

             +                                        route-target {

             + route-target-list 1.1.1.1:400;

             +                                        }

             + signaling-protocol {

             +                                            ldp {

             +                                            }

             +                                        }

             +                                    }

             +                                }

             +                            }

             +                        }

                                  }

}

}

}

                  }

device asr-9001-b {

config {

cisco-ios-xr:interface {

GigabitEthernet-subinterface {

             +                    GigabitEthernet 0/0/0/0.400 {

             +                        mode l2transport;

             +                        encapsulation {

             +                            dot1q {

             +                                vlan-id [ 400 ];

             +                            }

             +                        }

             +                        rewrite {

             +                            ingress {

             +                                tag {

             +                                    pop 1;

             +                                    mode symmetric;

             +                                }

             +                            }

             +                        }

             +                    }

}

}

cisco-ios-xr:l2vpn {

bridge {

                                  group customers {

             +                        bridge-domain customer-400 {

            + interface GigabitEthernet0/0/0/0.400;

             +                            interface GigabitEthernet0/0/0/1.400;

             +                            vfi customer-400 {

             +                                vpn-id 400;

             +                                autodiscovery {

             +                                    bgp {

             +                                        rd 1.1.1.1:400;

             + route-target {

             +                                            route-target-list 1.1.1.1:400;

             +                                        }

             + signaling-protocol {

             +                                            ldp {

             +                                            }

             +                                        }

             +                                    }

             +                                }

             +                            }

             +                        }

                                  }

}

}

}

                  }

              }

              services {

             +    l2vpnSRservice customer-400 {

             +        bridge-group-name customers;

             +        bridge-domain-name customer-400;

             +        vpn-id 400;

             +        signaling-protocol ldp;

             +        rd-id 1.1.1.1:400;

             +        rt-id 1.1.1.1:400;

             +        link asr-9001-a {

             +            iosxr {

             +                intf-number 0/0/0/1.400;

             +                vlan-id 400;

             +            }

             +        }

             +        link asr-9001-b {

             +            iosxr {

             +                intf-number 0/0/0/0.400;

             +                vlan-id 400;

             +            }

             +        }

             + }

              }

    }

}

admin@ncs(config)# commit dry-run | debug temp

.

.

.

.

Operation 'merge' on existing node: /devices/device[name='asr-9001-a']/config/cisco-ios-xr:l2vpn (from file "l2vpnSRservice-template.xml", line 32)

Evaluating "/bridge-group-name" (from file "l2vpnSRservice-template.xml", line 35)

Context node: /services/l2vpnSRservice:l2vpnSRservice[vfi-name='customer-400']/link[device='asr-9001-a']

Result:

For /services/l2vpnSRservice:l2vpnSRservice[vfi-name='customer-400'], it evaluates to "customers"

Operation 'merge' on existing node: /devices/device[name='asr-9001-a']/config/cisco-ios-xr:l2vpn/bridge/group[group-name='customers'] (from file "l2vpnSRservice-template.xml", line 35)

Evaluating "bridge-domain-name" (from file "l2vpnSRservice-template.xml", line 37)

Context node: /services/l2vpnSRservice:l2vpnSRservice[vfi-name='customer-400']

Result:

For /services/l2vpnSRservice:l2vpnSRservice[vfi-name='customer-400'], it evaluates to "customer-400"

Operation 'merge' on non-existing node: /devices/device[name='asr-9001-a']/config/cisco-ios-xr:l2vpn/bridge/group[group-name='customers']/bridge-domain[bridge-domain-name='customer-400'] (from file "l2vpnSRservice-template.xml", line 37)

Fetching literal "GigabitEthernet" (from file "l2vpnSRservice-template.xml", line 39)

Evaluating "/link/iosxr/intf-number" (from file "l2vpnSRservice-template.xml", line 39)

Context node: /services/l2vpnSRservice:l2vpnSRservice[vfi-name='customer-400']

Result:

For /services/l2vpnSRservice:l2vpnSRservice[vfi-name='customer-400']/link[device='asr-9001-a']/iosxr, it evaluates to "0/0/0/1.400"

For /services/l2vpnSRservice:l2vpnSRservice[vfi-name='customer-400']/link[device='asr-9001-b']/iosxr, it evaluates to "0/0/0/0.400"

Operation 'merge' on non-existing node: /devices/device[name='asr-9001-a']/config/cisco-ios-xr:l2vpn/bridge/group[group-name='customers']/bridge-domain[bridge-domain-name='customer-400']/interface[name='GigabitEthernet0/0/0/1.400'] (from file "l2vpnSRservice-template.xml", line 39)

Operation 'merge' on non-existing node: /devices/device[name='asr-9001-a']/config/cisco-ios-xr:l2vpn/bridge/group[group-name='customers']/bridge-domain[bridge-domain-name='customer-400']/interface[name='GigabitEthernet0/0/0/0.400'] (from file "l2vpnSRservice-template.xml", line 39)

Yang file –

module l2vpnSRservice {

      namespace "http://com/example/l2vpnSRservice";

      prefix l2vpnSRservice;

      import ietf-inet-types { prefix inet; }

      import tailf-ncs { prefix ncs; }

      import tailf-common { prefix tailf; }

      import tailf-ned-cisco-ios {prefix ios;}

      import tailf-ned-cisco-ios-xr {prefix cisco-ios-xr;}

      augment /ncs:services {

      list l2vpnSRservice {

            description "This is a L2VPN service.  The service uses BGP autodiscovery to find the relevant PEs and configures an IOS-XR or an IOS-XR router to act as an L2VPN PE.";

                   key vfi-name;

           

                   uses ncs:service-data;

                    ncs:servicepoint l2vpnSRservice-servicepoint;

                   leaf customer {

                          type leafref {

                                 tailf:info "L2VPN Customer";

                                path "/ncs:customers/ncs:customer/ncs:id";

                           }

                    }

           

                   leaf bridge-group-name {

                          mandatory true;

                          type string;

                           tailf:info "Bridge Group Name";

                    }

           

                   leaf bridge-domain-name {

                          mandatory true;

                           tailf:info "Bridge Domain Name";

                          type string;

                    }

                   leaf vfi-name {

                          mandatory true;

                           tailf:info "VFI Name";

                          type string;

                    }

                   leaf vpn-id {

                          mandatory true;

                           tailf:info "VPN ID";

                          type uint32;

                    }

                   leaf signaling-protocol {

                          mandatory true;

                           tailf:info "Signaling Protocol";

                          type enumeration {

                                enum bgp;

                                enum ldp;

                           }

                    }

                  

                   leaf rd-id {

                          mandatory true;

                           tailf:info "Unique RD ID xxx:xxx";

                          type ios:asn-ip-type;

                    }

                   leaf rt-id {

                          mandatory true;

                           tailf:info "Route-target";

                          type ios:asn-ip-type;

                    }

                   list link {

                           tailf:info "CE Facing Interface";

                          min-elements 1;

                          max-elements 10;

                          key device;

     

                          leaf device {

                                 tailf:info "PE Router";

                                mandatory true;

                                type leafref {

                                       path "/ncs:devices/ncs:device/ncs:name";

                                 }

                           }    

                         

                          container iosxr {

                                  tailf:cli-drop-node-name;

                                when"/ncs:devices/ncs:device[ncs:name=current()/../device]/ncs:device-type/ncs:cli/ncs:ned-id='cisco-ios-xr-id:cisco-ios-xr'";

                         

                                leaf existing-iosxr-intfs {

                                        tailf:info "Review list of existing GigabitEthernet interfaces -- read only";

                                       type leafref {

                                              path"/ncs:devices/ncs:device[ncs:name=current()/../../device]/ncs:config/cisco-ios-xr:interface/cisco-ios-xr:GigabitEthernet/cisco-ios-xr:id";       

                                        }

                                 }

                               

                                leaf existing-iosxr-subintfs {

                                        tailf:info "Review list of existing GigabitEthernet sub-interfaces -- read only";

                                       type leafref {

                                              path"/ncs:devices/ncs:device[ncs:name=current()/../../device]/ncs:config/cisco-ios-xr:interface/cisco-ios-xr:GigabitEthernet-subinterface/cisco-ios-xr:GigabitEthernet/cisco-ios-xr:id";        

                                        }    

                                 }

                               

                                leaf intf-number {

                                        tailf:info "GigabitEthernet interface ID including .x";

                                       mandatory true;

                                       type string;

                                 }

                               

                                leaf vlan-id {

                                        tailf:info "Subinterface vlan id";

                                 mandatory true;

                                type uint16 {

range "1 .. 4084" {

error-message "Vlan range 1-4094";

                                        }

                                 }

                                 }

                               

                                leaf ve-id {

                                        tailf:info "VE-ID.  Note: required with BGP signaling only";

                                       type uint16;

                                 }

                         

                                leaf vpls-id {

                                        tailf:info "VPLS-ID.  Note: optional with BGP signaling only";

                                       type ios:asn-ip-type;

                                 }

                           }

                           tailf:action self-test {

                           tailf:info "Perform self-test of the service";

                          tailf:actionpoint l2vpnSRservice-self-test;

                          output {

leaf success {

type boolean;

}

leaf message {

type string;

description "Free format message.";

}

                                  }

                    }

                    }

      }

       }

}

XML –

<?xml version="1.0" encoding="utf-8"?>

<config-template xmlns="http://tail-f.com/ns/config/1.0">

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

            <devicetags="nocreate">                                                      

                   <!-- Get Device name -->

                   <name>{/link/device}</name>

                   <config tags="merge">

                          <!-- IOS-XR Device -->

                          <!-- Configure IOS-XR Device -->

                   <!-- Configure IOS-XR Device interface -->

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

                   <GigabitEthernet-subinterface when="{iosxr/intf-number}">

                                <GigabitEthernet>

                                <id>{iosxr/intf-number}</id>

                                <mode>l2transport</mode>

                                <encapsulation>

                                             <dot1q>

                                                           <vlan-id>{vlan-id}</vlan-id>

                                             </dot1q>

                                </encapsulation>

                                <rewrite>

                                             <ingress>

                                             <tag>

                                                    <pop>1</pop>

                                                    <mode>symmetric</mode>

                                             </tag>

                                             </ingress>

                                </rewrite>

                                </GigabitEthernet>

                          </GigabitEthernet-subinterface>

                   </interface>

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

                         <bridge>

                                <group>

                                <group-name>{/bridge-group-name}</group-name>

                                <bridge-domain>

                                             <bridge-domain-name>{bridge-domain-name}</bridge-domain-name>

                                             <interface>

                                                    <name>GigabitEthernet{/link/iosxr/intf-number}</name>

                                             </interface>

                                     <vfi>

                                             <name>{vfi-name}</name>

                                             <vpn-id>{vpn-id}</vpn-id>

                                             <autodiscovery>

                                                    <bgp>

                                                          <rd>{rd-id}</rd>

                                                          <route-target>

                                                                 <route-target-list>

                                                                        <name>{rt-id}</name>

                                                                 </route-target-list>

                                                          </route-target>

                                                          <signaling-protocol>

                                                                 <ldp>

                                                          <vpls-id>{vpls-id}</vpls-id>

                                                          </ldp>

                                                          </signaling-protocol>

                                                    </bgp>

                                             </autodiscovery>

                                             </vfi>

                                </bridge-domain>

                                       </group>

                         </bridge>

                   </l2vpn>

            </config>

            </device>

      </devices>

</config-template>

1 Accepted Solution

Accepted Solutions

previousqna
Level 5
Level 5

Looks like I missed the obvious on this  --

<interface>

              <name>GigabitEthernet{/link[device=$DEVICE]/iosxr/intf-number}</name>

</interface>

View solution in original post

1 Reply 1

previousqna
Level 5
Level 5

Looks like I missed the obvious on this  --

<interface>

              <name>GigabitEthernet{/link[device=$DEVICE]/iosxr/intf-number}</name>

</interface>