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

type leafref in type union ineffective #277

Closed swh1991 closed 2 years ago

swh1991 commented 3 years ago

yang defintion:

    leaf test_name1 {
        type string;
    }
    leaf test_name2 {
        type string;
    }
    leaf test_name_ref {
        type union {
            type leafref {
                path "../test_name1";
                require-instance true;
            }
            type leafref {
                path "../test_name2";
                 require-instance true;
            }
        }
    }

startup_db as bellow and run ok, but expect run error.

 <configuration>
       <test_name1>test1</test_name1>
       <test_name2>test2</test_name2>
       <test_name_ref>test3</test_name_ref>  ----> not a leafref test_name1 or test_name2
 </configuration>
olofhagsand commented 2 years ago

Confirmed, can recreate

olofhagsand commented 2 years ago

The nature if this is issue is that validation of leafref's and identityref's in union doe does not work.

olofhagsand commented 2 years ago

Fixed by patch. new test in test_leafref_union.sh for both leafref and identityref in union. Please check and close if verified.