From 28b41814dedc2c26c560edd869702ffbfb25d818 Mon Sep 17 00:00:00 2001 From: leventecsanyi Date: Thu, 7 Dec 2023 14:02:14 +0100 Subject: Update Model to allow Persisting of alternateId - added new dmi model registry and modified tests Issue-ID: CPS-1989 Signed-off-by: leventecsanyi Change-Id: I576a5a0704fe28924dcc304c276fec5665b52764 --- .../onap/cps/ncmp/init/InventoryModelLoader.java | 4 +- .../resources/models/dmi-registry@2023-08-23.yang | 131 ------------------- .../resources/models/dmi-registry@2023-11-27.yang | 140 +++++++++++++++++++++ .../cps/ncmp/init/InventoryModelLoaderSpec.groovy | 6 +- .../performance/base/NcmpPerfTestBase.groovy | 2 +- .../ncmp-registry/dmi-registry@2022-05-10.yang | 123 ------------------ .../ncmp-registry/dmi-registry@2023-11-27.yang | 140 +++++++++++++++++++++ 7 files changed, 286 insertions(+), 260 deletions(-) delete mode 100644 cps-ncmp-service/src/main/resources/models/dmi-registry@2023-08-23.yang create mode 100644 cps-ncmp-service/src/main/resources/models/dmi-registry@2023-11-27.yang delete mode 100644 integration-test/src/test/resources/data/ncmp-registry/dmi-registry@2022-05-10.yang create mode 100644 integration-test/src/test/resources/data/ncmp-registry/dmi-registry@2023-11-27.yang diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/init/InventoryModelLoader.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/init/InventoryModelLoader.java index b805cdcd8..a27eb6f7c 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/init/InventoryModelLoader.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/init/InventoryModelLoader.java @@ -33,8 +33,8 @@ import org.springframework.stereotype.Service; @Service public class InventoryModelLoader extends AbstractModelLoader { - private static final String NEW_MODEL_FILE_NAME = "dmi-registry@2023-08-23.yang"; - private static final String NEW_SCHEMA_SET_NAME = "dmi-registry-2023-08-23"; + private static final String NEW_MODEL_FILE_NAME = "dmi-registry@2023-11-27.yang"; + private static final String NEW_SCHEMA_SET_NAME = "dmi-registry-2023-11-27"; public InventoryModelLoader(final CpsAdminService cpsAdminService, final CpsModuleService cpsModuleService, diff --git a/cps-ncmp-service/src/main/resources/models/dmi-registry@2023-08-23.yang b/cps-ncmp-service/src/main/resources/models/dmi-registry@2023-08-23.yang deleted file mode 100644 index bb7604d91..000000000 --- a/cps-ncmp-service/src/main/resources/models/dmi-registry@2023-08-23.yang +++ /dev/null @@ -1,131 +0,0 @@ -module dmi-registry { - - yang-version 1.1; - - namespace "org:onap:cps:ncmp"; - - prefix dmi-reg; - - contact "toine.siebelink@est.tech"; - - revision "2023-08-23" { - description - "Added ModuleSetTag"; - } - - revision "2022-05-10" { - description - "Added DataSyncEnabled, SyncState with State, LastSyncTime, DataStoreSyncState with Operational and Running syncstate"; - } - - revision "2022-02-10" { - description - "Added State, LockReason, LockReasonDetails to aid with cmHandle sync and timestamp to aid with retry/timeout scenarios"; - } - - revision "2021-12-13" { - description - "Added new list of public additional properties for a Cm-Handle which are exposed to clients of the NCMP interface"; - } - - revision "2021-10-20" { - description - "Added dmi-data-service-name & dmi-model-service-name to allow separate DMI instances for each responsibility"; - } - - revision "2021-05-20" { - description - "Initial Version"; - } - - grouping LockReason { - leaf reason { - type string; - } - leaf details { - type string; - } - } - - grouping SyncState { - leaf sync-state { - type string; - } - leaf last-sync-time { - type string; - } - } - - grouping Datastores { - container operational { - uses SyncState; - } - container running { - uses SyncState; - } - } - - container dmi-registry { - list cm-handles { - key "id"; - leaf id { - type string; - } - leaf dmi-service-name { - type string; - } - leaf dmi-data-service-name { - type string; - } - leaf dmi-model-service-name { - type string; - } - leaf module-set-tag { - type string; - } - - list additional-properties { - key "name"; - leaf name { - type string; - } - leaf value { - type string; - } - } - - list public-properties { - key "name"; - leaf name { - type string; - } - leaf value { - type string; - } - } - - container state { - leaf cm-handle-state { - type string; - } - - container lock-reason { - uses LockReason; - } - - leaf last-update-time { - type string; - } - - leaf data-sync-enabled { - type boolean; - default "false"; - } - - container datastores { - uses Datastores; - } - } - } - } -} diff --git a/cps-ncmp-service/src/main/resources/models/dmi-registry@2023-11-27.yang b/cps-ncmp-service/src/main/resources/models/dmi-registry@2023-11-27.yang new file mode 100644 index 000000000..808bbdd1b --- /dev/null +++ b/cps-ncmp-service/src/main/resources/models/dmi-registry@2023-11-27.yang @@ -0,0 +1,140 @@ +module dmi-registry { + + yang-version 1.1; + + namespace "org:onap:cps:ncmp"; + + prefix dmi-reg; + + contact "toine.siebelink@est.tech"; + + revision "2023-11-27" { + description + "Added alternate-id"; + } + + revision "2023-08-23" { + description + "Added module-set-tag"; + } + + revision "2022-05-10" { + description + "Added data-sync-enabled, sync-state with state, last-sync-time, data-store-sync-state with operational and running syncstate"; + } + + revision "2022-02-10" { + description + "Added state, lock-reason, lock-reason-details to aid with cmHandle sync and timestamp to aid with retry/timeout scenarios"; + } + + revision "2021-12-13" { + description + "Added new list of public-properties and additional-properties for a Cm-Handle which are exposed to clients of the NCMP interface"; + } + + revision "2021-10-20" { + description + "Added dmi-data-service-name & dmi-model-service-name to allow separate DMI instances for each responsibility"; + } + + revision "2021-05-20" { + description + "Initial Version"; + } + + grouping LockReason { + leaf reason { + type string; + } + leaf details { + type string; + } + } + + grouping SyncState { + leaf sync-state { + type string; + } + leaf last-sync-time { + type string; + } + } + + grouping Datastores { + container operational { + uses SyncState; + } + container running { + uses SyncState; + } + } + + container dmi-registry { + list cm-handles { + key "id"; + leaf id { + type string; + } + leaf dmi-service-name { + type string; + } + leaf dmi-data-service-name { + type string; + } + leaf dmi-model-service-name { + type string; + } + leaf module-set-tag { + type string; + } + leaf alternate-id { + type string; + } + + list additional-properties { + key "name"; + leaf name { + type string; + } + leaf value { + type string; + } + } + + list public-properties { + key "name"; + leaf name { + type string; + } + leaf value { + type string; + } + } + + container state { + leaf cm-handle-state { + type string; + } + + container lock-reason { + uses LockReason; + } + + leaf last-update-time { + type string; + } + + leaf data-sync-enabled { + type boolean; + default "false"; + } + + container datastores { + uses Datastores; + } + } + } + } +} + diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/init/InventoryModelLoaderSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/init/InventoryModelLoaderSpec.groovy index 43e0f69b3..4eb2ca3c7 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/init/InventoryModelLoaderSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/init/InventoryModelLoaderSpec.groovy @@ -49,7 +49,7 @@ class InventoryModelLoaderSpec extends Specification { def loggingListAppender void setup() { - expectedYangResourceToContentMap = objectUnderTest.createYangResourcesToContentMap('dmi-registry@2023-08-23.yang') + expectedYangResourceToContentMap = objectUnderTest.createYangResourcesToContentMap('dmi-registry@2023-11-27.yang') logger.setLevel(Level.DEBUG) loggingListAppender = new ListAppender() logger.addAppender(loggingListAppender) @@ -68,9 +68,9 @@ class InventoryModelLoaderSpec extends Specification { when: 'the application is ready' objectUnderTest.onApplicationEvent(Mock(ApplicationReadyEvent)) then: 'the module service is used to create the new schema set from the correct resource' - 1 * mockCpsModuleService.createSchemaSet(NCMP_DATASPACE_NAME, 'dmi-registry-2023-08-23', expectedYangResourceToContentMap) + 1 * mockCpsModuleService.createSchemaSet(NCMP_DATASPACE_NAME, 'dmi-registry-2023-11-27', expectedYangResourceToContentMap) and: 'the admin service is used to update the anchor' - 1 * mockCpsAdminService.updateAnchorSchemaSet(NCMP_DATASPACE_NAME, NCMP_DMI_REGISTRY_ANCHOR, 'dmi-registry-2023-08-23') + 1 * mockCpsAdminService.updateAnchorSchemaSet(NCMP_DATASPACE_NAME, NCMP_DMI_REGISTRY_ANCHOR, 'dmi-registry-2023-11-27') and: 'No schema sets are being removed by the module service (yet)' 0 * mockCpsModuleService.deleteSchemaSet(NCMP_DATASPACE_NAME, _, _) } diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/performance/base/NcmpPerfTestBase.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/performance/base/NcmpPerfTestBase.groovy index bef42248f..12b04be2e 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/performance/base/NcmpPerfTestBase.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/performance/base/NcmpPerfTestBase.groovy @@ -72,7 +72,7 @@ class NcmpPerfTestBase extends PerfTestBase { } def createRegistrySchemaSet() { - def modelAsString = readResourceDataFile('ncmp-registry/dmi-registry@2022-05-10.yang') + def modelAsString = readResourceDataFile('ncmp-registry/dmi-registry@2023-11-27.yang') cpsModuleService.createSchemaSet(NCMP_PERFORMANCE_TEST_DATASPACE, REGISTRY_SCHEMA_SET, [registry: modelAsString]) } diff --git a/integration-test/src/test/resources/data/ncmp-registry/dmi-registry@2022-05-10.yang b/integration-test/src/test/resources/data/ncmp-registry/dmi-registry@2022-05-10.yang deleted file mode 100644 index 77517968c..000000000 --- a/integration-test/src/test/resources/data/ncmp-registry/dmi-registry@2022-05-10.yang +++ /dev/null @@ -1,123 +0,0 @@ -module dmi-registry { - - yang-version 1.1; - - namespace "org:onap:cps:ncmp"; - - prefix dmi-reg; - - contact "toine.siebelink@est.tech"; - - revision "2022-05-10" { - description - "Added DataSyncEnabled, SyncState with State, LastSyncTime, DataStoreSyncState with Operational and Running syncstate"; - } - - revision "2022-02-10" { - description - "Added State, LockReason, LockReasonDetails to aid with cmHandle sync and timestamp to aid with retry/timeout scenarios"; - } - - revision "2021-12-13" { - description - "Added new list of public additional properties for a Cm-Handle which are exposed to clients of the NCMP interface"; - } - - revision "2021-10-20" { - description - "Added dmi-data-service-name & dmi-model-service-name to allow separate DMI instances for each responsibility"; - } - - revision "2021-05-20" { - description - "Initial Version"; - } - - grouping LockReason { - leaf reason { - type string; - } - leaf details { - type string; - } - } - - grouping SyncState { - leaf sync-state { - type string; - } - leaf last-sync-time { - type string; - } - } - - grouping Datastores { - container operational { - uses SyncState; - } - container running { - uses SyncState; - } - } - - container dmi-registry { - list cm-handles { - key "id"; - leaf id { - type string; - } - leaf dmi-service-name { - type string; - } - leaf dmi-data-service-name { - type string; - } - leaf dmi-model-service-name { - type string; - } - - list additional-properties { - key "name"; - leaf name { - type string; - } - leaf value { - type string; - } - } - - list public-properties { - key "name"; - leaf name { - type string; - } - leaf value { - type string; - } - } - - container state { - leaf cm-handle-state { - type string; - } - - container lock-reason { - uses LockReason; - } - - leaf last-update-time { - type string; - } - - leaf data-sync-enabled { - type boolean; - default "false"; - } - - container datastores { - uses Datastores; - } - } - } - } -} \ No newline at end of file diff --git a/integration-test/src/test/resources/data/ncmp-registry/dmi-registry@2023-11-27.yang b/integration-test/src/test/resources/data/ncmp-registry/dmi-registry@2023-11-27.yang new file mode 100644 index 000000000..e3152cb4a --- /dev/null +++ b/integration-test/src/test/resources/data/ncmp-registry/dmi-registry@2023-11-27.yang @@ -0,0 +1,140 @@ +module dmi-registry { + + yang-version 1.1; + + namespace "org:onap:cps:ncmp"; + + prefix dmi-reg; + + contact "toine.siebelink@est.tech"; + + revision "2023-11-27" { + description + "Added alternateId"; + } + + revision "2023-08-23" { + description + "Added ModuleSetTag"; + } + + revision "2022-05-10" { + description + "Added DataSyncEnabled, SyncState with State, LastSyncTime, DataStoreSyncState with Operational and Running syncstate"; + } + + revision "2022-02-10" { + description + "Added State, LockReason, LockReasonDetails to aid with cmHandle sync and timestamp to aid with retry/timeout scenarios"; + } + + revision "2021-12-13" { + description + "Added new list of public additional properties for a Cm-Handle which are exposed to clients of the NCMP interface"; + } + + revision "2021-10-20" { + description + "Added dmi-data-service-name & dmi-model-service-name to allow separate DMI instances for each responsibility"; + } + + revision "2021-05-20" { + description + "Initial Version"; + } + + grouping LockReason { + leaf reason { + type string; + } + leaf details { + type string; + } + } + + grouping SyncState { + leaf sync-state { + type string; + } + leaf last-sync-time { + type string; + } + } + + grouping Datastores { + container operational { + uses SyncState; + } + container running { + uses SyncState; + } + } + + container dmi-registry { + list cm-handles { + key "id"; + leaf id { + type string; + } + leaf dmi-service-name { + type string; + } + leaf dmi-data-service-name { + type string; + } + leaf dmi-model-service-name { + type string; + } + leaf module-set-tag { + type string; + } + leaf alternate-id { + type string; + } + + list additional-properties { + key "name"; + leaf name { + type string; + } + leaf value { + type string; + } + } + + list public-properties { + key "name"; + leaf name { + type string; + } + leaf value { + type string; + } + } + + container state { + leaf cm-handle-state { + type string; + } + + container lock-reason { + uses LockReason; + } + + leaf last-update-time { + type string; + } + + leaf data-sync-enabled { + type boolean; + default "false"; + } + + container datastores { + uses Datastores; + } + } + } + } +} + -- cgit 1.2.3-korg