From 55164b23839f187ae089fd08c34487dcfd165188 Mon Sep 17 00:00:00 2001 From: sourabh_sourabh Date: Tue, 26 Sep 2023 12:11:42 +0100 Subject: Expose REST endpoint to update YANG schema set using moduleSetTag - Added new schema to upgrade model into component. - Modified Ncmp rest input mapper to add upgradedCmHandles attributes. - Modified cm handle state mapper to add new lock reason. - Added new method to parse and upgrade Cm handles in DmiRegistration. - YANG data converter is modified to add "module-set-tag" atribute. - Cm handle new query method is added for cps path without appending ancestor. - Modified setCompositeStateForRetry to add lock reason. - New lock reason category is added. - Existing module sync service is modified to upgrade the model "syncAndCreateOrUpgradeSchemaSetAndAnchor". - Sync util method "getModuleSyncFailedCmHandles" to modified to add another lock reason "LOCKED_MISBEHAVING". - Added new attribute "UpgradedCmHandles" into DmiPluginRegistration and DmiPluginRegistrationResponse. - New attribute "moduleSetTag" is added into NcmpServiceCmHandle. - New model "UpgradedCmHandles" is added. - New method "updateSchemaSetWithExistingModules" is added into cps module service to update cm handle with exsting model. - Code coverage is reducced to 96 percentage that would be addressed and pushed into new patch. Issue-ID: CPS-1798 Signed-off-by: sourabh_sourabh Change-Id: I540acb404e38fc434de87a0d959bfde710a18b03 Signed-off-by: sourabh_sourabh --- cps-service/src/main/java/org/onap/cps/api/CpsModuleService.java | 4 ++-- .../src/main/java/org/onap/cps/api/impl/CpsModuleServiceImpl.java | 2 +- .../test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'cps-service') diff --git a/cps-service/src/main/java/org/onap/cps/api/CpsModuleService.java b/cps-service/src/main/java/org/onap/cps/api/CpsModuleService.java index 5ff08c9ac..e8c3e7775 100644 --- a/cps-service/src/main/java/org/onap/cps/api/CpsModuleService.java +++ b/cps-service/src/main/java/org/onap/cps/api/CpsModuleService.java @@ -47,13 +47,13 @@ public interface CpsModuleService { Map yangResourcesNameToContentMap); /** - * Create a schema set from new modules and existing modules. + * Create or upgrade a schema set from new modules and existing modules or only existing modules. * @param dataspaceName Dataspace name * @param schemaSetName schema set name * @param newModuleNameToContentMap YANG resources map where key is a module name and value is content * @param allModuleReferences All YANG resource module references */ - void createSchemaSetFromModules(String dataspaceName, String schemaSetName, + void createOrUpgradeSchemaSetFromModules(String dataspaceName, String schemaSetName, Map newModuleNameToContentMap, Collection allModuleReferences); diff --git a/cps-service/src/main/java/org/onap/cps/api/impl/CpsModuleServiceImpl.java b/cps-service/src/main/java/org/onap/cps/api/impl/CpsModuleServiceImpl.java index 7d9c472e6..444c895fb 100644 --- a/cps-service/src/main/java/org/onap/cps/api/impl/CpsModuleServiceImpl.java +++ b/cps-service/src/main/java/org/onap/cps/api/impl/CpsModuleServiceImpl.java @@ -66,7 +66,7 @@ public class CpsModuleServiceImpl implements CpsModuleService { } @Override - public void createSchemaSetFromModules(final String dataspaceName, final String schemaSetName, + public void createOrUpgradeSchemaSetFromModules(final String dataspaceName, final String schemaSetName, final Map newModuleNameToContentMap, final Collection allModuleReferences) { cpsValidator.validateNameCharacters(dataspaceName, schemaSetName); diff --git a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy index a794c58fc..61f67416d 100644 --- a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy +++ b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy @@ -65,7 +65,7 @@ class CpsModuleServiceImplSpec extends Specification { def moduleReferenceForExistingModule = new ModuleReference('test', '2021-10-12','test.org') def listOfExistingModulesModuleReference = [moduleReferenceForExistingModule] when: 'create schema set from modules method is invoked' - objectUnderTest.createSchemaSetFromModules('someDataspaceName', 'someSchemaSetName', [newModule: 'newContent'], listOfExistingModulesModuleReference) + objectUnderTest.createOrUpgradeSchemaSetFromModules('someDataspaceName', 'someSchemaSetName', [newModule: 'newContent'], listOfExistingModulesModuleReference) then: 'processing is delegated to persistence service' 1 * mockCpsModulePersistenceService.storeSchemaSetFromModules('someDataspaceName', 'someSchemaSetName', [newModule: 'newContent'], listOfExistingModulesModuleReference) and: 'the CpsValidator is called on the dataspaceName and schemaSetName' -- cgit 1.2.3-korg