08-08-2017 08:36 AM - edited 03-01-2019 03:57 AM
I have been trying to create a service model for TE explicit path but what happens is that the xml merges ip addresses together and the only solution, i know is to repeat the xml like the l2vpn model but it looks illogical for me because i have no idea how many indexes that customer will create so my question is there any solution without repeating the xml manually?
admin@ncs(config)# show configuration
devices device pe0
config
cisco-ios-xr:explicit-path name xxx
index 1 next-address ipv4 unicast 3.3.3.3
index 2 next-address ipv4 unicast 4.4.4.4
Yang
=================
module TE {
namespace "http://com/example/TE";
prefix TE;
import ietf-inet-types { prefix inet; }
import tailf-ncs { prefix ncs; }
import tailf-common { prefix tailf; }
import ietf-yang-types { prefix yang-type; }
augment /ncs:services {
list TE {
key device;
uses ncs:service-data;
ncs:servicepoint "TE";
leaf device {
tailf:info "PE Router";
container Explicit-path {
when "../Explicit='true'";
list ex-name {
key name;
leaf name {
type string;
}
list PATH {
key number;
leaf number {
type uint32;
}
leaf option {
type enumeration {
enum loose;
enum strict;
}
}
leaf ip-add {
type inet:ipv4-address;
}
}
}
}
}
}
}
===================================
XML
=======
?xml version="1.0" encoding="utf-8"?>
<config-template xmlns="http://tail-f.com/ns/config/1.0" servicepoint="TE">
<devices xmlns="http://tail-f.com/ns/ncs">
<device>
<name>{/device}</name>
<config>
<explicit-path xmlns="http://tail-f.com/ned/cisco-ios-xr">
<name>
<pathname>{/Explicit-path/ex-name/name}</pathname>
<index>
<index-id>{/Explicit-path/ex-name/PATH/number}</index-id>
<keyword>next-address</keyword>
<ipv4>
<unicast>{/Explicit-path/ex-name/PATH/ip-add}</unicast>
</ipv4>
</index>
</name>
</explicit-path
Thanks
Solved! Go to Solution.
08-08-2017 09:27 AM
It is in the doc/pdf directory under your NSO installation
08-08-2017 08:48 AM
Hi,
The the attribute foreach may solve your problem.
You should check the "Loop Statement" section in the NSO developement guide.
Regards,
Roque
08-08-2017 09:24 AM
Hello Roque,
Could send me a link for development guide as i'm depending on NSO student guide all the time.
Thanks,
Amr Emad
08-08-2017 09:27 AM
It is in the doc/pdf directory under your NSO installation
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