Subject: [netmod] Yang 1.1 change: Allow type "empty" in a key.

From: "Martin Ciglan -X (mciglan - PANTHEON TECHNOLOGIES at Cisco)" <[email-masked]>
Date: Tue, 14 Feb 2017 13:48:42 +0000

Hi all

Yang 1.1 change:  Allow type "empty" in a key.

What is the meaning of this change? We're interested from implementation point of view.

  Thanks

       Martin

---

From: Alex Campbell <[email-masked]>
Date: Tue, 14 Feb 2017 20:58:54 +0000

Hi,

It means exactly what the summary says. In YANG 1.0 (RFC 6020) we have:

   A leaf that is part of the key can be of any built-in or derived
   type, except it MUST NOT be the built-in type "empty".

and in YANG 1.1 (RFC 7950) we have:

   A leaf that is part of the key can be of any built-in or
   derived type.

In YANG 1.1, leaves of type "empty" are not disallowed from being keys.

Note that since leaves of type "empty" only convey information through their presence or absence, and since
key leaves must always be present, key leaves of type "empty" convey no useful information.

Alex

________________________________
From: netmod <[email-masked]> on behalf of Martin Ciglan -X (mciglan - PANTHEON TECHNOLOGIES at Cisco) <[email-masked]>
Sent: Wednesday, 15 February 2017 2:48 a.m.
To: [email-masked]
Cc: Igor Foltin -X (ifoltin - PANTHEON TECHNOLOGIES at Cisco)
Subject: [netmod] Yang 1.1 change: Allow type "empty" in a key.

Hi all

  Thanks

       Martin

---

From: "Jernej Tuljak" <[email-masked]>
Date: Wed, 15 Feb 2017 11:16:52 +0100

Plus, "empty keys" were aready allowed in YANG 1.

module empty-key {

  namespace "org:example:empty-key";

  prefix "ek";

  container stuff {

    list item {

      key "first second";

      leaf first {

        type string {

          length 0;

        }

      }

      leaf second {

        type string {

          pattern '.{0}';

        }

      }

    }

  }

}

Therefore this change removed a redundant (perhaps even broken) rule.

https://www.ietf.org/mail-archive/web/netmod/current/msg16763.html

Jernej

From: netmod [mailto:[email-masked]] On Behalf Of Alex Campbell
Sent: Tuesday, February 14, 2017 9:59 PM
To: Martin Ciglan -X (mciglan - PANTHEON TECHNOLOGIES at Cisco) <[email-masked]>
Cc: Igor Foltin -X (ifoltin - PANTHEON TECHNOLOGIES at Cisco) <[email-masked]>; [email-masked]
Subject: Re: [netmod] Yang 1.1 change: Allow type "empty" in a key.

Hi,

Alex

  _____  

From: netmod <[email-masked] <mailto:[email-masked]> > on behalf of Martin Ciglan -X (mciglan - PANTHEON TECHNOLOGIES at Cisco) <[email-masked] <mailto:[email-masked]> >
Sent: Wednesday, 15 February 2017 2:48 a.m.
To: [email-masked] <mailto:[email-masked]> 
Cc: Igor Foltin -X (ifoltin - PANTHEON TECHNOLOGIES at Cisco)
Subject: [netmod] Yang 1.1 change: Allow type "empty" in a key. 

Hi all

  Thanks

       Martin

---

From: Ladislav Lhotka <[email-masked]>
Date: Wed, 15 Feb 2017 11:39:42 +0100

> On 15 Feb 2017, at 11:16, Jernej Tuljak <[email-masked]> wrote:
> 

Well, keys with "empty" type were not allowed. What you are saying is that the same (dubious) effect can be achieved in other ways that were permitted in YANG 1. Note also that while if in XML encoding an empty leaf and a leaf containing string of length 0 look the same, in JSON encoding they are different:

"first": [null]

versus

"first": ""

> Therefore this change removed a redundant (perhaps even broken) rule.

Agreed.

Lada

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

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

---

From: "Jernej Tuljak" <[email-masked]>
Date: Wed, 15 Feb 2017 13:27:26 +0100

> -----Original Message-----
> From: Ladislav Lhotka [mailto:[email-masked]]
> Sent: Wednesday, February 15, 2017 11:40 AM
> To: Jernej Tuljak <[email-masked]>
> Cc: Alex Campbell <[email-masked]>; Martin Ciglan -X (mciglan
> - PANTHEON TECHNOLOGIES at Cisco) <[email-masked]>; Igor Foltin -X
> (ifoltin - PANTHEON TECHNOLOGIES at Cisco) <[email-masked]>;
> [email-masked]
> Well, keys with "empty" type were not allowed. What you are saying is that
> the same (dubious) effect can be achieved in other ways that were
> permitted in YANG 1.

Indeed. I meant »empty keys«. Quoting is hard. :)

Jernej

> Note also that while if in XML encoding an empty leaf
> and a leaf containing string of length 0 look the same, in JSON encoding they
> are different:
> 
> "first": [null]
> 
> versus
> 
> "first": ""
> 
> >
> > module empty-key {
> <[email-masked]>; [email-masked]
> > From: netmod <[email-masked]> on behalf of Martin Ciglan -X
> (mciglan - PANTHEON TECHNOLOGIES at Cisco) <[email-masked]>

---

From: "Martin Ciglan -X (mciglan - PANTHEON TECHNOLOGIES at Cisco)" <[email-masked]>
Date: Wed, 15 Feb 2017 14:56:45 +0000

Thanks for information, but still, from implementation point of view,
we've got empty keys in Map structures, searching for values...
that was my point.
________________________________________
Od: Jernej Tuljak <[email-masked]>
Odoslané: 15. februára 2017 13:27
Komu: 'Ladislav Lhotka'
Kópia: 'Alex Campbell'; Martin Ciglan -X (mciglan - PANTHEON TECHNOLOGIES at Cisco); Igor Foltin -X (ifoltin - PANTHEON TECHNOLOGIES at Cisco); [email-masked]
Predmet: RE: [netmod] Yang 1.1 change:  Allow type "empty" in a key.

Jernej

---

From: Ladislav Lhotka <[email-masked]>
Date: Wed, 15 Feb 2017 16:00:25 +0100

> On 15 Feb 2017, at 15:56, Martin Ciglan -X (mciglan - PANTHEON TECHNOLOGIES at Cisco) <[email-masked]> wrote:
> 

So what's your problem with them?

Lada