1 package org.openecomp.sdc.ci.tests.execute.sanity;
3 import com.aventstack.extentreports.Status;
4 import org.apache.commons.lang3.tuple.ImmutablePair;
5 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
6 import org.openecomp.sdc.be.model.Resource;
7 import org.openecomp.sdc.be.model.Service;
8 import org.openecomp.sdc.ci.tests.datatypes.*;
9 import org.openecomp.sdc.ci.tests.datatypes.enums.CircleSize;
10 import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
11 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
12 import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
13 import org.openecomp.sdc.ci.tests.pages.CompositionPage;
14 import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
15 import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage;
16 import org.openecomp.sdc.ci.tests.utilities.CatalogUIUtilitis;
17 import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
18 import org.openecomp.sdc.ci.tests.utilities.HomeUtils;
19 import org.openecomp.sdc.ci.tests.utilities.PortMirroringUtils;
20 import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
21 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
22 import org.openecomp.sdc.ci.tests.utils.general.FileHandling;
23 import org.openecomp.sdc.ci.tests.verificator.PortMirroringVerificator;
24 import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator;
25 import org.testng.AssertJUnit;
26 import org.testng.SkipException;
27 import org.testng.annotations.Test;
31 import static org.testng.Assert.assertTrue;
33 public class PortMirroring extends SetupCDTest {
36 public void createPortMirroringConfigurationServiceProxy() throws Throwable {
37 PortMirrioringConfigurationObject portMirrioringConfigurationObject = PortMirroringUtils.createPortMirriongConfigurationStructure();
38 ServiceReqDetails serviceReqDetails = portMirrioringConfigurationObject.getServiceReqDetails();
39 CanvasManager canvasManager = portMirrioringConfigurationObject.getCanvasManager();
40 CanvasElement serviceElementVmmeSourceName = portMirrioringConfigurationObject.getServiceElementVmmeSourceName();
41 String vmmeSourceName = portMirrioringConfigurationObject.getVmmeSourceName();
42 CanvasElement serviceElementVprobeCollector = portMirrioringConfigurationObject.getServiceElementVprobeCollector();
43 String vprobeSourceName = portMirrioringConfigurationObject.getVprobeSourceName();
45 serviceReqDetails.setVersion("0.1");
46 getExtendTest().log(Status.INFO, "Validating links between elements were created");
47 ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 2);
49 canvasManager.clickOnCanvaElement(serviceElementVmmeSourceName);
50 PortMirroringVerificator.validatingProxyServiceNameAndType(vmmeSourceName, "0");
52 canvasManager.clickOnCanvaElement(serviceElementVprobeCollector);
53 PortMirroringVerificator.validatingProxyServiceNameAndType(vprobeSourceName, "0");
57 public void distributePortMirroringConfigurationServiceProxy() throws Throwable {
58 PortMirrioringConfigurationObject portMirrioringConfigurationObject = PortMirroringUtils.createPortMirriongConfigurationStructure();
59 ServiceReqDetails serviceReqDetails = portMirrioringConfigurationObject.getServiceReqDetails();
60 Service service = portMirrioringConfigurationObject.getService();
62 serviceReqDetails.setVersion("0.1");
63 getExtendTest().log(Status.INFO, "Validating links between elements were created");
64 ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 2);
66 getExtendTest().log(Status.INFO, String.format("Going to certify the Service"));
67 service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
68 getExtendTest().log(Status.INFO, String.format("Service is certified"));
69 Boolean distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service);
70 getExtendTest().log(Status.INFO, String.format("Distribute and validate the Service"));
71 AssertJUnit.assertTrue("Distribution status is " + distributeAndValidateService, distributeAndValidateService);
75 public void createPortMirroringByPolicyServiceProxy() throws Throwable {
76 //Using API onboard and certify 2 zip files Source: vmmme and Collector: Vprobe
77 String filePath = FileHandling.getPortMirroringRepositoryPath();
78 ServiceContainer serviceContainerVmme_Source = PortMirroringUtils.createServiceFromHeatFile(filePath, "2016-227_vmme_vmme_30_1610_e2e.zip");
80 // create service with required pnf's and certify it
81 Resource resourceCisco = PortMirroringUtils.GeneratePNFAndUpdateInput(PortMirroringEnum.CISCO_VENDOR_NAME.getValue(), PortMirroringEnum.CISCO_VENDOR_MODEL_NUMBER.getValue(), getUser());
82 Resource resourceAPCON1 = PortMirroringUtils.GeneratePNFAndUpdateInput(PortMirroringEnum.APCON1_VENDOR_NAME.getValue(), PortMirroringEnum.APCON1_VENDOR_MODEL_NUMBER.getValue(), getUser());
83 Resource resourceAPCON2 = PortMirroringUtils.GeneratePNFAndUpdateInput(PortMirroringEnum.APCON2_VENDOR_NAME.getValue(), PortMirroringEnum.APCON2_VENDOR_MODEL_NUMBER.getValue(), getUser());
85 ServiceReqDetails serviceReqDetailsCollector = ElementFactory.getDefaultService();
86 serviceReqDetailsCollector.setServiceType(PortMirroringEnum.SERVICE_TYPE.getValue());
87 getExtendTest().log(Status.INFO, String.format("Creating collector service %s (PNF container)", serviceReqDetailsCollector.getName()));
88 Service serviceCollector = AtomicOperationUtils.createCustomService(serviceReqDetailsCollector, UserRoleEnum.DESIGNER, true).left().value();
90 getExtendTest().log(Status.INFO, String.format("Adding pnf's: %s,%s,%s to service %s", resourceCisco.getName(), resourceAPCON1.getName(), resourceAPCON2.getName(), serviceCollector.getName()));
92 AtomicOperationUtils.addComponentInstanceToComponentContainer(resourceCisco, serviceCollector, UserRoleEnum.DESIGNER, true, "80", "80");
93 AtomicOperationUtils.addComponentInstanceToComponentContainer(resourceAPCON1, serviceCollector, UserRoleEnum.DESIGNER, true, "80", "200");
94 AtomicOperationUtils.addComponentInstanceToComponentContainer(resourceAPCON2, serviceCollector, UserRoleEnum.DESIGNER, true, "200", "200");
96 serviceCollector = (Service) AtomicOperationUtils.changeComponentState(serviceCollector, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
98 // create container service
99 ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
100 getExtendTest().log(Status.INFO, String.format("Creating container service %s", serviceReqDetails.getName()));
101 Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
103 String vmmeSourceName = serviceContainerVmme_Source.getService().getName();
104 String collectorServiceName = serviceCollector.getName();
106 CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
107 GeneralUIUtils.findComponentAndClick(service.getName());
109 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
110 CanvasManager canvasManager = CanvasManager.getCanvasManager();
112 CompositionPage.searchForElement(vmmeSourceName);
113 CanvasElement serviceElementVmmeSource = canvasManager.createElementOnCanvas(vmmeSourceName);
115 CompositionPage.searchForElement(collectorServiceName);
116 CanvasElement serviceElementCollectorService = canvasManager.createElementOnCanvas(collectorServiceName);
118 CompositionPage.searchForElement(PortMirroringEnum.PMCP_ELEMENT_IN_PALLETE.getValue());
119 CanvasElement portMirroringConfigurationByPolicyElement = canvasManager.createElementOnCanvas(PortMirroringEnum.PMCP_ELEMENT_IN_PALLETE.getValue());
121 ConnectionWizardPopUpObject connectionWizardPopUpObjectVMME = new ConnectionWizardPopUpObject("",
123 PortMirroringEnum.PM_REQ_TYPE.getValue(),
124 PortMirroringEnum.PMCP_SOURCE_CAP.getValue());
126 canvasManager.linkElementsAndSelectCapReqTypeAndCapReqName(serviceElementVmmeSource,
128 portMirroringConfigurationByPolicyElement,
129 CircleSize.NORMATIVE,
130 connectionWizardPopUpObjectVMME);
132 serviceReqDetails.setVersion("0.1");
133 getExtendTest().log(Status.INFO, "Validating link between elements was created");
134 ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 1);
136 canvasManager.clickOnCanvaElement(serviceElementVmmeSource);
137 PortMirroringVerificator.validatingProxyServiceNameAndType(vmmeSourceName, "0");
139 getExtendTest().log(Status.INFO, "Adding properties to PMCP");
142 throw new SkipException("Open bug 373762, can't update properties on CP or VFC instance on Composition screen");
145 canvasManager.clickOnCanvaElement(portMirroringConfigurationByPolicyElement);
146 CompositionPage.showPropertiesAndAttributesTab();
147 CompositionPage.setSingleProperty(DataTestIdEnum.PortMirroring.COLLECTOR_NODE.getValue(), PortMirroringUtils.createProxyInstanceServiceName(collectorServiceName, "1"));
148 CompositionPage.setSingleProperty(DataTestIdEnum.PortMirroring.EQUIP_MODEL.getValue(), PortMirroringEnum.CISCO_VENDOR_MODEL_NUMBER.getValue());
149 CompositionPage.setSingleProperty(DataTestIdEnum.PortMirroring.EQUIP_VENDOR.getValue(), PortMirroringEnum.CISCO_VENDOR_NAME.getValue());
151 // Distribute the Port Mirroning Configuration By Policy
152 getExtendTest().log(Status.INFO, String.format("Going to certify the Service"));
153 service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
154 getExtendTest().log(Status.INFO, String.format("Service is certified"));
155 Boolean distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service);
156 getExtendTest().log(Status.INFO, String.format("Distribute and validate the Service"));
157 AssertJUnit.assertTrue("Distribution status is " + distributeAndValidateService, distributeAndValidateService);
161 public void deletePMCPLink() throws Throwable {
162 ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
163 getExtendTest().log(Status.INFO, String.format("Creating container service %s", serviceReqDetails.getName()));
164 Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
166 String filePath = FileHandling.getPortMirroringRepositoryPath();
167 ServiceContainer serviceContainerVmme_Source = PortMirroringUtils.createServiceFromHeatFile(filePath, "2016-227_vmme_vmme_30_1610_e2e.zip");
169 String vmmeSourceName = serviceContainerVmme_Source.getService().getName();
171 CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
172 GeneralUIUtils.findComponentAndClick(service.getName());
174 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
175 CanvasManager canvasManager = CanvasManager.getCanvasManager();
177 CompositionPage.searchForElement(vmmeSourceName);
178 CanvasElement serviceElementVmmeSource = canvasManager.createElementOnCanvas(vmmeSourceName);
180 CompositionPage.searchForElement(PortMirroringEnum.PMCP_ELEMENT_IN_PALLETE.getValue());
181 CanvasElement portMirroringConfigurationByPolicyElement = canvasManager.createElementOnCanvas(PortMirroringEnum.PMCP_ELEMENT_IN_PALLETE.getValue());
183 ImmutablePair<Integer, Integer> linkLocation = canvasManager.calcMidOfLink(serviceElementVmmeSource.getLocation(), portMirroringConfigurationByPolicyElement.getLocation());
185 ConnectionWizardPopUpObject connectionWizardPopUpObjectVMME = new ConnectionWizardPopUpObject("",
187 PortMirroringEnum.PM_REQ_TYPE.getValue(),
188 PortMirroringEnum.PMCP_SOURCE_CAP.getValue());
190 canvasManager.linkElementsAndSelectCapReqTypeAndCapReqName(serviceElementVmmeSource,
192 portMirroringConfigurationByPolicyElement,
193 CircleSize.NORMATIVE,
194 connectionWizardPopUpObjectVMME);
196 CanvasElement linkBetweenPMCP_VMME = new CanvasElement("Link", linkLocation);
198 serviceReqDetails.setVersion("0.1");
199 getExtendTest().log(Status.INFO, "Validating link between elements was created");
200 ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 1);
202 canvasManager.openLinkPopupReqsCapsConnection(linkBetweenPMCP_VMME);
203 canvasManager.closeLinkPopupReqsCapsConnection();
204 canvasManager.deleteLinkPopupReqsCapsConnection(linkBetweenPMCP_VMME);
206 getExtendTest().log(Status.INFO, "Validating link deleted");
207 ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 0);
211 public void verifyPMCNotExistInVF() throws Exception {
212 Resource resource = PortMirroringUtils.getResourceByType(ResourceTypeEnum.VF, "VF", "VendorModel");
214 CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
216 GeneralUIUtils.findComponentAndClick(resource.getName());
217 ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
219 CompositionPage.searchForElement(PortMirroringEnum.PMC_ELEMENT_IN_PALLETE.getValue());
221 getExtendTest().log(Status.INFO, "Verify that Port Mirroring Configuration and Configuration by Policy doesn't exist for VF ");
222 boolean isPMCFound = GeneralUIUtils.isElementInvisibleByTestId(DataTestIdEnum.PortMirroring.PMC_NAME_IN_PALLETE.getValue());
223 boolean isPMCPFound = GeneralUIUtils.isElementInvisibleByTestId(DataTestIdEnum.PortMirroring.PMCP_NAME_IN_PALLETE.getValue());
225 assertTrue(isPMCFound);
226 assertTrue(isPMCPFound);
230 public void verifyPMCPTabs() throws Exception {
232 ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
233 getExtendTest().log(Status.INFO, String.format("Creating container service %s", serviceReqDetails.getName()));
234 Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
236 CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
237 GeneralUIUtils.findComponentAndClick(service.getName());
239 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
240 CanvasManager canvasManager = CanvasManager.getCanvasManager();
242 CompositionPage.searchForElement(PortMirroringEnum.PMCP_ELEMENT_IN_PALLETE.getValue());
243 CanvasElement portMirroringConfigurationByPolicyElement = canvasManager.createElementOnCanvas(PortMirroringEnum.PMCP_ELEMENT_IN_PALLETE.getValue());
244 canvasManager.clickOnCanvaElement(portMirroringConfigurationByPolicyElement);
246 PortMirroringVerificator.validateGeneralInfo();
247 PortMirroringVerificator.validateReqsAndCapsTabExist();
252 public void editPMCPName() throws Exception {
254 ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
255 getExtendTest().log(Status.INFO, String.format("Creating container service %s", serviceReqDetails.getName()));
256 Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
258 CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
259 GeneralUIUtils.findComponentAndClick(service.getName());
261 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
262 CanvasManager canvasManager = CanvasManager.getCanvasManager();
264 CompositionPage.searchForElement(PortMirroringEnum.PMCP_ELEMENT_IN_PALLETE.getValue());
265 CanvasElement portMirroringConfigurationByPolicyElement = canvasManager.createElementOnCanvas(PortMirroringEnum.PMCP_ELEMENT_IN_PALLETE.getValue());
267 canvasManager.clickOnCanvaElement(portMirroringConfigurationByPolicyElement);
269 getExtendTest().log(Status.INFO, "Edit PMCP Name");
270 GeneralUIUtils.clickOnElementById(DataTestIdEnum.CompositionRightPanel.EDIT_PENCIL.getValue());
271 GeneralUIUtils.setTextInElementByDataTestID(DataTestIdEnum.CompositionRightPanel.INSTANCE_NAME_TEXTBOX.getValue(), PortMirroringEnum.PMCP_NEWNAME.getValue());
272 GeneralUIUtils.clickOnElementByTestId("OK");
274 PortMirroringVerificator.validateElementName(PortMirroringEnum.PMCP_NEWNAME.getValue());
279 public void deletePMCP() throws Exception {
281 ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
282 getExtendTest().log(Status.INFO, String.format("Creating container service %s", serviceReqDetails.getName()));
283 Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
285 CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
286 GeneralUIUtils.findComponentAndClick(service.getName());
288 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
289 CanvasManager canvasManager = CanvasManager.getCanvasManager();
291 CompositionPage.searchForElement(PortMirroringEnum.PMCP_ELEMENT_IN_PALLETE.getValue());
292 CanvasElement portMirroringConfigurationByPolicyElement = canvasManager.createElementOnCanvas(PortMirroringEnum.PMCP_ELEMENT_IN_PALLETE.getValue());
294 canvasManager.clickOnCanvaElement(portMirroringConfigurationByPolicyElement);
296 getExtendTest().log(Status.INFO, String.format("Delete element %s", portMirroringConfigurationByPolicyElement.getElementType()));
297 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.CompositionRightPanel.DELETE_ITEM.getValue());
298 GeneralUIUtils.clickOnElementByTestId("OK");
300 PortMirroringVerificator.validateElementName(service.getName());
304 public void createPortMirroringConfigurationMulipleInstances() throws Throwable {
305 PortMirrioringConfigurationObject portMirrioringConfigurationObject = PortMirroringUtils.createPortMirriongConfigurationStructure();
306 ServiceReqDetails serviceReqDetails = portMirrioringConfigurationObject.getServiceReqDetails();
307 CanvasElement serviceElementVmmeSourceName = portMirrioringConfigurationObject.getServiceElementVmmeSourceName();
309 serviceReqDetails.setVersion("0.1");
310 getExtendTest().log(Status.INFO, "Validating 2 links between elements were created");
311 ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 2);
313 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
314 GeneralUIUtils.ultimateWait();
315 GeneralUIUtils.findComponentAndClick(serviceReqDetails.getName());
317 getExtendTest().log(Status.INFO, "Adding second PMC to composition");
318 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
320 CanvasManager canvasManager = CanvasManager.getCanvasManager();
321 CompositionPage.searchForElement(PortMirroringEnum.PMC_ELEMENT_IN_PALLETE.getValue());
322 CanvasElement portMirroringConfigurationElement = canvasManager.createElementOnCanvas(PortMirroringEnum.PMC_ELEMENT_IN_PALLETE.getValue());
324 ConnectionWizardPopUpObject connectionWizardPopUpObjectVMME = new ConnectionWizardPopUpObject("", "",
325 PortMirroringEnum.PM_REQ_TYPE.getValue(), PortMirroringEnum.PMC1_SOURCE_CAP.getValue());
327 getExtendTest().log(Status.INFO, "Connect VMME to PMC again");
328 canvasManager.linkElementsAndSelectCapReqTypeAndCapReqName(serviceElementVmmeSourceName, CircleSize.SERVICE, portMirroringConfigurationElement,
329 CircleSize.NORMATIVE, connectionWizardPopUpObjectVMME);
331 getExtendTest().log(Status.INFO, "Connect VMME to PMC again");
332 canvasManager.linkElementsAndSelectCapReqTypeAndCapReqName(serviceElementVmmeSourceName, CircleSize.SERVICE, portMirroringConfigurationElement,
333 CircleSize.NORMATIVE, connectionWizardPopUpObjectVMME);
335 getExtendTest().log(Status.INFO, "Validating 4 links between elements exist");
336 ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 4);
338 getExtendTest().log(Status.INFO, "Adding second PMCP to composition");
339 CompositionPage.searchForElement(PortMirroringEnum.PMCP_ELEMENT_IN_PALLETE.getValue());
340 CanvasElement portMirroringConfigurationByPolicyElement = canvasManager.createElementOnCanvas(PortMirroringEnum.PMCP_ELEMENT_IN_PALLETE.getValue());
342 ConnectionWizardPopUpObject connectionWizardPopUpObjectVMME_PMCP = new ConnectionWizardPopUpObject("",
344 PortMirroringEnum.PM_REQ_TYPE.getValue(),
345 PortMirroringEnum.PMCP_SOURCE_CAP.getValue());
347 getExtendTest().log(Status.INFO, "Connect VMME to PMCP again");
348 canvasManager.linkElementsAndSelectCapReqTypeAndCapReqName(serviceElementVmmeSourceName, CircleSize.SERVICE, portMirroringConfigurationByPolicyElement,
349 CircleSize.NORMATIVE, connectionWizardPopUpObjectVMME_PMCP);
351 getExtendTest().log(Status.INFO, "Connect VMME to PMCP again");
352 canvasManager.linkElementsAndSelectCapReqTypeAndCapReqName(serviceElementVmmeSourceName, CircleSize.SERVICE, portMirroringConfigurationByPolicyElement,
353 CircleSize.NORMATIVE, connectionWizardPopUpObjectVMME_PMCP);
355 serviceReqDetails.setVersion("0.1");
356 getExtendTest().log(Status.INFO, "Validating 6 links between elements exist");
357 ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 6);
361 public void downloadArtifactFromPMCService() throws Throwable {
362 //Scenario of bug 362271
363 PortMirrioringConfigurationObject portMirrioringConfigurationObject = PortMirroringUtils.createPortMirriongConfigurationStructure();
364 ServiceReqDetails serviceReqDetails = portMirrioringConfigurationObject.getServiceReqDetails();
366 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
367 GeneralUIUtils.ultimateWait();
368 GeneralUIUtils.findComponentAndClick(serviceReqDetails.getName());
370 ServiceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen();
372 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ToscaArtifactsScreenEnum.TOSCA_MODEL.getValue());
373 File latestFilefromDir = org.openecomp.sdc.ci.tests.utilities.FileHandling.getLastModifiedFileNameFromDir();
374 String actualToscaModelFilename = latestFilefromDir.getName();
376 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ToscaArtifactsScreenEnum.TOSCA_TEMPLATE.getValue());
377 latestFilefromDir = org.openecomp.sdc.ci.tests.utilities.FileHandling.getLastModifiedFileNameFromDir();
378 String actualToscaTemplateFilename = latestFilefromDir.getName();
380 String expectedToscaModelFilename = String.format("service-%s-csar.csar", serviceReqDetails.getName());
381 String expectedToscaTemplateFilename = String.format("service-%s-template.yml", serviceReqDetails.getName());
383 getExtendTest().log(Status.INFO, "Validating tosca artifact downloaded successfully");
384 AssertJUnit.assertTrue(actualToscaModelFilename.equalsIgnoreCase(expectedToscaModelFilename));
385 AssertJUnit.assertTrue(actualToscaTemplateFilename.equalsIgnoreCase(expectedToscaTemplateFilename));
389 public void checkoutMirroringConfigurationServiceProxyAndDeletePMC() throws Throwable {
390 PortMirrioringConfigurationObject portMirrioringConfigurationObject = PortMirroringUtils.createPortMirriongConfigurationStructure();
391 ServiceReqDetails serviceReqDetails = portMirrioringConfigurationObject.getServiceReqDetails();
392 Service service = portMirrioringConfigurationObject.getService();
393 CanvasElement portMirroringConfigurationElement = portMirrioringConfigurationObject.getPortMirroringConfigurationElement();
395 serviceReqDetails.setVersion("0.1");
396 getExtendTest().log(Status.INFO, "Validating links between elements were created");
397 ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 2);
399 getExtendTest().log(Status.INFO, String.format("Going to certify the Service"));
400 service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
402 getExtendTest().log(Status.INFO, String.format("Checkout Port Mirroring Service"));
403 service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft();
405 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
406 GeneralUIUtils.ultimateWait();
407 HomeUtils.findComponentAndClickByVersion(service.getName(), "1.1");
409 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
410 CanvasManager canvasManager = CanvasManager.getCanvasManager();
411 GeneralUIUtils.ultimateWait();
412 canvasManager.clickOnCanvasPosition(portMirroringConfigurationElement.getLocation().getLeft(), portMirroringConfigurationElement.getLocation().getRight());
413 getExtendTest().log(Status.INFO, String.format("Delete element %s", portMirroringConfigurationElement.getElementType()));
414 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.CompositionRightPanel.DELETE_ITEM.getValue());
415 GeneralUIUtils.clickOnElementByTestId("OK");
417 PortMirroringVerificator.validateElementName(service.getName());
418 getExtendTest().log(Status.INFO, "Validating 0 links after delete the port mirroring element");
419 serviceReqDetails.setVersion("1.1");
420 ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 0);
422 getExtendTest().log(Status.INFO, String.format("Going to certify the Service"));
423 service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
425 getExtendTest().log(Status.INFO, String.format("Service is certified"));
426 Boolean distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service);
427 getExtendTest().log(Status.INFO, String.format("Distribute and validate the Service"));
428 AssertJUnit.assertTrue("Distribution status is " + distributeAndValidateService, distributeAndValidateService);
432 public void updatePortMirroringServiceInstance() throws Throwable {
434 PortMirrioringConfigurationObject portMirrioringConfigurationObject = PortMirroringUtils.createPortMirriongConfigurationStructure();
435 Service service = portMirrioringConfigurationObject.getService();
436 CanvasElement vmmeCanvasElement = portMirrioringConfigurationObject.getServiceElementVmmeSourceName();
438 getExtendTest().log(Status.INFO, String.format("Going to certify the Service"));
439 service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
441 Service serviceContainerVmme_Source = portMirrioringConfigurationObject.getServiceContainerVmme_Source();
442 getExtendTest().log(Status.INFO, String.format("Checkout the vmme Service"));
443 serviceContainerVmme_Source = (Service) AtomicOperationUtils.changeComponentState(serviceContainerVmme_Source, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft();
444 getExtendTest().log(Status.INFO, String.format("Going to certify the vmme Service"));
445 serviceContainerVmme_Source = (Service) AtomicOperationUtils.changeComponentState(serviceContainerVmme_Source, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
447 getExtendTest().log(Status.INFO, String.format("Checkout Port Mirroring Service"));
448 service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft();
450 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
451 GeneralUIUtils.ultimateWait();
452 HomeUtils.findComponentAndClickByVersion(service.getName(), "1.1");
454 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
455 CanvasManager canvasManager = CanvasManager.getCanvasManager();
457 getExtendTest().log(Status.INFO, String.format("Change vmme source %s instance to version 2.0", serviceContainerVmme_Source.getName()));
458 CompositionPage.changeComponentVersion(canvasManager, vmmeCanvasElement, "2.0",false);
460 getExtendTest().log(Status.INFO, String.format("Going to certify the Service"));
461 service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
463 getExtendTest().log(Status.INFO, String.format("Service is certified"));
464 Boolean distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service);
465 getExtendTest().log(Status.INFO, String.format("Distribute and validate the Service"));
466 AssertJUnit.assertTrue("Distribution status is " + distributeAndValidateService, distributeAndValidateService);
470 public void updateLinkPropertiesPortMirroringService() throws Throwable {
472 ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
473 getExtendTest().log(Status.INFO, String.format("Creating container service %s", serviceReqDetails.getName()));
474 Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
476 String filePath = FileHandling.getPortMirroringRepositoryPath();
477 ServiceContainer serviceContainerVmme_Source = PortMirroringUtils.createServiceFromHeatFile(filePath, "2016-227_vmme_vmme_30_1610_e2e.zip");
479 String vmmeSourceName = serviceContainerVmme_Source.getService().getName();
481 CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
482 GeneralUIUtils.findComponentAndClick(service.getName());
484 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
485 CanvasManager canvasManager = CanvasManager.getCanvasManager();
487 CompositionPage.searchForElement(vmmeSourceName);
488 CanvasElement serviceElementVmmeSource = canvasManager.createElementOnCanvas(vmmeSourceName);
490 CompositionPage.searchForElement(PortMirroringEnum.PMCP_ELEMENT_IN_PALLETE.getValue());
491 CanvasElement portMirroringConfigurationByPolicyElement = canvasManager.createElementOnCanvas(PortMirroringEnum.PMCP_ELEMENT_IN_PALLETE.getValue());
493 ImmutablePair<Integer, Integer> linkLocation = canvasManager.calcMidOfLink(serviceElementVmmeSource.getLocation(), portMirroringConfigurationByPolicyElement.getLocation());
495 ConnectionWizardPopUpObject connectionWizardPopUpObjectVMME = new ConnectionWizardPopUpObject("",
497 PortMirroringEnum.PM_REQ_TYPE.getValue(),
498 PortMirroringEnum.PMCP_SOURCE_CAP.getValue());
500 canvasManager.linkElementsAndSelectCapReqTypeAndCapReqName(serviceElementVmmeSource,
502 portMirroringConfigurationByPolicyElement,
503 CircleSize.NORMATIVE,
504 connectionWizardPopUpObjectVMME);
506 CanvasElement linkBetweenPMCP_VMME = new CanvasElement("Link", linkLocation);
508 serviceReqDetails.setVersion("0.1");
509 getExtendTest().log(Status.INFO, "Validating link between elements was created");
510 ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 1);
512 canvasManager.openLinkPopupReqsCapsConnection(linkBetweenPMCP_VMME);
514 getExtendTest().log(Status.INFO, "Fill link properties with data");
515 GeneralUIUtils.setTextInElementByXpath(PortMirroringEnum.NETWORK_ROLE_XPATH.getValue(),PortMirroringEnum.NETWORK_ROLE_VALUE.getValue());
516 GeneralUIUtils.setTextInElementByXpath(PortMirroringEnum.NFC_TYPE_XPATH.getValue(),PortMirroringEnum.NFC_TYPE_VALUE.getValue());
517 GeneralUIUtils.setTextInElementByXpath(PortMirroringEnum.PPS_CAPACITY_XPATH.getValue(),PortMirroringEnum.PPS_CAPACITY_VALUE.getValue());
518 GeneralUIUtils.setTextInElementByXpath(PortMirroringEnum.NF_TYPE_XPATH.getValue(),PortMirroringEnum.NF_TYPE_VALUE.getValue());
519 GeneralUIUtils.ultimateWait();
522 throw new SkipException("Open bug 373765, Can't update link property on Port Mirroring connection");
525 canvasManager.clickSaveOnLinkPopup();
526 Thread.sleep(3000); //Temp solution. Don't remove.
527 canvasManager.openLinkPopupReqsCapsConnection(linkBetweenPMCP_VMME);
529 PortMirroringVerificator.validateLinkProperties();
533 public void restorePortMirroringServiceLink() throws Throwable {
535 //Scenario is taken from bug 361475 - Second Scenario
536 PortMirrioringConfigurationObject portMirrioringConfigurationObject = PortMirroringUtils.createPortMirriongConfigurationStructure();
537 ServiceReqDetails serviceReqDetails = portMirrioringConfigurationObject.getServiceReqDetails();
538 Service service = portMirrioringConfigurationObject.getService();
539 CanvasElement vmmeCanvasElement = portMirrioringConfigurationObject.getServiceElementVmmeSourceName();
540 Service serviceContainerVmme_Source = portMirrioringConfigurationObject.getServiceContainerVmme_Source();
542 getExtendTest().log(Status.INFO, String.format("Checkout the vmme Service"));
543 serviceContainerVmme_Source = (Service) AtomicOperationUtils.changeComponentState(serviceContainerVmme_Source, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft();
544 getExtendTest().log(Status.INFO, String.format("Going to certify the vmme Service"));
545 serviceContainerVmme_Source = (Service) AtomicOperationUtils.changeComponentState(serviceContainerVmme_Source, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
547 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
548 GeneralUIUtils.ultimateWait();
549 HomeUtils.findComponentAndClick(service.getName());
551 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
552 CanvasManager canvasManager = CanvasManager.getCanvasManager();
554 getExtendTest().log(Status.INFO, String.format("Changing vmme source %s instance to version 2.0", serviceContainerVmme_Source.getName()));
555 CompositionPage.changeComponentVersion(canvasManager, vmmeCanvasElement, "2.0",false);
557 getExtendTest().log(Status.INFO, "Validating 1 link exist after change version to the vmme service (Newer version)");
558 ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 2);
560 getExtendTest().log(Status.INFO, String.format("Changing vmme source %s instance to version 1.0", serviceContainerVmme_Source.getName()));
561 CompositionPage.changeComponentVersion(canvasManager, vmmeCanvasElement, "1.0",false);
563 ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 2);
567 public void restoreServiceVersionOnContainerService() throws Throwable {
568 //Scenario is taken from bug 361475 - First Scenario
569 PortMirrioringConfigurationObject portMirrioringConfigurationObject = PortMirroringUtils.createPortMirriongConfigurationStructure();
570 ServiceReqDetails serviceReqDetails = portMirrioringConfigurationObject.getServiceReqDetails();
571 Service service = portMirrioringConfigurationObject.getService();
572 CanvasElement vmmeCanvasElement = portMirrioringConfigurationObject.getServiceElementVmmeSourceName();
573 Service serviceContainerVmme_Source = portMirrioringConfigurationObject.getServiceContainerVmme_Source();
574 Service serviceContainerVprobe_Vprobe_Collector = portMirrioringConfigurationObject.getServiceContainerVprobe_Collector();
575 CanvasElement vprobeCanvasElement = portMirrioringConfigurationObject.getServiceElementVprobeCollector();
578 getExtendTest().log(Status.INFO, String.format("Checkout the vmme Service"));
579 serviceContainerVmme_Source = (Service) AtomicOperationUtils.changeComponentState(serviceContainerVmme_Source, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft();
580 getExtendTest().log(Status.INFO, String.format("Going to certify the vmme Service"));
581 serviceContainerVmme_Source = (Service) AtomicOperationUtils.changeComponentState(serviceContainerVmme_Source, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
583 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
584 GeneralUIUtils.ultimateWait();
585 HomeUtils.findComponentAndClick(service.getName());
587 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
588 CanvasManager canvasManager = CanvasManager.getCanvasManager();
590 canvasManager.linkElements(vmmeCanvasElement, CircleSize.SERVICE, vprobeCanvasElement, CircleSize.SERVICE);
592 getExtendTest().log(Status.INFO, String.format("Changing vmme source %s instance to version 2.0", serviceContainerVmme_Source.getName()));
593 CompositionPage.changeComponentVersion(canvasManager, vmmeCanvasElement, "2.0",false);
595 getExtendTest().log(Status.INFO, "Validating 1 link exist after change version to the vmme service (Newer version)");
596 ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 3);
598 getExtendTest().log(Status.INFO, String.format("Changing vmme source %s instance to version 1.0", serviceContainerVmme_Source.getName()));
599 CompositionPage.changeComponentVersion(canvasManager, vmmeCanvasElement, "1.0",false);
601 ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 3);
605 protected UserRoleEnum getRole() {
606 return UserRoleEnum.DESIGNER;