Added oparent to sdc main
[sdc.git] / ui-ci / src / main / java / org / openecomp / sdc / ci / tests / execute / sanity / UpgradeServices.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.openecomp.sdc.ci.tests.execute.sanity;
22
23 import com.aventstack.extentreports.Status;
24 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
25 import org.openecomp.sdc.be.model.Resource;
26 import org.openecomp.sdc.be.model.Service;
27 import org.openecomp.sdc.be.model.User;
28 import org.openecomp.sdc.ci.tests.datatypes.*;
29 import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
30 import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
31 import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
32 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
33 import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
34 import org.openecomp.sdc.ci.tests.pages.*;
35 import org.openecomp.sdc.ci.tests.utilities.CatalogUIUtilitis;
36 import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
37 import org.openecomp.sdc.ci.tests.utilities.PortMirroringUtils;
38 import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
39 import org.openecomp.sdc.ci.tests.utils.general.*;
40 import org.openecomp.sdc.ci.tests.verificator.PropertiesAssignmentVerificator;
41 import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator;
42 import org.openecomp.sdc.ci.tests.verificator.VfVerificator;
43 import org.testng.Assert;
44 import org.testng.annotations.BeforeClass;
45 import org.testng.annotations.Test;
46
47 import java.util.Map;
48
49 public class UpgradeServices extends SetupCDTest{
50
51
52         protected User sdncDesignerDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
53         private String filePath;
54
55         @BeforeClass
56         public void beforeClass(){
57                 filePath = org.openecomp.sdc.ci.tests.utilities.FileHandling.getFilePath("");
58         }
59
60         @Test
61         public void upgradeVfOnServiceLevel() throws Throwable{
62                 String vnfFile = "2016-227_vmme_vmme_30_1610_e2e.zip";
63                 //1. Import VSP, create VF, certify
64                 Resource vfResource = createAndCertifyVFfromVSP(vnfFile);
65         //2. Create CR, certify
66                 ResourceReqDetails crMetaData = createCRAndCertify();
67         //3. Create PNF, certify
68                 ResourceReqDetails pnfMetaData = createPnfAndCertify();
69
70         //4. Create Service1. Service composition - add 2 VFi
71                 Service service1 = createService();
72         getExtendTest().log(Status.INFO, "Add VFi to service twice");
73         CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
74                 CanvasManager canvasManager1 = createCanvasManager(service1);
75         CanvasElement vfElementVmme1 = canvasManager1.createElementOnCanvas(vfResource.getName());
76         CanvasElement vfElementVmme11 = canvasManager1.createElementOnCanvas(vfResource.getName());
77
78         //5. Add CRi, PNFi and PMC to Service1
79                 getExtendTest().log(Status.INFO, "Add PMC element to service");
80         CompositionPage.searchForElement(PortMirroringEnum.PMC_ELEMENT_IN_PALLETE.getValue());
81         CanvasElement pmcElement = canvasManager1.createElementOnCanvas(PortMirroringEnum.PMC_ELEMENT_IN_PALLETE.getValue());
82         getExtendTest().log(Status.INFO, "Add CR and PNF elements to service");
83         canvasManager1.createElementOnCanvas(crMetaData.getName());
84         canvasManager1.createElementOnCanvas(pnfMetaData.getName());
85
86         //6. Link between VF and PMC. Give values to capability properties. Certify Service1.
87         ConnectionWizardPopUpObject connectionWizardPopUpObject = new ConnectionWizardPopUpObject("", "",
88                 PortMirroringEnum.PM_REQ_TYPE.getValue(), PortMirroringEnum.PMC_SOURCE_CAP.getValue());
89                 Map<String, String> capPropValues1 = canvasManager1.linkElementsWithCapPropAssignment(vfElementVmme1,
90                                 pmcElement, connectionWizardPopUpObject); //link elements, assign values to properties and save map of values for later validation
91                 certifyServiceInUI(service1);
92                 service1.setVersion("1.0");
93                 service1 = AtomicOperationUtils.getServiceObjectByNameAndVersion(UserRoleEnum.DESIGNER, service1.getName(), service1.getVersion());
94                 String vf1CustUuidOrig = AtomicOperationUtils.getServiceComponentInstanceByName
95                                 (service1, vfElementVmme1.getElementNameOnCanvas(),true).getCustomizationUUID();
96
97         //7. Create Service2. Service composition - add VFi. Start certifying Service2 ("certification in progress" stage)
98                 Service service2 = createService();
99         getExtendTest().log(Status.INFO, "Add VFi to service");
100                 CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
101                 CanvasManager canvasManager2 = createCanvasManager(service2);
102         CanvasElement vfElementVmme2 = canvasManager2.createElementOnCanvas(vfResource.getName());
103         getExtendTest().log(Status.INFO, "Start service certification");
104         AtomicOperationUtils.changeComponentState(service2, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.STARTCERTIFICATION, true).getLeft();
105                 service2 = AtomicOperationUtils.getServiceObject(service2.getUniqueId());
106                 String vf2CustUuidOrig = AtomicOperationUtils.getServiceComponentInstanceByName
107                                 (service2, vfElementVmme2.getElementNameOnCanvas(),true).getCustomizationUUID();
108
109         //8. Create Service3. Service composition - add VFi. Leave service in "checked out" state
110                 Service service3 = createService();
111         getExtendTest().log(Status.INFO, "Add VFi to service");
112         GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
113                 CanvasManager canvasManager3 = createCanvasManager(service3);
114         CanvasElement vfElementVmme3 = canvasManager3.createElementOnCanvas(vfResource.getName());
115                 service3 = AtomicOperationUtils.getServiceObject(service3.getUniqueId()); //updated
116                 String vf3CustUuidOrig = AtomicOperationUtils.getServiceComponentInstanceByName
117                                 (service3, vfElementVmme3.getElementNameOnCanvas(),true).getCustomizationUUID();
118
119         //9. VF - checkout, save, click "certify"
120         GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
121         GeneralUIUtils.findComponentAndClick(vfResource.getName());
122         GeneralPageElements.clickCheckoutButton();
123         GeneralPageElements.clickCreateUpdateButton(10*60);
124         GeneralPageElements.clickCertifyButtonNoUpgradePopupDismiss(vfResource.getName());
125
126         //10. Validate that Service1 can be upgraded (checked), Service2 and Service3 are locked
127         //TODO - add validation in UI
128
129         //11. Click Upgrade button
130         GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.UPGRADE_SERVICES_OK.getValue());
131         GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.UPGRADE_SERVICES_CLOSE.getValue());
132
133         //12. Open Service1, verify version (1.1), state(checked in), VFi version (v2.0)
134         GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
135         GeneralUIUtils.findComponentAndClick(service1.getName());
136         ServiceVerificator.verifyVersionUI("1.1");
137         ServiceVerificator.verifyServiceLifecycleInUI(LifeCycleStateEnum.CHECKIN);
138                 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
139                 CanvasManager canvasManager4 = CanvasManager.getCanvasManager();
140                 canvasManager4.clickOnCanvaElement(vfElementVmme1);
141                 ServiceVerificator.verifyResourceInstanceVersionUI("2.0");
142                 canvasManager4.clickOnCanvaElement(vfElementVmme11);
143                 ServiceVerificator.verifyResourceInstanceVersionUI("2.0");
144
145                 //13. Verify that VFi CustomizationID is different
146                 service1.setVersion("1.1");
147                 service1 = AtomicOperationUtils.getServiceObjectByNameAndVersion(UserRoleEnum.DESIGNER, service1.getName(), service1.getVersion()); //updated
148                 String vf1CustUuidUpd = AtomicOperationUtils.getServiceComponentInstanceByName
149                                 (service1, vfElementVmme1.getElementNameOnCanvas(),true).getCustomizationUUID();
150         Assert.assertTrue(!vf1CustUuidOrig.equals(vf1CustUuidUpd));
151
152         //14. Verify that capabilities properties assignment is kept
153                 canvasManager4.openLinkPopupReqsCapsConnection(vfElementVmme1, pmcElement); //open connection wizard
154                 Map<String, String> capPropValues2 = canvasManager4.connectionWizardCollectCapPropValues(); //collect cap prop values
155                 Assert.assertTrue(capPropValues1.equals(capPropValues2)); // compare cap prop values before and after changing VF version
156         canvasManager4.clickSaveOnLinkPopup();
157
158                 //15. Open Service2, verify version (0.1), state ("in testing"), VFi version (1.0) and VFi Customization UUID (hasn't changed)
159                 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
160                 GeneralUIUtils.findComponentAndClick(service2.getName());
161                 ServiceVerificator.verifyVersionUI("0.1");
162                 ServiceVerificator.verifyServiceLifecycleInUI(LifeCycleStateEnum.IN_TESTING);
163                 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
164                 CanvasManager canvasManager5 = CanvasManager.getCanvasManager();
165                 canvasManager5.clickOnCanvaElement(vfElementVmme2);
166                 ServiceVerificator.verifyResourceInstanceVersionUI("1.0");
167                 service2 = AtomicOperationUtils.getServiceObject(service2.getUniqueId()); //updated
168                 String vf2CustUuidUpd = AtomicOperationUtils.getServiceComponentInstanceByName
169                                 (service2, vfElementVmme2.getElementNameOnCanvas(),true).getCustomizationUUID();
170         Assert.assertTrue(vf2CustUuidOrig.equals(vf2CustUuidUpd));
171
172                 //16. Open Service3, verify version (0.1), state ("checked out"), VFi version (1.0) and VFi Customization UUID (hasn't changed)
173                 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
174                 GeneralUIUtils.findComponentAndClick(service3.getName());
175                 ServiceVerificator.verifyVersionUI("0.1");
176                 ServiceVerificator.verifyServiceLifecycleInUI(LifeCycleStateEnum.CHECKOUT);
177                 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
178                 CanvasManager canvasManager6 = CanvasManager.getCanvasManager();
179                 canvasManager6.clickOnCanvaElement(vfElementVmme3);
180                 ServiceVerificator.verifyResourceInstanceVersionUI("1.0");
181                 service3 = AtomicOperationUtils.getServiceObject(service3.getUniqueId()); //updated
182                 String vf3CustUuidUpd = AtomicOperationUtils.getServiceComponentInstanceByName
183                                 (service3, vfElementVmme3.getElementNameOnCanvas(),true).getCustomizationUUID();
184         Assert.assertTrue(vf3CustUuidOrig.equals(vf3CustUuidUpd));
185
186                 //17. Open CR, checkout, certify. Verify there is no upgrade popup
187                 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
188                 GeneralUIUtils.findComponentAndClick(crMetaData.getName());
189                 ResourceGeneralPage.clickCheckoutButton();
190                 ResourceGeneralPage.clickCertifyButton(crMetaData.getName());
191         Assert.assertTrue(!UpgradeServicesPopup.isUpgradePopupShown());
192
193                 //18. Open PNF, checkout, certify. Verify there is no upgrade popup
194                 GeneralUIUtils.findComponentAndClick(pnfMetaData.getName());
195                 ResourceGeneralPage.clickCheckoutButton();
196                 ResourceGeneralPage.clickCertifyButton(pnfMetaData.getName());
197         Assert.assertTrue(!UpgradeServicesPopup.isUpgradePopupShown());
198         }
199
200         @Test
201         public void upgradeAllottedVfOnServiceLevel() throws Throwable {
202             String propUUID = "depending_service_uuid";
203             String propInvUUID = "depending_service_invariant_uuid";
204             String propName = "depending_service_name";
205
206                 //1. Create Service1, certify
207                 Service service1 = createService();
208                 getExtendTest().log(Status.INFO, "Certify Service1");
209                 AtomicOperationUtils.changeComponentState(service1, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
210                 String serviceName = service1.getName();
211                 String serviceInvUUID = service1.getInvariantUUID();
212                 String serviceUUIDv1 = service1.getUUID();
213
214                 //2. Import AllottedResource yaml, create VFC, certify
215                 String fileName = "Allottedresource.yml";
216                 ResourceReqDetails vfcMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT,
217                                 ResourceCategoryEnum.ALLOTTED_RESOURCE, getUser());
218                 ResourceUIUtils.importVfc(vfcMetaData, filePath, fileName, getUser());
219                 ResourceGeneralPage.clickCertifyButton(vfcMetaData.getName());
220
221                 //3. Create VF, add VFCi to canvas
222                 ResourceReqDetails vfMetaData = createVFviaAPI(ResourceCategoryEnum.ALLOTTED_RESOURCE_TUNNEL_XCONNECT);
223         CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
224         GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
225                 ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
226                 CanvasManager canvasManager1 = CanvasManager.getCanvasManager();
227                 CanvasElement vfcElement1 = canvasManager1.createElementOnCanvas(vfcMetaData.getName());
228
229                 //4. VF Properties Assignment: edit values of depending service properties, certify VF
230         CompositionPage.moveToPropertiesScreen();
231         PropertiesAssignmentPage.findSearchBoxAndClick(propName);
232         PropertiesAssignmentPage.editPropertyValue(PropertyNameBuilder.buildSimpleField(propName), serviceName);
233         PropertiesAssignmentPage.clickOnSaveButton();
234         PropertiesAssignmentPage.findSearchBoxAndClick(propUUID);
235         PropertiesAssignmentPage.editPropertyValue(PropertyNameBuilder.buildSimpleField(propUUID), serviceUUIDv1);
236         PropertiesAssignmentPage.clickOnSaveButton();
237         PropertiesAssignmentPage.findSearchBoxAndClick(propInvUUID);
238         PropertiesAssignmentPage.editPropertyValue(PropertyNameBuilder.buildSimpleField(propInvUUID), serviceInvUUID);
239         PropertiesAssignmentPage.clickOnSaveButton();
240                 ResourceGeneralPage.clickCertifyButton(vfMetaData.getName());
241
242                 //5. Create Service2, add VFi to Service2, certify Service2
243                 Service service2 = createService();
244                 CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
245                 CanvasManager canvasManager2 = createCanvasManager(service2);
246                 CanvasElement vfElement1 = canvasManager2.createElementOnCanvas(vfMetaData.getName());
247                 getExtendTest().log(Status.INFO, "Certify Service2");
248                 AtomicOperationUtils.changeComponentState(service2, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
249
250                 //6. Create Service3, add VFi to Service3, leave Service3 in checked-out state
251                 Service service3 = createService();
252                 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
253                 CanvasManager canvasManager3 = createCanvasManager(service3);
254                 CanvasElement vfElement2 = canvasManager3.createElementOnCanvas(vfMetaData.getName());
255
256                 //7. Check out and certify Service1 (keep new UUID)
257                 AtomicOperationUtils.changeComponentState(service1, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft();
258                 AtomicOperationUtils.changeComponentState(service1, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
259                 service1 = AtomicOperationUtils.getServiceObject(service1.getUniqueId());
260                 String serviceUUIDv2 = service1.getUUID();
261
262                 //8. Open Service1 and click “Upgrade Services” button
263                 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
264                 GeneralUIUtils.findComponentAndClick(service1.getName());
265                 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.UPDATE_SERVICES_BUTTON.getValue()).click();
266
267                 //9. Validate that Service2 can be upgraded (checked), Service3 is locked
268                 //TODO - add validation in UI
269
270                 //10. Click Upgrade button
271                 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.UPDATE_SERVICES_OK.getValue());
272                 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.UPGRADE_SERVICES_CLOSE.getValue());
273
274                 //11. Open VF, verify that version is 2.0
275                 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
276                 GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
277                 VfVerificator.verifyVersionUI("2.0");
278
279                 //12. VF properties assignment - verify that UUID value is updated, other values are the same
280                 ResourceGeneralPage.getLeftMenu().moveToPropertiesAssignmentScreen();
281                 PropertiesAssignmentVerificator.validatePropertyValue(PropertyNameBuilder.buildSimpleField(propUUID),serviceUUIDv2);
282                 PropertiesAssignmentVerificator.validatePropertyValue(PropertyNameBuilder.buildSimpleField(propInvUUID),serviceInvUUID);
283                 PropertiesAssignmentVerificator.validatePropertyValue(PropertyNameBuilder.buildSimpleField(propName),serviceName);
284
285                 //13. Open Service2, verify version 1.1 and state "in design check in", select VFi, verify version 2.0
286         GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
287         GeneralUIUtils.findComponentAndClick(service2.getName());
288         ServiceVerificator.verifyVersionUI("1.1");
289         ServiceVerificator.verifyServiceLifecycleInUI(LifeCycleStateEnum.CHECKIN);
290         ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
291         CanvasManager canvasManager4 = CanvasManager.getCanvasManager();
292         canvasManager4.clickOnCanvaElement(vfElement1);
293         ServiceVerificator.verifyResourceInstanceVersionUI("2.0");
294
295         //14. Open Service3, select VFi in composition, verify version 1.0
296                 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
297                 GeneralUIUtils.findComponentAndClick(service3.getName());
298                 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
299                 CanvasManager canvasManager5 = CanvasManager.getCanvasManager();
300                 canvasManager5.clickOnCanvaElement(vfElement2);
301                 ServiceVerificator.verifyResourceInstanceVersionUI("1.0");
302         }
303
304         @Test
305         public void upgradeServiceProxyOnServiceLevel() throws Throwable {
306             //1. Create Port Mirroring Service1, certify
307                 PortMirrioringConfigurationObject portMirrioringConfigurationObject = PortMirroringUtils.createPortMirriongConfigurationStructure(true);
308                 Service service1 = portMirrioringConfigurationObject.getService();
309                 Service serviceSource = portMirrioringConfigurationObject.getServiceContainerVmme_Source();
310                 CanvasElement pmcElement = portMirrioringConfigurationObject.getPortMirroringConfigurationElement();
311                 CanvasElement sourceElement = portMirrioringConfigurationObject.getServiceElementVmmeSourceName();
312                 Map<String, String> capPropValues1 = portMirrioringConfigurationObject.getCapPropValues();
313                 certifyServiceInUI(service1);
314                 service1 = AtomicOperationUtils.getServiceObject(service1.getUniqueId());
315                 String serviceSourceName = portMirrioringConfigurationObject.getServiceElementVmmeSourceName().getElementNameOnCanvas();
316                 String sourceUuidOrig = AtomicOperationUtils.getServiceComponentInstanceByName
317                                 (service1, serviceSourceName,true).getCustomizationUUID();
318
319         //2. Create Service2, add source service to it
320         Service service2 = createService();
321                 CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
322         CanvasManager canvasManager1 = createCanvasManager(service2);
323         CanvasElement serviceSourceElement = canvasManager1.createElementOnCanvas(serviceSource.getName());
324
325         //3. Checkout and certify serviceSource
326                 AtomicOperationUtils.changeComponentState(serviceSource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft();
327                 AtomicOperationUtils.changeComponentState(serviceSource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
328                 serviceSource = AtomicOperationUtils.getServiceObject(serviceSource.getUniqueId());
329
330                 //4. Open Service2, click Update button
331                 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
332                 GeneralUIUtils.findComponentAndClick(serviceSource.getName());
333                 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.UPDATE_SERVICES_BUTTON.getValue()).click();
334
335                 //5. Validate that Service1 can be upgraded (checked), Service2 is locked
336                 //TODO - add validation in UI
337
338                 //6. Click Upgrade button
339                 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.UPDATE_SERVICES_OK.getValue());
340                 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.UPGRADE_SERVICES_CLOSE.getValue());
341
342                 //7. Open Service1, verify version 1.1 and state "in design check in", select VFi, verify version 2.0
343                 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
344                 GeneralUIUtils.findComponentAndClick(service1.getName());
345                 ServiceVerificator.verifyVersionUI("1.1");
346                 ServiceVerificator.verifyServiceLifecycleInUI(LifeCycleStateEnum.CHECKIN);
347                 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
348                 CanvasManager canvasManager2 = CanvasManager.getCanvasManager();
349                 canvasManager2.clickOnCanvaElement(serviceSourceElement);
350                 ServiceVerificator.verifyResourceInstanceVersionUI("2.0");
351
352                 //8. Verify that capabilities properties values are kept
353                 canvasManager2.openLinkPopupReqsCapsConnection(sourceElement, pmcElement); //open connection wizard
354                 Map<String, String> capPropValues2 = canvasManager2.connectionWizardCollectCapPropValues(); //collect cap prop values
355                 Assert.assertTrue(capPropValues1.equals(capPropValues2)); // compare cap prop values before and after changing VF version
356                 canvasManager2.clickSaveOnLinkPopup();
357
358                 //9. Verify that CustomizationUUID of service source instance is changed
359                 service1.setVersion("1.1");//updated
360                 service1 = AtomicOperationUtils.getServiceObjectByNameAndVersion(UserRoleEnum.DESIGNER, service1.getName(), service1.getVersion());
361                 String sourceUuidUpd = AtomicOperationUtils.getServiceComponentInstanceByName
362                                 (service1, serviceSourceName,true).getCustomizationUUID();
363                 Assert.assertTrue(!sourceUuidOrig.equals(sourceUuidUpd));
364
365                 //10. Open Service3, select VFi in composition, verify version 1.0
366                 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
367                 GeneralUIUtils.findComponentAndClick(service2.getName());
368                 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
369                 CanvasManager canvasManager3 = CanvasManager.getCanvasManager();
370                 canvasManager3.clickOnCanvaElement(serviceSourceElement);
371                 ServiceVerificator.verifyResourceInstanceVersionUI("1.0");
372         }
373
374
375
376
377
378
379
380         private CanvasManager createCanvasManager(Service service1) throws Exception {
381                 GeneralUIUtils.findComponentAndClick(service1.getName());
382                 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
383                 return CanvasManager.getCanvasManager();
384         }
385
386         private void certifyServiceInUI(Service service1) throws Exception {
387                 getExtendTest().log(Status.INFO, "Certify Service");
388                 ServiceGeneralPage.clickSubmitForTestingButton(service1.getName());
389                 reloginWithNewRole(UserRoleEnum.TESTER);
390                 GeneralUIUtils.findComponentAndClick(service1.getName());
391                 TesterOperationPage.certifyComponent(service1.getName());
392                 reloginWithNewRole(UserRoleEnum.DESIGNER);
393         }
394
395         private Service createService() throws Exception {
396                 ServiceReqDetails serviceReqDetails1 = OnboardingUtillViaApis.prepareServiceDetailsBeforeCreate(sdncDesignerDetails);
397                 getExtendTest().log(Status.INFO, "Create Service " + serviceReqDetails1.getName() );
398                 return AtomicOperationUtils.createCustomService(serviceReqDetails1, UserRoleEnum.DESIGNER, true).left().value();
399         }
400
401         private ResourceReqDetails createPnfAndCertify() throws Exception {
402                 ResourceReqDetails pnfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.PNF, getUser());
403                 ResourceUIUtils.createPNF(pnfMetaData, getUser());
404                 ResourceGeneralPage.clickCertifyButton(pnfMetaData.getName());
405                 return pnfMetaData;
406         }
407
408         private Resource createAndCertifyVFfromVSP(String vnfFile) throws Exception {
409                 String filePath = FileHandling.getPortMirroringRepositoryPath();
410                 getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile);
411                 AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(getUser());
412                 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
413                 VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null);
414                 resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject);
415                 Resource vfResource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails);
416                 vfResource = (Resource) AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
417                 return vfResource;
418         }
419
420         private ResourceReqDetails createCRAndCertify() throws Exception {
421                 ResourceReqDetails crMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.CR, getUser());
422                 ResourceUIUtils.createCR(crMetaData, getUser());
423                 ResourceGeneralPage.clickCertifyButton(crMetaData.getName());
424                 return crMetaData;
425         }
426
427         private ResourceReqDetails createVFviaAPI(ResourceCategoryEnum resourceCategory) {
428                 ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, resourceCategory, getUser());
429                 SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating VF %s", vfMetaData.getName()));
430                 AtomicOperationUtils.createResourceByResourceDetails(vfMetaData, UserRoleEnum.DESIGNER, true).left().value();
431                 return vfMetaData;
432         }
433         @Override
434         protected UserRoleEnum getRole() {
435                 return UserRoleEnum.DESIGNER;
436         }
437
438 }