JOEY BOYD <[email protected]> wrote:
> Hello,
> 
> Does anyone have thoughts on this?
> 
> Regards,
> Joey
> 
> -----Original Message-----
> From: JOEY BOYD 
> Sent: Wednesday, September 27, 2017 9:06 AM
> To: '[email protected]'
> 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.

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




> 
> <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
> 
> _______________________________________________
> netmod mailing list
> [email protected]
> https://www.ietf.org/mailman/listinfo/netmod
> 

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

Reply via email to