On Mon, Sep 27, 2021 at 9:21 AM Sterne, Jason (Nokia - CA/Ottawa) <
jason.ste...@nokia.com> wrote:

> Hi all,
>
> Reserving a "magic value" like -1 may be workable, but it doesn't feel
> like a terribly good fit into YANG. The rest of the range of integer values
> are valid and it seems odd to just tack on a "-1".
>
> Why not just make the absence of the leaf mean "not applicable" or "not
> available" or whatever you are thinking of encoding as "null" ?
>
> I've seen discussions where an SNMP MIB (which uses magic values like -1
> or 0) was mapped to YANG and the result was simply to map the -1 (or 0) to
> the "absence of the leaf" (especially for read only state).
>
> If it really is critical to distinguish these two cases (which I'm pretty
> doubtful of for an individual leaf like this), then I think at least an
> enum more distinctly separates the valid range from the special "not
> applicable" token:
> 1) leaf was filtered out due to AAA rules
> 2) leaf wasn't returned because it is not-applicable/not-available
>
>

IMO this is not a real problem.
There is an assumption that access control is setup correctly.
The NACM default is to allow all reads so explicit rules are needed
to remove access to config=false data nodes.

It is clearly better to omit nodes rather than return them with "not set"
indications.
This reduced the amount of data transferred which may matter to the
operator.

SNMP GetNext and GetBulk do not handle missing nodes well at all, so it
became
common practice to return 0 or -1, etc. to simplify client processing of
these operations.
None of the YANG-based protocols have this problem.


> Jason
>

Andy


