ConfD User Community

The "presence" and must check usage in a container


#1

Hi,
For the np-containers, if the container isn’t created but in which contains some must check which doesn’t meet the request, whether the must check should be done?
Use an example to show it:
1.There are two yang files:

  1. test-leafref.yang
       module test-leafref {
        namespace "http://test/leafref";
        prefix leafref;

        container ph1 {
                list a-list {
                        key "x";
                        leaf x {
                                type string;
                        }
                  }
             }
}
  1. test-leafref1.yang augment to test-leafref.yang
    module test-leafref1 {
        namespace "http://test/leafref1";
        prefix leafref1;

        import test-leafref {
                prefix leafref;
        }
        augment "/leafref:ph1" {
                container inner {
                  list b-list {
                    key p;
                    leaf p {
                    type leafref {
                     path "/leafref:ph1/leafref:a-list/leafref:x";
                   }
                 }

                 leaf t1{ type string;}
                 container test-presence {
                   presence "exist";
                   must "../t1='3'";
                   leaf t2{type string;}
                }
            }
        }
   }
}
  1. If I want to write a XML data which doesn’t contain the container “container test-presence”, whether the must check “must “…/t1=‘3’”;” should be done based on the standard, as I didn’t find the extract description about the usage?
    leafref.xml
<ph1 xmlns="http://test/leafref">
        <a-list>
            <x>3</x>
            <y>1</y>
        </a-list>        
   <inner xmlns="http://test/leafref1">
            <b-list>
                    <p>3</p>
                    <t1>2</t1>
                </b-list>
        </inner>
</ph1>

Container "presence" sub-statement