Auto id generation in yang model

Hello Everyone,

Basically i have YANG file which is like this:
image

in that case, how can i generate id in automatic way ?
if client doesn’t pass the ID value, how can i generate in easy way?
Is there a solution on confD side or external yang file (such ietf’s yang file and so on) ?

Many Thanks,
With My Best Regards

In NETCONF or similar NBI’s there is no way how the user does not pass a list key value - the key value is the only means how a list instance can be identified, and so as to configure a list instance, you first need to identify it. In CLI you may use tailf:key-default to assign a fixed values and then write a transaction hook that would do the value generation (i.e. “move” the new list instance to another list instance with a generated key value).

What I would suggest though is to use actions: define an action like create-subnet which would take the list attributes as an input, and the action implementation would generate the id value. Such approach would work for both CLI or NETCONF or any other NBI.