allow a range of vlans NSO CISCO

300 Views Asked by At

I'm trying to build L2VPN service in which we need to allow a range of vlans in the customer side. The configuration is as follow:

    device {

        name ME0

        data interface GigabitEthernet0/2

              no switchport

              service instance 2 ethernet

               encapsulation dot1q 2-10,60

               bridge-domain 2

              exit

              no shutdown

             exit

    }

The xml template is as follow:

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

             <device>

               <name>ME0</name>

               <config>

                 <interface xmlns="urn:ios">

                   <GigabitEthernet>

                     <name>0/2</name>

                     <service>

                       <instance>

                         <id>2</id>

                         <ethernet/>

                         <encapsulation>

                           <dot1q>

                             <id>2</id>

                             <id>3</id>

                             <id>4</id>

                             <id>5</id>

                             <id>6</id>

                             <id>7</id>

                             <id>8</id>

                             <id>9</id>

                             <id>10</id>

                             <id>60</id>


                           </dot1q>

                         </encapsulation>

                         <bridge-domain>

                           <bridge-id>2</bridge-id>

                         </bridge-domain>

                       </instance>

                     </service>

                   </GigabitEthernet>

                 </interface>

               </config>

             </device>

           </devices>

The question is how to orchestrate this range of vlans and how to translate the output of vlan range from yang model into xml file.

Note that in this service, the customer will enter the first and the last vlan and NSO will configure this range under the interface.

Thank you.

1

There are 1 best solutions below

0
On

As we know to control and apply any logic in Cisco NSO we have to use Python or Java. With XML and YANG, this is not easy to apply.

I will suggest using python or java based Service Package and taking input range from the user and applying as per logic using python or java code.

Or still, you want to handle this on XML template you can try this:

<dot1q>
    <from>1</from>
    <to>2</to>
</dot1q>

But, might be create issue here, Practically I haven't tried till now .