Subject: [yang-doctors] YANG QUIC-LB model

From: Martin Duke <[email-masked]>
Date: Mon, 1 Feb 2021 17:45:16 -0800

Hello yang-doctors,

I don't know that this rises to the level of a full review, but the QUIC-LB
draft (currently adopted by the QUIC WG) is basically a standard for
configuration of QUIC Load Balancers and servers to work together. After
much reluctance to take on a format I don't understand, I took a shot at a
YANG model:

https://github.com/quicwg/load-balancers/blob/yang/draft-ietf-quic-load-balancers.md

(The YANG stuff is in an appendix near the end -- search for #yang-model).

Before we talk about a full review where you labor to understand the data
items, I'd appreciate an informal quick sanity check that I am doing this
roughly correctly, as I have zero experience with YANG.

One other silly question: I have a field whose length depends on other
fields. Can you give me an example on how to express this correctly? e.g.

leaf foo-length {
    type uint8
}

leaf foo {
    type yang:hex-string {
        length foo-length;
    }
}

Thanks,
Martin

---

From: Ladislav Lhotka <[email-masked]>
Date: Tue, 02 Feb 2021 08:49:51 +0100

Hi,

just responding to your question near the end.

> fields. Can you give me an example on how to express this correctly? e.g.

leaf foo {
    type yang:hex-string;
    must "string-length(.) = ../foo-length";
}

Lada

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

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

---

From: Martin Björklund <[email-masked]>
Date: Tue, 02 Feb 2021 08:56:17 +0100 (CET)

Hi,

> roughly correctly, as I have zero experience with YANG.

I downloaded the module and ran it through a YANG compiler, and
started to fix several minor syntactical errors (such as missing ";"),
but then I ran into other issues that made it difficult for me to
guess what you meant.  I suggest you ensure that the model compiles
(there are a bunch of compilers available, e.g., pyang, yanglint, ...)
and post it again.

Some comments though:

You have:

       list cid-configs {
         key "config-rotation-bits";

         leaf config-rotation-bits {
           type uint8 {
             range "0..2";
           }

This means that there can only be max 3 entries in this list.  Is that
what you meant?

You also have:

       typedef quic-lb-key {
         type yang:hex-string {
           length 16;
         }
       }

The YANG statement "length", when given on a type "string", or derived
from "string", operates on the number of characters in the string.  In
this case, you probably what to limit the number of bytes represented
by the hex-string.  Unfortunately, it is not possible in standard YANG
1.1 to do this.

However, in this particular case it sort-of works, since the length of
the hex-string is 2 * N + 1, where N is the number of bytes.  Hence,
the length would be 33.  If you do this I suggest you explain this in
the description statement.

An alternative could be to drop the length statement and only explain
it in the description statement.

> fields. Can you give me an example on how to express this correctly? e.g.

This is possible by using a "must" statement.  However, it has the
same problem with the lexical value as above:

  leaf foo {
    type yang:hex-string;
    must 'string-length(.) = 2 * ../foo-length + 1';
  }

/martin

---

From: Jan Lindblad <[email-masked]>
Date: Tue, 2 Feb 2021 09:26:20 +0100

Martin,

Actually, I think the string length is "0 | 3 * N - 1" since each byte is encoded as two hex digits and a colon, except the last byte which is just two hex digits, as in "11:22:33:44". But I wonder, why do you need a configured value for the length at all? Would it not suffice that the operator configures the hex-string and let the system figure out the length based on that?

I did a quick scan of your module. It has a lot of trivial issues (naming, mandatory, prefix, ...) that are easy to fix, but overall I think you've understood how to do this.

Best Regards,
/jan

> On 2 Feb 2021, at 08:56, Martin Björklund <[email-masked]> wrote:
> 
> Hi,
> 
> 
> Martin Duke <[email-masked] <mailto:[email-masked]>> wrote:
>> Hello yang-doctors,
>> 
> [email-masked] <mailto:[email-masked]>
> https://www.ietf.org/mailman/listinfo/yang-doctors <https://www.ietf.org/mailman/listinfo/yang-doctors>

---

From: Ladislav Lhotka <[email-masked]>
Date: Tue, 2 Feb 2021 09:26:36 +0100

> by the hex-string.  Unfortunately, it is not possible in standard YANG

An alternative then might be to use the "binary" type, its length
restriction is related to the number of octets.

Lada

---

From: Martin Duke <[email-masked]>
Date: Tue, 2 Feb 2021 16:43:51 -0800

Hello all,

Thanks very much for your comments -- I was able to get the model to
compile.

To answer mbj's question, yes there should be no more than three items.

I look forward to requesting a full review when the model stabilizes a
little more. You have made this process relatively painless.

Martin

On Tue, Feb 2, 2021 at 12:26 AM Jan Lindblad <[email-masked]> wrote:

> Martin,
>
> Actually, I think the string length is "0 | 3 * N - 1" since each byte is
> encoded as two hex digits and a colon, except the last byte which is just
> two hex digits, as in "11:22:33:44". But I wonder, why do you need a
> configured value for the length at all? Would it not suffice that the
> operator configures the hex-string and let the system figure out the length
> based on that?
>
> I did a quick scan of your module. It has a lot of trivial issues (naming,
> mandatory, prefix, ...) that are easy to fix, but overall I think you've
> understood how to do this.
>
> Best Regards,
> /jan
>
>
>