Closed andre-d-brizido-alb closed 1 year ago
Well, strictly complying with the RFC 7950, I would say it is not allowed:
If the target node is a choice node, the "case" statement or a
shorthand "case" statement (see Section 7.9.2) can be used within the
"augment" statement.
You may argue that it is the same as when uses
is used with these statements but another target has it mentioned explicitly:
If the target node is a container, list, case, input, output, or
notification node, the "container", "leaf", "list", "leaf-list",
"uses", and "choice" statements can be used within the "augment"
statement.
I am not sure whether this was intentional and what is the reason for leaving uses
out but unless allowing it is confirmed on the NETMOD mailing list and ideally an errata is accepted, it will not be changed.
Indeed you are right. We saw the 7.17.1 table saying that "uses" is a valid substatement of "augment", but missed that detail in the text.
Thanks for the extra pair of eyes, as always, @michalvasko -- there was indeed a simple fix by injecting a "case" before the subsequent "uses" of the desired grouping. With the multiple nested augments+uses, this was tricky to find.
The solution, for others who stumble upon "YANG augment with uses" threads later:
augment initiate/remote-server/transport {
description
"The Mfc-CPRi and Mfc-SCi client endpoints.";
case grpc {
description
"Selection for gRPC client transport.";
uses bbf-grpcc:grpc-client-transport {
augment "grpc-client/access-point/"+
"grpc-transport-parameters/tcp-client-options" {
Thanks; -JH
Hi
With yanglint 2.1.25 I'm getting the following error:
yanglint -F ietf-tcp-client: -F bbf-kafka-agent: -F bbf-network-function-client: -Fbbf-d-olt-pppoe-intermediate-agent: -t config \ -f xml -p ../../../nf-standard-adapters/bbf-nf-d_olt_pppoe_ia-standard-1.0/yang/ \ ../../../nf-standard-adapters/bbf-nf-d_olt_pppoe_ia-standard-1.0/yang/bbf-d-olt-pppoe-intermediate-agent.yang \ libyang err : Invalid augment of choice node which is not allowed to contain uses node "bbf-grpcc:grpc-client-transport". (/bbf-d-olt-pppoe-intermediate-agent:{uses='d-olt-pppoe-intermediate-agent'}/bbf-d-olt-pppoe-intermediate-agent:d-olt-pppoe-intermediate-agent/remote-nf/nf-client/{uses='bbf-nfc:nf-client'}/initiate/remote-server/transport/{augment='initiate/remote-server/transport'})
I was trying to convert a XML file into JSON, but the error seems to be related with the YANG file. However, the YANG files were correctly validated with pyang.
This is the YANG exceprt in cause:
Indeed it has some some special tweaks, but they seem to be all legal according to RFC 7950. In attach you can find the complete files.
Best regards Andre
pppoeia-config.zip
yang.zip