Subject: [netmod] does a union leaf preserve the input format ?

From: "Sterne, Jason (Nokia - CA)" <[email-masked]>
Date: Wed, 8 Feb 2017 04:15:56 +0000

Hi all,

>From RFC6020/7950 and a search in the netmod archives I'm not certain if a leaf defined as a union is required to preserve the representation that was set in an edit by a client.

For example:

  leaf ip-protocol {
    type union {
      type uint8 {
        range 0..254;
      }
      type enumeration {
        enum icmp;
        enum tcp;
         ...
      }
    }

If an <edit-config> sets ip-protocol to tcp:
                <ip-protocol>tcp</ip-protocol>

is it expected that a <get-config> would return 'tcp' and not '6' ?

I can see in the RFCs that during an edit, the value is checked against each union type in order.  But not certain that the rest of the language that describes union indicates whether the syntax/format should be preserved from the original input.

Or is a server free to reply to a <get-config> with either 'tcp' or '6' in the example above ?

There are some common uses of union that this question is applicable to -> dscp ('10' vs 'af11'), ip addresses (especially ipv6), well know port numbers, etc.

Regards,
Jason

---

From: Juergen Schoenwaelder <[email-masked]>
Date: Wed, 8 Feb 2017 08:57:04 +0100

Jason,

I do not recall we ever discussed this question. I think the union
should by default remember the type selected and thus if you configure
'tcp' the value returned should be 'tcp' unless otherwise stated in
the description statement (i.e., the description statement says that
the canonical format of the union is always a number).

Note that type specific canonicalization still applies according to
the type selected. For example, if there is an ipv6-address in a
union, then the value '0::1' should still be converted to '::1'.

(I know, this leaves the possibility that one can construct a union of
two types where type B is selected by a value but the canonicalization
applied by type B returns a value that would select type A. I consider
this a pathological case that deserves specific text in the
description statement.)

/js

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

-- 
Juergen Schoenwaelder           Jacobs University Bremen gGmbH
Phone: +49 421 200 3587         Campus Ring 1 | 28759 Bremen | Germany
Fax:   +49 421 200 3103         <http://www.jacobs-university.de/>