1 ///<reference path="../../../node_modules/cypress/types/index.d.ts"/>
2 import {JsonBuilder} from '../../support/jsonBuilders/jsonBuilder';
3 import {ServiceModel} from '../../support/jsonBuilders/models/service.model';
4 import {AsyncInstantiationModel} from "../../support/jsonBuilders/models/asyncInstantiation.model";
6 describe('Delete vnf instance', function () {
7 let jsonBuilderAndMock: JsonBuilder<ServiceModel> = new JsonBuilder<ServiceModel>();
9 let jsonBuilderInstantiationBuilder: JsonBuilder<AsyncInstantiationModel> = new JsonBuilder<AsyncInstantiationModel>();
12 cy.clearSessionStorage();
13 cy.preventErrorsOnLoading();
17 cy.permissionVidMock();
25 it(`Update vnf - add 1 delete 1`, function () {
26 const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89";
27 const SERVICE_TYPE: string = "TYLER SILVIA";
28 const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
29 const SERVICE_MODEL_ID: string = '6b528779-44a3-4472-bdff-9cd15ec93450';
32 url: Cypress.config('baseUrl') + '/asyncInstantiation/bulk',
36 }).as("expectedPostAsyncInstantiation");
38 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/serviceModels/ecompNamingFalseModel.json').then((res) => {
39 res.service.vidNotions.instantiationType = 'ALaCarte';
40 jsonBuilderAndMock.basicJson(
42 Cypress.config('baseUrl') + "/rest/models/services/6b528779-44a3-4472-bdff-9cd15ec93450",
45 "ecompNamingFalseModel",
49 cy.readFile('../vid-automation/src/test/resources/aaiGetInstanceTopology/getServiceInstanceTopologyResult.json').then((res) => {
51 res.isALaCarte = true;
52 res.instanceId = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
54 const vnf = res.vnfs['2017-488_PASQUALE-vPE 0'];
55 vnf.instanceId = "VNF_INSTANCE_ID";
56 vnf.vfModules['2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0']['2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0uvfot'].instanceId = "VF_MODULE_BASE_INSTANCE_ID";
57 vnf.vfModules['2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1']['2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1fshmc'].instanceId = "VF_MODULE_INSTANCE_ID";
59 jsonBuilderAndMock.basicJson(
61 Cypress.config('baseUrl') + "/aai_get_service_instance_topology/e433710f-9217-458d-a79d-1c7aff376d89/TYLER SILVIA/f8791436-8d55-4fde-b4d5-72dd2cf13cfb",
63 "initServiceInstanceTopology",
67 cy.openIframe(`app/ui/#/servicePlanning/EDIT?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}`);
69 // add a vnf on update mode
70 cy.drawingBoardPressAddButtonByElementName('node-2017-388_PASQUALE-vPE 0').click({force: true});
71 cy.selectDropdownOptionByText('rollback', 'Rollback');
75 cy.drawingBoardTreeOpenContextMenuByElementDataTestId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0', 0)
76 .drawingBoardTreeClickOnContextMenuOptionByName('Delete');
79 cy.getDrawingBoardDeployBtn().click();
81 cy.getReduxState().then((state) => {
82 const vnf = state.service.serviceInstance[SERVICE_MODEL_ID].vnfs["2017-388_PASQUALE-vPE 0_1"];
83 cy.wait('@expectedPostAsyncInstantiation').then(xhr => {
84 cy.readFile('../vid-automation/src/test/resources/asyncInstantiation/vidRequestDelete1Create1Vnf.json').then((expectedResult) => {
85 expectedResult.vnfs["2017-388_PASQUALE-vPE 0_1"].trackById = vnf.trackById;
86 cy.deepCompare(expectedResult, xhr.request.body);