> On 23 May 2016, at 16:10, Martin Bjorklund <[email protected]> wrote:
> 
> Hi,
> 
> This comment from the Gen-ART review deserves it's own thread.
> 
> gen-art> - section 9.9
> gen-art> 
> gen-art>    The leafref type is used to declare a constraint on the value 
> space
> gen-art>    of a leaf, based on a reference to a set of leaf instances in the
> gen-art>    data tree.  The "path" substatement (Section 9.9.2) selects a set 
> of
> gen-art>    leaf instances, and the leafref value space is the set of values 
> of
> gen-art>    these leaf instances.
> gen-art> 
> gen-art> The first sentence isn't quite right.  Perhaps:
> gen-art> 
> gen-art>    The value space of a leaf with leafref type is one of the values 
> of
> gen-art>    a set of leaf instances in the data tree.  The "path" substatement
> gen-art>    (Section 9.9.2) selects the set of leaf instances, and the leafref
> gen-art>    value space is the set of values of these leaf instances.
> gen-art>
> gen-art> - section 9.9.3
> gen-art> 
> gen-art>    If "require-instance" is "true", it means that the instance being
> gen-art>    referred MUST exist for the data to be valid.  This constraint is
> gen-art>    enforced according to the rules in Section 8.
> gen-art> 
> gen-art>    If "require-instance" is "false", it means that the instance being
> gen-art>    referred MAY exist in valid data.
> gen-art> 
> [...]
> gen-art> Also, I think the second paragraph means that if require-instance is
> gen-art> false, the referred-to instance need not exist.  But it's not clear 
> to
> gen-art> me what that would mean -- if there are no instances referenced by 
> the
> gen-art> XPath expression, then the set of value values of the leafref would 
> be
> gen-art> empty and the leafref would necessarily be invalid. ...  I think 
> these
> gen-art> paragraphs need to be expanded in some way.
> 
> mbj> Right; so what we want to say is:
> mbj> 
> mbj>   - the value space is the same as the value space of the referred
> mbj>     leaf
> mbj> 
> mbj>   - there is an additional constraint if require-instance is true that
> mbj>     the referred to leaf instance must exist
> mbj> 
> mbj> How about
> mbj> 
> mbj> OLD:
> mbj> 
> mbj>    The leafref type is used to declare a constraint on the value space
> mbj>    of a leaf, based on a reference to a set of leaf instances in the
> mbj>    data tree.  The "path" substatement (Section 9.9.2) selects a set of
> mbj>    leaf instances, and the leafref value space is the set of values of
> mbj>    these leaf instances.
> mbj> 
> mbj>    If the leaf with the leafref type represents configuration data, and
> mbj>    the "require-instance" property (Section 9.9.3) is "true", the leaf
> mbj>    it refers to MUST also represent configuration.  Such a leaf puts a
> mbj>    constraint on valid data.  All such nodes MUST reference existing
> mbj>    leaf instances or leafs with default values in use (see Section 7.6.1
> mbj>    and Section 7.7.2) for the data to be valid.  This constraint is
> mbj>    enforced according to the rules in Section 8.
> mbj> 
> mbj> NEW:
> mbj> 
> mbj>    The leafref type is used to declare a constraint on the value space
> mbj>    of a leaf, based on a reference to a set of leaf instances in the
> mbj>    data tree.  The "path" substatement (Section 9.9.2) is used to refer
> mbj>    to another leaf node.  The leafref value space is the value space of
> mbj>    this leaf node.

This mixes up paths in the data tree with those in the schema tree. The XPath 
expression in the "path" statement is evaluated in the context of a data tree, 
but if the result is an empty node set, then "this leaf node" makes no sense.

A specific example:

leaf fooref {
  type leafref {
    path "../foo";
    require-instance false;
  }
}

leaf foo {
  type uint8;
  when "../bar < 42";
}

leaf bar {   
  type uint8;
  default 100;
}

If there is neither "foo" nor "bar" in the data tree, what is the value space 
of "fooref"?

Lada

> mbj> 
> mbj>    If the "require-instance" property is "true", there MUST exist an
> mbj>    instance, or a leaf with a default value in use (see Section 7.6.1
> mbj>    and Section 7.7.2), of the leaf being referred to with the same value
> mbj>    as the leafref value in a valid data tree.
> mbj> 
> mbj>    If the leaf with the leafref type represents configuration data, and
> mbj>    the "require-instance" property (Section 9.9.3) is "true", the leaf
> mbj>    it refers to MUST also represent configuration.
> 
> 
> Does anyone have comments on this proposal?
> 
> 
> /martin
> 
> _______________________________________________
> netmod mailing list
> [email protected]
> https://www.ietf.org/mailman/listinfo/netmod

--
Ladislav Lhotka, CZ.NIC Labs
PGP Key ID: E74E8C0C




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

Reply via email to