Subject: [netmod] YANG questions

From: Tony Li <[email-masked]>
Date: Thu, 1 Apr 2021 17:24:55 -0700

Hi,

I have some basic questions about YANG. I’m pretty certain this is NOT the right place to ask them, so please feel free to redirect me.

1) Is there a way to define the width of an enumeration?  Suppose I had an enumeration that was in a 16 bit field, how do I describe that?

2) How do I model a non-octet sized multi-bit field?  For example, if there is a 5 bit numeric value as part of some ‘bits’?  Position only takes a single value, I can’t really say ‘position 3-7’.

Thanks,
Tony

---

From: Ladislav Lhotka <[email-masked]>
Date: Fri, 02 Apr 2021 10:27:57 +0200

> 1) Is there a way to define the width of an enumeration?  Suppose I had an enumeration that was in a 16 bit field, how do I describe that?

In the description, if necessary. However, this should be an implementation detail, as long as the underlying numeric type can accommodate all enums.

You could perhaps also define and enum for the highest possible value and make in reserved.

> 2) How do I model a non-octet sized multi-bit field?  For example, if there is a 5 bit numeric value as part of some ‘bits’?  Position only takes a single value, I can’t really say ‘position 3-7’.

In this case, I would question whether the 'bits' type is really appropriate. It might be useful to split the value into multiple items in YANG.

Lada

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

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

---

From: Tony Li <[email-masked]>
Date: Fri, 2 Apr 2021 09:14:10 -0700

Hi Lada,

Thanks for your reply.  At heart, I guess I’m asking a more fundamental question: is YANG intended as a data modelling language or as a data structure modelling language?

Your reply suggests the former: structure is irrelevant to YANG.  If that’s true, then what’s the point in ‘position’?  And why do you need ‘bits’ when you have ‘binary’?

Confused,
Tony

> On Apr 2, 2021, at 1:27 AM, Ladislav Lhotka <[email-masked]> wrote:
>

---

From: "Acee Lindem (acee)" <[email-masked]>
Date: Fri, 2 Apr 2021 17:23:22 +0000

Hi Tony,

I would argue that YANG is a data modeling language. Another disadvantage of the bits type that it isn't augmentable with new bits. Hence, usage of unused bits requires a new version of the module as opposed to an augmentation. For that reason, we greatly limited their usage in routing modules and used identities instead. 

Thanks,
Acee

On 4/2/21, 12:14 PM, "netmod on behalf of Tony Li" <[email-masked] on behalf of [email-masked]> wrote:

    Hi Lada,

    Confused,
    Tony

---

From: Andy Bierman <[email-masked]>
Date: Fri, 2 Apr 2021 11:13:24 -0700

On Fri, Apr 2, 2021 at 10:23 AM Acee Lindem (acee) <acee=
[email-masked]> wrote:

> Hi Tony,
>
> I would argue that YANG is a data modeling language. Another disadvantage
> of the bits type that it isn't augmentable with new bits. Hence, usage of
> unused bits requires a new version of the module as opposed to an
> augmentation. For that reason, we greatly limited their usage in routing
> modules and used identities instead.
>
>
The line between data model and implementation is blurry with YANG +
extensions.
Most of us want YANG data to be independent of the encoding format.

> Acee

Andy

>
> On 4/2/21, 12:14 PM, "netmod on behalf of Tony Li" <
> [email-masked] on behalf of [email-masked]> wrote:
>
>
>     Hi Lada,
>
>     Thanks for your reply.  At heart, I guess I’m asking a more
> fundamental question: is YANG intended as a data modelling language or as a
> data structure modelling language?
>
>     Your reply suggests the former: structure is irrelevant to YANG.  If
> that’s true, then what’s the point in ‘position’?  And why do you need
> ‘bits’ when you have ‘binary’?
>
>     Confused,
>     Tony
>
>
>     >> I have some basic questions about YANG. I’m pretty certain this is
> NOT the right place to ask them, so please feel free to redirect me.
>     >>
>     >>
>     >> 1) Is there a way to define the width of an enumeration?  Suppose I
> had an enumeration that was in a 16 bit field, how do I describe that?
>     >
>     > In the description, if necessary. However, this should be an
> implementation detail, as long as the underlying numeric type can
> accommodate all enums.
>     >
>     >> 2) How do I model a non-octet sized multi-bit field?  For example,
> if there is a 5 bit numeric value as part of some ‘bits’?  Position only
> takes a single value, I can’t really say ‘position 3-7’.
>     >
>     > In this case, I would question whether the 'bits' type is really
> appropriate. It might be useful to split the value into multiple items in
> YANG.
>     >
>     > Lada
>     >
>     >>
>     >> Thanks,
>     >> Tony

---

From: Carsten Bormann <[email-masked]>
Date: Fri, 2 Apr 2021 21:11:19 +0200

> Thanks for your reply.  At heart, I guess I’m asking a more fundamental question: is YANG intended as a data modelling language or as a data structure modelling language?

I can’t answer that, but I can point out that YANG is easily extended by representation-level attributes:

https://datatracker.ietf.org/doc/html/draft-petrov-t2trg-youpi-01

Of course, there is also CDDL (https://www.rfc-editor.org/rfc/rfc8610.html).
Over in ASDF, we are also discussing “mapping files” for SDF as a way to bind the abstract data model into something more concrete.

Finally, there is a non-WG mailing list for formal description techniques, [email-masked].

Grüße, Carsten