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

When multiple lists have same key name, need more elaborate error message in case of configuration having duplicate keys #362

Closed DeekshaBhandary closed 1 year ago

DeekshaBhandary commented 2 years ago
list l1{
key "name";
leaf name {
 type string;
}
}

list l2{
key "name";
leaf name {
 type string;
}
}

json config file:

{
        "ietf-restconf:data": {
                "config:l1": [
                        {
                                 "name" : "test1"
                        },
                        {
                                 "name" : "test1"
                        }
                ],
                "config:instance": [
                        {
                                "name" : "test2"
                        },
                        {
                                 "name" : "test3"
                        }
                ]
        }
}

Loading this file throws error with just the node name that has uniqueness issue. In case of huge configs it is difficult to find the exact config causing the issue. Having node's xpath or parent info in the error message can be useful

cli> load config test.json
Sep  9 10:48:26: Editing configuration: application operation-failed <non-unique>name</non-unique>: data-not-unique 
cli>
olofhagsand commented 2 years ago

Agreed. Although not technically a "bug" it is a usability issue. Please continue to report such observations.

olofhagsand commented 2 years ago

Fixed by conforming to RFC 7950 Section 15.1 replacing name with instance-identifier. Also adding correct namespace to the non-unique tag. Please verify.