From: Amichai Hemli Date: Tue, 31 Mar 2020 23:06:52 +0000 (+0300) Subject: when deleting a vf module from the modern ui verify that correct delete is sent to mSO X-Git-Tag: 6.0.0-ONAP~26 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=92210925190803f5b4a698cf83de2fb75dbcb79d;p=vid.git when deleting a vf module from the modern ui verify that correct delete is sent to mSO Issue-ID: VID-798 Change-Id: I1c8422ccbd15f12b6e516abb6e77229daa65ffe1 Signed-off-by: Amichai Hemli Signed-off-by: Ittay Stern --- diff --git a/vid-app-common/src/test/java/org/onap/vid/job/impl/AsyncInstantiationIntegrationTest.java b/vid-app-common/src/test/java/org/onap/vid/job/impl/AsyncInstantiationIntegrationTest.java index 6b15c879f..c70bbd76a 100644 --- a/vid-app-common/src/test/java/org/onap/vid/job/impl/AsyncInstantiationIntegrationTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/job/impl/AsyncInstantiationIntegrationTest.java @@ -1286,6 +1286,79 @@ public class AsyncInstantiationIntegrationTest extends AsyncInstantiationBaseTes assertThat(requestCaptor.getValue(), jsonEquals(expectedPayloadToMso).when(IGNORING_ARRAY_ORDER)); } + @Test + public void whenDeletingVfModule_thenExpectedDeleteRequestSent() + { + String currentServiceInstanceId = "6196ab1f-2349-4b32-9b6c-cffeb0ccc79c"; + String currentVnfInstanceId = "d520268f-7489-4662-be59-f81495b3a069"; + String currentVfModuleInstanceId = "b0732bed-3ddf-43cc-b193-7f18db84e476"; + + assertTestPayloadFitsExpectedIds(deleteVfModuleBulkPayload(), currentServiceInstanceId, currentVnfInstanceId, currentVfModuleInstanceId); + + String deleteRequestId = randomUuid(); + String userId = "az2016"; + + + String expectedMsoDeletePath = "/serviceInstantiation/v7/serviceInstances/" + + currentServiceInstanceId + "/vnfs/" + currentVnfInstanceId + "/vfModules/" + currentVfModuleInstanceId; + + when(restMso.restCall(eq(HttpMethod.DELETE), eq(RequestReferencesContainer.class), any(), eq(expectedMsoDeletePath), eq(Optional.of(userId)))) + .thenReturn(createResponse(202, currentVfModuleInstanceId, deleteRequestId)); + + when(restMso.GetForObject(eq("/orchestrationRequests/v7/" + deleteRequestId), eq(AsyncRequestStatus.class))) + .thenReturn(asyncRequestStatusResponseAsRestObject(IN_PROGRESS_STR), + asyncRequestStatusResponseAsRestObject(IN_PROGRESS_STR), + asyncRequestStatusResponseAsRestObject(COMPLETE_STR)); + + enableAddCloudOwnerOnMsoRequest(); + + + UUID jobUUID = asyncInstantiationBL.pushBulkJob(deleteVfModuleBulkPayload(), userId).get(0); + processJobsCountTimesAndAssertStatus(jobUUID, 20, COMPLETED); + + + ArgumentCaptor requestCaptor = ArgumentCaptor.forClass(RequestDetailsWrapper.class); + verify(restMso, times(1)).restCall( + eq(HttpMethod.DELETE), + eq(RequestReferencesContainer.class), + requestCaptor.capture(), + eq(expectedMsoDeletePath), + eq(Optional.of(userId)) + ); + + assertThat(requestCaptor.getValue(), jsonEquals(getDeleteVfModulePayloadToMso())); + } + + + private ServiceInstantiation deleteVfModuleBulkPayload() { + return readJsonResourceFileAsObject("/payload_jsons/vfmodule/delete_1_vfmodule_expected_bulk.json", ServiceInstantiation.class); + } + + private String getDeleteVfModulePayloadToMso() { + return "{ " + + " \"requestDetails\": { " + + " \"requestInfo\": { " + + " \"source\": \"VID\", " + + " \"requestorId\": \"az2016\" " + + " }, " + + " \"modelInfo\": { " + + " \"modelType\": \"vfModule\", " + + " \"modelName\": \"XbiTestModuleReplace..base_ocg..module-0\", " + + " \"modelVersionId\": \"04b21d26-9780-4956-8329-b22b049329f4\", " + + " \"modelVersion\": \"1.0\", " + + " \"modelInvariantId\": \"d887658e-2a89-4baf-83e2-b189601a1a7c\", " + + " \"modelCustomizationName\": \"XbiTestModuleReplace..base_ocg..module-0\", " + + " \"modelCustomizationId\": \"3f1f0fcb-8a88-4612-a794-3912613ed9e8\" " + + " }, " + + " \"cloudConfiguration\": { " + + " \"lcpCloudRegionId\": \"olson5a\", " + + " \"cloudOwner\": \"irma-aic\", " + + " \"tenantId\": \"7ff7b1a4fe954f71ab79d3160ec3eb08\" " + + " } " + + " } " + + "}"; + } + private void assertTestPayloadFitsExpectedIds(ServiceInstantiation upgradeVfModulePayload, String serviceInstanceId, String vnfInstanceId, String vfModuleInstanceId) { /* diff --git a/vid-app-common/src/test/resources/payload_jsons/vfmodule/delete_1_vfmodule_expected_bulk.json b/vid-app-common/src/test/resources/payload_jsons/vfmodule/delete_1_vfmodule_expected_bulk.json new file mode 100644 index 000000000..f7ba34cdc --- /dev/null +++ b/vid-app-common/src/test/resources/payload_jsons/vfmodule/delete_1_vfmodule_expected_bulk.json @@ -0,0 +1,123 @@ +{ + "action": "None", + "isDirty": false, + "vnfs": { + "d520268f-7489-4662-be59-f81495b3a069": { + "action": "None", + "instanceName": "PST-VfMod-Replace-5-Vnf", + "instanceId": "d520268f-7489-4662-be59-f81495b3a069", + "orchStatus": "Active", + "productFamilyId": null, + "lcpCloudRegionId": "olson5a", + "tenantId": "7ff7b1a4fe954f71ab79d3160ec3eb08", + "cloudOwner": "irma-aic", + "modelInfo": { + "modelCustomizationName": "xbi test module replace 0", + "modelCustomizationId": "84ea2603-b892-4b63-b7ad-e53b902eacdb", + "modelInvariantId": "5626a5ec-7dce-4cc1-b025-bdb7abb2f058", + "modelVersionId": "fb0fea03-db45-4617-a2a8-0910309e5c86", + "modelName": "xbi test module replace", + "modelType": "vnf", + "modelVersion": "1.0" + }, + "instanceType": "xbi test module replace/xbi test module replace 0", + "provStatus": "PREPROV", + "inMaint": false, + "uuid": "fb0fea03-db45-4617-a2a8-0910309e5c86", + "originalName": "xbi test module replace 0", + "legacyRegion": null, + "lineOfBusiness": null, + "platformName": null, + "trackById": "d520268f-7489-4662-be59-f81495b3a069", + "vfModules": { + "xbitestmodulereplace0..XbiTestModuleReplace..base_ocg..module-0": { + "b0732bed-3ddf-43cc-b193-7f18db84e476": { + "action": "None_Delete", + "retainAssignments" : true, + "sdncPreLoad" : false, + "instanceName": "PST-VfMod-Replace-5-Vfmod", + "instanceId": "b0732bed-3ddf-43cc-b193-7f18db84e476", + "orchStatus": "Active", + "productFamilyId": null, + "lcpCloudRegionId": "olson5a", + "tenantId": "7ff7b1a4fe954f71ab79d3160ec3eb08", + "cloudOwner": "irma-aic", + "modelInfo": { + "modelCustomizationName": "XbiTestModuleReplace..base_ocg..module-0", + "modelCustomizationId": "3f1f0fcb-8a88-4612-a794-3912613ed9e8", + "modelInvariantId": "d887658e-2a89-4baf-83e2-b189601a1a7c", + "modelName": "XbiTestModuleReplace..base_ocg..module-0", + "modelVersionId": "04b21d26-9780-4956-8329-b22b049329f4", + "modelType": "vfModule", + "modelVersion": "1.0" + }, + "instanceType": null, + "provStatus": null, + "inMaint": false, + "uuid": "04b21d26-9780-4956-8329-b22b049329f4", + "originalName": "xbitestmodulereplace0..XbiTestModuleReplace..base_ocg..module-0", + "legacyRegion": null, + "lineOfBusiness": null, + "platformName": null, + "trackById": "b0732bed-3ddf-43cc-b193-7f18db84e476", + "isBase": true, + "volumeGroupName": null, + "supplementaryFile": null, + "supplementaryFile_hidden": null, + "supplementaryFile_hidden_content" : null + } + } + }, + "networks": {}, + "vnfStoreKey": "d520268f-7489-4662-be59-f81495b3a069", + "upgradedVFMSonsCounter": 1 + } + }, + "vrfs": {}, + "instanceParams": [], + "validationCounter": 0, + "existingNames": { + "pst-vfmod-replace-5": "" + }, + "existingVNFCounterMap": { + "84ea2603-b892-4b63-b7ad-e53b902eacdb": 1 + }, + "existingVRFCounterMap": {}, + "existingVnfGroupCounterMap": {}, + "existingNetworksCounterMap": {}, + "networks": {}, + "vnfGroups": {}, + "bulkSize": 1, + "instanceName": "PST-VfMod-Replace-5", + "instanceId": "6196ab1f-2349-4b32-9b6c-cffeb0ccc79c", + "orchStatus": "Active", + "productFamilyId": null, + "lcpCloudRegionId": null, + "tenantId": null, + "cloudOwner": null, + "modelInfo": { + "modelInvariantId": "b3a1a119-dede-4ed0-b077-2a617fa519a3", + "modelVersionId": "06c415d8-afc2-4bcb-a131-e4db4b8e96ce", + "modelName": "xbi test module replace", + "modelType": "service", + "modelVersion": "1.0" + }, + "globalSubscriberId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "subscriptionServiceType": "Emanuel", + "owningEntityId": null, + "owningEntityName": null, + "tenantName": null, + "aicZoneId": null, + "aicZoneName": null, + "projectName": null, + "rollbackOnFailure": false, + "isALaCarte": true, + "collectionResources": {}, + "testApi": "GR_API", + "vidNotions": { + "instantiationUI": "legacy", + "modelCategory": "other", + "viewEditUI": "legacy", + "instantiationType": "ALaCarte" + } +}