blob: 2f2ed14c4120c78f364923fb330e0a2517e3c407 [file] [log] [blame]
Ittay Stern6f900cc2018-08-29 17:01:32 +03001///<reference path="../../../node_modules/cypress/types/index.d.ts"/>
2/// <reference types="Cypress" />
3import {JsonBuilder} from '../../support/jsonBuilders/jsonBuilder';
4import {ServiceModel} from '../../support/jsonBuilders/models/service.model';
5import {AsyncInstantiationModel} from "../../support/jsonBuilders/models/asyncInstantiation.model";
6
7describe('View only drawing board', function () {
8 var jsonBuilderAndMock: JsonBuilder<ServiceModel> = new JsonBuilder<ServiceModel>();
9
10 var jsonBuilderInstantiationBuilder: JsonBuilder<AsyncInstantiationModel> = new JsonBuilder<AsyncInstantiationModel>();
11
12 beforeEach(() => {
13 cy.window().then((win) => {
14 win.sessionStorage.clear();
15 cy.preventErrorsOnLoading();
16 cy.initAAIMock();
17 cy.initVidMock();
18 cy.initZones();
19 cy.permissionVidMock();
20 cy.login();
21 });
22 });
23
24 afterEach(() => {
25 cy.screenshot();
26 });
27
28 it('error should display on api error', function () {
29 const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89";
30 const SERVICE_TYPE: string = "TYLER SILVIA";
31 const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
32 const SERVICE_MODEL_ID: string = '6b528779-44a3-4472-bdff-9cd15ec93450';
33
34 cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/serviceModels/ecompNamingFalseModel.json').then((res) => {
35 jsonBuilderInstantiationBuilder.basicJson(
36 res,
37 Cypress.config('baseUrl') + "/rest/models/services/6b528779-44a3-4472-bdff-9cd15ec93450",
38 500,
39 0,
40 "error 500 getServiceInstanceTopology"
41 );
42
43 cy.openIframe(`app/ui/#/servicePlanning/VIEW?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}`);
44
45 cy.get('div.title')
46 .contains('Server not available');
47
48 });
49 });
50
51 it(`when open service planning in view mode service instance is shown as expected`, function () {
52 const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89";
53 const SERVICE_TYPE: string = "TYLER SILVIA";
54 const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
55 const SERVICE_MODEL_ID: string = '6b528779-44a3-4472-bdff-9cd15ec93450';
56
57 cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/serviceModels/ecompNamingFalseModel.json').then((res) => {
58 jsonBuilderAndMock.basicJson(
59 res,
60 Cypress.config('baseUrl') + "/rest/models/services/6b528779-44a3-4472-bdff-9cd15ec93450",
61 200,
62 0,
63 "ecompNamingFalseModel",
64 )
65 });
66
67 cy.readFile('../vid-automation/src/test/resources/aaiGetInstanceTopology/getServiceInstanceTopologyResult.json').then((res) => {
68 jsonBuilderAndMock.basicJson(
69 res,
70 Cypress.config('baseUrl') + "/aai_get_service_instance_topology/e433710f-9217-458d-a79d-1c7aff376d89/TYLER SILVIA/f8791436-8d55-4fde-b4d5-72dd2cf13cfb",
71 200, 0,
72 "initServiceInstanceTopology",
73 )
74 });
75
76 cy.openIframe(`app/ui/#/servicePlanning/VIEW?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}`);
77 //cy.visit("welcome.htm"); //relaod page to not break the following tests
78
79 //testing left side
Ittay Sternf7926712019-07-07 19:23:03 +030080 cy.getElementByDataTestsId('node-2017-388_PASQUALE-vPE 1').find(`[data-tests-id='node-type-indicator']`).should('have.text', 'VNF');
81 cy.getElementByDataTestsId('node-2017-488_PASQUALE-vPE 0').click({force: true});
82 cy.getElementByDataTestsId('node-2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1').find(`[data-tests-id='node-type-indicator']`).should('have.text', 'M');
Ittay Stern6f900cc2018-08-29 17:01:32 +030083
84 //testing right side
Ittay Sternf7926712019-07-07 19:23:03 +030085 cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').find(`[data-tests-id='node-type-indicator']`).should('have.text', 'VNF');
86 cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').click({force: true});
87 cy.getElementByDataTestsId('node-f8360508-3f17-4414-a2ed-6bc71161e8db-2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0').eq(0).find(`[data-tests-id='node-type-indicator']`).should('have.text', 'M');
Ittay Stern6f900cc2018-08-29 17:01:32 +030088
89 //check vnf node tree sub header
Ittay Sternf7926712019-07-07 19:23:03 +030090 cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').find("[data-tests-id='status-property-orchStatus']").should('have.text', 'Created');
91 cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').find("[data-tests-id='status-property-provStatus']").should('have.text', '');
92 cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').find("[data-tests-id='status-property-inMaint']").should('not.exist');
Ittay Stern6f900cc2018-08-29 17:01:32 +030093
94 //check vf Module node tree sub header
Ittay Sternf7926712019-07-07 19:23:03 +030095 cy.getElementByDataTestsId('node-f8360508-3f17-4414-a2ed-6bc71161e8db-2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0').find("[data-tests-id='status-property-provStatus']").eq(0).should('have.text', 'Prov Status');
96 cy.getElementByDataTestsId('node-f8360508-3f17-4414-a2ed-6bc71161e8db-2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0').find("[data-tests-id='status-property-orchStatus']").eq(0).should('have.text', 'Active');
97 cy.getElementByDataTestsId('node-f8360508-3f17-4414-a2ed-6bc71161e8db-2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0').find("[data-tests-id='status-property-inMaint']").eq(0).should('have.text', '');
Ittay Stern6f900cc2018-08-29 17:01:32 +030098
99 cy.getElementByDataTestsId("serviceInstance").should('have.text', 'Service instance:');
100 cy.getElementByDataTestsId("serviceName").should('have.text', 'mCaNkinstancename');
101 cy.getElementByDataTestsId("orchStatusLabel").should('have.text', 'Orch Status:');
102 cy.getElementByDataTestsId("orchStatusValue").should('have.text', 'Active');
103 cy.getElementByDataTestsId("quantityLabel").should('be.visible');
104 cy.getElementByDataTestsId("servicesQuantity").should('have.text', ' 1 ');
105
106
107 });
Ittay Sternf7926712019-07-07 19:23:03 +0300108 function initServicePlanning(){
Ittay Stern6f900cc2018-08-29 17:01:32 +0300109 const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89";
110 const SERVICE_TYPE: string = "TYLER SILVIA";
111 const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
112 const SERVICE_MODEL_ID: string = '6e59c5de-f052-46fa-aa7e-2fca9d674c44';
113
114 cy.readFile('../vid-automation/src/test/resources/aaiGetInstanceTopology/ServiceTreeWithMultipleChildren_serviceModel.json').then((res) => {
115 jsonBuilderAndMock.basicJson(
116 res,
117 Cypress.config('baseUrl') + "/rest/models/services/6e59c5de-f052-46fa-aa7e-2fca9d674c44",
118 200,
119 0,
120 "ServiceTreeWithMultipleChildren_serviceModel",
121 )
122 });
123
124 cy.readFile('../vid-automation/src/test/resources/aaiGetInstanceTopology/ServiceTreeWithMultipleChildren_serviceInstance.json').then((res) => {
125 jsonBuilderAndMock.basicJson(
126 res,
127 Cypress.config('baseUrl') + "/aai_get_service_instance_topology/e433710f-9217-458d-a79d-1c7aff376d89/TYLER SILVIA/f8791436-8d55-4fde-b4d5-72dd2cf13cfb",
128 200, 0,
129 "ServiceTreeWithMultipleChildren_serviceInstance",
130 )
131 });
132
133 cy.openIframe(`app/ui/#/servicePlanning/VIEW?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}`);
134
Ittay Sternf7926712019-07-07 19:23:03 +0300135 }
136 it('check component info for 2 trees for vnf, vf-module, and network', function(){
137 initServicePlanning();
138 testComponentInfoForVNF();
139 testComponentInfoForVFMODULE();
140 testComponentInfoForNetwork();
141 });
142
143 it(`when open service planning in view mode service instance is shown as expected - e2e with API's ServiceTreeWithMultipleChildren`, function () {
144 initServicePlanning();
Ittay Stern6f900cc2018-08-29 17:01:32 +0300145 /*
146 0. title area -> generic stuff
147 instance name
148 orch status
149 service name
150 */
151 cy.getElementByDataTestsId("serviceInstance").should('have.text', 'Service instance:');
152 cy.getElementByDataTestsId("orchStatusLabel").should('have.text', 'Orch Status:');
153 cy.getElementByDataTestsId("quantityLabel").should('be.visible');
154 cy.getElementByDataTestsId("servicesQuantity").should('have.text', ' 1 ');
155
156 // specific
157 cy.getElementByDataTestsId("serviceName").should('have.text', 'SERVICE_INSTANCE_NAME');
158 cy.getElementByDataTestsId("orchStatusValue").should('have.text', 'GARBAGE DATA');
159 cy.get('span#service-model-name').should('have.text', 'ComplexService');
160
161 // test component info of service-level
162 let labelsAndValues = [
Ittay Sternf7926712019-07-07 19:23:03 +0300163 ['Model version', '1.0'],
Ittay Stern6f900cc2018-08-29 17:01:32 +0300164 ['Instance ID', 'service-instance-id'],
Ittay Sternf7926712019-07-07 19:23:03 +0300165 ['Service type', 'service-instance-type'],
Ittay Stern6f900cc2018-08-29 17:01:32 +0300166 ];
167 cy.assertComponentInfoTitleLabelsAndValues('Service Instance INFO', labelsAndValues);
168
169
170 // expand all
171 cy.get('available-models-tree').find('.toggle-children').click({ multiple: true });
172
173 /*
174 1. Left tree -> VNF with 3 vf modules
175 Network
176 Configuration
177 */
178 const leftShouldHaves: { [dataTestId: string]: { [dataTestId: string]: string; }; } = {
Ittay Sternf7926712019-07-07 19:23:03 +0300179 'node-VF_vGeraldine 0': {
Ittay Stern6f900cc2018-08-29 17:01:32 +0300180 'node-type-indicator': 'VNF',
Ittay Sternf7926712019-07-07 19:23:03 +0300181 'node-name': 'VF_vGeraldine 0',
Ittay Stern6f900cc2018-08-29 17:01:32 +0300182 'numberButton': '1',
183 },
Ittay Sternf7926712019-07-07 19:23:03 +0300184 'node-vf_vgeraldine0..VfVgeraldine..base_vflorence..module-0': {
Ittay Stern6f900cc2018-08-29 17:01:32 +0300185 'node-type-indicator': 'M',
Ittay Sternf7926712019-07-07 19:23:03 +0300186 'node-name': 'vf_vgeraldine0..VfVgeraldine..base_vflorence..module-0',
Ittay Stern6f900cc2018-08-29 17:01:32 +0300187 'numberButton': '',
188 },
Ittay Sternf7926712019-07-07 19:23:03 +0300189 'node-vf_vgeraldine0..VfVgeraldine..vflorence_vlc..module-1': {
Ittay Stern6f900cc2018-08-29 17:01:32 +0300190 'node-type-indicator': 'M',
Ittay Sternf7926712019-07-07 19:23:03 +0300191 'node-name': 'vf_vgeraldine0..VfVgeraldine..vflorence_vlc..module-1',
Ittay Stern6f900cc2018-08-29 17:01:32 +0300192 'numberButton': '1',
193 },
Ittay Sternf7926712019-07-07 19:23:03 +0300194 'node-vf_vgeraldine0..VfVgeraldine..vflorence_gpb..module-2': {
Ittay Stern6f900cc2018-08-29 17:01:32 +0300195 'node-type-indicator': 'M',
Ittay Sternf7926712019-07-07 19:23:03 +0300196 'node-name': 'vf_vgeraldine0..VfVgeraldine..vflorence_gpb..module-2',
Ittay Stern6f900cc2018-08-29 17:01:32 +0300197 'numberButton': '',
198 },
199 'node-ExtVL 0': {
200 'node-type-indicator': 'N',
201 'node-name': 'ExtVL 0',
202 'numberButton': '2',
203 },
204 'node-Port Mirroring Configuration By Policy 0': {
205 'node-type-indicator': 'C',
206 'node-name': 'Port Mirroring Configuration By Policy 0',
207 'numberButton': '',
208 },
209 };
210
211 for (let node in leftShouldHaves) {
212 for (let span in leftShouldHaves[node]) {
213 const expected = leftShouldHaves[node][span];
214 cy.getElementByDataTestsId(node).find(`[data-tests-id='${span}']`).should(expected ? 'have.text' : 'not.exist', expected);
215 }
216 }
217
218 /*
219 2. Right tree -> VNF with 2 vf modules
220 2 networks
221 IGNORE, don't check: first node, which have no Service connection
222 */
223 const rightShouldHaves: { [dataTestId: string]: { [dataTestId: string]: string; }; } = {
Ittay Sternf7926712019-07-07 19:23:03 +0300224 'node-d6557200-ecf2-4641-8094-5393ae3aae60-VF_vGeraldine 0:0': {
Ittay Stern6f900cc2018-08-29 17:01:32 +0300225 'node-type-indicator': 'VNF',
226 'node-name': 'VNF2_INSTANCE_NAME',
227 'status-property-orchStatus': '',
228 'status-property-provStatus': '',
229 'status-property-inMaint': '',
230 },
231 'node-undefined-dc229cd8-c132-4455-8517-5c1787c18b14:0': {
232 'node-type-indicator': 'M',
233 'node-name': 'ss820f_0918_base',
234 'status-property-orchStatus': 'Assigned',
235 'status-property-provStatus': '',
236 },
Ittay Sternf7926712019-07-07 19:23:03 +0300237 'node-522159d5-d6e0-4c2a-aa44-5a542a12a830-vf_vgeraldine0..VfVgeraldine..vflorence_vlc..module-1:0': {
Ittay Stern6f900cc2018-08-29 17:01:32 +0300238 'node-type-indicator': 'M',
239 'node-name': 'ss820f_0918_db',
240 'status-property-orchStatus': 'deleted',
241 'status-property-provStatus': '',
242 'status-property-inMaint': '',
243 },
244 'node-ddc3f20c-08b5-40fd-af72-c6d14636b986-ExtVL 0:0': {
245 'node-type-indicator': 'N',
246 'node-name': 'NETWORK3_INSTANCE_NAME',
247 'status-property-orchStatus': 'Assigned',
248 'status-property-provStatus': 'nvtprov',
249 },
250 'node-ddc3f20c-08b5-40fd-af72-c6d14636b986-ExtVL 0:1': {
251 'node-type-indicator': 'N',
252 'node-name': 'NETWORK4_INSTANCE_NAME',
253 'status-property-orchStatus': 'Created',
254 'status-property-provStatus': 'preprov',
255 },
256 };
257
258 for (let node in rightShouldHaves) {
259 var [nodeName, nodeEq] = node.split(":");
260 for (let span in rightShouldHaves[node]) {
261 cy.getElementByDataTestsId(nodeName).eq(+nodeEq).find(`[data-tests-id='${span}']`).should('have.text', rightShouldHaves[node][span]);
262 }
263 }
264
265 /*
266 3. Left to right connections ->
267 vnf: # of instances = 1, click -> vnf selected
268 vf module1: # of instances = 1, click -> 1 vfmodule "ss820f_0918_db" selected
269 vf module2: # of instances = 0, click -> nothing
270 vf module3: # of instances = 0, click -> nothing
271 network: # of instances = 2, click -> 2 networks selected
272 configuration: # of instances = 0, click -> nothing
273 */
274 const leftShouldHighlight: { [text: string]: string[] } = {
Ittay Sternf7926712019-07-07 19:23:03 +0300275 'VF_vGeraldine 0': ['VNF2_INSTANCE_NAME'],
276 'vf_vgeraldine0..VfVgeraldine..base_vflorence..module-0': [],
277 'vf_vgeraldine0..VfVgeraldine..vflorence_vlc..module-1': ['ss820f_0918_db'],
278 'vf_vgeraldine0..VfVgeraldine..vflorence_gpb..module-2': [],
Ittay Stern6f900cc2018-08-29 17:01:32 +0300279 'ExtVL 0': ['NETWORK3_INSTANCE_NAME', 'NETWORK4_INSTANCE_NAME'],
280 'Port Mirroring Configuration By Policy 0': [],
281 };
282
283 for (let text in leftShouldHighlight) {
284 cy.get('available-models-tree').contains(text).click();
285
286 cy.get('.node-content-wrapper-active').find(`[data-tests-id='node-name']`).should('have.text', text + leftShouldHighlight[text].join(''));
287 }
288
289 /*
290 4. Right to left connections ->
291 vnf: click -> vnf selected
292 vf module1: click -> nothing
293 vf module2: click -> vemme0 selected
294 network1: click -> network selected
295 network2: click -> network selected
296 */
297 const rightShouldHighlight: { [text: string]: string[] } = {
Ittay Sternf7926712019-07-07 19:23:03 +0300298 'VNF2_INSTANCE_NAME': ['VF_vGeraldine 0'],
Ittay Stern6f900cc2018-08-29 17:01:32 +0300299 'ss820f_0918_base': [],
Ittay Sternf7926712019-07-07 19:23:03 +0300300 'ss820f_0918_db': ['vf_vgeraldine0..VfVgeraldine..vflorence_vlc..module-1'],
Ittay Stern6f900cc2018-08-29 17:01:32 +0300301 'NETWORK3_INSTANCE_NAME': ['ExtVL 0'],
302 'NETWORK4_INSTANCE_NAME': ['ExtVL 0'],
303 };
304
305 for (let node in rightShouldHighlight) {
306 cy.get('drawing-board-tree').contains(node).click();
307 cy.get('.node-content-wrapper-active').find(`[data-tests-id='node-name']`).should('have.text', rightShouldHighlight[node].join('') + node);
308 }
309 cy.getElementByDataTestsId('isViewOnly-status-test').contains('VIEW ONLY');
310
311
312 /*
313 5. Click outside should remove highlight from all trees.
314 */
315
316 cy.clickOutside('search-left-tree-input', ()=>{
317 cy.get('.node-content-wrapper-active.node-content-wrapper-focused').should('have.length', 2)
318 }, ()=>{
319 cy.get('.node-content-wrapper-active.node-content-wrapper-focused').should('have.length', 0);
320 });
321
322
323 });
Ittay Sternf7926712019-07-07 19:23:03 +0300324
325 function testComponentInfoForVNF(){
326 const labelsAndValuesForModel = [
327 ['Model version', '2.0'],
328 ['Model customization ID', '91415b44-753d-494c-926a-456a9172bbb9'],
329 ['Min instances', '0'],
330 ['Max instances', '1']
331 ];
332 const extraLabelsAndValuesForInstance = [['Instance type', 'VNF2_INSTANCE_TYPE'],['In maintenance','true'], ['Instance ID', 'VNF2_INSTANCE_ID']];
333 testComponentInfoByType('node-VF_vGeraldine 0', labelsAndValuesForModel,'VNF INFO',
334 'VNF2_INSTANCE_NAME', extraLabelsAndValuesForInstance,'VNF Instance INFO');
335
336 }
337
338 function testComponentInfoForVFMODULE(){
339 const labelsAndValuesForModel = [
340 ['Model version', '2'],
341 ['Model customization ID', '55b1be94-671a-403e-a26c-667e9c47d091'],
342 ['Base module', 'false'],
343 ['Min instances', '0'],
344 ['Initial instances count', '0']
345 ];
346 const extraLabelsAndValuesForInstance = [['In maintenance','true'], ['Instance ID', '2c1ca484-cbc2-408b-ab86-25a2c15ce280']];
347 testComponentInfoByType('node-vf_vgeraldine0..VfVgeraldine..vflorence_vlc..module-1',labelsAndValuesForModel,'VFModule INFO',
348 'ss820f_0918_db',extraLabelsAndValuesForInstance,'VFModule Instance INFO')
349
350 }
351
352 function testComponentInfoForNetwork(){
353 const labelsAndValuesForModel = [
354 ['Model version', '37.0'],
355 ['Model customization ID', '94fdd893-4a36-4d70-b16a-ec29c54c184f'],
356 ['Network role','network role 1, network role 2']
357 ];
358 const extraLabelsAndValuesForInstance = [['In maintenance','false'], ['Instance ID', 'NETWORK3_INSTANCE_ID'],['Instance type', 'CONTRAIL30_BASIC']];
359 testComponentInfoByType('node-ExtVL 0',labelsAndValuesForModel,'Network INFO',
360 'NETWORK3_INSTANCE_NAME',extraLabelsAndValuesForInstance,'Network Instance INFO');
361
362 }
363
364 function testComponentInfoByType(leftNode:string, labelsAndValuesForModel: string[][], expectedTitleForModel:string, rightNode:string, extraLabelsAndValuesForInstance: string[][], expectedTitleForInstance:string){
365 cy.getElementByDataTestsId(leftNode).eq(0).click({force: true});
366 cy.assertComponentInfoTitleLabelsAndValues(expectedTitleForModel, labelsAndValuesForModel);
367
368 let labelsAndValuesForInstance = labelsAndValuesForModel.concat(extraLabelsAndValuesForInstance);
369 cy.get('drawing-board-tree').contains(rightNode).click();
370 cy.assertComponentInfoTitleLabelsAndValues(expectedTitleForInstance, labelsAndValuesForInstance);
371 }
372
373
Ittay Stern6f900cc2018-08-29 17:01:32 +0300374});