I have three YANG files:
Main YANG file:
module A {
container interfaces {
list interface {
leaf type {
mandatory true;
}
}
}
}
1st Augment YANG:
module B {
augment “/if:interfaces/if:interface” {
container ethernet {
when “…/if:type = ‘ethernet’”;
}
}
}
2nd Augment YANG:
module C {
grouping pmetric {
container performance-metric {
leaf value {
type uint64;
}
}
}
augment “/if:interfaces/if:interface/eth:ethernet” {
uses pmetric;
}
}
I have a main YANG module that defines a generic interface. It has a mandatory ‘type’ attribute. An augment YANG module adds a container ‘ethernet’ to it when the type of this interface is ‘ethernet’. Further, another augment statement directly refers to this ‘/interfaces/interface/ethernet’ container and adds ‘performance-metric’ container to it.
How does CONFD add these nodes to it’s data model? Currently, I’m observing that even though ‘ethernet’ container is defined as a conditional augment, it is always present within the model. And ‘performance-metric’ container is added to it.
Further cdb_exists() function returns True for ‘/interfaces/interface{x}/ethernet/performance-metric’ even when configured interface is not of ethernet type.
Is this expected behavior? I would assume the as ‘ethernet’ container is conditional, both these containers should only be present within data-model when type is ‘ethernet’.
CONFD VERSION used: confd-6.2 and confd-6.4.1