Resolve "Update the models to address the new resource state model"

Closes #12

Merge request reports

Loading
−6

File deleted.

+67
Changes for docs/20260829_1610_add-crcheckval-state-health-characteristics.md: 67 added lines, 0 removed lines.
Original line number Diff line number Diff line
# Add X.731 state + health `_CR_CHECKVAL_` characteristics to KubernetesCRDV1 / KubernetesCRV1

Date: 2026-08-29 16:10
Branch: `12-update-the-models-to-address-the-new-resource-state-model`

## Why

Issue #12 introduced the ITU-T X.731 resource state model on
`org.etsi.osl.tmf.ri639.model.Resource`:

- `ResourceAdministrativeStateType` — LOCKED / UNLOCKED / SHUTDOWN
- `ResourceOperationalStateType` — ENABLE / DISABLE
- `ResourceUsageStateType` — IDLE / ACTIVE / BUSY
- `ResourceHealth` (derived) — UP / PENDING / DOWN / HELD / GONE

Until now `KubernetesCRDV1` / `KubernetesCRV1` only let an operator map an observed CR
status-field value onto a `ResourceStatusType` (`_CR_CHECK_FIELD` +
`_CR_CHECKVAL_STANDBY|ALARM|AVAILABLE|RESERVED|UNKNOWN|SUSPENDED`). `ResourceStatusType` is now
inventory/pool bookkeeping only; health lives in the X.731 pair. Operators need the same
value-mapping mechanism for the new state dimensions.

## What changed

Both `KubernetesCRDV1` and `KubernetesCRV1`:

1. **13 new `String` backing fields** alongside the existing `statusCheckValue*` block:
   `adminStateCheckValueLocked/Unlocked/Shutdown`, `operStateCheckValueEnable/Disable`,
   `usageStateCheckValueIdle/Active/Busy`,
   `healthCheckValueUp/Pending/Down/Held/Gone`. Covered by the class-level Lombok
   `@Getter`/`@Setter`; not `@Builder` constructor params (same as the existing fields).

2. **13 new spec characteristics** in `toRSpecCreate()`, added after `_CR_CHECKVAL_SUSPENDED`
   (empty default value, TEXT, non-configurable):
   `_CR_CHECKVAL_ADMINSTATE_LOCKED`, `_CR_CHECKVAL_ADMINSTATE_UNLOCKED`,
   `_CR_CHECKVAL_ADMINSTATE_SHUTDOWN`, `_CR_CHECKVAL_OPERSTATE_ENABLE`,
   `_CR_CHECKVAL_OPERSTATE_DISABLE`, `_CR_CHECKVAL_USAGESTATE_IDLE`,
   `_CR_CHECKVAL_USAGESTATE_ACTIVE`, `_CR_CHECKVAL_USAGESTATE_BUSY`,
   `_CR_CHECKVAL_HEALTH_UP`, `_CR_CHECKVAL_HEALTH_PENDING`, `_CR_CHECKVAL_HEALTH_DOWN`,
   `_CR_CHECKVAL_HEALTH_HELD`, `_CR_CHECKVAL_HEALTH_GONE`.

3. **13 matching resource characteristics** in `toResourceCreate()`, each carrying the value of
   the corresponding new field.

4. **RSpec version bumps** (spec characteristics changed):
   - `KubernetesCRDV1.OSL_KUBCRD_RSPEC_VERSION` `0.0.3` → `0.0.4`
   - `KubernetesCRV1.OSL_KUBCRV1_RSPEC_VERSION` `0.0.4` → `0.0.5`

`toRSpecUpdate()` / `toResourceUpdate()` delegate to the create methods — unchanged.

## Files

- `src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesCRDV1.java`
- `src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesCRV1.java`

## Verification

- `mvn -q compile` — clean.
- `grep -c` of the new key prefixes → 26 per file (13 in `toRSpecCreate` + 13 in
  `toResourceCreate`).

## Follow-up

- `KubernetesCRV1.applyHealth(...)` derived health from `statusValue` only — addressed in
  [20260829_1619](20260829_1619_kubernetescrv1-applystate-from-x731-not-status.md)
  (`applyState` now keyed off resolved `healthValue` / `*StateValue` fields).
- Still open: the cridge watcher must populate those resolved fields from the `_CR_CHECK_FIELD` +
  `_CR_CHECKVAL_*` mapping.
+54
Changes for docs/20260829_1619_kubernetescrv1-applystate-from-x731-not-status.md: 54 added lines, 0 removed lines.
Original line number Diff line number Diff line
# KubernetesCRV1: derive resource state from the X.731 model, not from `statusValue`

Date: 2026-08-29 16:19
Branch: `12-update-the-models-to-address-the-new-resource-state-model`

## Why

