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

How can use forloop in nso rfs template?

vishavjeet Singh
Beginner
Beginner

Example1 : Supposed your input payload is given below 
{
"l3-device-list" :{
  "interface-list":{
     "s-existing-trunk-vlan":[444, 454,222],
  }
}
}

Step1: Add variable in java 
inputParams.putQuotedEmptyIfNull(
        "s-existing-trunk-vlan",
        interfaceObj.leaf(l3VpnRfs._s_existing_trunk_vlan_).valueAsString()
    );

Step2: Add variable in  yang  
leaf-list s-existing-trunk-vlan {
    type uint32 {
        range "1..4096";
      }
    }

#3: Add loop in config template 
<dot1q>
<?foreach {l3-device-list/interface-list/s-existing-trunk-vlan}?>
<id>{.}</id>
<?end?>
<id>{$vlan-id}</id>
</dot1q>

 

Example2 : Supposed your input payload is given below 

{
  "alc-last-mile-ag2-rfs": {
      "interface-name1":["0/0/1/7", "0/0/1/8", "0/0/1/9"],
  }
}

Step1: Add variable in  yang

leaf-list interface-name1 {
    type string;

}

Step2:  Add loop in config template  
<?foreach{interface-name1}?>
<TenGigE>
<id>{.}</id>
<load-interval>30</load-interval>
<bundle>
<id>
<id-value>{$B-ID}</id-value>
<mode>active</mode>
</id>
</bundle>
</TenGigE>
<?end?>

 

0 Replies 0
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: