"GUBALLA, JENS (JENS)" <jens.guba...@alcatel-lucent.com> wrote: > Hi Lada, > > > -----Original Message----- > > From: Ladislav Lhotka [mailto:lho...@nic.cz] > > Sent: Freitag, 11. Dezember 2015 11:51 > > To: GUBALLA, JENS (JENS) > > Cc: netmod@ietf.org > > 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.
Another common way to handle this is to do a choice of two leafs: choice s { leaf something-as-leafreaf { type leafreaf ... } leaf something-as-enum { ... } } /martin _______________________________________________ netmod mailing list netmod@ietf.org https://www.ietf.org/mailman/listinfo/netmod