Two services: service_01 and service_02 ,service_01 which stores the values in cdb and service_02 iterate over a list in service_01. The problem is I need to control how many loopbacks should be created, used counter in xml template but is not really working.
--YANG----
module service_01 {
namespace "http://com/example/service_01";
prefix service_01;
list loopback {
key loopback_id;
leaf loopback_id {
type uint16{
range "1000..10000";
}
mandatory true;
}
leaf loopback_ip {
type inet:ipv4-address;
mandatory true;
}
-----XML-----
service_02
<interface xmlns="urn:ios">
<?set counter={0}?>
<?foreach {/../service_01:service_01[service_01_name]/loopback}?>
<Loopback>
<name>{loopback_id}</name>
<ip-vrf>
<ip>
<vrf>
<forwarding>{/vrf_id}</forwarding>
</vrf>
</ip>
</ip-vrf>
<ip>
<address>
<primary>
<address>{loopback_ip}</address>
<mask>255.255.255.255</mask>
</primary>
</address>
</ip>
</Loopback>
<?end?>
</interface>