openBackhaul / core

Core Information Model that consolidates all technology specific extension
Apache License 2.0
1 stars 0 forks source link

Identityref pointing to base identity is not valid #9

Closed alexandrustancu closed 1 year ago

alexandrustancu commented 4 years ago

I've found the following scenario in the core-model, detailed below.

Context: the switch-selection-reason leaf is an identityref, pointing to the SWITCH_STATE_REASON base identity.

The problem is that the core-model defines only the base identity, SWITCH_STATE_REASON and no other identities that extent this base one.

In the device implementation of the core-model, the leaf switch-selection-reason will need to have a valid value. But no other identities besides the base identity SWITCH_STATE_REASON are defined in the core-model. This means that if a device implements only the core-model, it cannot provide a valid value for the switch-selection-reason, because having a reference to the base identity is not a valid value. According to the YANG RFC 6020: "Valid values for an identityref are any identities derived from the identityref's base identity."

This means that the core-model needs to define another identity derived from the base identity SWITCH_STATE_REASON.

Proposed solution: define a new identity derived from the base identity. All other base identities defined in the core-model have such derived identities, except for the SWITCH_STATE_REASON.

E.g.:

identity SWITCH_STATE_REASON_NONE { base SWITCH_STATE_REASON; description "No reason"; }

Otherwise, a device that implements the core-model might be unable to provide a valid YANG, according to RFC 6020.

openBackhaul commented 4 years ago

Added the following segments manually to core-model-1-4 YANG

  identity ROUTE_SELECTION_REASON_NONE {
    base ROUTE_SELECTION_REASON;
    description
      "No reason";
  }

and

  identity SWITCH_STATE_REASON_NONE {
    base SWITCH_STATE_REASON;
    description
      "No reason";
  }

Entries have to be made in the UML as well.

PrathibaJee commented 2 years ago
openBackhaul commented 1 year ago

Implemented as decided.