diff options
Diffstat (limited to 'vid-webpack-master/cypress')
2 files changed, 134 insertions, 8 deletions
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 1e9727ec3..e481c3e8b 100644 --- a/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts @@ -155,7 +155,7 @@ describe('Drawing Board: Instantiation Templates', function () { ...vnfPath, "vfModules", module1CustomizationId, ]; - let serviceInstanceElementOnRedux = state.service.serviceInstance[serviceModelId]; + let serviceInstanceElementOnRedux = state.service.serviceInstance[(templateWithVnfSetup.serviceModelId)]; let latestVfModule_1Path = findPathOfLatestVfModule(serviceInstanceElementOnRedux, vfModules_1Path); // This is a funny merge, as values are already there, but that way ensures @@ -251,34 +251,72 @@ describe('Drawing Board: Instantiation Templates', function () { }); + it(`Given a stored template of Network - - it is loaded`, () => { + + loadDrawingBoardWithRecreateModeNetwork(); + + // Then... + cy.getElementByDataTestsId("node-SR-IOV Provider 2-1").should('be.visible'); + cy.getElementByDataTestsId("node-SR-IOV Provider 2-2").should('be.visible'); + assertThatBodyFromDeployRequestEqualsToTemplateFromBackEnd_network(); + }); + + }); }); }); -const serviceModelId = '6cfeeb18-c2b0-49df-987a-da47493c8e38'; +let apiTestResources = '../vid-automation/src/test/resources/asyncInstantiation/'; + +const templateWithVnfSetup = { + serviceModelId: '6cfeeb18-c2b0-49df-987a-da47493c8e38', + instanceTemplateFile: apiTestResources + 'templates__instance_template.json', + instanceTemplateSetWithoutModifyFile: apiTestResources + 'templates__instance_from_template__set_without_modify1.json', + serviceModelFile: '../support/jsonBuilders/mocks/jsons/instantiationTemplates/templates__service_model.json', +}; + +const templateWithNetworkSetup = { + serviceModelId: 'a1a14610-ee40-4049-8007-0608a20dd1fa', + instanceTemplateFile: apiTestResources + 'templates__instance_template_network.json', + serviceModelFile: '../support/jsonBuilders/mocks/jsons/instantiationTemplates/templates__service_model_network.json', +}; const vnfPath = [ "vnfs", "vProbe_NC_VNF 0" ]; function loadDrawingBoardWithRecreateMode() { + loadDrawingBoardWithRecreateModeInternal( + '../../' + templateWithVnfSetup.instanceTemplateFile, + templateWithVnfSetup.serviceModelId, + templateWithVnfSetup.serviceModelFile); +} + +function loadDrawingBoardWithRecreateModeNetwork() { + loadDrawingBoardWithRecreateModeInternal( + '../../' + templateWithNetworkSetup.instanceTemplateFile, + templateWithNetworkSetup.serviceModelId, + templateWithNetworkSetup.serviceModelFile); +} + +function loadDrawingBoardWithRecreateModeInternal(instanceTemplate: string, serviceModelIdToLoad: any, serviceModel: string) { const templateUuid = "46390edd-7100-46b2-9f18-419bd24fb60b"; const drawingBoardAction = `RECREATE`; const templateTopologyEndpoint = "templateTopology"; - cy.route(`**/rest/models/services/${serviceModelId}`, - 'fixture:../support/jsonBuilders/mocks/jsons/instantiationTemplates/templates__service_model.json') + cy.route(`**/rest/models/services/${serviceModelIdToLoad}`, + 'fixture:' + serviceModel) .as('serviceModel'); cy.route(`**/instantiationTemplates/${templateTopologyEndpoint}/${templateUuid}`, - 'fixture:../../../vid-automation/src/test/resources/asyncInstantiation/templates__instance_template.json') + 'fixture:' + instanceTemplate) .as('templateTopology'); // When... cy.openIframe(`app/ui/#/servicePlanning/${drawingBoardAction}` + `?jobId=${templateUuid}` + - `&serviceModelId=${serviceModelId}`); + `&serviceModelId=${serviceModelIdToLoad}`); cy.wait('@serviceModel'); cy.wait('@templateTopology'); @@ -303,9 +341,17 @@ function removeVNFWithVFModules(dataTestId: string) { } function assertThatBodyFromDeployRequestEqualsToTemplateFromBackEnd(deviationFromExpected: { path: PropertyPath, value: any }[] = []) { + assertThatBodyFromDeployRequestEqualsToTemplateFromBackEndInternal(templateWithVnfSetup.instanceTemplateFile, deviationFromExpected); +} + +function assertThatBodyFromDeployRequestEqualsToTemplateFromBackEnd_network(deviationFromExpected: { path: PropertyPath, value: any }[] = []) { + assertThatBodyFromDeployRequestEqualsToTemplateFromBackEndInternal(templateWithNetworkSetup.instanceTemplateFile, deviationFromExpected); +} + +function assertThatBodyFromDeployRequestEqualsToTemplateFromBackEndInternal(filePathOfExpected: string, deviationFromExpected: { path: PropertyPath; value: any }[]) { cy.getDrawingBoardDeployBtn().click(); cy.wait('@expectedPostAsyncInstantiation').then(xhr => { - cy.readFile('../vid-automation/src/test/resources/asyncInstantiation/templates__instance_template.json').then((expectedResult) => { + cy.readFile(filePathOfExpected).then((expectedResult) => { convertRollbackOnFailureValueFromStringToBoolean(expectedResult); let xhrBodyWithoutIsDirtyField = removeIsDirtyFieldFromXhrRequestBody(xhr); @@ -320,7 +366,7 @@ function assertThatBodyFromDeployRequestEqualsToFile(deviationFromExpected: { pa 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.readFile(templateWithVnfSetup.instanceTemplateSetWithoutModifyFile).then((expectedResult) => { setDeviationInExpected(expectedResult, deviationFromExpected); cy.deepCompare(xhr.request.body, expectedResult); }); diff --git a/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/instantiationTemplates/templates__service_model_network.json b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/instantiationTemplates/templates__service_model_network.json new file mode 100644 index 000000000..08597a918 --- /dev/null +++ b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/instantiationTemplates/templates__service_model_network.json @@ -0,0 +1,80 @@ +{ + "service": { + "uuid": "a1a14610-ee40-4049-8007-0608a20dd1fa", + "invariantUuid": "ce23786e-b2b1-4258-b561-f77ef93ada9c", + "name": "int_pktmirror_net NC SRIOV network", + "version": "3.0", + "toscaModelURL": null, + "category": "Network Service", + "serviceType": "INFRASTRUCTURE", + "serviceRole": "PROVIDER-NETWORK", + "description": "SRIOV network model for NC 1.0, VLAN ID 187 and 188.", + "serviceEcompNaming": "false", + "instantiationType": "A-La-Carte", + "inputs": {}, + "vidNotions": { + "instantiationUI": "anyAlacarteWhichNotExcluded", + "modelCategory": "5G Provider Network", + "viewEditUI": "legacy", + "instantiationType": "ALaCarte" + } + }, + "vnfs": {}, + "networks": { + "SR-IOV Provider 2-1": { + "uuid": "01f4c475-3f89-4f00-a2f4-39a873dba0ae", + "invariantUuid": "ffb9e45c-e674-4289-aad3-00040ad746e4", + "description": "NETWORK_CLOUD_PROVIDER_NETWORK", + "name": "NETWORK_CLOUD_PROVIDER_NETWORK", + "version": "1.0", + "customizationUuid": "f6b6d141-0d4c-427d-ad35-797f3d1abe71", + "inputs": {}, + "commands": {}, + "properties": { + "network_role": "int_pktmirror_net_1", + "exVL_naming": "{ecomp_generated_naming=false}", + "network_flows": "{is_network_policy=false, is_bound_to_vpn=false}", + "network_scope": "GLOBAL", + "ecomp_generated_naming": "false", + "network_type": "SR-IOV-PROVIDER2-1", + "provider_network": "{physical_network_name=sriovnet1, is_provider_network=true}", + "network_technology": "STANDARD-SR-IOV", + "network_homing": "{ecomp_selected_instance_node_target=false}" + }, + "type": "VL", + "modelCustomizationName": "SR-IOV Provider 2-1" + }, + "SR-IOV Provider 2-2": { + "uuid": "01f4c475-3f89-4f00-a2f4-39a873dba0ae", + "invariantUuid": "ffb9e45c-e674-4289-aad3-00040ad746e4", + "description": "NETWORK_CLOUD_PROVIDER_NETWORK", + "name": "NETWORK_CLOUD_PROVIDER_NETWORK", + "version": "1.0", + "customizationUuid": "e01e26b2-aa26-4e11-9243-105d4589ff08", + "inputs": {}, + "commands": {}, + "properties": { + "network_role": "int_pktmirror_net_2", + "exVL_naming": "{ecomp_generated_naming=false}", + "network_flows": "{is_network_policy=false, is_bound_to_vpn=false}", + "network_scope": "GLOBAL", + "ecomp_generated_naming": "false", + "network_type": "SR-IOV-PROVIDER2-2", + "provider_network": "{physical_network_name=sriovnet2, is_provider_network=true}", + "network_technology": "STANDARD-SR-IOV", + "network_homing": "{ecomp_selected_instance_node_target=false}" + }, + "type": "VL", + "modelCustomizationName": "SR-IOV Provider 2-2" + } + }, + "collectionResources": {}, + "configurations": {}, + "fabricConfigurations": {}, + "serviceProxies": {}, + "vfModules": {}, + "volumeGroups": {}, + "pnfs": {}, + "vnfGroups": {}, + "vrfs": {} +} |