freeconf / yang

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

'Config'=false setting from parent/grand-parents not getting inherited to data nodes under a choice #85

Closed davidmat50 closed 1 year ago

davidmat50 commented 1 year ago

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

After the above fix, we are able to add config false; under choice and loading of file is sucess. But the Config() method for the data node is still returning true;

Also , if any of the parent/grand parent is set to config false, this config is not inherited to the nodes under the choice.

module config-with-choice2 {

    namespace "urn:params:config-with-choice2";
    prefix basic_config;

    yang-version 1.1;

    container root-container {
        config false;
        leaf leaf-init {
            description "This is a leaf with config false";
            type boolean;
            default true;
            units USD;

        }
        leaf-list leaf-list-init {
            description "This is a leaf-list with config false";
            type string;
            units USD;

        }
        container container-init {

            description "This is a container with config false";
            leaf leaf-boolean {
                type boolean;
                default true;
            }
        }
        list list-init {

            description "This is a list with config false";
            leaf-list leaf-list-under-list {
                type string;
            }
        }
        choice choice-init {
            description "This is a choice with config false";
            default case-A;
            config false;
            case case-A {
                leaf leaf-init1 {
                    type string;
                }
            }
            case case-B {
                leaf leaf-init2 {
                    type string;
                }
            }
        }
        container container-nod {

            container second {
                leaf leaf-boolean-2 {
                    type boolean;           
                }
            }
            leaf leaf-boolean {
                type boolean;

            }
        }
        list list-nod {

            leaf-list leaf-list-under-list {
                type string;

            }
        }
        choice choice-nod { 
            case case-A {
                leaf leaf-init3 {
                    type string;
                }
            }
            case case-B {
                leaf leaf-init4 {
                    type string;
                }
            }
        }
    }
}

In the above exmaple file, config=false was set for root-container . So it was expected that the Config() will return false for all the data nodes in this file. It was as expected for all data nodes except which are under a choice.

For leaf-init1, leaf-init2, leaf-init3, and leaf-init4 which are under choice are returning .Config() as true always. The config=false is not inherited from above.

RFC references: In https://www.rfc-editor.org/rfc/rfc7950#section-4.2.3 When a node is tagged with "config false", its subhierarchy is flagged as state data.

and https://www.rfc-editor.org/rfc/rfc7950#section-7.21.1

dhubler commented 1 year ago

i believe i fixed this, would you mind verifying this and closing if so?

davidmat50 commented 1 year ago

Hi @dhubler , I have tested using image for the latest commit you did for https://github.com/freeconf/yang/issues/85, but still i see that config() is returned as true for the leafs under a choice case even if the choice is having config=false.

Also config=false from the top most container is not inherited to leafs under choice case.

So the problem still exists

dhubler commented 1 year ago

ok, this time i fixed it for sure.

davidmat50 commented 1 year ago

Yes. It is fixed now. Thank you