>
> > -----Original Message-----
> > From: netmod <netmod-boun...@ietf.org> On Behalf Of STARK, BARBARA
> > H
> > Sent: Tuesday, September 14, 2021 9:52 AM
> > To: 'tom petch' <ie...@btconnect.com>; 'Juergen Schoenwaelder'
> > <j.schoenwael...@jacobs-university.de>; 'Mahesh Jethanandani'
> > <mjethanand...@gmail.com>
> > Cc: 'Babel at IETF' <ba...@ietf.org>; 'netmod@ietf.org' <netmod@ietf.org
> >
> > Subject: Re: [netmod] [babel] NULL value for uint16
> >
> >
> >
> > > I seem to be coming into this discussion in the middle, so I hope I'm
> > > understanding where things are. Comments in-line.
> > >
> > > > Hi Mahesh,
> > > >
> > > > management interface usually do not change protocol semantics (for
> the
> > > > simple reason that protocol engines do not necessarily know which
> > > > management interfaces control them and their peers).
> > > >
> > > > Does the Babel RFC reserve the special sequence number 0? If not,
> does
> > > > this document formally update the Babel RFC to reserve the sequence
> > > > number 0? And will implementations and deployments follow on or will
> > > > we see "old" and "updated" implementations in the wild causing
> > > > operational trouble?
> > >
> > > Yes, the Babel RFC makes it clear that 0 is a valid value that must
> not be
> > > confused with NULL.
> > > I have no idea what conventions exist for a YANG model to distinguish
> > between
> > > 0 and NULL in such cases, but merely expressed that the distinction
> must
> > exist.
> > > Whatever conventions exist within YANG to make this distinction can be
> > used. It
> > > sounded from Tom's email that several conventions exist for handling
> this.
> > > Under no circumstances should this YANG model allow the valid value of
> > zero to
> > > be repurposed to mean NULL.
> > >
> > > <tp>
> > > Barbara,
> > >
> > > Apologies for making a mess of raising this issue; I am struggling with
> > webmail
> > > and a PC that has a mind of its own such that I cannot send e-mails
> where I
> > want
> > > to or even when I want to:-(
> > >
> > > Anyhow, I agree that the Information model makes it clear the NULL and
> > zero
> > > are different.  YANG has no concept of NULL; some languages do, YANG
> > does
> > > not.  This raises  number of possibilities.
> > >
> > > One is to deviate from the Information Model and treat zero as NULL
> but I
> > > would not expect that to be acceptable.
> > >
> > > Another it to modify the range by making uint16 into int16 and making a
> > > negative value represent NULL in this model.  Again, I would not expect
> > that to
> > > be acceptable but you could make it a int32 or uint32 with a range
> > restriction
> > > such that one value means NULL..
> > >
> > > Another is to make the objects a YANG union of uint16 and something
> else.
> > > YANG has a built-in type 'empty' which has no value(!) and so a union
> of
> > uint16
> > > and empty is probably the closest YANG gets.  A similar approach is a
> union
> > of
> > > uint16 and boolean.  My YANG is not up to the merits of the two
> > approaches.  I
> > > have never been comfortable with 'empty' but there is plenty of it
> about in
> > the
> > > IETF. By the same token, almost all models have a union in the shape
> of an
> > ip
> > > address which is a union of ipv4 address and ipv6 address; a union is
> > something I
> > > am comfortable with.
> > >
> > > I do not know of an exact parallel to what you want to do.  I do see
> 'null' as
> > one
> > > value of the text string in an enumeration which is fine for
> enumerations!  I
> > also
> > > see the choice/case construct used with one case having a YANG type
> > 'empty'
> > > which is perhaps the closest if you do not want to use a union.
> > >
> > > HTH
> > >
> > > Tom Petch
> >
> > Hi Tom,
> > Thanks for making this an issue! I think it's important that we get it
> right.
> > This is something Mahesh and I have discussed several times (and we still
> > apparently didn't get it right).
> > As I mentioned, BBF TR-181 uses int with range        -1:65535 with -1
> > meaning NULL. So I certainly have no issue with that approach. The
> language
> > in RFC9046 was intended to make sure this approach was allowed, since
> this
> > is how it's done in TR-181.
> > I guess I am a bit surprised to learn that YANG doesn't seem to have a
> > preferred way to handle this. Unfortunately, given my considerable lack
> of
> > YANG expertise, I can't recommend the "right" way to model this in YANG.
> I
> > can only insist that the model be able to express a value in the range 0
> to
> > 2^16 and NULL value for these parameters.
> > Independent of the fact that the words in RFC9046 don't seem to have
> > expressed this perfectly clearly, that is absolutely the intent of those
> words. I
> > apologize that the RFC9046 words don't seem to be sufficiently clear.
> >
> > Since you do mention the possibility of using -1 for NULL, I'd like to
> > understand who might find this approach unacceptable? The language in the
> > information model was definitely intended to express the acceptability of
> > using this approach from a Babel WG perspective (because I knew that's
> how
> > it would be done in TR-181). Would this be unacceptable to people with
> > YANG expertise? I think my preference would be to use this approach,
> since
> > it would provide additional consistency between the TR-181 and YANG
> > models.
> >
> > Thanks again for raising this issue.
> > Barbara
> >
> > > > /js
> > > >
> > > > On Mon, Sep 13, 2021 at 12:49:33PM -0700, Mahesh Jethanandani wrote:
> > > > > [Bringing in babel WG, instead of maintaining two threads]
> > > > >
> > > > >
> > > > > Hi Juergen,
> > > > >
> > > > >
> > > > > > On Sep 10, 2021, at 1:09 PM, Jürgen Schönwälder
> > > > <j.schoenwael...@jacobs-university.de> wrote:
> > > > > >
> > > > > > On Fri, Sep 10, 2021 at 01:40:03PM -0400, Lou Berger wrote:
> > > > > >
> > > > > >> and it references an RFC that says:
> > > > > >>
> > > > > >>      This is a 16-bit unsigned integer;
> > > > > >>      if the data model uses zero (0) to represent NULL values
> for
> > > > > >>      unsigned integers, the data model MAY use a different data
> type
> > > > > >>      that allows differentiation between zero (0) and NULL.
> > > > > >
> > > > > > We are talking about RFC 9046? RFC 9046 repeats this sentence
> > several
> > > > > > times but I find it difficult to infer the intended meaning. If
> 0 is a
> > > > > > legal value, you can't have it represent "NULL" at the same time.
> > > > >
> > > > > There are five definitions in the Babel YANG model
> > > > <https://urldefense.com/v3/__https://www.ietf.org/archive/id/draft-
> > ietf-
> > > > babel-yang-model-
> > > >
> > >
> > 11.html__;!!BhdT!w6VP0VXwBo8HQB7xl29xPqAxO7zHbtal44Pwbxrh6lIs8a04
> > rPj
> > > > 0rzZ_DACdBQ$ > that use NULL to represent a special meaning.
> > > > >
> > > > > With 'babel-route-received-metric', and
> 'babel-route-calculated-metric'
> > > > values use NULL or 0 to represent that a route was NOT received. A
> non-
> > zero
> > > > value indicates that a route was received and subsequently
> advertised.
> > > > >
> > > > > With 'babel-expo-mcast-hello-seqno', and 'babel-exp-ucast-hello-
> > seqno' a
> > > > value of NULL or 0 is used to represent that a multicast, or unicast
> hello
> > > packets
> > > > respectively are NOT expected or processing of multicast/unicast
> packets
> > is
> > > not
> > > > enabled. Although not explicit stated, it also means that the
> sequence
> > number
> > > > cannot be a 0.
> > > > >
> > > > > Finally, with 'babel-ucast-hello-seqno' a value of NULL or 0 is
> used to
> > > > represent a unicast hello is not being sent. A non-zero value
> reflects the
> > > current
> > > > sequence number in use for unicast hellos. Again, although not
> explicit, it
> > also
> > > > means that the sequence number cannot be a 0.
> > > > >
> > > > > >
> > > > > > In YANG, we tend to not instantiate leafs that do not have a
> value.
> > > > > > Anyway, if a YANG author wants to report a special value to
> indicate
> > > > > > that there is no value, then you have design for it and reserve
> and
> > > > > > set aside a special value from the number space or use a union.
> > > > >
> > > > > This YANG model reserves the value of 0 to indicate that these
> leafs are
> > not
> > > > set or the particular attribute is not enabled.
> > > > >
> > > > > Thanks.
> > > > >
> > > > > >
> > > > > > RFC 9046 uses the same text for things like sequence numbers.
> > Skimming
> > > > > > RFC 8966, it seems sequence numbers are 16-bit integers:
> > > > > >
> > > > > >   Sequence numbers (seqnos) appear in a number of Babel data
> > > > > >   structures, and they are interpreted as integers modulo 2^(16).
> > > > > >
> > > > > > The text in the context makes me believe they are an unsigned
> 16-bit
> > > > > > integers. If so, there simply is no way to use 0 to indicate
> that a
> > > > > > sequence number is absent. The problem really might be the text
> in
> > RFC
> > > > > > 9046.
> > >
> > > RFC9046 text is intended to allow and encourage data models to do
> > whatever
> > > they need to do to ensure they can distinguish between a value of 0
> and a
> > NULL
> > > value. For example, in BBF TR-181 data model, we use a signed integer
> for
> > these
> > > parameters, where "-1" means "null value" and 0 to 2^16 represent
> actual
> > > values. This use of -1 and a signed integer to convey NULL for an
> unsigned
> > > integer is a convention that has long been defined in TR-181 data
> modeling
> > > rules. OTOH, Babel implementations written in languages like C *are*
> able
> > to
> > > distinguish between a zero-length variable and a zero-value variable
> -- so
> > their
> > > GUIs have no difficulty with this distinction and can simply use an
> unsigned
> > > integer.
> > >
> > > Different data modeling languages are likely to each have their own
> > mechanisms
> > > for handling this -- which means it would have been improper for
> RFC9046
> > to be
> > > proscriptive about *how* a data model should distinguish between null
> > and 0.
> > > Therefore, the text in RFC9046 merely states that although the native
> > variable is
> > > a 16-bit unsigned integer, it must be possible to indicate null as
> something
> > > distinct from 0. RFC9046 does not dictate how that should be
> accomplished.
> > The
> > > data model needs to ensure this distinction exists using whatever
> method
> > makes
> > > sense or whatever convention exists for that data modeling language.
> > > Barbara
> > >
> > > _______________________________________________
> > > netmod mailing list
> > > netmod@ietf.org
> > >
> > https://urldefense.com/v3/__https://www.ietf.org/mailman/listinfo/netmo
> > d__;
> > > !!BhdT!z9HMtl5ev04-D11rq22Qye-5_sscMd1C-
> > > sWwIDBqeMrQ2tPPXauYRZI_wB2KAA$
> >
> > _______________________________________________
> > netmod mailing list
> > netmod@ietf.org
> > https://www.ietf.org/mailman/listinfo/netmod
>
> _______________________________________________
> netmod mailing list
> netmod@ietf.org
> https://www.ietf.org/mailman/listinfo/netmod
>
_______________________________________________
netmod mailing list
netmod@ietf.org
https://www.ietf.org/mailman/listinfo/netmod

Reply via email to