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.ci.tests.datatypes.*;
28 import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
29 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
30 import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
31 import org.openecomp.sdc.ci.tests.pages.CompositionPage;
32 import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
33 import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage;
34 import org.openecomp.sdc.ci.tests.utilities.CatalogUIUtilitis;
35 import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
36 import org.openecomp.sdc.ci.tests.utilities.HomeUtils;
37 import org.openecomp.sdc.ci.tests.utilities.PortMirroringUtils;
38 import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
39 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
40 import org.openecomp.sdc.ci.tests.utils.general.FileHandling;
41 import org.openecomp.sdc.ci.tests.verificator.PortMirroringVerificator;
42 import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator;
43 import org.testng.AssertJUnit;
44 import org.testng.annotations.Test;
48 import static org.testng.Assert.assertTrue;
50 public class PortMirroring extends SetupCDTest {
53 public void createPortMirroringConfigurationServiceProxy() throws Throwable {
54 PortMirrioringConfigurationObject portMirrioringConfigurationObject = PortMirroringUtils.createPortMirriongConfigurationStructure(false);
55 ServiceReqDetails serviceReqDetails = portMirrioringConfigurationObject.getServiceReqDetails();
56 CanvasManager canvasManager = portMirrioringConfigurationObject.getCanvasManager();
57 CanvasElement serviceElementVmmeSourceName = portMirrioringConfigurationObject.getServiceElementVmmeSourceName();
58 String vmmeSourceName = portMirrioringConfigurationObject.getVmmeSourceName();
59 CanvasElement serviceElementVprobeCollector = portMirrioringConfigurationObject.getServiceElementVprobeCollector();
60 String vprobeSourceName = portMirrioringConfigurationObject.getVprobeSourceName();
62 serviceReqDetails.setVersion("0.1");
63 getExtendTest().log(Status.INFO, "Validating links between elements were created");
64 ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 2);
66 canvasManager.clickOnCanvaElement(serviceElementVmmeSourceName);
67 PortMirroringVerificator.validatingProxyServiceNameAndType(vmmeSourceName, "0");
69 canvasManager.clickOnCanvaElement(serviceElementVprobeCollector);
70 PortMirroringVerificator.validatingProxyServiceNameAndType(vprobeSourceName, "0");
74 public void distributePortMirroringConfigurationServiceProxy() throws Throwable {
75 PortMirrioringConfigurationObject portMirrioringConfigurationObject = PortMirroringUtils.createPortMirriongConfigurationStructure(false);
76 ServiceReqDetails serviceReqDetails = portMirrioringConfigurationObject.getServiceReqDetails();
77 Service service = portMirrioringConfigurationObject.getService();
79 serviceReqDetails.setVersion("0.1");
80 getExtendTest().log(Status.INFO, "Validating links between elements were created");
81 ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 2);
83 getExtendTest().log(Status.INFO, String.format("Going to certify the Service"));
84 service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
85 getExtendTest().log(Status.INFO, String.format("Service is certified"));
86 Boolean distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service);
87 getExtendTest().log(Status.INFO, String.format("Distribute and validate the Service"));
88 AssertJUnit.assertTrue("Distribution status is " + distributeAndValidateService, distributeAndValidateService);
92 public void createPortMirroringByPolicyServiceProxy() throws Throwable {
93 //Using API onboard and certify 2 zip files Source: vmmme and Collector: Vprobe
94 String filePath = FileHandling.getPortMirroringRepositoryPath();
95 ServiceContainer serviceContainerVmme_Source = PortMirroringUtils.createServiceFromHeatFile(filePath, "2016-227_vmme_vmme_30_1610_e2e.zip");
97 // create service with required pnf's and certify it
98 Resource resourceCisco = PortMirroringUtils.GeneratePNFAndUpdateInput(PortMirroringEnum.CISCO_VENDOR_NAME.getValue(), PortMirroringEnum.CISCO_VENDOR_MODEL_NUMBER.getValue(), getUser());
99 Resource resourceAPCON1 = PortMirroringUtils.GeneratePNFAndUpdateInput(PortMirroringEnum.APCON1_VENDOR_NAME.getValue(), PortMirroringEnum.APCON1_VENDOR_MODEL_NUMBER.getValue(), getUser());
100 Resource resourceAPCON2 = PortMirroringUtils.GeneratePNFAndUpdateInput(PortMirroringEnum.APCON2_VENDOR_NAME.getValue(), PortMirroringEnum.APCON2_VENDOR_MODEL_NUMBER.getValue(), getUser());
102 ServiceReqDetails serviceReqDetailsCollector = ElementFactory.getDefaultService();
103 serviceReqDetailsCollector.setServiceType(PortMirroringEnum.SERVICE_TYPE.getValue());
104 getExtendTest().log(Status.INFO, String.format("Creating collector service %s (PNF container)", serviceReqDetailsCollector.getName()));
105 Service serviceCollector = AtomicOperationUtils.createCustomService(serviceReqDetailsCollector, UserRoleEnum.DESIGNER, true).left().value();
107 getExtendTest().log(Status.INFO, String.format("Adding pnf's: %s,%s,%s to service %s", resourceCisco.getName(), resourceAPCON1.getName(), resourceAPCON2.getName(), serviceCollector.getName()));
109 AtomicOperationUtils.addComponentInstanceToComponentContainer(resourceCisco, serviceCollector, UserRoleEnum.DESIGNER, true, "80", "80");
110 AtomicOperationUtils.addComponentInstanceToComponentContainer(resourceAPCON1, serviceCollector, UserRoleEnum.DESIGNER, true, "80", "200");
111 AtomicOperationUtils.addComponentInstanceToComponentContainer(resourceAPCON2, serviceCollector, UserRoleEnum.DESIGNER, true, "200", "200");
113 serviceCollector = (Service) AtomicOperationUtils.changeComponentState(serviceCollector, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
115 // create container service
116 ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
117 getExtendTest().log(Status.INFO, String.format("Creating container service %s", serviceReqDetails.getName()));
118 Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
120 String vmmeSourceName = serviceContainerVmme_Source.getService().getName();
121 String collectorServiceName = serviceCollector.getName();
123 CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
124 GeneralUIUtils.findComponentAndClick(service.getName());
126 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
127 CanvasManager canvasManager = CanvasManager.getCanvasManager();
129 CompositionPage.searchForElement(vmmeSourceName);
130 CanvasElement serviceElementVmmeSource = canvasManager.createElementOnCanvas(vmmeSourceName);
132 CompositionPage.searchForElement(collectorServiceName);
133 CanvasElement serviceElementCollectorService = canvasManager.createElementOnCanvas(collectorServiceName);
135 CompositionPage.searchForElement(PortMirroringEnum.PMCP_ELEMENT_IN_PALLETE.getValue());
136 CanvasElement portMirroringConfigurationByPolicyElement = canvasManager.createElementOnCanvas(PortMirroringEnum.PMCP_ELEMENT_IN_PALLETE.getValue());
138 ConnectionWizardPopUpObject connectionWizardPopUpObjectVMME = new ConnectionWizardPopUpObject("",
140 PortMirroringEnum.PM_REQ_TYPE.getValue(),
141 PortMirroringEnum.PMCP_SOURCE_CAP.getValue());
143 canvasManager.linkElementsAndSelectCapReqTypeAndCapReqName(serviceElementVmmeSource,
144 portMirroringConfigurationByPolicyElement,
145 connectionWizardPopUpObjectVMME);
147 serviceReqDetails.setVersion("0.1");
148 getExtendTest().log(Status.INFO, "Validating link between elements was created");
149 ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 1);
151 canvasManager.clickOnCanvaElement(serviceElementVmmeSource);
152 PortMirroringVerificator.validatingProxyServiceNameAndType(vmmeSourceName, "0");
154 getExtendTest().log(Status.INFO, "Adding properties to PMCP");
157 // throw new SkipException("Open bug 373762, can't update properties on CP or VFC instance on Composition screen");
158 SetupCDTest.getExtendTest().log(Status.INFO, "Open bug 373762, can't update properties on CP or VFC instance on Composition screen");
161 canvasManager.clickOnCanvaElement(portMirroringConfigurationByPolicyElement);
162 CompositionPage.showPropertiesAndAttributesTab();
163 CompositionPage.setSingleProperty(DataTestIdEnum.PortMirroring.COLLECTOR_NODE.getValue(), PortMirroringUtils.createProxyInstanceServiceName(collectorServiceName, "1"));
164 CompositionPage.setSingleProperty(DataTestIdEnum.PortMirroring.EQUIP_MODEL.getValue(), PortMirroringEnum.CISCO_VENDOR_MODEL_NUMBER.getValue());
165 CompositionPage.setSingleProperty(DataTestIdEnum.PortMirroring.EQUIP_VENDOR.getValue(), PortMirroringEnum.CISCO_VENDOR_NAME.getValue());
167 // Distribute the Port Mirroning Configuration By Policy
168 getExtendTest().log(Status.INFO, String.format("Going to certify the Service"));
169 service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
170 getExtendTest().log(Status.INFO, String.format("Service is certified"));
171 Boolean distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service);
172 getExtendTest().log(Status.INFO, String.format("Distribute and validate the Service"));
173 AssertJUnit.assertTrue("Distribution status is " + distributeAndValidateService, distributeAndValidateService);
177 public void deletePMCPLink() throws Throwable {
178 ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
179 getExtendTest().log(Status.INFO, String.format("Creating container service %s", serviceReqDetails.getName()));
180 Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
182 String filePath = FileHandling.getPortMirroringRepositoryPath();
183 ServiceContainer serviceContainerVmme_Source = PortMirroringUtils.createServiceFromHeatFile(filePath, "2016-227_vmme_vmme_30_1610_e2e.zip");
185 String vmmeSourceName = serviceContainerVmme_Source.getService().getName();
187 CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
188 GeneralUIUtils.findComponentAndClick(service.getName());
190 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
191 CanvasManager canvasManager = CanvasManager.getCanvasManager();
193 CompositionPage.searchForElement(vmmeSourceName);
194 CanvasElement serviceElementVmmeSource = canvasManager.createElementOnCanvas(vmmeSourceName);
196 CompositionPage.searchForElement(PortMirroringEnum.PMCP_ELEMENT_IN_PALLETE.getValue());
197 CanvasElement portMirroringConfigurationByPolicyElement = canvasManager.createElementOnCanvas(PortMirroringEnum.PMCP_ELEMENT_IN_PALLETE.getValue());
199 ConnectionWizardPopUpObject connectionWizardPopUpObjectVMME = new ConnectionWizardPopUpObject("",
201 PortMirroringEnum.PM_REQ_TYPE.getValue(),
202 PortMirroringEnum.PMCP_SOURCE_CAP.getValue());
204 canvasManager.linkElementsAndSelectCapReqTypeAndCapReqName(serviceElementVmmeSource,
205 portMirroringConfigurationByPolicyElement,
206 connectionWizardPopUpObjectVMME);
208 serviceReqDetails.setVersion("0.1");
209 getExtendTest().log(Status.INFO, "Validating link between elements was created");
210 ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 1);
212 canvasManager.openLinkPopupReqsCapsConnection(serviceElementVmmeSource, portMirroringConfigurationByPolicyElement);
213 canvasManager.closeLinkPopupReqsCapsConnection();
214 canvasManager.deleteLinkPopupReqsCapsConnection(serviceElementVmmeSource, portMirroringConfigurationByPolicyElement);
216 getExtendTest().log(Status.INFO, "Validating link deleted");
217 ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 0);
221 public void verifyPMCNotExistInVF() throws Exception {
222 Resource resource = PortMirroringUtils.getResourceByType(ResourceTypeEnum.VF, "VF", "VendorModel");
224 CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
226 GeneralUIUtils.findComponentAndClick(resource.getName());
227 ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
229 CompositionPage.searchForElement(PortMirroringEnum.PMC_ELEMENT_IN_PALLETE.getValue());
231 getExtendTest().log(Status.INFO, "Verify that Port Mirroring Configuration and Configuration by Policy doesn't exist for VF ");
232 boolean isPMCFound = GeneralUIUtils.isElementInvisibleByTestId(DataTestIdEnum.PortMirroring.PMC_NAME_IN_PALLETE.getValue());
233 boolean isPMCPFound = GeneralUIUtils.isElementInvisibleByTestId(DataTestIdEnum.PortMirroring.PMCP_NAME_IN_PALLETE.getValue());
235 assertTrue(isPMCFound);
236 assertTrue(isPMCPFound);
240 public void verifyPMCPTabs() throws Exception {
242 ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
243 getExtendTest().log(Status.INFO, String.format("Creating container service %s", serviceReqDetails.getName()));
244 Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
246 CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
247 GeneralUIUtils.findComponentAndClick(service.getName());
249 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
250 CanvasManager canvasManager = CanvasManager.getCanvasManager();
252 CompositionPage.searchForElement(PortMirroringEnum.PMCP_ELEMENT_IN_PALLETE.getValue());
253 CanvasElement portMirroringConfigurationByPolicyElement = canvasManager.createElementOnCanvas(PortMirroringEnum.PMCP_ELEMENT_IN_PALLETE.getValue());
254 canvasManager.clickOnCanvaElement(portMirroringConfigurationByPolicyElement);
256 PortMirroringVerificator.validateGeneralInfo();
257 PortMirroringVerificator.validateReqsAndCapsTabExist();
262 public void editPMCPName() throws Exception {
264 ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
265 getExtendTest().log(Status.INFO, String.format("Creating container service %s", serviceReqDetails.getName()));
266 Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
268 CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
269 GeneralUIUtils.findComponentAndClick(service.getName());
271 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
272 CanvasManager canvasManager = CanvasManager.getCanvasManager();
274 CompositionPage.searchForElement(PortMirroringEnum.PMCP_ELEMENT_IN_PALLETE.getValue());
275 CanvasElement portMirroringConfigurationByPolicyElement = canvasManager.createElementOnCanvas(PortMirroringEnum.PMCP_ELEMENT_IN_PALLETE.getValue());
277 canvasManager.clickOnCanvaElement(portMirroringConfigurationByPolicyElement);
279 getExtendTest().log(Status.INFO, "Edit PMCP Name");
280 // GeneralUIUtils.clickOnElementById(DataTestIdEnum.CompositionRightPanel.EDIT_PENCIL.getValue());
281 // GeneralUIUtils.setTextInElementByDataTestID(DataTestIdEnum.CompositionRightPanel.INSTANCE_NAME_TEXTBOX.getValue(), PortMirroringEnum.PMCP_NEWNAME.getValue());
282 // GeneralUIUtils.clickOnElementByTestId("OK");
283 canvasManager.updateElementNameInCanvas(portMirroringConfigurationByPolicyElement,PortMirroringEnum.PMCP_NEWNAME.getValue());
285 PortMirroringVerificator.validateElementName(PortMirroringEnum.PMCP_NEWNAME.getValue());
290 public void deletePMCP() throws Exception {
292 ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
293 getExtendTest().log(Status.INFO, String.format("Creating container service %s", serviceReqDetails.getName()));
294 Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
296 CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
297 GeneralUIUtils.findComponentAndClick(service.getName());
299 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
300 CanvasManager canvasManager = CanvasManager.getCanvasManager();
302 CompositionPage.searchForElement(PortMirroringEnum.PMCP_ELEMENT_IN_PALLETE.getValue());
303 CanvasElement portMirroringConfigurationByPolicyElement = canvasManager.createElementOnCanvas(PortMirroringEnum.PMCP_ELEMENT_IN_PALLETE.getValue());
305 canvasManager.clickOnCanvaElement(portMirroringConfigurationByPolicyElement);
307 getExtendTest().log(Status.INFO, String.format("Delete element %s", portMirroringConfigurationByPolicyElement.getElementType()));
308 // GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.CompositionRightPanel.DELETE_ITEM.getValue());
309 // GeneralUIUtils.clickOnElementByTestId("OK");
310 canvasManager.deleteElementFromCanvas(portMirroringConfigurationByPolicyElement);
312 PortMirroringVerificator.validateElementName(service.getName());
316 public void createPortMirroringConfigurationMulipleInstances() throws Throwable {
317 PortMirrioringConfigurationObject portMirrioringConfigurationObject = PortMirroringUtils.createPortMirriongConfigurationStructure(false);
318 ServiceReqDetails serviceReqDetails = portMirrioringConfigurationObject.getServiceReqDetails();
319 CanvasElement serviceElementVmmeSourceName = portMirrioringConfigurationObject.getServiceElementVmmeSourceName();
321 serviceReqDetails.setVersion("0.1");
322 getExtendTest().log(Status.INFO, "Validating 2 links between elements were created");
323 ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 2);
325 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
326 GeneralUIUtils.ultimateWait();
327 GeneralUIUtils.findComponentAndClick(serviceReqDetails.getName());
329 getExtendTest().log(Status.INFO, "Adding second PMC to composition");
330 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
332 CanvasManager canvasManager = CanvasManager.getCanvasManager();
333 CompositionPage.searchForElement(PortMirroringEnum.PMC_ELEMENT_IN_PALLETE.getValue());
334 CanvasElement portMirroringConfigurationElement = canvasManager.createElementOnCanvas(PortMirroringEnum.PMC_ELEMENT_IN_PALLETE.getValue());
336 // ConnectionWizardPopUpObject connectionWizardPopUpObjectVMME = new ConnectionWizardPopUpObject("", "",
337 // PortMirroringEnum.PM_REQ_TYPE.getValue(), PortMirroringEnum.PMC1_SOURCE_CAP.getValue());
339 ConnectionWizardPopUpObject connectionWizardPopUpObjectVMME = new ConnectionWizardPopUpObject("", "",
340 PortMirroringEnum.PM_REQ_TYPE.getValue(), PortMirroringEnum.PMC_SOURCE_CAP.getValue());
342 getExtendTest().log(Status.INFO, "Connect VMME to PMC again");
343 canvasManager.linkElementsAndSelectCapReqTypeAndCapReqName(serviceElementVmmeSourceName,portMirroringConfigurationElement,
344 connectionWizardPopUpObjectVMME);
346 getExtendTest().log(Status.INFO, "Connect VMME to PMC again");
347 canvasManager.linkElementsAndSelectCapReqTypeAndCapReqName(serviceElementVmmeSourceName, portMirroringConfigurationElement,
348 connectionWizardPopUpObjectVMME);
350 getExtendTest().log(Status.INFO, "Validating 4 links between elements exist");
351 ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 4);
353 getExtendTest().log(Status.INFO, "Adding second PMCP to composition");
354 CompositionPage.searchForElement(PortMirroringEnum.PMCP_ELEMENT_IN_PALLETE.getValue());
355 CanvasElement portMirroringConfigurationByPolicyElement = canvasManager.createElementOnCanvas(PortMirroringEnum.PMCP_ELEMENT_IN_PALLETE.getValue());
357 ConnectionWizardPopUpObject connectionWizardPopUpObjectVMME_PMCP = new ConnectionWizardPopUpObject("",
359 PortMirroringEnum.PM_REQ_TYPE.getValue(),
360 PortMirroringEnum.PMCP_SOURCE_CAP.getValue());
362 getExtendTest().log(Status.INFO, "Connect VMME to PMCP again");
363 canvasManager.linkElementsAndSelectCapReqTypeAndCapReqName(serviceElementVmmeSourceName, portMirroringConfigurationByPolicyElement,
364 connectionWizardPopUpObjectVMME_PMCP);
366 getExtendTest().log(Status.INFO, "Connect VMME to PMCP again");
367 canvasManager.linkElementsAndSelectCapReqTypeAndCapReqName(serviceElementVmmeSourceName, portMirroringConfigurationByPolicyElement,
368 connectionWizardPopUpObjectVMME_PMCP);
370 serviceReqDetails.setVersion("0.1");
371 getExtendTest().log(Status.INFO, "Validating 6 links between elements exist");
372 ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 6);
376 public void downloadArtifactFromPMCService() throws Throwable {
377 //Scenario of bug 362271
378 PortMirrioringConfigurationObject portMirrioringConfigurationObject = PortMirroringUtils.createPortMirriongConfigurationStructure(false);
379 ServiceReqDetails serviceReqDetails = portMirrioringConfigurationObject.getServiceReqDetails();
381 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
382 GeneralUIUtils.ultimateWait();
383 GeneralUIUtils.findComponentAndClick(serviceReqDetails.getName());
385 ServiceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen();
387 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ToscaArtifactsScreenEnum.TOSCA_MODEL.getValue());
388 File latestFilefromDir = org.openecomp.sdc.ci.tests.utilities.FileHandling.getLastModifiedFileNameFromDir();
389 String actualToscaModelFilename = latestFilefromDir.getName();
391 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ToscaArtifactsScreenEnum.TOSCA_TEMPLATE.getValue());
392 latestFilefromDir = org.openecomp.sdc.ci.tests.utilities.FileHandling.getLastModifiedFileNameFromDir();
393 String actualToscaTemplateFilename = latestFilefromDir.getName();
395 String expectedToscaModelFilename = String.format("service-%s-csar.csar", serviceReqDetails.getName());
396 String expectedToscaTemplateFilename = String.format("service-%s-template.yml", serviceReqDetails.getName());
398 getExtendTest().log(Status.INFO, "Validating tosca artifact downloaded successfully");
399 AssertJUnit.assertTrue(actualToscaModelFilename.equalsIgnoreCase(expectedToscaModelFilename));
400 AssertJUnit.assertTrue(actualToscaTemplateFilename.equalsIgnoreCase(expectedToscaTemplateFilename));
404 public void checkoutMirroringConfigurationServiceProxyAndDeletePMC() throws Throwable {
405 PortMirrioringConfigurationObject portMirrioringConfigurationObject = PortMirroringUtils.createPortMirriongConfigurationStructure(false);
406 ServiceReqDetails serviceReqDetails = portMirrioringConfigurationObject.getServiceReqDetails();
407 Service service = portMirrioringConfigurationObject.getService();
408 CanvasElement portMirroringConfigurationElement = portMirrioringConfigurationObject.getPortMirroringConfigurationElement();
410 serviceReqDetails.setVersion("0.1");
411 getExtendTest().log(Status.INFO, "Validating links between elements were created");
412 ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 2);
414 getExtendTest().log(Status.INFO, String.format("Going to certify the Service"));
415 service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
417 getExtendTest().log(Status.INFO, String.format("Checkout Port Mirroring Service"));
418 service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft();
420 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
421 GeneralUIUtils.ultimateWait();
422 HomeUtils.findComponentAndClickByVersion(service.getName(), "1.1");
424 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
425 CanvasManager canvasManager = CanvasManager.getCanvasManager();
426 GeneralUIUtils.ultimateWait();
427 // canvasManager.clickOnCanvasPosition(portMirroringConfigurationElement.getLocation().getLeft(), portMirroringConfigurationElement.getLocation().getRight());
428 canvasManager.clickOnCanvaElement(portMirroringConfigurationElement);
429 getExtendTest().log(Status.INFO, String.format("Delete element %s", portMirroringConfigurationElement.getElementType()));
430 // GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.CompositionRightPanel.DELETE_ITEM.getValue());
431 // GeneralUIUtils.clickOnElementByTestId("OK");
432 canvasManager.deleteElementFromCanvas(portMirroringConfigurationElement);
434 PortMirroringVerificator.validateElementName(service.getName());
435 getExtendTest().log(Status.INFO, "Validating 0 links after delete the port mirroring element");
436 serviceReqDetails.setVersion("1.1");
437 ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 0);
439 getExtendTest().log(Status.INFO, String.format("Going to certify the Service"));
440 service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
442 getExtendTest().log(Status.INFO, String.format("Service is certified"));
443 Boolean distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service);
444 getExtendTest().log(Status.INFO, String.format("Distribute and validate the Service"));
445 AssertJUnit.assertTrue("Distribution status is " + distributeAndValidateService, distributeAndValidateService);
449 public void updatePortMirroringServiceInstance() throws Throwable {
451 PortMirrioringConfigurationObject portMirrioringConfigurationObject = PortMirroringUtils.createPortMirriongConfigurationStructure(false);
452 Service service = portMirrioringConfigurationObject.getService();
453 CanvasElement vmmeCanvasElement = portMirrioringConfigurationObject.getServiceElementVmmeSourceName();
455 getExtendTest().log(Status.INFO, String.format("Going to certify the Service"));
456 service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
458 Service serviceContainerVmme_Source = portMirrioringConfigurationObject.getServiceContainerVmme_Source();
459 getExtendTest().log(Status.INFO, String.format("Checkout the vmme Service"));
460 serviceContainerVmme_Source = (Service) AtomicOperationUtils.changeComponentState(serviceContainerVmme_Source, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft();
461 getExtendTest().log(Status.INFO, String.format("Going to certify the vmme Service"));
462 serviceContainerVmme_Source = (Service) AtomicOperationUtils.changeComponentState(serviceContainerVmme_Source, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
464 getExtendTest().log(Status.INFO, String.format("Checkout Port Mirroring Service"));
465 service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft();
467 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
468 GeneralUIUtils.ultimateWait();
469 HomeUtils.findComponentAndClickByVersion(service.getName(), "1.1");
471 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
472 CanvasManager canvasManager = CanvasManager.getCanvasManager();
474 getExtendTest().log(Status.INFO, String.format("Change vmme source %s instance to version 2.0", serviceContainerVmme_Source.getName()));
475 CompositionPage.changeComponentVersion(canvasManager, vmmeCanvasElement, "2.0",false);
477 getExtendTest().log(Status.INFO, String.format("Going to certify the Service"));
478 service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
480 getExtendTest().log(Status.INFO, String.format("Service is certified"));
481 Boolean distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service);
482 getExtendTest().log(Status.INFO, String.format("Distribute and validate the Service"));
483 AssertJUnit.assertTrue("Distribution status is " + distributeAndValidateService, distributeAndValidateService);
487 public void updateLinkPropertiesPortMirroringService() throws Throwable {
489 ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
490 getExtendTest().log(Status.INFO, String.format("Creating container service %s", serviceReqDetails.getName()));
491 Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
493 String filePath = FileHandling.getPortMirroringRepositoryPath();
494 ServiceContainer serviceContainerVmme_Source = PortMirroringUtils.createServiceFromHeatFile(filePath, "2016-227_vmme_vmme_30_1610_e2e.zip");
496 String vmmeSourceName = serviceContainerVmme_Source.getService().getName();
498 CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
499 GeneralUIUtils.findComponentAndClick(service.getName());
501 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
502 CanvasManager canvasManager = CanvasManager.getCanvasManager();
504 CompositionPage.searchForElement(vmmeSourceName);
505 CanvasElement serviceElementVmmeSource = canvasManager.createElementOnCanvas(vmmeSourceName);
507 CompositionPage.searchForElement(PortMirroringEnum.PMCP_ELEMENT_IN_PALLETE.getValue());
508 CanvasElement portMirroringConfigurationByPolicyElement = canvasManager.createElementOnCanvas(PortMirroringEnum.PMCP_ELEMENT_IN_PALLETE.getValue());
510 ConnectionWizardPopUpObject connectionWizardPopUpObjectVMME = new ConnectionWizardPopUpObject("",
512 PortMirroringEnum.PM_REQ_TYPE.getValue(),
513 PortMirroringEnum.PMCP_SOURCE_CAP.getValue());
515 canvasManager.linkElementsAndSelectCapReqTypeAndCapReqName(serviceElementVmmeSource,
516 portMirroringConfigurationByPolicyElement,
517 connectionWizardPopUpObjectVMME);
519 serviceReqDetails.setVersion("0.1");
520 getExtendTest().log(Status.INFO, "Validating link between elements was created");
521 ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 1);
523 canvasManager.openLinkPopupReqsCapsConnection(serviceElementVmmeSource, portMirroringConfigurationByPolicyElement);
525 getExtendTest().log(Status.INFO, "Fill link properties with data");
526 GeneralUIUtils.setTextInElementByXpath(PortMirroringEnum.NETWORK_ROLE_XPATH.getValue(),PortMirroringEnum.NETWORK_ROLE_VALUE.getValue());
527 GeneralUIUtils.setTextInElementByXpath(PortMirroringEnum.NFC_TYPE_XPATH.getValue(),PortMirroringEnum.NFC_TYPE_VALUE.getValue());
528 GeneralUIUtils.setTextInElementByXpath(PortMirroringEnum.PPS_CAPACITY_XPATH.getValue(),PortMirroringEnum.PPS_CAPACITY_VALUE.getValue());
529 GeneralUIUtils.setTextInElementByXpath(PortMirroringEnum.NF_TYPE_XPATH.getValue(),PortMirroringEnum.NF_TYPE_VALUE.getValue());
530 GeneralUIUtils.ultimateWait();
533 // throw new SkipException("Open bug 373765, Can't update link property on Port Mirroring connection");
536 canvasManager.clickSaveOnLinkPopup();
537 Thread.sleep(3000); //Temp solution. Don't remove.
538 canvasManager.openLinkPopupReqsCapsConnection(serviceElementVmmeSource, portMirroringConfigurationByPolicyElement);
540 PortMirroringVerificator.validateLinkProperties();
544 public void restorePortMirroringServiceLink() throws Throwable {
546 //Scenario is taken from bug 361475 - Second Scenario
547 PortMirrioringConfigurationObject portMirrioringConfigurationObject = PortMirroringUtils.createPortMirriongConfigurationStructure(false);
548 ServiceReqDetails serviceReqDetails = portMirrioringConfigurationObject.getServiceReqDetails();
549 Service service = portMirrioringConfigurationObject.getService();
550 CanvasElement vmmeCanvasElement = portMirrioringConfigurationObject.getServiceElementVmmeSourceName();
551 Service serviceContainerVmme_Source = portMirrioringConfigurationObject.getServiceContainerVmme_Source();
553 getExtendTest().log(Status.INFO, String.format("Checkout the vmme Service"));
554 serviceContainerVmme_Source = (Service) AtomicOperationUtils.changeComponentState(serviceContainerVmme_Source, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft();
555 getExtendTest().log(Status.INFO, String.format("Going to certify the vmme Service"));
556 serviceContainerVmme_Source = (Service) AtomicOperationUtils.changeComponentState(serviceContainerVmme_Source, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
558 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
559 GeneralUIUtils.ultimateWait();
560 HomeUtils.findComponentAndClick(service.getName());
562 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
563 CanvasManager canvasManager = CanvasManager.getCanvasManager();
565 getExtendTest().log(Status.INFO, String.format("Changing vmme source %s instance to version 2.0", serviceContainerVmme_Source.getName()));
566 CompositionPage.changeComponentVersion(canvasManager, vmmeCanvasElement, "2.0",false);
568 getExtendTest().log(Status.INFO, "Validating 1 link exist after change version to the vmme service (Newer version)");
569 ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 2);
571 getExtendTest().log(Status.INFO, String.format("Changing vmme source %s instance to version 1.0", serviceContainerVmme_Source.getName()));
572 CompositionPage.changeComponentVersion(canvasManager, vmmeCanvasElement, "1.0",false);
574 ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 2);
578 public void restoreServiceVersionOnContainerService() throws Throwable {
579 //Scenario is taken from bug 361475 - First Scenario
580 PortMirrioringConfigurationObject portMirrioringConfigurationObject = PortMirroringUtils.createPortMirriongConfigurationStructure(false);
581 ServiceReqDetails serviceReqDetails = portMirrioringConfigurationObject.getServiceReqDetails();
582 Service service = portMirrioringConfigurationObject.getService();
583 CanvasElement vmmeCanvasElement = portMirrioringConfigurationObject.getServiceElementVmmeSourceName();
584 Service serviceContainerVmme_Source = portMirrioringConfigurationObject.getServiceContainerVmme_Source();
585 Service serviceContainerVprobe_Vprobe_Collector = portMirrioringConfigurationObject.getServiceContainerVprobe_Collector();
586 CanvasElement vprobeCanvasElement = portMirrioringConfigurationObject.getServiceElementVprobeCollector();
589 getExtendTest().log(Status.INFO, String.format("Checkout the vmme Service"));
590 serviceContainerVmme_Source = (Service) AtomicOperationUtils.changeComponentState(serviceContainerVmme_Source, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft();
591 getExtendTest().log(Status.INFO, String.format("Going to certify the vmme Service"));
592 serviceContainerVmme_Source = (Service) AtomicOperationUtils.changeComponentState(serviceContainerVmme_Source, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
594 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
595 GeneralUIUtils.ultimateWait();
596 HomeUtils.findComponentAndClick(service.getName());
598 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
599 CanvasManager canvasManager = CanvasManager.getCanvasManager();
601 // canvasManager.linkElements(vmmeCanvasElement, CircleSize.SERVICE, vprobeCanvasElement, CircleSize.SERVICE);
602 canvasManager.linkElements(vmmeCanvasElement, vprobeCanvasElement);
604 getExtendTest().log(Status.INFO, String.format("Changing vmme source %s instance to version 2.0", serviceContainerVmme_Source.getName()));
605 CompositionPage.changeComponentVersion(canvasManager, vmmeCanvasElement, "2.0",false);
607 getExtendTest().log(Status.INFO, "Validating 1 link exist after change version to the vmme service (Newer version)");
608 ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 3);
610 getExtendTest().log(Status.INFO, String.format("Changing vmme source %s instance to version 1.0", serviceContainerVmme_Source.getName()));
611 CompositionPage.changeComponentVersion(canvasManager, vmmeCanvasElement, "1.0",false);
613 ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 3);
617 protected UserRoleEnum getRole() {
618 return UserRoleEnum.DESIGNER;