Subject: Re: [netmod] Backward Compatibility Question

From: JOEY BOYD <[email-masked]>
Date: Mon, 2 Oct 2017 13:15:40 +0000

Hello,

Does anyone have thoughts on this?

Regards,
Joey

-----Original Message-----
From: JOEY BOYD 
Sent: Wednesday, September 27, 2017 9:06 AM
To: [email-masked]'
Subject: Backward Compatibility Question

Hi all,

Suppose I had a published YANG model with the following leaf.

  leaf thing1 {
    type uint8;
    description
      "Thing 1.";
  }

Later, I realize that I wish I had modeled this in a choice as I now have a mutually exclusive option to 'thing1' which I want to add to the model.

  leaf thing2 {
    type empty;
    description
      "Thing 2.";
  }

This is a very simplified example but should be sufficient to demonstrate the problem. 

If I look at the XML representation of 'thing1', it looks like this.

<thing1>123</thing1>

If I were to move 'thing1' into a choice with a single case, it would look like this.

choice things {
  case thing1 {
    leaf thing1 {
      type uint8;
      description
        "Thing 1.";
    }
  }
}

Looking to the XML representation, it looks the same as before.

<thing1>123</thing1>

To me, this means that taking a single node or set of nodes and moving them under a case within a new choice statement is a backward compatible change. This assumes, of course, any mandatory or default behavior is preserved. I now can add 'thing2' to the existing model as an option to 'thing1'.

choice things {
  case thing1 {
    leaf thing1 {
      type uint8;
      description
        "Thing 1.";
    }
  }
  case thing2 {
    leaf thing2 {
      type empty;
      description
        "Thing 2.";
    }
  }
}

Do you agree with this analysis or am I missing something?

Best regards,
Joey

---

From: Andy Bierman <[email-masked]>
Date: Mon, 2 Oct 2017 09:27:39 -0700

> Does anyone have thoughts on this?

The choice and case nodes are schema nodes so they are never an issue
for data tree XPath such as must/when.

The change works in your example because a leaf cannot be augmented.
If it was container and some other module augmented it, that module
will break if the container is changed to a choice.

> Joey

Andy

> Later, I realize that I wish I had modeled this in a choice as I now have
> a mutually exclusive option to 'thing1' which I want to add to the model.
>
>   leaf thing2 {
>     type empty;
>     description
>       "Thing 2.";
>   }
>
> To me, this means that taking a single node or set of nodes and moving
> them under a case within a new choice statement is a backward compatible
> change. This assumes, of course, any mandatory or default behavior is
> preserved. I now can add 'thing2' to the existing model as an option to
> 'thing1'.
>
> choice things {
>   case thing1 {
>     leaf thing1 {
>       type uint8;
>       description
>         "Thing 1.";
>     }
>   }
>   case thing2 {
>     leaf thing2 {
>       type empty;
>       description
>         "Thing 2.";
>     }
>   }
> }
>
> _______________________________________________
> netmod mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/netmod
>

---

From: Martin Bjorklund <[email-masked]>
Date: Mon, 02 Oct 2017 19:19:25 +0200 (CEST)

> Looking to the XML representation, it looks the same as before.

But it is not backwards compatible, since the schema tree has
changed.  Suppose that "thing1" was a container; then some other
module might have augmented that container.  If you put the node in a
choice and case, the augment will no longer work.

/martin