freeconf / yang

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

Config substatment is not supported under choice statement #75

Closed davidmat50 closed 1 year ago

davidmat50 commented 1 year ago

As per https://www.rfc-editor.org/rfc/rfc7950.html#section-7.9.1 , config substatement should be supported under choice statement. But the freeconf/yang library considers it as an invalid configuration and throws error.

Error thrown for the below exmaple file: " could not load yang file for 'basic_config'. syntax error - line 43, col 3 "

File used :

module basic_config {

    namespace "urn:params:basic_config";
    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;
            /*config false;*/
        }
        leaf-list leaf-list-init {
            description "This is a leaf-list with config false";
            type string;
            units USD;
            /*config false;*/
        }
        container container-init {
            /*config false;*/
            description "This is a container with config false";
            leaf leaf-boolean {
                type boolean;
                default true;
            }
        }
        list list-init {
            /*config false;*/
            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 {
            /*config false;*/
            container second {
                leaf leaf-boolean-2 {
                    type boolean;
                    /*config false;*/
                }
            }
            leaf leaf-boolean {
                type boolean;
                /*config false;*/
            }
        }
        list list-nod {
            /*config false;*/
            leaf-list leaf-list-under-list {
                type string;
                /*config false;*/
            }
        }
        choice choice-nod {
            /*config false;*/
            case case-A {
                leaf leaf-init3 {
                    type string;
                }
            }
            case case-B {
                leaf leaf-init4 {
                    type string;
                }
            }
        }   
    }
}
dhubler commented 1 year ago

fixed