blob: 57c67326246a80d26a6651a637621cb5dd65a674 [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(() => {
Ittay Stern32dbf802019-10-29 12:58:49 +020017 cy.clearSessionStorage();
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030018 cy.setReduxState();
19 cy.preventErrorsOnLoading();
20 cy.initAAIMock();
Ittay Stern0b2078f2019-10-23 17:47:34 +030021 cy.initVidMock();
22 cy.mockLatestVersionForService(SERVICE_ID, SERVICE_INVARIANT_ID);
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030023 cy.initAlaCarteService();
24 cy.initZones();
25 cy.login();
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030026 });
27
Ittay Stern6f900cc2018-08-29 17:01:32 +030028 afterEach(() => {
29 cy.screenshot();
30 });
31
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030032
33
Ittay Stern6f900cc2018-08-29 17:01:32 +030034 it(`service name should be mandatory : serviceEcompNaming = true`, ()=> {
Ittay Stern607ea3d2019-10-23 17:10:52 +030035 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/basicService.json').then((res) => {
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030036 jsonBuilderAAIService.basicJson(res,
Einat Vinouzee1f79742019-08-27 16:01:01 +030037 Cypress.config('baseUrl') + '/rest/models/services/' + SERVICE_ID,
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030038 200,
39 0,
40 SERVICE_ID + ' - service',
41 changeServiceEcompNamingToTrue);
Ittay Stern6f900cc2018-08-29 17:01:32 +030042 checkServiceNameInputIdMandatory();
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030043 });
44 });
45
Ittay Stern6f900cc2018-08-29 17:01:32 +030046 it(`Service a-la-carte`, ()=> {
47
48 const subscriptionServiceType : string = "TYLER SILVIA";
49 const owningEntityName : string = "WayneHolland";
50 const rollbackOnFailure : string = "true";
51 const projectName : string = "WATKINS";
52 const instanceName : string = "serviceInstanceName";
Ittay Stern607ea3d2019-10-23 17:10:52 +030053 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => {
Ittay Stern6f900cc2018-08-29 17:01:32 +030054
55 cy.setTestApiParamToGR();
Ittay Sternf7926712019-07-07 19:23:03 +030056 res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].service.vidNotions.instantiationType = 'ALaCarte';
Ittay Stern6f900cc2018-08-29 17:01:32 +030057 res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].service.inputs = null;
58 cy.setReduxState(<any>res);
59 cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd');
60
61 cy.getElementByDataTestsId("openMenuBtn").click({force: true})
62 .getElementByDataTestsId("context-menu-header-edit-item").click({force: true})
63 .getElementByDataTestsId("instanceName")
64 .getElementByDataTestsId("subscriberName")
65 .getElementByDataTestsId("serviceType")
66 .getElementByDataTestsId("owningEntity")
67 .getElementByDataTestsId("project")
68 .getElementByDataTestsId("rollback");
69
70 cy.selectDropdownOptionByText("subscriberName", "SILVIA ROBBINS");
71 cy.selectDropdownOptionByText("serviceType", subscriptionServiceType);
72 cy.selectDropdownOptionByText("owningEntity", owningEntityName);
73 cy.selectDropdownOptionByText("rollback", rollbackOnFailure);
74 cy.selectDropdownOptionByText("project", projectName);
75 cy.typeToInput("instanceName", instanceName);
76
77 cy.get('#quantity-select').should('have.attr', 'disabled');
78 cy.getElementByDataTestsId('form-set').click({force: true}).then(() => {
79 cy.getReduxState().then((state) => {
80 const service = state.service.serviceInstance['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'];
81
82 cy.readFile('../vid-automation/src/test/resources/a-la-carte/redux-a-la-carte.json').then((file) => {
83 expect(service.subscriptionServiceType).to.equals(subscriptionServiceType);
84 expect(service.owningEntityName).to.equals(owningEntityName);
85 expect(service.rollbackOnFailure).to.equals(rollbackOnFailure);
86 expect(service.projectName).to.equals(projectName);
87 expect(service.instanceName).to.equals(instanceName);
88 });
89 });
90 });
91 });
92 });
93
94
95 it(`VNF a-la-carte`, ()=> {
Ittay Stern607ea3d2019-10-23 17:10:52 +030096 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => {
Ittay Stern6f900cc2018-08-29 17:01:32 +030097 cy.setTestApiParamToGR();
Ittay Sternf7926712019-07-07 19:23:03 +030098 res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].service.vidNotions.instantiationType = 'ALaCarte';
Ittay Stern6f900cc2018-08-29 17:01:32 +030099 res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].service.inputs = null;
100 cy.setReduxState(<any>res);
101 cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd');
102
103 cy.getElementByDataTestsId("openMenuBtn").click({force: true})
104 .getElementByDataTestsId("context-menu-header-edit-item").click({force: true})
105 .getElementByDataTestsId("instanceName")
106 .getElementByDataTestsId("subscriberName")
107 .getElementByDataTestsId("serviceType")
108 .getElementByDataTestsId("owningEntity")
109 .getElementByDataTestsId("project")
110 .getElementByDataTestsId("rollback");
111
112 cy.selectDropdownOptionByText("subscriberName", "SILVIA ROBBINS");
113 cy.selectDropdownOptionByText("serviceType", "TYLER SILVIA");
114 cy.selectDropdownOptionByText("owningEntity", "WayneHolland");
115 cy.selectDropdownOptionByText("rollback", "true");
116 cy.selectDropdownOptionByText("project", "WATKINS");
117 cy.typeToInput("instanceName", "serviceInstanceName");
118
119 cy.get('#quantity-select').should('have.attr', 'disabled');
120 cy.getElementByDataTestsId('form-set').click({force: true}).then(() => {
Ittay Sternf7926712019-07-07 19:23:03 +0300121 cy.getElementByDataTestsId('node-2017-488_PASQUALE-vPE 0-add-btn').click({force: true}).then(() => {
Ittay Stern6f900cc2018-08-29 17:01:32 +0300122 cy.selectDropdownOptionByText('productFamily', 'Emanuel');
Ittay Sternf7926712019-07-07 19:23:03 +0300123 cy.selectDropdownOptionByText('lcpRegion', 'AAIAIC25');
Ittay Stern6f900cc2018-08-29 17:01:32 +0300124 cy.typeToInput("lcpRegionText", "just another region");
125 cy.selectDropdownOptionByText('tenant', 'USP-SIP-IC-24335-T-01');
126 cy.selectDropdownOptionByText('lineOfBusiness', 'zzz1');
127 cy.selectDropdownOptionByText('platform', 'xxx1');
128 cy.getElementByDataTestsId('form-set').click({force: true}).then(() => {
129 cy.getReduxState().then((state) => {
130
Ittay Sternf7926712019-07-07 19:23:03 +0300131 const vnf = state.service.serviceInstance['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].vnfs['2017-488_PASQUALE-vPE 0'];
Ittay Stern6f900cc2018-08-29 17:01:32 +0300132 cy.readFile('../vid-automation/src/test/resources/a-la-carte/redux-a-la-carte.json').then((file) => {
Ittay Sternf7926712019-07-07 19:23:03 +0300133 file.vnfs['2017-488_PASQUALE-vPE 0'].trackById = vnf.trackById;
134 file.vnfs['2017-488_PASQUALE-vPE 0'].vfModules = {};
Einat Vinouzee1f79742019-08-27 16:01:01 +0300135 file.vnfs['2017-488_PASQUALE-vPE 0'].upgradedVFMSonsCounter = 0;
Ittay Sternf7926712019-07-07 19:23:03 +0300136 cy.deepCompare(vnf, file.vnfs['2017-488_PASQUALE-vPE 0'])
Ittay Stern6f900cc2018-08-29 17:01:32 +0300137 });
138 });
139 });
140
141 });
142 });
143 });
144 });
145
146 it(`Network a-la-carte`, ()=> {
Ittay Stern607ea3d2019-10-23 17:10:52 +0300147 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => {
Ittay Stern6f900cc2018-08-29 17:01:32 +0300148 cy.setTestApiParamToGR();
Ittay Sternf7926712019-07-07 19:23:03 +0300149 res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].service.vidNotions.instantiationType = 'ALaCarte';
Ittay Stern6f900cc2018-08-29 17:01:32 +0300150 res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].service.inputs = null;
151 res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].networks = {
152 "ExtVL 0": {
153 "uuid": "ddc3f20c-08b5-40fd-af72-c6d14636b986",
154 "invariantUuid": "379f816b-a7aa-422f-be30-17114ff50b7c",
155 "description": "ECOMP generic virtual link (network) base type for all other service-level and global networks",
156 "name": "ExtVL",
157 "version": "37.0",
158 "customizationUuid": "94fdd893-4a36-4d70-b16a-ec29c54c184f",
159 "inputs": {},
160 "commands": {},
161 "properties": {
162 "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}}",
163 "ecomp_generated_naming": "false",
164 "exVL_naming": "{ecomp_generated_naming=true}",
165 "network_flows": "{is_network_policy=false, is_bound_to_vpn=false}",
166 "network_homing": "{ecomp_selected_instance_node_target=false}"
167 },
168 "type": "VL",
169 "modelCustomizationName": "ExtVL 0"
170 }
171 };
172 res.service.serviceInstance['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].networks = {};
173 cy.setReduxState(<any>res);
174 cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd');
175 cy.getElementByDataTestsId("node-ExtVL 0-add-btn").click({force: true});
176 cy.selectDropdownOptionByText("platform", "xxx1");
Ittay Sternf7926712019-07-07 19:23:03 +0300177 cy.selectDropdownOptionByText("lcpRegion", "AAIAIC25");
Ittay Stern6f900cc2018-08-29 17:01:32 +0300178 cy.selectDropdownOptionByText("tenant", "USP-SIP-IC-24335-T-01");
Ittay Sternf7926712019-07-07 19:23:03 +0300179 cy.selectDropdownOptionByText("productFamily", "ERICA");
Ittay Stern6f900cc2018-08-29 17:01:32 +0300180 cy.selectDropdownOptionByText("lineOfBusiness", "zzz1");
181 cy.typeToInput("lcpRegionText", "lcpRegionText");
182
183 cy.getElementByDataTestsId('form-set').click({force: true}).then(() => {
184 cy.getReduxState().then((state) => {
185 const network = state.service.serviceInstance['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].networks['ExtVL 0'];
186
187 cy.readFile('../vid-automation/src/test/resources/a-la-carte/redux-a-la-carte.json').then((file) => {
188 file.networks['ExtVL 0'].trackById = network.trackById;
189 cy.deepCompare(network, file.networks['ExtVL 0']);
190 });
191 });
192 });
193 });
194 });
195
196 it(`VFModule a-la-carte`, ()=> {
197 var timeBomb = new Date('12/09/2018');
198 if (new Date() < timeBomb) {
199 return;
200 }
Ittay Stern607ea3d2019-10-23 17:10:52 +0300201 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => {
Ittay Stern6f900cc2018-08-29 17:01:32 +0300202 cy.setTestApiParamToGR();
Ittay Sternf7926712019-07-07 19:23:03 +0300203 res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].service.vidNotions.instantiationType = 'ALaCarte';
Ittay Stern6f900cc2018-08-29 17:01:32 +0300204 res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].service.inputs = null;
205 cy.setReduxState(<any>res);
206 cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd');
207
Ittay Sternf7926712019-07-07 19:23:03 +0300208 cy.getElementByDataTestsId('node-2017-488_PASQUALE-vPE 0-add-btn').click({force: true}).then(() => {
Ittay Stern6f900cc2018-08-29 17:01:32 +0300209 cy.selectDropdownOptionByText('productFamily', 'Emanuel');
210 cy.selectDropdownOptionByText('lcpRegion', 'hvf6');
211 cy.selectDropdownOptionByText('tenant', 'AIN Web Tool-15-D-STTest2');
212 cy.selectDropdownOptionByText('lineOfBusiness', 'zzz1');
213 cy.selectDropdownOptionByText('platform', 'xxx1');
214 cy.getElementByDataTestsId('form-set').click({force: true}).then(() => {
Ittay Sternf7926712019-07-07 19:23:03 +0300215 const vnfName = '2017-488_PASQUALE-vPE 0';
Ittay Stern6f900cc2018-08-29 17:01:32 +0300216 let vfModulesNames: Array<string> = [
Ittay Sternf7926712019-07-07 19:23:03 +0300217 '2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0',
218 '2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1',
219 '2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vPFE_BV..module-2',
Ittay Stern6f900cc2018-08-29 17:01:32 +0300220 ];
221
222 addVfModule(vnfName, vfModulesNames[0], 'mimazepubi', 'hvf6', '', 'AINWebTool-15-D-iftach', false, false, false)
223 .then(() => {
Ittay Sternf7926712019-07-07 19:23:03 +0300224 addVfModule(vnfName, vfModulesNames[1], 'puwesovabe', 'AAIAIC25', 'my region', 'USP-SIP-IC-24335-T-01', true, true, false)
Ittay Stern6f900cc2018-08-29 17:01:32 +0300225 .then(() => {
226 addVfModule(vnfName, vfModulesNames[2], 'bnmgtrx', 'hvf6', '', 'AINWebTool-15-D-iftach', false, false, true)
227 .then(() => {
228 cy.getReduxState().then((state) => {
229 const vfModules = state.service.serviceInstance['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].vnfs[vnfName].vfModules;
230 cy.readFile('../vid-automation/src/test/resources/a-la-carte/redux-a-la-carte.json').then((file) => {
231 for (let vfModulesName of vfModulesNames) {
232 const vfModule = vfModules[vfModulesName];
233 let vfModuleObject = vfModule[Object.keys(vfModule)[0]];
Einat Vinouzee1f79742019-08-27 16:01:01 +0300234 file.vnfs[vnfName].vfModules[vfModulesName][vfModulesName].action = "Create";
Ittay Stern6f900cc2018-08-29 17:01:32 +0300235 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
Einat Vinouzee1f79742019-08-27 16:01:01 +0300264 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 +0300265 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
Einat Vinouzee1f79742019-08-27 16:01:01 +0300287
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +0300288 });
289});