Hi,
I have command like,
show colours <1-10|all>
for the above command, I have defined yang implementation for key leaf as,
leaf input {
type union {
type int;
type string {
pattern all;
}
}
In my datahandler implementation,
If I give show colors 2, then in my datahandler, get_elem() call is occurs and respective color is displayed
If I give show colors, then in my datahandler, get_next() call is occurs and all colors gets displayed…
If I give show colors all, then get_elem() call occurs, and return no entry found…But this scenario should be like get_next call.
Here get_elem and get_next trigger happening by confd…So, I can’t able to handle it
It appears that the expected behavior of your show command doesn’t match the definition all your YANG model.
The way your YANG model is defined, ConfD expects for the “all” string to be another instance of your colours list. When “all” is entered as an argument for the show colours command, ConfD will issue an get_elem( ) call for the instance of the colours list with its key that matches “all”.
The auto rendered behavior of the show command for both the J style and C style of CLI will show all entries of your colours list when you enter either of the following:
show colours
or
show colours *
Take a look at Chapter 16.21.6, Adding custom show output, of the ConfD 6.0 User Guide if you would like to customize the behavior of the auto-rendered show commands.