blob: 790fcfc67b0652c8f85d7a9a6ceeeaa17e77bd4f [file] [log] [blame]
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +03001///<reference path="../../../node_modules/cypress/types/index.d.ts"/>
2/// <reference types="Cypress" />
Ittay Stern6f900cc2018-08-29 17:01:32 +03003import {JsonBuilder} from '../../support/jsonBuilders/jsonBuilder';
4import {ServiceModel} from '../../support/jsonBuilders/models/service.model';
5import * as _ from 'lodash';
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +03006
7describe('A la carte', function () {
8 describe('check service name', () => {
Ittay Stern6f900cc2018-08-29 17:01:32 +03009 let jsonBuilderAAIService: JsonBuilder<ServiceModel> = new JsonBuilder<ServiceModel>();
Einat Vinouzee1f79742019-08-27 16:01:01 +030010 const SERVICE_ID: string = '4d71990b-d8ad-4510-ac61-496288d9078e';
11 const SERVICE_INVARIANT_ID: string = 'd27e42cf-087e-4d31-88ac-6c4b7585f800';
12 const INSTANCE_NAME_MANDATORY_MESSAGE: string = 'Missing data ("Instance Name" and 3 other fields';
13 const INSTANCE_NAME_NOT_MANDATORY_MESSAGE: string = 'Missing data ("Subscriber Name" and 2 other fields)';
14 const CONFIRM_BUTTON: string = 'confirmButton';
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030015
16 beforeEach(() => {
17 cy.window().then((win) => {
18 win.sessionStorage.clear();
19 cy.setReduxState();
20 cy.preventErrorsOnLoading();
21 cy.initAAIMock();
Einat Vinouzee1f79742019-08-27 16:01:01 +030022 cy.initVidMock({serviceUuid:SERVICE_ID, invariantId: SERVICE_INVARIANT_ID});
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030023 cy.initAlaCarteService();
24 cy.initZones();
25 cy.login();
26 });
27 });
28
Ittay Stern6f900cc2018-08-29 17:01:32 +030029 afterEach(() => {
30 cy.screenshot();
31 });
32
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030033
34
Ittay Stern6f900cc2018-08-29 17:01:32 +030035 it(`service name should be mandatory : serviceEcompNaming = true`, ()=> {
Ittay Stern607ea3d2019-10-23 17:10:52 +030036 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/basicService.json').then((res) => {
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030037 jsonBuilderAAIService.basicJson(res,
Einat Vinouzee1f79742019-08-27 16:01:01 +030038 Cypress.config('baseUrl') + '/rest/models/services/' + SERVICE_ID,
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030039 200,
40 0,
41 SERVICE_ID + ' - service',
42 changeServiceEcompNamingToTrue);
Ittay Stern6f900cc2018-08-29 17:01:32 +030043 checkServiceNameInputIdMandatory();
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030044 });
45 });
46
Ittay Stern6f900cc2018-08-29 17:01:32 +030047 it(`Service a-la-carte`, ()=> {
48
49 const subscriptionServiceType : string = "TYLER SILVIA";
50 const owningEntityName : string = "WayneHolland";
51 const rollbackOnFailure : string = "true";
52 const projectName : string = "WATKINS";
53 const instanceName : string = "serviceInstanceName";
Ittay Stern607ea3d2019-10-23 17:10:52 +030054 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => {
Ittay Stern6f900cc2018-08-29 17:01:32 +030055
56 cy.setTestApiParamToGR();
Ittay Sternf7926712019-07-07 19:23:03 +030057 res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].service.vidNotions.instantiationType = 'ALaCarte';
Ittay Stern6f900cc2018-08-29 17:01:32 +030058 res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].service.inputs = null;
59 cy.setReduxState(<any>res);
60 cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd');
61
62 cy.getElementByDataTestsId("openMenuBtn").click({force: true})
63 .getElementByDataTestsId("context-menu-header-edit-item").click({force: true})
64 .getElementByDataTestsId("instanceName")
65 .getElementByDataTestsId("subscriberName")
66 .getElementByDataTestsId("serviceType")
67 .getElementByDataTestsId("owningEntity")
68 .getElementByDataTestsId("project")
69 .getElementByDataTestsId("rollback");
70
71 cy.selectDropdownOptionByText("subscriberName", "SILVIA ROBBINS");
72 cy.selectDropdownOptionByText("serviceType", subscriptionServiceType);
73 cy.selectDropdownOptionByText("owningEntity", owningEntityName);
74 cy.selectDropdownOptionByText("rollback", rollbackOnFailure);
75 cy.selectDropdownOptionByText("project", projectName);
76 cy.typeToInput("instanceName", instanceName);
77
78 cy.get('#quantity-select').should('have.attr', 'disabled');
79 cy.getElementByDataTestsId('form-set').click({force: true}).then(() => {
80 cy.getReduxState().then((state) => {
81 const service = state.service.serviceInstance['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'];
82
83 cy.readFile('../vid-automation/src/test/resources/a-la-carte/redux-a-la-carte.json').then((file) => {
84 expect(service.subscriptionServiceType).to.equals(subscriptionServiceType);
85 expect(service.owningEntityName).to.equals(owningEntityName);
86 expect(service.rollbackOnFailure).to.equals(rollbackOnFailure);
87 expect(service.projectName).to.equals(projectName);
88 expect(service.instanceName).to.equals(instanceName);
89 });
90 });
91 });
92 });
93 });
94
95
96 it(`VNF a-la-carte`, ()=> {
Ittay Stern607ea3d2019-10-23 17:10:52 +030097 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => {
Ittay Stern6f900cc2018-08-29 17:01:32 +030098 cy.setTestApiParamToGR();
Ittay Sternf7926712019-07-07 19:23:03 +030099 res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].service.vidNotions.instantiationType = 'ALaCarte';
Ittay Stern6f900cc2018-08-29 17:01:32 +0300100 res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].service.inputs = null;
101 cy.setReduxState(<any>res);
102 cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd');
103
104 cy.getElementByDataTestsId("openMenuBtn").click({force: true})
105 .getElementByDataTestsId("context-menu-header-edit-item").click({force: true})
106 .getElementByDataTestsId("instanceName")
107 .getElementByDataTestsId("subscriberName")
108 .getElementByDataTestsId("serviceType")
109 .getElementByDataTestsId("owningEntity")
110 .getElementByDataTestsId("project")
111 .getElementByDataTestsId("rollback");
112
113 cy.selectDropdownOptionByText("subscriberName", "SILVIA ROBBINS");
114 cy.selectDropdownOptionByText("serviceType", "TYLER SILVIA");
115 cy.selectDropdownOptionByText("owningEntity", "WayneHolland");
116 cy.selectDropdownOptionByText("rollback", "true");
117 cy.selectDropdownOptionByText("project", "WATKINS");
118 cy.typeToInput("instanceName", "serviceInstanceName");
119
120 cy.get('#quantity-select').should('have.attr', 'disabled');
121 cy.getElementByDataTestsId('form-set').click({force: true}).then(() => {
Ittay Sternf7926712019-07-07 19:23:03 +0300122 cy.getElementByDataTestsId('node-2017-488_PASQUALE-vPE 0-add-btn').click({force: true}).then(() => {
Ittay Stern6f900cc2018-08-29 17:01:32 +0300123 cy.selectDropdownOptionByText('productFamily', 'Emanuel');
Ittay Sternf7926712019-07-07 19:23:03 +0300124 cy.selectDropdownOptionByText('lcpRegion', 'AAIAIC25');
Ittay Stern6f900cc2018-08-29 17:01:32 +0300125 cy.typeToInput("lcpRegionText", "just another region");
126 cy.selectDropdownOptionByText('tenant', 'USP-SIP-IC-24335-T-01');
127 cy.selectDropdownOptionByText('lineOfBusiness', 'zzz1');
128 cy.selectDropdownOptionByText('platform', 'xxx1');
129 cy.getElementByDataTestsId('form-set').click({force: true}).then(() => {
130 cy.getReduxState().then((state) => {
131
Ittay Sternf7926712019-07-07 19:23:03 +0300132 const vnf = state.service.serviceInstance['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].vnfs['2017-488_PASQUALE-vPE 0'];
Ittay Stern6f900cc2018-08-29 17:01:32 +0300133 cy.readFile('../vid-automation/src/test/resources/a-la-carte/redux-a-la-carte.json').then((file) => {
Ittay Sternf7926712019-07-07 19:23:03 +0300134 file.vnfs['2017-488_PASQUALE-vPE 0'].trackById = vnf.trackById;
135 file.vnfs['2017-488_PASQUALE-vPE 0'].vfModules = {};
Einat Vinouzee1f79742019-08-27 16:01:01 +0300136 file.vnfs['2017-488_PASQUALE-vPE 0'].upgradedVFMSonsCounter = 0;
Ittay Sternf7926712019-07-07 19:23:03 +0300137 cy.deepCompare(vnf, file.vnfs['2017-488_PASQUALE-vPE 0'])
Ittay Stern6f900cc2018-08-29 17:01:32 +0300138 });
139 });
140 });
141
142 });
143 });
144 });
145 });
146
147 it(`Network a-la-carte`, ()=> {
Ittay Stern607ea3d2019-10-23 17:10:52 +0300148 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => {
Ittay Stern6f900cc2018-08-29 17:01:32 +0300149 cy.setTestApiParamToGR();
Ittay Sternf7926712019-07-07 19:23:03 +0300150 res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].service.vidNotions.instantiationType = 'ALaCarte';
Ittay Stern6f900cc2018-08-29 17:01:32 +0300151 res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].service.inputs = null;
152 res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].networks = {
153 "ExtVL 0": {
154 "uuid": "ddc3f20c-08b5-40fd-af72-c6d14636b986",
155 "invariantUuid": "379f816b-a7aa-422f-be30-17114ff50b7c",
156 "description": "ECOMP generic virtual link (network) base type for all other service-level and global networks",
157 "name": "ExtVL",
158 "version": "37.0",
159 "customizationUuid": "94fdd893-4a36-4d70-b16a-ec29c54c184f",
160 "inputs": {},
161 "commands": {},
162 "properties": {
163 "network_assignments": "{is_external_network=false, ipv4_subnet_default_assignment={min_subnets_count=1}, ecomp_generated_network_assignment=false, ipv6_subnet_default_assignment={min_subnets_count=1}}",
164 "ecomp_generated_naming": "false",
165 "exVL_naming": "{ecomp_generated_naming=true}",
166 "network_flows": "{is_network_policy=false, is_bound_to_vpn=false}",
167 "network_homing": "{ecomp_selected_instance_node_target=false}"
168 },
169 "type": "VL",
170 "modelCustomizationName": "ExtVL 0"
171 }
172 };
173 res.service.serviceInstance['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].networks = {};
174 cy.setReduxState(<any>res);
175 cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd');
176 cy.getElementByDataTestsId("node-ExtVL 0-add-btn").click({force: true});
177 cy.selectDropdownOptionByText("platform", "xxx1");
Ittay Sternf7926712019-07-07 19:23:03 +0300178 cy.selectDropdownOptionByText("lcpRegion", "AAIAIC25");
Ittay Stern6f900cc2018-08-29 17:01:32 +0300179 cy.selectDropdownOptionByText("tenant", "USP-SIP-IC-24335-T-01");
Ittay Sternf7926712019-07-07 19:23:03 +0300180 cy.selectDropdownOptionByText("productFamily", "ERICA");
Ittay Stern6f900cc2018-08-29 17:01:32 +0300181 cy.selectDropdownOptionByText("lineOfBusiness", "zzz1");
182 cy.typeToInput("lcpRegionText", "lcpRegionText");
183
184 cy.getElementByDataTestsId('form-set').click({force: true}).then(() => {
185 cy.getReduxState().then((state) => {
186 const network = state.service.serviceInstance['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].networks['ExtVL 0'];
187
188 cy.readFile('../vid-automation/src/test/resources/a-la-carte/redux-a-la-carte.json').then((file) => {
189 file.networks['ExtVL 0'].trackById = network.trackById;
190 cy.deepCompare(network, file.networks['ExtVL 0']);
191 });
192 });
193 });
194 });
195 });
196
197 it(`VFModule a-la-carte`, ()=> {
198 var timeBomb = new Date('12/09/2018');
199 if (new Date() < timeBomb) {
200 return;
201 }
Ittay Stern607ea3d2019-10-23 17:10:52 +0300202 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => {
Ittay Stern6f900cc2018-08-29 17:01:32 +0300203 cy.setTestApiParamToGR();
Ittay Sternf7926712019-07-07 19:23:03 +0300204 res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].service.vidNotions.instantiationType = 'ALaCarte';
Ittay Stern6f900cc2018-08-29 17:01:32 +0300205 res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].service.inputs = null;
206 cy.setReduxState(<any>res);
207 cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd');
208
Ittay Sternf7926712019-07-07 19:23:03 +0300209 cy.getElementByDataTestsId('node-2017-488_PASQUALE-vPE 0-add-btn').click({force: true}).then(() => {
Ittay Stern6f900cc2018-08-29 17:01:32 +0300210 cy.selectDropdownOptionByText('productFamily', 'Emanuel');
211 cy.selectDropdownOptionByText('lcpRegion', 'hvf6');
212 cy.selectDropdownOptionByText('tenant', 'AIN Web Tool-15-D-STTest2');
213 cy.selectDropdownOptionByText('lineOfBusiness', 'zzz1');
214 cy.selectDropdownOptionByText('platform', 'xxx1');
215 cy.getElementByDataTestsId('form-set').click({force: true}).then(() => {
Ittay Sternf7926712019-07-07 19:23:03 +0300216 const vnfName = '2017-488_PASQUALE-vPE 0';
Ittay Stern6f900cc2018-08-29 17:01:32 +0300217 let vfModulesNames: Array<string> = [
Ittay Sternf7926712019-07-07 19:23:03 +0300218 '2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0',
219 '2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1',
220 '2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vPFE_BV..module-2',
Ittay Stern6f900cc2018-08-29 17:01:32 +0300221 ];
222
223 addVfModule(vnfName, vfModulesNames[0], 'mimazepubi', 'hvf6', '', 'AINWebTool-15-D-iftach', false, false, false)
224 .then(() => {
Ittay Sternf7926712019-07-07 19:23:03 +0300225 addVfModule(vnfName, vfModulesNames[1], 'puwesovabe', 'AAIAIC25', 'my region', 'USP-SIP-IC-24335-T-01', true, true, false)
Ittay Stern6f900cc2018-08-29 17:01:32 +0300226 .then(() => {
227 addVfModule(vnfName, vfModulesNames[2], 'bnmgtrx', 'hvf6', '', 'AINWebTool-15-D-iftach', false, false, true)
228 .then(() => {
229 cy.getReduxState().then((state) => {
230 const vfModules = state.service.serviceInstance['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].vnfs[vnfName].vfModules;
231 cy.readFile('../vid-automation/src/test/resources/a-la-carte/redux-a-la-carte.json').then((file) => {
232 for (let vfModulesName of vfModulesNames) {
233 const vfModule = vfModules[vfModulesName];
234 let vfModuleObject = vfModule[Object.keys(vfModule)[0]];
Einat Vinouzee1f79742019-08-27 16:01:01 +0300235 file.vnfs[vnfName].vfModules[vfModulesName][vfModulesName].action = "Create";
Ittay Stern6f900cc2018-08-29 17:01:32 +0300236 cy.deepCompare(vfModuleObject, file.vnfs[vnfName].vfModules[vfModulesName][vfModulesName]);
237 }
238 });
239 });
240 });
241 });
242 });
243 });
244 });
245 });
246 });
247
248
249 function changeServiceEcompNamingToTrue(obj: ServiceModel) {
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +0300250 obj.service.serviceEcompNaming = "true";
251 return obj;
252 }
253
Ittay Stern6f900cc2018-08-29 17:01:32 +0300254 function checkServiceNameInputIdMandatory() {
Ittay Stern7befef82019-07-11 15:54:36 +0300255 cy.get('span').contains('Browse SDC Service Models').click({force: true})
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +0300256 .getElementByDataTestsId('deploy-' + SERVICE_ID).click({force: true})
257 .wait(1000).getElementByDataTestsId(CONFIRM_BUTTON).click({force: true})
258 .get('.error').contains(INSTANCE_NAME_MANDATORY_MESSAGE)
259 .typeToInput('instanceName', 'testService');
260
261 cy.getElementByDataTestsId(CONFIRM_BUTTON).click({force: true})
262 .get('.error').contains(INSTANCE_NAME_NOT_MANDATORY_MESSAGE);
263 }
Ittay Stern6f900cc2018-08-29 17:01:32 +0300264
Einat Vinouzee1f79742019-08-27 16:01:01 +0300265 function addVfModule (vnfName: string, vfModuleName: string, instanceName: string, lcpRegion: string, legacyRegion: string, tenant: string, rollback: boolean, sdncPreLoad: boolean, deleteVgName: boolean): Chainable<any> {
Ittay Stern6f900cc2018-08-29 17:01:32 +0300266 return cy.getElementByDataTestsId('node-' + vnfName).click({force: true}).then(() => {
267 cy.getElementByDataTestsId('node-' + vfModuleName + '-add-btn').click({force: true}).then(() => {
268 cy.getElementByDataTestsId('instanceName').clear().type(instanceName, {force: true}).then(() => {
269 if (deleteVgName) {
270 cy.getElementByDataTestsId('volumeGroupName').clear();
271 }
272 }).then(() => {
273 cy.selectDropdownOptionByText('lcpRegion', lcpRegion);
274 if (!_.isEmpty(legacyRegion)) {
275 cy.typeToInput("lcpRegionText", legacyRegion);
276 }
277 cy.selectDropdownOptionByText('tenant', tenant);
278 cy.selectDropdownOptionByText('rollback', String(rollback));
279 if (sdncPreLoad) {
280 cy.getElementByDataTestsId('sdncPreLoad').check();
281 }
282 cy.getElementByDataTestsId('form-set').click({force: true});
283 });
284 });
285 });
286 }
287
Einat Vinouzee1f79742019-08-27 16:01:01 +0300288
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +0300289 });
290});