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