`KubernetesCRV1.applyHealth(ResourceCreate)` set `operationalState` / `administrativeState`
by switching on `statusValue` (`ResourceStatusType`). Per issue #12, `ResourceStatusType` is
inventory/pool bookkeeping and must not be the source of a health verdict — health belongs to the
ITU-T X.731 attributes and the derived `ResourceHealth`. The producer (cridge watcher) should
report state directly rather than have the model reverse-engineer it from a pool-status label.

## What changed

`src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesCRV1.java`:

1. **New resolved-value fields** (builder params, alongside `statusValue`):
   - `ResourceHealth healthValue` — the convenient path
   - `ResourceOperationalStateType operationalStateValue`
   - `ResourceAdministrativeStateType administrativeStateValue`
   - `ResourceUsageStateType usageStateValue`

   These are the producer's *resolved* view. They are distinct from the `*CheckValue*` /
   `healthCheckValue*` strings added earlier, which are operator mapping *configuration* passed
   through as characteristics.

2. **`applyHealth(...)` → `applyState(...)`**, rewritten:
   - `OSL_LABEL_DELETED` short-circuit unchanged (→ `DISABLE` + `SHUTDOWN`).
   - If `healthValue` is set, translate it to the `operationalState`/`administrativeState` pair
     exactly as `Resource.applyHealth` does (UP→enable/unlocked, DOWN→disable/unlocked,
     HELD→enable/locked, GONE→disable/shutdown, PENDING→leave unset) **and return** — the verdict
     is authoritative.
   - Only when `healthValue` is null, apply `operationalStateValue` / `administrativeStateValue` /
     `usageStateValue` individually if set.
   - No longer reads `statusValue`.

3. `statusValue` is retained — it still drives `rs.resourceStatus(...)` (pool bookkeeping only).

The method was kept (not removed): `ResourceCreate` has no `applyHealth` helper, so the
`ResourceHealth` → enum-pair translation still needs a home.

## Verification

- `mvn -q compile` — clean.
- No in-repo callers of `KubernetesCRV1` broke; the Lombok builder gains four optional setters.
- Existing `_CR_CHECKVAL_*` characteristics and `statusValue`→`resourceStatus` mapping unchanged.

## Follow-up (out of scope)

The cridge watcher must be updated to populate `healthValue` (and/or the individual
`*StateValue` fields) on the `KubernetesCRV1` it builds, using the `_CR_CHECK_FIELD` +
`_CR_CHECKVAL_*` mapping now including the new `ADMINSTATE` / `OPERSTATE` / `USAGESTATE` /
`HEALTH` keys.
+4
Changes for docs/index.md: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
# Docs index

- [20260829_1610 Add X.731 state + health `_CR_CHECKVAL_` characteristics](20260829_1610_add-crcheckval-state-health-characteristics.md) — new namespaced `_CR_CHECKVAL_ADMINSTATE_*`, `_CR_CHECKVAL_OPERSTATE_*`, `_CR_CHECKVAL_USAGESTATE_*` and `_CR_CHECKVAL_HEALTH_*` characteristics on `KubernetesCRDV1` / `KubernetesCRV1`, plus RSpec version bumps.
- [20260829_1619 KubernetesCRV1: derive state from X.731, not `statusValue`](20260829_1619_kubernetescrv1-applystate-from-x731-not-status.md) — `applyHealth` → `applyState`, keyed off new `healthValue` / `operationalStateValue` / `administrativeStateValue` / `usageStateValue` builder params instead of the `ResourceStatusType` switch.
+43 −1
Changes for src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesCRDV1.java: 43 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@ import org.etsi.osl.tmf.rcm634.model.ResourceSpecificationCreate;
import org.etsi.osl.tmf.rcm634.model.ResourceSpecificationRef;
import org.etsi.osl.tmf.rcm634.model.ResourceSpecificationUpdate;
import org.etsi.osl.tmf.ri639.model.ResourceCreate;
import org.etsi.osl.tmf.ri639.model.ResourceAdministrativeStateType;
import org.etsi.osl.tmf.ri639.model.ResourceOperationalStateType;
import org.etsi.osl.tmf.ri639.model.ResourceStatusType;
import org.etsi.osl.tmf.ri639.model.ResourceUpdate;
@@ -28,7 +29,7 @@ public class KubernetesCRDV1 extends DomainModelDefinition
		implements ITMFRCM634_ModelTransformer, ITMFRI639_ModelTransformer {

	public static final String OSL_KUBCRD_RSPEC_NAME = "kubernetes-crd.openslice.io";
	public static final String OSL_KUBCRD_RSPEC_VERSION = "0.0.3";
	public static final String OSL_KUBCRD_RSPEC_VERSION = "0.0.4";
	public static final String OSL_KUBCRD_RSPEC_CATEGORY = "KubernetesCRD-apiextensions.k8s.io/v1";
	public static final String OSL_KUBCRD_RESOURCE_CATEGORY = "KubernetesCRD-apiextensions.k8s.io/v1";
	public static final String OSL_KUBCRD_RSPEC_TYPE = "LogicalResourceSpecification";
@@ -56,6 +57,20 @@ public class KubernetesCRDV1 extends DomainModelDefinition
    private String statusCheckValueUnknown;
    private String statusCheckValueSuspended;

    private String adminStateCheckValueLocked;
    private String adminStateCheckValueUnlocked;
    private String adminStateCheckValueShutdown;
    private String operStateCheckValueEnable;
    private String operStateCheckValueDisable;
    private String usageStateCheckValueIdle;
    private String usageStateCheckValueActive;
    private String usageStateCheckValueBusy;
    private String healthCheckValueUp;
    private String healthCheckValuePending;
    private String healthCheckValueDown;
    private String healthCheckValueHeld;
    private String healthCheckValueGone;


	@Builder
	public KubernetesCRDV1(String osl_KUBCRD_RSPEC_UUID, String uuid, String name, String version, String description, String category,
@@ -126,6 +141,19 @@ public class KubernetesCRDV1 extends DomainModelDefinition
        rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_RESERVED", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal the reserved status", false);
        rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_UNKNOWN", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal the unknown status", false);
        rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_SUSPENDED", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal the suspended status", false);
        rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_ADMINSTATE_LOCKED", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal administrativeState=locked", false);
        rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_ADMINSTATE_UNLOCKED", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal administrativeState=unlocked", false);
        rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_ADMINSTATE_SHUTDOWN", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal administrativeState=shutdown", false);
        rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_OPERSTATE_ENABLE", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal operationalState=enable", false);
        rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_OPERSTATE_DISABLE", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal operationalState=disable", false);
        rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_USAGESTATE_IDLE", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal usageState=idle", false);
        rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_USAGESTATE_ACTIVE", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal usageState=active", false);
        rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_USAGESTATE_BUSY", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal usageState=busy", false);
        rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_HEALTH_UP", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal health=UP", false);
        rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_HEALTH_PENDING", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal health=PENDING", false);
        rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_HEALTH_DOWN", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal health=DOWN", false);
        rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_HEALTH_HELD", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal health=HELD", false);
        rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_HEALTH_GONE", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal health=GONE", false);

