clicon / clixon

YANG-based toolchain including NETCONF and RESTCONF interfaces and an interactive CLI
http://www.clicon.org/
Other
215 stars 72 forks source link

if choice is declared with multiple elements or leaf-list with in a case scope , addition or updation is not happening as expected #327

Closed gopiKrishnaPuligundla closed 2 years ago

gopiKrishnaPuligundla commented 2 years ago

Scenario 1 :

Container ex_container { choice ex_choice { case a { leaf b { type uint32; } leaf c { type uint32; } } case source_dest_network { leaf d { type uint32; } } if in a case 2 leafs are there , we can only configure one leaf , in above example if we configure b and try to configure c , b gets deleted and vice verse

scenario 2 :

Container ex_container { choice ex_choice { case acl_id { leaf-list acl-list { type uint32; } } case source_dest_network { leaf-list source-network { type string; } } leaf-list destination-network { type string; } } } } In above example , if we configure act-list 1 and if we try to add act-list 2 , clixon infra is triggering delete request for acl-list 1. Ideally it shouldn’t delete act-list 1 instead just add acl-list 2 as it is of same case .

olofhagsand commented 2 years ago

I see some more issues with the choice/case code that does not follwo RFC 7950 Sec 7.9:

If a request creates a node from a case, the server will delete any existing nodes that are defined in other cases inside the choice.

These are also fixed as part of the patch of fixing merge properly. Note that you may need to apply "Merge" instead of "replace/set" to add items to an existing case.

olofhagsand commented 2 years ago

Please verify patch and close issue if verified

gopiKrishnaPuligundla commented 2 years ago

Hi Olof , issues mentioned were fixed, thank you