Ladislav Lhotka <[email protected]> wrote: > Andy Bierman <[email protected]> writes: > > > On Mon, Jun 8, 2015 at 8:39 AM, Kent Watsen <[email protected]> wrote: > >> > >> > >> > >>>I think the two leafs are coupled through the path statement and so the > >>>values of both should conform to the same type. If I extend Balazs¹ > >>>example with uint8 and 1..10 range: > >>> > >>>1. Would a leafref value of 256 be acceptable? > >>> > >>>2. How about "foo"? > >> > >> > >> I agree it doesn't makes sense, but is the configuration invalid? > >> > >> The leafref is marked require-instance=false, it just means a matching > >> condition will never succeed. > >> > > > > If require-instance = false then the node must conform to > > the data type for the leaf. This means the typedef used > > in the implemented version. > > > >> Would a configuration be invalid if a "when" expression could never > >> evaluate to true? > >> > > > > The node would never appear in a configuration. > > A must-stmt then is always false would make the config invalid. > > What's actually relevant to the subject of this thread (and supports > Kent's point somewhat) is this example: > > leaf foo { > type uint8; > must ". <= 10"; > } > leaf bar { > type leafref { > require-instance false; > path "../foo"; > } > } > > Should <bar>20</bar> be flagged as invalid? IMO no.
No! "flagged as invalid" is not precise enough - note that <foo>20</foo> is ok in some circumstances, e.g., it is ok to have <foo>20</foo> in the candidate. However <foo>20</foo> can never be part of a valid configuration. <bar>20</bar> is always ok. /martin _______________________________________________ netmod mailing list [email protected] https://www.ietf.org/mailman/listinfo/netmod
