ConfD User Community

Creating list with default key via NETCONF

In the yang, I have defined a list with default key value using taif:key-default.
Creating list via CLI works fine. That is, I’m able to create the list without explicitly providing the key value.
However, when I try to create the list with NETCONF without including the key element in edit-config, it returns error 'expected tag: ’ for key element. Why is it not taking the default key value defined in yang in this case.

That is not possible. tailf:key-default is a custom extension that affects only CLI, and it can do that since there is no standard in how CLI is supposed to look like given the YANG data model. But there are RFC documents that prescribe how the NETCONF interface should look like, in particular, RFC 7950 requires that

All key leafs MUST be given values when a list entry is created.

In other words, if you want to change how NETCONF behaves, I’m afraid you need to change your YANG model.

1 Like