06-07-2023 08:08 AM
Hi,
I'm building a baselining service, where I wan't to keep some defaults in my YANG models. I'm using Yang 1.1 since it gives me the possibility to define default values for a leaf-list. An abbreviated and simplified model
module cpe-baseline {
yang-version 1.1;
augment /ncs:services {
list cpe-baseline {
key device;
uses ncs:service-data;
ncs:servicepoint cpe-baseline-servicepoint;
leaf device {
type leafref {
path "/ncs:devices/ncs:device/ncs:name";
}
mandatory true;
}
leaf management-interface {
type string;
mandatory false;
default "Vlan2";
}
leaf-list syslog-servers-v4 {
type inet:ipv4-address;
default 192.0.2.1;
default 192.0.2.2;
}
}
}
}
}
When doing a definion of the service, and applying the configuration via the corresponding template I can see, that default values for the leaf "management-interface" is being evaluated as "Vlan2", but nothing is returned when evaluating "syslog-servers-v4".
Evaluating "/syslog-servers-v4" (from file "logging.xml", line 19)
Context node: /services/cpe-baseline:cpe-baseline[name='cpe01']
Result: empty node
Evaluating "/management-interface" (from file "logging.xml", line 29)
Context node: /services/h2-cpe-baseline:h2-cpe-baseline[name='cpe01']
Result:
For /services/h2-cpe-baseline:h2-cpe-baseline[name='cpe01'], it evaluates to "Vlan2"
If I explicitly specify syslog-servers-v4 on my service definition it is being evaluated as expected.
Is there a reason why my defaults for the leaf-list is not being evaluted - or is it simply not supported?
Tried this on both NSO 6.0.4 and 6.1.
06-07-2023 08:16 AM
Oh, and I'm not doing anything "fancy" in my templates:
<?xml version="1.0"?>
<config-template xmlns="http://tail-f.com/ns/config/1.0">
<devices xmlns="http://tail-f.com/ns/ncs">
<device>
<name>{/device}</name>
<config>
<logging xmlns="urn:ios" tags="replace">
<host>
<ipv4>
<host>{/syslog-servers-v4}</host>
</ipv4>
</host>
<source-interface>
<name>{/management-interface}</name>
</source-interface>
</logging>
</config>
</device>
</devices>
</config-template>
06-08-2023 03:03 AM
Looks like a bug, guess the template engine doesnt handle default values for leaf-lists.
06-08-2023 03:05 AM - edited 06-08-2023 04:32 AM
that means, file a bug-report via TAC. Attach the above service to the ticket so that its easy for TAC to reproduce.
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