diff options
author | danielhanrahan <daniel.hanrahan@est.tech> | 2024-02-19 18:39:37 +0000 |
---|---|---|
committer | danielhanrahan <daniel.hanrahan@est.tech> | 2024-02-21 10:55:18 +0000 |
commit | cbd20a33ea2414a02a3a3fba79ddc734f51e77ac (patch) | |
tree | 7172b374595478abc663019d181f395d5dceff88 /integration-test | |
parent | b82d45a6d32a24e6f59f0d9730a8bfe613c991ae (diff) |
Add moduleSetTag when getting a CM handle
Test changes:
- Check moduleSetTag (and alternateId) in unit test of get CM handle.
- Verify moduleSetTag is updated in tests of CM handle upgrade.
Code changes:
- Set moduleSetTag when converting a YangModelCmHandle to
NcmpServiceCmHandle.
- Set moduleSetTag in YangModelCmHandle copy constructor.
- Minor refactor using StringUtils::isBlank.
Issue-ID: CPS-2027
Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech>
Change-Id: I6a9a92aa58d15c6ecf5a6bb21aa5c9d6ec8dc817
Diffstat (limited to 'integration-test')
2 files changed, 19 insertions, 4 deletions
diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/functional/NcmpCmHandleCreateSpec.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/functional/NcmpCmHandleCreateSpec.groovy index 6707753257..4369b799bd 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/functional/NcmpCmHandleCreateSpec.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/functional/NcmpCmHandleCreateSpec.groovy @@ -122,8 +122,11 @@ class NcmpCmHandleCreateSpec extends CpsIntegrationSpecBase { assert CmHandleState.READY == objectUnderTest.getCmHandleCompositeState('ch-3').cmHandleState }) + and: 'the CM-handle has expected moduleSetTag' + assert objectUnderTest.getNcmpServiceCmHandle('ch-3').moduleSetTag == 'B' + and: 'the CM-handle has expected modules from module set "B": M1 and M3' - ['M1', 'M3'] == objectUnderTest.getYangResourcesModuleReferences('ch-3').moduleName.sort() + assert ['M1', 'M3'] == objectUnderTest.getYangResourcesModuleReferences('ch-3').moduleName.sort() cleanup: 'deregister CM handles' deregisterCmHandles(DMI_URL, ['ch-1', 'ch-2', 'ch-3']) diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/functional/NcmpCmHandleUpgradeSpec.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/functional/NcmpCmHandleUpgradeSpec.groovy index 6b550a76bc..5f062962db 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/functional/NcmpCmHandleUpgradeSpec.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/functional/NcmpCmHandleUpgradeSpec.groovy @@ -82,6 +82,9 @@ class NcmpCmHandleUpgradeSpec extends CpsIntegrationSpecBase { assert CmHandleState.READY == objectUnderTest.getCmHandleCompositeState(CM_HANDLE_ID).cmHandleState }) + and: 'the CM-handle has expected moduleSetTag' + assert objectUnderTest.getNcmpServiceCmHandle(CM_HANDLE_ID).moduleSetTag == updatedModuleSetTag + and: 'CM-handle has expected updated modules: M1 and M3' assert ['M1', 'M3'] == objectUnderTest.getYangResourcesModuleReferences(CM_HANDLE_ID).moduleName.sort() @@ -124,6 +127,9 @@ class NcmpCmHandleUpgradeSpec extends CpsIntegrationSpecBase { assert CmHandleState.READY == objectUnderTest.getCmHandleCompositeState(CM_HANDLE_ID).cmHandleState }) + and: 'the CM-handle has expected moduleSetTag' + assert objectUnderTest.getNcmpServiceCmHandle(CM_HANDLE_ID).moduleSetTag == updatedModuleSetTag + and: 'CM-handle has expected updated modules: M1 and M3' assert ['M1', 'M3'] == objectUnderTest.getYangResourcesModuleReferences(CM_HANDLE_ID).moduleName.sort() @@ -150,7 +156,10 @@ class NcmpCmHandleUpgradeSpec extends CpsIntegrationSpecBase { then: 'CM-handle remains in READY state' assert CmHandleState.READY == objectUnderTest.getCmHandleCompositeState(CM_HANDLE_ID).cmHandleState - and: 'CM-handle has same modules as before: M1 and M2' + and: 'the CM-handle has same moduleSetTag as before' + assert objectUnderTest.getNcmpServiceCmHandle(CM_HANDLE_ID).moduleSetTag == 'same' + + then: 'CM-handle has same modules as before: M1 and M2' assert ['M1', 'M2'] == objectUnderTest.getYangResourcesModuleReferences(CM_HANDLE_ID).moduleName.sort() cleanup: 'deregister CM-handle' @@ -159,13 +168,13 @@ class NcmpCmHandleUpgradeSpec extends CpsIntegrationSpecBase { def 'Upgrade of CM-handle fails due to DMI error.'() { given: 'an existing CM-handle' - registerCmHandle(DMI_URL, CM_HANDLE_ID, NO_MODULE_SET_TAG, INITIAL_MODULE_REFERENCES_RESPONSE, INITIAL_MODULE_RESOURCES_RESPONSE) + registerCmHandle(DMI_URL, CM_HANDLE_ID, 'oldTag', INITIAL_MODULE_REFERENCES_RESPONSE, INITIAL_MODULE_RESOURCES_RESPONSE) and: 'DMI returns error code' mockDmiServer.expect(anything()).andRespond(withStatus(HttpStatus.SERVICE_UNAVAILABLE)) when: "CM-handle is upgraded" - def cmHandlesToUpgrade = new UpgradedCmHandles(cmHandles: [CM_HANDLE_ID], moduleSetTag: NO_MODULE_SET_TAG) + def cmHandlesToUpgrade = new UpgradedCmHandles(cmHandles: [CM_HANDLE_ID], moduleSetTag: 'newTag') networkCmProxyDataService.updateDmiRegistrationAndSyncModule( new DmiPluginRegistration(dmiPlugin: DMI_URL, upgradedCmHandles: cmHandlesToUpgrade)) @@ -180,6 +189,9 @@ class NcmpCmHandleUpgradeSpec extends CpsIntegrationSpecBase { assert cmHandleCompositeState.lockReason.lockReasonCategory == LockReasonCategory.MODULE_UPGRADE_FAILED }) + and: 'the CM-handle has same moduleSetTag as before' + assert objectUnderTest.getNcmpServiceCmHandle(CM_HANDLE_ID).moduleSetTag == 'oldTag' + cleanup: 'deregister CM-handle' deregisterCmHandle(DMI_URL, CM_HANDLE_ID) } |