ConfD User Community

One question about the leaf default usage


I have a question about the leaf’s default usage, use the below exampe to show it.

  1. The yang module:
# cat default.yang
module default{
  namespace "http://complex/default";
  prefix "default";
  container test1 {
     list test2{
        key id;
        leaf id{
          type uint8 {
              range "1..80";
        leaf type{
           type enumeration {
              enum "Act";
              enum "Term";
           default "Act";
        leaf trace{
           when "../type = 'Act'";
           type enumeration {
              enum "URI";
              enum "Number";
           default "Number";
         leaf name{
           must "not(../trace = 'URI')";
           type string;
  1. The XML file:
 # cat default.xml 
  <test1 xmlns="http://complex/default">
  1. The edit-config result will report error.
# /root/lab-5/confd/bin/netconf-console  --port=2022 --edit-config default.xml 
<?xml version="1.0" encoding="UTF-8"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
    <error-path xmlns:default="http://complex/default">
    <error-message xml:lang="en">/test1/test2[id='2']/trace: the 'when' expression "../type = 'Act'" failed</error-message>
  1. My question is:
    In the RFC7950, the below description shows the default value won’t be used if the when condition is false. But the above error seems it still use the default value.

Note that if the leaf or any of its ancestors has a “when” condition
or “if-feature” expression that evaluates to “false”, then the
default value is not in use.

note: Only the leaf name contains the must check which uses the leaf trace will trigger the when error(i.e.if I remove the must check in the leaf name, the above when error won’t be reported), I didn’t find in the RFC that the default valude is in use if the leaf is referred by other value.


What ConfD release are you using? I tried this with several releases down to 6.3, in all of them the edit-config request passed without any errors.


Hi @mvf,
My ConfD version is 6.2, maybe my release is too old.

# ./confd --version


Yes, I would think so. confd-6.2 was released 3 years ago, and 6 months younger confd-6.3 handles this correctly.