Cypress to drive recreation from templates 83/98983/2
authorIttay Stern <ittay.stern@att.com>
Sun, 1 Dec 2019 17:38:32 +0000 (19:38 +0200)
committerIttay Stern <ittay.stern@att.com>
Sun, 1 Dec 2019 17:51:25 +0000 (19:51 +0200)
A new route "RECREATE" allows the half-way between RETRY and CREATE: It
is "retry" because historic topology is loaded. It is "create" because
a new instance is created upon "Deploy".

Following commits should modify business-code, so that:

- The expectedPostAsyncInstantiation assertion pass;

- User is navigated the Instantiation-Status page;

- The template topology will be from a designated endpoint
  "templateTopology", instead of "bulkForRetry";

- Consider the hack in `templates__instance_template.json`, where action
  is "None_Create" instead of "Create" to workaround a state-oriented
  problem in the method `extractServiceFields()`.

Issue-ID: VID-724

Change-Id: I0fc282b506a05b8161f3b3f96959493d3843c7f9
Signed-off-by: Ittay Stern <ittay.stern@att.com>
vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts [new file with mode: 0644]
vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/instantiationTemplates/templates__instance_template.json [new file with mode: 0644]
vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/instantiationTemplates/templates__service_model.json [new file with mode: 0644]
vid-webpack-master/src/app/drawingBoard/drawingBoard.routing.ts

