Showing results for 
Search instead for 
Did you mean: 

Mohamed Abid

L2VPN service matching a range of vlans yang/template help


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

               bridge-domain 2


              no shutdown



The xml template is as follow:

result-xml <devices xmlns="">




                 <interface xmlns="urn:ios">






























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 (vlan range can be variable) and NSO will configure this range under the interface.

Thank you.

Cisco Employee

Hi Mohamed,

There could be multiple ways to achieve it but two of them could be as below. You need to write some logic in your RFS service code.

1) Get the first and last VLAN range in yang input. Define a list of VLAN in yang that should be populated by your RFS code. Then you can keep foreach loop in <dot1q> tag in template which will repeat <id> section for all the items of VLAN list.

2) You can move encapsulation portion in another template having single <id> tag and you can repeat this template for all the VLAN values from RFS code.

Hi Vishesh,

Thank you for your response.

Regarding the first scenario, how can we make a pool in xml file and receive all values from RFS code.

As I know in xml file, we will receive only one value ($vlan-ID) from RFS code.

Thank you.

Hi Mohamed,

That pool you need to make in CDB using Yang model of your service. For example, you can create a list in your service model that will be empty initially. When you get first and last lan range, based on that you need to populate that yang list from RFS code. At the same time, you need to give the reference of your yang list in the xml template using foreach loop. NSO will repeat the section under foreach loop for all the elements of the yang VLAN list. Like, in the below example, tunnel is the yang list which is part of service yang model. <prefix>, <mask> and <forwarding-address> will be repeated for each element of tunnel list. Hope it will help.

<ip xmlns="urn:ios">




NSO 4.4 Development



Capabilities and Namespaces

<ip-route-forwarding-list foreach="{tunnel}">