11-13-2019 06:15 AM
I'm attempting to create my first service template but have issues when referencing device-groups in my yang file.
user@ncs(config)# L2-BRIDGE TEST device-group LEAF-SWITCHES vlan 10 vni 10002
user@ncs(config-L2-BRIDGE-TEST)# commit dry-run outformat native
Aborted: L2-BRIDGE-template.xml:5 The node '/ncs:devices/device{LEAF-SWITCHES}' was not created. An explicit tag 'merge' or 'create' is needed.
The device-group LEAF-SWITCHES exists within NSO and contains some switches.
Solved! Go to Solution.
11-13-2019 09:22 AM
Hmm.. Stupid thing ate my xml tags..
Trying again:
-------------------------------
<devices xmlns="http://tail-f.com/ns/ncs">
<device>
<name>{/device-group}</name>
<devices xmlns="http://tail-f.com/ns/ncs">
<device>
<name>{deref(/device-group)/../member}</name>
<devices xmlns="http://tail-f.com/ns/ncs">
<?foreach {/device-group}?>
<device>
<name>{deref(.)/../member}</name>
...
...
</device>
<?end?>
</devices>
11-13-2019 07:55 AM
11-13-2019 08:24 AM
Correct, I am not trying to create a new device as they are existing within the device-group. My goal for this initial test is to deploy the service template to all the devices within the device-group.
<config-template xmlns="http://tail-f.com/ns/config/1.0"
servicepoint="L2-BRIDGE">
<devices xmlns="http://tail-f.com/ns/ncs">
<device>
<name>{/device-group}</name>
<config>
<vlan xmlns="http://tail-f.com/ned/cisco-nx">
<vlan-list>
<id>{/vlan}</id>
<name>{/customer-name}</name>
<vn-segment>{/vni}</vn-segment>
</vlan-list>
</vlan>
<evpn xmlns="http://tail-f.com/ned/cisco-nx">
<vni>
<id>{/vni}</id>
<l2/>
<rd>auto</rd>
<route-target>
<method>import</method>
<rt>auto</rt>
</route-target>
<route-target>
<method>export</method>
<rt>auto</rt>
</route-target>
</vni>
</evpn>
<interface xmlns="http://tail-f.com/ned/cisco-nx">
<nve>
<name>1</name>
<member>
<vni>
<id>{/vni}</id>
<suppress-arp/>
<ingress-replication>
<protocol>
<bgp/>
</protocol>
</ingress-replication>
</vni>
</member>
</nve>
<port-channel>
<name>200</name>
<switchport>
<trunk>
<allowed>
<vlan>
<ids>{/vlan}</ids>
</vlan>
</allowed>
</trunk>
</switchport>
</port-channel>
</interface>
</config>
</device>
</devices>
</config-template>module L2-BRIDGE {
namespace "http://com/example/L2BRIDGE";
prefix L2-BRIDGE;
import ietf-inet-types {
prefix inet;
}
import tailf-ncs {
prefix ncs;
}
list L2-BRIDGE {
key customer-name;
uses ncs:service-data;
ncs:servicepoint "L2-BRIDGE";
leaf customer-name {
type string;
}
leaf-list device-group {
type leafref {
path "/ncs:devices/ncs:device-group/ncs:name";
}
}
leaf vlan {
mandatory true;
type uint16;
}
leaf vni {
mandatory true;
type uint16;
}
}
}
Thanks!
11-13-2019 09:15 AM
11-13-2019 09:22 AM
Hmm.. Stupid thing ate my xml tags..
Trying again:
-------------------------------
<devices xmlns="http://tail-f.com/ns/ncs">
<device>
<name>{/device-group}</name>
<devices xmlns="http://tail-f.com/ns/ncs">
<device>
<name>{deref(/device-group)/../member}</name>
<devices xmlns="http://tail-f.com/ns/ncs">
<?foreach {/device-group}?>
<device>
<name>{deref(.)/../member}</name>
...
...
</device>
<?end?>
</devices>
11-14-2019 02:36 AM
Thanks Ram, that worked a charm!
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide