blob: 13c4464cd43a850f9560796ce8c8764dcbbfcf63 [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>();
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030010
11
12 beforeEach(() => {
13 cy.window().then((win) => {
14 win.sessionStorage.clear();
15 cy.setReduxState();
16 cy.preventErrorsOnLoading();
17 cy.initAAIMock();
18 cy.initVidMock();
19 cy.initAlaCarteService();
20 cy.initZones();
21 cy.login();
22 });
23 });
24
Ittay Stern6f900cc2018-08-29 17:01:32 +030025 afterEach(() => {
26 cy.screenshot();
27 });
28
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030029 const SERVICE_ID: string = '4d71990b-d8ad-4510-ac61-496288d9078e';
30 const INSTANCE_NAME_MANDATORY_MESSAGE: string = 'Missing data ("Instance Name" and 3 other fields';
31 const INSTANCE_NAME_NOT_MANDATORY_MESSAGE: string = 'Missing data ("Subscriber Name" and 2 other fields)';
Ittay Stern6f900cc2018-08-29 17:01:32 +030032 const CONFIRM_BUTTON: string = 'confirmButton';
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`, ()=> {
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030036 cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/basicService.json').then((res) => {
37 jsonBuilderAAIService.basicJson(res,
38 Cypress.config('baseUrl') + '/rest/models/services/4d71990b-d8ad-4510-ac61-496288d9078e',
39 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";
54 cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => {
55
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`, ()=> {
97 cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => {
98 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
134 cy.readFile('../vid-automation/src/test/resources/a-la-carte/redux-a-la-carte.json').then((file) => {
Ittay Sternf7926712019-07-07 19:23:03 +0300135 file.vnfs['2017-488_PASQUALE-vPE 0'].trackById = vnf.trackById;
136 file.vnfs['2017-488_PASQUALE-vPE 0'].vfModules = {};
137 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`, ()=> {
148 cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => {
149 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 }
202 cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => {
203 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]];
235 cy.deepCompare(vfModuleObject, file.vnfs[vnfName].vfModules[vfModulesName][vfModulesName]);
236 }
237 });
238 });
239 });
240 });
241 });
242 });
243 });
244 });
245 });
246
247
248 function changeServiceEcompNamingToTrue(obj: ServiceModel) {
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +0300249 obj.service.serviceEcompNaming = "true";
250 return obj;
251 }
252
Ittay Stern6f900cc2018-08-29 17:01:32 +0300253 function checkServiceNameInputIdMandatory() {
Ittay Stern7befef82019-07-11 15:54:36 +0300254 cy.get('span').contains('Browse SDC Service Models').click({force: true})
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +0300255 .getElementByDataTestsId('deploy-' + SERVICE_ID).click({force: true})
256 .wait(1000).getElementByDataTestsId(CONFIRM_BUTTON).click({force: true})
257 .get('.error').contains(INSTANCE_NAME_MANDATORY_MESSAGE)
258 .typeToInput('instanceName', 'testService');
259
260 cy.getElementByDataTestsId(CONFIRM_BUTTON).click({force: true})
261 .get('.error').contains(INSTANCE_NAME_NOT_MANDATORY_MESSAGE);
262 }
Ittay Stern6f900cc2018-08-29 17:01:32 +0300263
264 function addVfModule(vnfName: string, vfModuleName: string, instanceName: string, lcpRegion: string, legacyRegion: string, tenant: string, rollback: boolean, sdncPreLoad: boolean, deleteVgName: boolean): Chainable<any> {
265 return cy.getElementByDataTestsId('node-' + vnfName).click({force: true}).then(() => {
266 cy.getElementByDataTestsId('node-' + vfModuleName + '-add-btn').click({force: true}).then(() => {
267 cy.getElementByDataTestsId('instanceName').clear().type(instanceName, {force: true}).then(() => {
268 if (deleteVgName) {
269 cy.getElementByDataTestsId('volumeGroupName').clear();
270 }
271 }).then(() => {
272 cy.selectDropdownOptionByText('lcpRegion', lcpRegion);
273 if (!_.isEmpty(legacyRegion)) {
274 cy.typeToInput("lcpRegionText", legacyRegion);
275 }
276 cy.selectDropdownOptionByText('tenant', tenant);
277 cy.selectDropdownOptionByText('rollback', String(rollback));
278 if (sdncPreLoad) {
279 cy.getElementByDataTestsId('sdncPreLoad').check();
280 }
281 cy.getElementByDataTestsId('form-set').click({force: true});
282 });
283 });
284 });
285 }
286
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +0300287 });
288});