On Tue, Sep 6, 2016 at 11:11 AM, Phil Shafer <[email protected]> wrote:
> Juergen Schoenwaelder writes:
> >On Tue, Sep 06, 2016 at 02:50:19AM +0000, Sterne, Jason (Nokia - CA)
> wrote:
> >> I did manage to find some older posts about empty types in keys. It
> >> seems that perhaps YANG 1.1 allows them but they are not actually
> >> useful.
> >Yes. Note that there are other constructs that are legal but not
> >useful (a list key leaf with a type that only allows a single value
> >is very close to list key leaf of type empty).
>
> No, a missing key is worse, since the spec requires that all keys
> must appear (7.8.6: 'If all keys are not specified for a list entry,
> a "missing-element" error is returned.' Also 8.3.1). A key that
> only allows a single value may be useless, but it makes data that
> can be consistently manipulated. Is there a change in 7950 for
> handling these?
>
> In a similar node, while looking in 7950 for a such a rule, I saw the
> following in 9.13.4:
>
> /* instance-identifier for a list entry where the second
> key ("enabled") is of type "empty" */
> /ex:system/ex:service[ex:name='foo'][ex:enabled='']
>
> But XPath says (4.2):
>
> A node-set is converted to a string by returning the string-value
> of the node in the node-set that is first in document order.
> If the node-set is empty, an empty string is returned.
>
> So if no <ex:enabled> elements are present, then the expression
> ex:enabled selects an empty node set, and the string comparison
> forces a conversion to type string, which generates an empty string.
> Unless I'm off, the line should be fixed to avoid the string
> conversion:
>
> /ex:system/ex:service[ex:name='foo'][ex:enabled]
>
> and a negation should be:
>
> /ex:system/ex:service[ex:name='foo'][not(ex:enabled)]
>
>
There is only one value provided by type empty. The 2nd instance
identifier is invalid.
There is no instance possible that does not include the 'enabled' leaf.
I added a section on this issue in the latest 6087bis draft:
https://tools.ietf.org/html/draft-ietf-netmod-rfc6087bis-08#section-5.11.5
I think we had it right in YANG 1.0.
Using a key of type empty is utterly pointless unless the point
is to make the instance identifier longer.
> Thanks,
> Phil
>
Andy
>
> _______________________________________________
> netmod mailing list
> [email protected]
> https://www.ietf.org/mailman/listinfo/netmod
>
_______________________________________________
netmod mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/netmod