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

How can use forloop in nso rfs template?

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?>

 

1 Reply 1

Ruben Cocheno
Spotlight
Spotlight

@vishavjeet Singh 

Just following up on this and see if you still need help?

Tag me to follow up.
Please mark it as Helpful and/or Solution Accepted if that is the case. Thanks for making Engineering easy again.
Connect with me for more on Linkedin https://www.linkedin.com/in/rubencocheno/