Subject: [netmod] Module update rules: changing a type to a union

From: "Sterne, Jason (Nokia - CA/Ottawa)" <[email-masked]>
Date: Fri, 10 Aug 2018 15:19:40 +0000

Hi all,

I'm uncertain about how to interpret the YANG module update rules when a type changes to a union.

Is the following change allowed?

From:
  typedef my-type {
    type enumeration {
      enum "foo";
    }
  }
To:
  typedef my-type {
    type union {
      type enumeration {
        enum "foo";
      }
      type uint32;
    }
  }

The general spirit of the rules is that expanding the value space is generally OK, but this case does seem to violate this paragraph of section 11:

   o  A "type" statement may be replaced with another "type" statement
      that does not change the syntax or semantics of the type.  For
      example, an inline type definition may be replaced with a typedef,
      but an int8 type cannot be replaced by an int16, since the syntax
      would change.

Does the addition of the union change the semantics of the type if that union encompasses the original type?

With XML encoding I can see how an "old" client could easily still communicate with a "new" server for this change. But I wonder about other possible encodings that might change when a type becomes a union that contains additional types.

Regards,
Jason

---

From: Alex Campbell <[email-masked]>
Date: Sun, 12 Aug 2018 23:22:41 +0000

Hi,

It seems to be that the rule you quoted specifically states that expanding the value space is not okay:

________________________________
From: netmod <[email-masked]> on behalf of Sterne, Jason (Nokia - CA/Ottawa) <[email-masked]>
Sent: Saturday, 11 August 2018 3:19 a.m.
To: [email-masked]
Subject: EXTERNAL: [netmod] Module update rules: changing a type to a union

Hi all,

From:
  typedef my-type {
    type enumeration {
      enum "foo";
    }
  }
To:
  typedef my-type {
    type union {
      type enumeration {
        enum "foo";
      }
      type uint32;
    }
  }

Regards,
Jason

---

From: Martin Bjorklund <[email-masked]>
Date: Mon, 13 Aug 2018 12:08:16 +0200 (CEST)

>       but an int8 type cannot be replaced by an int16, since the syntax

Right.  I think that changing from an enumeration to a union changes
the syntax of the type, so this would not be allowed.

/martin

---

From: "Sterne, Jason (Nokia - CA/Ottawa)" <[email-masked]>
Date: Mon, 13 Aug 2018 11:35:04 +0000

OK - thx Martin and Alex.  It seems the conclusion is that changing a type to a union is not allowed.

> -----Original Message-----
> From: Martin Bjorklund <[email-masked]>
> Sent: Monday, August 13, 2018 6:08 AM
> To: Sterne, Jason (Nokia - CA/Ottawa) <[email-masked]>
> Cc: [email-masked]
> Subject: Re: [netmod] Module update rules: changing a type to a union
> 
> > The general spirit of the rules is that expanding the value space is generally
> OK, but this case does seem to violate this paragraph of section 11:
> >
> > With XML encoding I can see how an "old" client could easily still
> communicate with a "new" server for this change. But I wonder about other
> possible encodings that might change when a type becomes a union that
> contains additional types.
> >
> > Regards,
> > Jason