freeconf / yang

Standards-based management for Golang microservices
Apache License 2.0
38 stars 14 forks source link

No error thrown is when a duplicate node is added to container using augment. #78

Closed davidmat50 closed 1 year ago

davidmat50 commented 1 year ago

This issue is continuation of https://github.com/freeconf/yang/issues/73.

If two leaf-nodes with same name are used in a container, then yang loader throws error. It works as expected. But if the a leaf-node with same name is tried to be added into container using augment, then no error is thrown. It is observed the duplicate leaf is not added into the data tree, which is correct, but it was also expected to throw an error while loading which indicates an invalid configuartion.

File used: module check_similar_identifiers_using_augments {

    namespace "urn:params:check_similar_identifiers";
    prefix check_similar_identifiers;
    yang-version 1.1;

    augment "/root-container" {
        uses grouping-1;
        uses grouping-2;
    }

    container root-container {
        leaf leaf-root {
            type enumeration {
                enum "one";
                enum "two";
            }
        }
    }

    grouping grouping-1 {
        leaf leaf-root {
            type enumeration {
                enum "three";
                enum "four";
            }
        }
    }

    grouping grouping-2 {
        leaf leaf-root-new {
            type enumeration {
                enum "five";
                enum "six";
            }
        }
    }
}

In the above example, uses grouping-1; tries to add leaf leaf-root to container. It does not get added due to duplication ( as expected), but no error was thrown to show the incorrect duplicate configuration.

dhubler commented 1 year ago

fixed