ConfD User Community

Extra cli generated when adding new options to the existing config

For the following yang code, we found an extra cli generated when adding new options to the existing config.

module generic-yang {

  namespace "https://tail-f.com/ns/example/generic-yang";
  prefix "generic";

  import tailf-common {
    prefix tailf;
  }
  import ietf-inet-types {
    prefix inet;
  }

  grouping config-ospf-max-metric-grouping {
    container max-metric {
      description
        "Set maximum metric";

      container router-lsa {
        description
          "Maximum metric in self-originated router-LSAs";
        presence "true";
        tailf:cli-compact-syntax;

        leaf include-stub {
          description
            "Set maximum metric for stub links in router-LSAs";
          type empty;
        }

        container summary-lsa {
          description
            "Override summary-lsa metric with max-metric value";
          presence "true";
          tailf:cli-flatten-container;
          tailf:cli-delete-when-empty;
          leaf metric {
            tailf:cli-no-value-on-delete;
            tailf:cli-delete-container-on-delete;
            tailf:cli-drop-node-name;
            type uint32 {
              range "1 .. 16777214";
            }
            default "16711680";
          }
        }

        container external-lsa {
          description
            "Override external-lsa metric with max-metric value";
          tailf:cli-flatten-container;
          presence "true";

          leaf metric {
            tailf:cli-drop-node-name;
            type uint32 {
              range "1 .. 16777214";
            }
            default "16711680";
          }
        }

        container on-startup {
          description
            "Set maximum metric temporarily after reboot";
          tailf:cli-flatten-container;

          choice time-wait-for-bgp-choice {
            leaf time {
              tailf:cli-drop-node-name;
              type uint32 {
                range "5 .. 86400";
              }
            }

            leaf wait-for-bgp {
              description
                "Let BGP decide when to originate router-LSA with normal metric";
              type empty;
            }
          }
        }

      } // end of router-lsa
    } // end of max-metric
  } // end of config-ospf-max-metric-grouping

  container native {
    tailf:cli-drop-node-name;
    uses config-ospf-max-metric-grouping;
  }
}

step 1 config the following:

(config)# max-metric router-lsa include-stub summary-lsa 555 on-startup 333

Commit complete.

step2: add on config

ott-ads-647(config)# max-metric router-lsa external-lsa 222
ott-ads-647(config)# show config
max-metric router-lsa include-stub summary-lsa 555 external-lsa 222 on-startup 333
no max-metric router-lsa include-stub summary-lsa on-startup 333 <== extra cli generated and causing IOS fail.

analysis finding:

container router-lsa {
        description
          "Maximum metric in self-originated router-LSAs";
   -     presence "true"; 

if we remove presence true from the above, we got the command below, which is correct.

max-metric router-lsa include-stub summary-lsa 555 external-lsa 222 on-startup 333

However we need that presence true to allow us to config “max-metric router-lsa”.

Please advice the solution.