diff options
11 files changed, 346 insertions, 28 deletions
diff --git a/vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__fe_input_cypress.json b/vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__fe_input_cypress.json index 748b5f267..b1c9d9b9a 100644 --- a/vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__fe_input_cypress.json +++ b/vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__fe_input_cypress.json @@ -34,7 +34,6 @@ "b0732bed-3ddf-43cc-b193-7f18db84e476": { "action": "None_Upgrade", "retainAssignments" : false, - "retainVolumeGroups" : false, "sdncPreLoad" : true, "instanceName": "PST-VfMod-Replace-5-Vfmod", "instanceId": "b0732bed-3ddf-43cc-b193-7f18db84e476", @@ -60,7 +59,7 @@ "platformName": null, "trackById": "b0732bed-3ddf-43cc-b193-7f18db84e476", "isBase": true, - "volumeGroupName": null, + "volumeGroupName": "xbitestmodulereplace0..XbiTestModuleReplace..base_ocg..module-0_vol", "supplementaryFile": null, "supplementaryFile_hidden": null, "supplementaryFile_hidden_content" : null diff --git a/vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__payload_to_mso.json b/vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__payload_to_mso.json index 45b89f730..91f80e9f1 100644 --- a/vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__payload_to_mso.json +++ b/vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__payload_to_mso.json @@ -34,7 +34,6 @@ ], "requestParameters": { "retainAssignments": false, - "rebuildVolumeGroups":true, "usePreload" : true, "userParams": [], "testApi": "VNF_API" diff --git a/vid-automation/src/test/java/org/onap/vid/api/InstantiationTemplatesApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/InstantiationTemplatesApiTest.java index ab59f087d..828562041 100644 --- a/vid-automation/src/test/java/org/onap/vid/api/InstantiationTemplatesApiTest.java +++ b/vid-automation/src/test/java/org/onap/vid/api/InstantiationTemplatesApiTest.java @@ -22,7 +22,6 @@ import org.springframework.http.HttpEntity; import org.springframework.http.HttpMethod; import org.testng.annotations.AfterMethod; import org.testng.annotations.Test; -import vid.automation.test.Constants; import vid.automation.test.Constants.Users; import vid.automation.test.model.User; import vid.automation.test.services.AsyncJobsService; @@ -77,18 +76,34 @@ public class InstantiationTemplatesApiTest extends AsyncInstantiationBase { @Test public void templateTopology_givenDeployFromCypressE2E_getTemplateTopologyDataIsEquivalent() throws IOException { - templateTopology_givenDeploy_templateTopologyIsEquivalent(objectMapper.readValue( - convertRequest(objectMapper, "asyncInstantiation/templates__instance_template.json"), - JsonNode.class)); + templateTopology_givenDeploy_templateTopologyIsEquivalentToBody( + fileAsJsonNode("asyncInstantiation/templates__instance_template.json")); } - public void templateTopology_givenDeploy_templateTopologyIsEquivalent(JsonNode body) { + @Test + public void templateTopology_givenDeployFromEditedTemplateCypressE2E_getTemplateTopologyDataIsEquivalentToOriginalTemplate() throws IOException { + templateTopology_givenDeploy_templateTopologyIsEquivalent( + fileAsJsonNode("asyncInstantiation/templates__instance_from_template__set_without_modify1.json"), + fileAsJsonNode("asyncInstantiation/templates__instance_template.json")); + } + + private JsonNode fileAsJsonNode(String fileName) throws IOException { + return objectMapper.readValue( + convertRequest(objectMapper, fileName), + JsonNode.class); + } + + public void templateTopology_givenDeploy_templateTopologyIsEquivalentToBody(JsonNode body) { + templateTopology_givenDeploy_templateTopologyIsEquivalent(body, body); + } + + public void templateTopology_givenDeploy_templateTopologyIsEquivalent(JsonNode body, JsonNode expectedTemplateTopology) { registerExpectationFromPreset(new PresetAAIGetSubscribersGet(), RegistrationStrategy.CLEAR_THEN_SET); String uuid1 = postAsyncInstanceRequest(body); JsonNode templateTopology1 = restTemplate.getForObject(templateTopologyUri(uuid1), JsonNode.class); - assertThat(cleanupTemplate(templateTopology1), jsonEquals(cleanupTemplate(body))); + assertThat(cleanupTemplate(templateTopology1), jsonEquals(cleanupTemplate(expectedTemplateTopology))); } private JsonNode cleanupTemplate(JsonNode templateTopology) { diff --git a/vid-automation/src/test/resources/asyncInstantiation/templates__instance_from_template__set_without_modify1.json b/vid-automation/src/test/resources/asyncInstantiation/templates__instance_from_template__set_without_modify1.json new file mode 100644 index 000000000..7814b6554 --- /dev/null +++ b/vid-automation/src/test/resources/asyncInstantiation/templates__instance_from_template__set_without_modify1.json @@ -0,0 +1,161 @@ +{ + "action": "Create", + "aicZoneId": null, + "aicZoneName": null, + "bulkSize": 1, + "category": "Emanuel", + "description": "vProbe_NC_Service", + "existingNames": { + "hvf6arlba007": "", + "hvf6arlba007_lba_base_01": "", + "vprobe_nc_service_dg_new_si": "" + }, + "existingNetworksCounterMap": { + }, + "existingVNFCounterMap": { + "024a417d-ca46-40bf-95ce-809c6a269011": 1 + }, + "existingVnfGroupCounterMap": { + }, + "existingVRFCounterMap": { + }, + "globalSubscriberId": "e433710f-9217-458d-a79d-1c7aff376d89", + "instanceId": null, + "instanceName": "vProbe_NC_Service_DG_new_SI", + "instanceParams": [ + { + } + ], + "invariantUuid": "90a32d31-8a01-4de2-a91f-7e2414d6f5aa", + "isALaCarte": true, + "isDirty": true, + "isEcompGeneratedNaming": false, + "isFailed": false, + "isMultiStepDesign": false, + "lcpCloudRegionId": null, + "modelInfo": { + "modelInvariantId": "90a32d31-8a01-4de2-a91f-7e2414d6f5aa", + "modelName": "vProbe_NC_Service", + "modelUniqueId": "6cfeeb18-c2b0-49df-987a-da47493c8e38", + "modelVersion": "1.0", + "modelVersionId": "6cfeeb18-c2b0-49df-987a-da47493c8e38", + "uuid": "6cfeeb18-c2b0-49df-987a-da47493c8e38" + }, + "name": "vProbe_NC_Service", + "networks": { + }, + "owningEntityId": "d61e6f2d-12fa-4cc2-91df-7c244011d6fc", + "owningEntityName": "WayneHolland", + "pause": false, + "position": null, + "productFamilyId": null, + "projectName": "WATKINS", + "rollbackOnFailure": true, + "serviceRole": "VNF", + "serviceType": "INFRASTRUCTURE", + "statusMessage": null, + "subscriberName": "SILVIA ROBBINS", + "subscriptionServiceType": "TYLER SILVIA", + "tenantId": null, + "tenantName": null, + "testApi": "GR_API", + "trackById": "36601560-f8e3-4020-bdef-3e4709c51e84", + "uuid": "6cfeeb18-c2b0-49df-987a-da47493c8e38", + "version": "1.0", + "vidNotions": { + "instantiationType": "ALaCarte", + "instantiationUI": "anyAlacarteWhichNotExcluded", + "modelCategory": "5G Fabric Configuration", + "viewEditUI": "legacy" + }, + "vnfGroups": { + }, + "vnfs": { + "vProbe_NC_VNF 0": { + "action": "Create", + "instanceId": null, + "instanceName": "hvf6arlba007", + "instanceParams": [ + { + } + ], + "isFailed": false, + "isMissingData": false, + "lcpCloudRegionId": "hvf6", + "lineOfBusiness": "zzz1", + "modelInfo": { + "modelCustomizationId": "024a417d-ca46-40bf-95ce-809c6a269011", + "modelCustomizationName": "vProbe_NC_VNF 0", + "modelInvariantId": "a6a96924-b9c5-4c85-ae18-cbfca848095e", + "modelName": "vProbe_NC_VNF", + "modelUniqueId": "024a417d-ca46-40bf-95ce-809c6a269011", + "modelVersion": "1.0", + "modelVersionId": "21ae311e-432f-4c54-b855-446d0b8ded72", + "uuid": "21ae311e-432f-4c54-b855-446d0b8ded72" + }, + "platformName": "xxx1", + "position": null, + "productFamilyId": "e433710f-9217-458d-a79d-1c7aff376d89", + "rollbackOnFailure": true, + "statusMessage": null, + "tenantId": "4914ab0ab3a743e58f0eefdacc1dde77", + "trackById": "1d2848a0-3573-4d29-b3dd-60bb263260ea", + "uuid": "21ae311e-432f-4c54-b855-446d0b8ded72", + "vfModules": { + "vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1": { + "vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1yprvi": { + "action": "Create", + "instanceName": "my_hvf6arlba007_lba_dj_01", + "instanceParams": [ + { + } + ], + "isFailed": false, + "lcpCloudRegionId": "hvf6", + "modelInfo": { + "modelCustomizationId": "9b99d340-a80b-45ef-9ff1-993fa3e4c001", + "modelCustomizationName": "VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1", + "modelInvariantId": "1bcc4824-6c1a-4b51-af7c-076b7fc14d05", + "modelName": "VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1", + "modelType": "vfModule", + "modelVersion": "1", + "modelVersionId": "c09e4530-8fd8-418f-9483-2f57ce927b05" + }, + "rollbackOnFailure": true, + "sdncPreLoad": true, + "tenantId": "4914ab0ab3a743e58f0eefdacc1dde77", + "trackById": "b134410e-3bc0-478e-883e-1b6bdf8a28df", + "volumeGroupName": "my_special_hvf6arlba007_lba_dj_01_vol" + } + }, + "vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0": { + "vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0ahubg": { + "instanceName": "hvf6arlba007_lba_Base_01", + "instanceParams": [ + { + } + ], + "isMissingData": false, + "lcpCloudRegionId": "hvf6", + "modelInfo": { + "modelCustomizationId": "4d0818cf-eaa9-4a3f-89c2-639953089e14", + "modelCustomizationName": "VprobeNcVnf..FE_base_module..module-0", + "modelInvariantId": "29b6fa3c-aeb3-4103-b3f7-6f98e097b005", + "modelName": "VprobeNcVnf..FE_base_module..module-0", + "modelUniqueId": "4d0818cf-eaa9-4a3f-89c2-639953089e14", + "modelVersion": "1", + "modelVersionId": "c5b26cc1-a66f-4b69-aa23-6abc7c647c88", + "uuid": "c5b26cc1-a66f-4b69-aa23-6abc7c647c88" + }, + "rollbackOnFailure": true, + "sdncPreLoad": null, + "tenantId": "4914ab0ab3a743e58f0eefdacc1dde77", + "uuid": "c5b26cc1-a66f-4b69-aa23-6abc7c647c88" + } + } + } + } + }, + "vrfs": { + } +} diff --git a/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts index f9fe68b20..3c53d262f 100644 --- a/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts @@ -4,7 +4,7 @@ describe('Drawing Board: Instantiation Templates', function () { beforeEach(() => { cy.clearSessionStorage(); - cy.setTestApiParamToVNF(); + cy.setTestApiParamToGR(); cy.initAAIMock(); cy.initGetAAISubDetails(); cy.initVidMock(); @@ -29,7 +29,7 @@ describe('Drawing Board: Instantiation Templates', function () { assertThatBodyFromDeployRequestEqualsToTemplateFromBackEnd(); }); - it('Given a stored template - when "edit" vnf and vfmodules are opened - then template’s details are visible as expected', ()=> { + it('Given a stored template - when "edit" vnf and vfmodules are opened - then template’s details are visible as expected and deploy without changes', () => { loadDrawingBoardWithRecreateMode(); @@ -60,8 +60,6 @@ describe('Drawing Board: Instantiation Templates', function () { .getElementByDataTestsId("sdncPreLoad").should('have.value', 'on') .getElementByDataTestsId("cancelButton").click(); - - assertThatBodyFromDeployRequestEqualsToTemplateFromBackEnd(); }); @@ -81,6 +79,25 @@ describe('Drawing Board: Instantiation Templates', function () { }); + it('Given a stored template - edit service vnf and vfmodule without changes - deploy request should be without changes', function () { + + loadDrawingBoardWithRecreateMode(); + + //open - set edit service + cy.openServiceContextMenu() + .getElementByDataTestsId("context-menu-header-edit-item").click() + .getElementByDataTestsId('form-set').click(); + + //open - set edit vnf + editNode("node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0") + .getElementByDataTestsId('form-set').click(); + + //open - set edit vf + editNode("node-c5b26cc1-a66f-4b69-aa23-6abc7c647c88-vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0") + .getElementByDataTestsId('form-set').click(); + + assertThatBodyFromDeployRequestEqualsToFile(); + }); }); }); @@ -127,6 +144,18 @@ function assertThatBodyFromDeployRequestEqualsToTemplateFromBackEnd() { }); } + +function assertThatBodyFromDeployRequestEqualsToFile() { + cy.getDrawingBoardDeployBtn().click(); + cy.wait('@expectedPostAsyncInstantiation').then(xhr => { + + cy.readFile('../vid-automation/src/test/resources/asyncInstantiation/templates__instance_from_template__set_without_modify1.json').then((expectedResult) => { + cy.deepCompare(xhr.request.body, expectedResult); + }); + + }); +} + //We use this function because the deployService() on drawing-board-header.component class // changes rollbackOnFailure value from string type to boolean. function convertRollbackOnFailureValueFromStringToBoolean(expectedResult: any) { diff --git a/vid-webpack-master/cypress/support/steps/drawingBoard/general.steps.ts b/vid-webpack-master/cypress/support/steps/drawingBoard/general.steps.ts index 5444971b7..8d2bb8a24 100644 --- a/vid-webpack-master/cypress/support/steps/drawingBoard/general.steps.ts +++ b/vid-webpack-master/cypress/support/steps/drawingBoard/general.steps.ts @@ -26,8 +26,5 @@ function openServiceContextMenu() : Chainable<any> { return cy.getElementByDataTestsId('openMenuBtn').click({force: true}); } - - - Cypress.Commands.add('updateServiceShouldNotOverrideChild', updateServiceShouldNotOverrideChild); Cypress.Commands.add('openServiceContextMenu', openServiceContextMenu); diff --git a/vid-webpack-master/package.json b/vid-webpack-master/package.json index c9113d681..ee04de10d 100644 --- a/vid-webpack-master/package.json +++ b/vid-webpack-master/package.json @@ -8,6 +8,7 @@ "build": "ng build --no-progress --no-aot --output-hashing all", "build.prod": "ng build", "test": "jest", + "ci": "npm run test && npm run build", "test:jest": "jest", "test:jest:pipeline": "jest --silent --ci --reporters=default --reporters=jest-junit", "test:jest:watch": "jest --watch", diff --git a/vid-webpack-master/pom.xml b/vid-webpack-master/pom.xml index 2fe0a6eaf..f84a485eb 100644 --- a/vid-webpack-master/pom.xml +++ b/vid-webpack-master/pom.xml @@ -28,7 +28,7 @@ <stagingNexusPath>content/repositories/staging/</stagingNexusPath> <snapshotNexusPath>content/repositories/snapshots/</snapshotNexusPath> <releaseNexusPath>content/repositories/releases/</releaseNexusPath> - <NPM_CMD>build</NPM_CMD> + <NPM_CMD>ci</NPM_CMD> </properties> @@ -70,6 +70,7 @@ </distributionManagement> <profiles> + <profile> <id>if-not-webpack</id> <activation> @@ -107,6 +108,7 @@ </plugins> </build> </profile> + <profile> <id>webpack-npm</id> <activation> diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.spec.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.spec.ts index 54bc77877..8bdab11e3 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.spec.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.spec.ts @@ -416,7 +416,33 @@ describe('VFModule Model Info', () => { 'modelInfo' : { modelVersionId : 'vfModuleId' } + }, + 'vnfModuleName_111_1': { + 'action': 'Create', + 'modelInfo' : { + modelVersionId : 'vfModuleId' + } + } + } + } + }, + 'vnfName_1' :{ + 'action': 'Create', + 'originalName' : 'vnfName', + 'vfModules' : { + 'vfModuleName' : { + 'vnfModuleName_111': { + 'action': 'Create', + 'modelInfo' : { + modelVersionId : 'vfModuleId' + } + }, + 'vnfModuleName_111_1': { + 'action': 'Create', + 'modelInfo' : { + modelVersionId : 'vfModuleId' } + } } } } @@ -441,6 +467,95 @@ describe('VFModule Model Info', () => { } }; let result = vfModuleModel.getNodeCount(<any>node , serviceId); + expect(result).toEqual(2); + }); + + + test('getNodeCount should return number of nodes : there is selectedVNF', ()=>{ + let serviceId : string = 'servicedId'; + jest.spyOn(MockNgRedux.getInstance(), 'getState').mockReturnValue({ + global : {}, + service : { + serviceHierarchy : { + 'servicedId' : { + 'vnfs' : { + 'vnfName' : { + 'properties' : { + 'max_instances' : 1 + } + } + }, + 'vfModules' : { + 'vfModuleName' : { + 'properties' : { + maxCountInstances : 2 + } + } + } + } + }, + serviceInstance : { + 'servicedId' : { + 'existingVNFCounterMap' : { + 'vnfId' : 1 + }, + 'vnfs' : { + 'vnfName' :{ + 'action': 'Create', + 'originalName' : 'vnfName', + 'vfModules' : { + 'vfModuleName' : { + 'vnfModuleName_111': { + 'action': 'Create', + 'modelInfo' : { + modelVersionId : 'vfModuleId' + } + }, + 'vnfModuleName_111_1': { + 'action': 'Create', + 'modelInfo' : { + modelVersionId : 'vfModuleId' + } + } + } + } + }, + 'vnfName_1' :{ + 'action': 'Create', + 'originalName' : 'vnfName', + 'vfModules' : { + 'vfModuleName' : { + 'vnfModuleName_111': { + 'action': 'Create', + 'modelInfo' : { + modelVersionId : 'vfModuleId' + } + } + } + } + } + } + } + } + } + }); + jest.spyOn(_sharedTreeService, 'getSelectedVNF').mockReturnValue('vnfName_1'); + + let node = { + data : { + id : 'vfModuleId', + name : 'vfModuleName', + 'action': 'Create', + }, + parent : { + data : { + id : 'vnfId', + name : 'vnfName_1', + 'action': 'Create', + } + } + }; + let result = vfModuleModel.getNodeCount(<any>node , serviceId); expect(result).toEqual(1); }); diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts index a82cd49d7..73f35279f 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts @@ -177,12 +177,16 @@ export class VFModuleModelInfo implements ILevelNodeInfo { * @param serviceModelId - current service id ************************************************************/ getNodeCount(node: ITreeNode, serviceModelId: string): number { + const vnfs = this._store.getState().service.serviceInstance[serviceModelId].vnfs; let count: number = 0; if (!_.isNil(this._store.getState().service.serviceInstance) && !_.isNil(this._store.getState().service.serviceInstance[serviceModelId])) { - const vnfs = this._store.getState().service.serviceInstance[serviceModelId].vnfs; - - for (let vnfKey in vnfs) { - count += this.countNumberOfVFModule(vnfs[vnfKey], node); + const selectedVNF: string = this._sharedTreeService.getSelectedVNF(); + if (selectedVNF) { + count += this.countNumberOfVFModule(vnfs[selectedVNF], node); + }else { + for (let vnfKey in vnfs) { + count += this.countNumberOfVFModule(vnfs[vnfKey], node); + } } return count; } @@ -206,11 +210,8 @@ export class VFModuleModelInfo implements ILevelNodeInfo { getCountVFModuleOfSelectedVNF(node: ITreeNode, vnfStoreKey: string, serviceModelId: string): number { let count: number = 0; if (!_.isNil(this._store.getState().service.serviceInstance) && !_.isNil(this._store.getState().service.serviceInstance[serviceModelId])) { - const vnfs = this._store.getState().service.serviceInstance[serviceModelId].vnfs; - - for (let vnfKey in vnfs) { - count += this.countNumberOfVFModule(vnfs[vnfKey], node); - } + const vnf = this._store.getState().service.serviceInstance[serviceModelId].vnfs[vnfStoreKey]; + count += this.countNumberOfVFModule(vnf, node); return count; } return count; @@ -238,7 +239,6 @@ export class VFModuleModelInfo implements ILevelNodeInfo { showVFModuleOnSelectedVNF(node: ITreeNode, selectedVNF: string, serviceModelId: string): AvailableNodeIcons { - if (!_.isNil(this._store.getState().service.serviceInstance[serviceModelId].vnfs[selectedVNF]) && node.parent.data.name === this._store.getState().service.serviceInstance[serviceModelId].vnfs[selectedVNF].originalName) { const existingVFModules = this.getCountVFModuleOfSelectedVNF(node, selectedVNF, serviceModelId); const reachedLimit = this.isVFModuleReachedLimit(node, this._store.getState().service.serviceHierarchy, serviceModelId, existingVFModules); diff --git a/vid-webpack-master/src/app/shared/components/formControls/component/multiselect/multiselect.formControl.component.ts b/vid-webpack-master/src/app/shared/components/formControls/component/multiselect/multiselect.formControl.component.ts index 26a55e9d2..cf062f0e0 100644 --- a/vid-webpack-master/src/app/shared/components/formControls/component/multiselect/multiselect.formControl.component.ts +++ b/vid-webpack-master/src/app/shared/components/formControls/component/multiselect/multiselect.formControl.component.ts @@ -35,7 +35,7 @@ export class MultiselectFormControlComponent implements OnChanges{ this.options = options; this._multiselectFormControlService.convertSelectedItems(this.data).then((res)=> { this.selectedItems = res; - this.form.controls[this.data.controlName].setValue(this.selectedItems); + this.data.onChange(this.selectedItems ,this.form); }) }); } |