Subject: [yang-doctors] Question about "must" statement

From: "Marco Gallina" <[email-masked]>
Date: Fri, 31 Mar 2017 16:01:22 +0200

Hello Yang-doctors,

I have a question about the "must" statement:

is it possible to refer, inside the XPath expression of a must statement, a leaf that may be not present in the tree ?

If yes, which is the correct way to express the XPATH for specifying how to evaluate the result ?

For example:

leaf minValueForB {

  type int;

}

leaf B {

  type int;

  must 'current() > ../minValueForB '

}

and suppose B may be set to any value if minValueForB is not present;

Of course there may be cases where N leaves are referred by the XPATH and some of them may be present or not...

Thank you in advance !

Marco

v:* {behavior:url(#default#VML);}o:* {behavior:url(#default#VML);}w:* {behavior:url(#default#VML);}.shape {behavior:url(#default#VML);} v:* {behavior:url(#default#VML);}o:* {behavior:url(#default#VML);}w:* {behavior:url(#default#VML);}.shape {behavior:url(#default#VML);} 
Marco Gallina
 
NMS System Engineer
 
Tel+39 039 9064 281

---

From: Martin Bjorklund <[email-masked]>
Date: Mon, 03 Apr 2017 11:50:10 +0200 (CEST)

Hi,

> and suppose B may be set to any value if minValueForB is not present;

In this case you can write:

  must 'not(../minValueForB) or (current() > ../minValueForB)';

/martin