cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
570
Views
1
Helpful
3
Replies

leaf-list with defaults being ignored by template

olenha
Level 1
Level 1

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.

3 Replies 3

olenha
Level 1
Level 1

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>

hniska
Cisco Employee
Cisco Employee

Looks like a bug, guess the template engine doesnt handle default values for leaf-lists. 

hniska
Cisco Employee
Cisco Employee

that means, file a bug-report via TAC. Attach the above service to the ticket so that its easy for TAC to reproduce.