Let say a year ago I handled a “shorthand case” issue and summarized a knowledge that under a choice node, an identifier can’t appear more than once unless it is “naming protected” ( i.e. wrapped by container/list or comes from different namespace ).
So with the two modules below I was hoping that one of that two augment statements from “aug.yang” should fail on the compilation.
But I found them passed both “confdc” compilation and “pyang” tree conversion, yet only one augment branch occur on the ConfD CLI.
I think it is a semantic error. Can someone share your comments on this? And correct me if I was wrong with something.
bak.yang
module bak {
namespace "http://tail-f.com/ns/example/bak";
prefix bak;
container test{
list server {
key name;
leaf name {type string;}
leaf ip {type int32;}
choice children-type {
case queues {
leaf queue {type string;}
}
case scheduler-nodes {
list scheduler-node {
key name;
leaf name {type string;}
leaf port {type int32;}
}
}
}
}
}
}
And with this YANG loaded to ConfD (ver 6.5.3), I configured some data and showed them. Here are the output.
admin connected from 192.168.56.1 using ssh on ubuntu
admin@ubuntu> con
Entering configuration mode private
[ok][2018-10-24 23:48:38]
[edit]
admin@ubuntu% set
Possible completions:
aaa - AAA management
alias - Create command alias.
nacm - Access control
servers -
session - Global default CLI session parameters
test -
user - User specific command aliases and default CLI session parameters
webui - Web UI specific configuration
admin@ubuntu% set test server
Possible completions:
<name:string>
admin@ubuntu% set test server alex
Possible completions:
aug:abc ip queue scheduler-node
admin@ubuntu% set test server alex ip
Possible completions:
<int>
admin@ubuntu% set test server alex ip 123
Possible completions:
aug:abc queue scheduler-node
admin@ubuntu% set test server alex ip 123 queue
Possible completions:
<string>
admin@ubuntu% set test server alex ip 123 aug:abc foo
Possible completions:
<string>
admin@ubuntu% set test server alex ip 123 aug:abc foo helloworld
[ok][2018-10-24 23:49:41]
[edit]
admin@ubuntu% commit
Commit complete.
[ok][2018-10-24 23:49:44]
[edit]
admin@ubuntu% show test server
server alex {
ip 123;
aug:abc {
foo helloworld;
}
aug:abc {
foo helloworld;
}
}
[ok][2018-10-24 23:49:50]
[edit]
admin@ubuntu%
You’re right, augmenting two different cases of a choice with same-named toplevel nodes in the augments is not valid (per e.g. https://tools.ietf.org/html/rfc6020#section-7.9.2 3rd paragraph), and should ideally be rejected by the compiler.