Hi all,

I've seen some older threads about 'when' handling and they ended up creating a 
lot of debate about behavior & intentions (and about how well the text is 
written in the specs).

I'm hoping that the community out there is in agreement on yes vs no for the 
questions below.

Given the following module:

module test {
   namespace "http://test.com";;
   prefix "test";

   container foo {
     leaf foo-type {
       type enumeration {
         enum "green";
         enum "red";
       }
     }
     leaf green-value {
       when "../foo-type = 'green'";
       type uint32;
     }
     leaf red-value {
       when "../foo-type = 'red'";
       type uint32;
     }
   }
}


(A) Assume the candidate is empty initially.  Does the following edit-config to 
the candidate return "OK" ?  (only showing the content of the <config></config> 
section):

<root xmlns=http://dummy.com>
  <red-value>23</red-value>
  <foo-type>red</foo-type>
</root>

Does the candidate contain the following after the edit-config ?
     foo-type = red
     red-value = 23

Is the result the same if the red-value and foo-type leafs were reversed in the 
XML above ?

(B) Assume the candidate is empty initially.  Does the following edit-config to 
the candidate return an error ?

<root xmlns=http://dummy.com>
  <red-value>23</red-value>
  <foo-type>green</foo-type>
</root>

Does it also return an error if the red-value and foo-type leafs were reversed 
in the XML above ?

(C) Does the presence of 'when' in a YANG model ever create the need for a 
NETCONF client to specifically order nodes within a single edit-config to 
achieve some desired behavior ?

Or do 'when' statements purely put the onus on the server to build a dependency 
tree with the scope of a single edit-config (to ensure that the input leafs to 
a 'when' statement are processed before the when statement itself is evaluated, 
i.e. evaluate the when statements at the end) ?

Rgds,
Jason








_______________________________________________
netmod mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/netmod

Reply via email to