I want to remove the configuration of Container B when I configure Container A → address (or) ipv6. I tried using tailf:cli-recursive-delete; which woks only for the leaves under a container . My requirement is to reset the container B when A is configured. Kindly suggest any tailf command for the same.
container A {
tailf:cli-reset-container;
tailf:cli-recursive-delete;
container address {
presence "true";
tailf:cli-reset-container;
leaf ipv6 {
type empty;
}
}
container B {
presence "true";
tailf:cli-reset-container;
leaf id {
tailf:cli-drop-node-name;
type string;
}
}
}
your excerpt does not have the trailing closing brace, and it’s a bit unclear whether container B is sibling of container A, or it is its child… can you clarify?
If i understood your expected behavior correctly, i think the YANG’s “choice” statement might do what you need (no reset annotations needed).
Below YANG implies that at any time, there can be only of of the “address” / “B” present inside of A container.
If user configures the other option, previous one is automatically “removed”.
Please test the following and see whether it works correctly:
container A {
choice address-or-B {
case option-address {
container address {
presence "true";
leaf ipv6 { type empty; }
}
}
case option-B {
container B {
presence "true";
leaf id { type string; }
}
}
}
}
(“address-or-B” / “option-…” are not visible in CLI / NETCONF messages as extra keywords of course)