The reason is that tailf:annotate can be used only for adding tailf:... statements. If you want to add statements like must or when, you either need to modify the original YANG file, or use a deviation module (see the RFC 7950 and the confdc documentation). The deviation in your case may look like this:
Thanks @mvf. it worked. Is there any possibility to avoid eth0 appearing in the list? i tried with when but looks like when is not supported in deviations.
Hm, right, when cannot be deviated, not sure why. But when would not help you here, a when statement referencing the current node is troublesome, to say the least (and confdc actually refuses that).
What do you mean by “to avoid eth0 appearing in the list”, do you refer to CLI completion? In that case you might need to implement a custom completion callback.
Ok. Thank you.
One last question.
is it possible to put tailf:cli-completion-actionpoint or tailf:validate as part of some condition in annotate statement? validation or completion should be called only when condition is true.
example:
tailf:annotate “/oc-if:interfaces/oc-if:interface/oc-eth:ethernet/oc-eth:config/oc-eth:port-speed” {
tailf:cli-completion-actionpoint or tailf:validate when /oc-if:interfaces/oc-if:interface/oc-if:config/oc-if:name is “etho”
}
Note that you can use tailf:annotate-module/statement to to annotate an existing statement with ‘must’, ‘min-elements’, ‘max-elements’, ‘mandatory’, ‘unique’, and ‘when’ statements.
Is it possible to add a condition using annotate-statement in this case?
tailf:annotate “/oc-if:interfaces/oc-if:interface/oc-eth:ethernet/oc-eth:config/oc-eth:port-speed” {
tailf:cli-completion-actionpoint port_speed;
}
ethernet is an augmented container in interfaces module. Also at the end i need to refer interface name to restrict to a specific port speed list. Is /oc-if:interfaces/oc-if:interface/oc-if:config/oc-if:name path accessible here?
I gave a try by using annotate-statement but couldn’t succeed.