Showing results for 
Search instead for 
Did you mean: 

Multiple lists in YANG

Hello everyone,


is it possible to have multiple lists in the YANG-model? I have tried that and the YANG-model compiles without errors. But my problem appears when I want to create a service instance. Both lists are shown as an available option when using the '?'-feature, but after I have entered the parameters for one list, the other list is not available anymore/is not shown as a next option.

The following code shows an abridged version of my YANG-model; the service contains two lists, the list "hub" and the list "spoke". In the NSO-CLI when creating a service-instance, i can only fill out one of those lists, after that the other one is not shown as an available option as to what enter next.



module RN-DMVPN {
(lines omitted)
list RN-DMVPN { description "This is an RFS skeleton service"; key vpnid; uses ncs:service-data; ncs:servicepoint RN-DMVPN-servicepoint; leaf vpnid { type uint32; description "VPN-ID"; } (further leafs omitted) list hub { key device; leaf group { tailf:hidden full; type leafref { path "/ncs:devices/ncs:device-group/ncs:name"; } default "DMVPN-Hubs"; } leaf device { type leafref { path "/ncs:devices/ncs:device-group[ncs:name=current()/../group]/ncs:device-name"; } description "Hub-Router"; } leaf siteid { type uint8 { range 1..254; } mandatory true; description "Site-ID; 1...254"; } (further leafs omitted) } list spoke { key device; leaf group { tailf:hidden full; type leafref { path "/ncs:devices/ncs:device-group/ncs:name"; } default "DMVPN-Spokes"; } leaf device { type leafref { path "/ncs:devices/ncs:device-group[ncs:name=current()/../group]/ncs:device-name"; } description "Spoke-Router"; } leaf spokeid { type uint8 { range 1..254; } mandatory true; description "Spoke-ID; 1...254"; } (further leafs omitted) } } }

So is it even allowed to have multiple lists inside the YANG-model? Since I don't receive any errors when compiling, I believe this must be a valid model. But then why can't I fill out both lists in the CLI?


Any help or ideas would be greatly appreciated.


Thanks in advance,



Cisco Employee

It is allowed, you just can't fill out both lists with a single CLI command without some changes to the YANG. If you enter the configuration command for one list and then go back to the top of the CLI config mode, you can then enter the CLI command to configure the other list. If you then do a commit dry-run, you will see that the configuration changes for both lists are present.


Alternatively, you may be able to modify the YANG to allow you to make the changes in a single CLI command. If you add the "tailf:cli-flatten-container" option to both of the child lists, when you enter values for all the leafs within the child list it should then allow you to continue inputting data for the parent list.

Thanks for your answer, the "tailf:cli-flatten-container" option is exactly what I was looking for. However, it doesn't seem to work. I added the statement under both lists, like this:


list hub {
      key device;


list spoke {
      key device;


It compiles without errors, but it seems like there are no changes in the CLI, I still can only fill out one of the lists, it still looks like this (don't get confused by the long seemingly random string after the leaf 'psk', this represents a password which has a set length of 127 characters):




As you can see, after filling out the list 'hub', I still can't enter parameters for the list 'spoke', although this should actually be possible now. Do you know why this doesn't work? If it helps, for testing reasons I am testing my service currently on netsim-devices and not and not on actual physical devices.

I attached the full YANG-file in this reply, should you require insight into the complete model (I had to change the file to a .txt file, the .yang wasn't accepted for some reason).

Best regards,


If "tailf:cli-flatten-container" doesn't do what you need, you may have to put the configuration in as two separate commands on the CLI.


To simplify navigation, you may wish to consider adding the "tailf:cli-suppress-mode" option under both the parent and child lists in your model. This will mean that you remain at the top of the configuration rather than going into a list specific configuration mode when making a configuration change, so you will not need to exit out of the mode after the first command to enter the second command. In this case, the config commands will look something like the below:

admin@ncs(config)# RN-DMVPN 100 vrfname myvrf psk mykey nhrpauth abcdefg1 hub c0 siteid 1 rolle 1
admin@ncs(config)# RN-DMVPN 100 spoke c1 spokeid 1


Thanks for your answer, I am currently going with your suggested "two-step"-solution and it works just fine.


Thanks for all your help,


Best regards,