netmod-wg / yang-next

Feature requests for future versions of YANG
6 stars 0 forks source link

Changing an identity base #122

Open italobusi opened 1 year ago

italobusi commented 1 year ago

Since, as explained in section 7.18.2 of RFC7950, the derivation of identities is transitive, replacing a "base" statement with new "base" statement which is derived from the previous one is also a BC change.

See Netmod WG discussion thread: https://mailarchive.ietf.org/arch/msg/netmod/weIxTUX4bDmWMpVNxcZJkgOYjaY/

abierman commented 2 months ago

Not sure if any text needs clarification. Adding another base to an identity is a BC change.

Maybe this is related to some issues in #107

base-stmt

Close

italobusi commented 2 months ago

There is more explanation in the referenced mail thread on Netmod WG mailing list

The issue is that NEW (A) is BC according to RFC7950 rules, while NEW (B), which is equivalent to NEW (A), seems not BC according to RFC7950:

OLD

identity foo {}

identity bar {
  base foo;
}

NEW (A)

identity foo {}

identity baz {
  base foo
}

identity bar {
  base foo;
  base baz;
}

NEW (B)

identity foo {}

identity baz {
  base foo
}

identity bar {
  base baz;
}

I think the issue is different from #107

abierman commented 2 months ago

You are right.

The extremely picky update rules do not mention replacing the base.

   o  A "base" statement may be added to an "identity" statement.

   o  A "base" statement may be removed from an "identityref" type,
      provided there is at least one "base" statement left.

The problem is that identities are used differently in different places

kwatsen commented 1 month ago

Clarification seems important.

italobusi commented 1 month ago
  • XPath equality expression: a lot of this in the wild. This replacement does not work

@abierman I am not sure I understand this comment

Are you considering the following XPath equality expression data-node="bar"?

PS: currently, yanglint is raising a warning when getting these expression and in most (if not all) of the cases, I usually replace with with a derived-from-or-self(data-node, "bar") expression