diff --git a/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts
new file mode 100644 (file)
index 0000000..be029a1
--- /dev/null
@@ -0,0 +1,69 @@
+describe('Drawing Board: Instantiation Templates', function () {
+
+  describe('Load Page and Deploy', () => {
+
+    beforeEach(() => {
+      cy.clearSessionStorage();
+      cy.setTestApiParamToVNF();
+      cy.initVidMock();
+      cy.initDrawingBoardUserPermission();
+      cy.login();
+
+      mockAsyncBulkResponse();
+    });
+
+    afterEach(() => {
+      cy.screenshot();
+    });
+
+    it(`Given a stored template - when click "deploy" - then a coherent request should be sent upon deploy`, function () {
+      const serviceModelId = '6cfeeb18-c2b0-49df-987a-da47493c8e38';
+      const templateUuid = "46390edd-7100-46b2-9f18-419bd24fb60b";
+
+      const drawingBoardAction = `RECREATE`;
+      const templateTopologyEndpoint = "bulkForRetry"; // will be: "templateTopology"
+
+      // Given...
+
+      cy.route(`**/rest/models/services/${serviceModelId}`,
+        'fixture:../support/jsonBuilders/mocks/jsons/instantiationTemplates/templates__service_model.json')
+      .as('serviceModel');
+
+      cy.route(`**/asyncInstantiation/${templateTopologyEndpoint}/${templateUuid}`,
+        'fixture:../support/jsonBuilders/mocks/jsons/instantiationTemplates/templates__instance_template.json')
+      .as('templateTopology');
+
+      // When...
+
+      cy.openIframe(`app/ui/#/servicePlanning/${drawingBoardAction}` +
+        `?jobId=${templateUuid}` +
+        `&serviceModelId=${serviceModelId}`);
+
+      cy.wait('@serviceModel');
+      cy.wait('@templateTopology');
+
+      cy.getDrawingBoardDeployBtn().click();
+
+      // Then...
+
+      cy.wait('@expectedPostAsyncInstantiation').then(xhr => {
+        // cy.readFile('cypress/support/jsonBuilders/mocks/jsons/instantiationTemplates/templates__instance_template.json').then((expectedResult) => {
+        //   cy.deepCompare(xhr.request.body, expectedResult);
+        // });
+      });
+
+    });
+
+  });
+
+
+  function mockAsyncBulkResponse() {
+    cy.server().route({
+      url: Cypress.config('baseUrl') + '/asyncInstantiation/bulk',
+      method: 'POST',
+      status: 200,
+      response: "[]",
+    }).as("expectedPostAsyncInstantiation");
+  }
+
+});
diff --git a/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/instantiationTemplates/templates__instance_template.json b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/instantiationTemplates/templates__instance_template.json
new file mode 100644 (file)
index 0000000..d94dbd3
--- /dev/null
@@ -0,0 +1,116 @@
+{
+  "action": "None_Create",
+  "instanceName": "vProbe_NC_Service_DG_new_SI",
+  "productFamilyId": null,
+  "lcpCloudRegionId": null,
+  "tenantId": null,
+  "modelInfo": {
+    "modelInvariantId": "90a32d31-8a01-4de2-a91f-7e2414d6f5aa",
+    "modelVersionId": "6cfeeb18-c2b0-49df-987a-da47493c8e38",
+    "modelName": "vProbe_NC_Service",
+    "modelType": "service",
+    "modelVersion": "1.0"
+  },
+  "globalSubscriberId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+  "subscriptionServiceType": "Emanuel",
+  "owningEntityId": "10c645f5-9924-4b89-bec0-b17cf49d3cad",
+  "owningEntityName": "EMANUEL-CORE",
+  "tenantName": null,
+  "aicZoneId": null,
+  "aicZoneName": null,
+  "projectName": "Kennedy",
+  "subscriberName": "Emanuel",
+  "rollbackOnFailure": true,
+  "isALaCarte": true,
+  "testApi": "GR_API",
+  "trackById": "36601560-f8e3-4020-bdef-3e4709c51e84",
+  "vnfs": {
+    "vProbe_NC_VNF 0": {
+      "modelInfo": {
+        "modelCustomizationName": "vProbe_NC_VNF 0",
+        "modelCustomizationId": "024a417d-ca46-40bf-95ce-809c6a269011",
+        "modelInvariantId": "a6a96924-b9c5-4c85-ae18-cbfca848095e",
+        "modelVersionId": "21ae311e-432f-4c54-b855-446d0b8ded72",
+        "modelName": "vProbe_NC_VNF",
+        "modelType": "vnf",
+        "modelVersion": "1.0"
+      },
+      "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+      "instanceName": "zolson57arlba007",
+      "action": "Create",
+      "platformName": "NETWORK-CLOUD",
+      "lcpCloudRegionId": "olson57a",
+      "tenantId": "dcb28ad99c7341748830c9dc307f85eb",
+      "instanceParams": [
+        {}
+      ],
+      "rollbackOnFailure": true,
+      "vfModules": {
+        "vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0": {
+          "vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0ahubg": {
+            "modelInfo": {
+              "modelCustomizationName": "VprobeNcVnf..FE_base_module..module-0",
+              "modelCustomizationId": "4d0818cf-eaa9-4a3f-89c2-639953089e14",
+              "modelInvariantId": "29b6fa3c-aeb3-4103-b3f7-6f98e097b005",
+              "modelVersionId": "c5b26cc1-a66f-4b69-aa23-6abc7c647c88",
+              "modelName": "VprobeNcVnf..FE_base_module..module-0",
+              "modelType": "vfModule",
+              "modelVersion": "1"
+            },
+            "instanceName": "zolson57arlba007_lba_Base_01",
+            "action": "Create",
+            "lcpCloudRegionId": "olson57a",
+            "tenantId": "dcb28ad99c7341748830c9dc307f85eb",
+            "instanceParams": [
+              {}
+            ],
+            "rollbackOnFailure": true,
+            "trackById": "ea2879a6-10bc-4697-90d7-7bc3e71da0fd"
+          }
+        },
+        "vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1": {
+          "vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1yprvi": {
+            "modelInfo": {
+              "modelCustomizationName": "VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1",
+              "modelCustomizationId": "9b99d340-a80b-45ef-9ff1-993fa3e4c001",
+              "modelInvariantId": "1bcc4824-6c1a-4b51-af7c-076b7fc14d05",
+              "modelVersionId": "c09e4530-8fd8-418f-9483-2f57ce927b05",
+              "modelName": "VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1",
+              "modelType": "vfModule",
+              "modelVersion": "1"
+            },
+            "instanceName": "zolson57arlba007_lba_dj_01",
+            "action": "Create",
+            "lcpCloudRegionId": "olson57a",
+            "tenantId": "dcb28ad99c7341748830c9dc307f85eb",
+            "instanceParams": [
+              {}
+            ],
+            "rollbackOnFailure": true,
+            "trackById": "b134410e-3bc0-478e-883e-1b6bdf8a28df",
+            "volumeGroupInstanceName": "zolson57arlba007_lba_dj_01_vol",
+            "usePreload": true
+          }
+        }
+      },
+      "trackById": "1d2848a0-3573-4d29-b3dd-60bb263260ea",
+      "position": null,
+      "lineOfBusiness": "EMANUEL-CONSUMER"
+    }
+  },
+  "networks": {},
+  "vrfs": {},
+  "vnfGroups": {},
+  "instanceParams": [
+    {}
+  ],
+  "pause": false,
+  "bulkSize": 1,
+  "vidNotions": {
+    "instantiationUI": "anyAlacarteWhichNotExcluded",
+    "modelCategory": "5G Fabric Configuration",
+    "viewEditUI": "legacy",
+    "instantiationType": "ALaCarte"
+  },
+  "position": null
+}
diff --git a/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/instantiationTemplates/templates__service_model.json b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/instantiationTemplates/templates__service_model.json
new file mode 100644 (file)
index 0000000..96c29a0
--- /dev/null
@@ -0,0 +1,199 @@
+{
+  "service": {
+    "uuid": "6cfeeb18-c2b0-49df-987a-da47493c8e38",
+    "invariantUuid": "90a32d31-8a01-4de2-a91f-7e2414d6f5aa",
+    "name": "vProbe_NC_Service",
+    "version": "1.0",
+    "toscaModelURL": null,
+    "category": "Emanuel",
+    "serviceType": "INFRASTRUCTURE",
+    "serviceRole": "VNF",
+    "description": "vProbe_NC_Service",
+    "serviceEcompNaming": "false",
+    "instantiationType": "A-La-Carte",
+    "inputs": {},
+    "vidNotions": {
+      "instantiationUI": "anyAlacarteWhichNotExcluded",
+      "modelCategory": "5G Fabric Configuration",
+      "viewEditUI": "legacy",
+      "instantiationType": "ALaCarte"
+    }
+  },
+  "vnfs": {
+    "vProbe_NC_VNF 0": {
+      "uuid": "21ae311e-432f-4c54-b855-446d0b8ded72",
+      "invariantUuid": "a6a96924-b9c5-4c85-ae18-cbfca848095e",
+      "description": "vProbe",
+      "name": "vProbe_NC_VNF",
+      "version": "1.0",
+      "customizationUuid": "024a417d-ca46-40bf-95ce-809c6a269011",
+      "inputs": {},
+      "commands": {},
+      "properties": {
+        "nf_naming": "{naming_policy=SDNC_Policy.Config_MS_VNFVMVNFCNamingPolicyEmanuel, ecomp_generated_naming=true}",
+        "multi_stage_design": "false",
+        "nf_function": "VPMS-UP-VLBA",
+        "nf_naming_code": "RLBA",
+        "availability_zone_max_count": "1",
+        "ecomp_generated_naming": "true",
+        "security_group_name": "rlba01-sec_grp",
+        "version_number": "11.04.02.000.02",
+        "vlbagent_version_name": "vProbe.r.107056",
+        "nf_type": "PROBE",
+        "vlbagent_eph_flavor_name": "p1.c16r80d80e2000.n0i2",
+        "vlbagent_eph_volume_size_1": "5.0",
+        "vlbagent_eph_volume_size_0": "5.0",
+        "ntp_timezone": "UTC",
+        "nf_role": "VLBA-FE",
+        "vlbagent_eph_image_name": "PROBE_VPROBE_11.3.7.02_NC.qcow2",
+        "vlbagent_eph_volume_type_0": "rbd1",
+        "vlbagent_eph_volume_name_0": "log",
+        "vlbagent_eph_volume_type_1": "rbd1",
+        "vlbagent_eph_volume_name_1": "config"
+      },
+      "type": "VF",
+      "modelCustomizationName": "vProbe_NC_VNF 0",
+      "vfModules": {
+        "vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0": {
+          "uuid": "c5b26cc1-a66f-4b69-aa23-6abc7c647c88",
+          "invariantUuid": "29b6fa3c-aeb3-4103-b3f7-6f98e097b005",
+          "customizationUuid": "4d0818cf-eaa9-4a3f-89c2-639953089e14",
+          "description": null,
+          "name": "VprobeNcVnf..FE_base_module..module-0",
+          "version": "1",
+          "modelCustomizationName": "VprobeNcVnf..FE_base_module..module-0",
+          "properties": {
+            "minCountInstances": 1,
+            "maxCountInstances": 1,
+            "initialCount": 1,
+            "vfModuleLabel": "FE_base_module",
+            "baseModule": true
+          },
+          "inputs": {},
+          "volumeGroupAllowed": false
+        },
+        "vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1": {
+          "uuid": "c09e4530-8fd8-418f-9483-2f57ce927b05",
+          "invariantUuid": "1bcc4824-6c1a-4b51-af7c-076b7fc14d05",
+          "customizationUuid": "9b99d340-a80b-45ef-9ff1-993fa3e4c001",
+          "description": null,
+          "name": "VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1",
+          "version": "1",
+          "modelCustomizationName": "VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1",
+          "properties": {
+            "minCountInstances": 0,
+            "maxCountInstances": null,
+            "initialCount": 0,
+            "vfModuleLabel": "FE_Add_On_Module_vlbagent_eph",
+            "baseModule": false
+          },
+          "inputs": {},
+          "volumeGroupAllowed": true
+        }
+      },
+      "volumeGroups": {
+        "vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1": {
+          "uuid": "c09e4530-8fd8-418f-9483-2f57ce927b05",
+          "invariantUuid": "1bcc4824-6c1a-4b51-af7c-076b7fc14d05",
+          "customizationUuid": "9b99d340-a80b-45ef-9ff1-993fa3e4c001",
+          "description": null,
+          "name": "VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1",
+          "version": "1",
+          "modelCustomizationName": "VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1",
+          "properties": {
+            "minCountInstances": 0,
+            "maxCountInstances": null,
+            "initialCount": 0,
+            "vfModuleLabel": "FE_Add_On_Module_vlbagent_eph",
+            "baseModule": false
+          },
+          "inputs": {}
+        }
+      },
+      "vfcInstanceGroups": {}
+    }
+  },
+  "networks": {},
+  "collectionResources": {},
+  "configurations": {},
+  "fabricConfigurations": {
+    "Fabric Configuration 0": {
+      "uuid": "fa069a04-cb85-4915-8ca0-df372dde6a3c",
+      "invariantUuid": "58fa0e1f-f8db-4dce-8972-b8ee630288cf",
+      "description": "A fabric Configuration object",
+      "name": "Fabric Configuration",
+      "version": "9.0",
+      "customizationUuid": "a41997f7-e019-47b2-a6b4-cd20154cfe46",
+      "inputs": {},
+      "commands": {},
+      "properties": {
+        "role": "Fabric Config",
+        "function": "Network Cloud",
+        "ecomp_generated_naming": "false",
+        "type": "5G"
+      },
+      "type": "Configuration"
+    }
+  },
+  "serviceProxies": {},
+  "vfModules": {
+    "vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0": {
+      "uuid": "c5b26cc1-a66f-4b69-aa23-6abc7c647c88",
+      "invariantUuid": "29b6fa3c-aeb3-4103-b3f7-6f98e097b005",
+      "customizationUuid": "4d0818cf-eaa9-4a3f-89c2-639953089e14",
+      "description": null,
+      "name": "VprobeNcVnf..FE_base_module..module-0",
+      "version": "1",
+      "modelCustomizationName": "VprobeNcVnf..FE_base_module..module-0",
+      "properties": {
+        "minCountInstances": 1,
+        "maxCountInstances": 1,
+        "initialCount": 1,
+        "vfModuleLabel": "FE_base_module",
+        "baseModule": true
+      },
+      "inputs": {},
+      "volumeGroupAllowed": false
+    },
+    "vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1": {
+      "uuid": "c09e4530-8fd8-418f-9483-2f57ce927b05",
+      "invariantUuid": "1bcc4824-6c1a-4b51-af7c-076b7fc14d05",
+      "customizationUuid": "9b99d340-a80b-45ef-9ff1-993fa3e4c001",
+      "description": null,
+      "name": "VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1",
+      "version": "1",
+      "modelCustomizationName": "VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1",
+      "properties": {
+        "minCountInstances": 0,
+        "maxCountInstances": null,
+        "initialCount": 0,
+        "vfModuleLabel": "FE_Add_On_Module_vlbagent_eph",
+        "baseModule": false
+      },
+      "inputs": {},
+      "volumeGroupAllowed": true
+    }
+  },
+  "volumeGroups": {
+    "vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1": {
+      "uuid": "c09e4530-8fd8-418f-9483-2f57ce927b05",
+      "invariantUuid": "1bcc4824-6c1a-4b51-af7c-076b7fc14d05",
+      "customizationUuid": "9b99d340-a80b-45ef-9ff1-993fa3e4c001",
+      "description": null,
+      "name": "VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1",
+      "version": "1",
+      "modelCustomizationName": "VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1",
+      "properties": {
+        "minCountInstances": 0,
+        "maxCountInstances": null,
+        "initialCount": 0,
+        "vfModuleLabel": "FE_Add_On_Module_vlbagent_eph",
+        "baseModule": false
+      },
+      "inputs": {}
+    }
+  },
+  "pnfs": {},
+  "vnfGroups": {},
+  "vrfs": {}
+}
index 0c1fa70..6564746 100644 (file)
@@ -26,6 +26,14 @@ export const DrawingBoardRoutes: Route[] = [
           viewEditResolver: ViewEditResolver
         }
       },
+      {
+        path: 'RECREATE',
+        component: ServicePlanningComponent,
+        resolve: {
+          flags: FlagsResolve,
+          viewEditResolver: RetryResolver
+        }
+      },
       {
         path: 'RETRY_EDIT',
         component: ServicePlanningComponent,