//		rsc.addResourceSpecificationCharacteristicItemShort( "properties", "", EValueType.SET.getValue());
//		rsc.addResourceSpecificationCharacteristicItemShort( "additionalProperties", "", EValueType.SET.getValue());
@@ -185,6 +213,7 @@ public class KubernetesCRDV1 extends DomainModelDefinition
		.description( this.description )
		.resourceStatus( ResourceStatusType.AVAILABLE )
		.operationalState( ResourceOperationalStateType.ENABLE )
		.administrativeState( ResourceAdministrativeStateType.UNLOCKED )
		.resourceSpecification( rSpecRef )
		.resourceVersion( this.version);
		
@@ -208,6 +237,19 @@ public class KubernetesCRDV1 extends DomainModelDefinition
        rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_RESERVED", this.statusCheckValueReserved, EValueType.TEXT.getValue());
        rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_UNKNOWN", this.statusCheckValueUnknown, EValueType.TEXT.getValue());
        rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_SUSPENDED", this.statusCheckValueSuspended, EValueType.TEXT.getValue());
        rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_ADMINSTATE_LOCKED", this.adminStateCheckValueLocked, EValueType.TEXT.getValue());
        rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_ADMINSTATE_UNLOCKED", this.adminStateCheckValueUnlocked, EValueType.TEXT.getValue());
        rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_ADMINSTATE_SHUTDOWN", this.adminStateCheckValueShutdown, EValueType.TEXT.getValue());
        rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_OPERSTATE_ENABLE", this.operStateCheckValueEnable, EValueType.TEXT.getValue());
        rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_OPERSTATE_DISABLE", this.operStateCheckValueDisable, EValueType.TEXT.getValue());
        rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_USAGESTATE_IDLE", this.usageStateCheckValueIdle, EValueType.TEXT.getValue());
        rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_USAGESTATE_ACTIVE", this.usageStateCheckValueActive, EValueType.TEXT.getValue());
        rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_USAGESTATE_BUSY", this.usageStateCheckValueBusy, EValueType.TEXT.getValue());
        rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_HEALTH_UP", this.healthCheckValueUp, EValueType.TEXT.getValue());
        rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_HEALTH_PENDING", this.healthCheckValuePending, EValueType.TEXT.getValue());
        rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_HEALTH_DOWN", this.healthCheckValueDown, EValueType.TEXT.getValue());
        rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_HEALTH_HELD", this.healthCheckValueHeld, EValueType.TEXT.getValue());
        rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_HEALTH_GONE", this.healthCheckValueGone, EValueType.TEXT.getValue());



Loading
Loading