diff options
4 files changed, 256 insertions, 11 deletions
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 145db8b9d..cf3d508e8 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 @@ -28,6 +28,7 @@ import org.springframework.http.HttpEntity; import org.springframework.http.HttpMethod; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; +import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import vid.automation.test.Constants.Users; import vid.automation.test.infra.FeatureTogglingTest; @@ -88,10 +89,18 @@ public class InstantiationTemplatesApiTest extends AsyncInstantiationBase { return uri.toASCIIString() + "/instantiationTemplates/templateTopology/" + jobId; } - @Test - public void templateTopology_givenDeployFromCypressE2E_getTemplateTopologyDataIsEquivalent() { + @DataProvider + public static Object[][] deployFromCypressE2EFilenames() { + return new Object[][]{ + {"asyncInstantiation/templates__instance_template.json"}, + {"asyncInstantiation/templates__instance_template_network.json"}, + }; + } + + @Test(dataProvider = "deployFromCypressE2EFilenames") + public void templateTopology_givenDeployFromCypressE2E_getTemplateTopologyDataIsEquivalent(String fileName) { templateTopology_givenDeploy_templateTopologyIsEquivalentToBody( - fileAsJsonNode("asyncInstantiation/templates__instance_template.json")); + fileAsJsonNode(fileName)); } @Test diff --git a/vid-automation/src/test/resources/asyncInstantiation/templates__instance_template_network.json b/vid-automation/src/test/resources/asyncInstantiation/templates__instance_template_network.json new file mode 100644 index 000000000..5669ee285 --- /dev/null +++ b/vid-automation/src/test/resources/asyncInstantiation/templates__instance_template_network.json @@ -0,0 +1,110 @@ +{ + "modelInfo": { + "modelInvariantId": "ce23786e-b2b1-4258-b561-f77ef93ada9c", + "modelVersionId": "a1a14610-ee40-4049-8007-0608a20dd1fa", + "modelName": "int_pktmirror_net NC SRIOV network", + "modelType": "service", + "modelVersion": "3.0" + }, + "owningEntityId": "d61e6f2d-12fa-4cc2-91df-7c244011d6fc", + "owningEntityName": "WayneHolland", + "projectName": "WATKINS", + "globalSubscriberId": "e433710f-9217-458d-a79d-1c7aff376d89", + "subscriberName": "SILVIA ROBBINS", + "productFamilyId": null, + "instanceName": "SDN_int_pktmirror_net_svc", + "subscriptionServiceType": "TYLER SILVIA", + "lcpCloudRegionId": null, + "tenantId": null, + "tenantName": null, + "aicZoneId": null, + "aicZoneName": null, + "existingVNFCounterMap": {}, + "existingVRFCounterMap": {}, + "existingVnfGroupCounterMap": {}, + "existingNetworksCounterMap": { + "f6b6d141-0d4c-427d-ad35-797f3d1abe71": 1, + "e01e26b2-aa26-4e11-9243-105d4589ff08": 1 + }, + "existingNames": { + }, + "vnfs": {}, + "networks": { + "SR-IOV Provider 2-1": { + "modelInfo": { + "modelCustomizationName": "SR-IOV Provider 2-1", + "modelCustomizationId": "f6b6d141-0d4c-427d-ad35-797f3d1abe71", + "modelInvariantId": "ffb9e45c-e674-4289-aad3-00040ad746e4", + "modelVersionId": "01f4c475-3f89-4f00-a2f4-39a873dba0ae", + "modelName": "NETWORK_CLOUD_PROVIDER_NETWORK", + "modelType": "network", + "modelVersion": "1.0" + }, + "productFamilyId": "e433710f-9217-458d-a79d-1c7aff376d89", + "instanceName": "SDN_int_pktmirror_net_1", + "action": "Create", + "platformName": "xxx1", + "lcpCloudRegionId": "hvf6", + "tenantId": "4914ab0ab3a743e58f0eefdacc1dde77", + "instanceParams": [ + {} + ], + "rollbackOnFailure": true, + "instanceId": null, + "trackById": "2e8455cb-4c28-4aa7-929d-f1e1881aaaa1", + "isFailed": false, + "statusMessage": null, + "position": null, + "lineOfBusiness": "zzz1" + }, + "SR-IOV Provider 2-2": { + "modelInfo": { + "modelCustomizationName": "SR-IOV Provider 2-2", + "modelCustomizationId": "e01e26b2-aa26-4e11-9243-105d4589ff08", + "modelInvariantId": "ffb9e45c-e674-4289-aad3-00040ad746e4", + "modelVersionId": "01f4c475-3f89-4f00-a2f4-39a873dba0ae", + "modelName": "NETWORK_CLOUD_PROVIDER_NETWORK", + "modelType": "network", + "modelVersion": "1.0" + }, + "productFamilyId": "e433710f-9217-458d-a79d-1c7aff376d89", + "instanceName": "SDN_int_pktmirror_net_2", + "action": "Create", + "platformName": "xxx1", + "lcpCloudRegionId": "hvf6", + "tenantId": "4914ab0ab3a743e58f0eefdacc1dde77", + "instanceParams": [ + {} + ], + "rollbackOnFailure": true, + "instanceId": null, + "trackById": "e43ffa05-ea78-4c34-a0c8-02449851d827", + "isFailed": false, + "statusMessage": null, + "position": null, + "lineOfBusiness": "zzz1" + } + }, + "vnfGroups": {}, + "vrfs": {}, + "instanceParams": [ + {} + ], + "pause": false, + "bulkSize": 1, + "rollbackOnFailure": "true", + "isALaCarte": true, + "testApi": "GR_API", + "instanceId": null, + "action": "Create", + "trackById": "4157dcfb-fa22-435d-8df9-659628137177", + "isFailed": false, + "statusMessage": null, + "vidNotions": { + "instantiationUI": "networkWithPropertyNetworkTechnologyEqualsStandardSriovOrOvs", + "modelCategory": "5G Provider Network", + "viewEditUI": "legacy", + "instantiationType": "ALaCarte" + }, + "position": null +} 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 a73576d9a..1da12a55d 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 @@ -236,34 +236,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'); @@ -288,9 +326,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); @@ -305,7 +351,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": {} +} |