GUBALLA, JENS (JENS) je 11.12.2015 ob 14:40 napisal:
Hi Lada,

-----Original Message-----
From: Ladislav Lhotka [mailto:[email protected]]
Sent: Freitag, 11. Dezember 2015 11:51
To: GUBALLA, JENS (JENS)
Cc: [email protected]
Subject: Re: [netmod] How to model a leafref in union conforming to
RFC6020?


On 11 Dec 2015, at 10:29, GUBALLA, JENS (JENS) <jens.guballa@alcatel-
lucent.com> wrote:
Hi,

According to RFC6020 a leafref within a union is not allowed. This
issue is captured by Y30 of the yang1.1 issue list.

My question: how can such a construct as show below be modeled
conforming to RFC6020?

    leaf the_reference {type uint8;}
    leaf something {
        type union {
            type leafref {
                path "../the_reference";
            }
            type enumeration {
                enum "none";
                enum "something-else";
            }
        }
    }

Has anyone any ideas or can someone provide me a pointer if this has
been discussed already?
You can define the first union member simply as uint8, without being
formally coupled with "the_reference". I'd suggest to use YANG 1.1
though where that CLR was removed.
[JG] Thanks a lot for your suggestions. Replacing "type leafref" by "type
unit8" would mean to lose the semantic of the leafref type. Thus

     <the_reference>5</the_reference>
     <something>4</something>

would unfortunately be regarded as compliant to the model.

On the other hand the data model should be Yang1.0 compliant. So I want to
check if there is any other solution to the issue.

Add a (very specific) must constraint to the "something" leaf? Something along the lines of:

leaf the_reference {type uint8;}
  leaf something {
    must "(not(number()) and not(. = 0)) or . = /the_reference";
    type union {
      type uint8;
      type enumeration {
        enum "none";
        enum "something-else";
      }
    }
  }

for this particular example. Ugly, yes, but (probably) works. The above requires "not a number or same as 'the_reference'".

Jernej


Best regards,
Jens

Lada

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





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

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

Reply via email to