Hi Joey,

Your proposal looks fine to me, since it doesn't change the semantics of the 
data model.  Note that https://tools.ietf.org/html/rfc7950#section-11 says:

   o  Any set of data definition nodes may be replaced with another set
      of syntactically and semantically equivalent nodes.  For example,
      a set of leafs may be replaced by a "uses" statement of a grouping
      with the same leafs.

Kent

--

Hello,

Does anyone have thoughts on this?

Regards,
Joey

-----Original Message-----
From: JOEY BOYD 
Sent: Wednesday, September 27, 2017 9:06 AM
To: 'netmod@ietf.org'
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

_______________________________________________
netmod mailing list
netmod@ietf.org
https://urldefense.proofpoint.com/v2/url?u=https-3A__www.ietf.org_mailman_listinfo_netmod&d=DwICAg&c=HAkYuh63rsuhr6Scbfh0UjBXeMK-ndb3voDTXcWzoCI&r=9zkP0xnJUvZGJ9EPoOH7Yhqn2gsBYaGTvjISlaJdcZo&m=vi3qkFb6HjmIlHo1rXJ2EV-Px58aFLqNc_L6hFsiug4&s=RBiaGoEWCnihPqGVmD6nyVoG_-2vlalhOsqwUjsSRqg&e=
 


_______________________________________________
netmod mailing list
netmod@ietf.org
https://www.ietf.org/mailman/listinfo/netmod

Reply via email to