2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 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.ExtentTest;
24 import com.aventstack.extentreports.Status;
25 import org.openecomp.sdc.be.model.ComponentInstance;
26 import org.openecomp.sdc.be.model.Resource;
27 import org.openecomp.sdc.be.model.Service;
28 import org.openecomp.sdc.ci.tests.data.providers.OnboardingDataProviders;
29 import org.openecomp.sdc.ci.tests.dataProvider.OnbordingDataProviders;
30 import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
31 import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
32 import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
33 import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
34 import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
35 import org.openecomp.sdc.ci.tests.datatypes.VendorLicenseModel;
36 import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject;
37 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
38 import org.openecomp.sdc.ci.tests.datatypes.enums.XnfTypeEnum;
39 import org.openecomp.sdc.ci.tests.execute.setup.DriverFactory;
40 import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
41 import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
42 import org.openecomp.sdc.ci.tests.flow.CheckSoftwareVersionPropertyFlow;
43 import org.openecomp.sdc.ci.tests.flow.CreateResourceFlow;
44 import org.openecomp.sdc.ci.tests.flow.CreateVspFlow;
45 import org.openecomp.sdc.ci.tests.flow.ImportVspFlow;
46 import org.openecomp.sdc.ci.tests.flow.exception.UiTestFlowRuntimeException;
47 import org.openecomp.sdc.ci.tests.pages.CompositionPage;
48 import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
49 import org.openecomp.sdc.ci.tests.pages.GovernorOperationPage;
50 import org.openecomp.sdc.ci.tests.pages.HomePage;
51 import org.openecomp.sdc.ci.tests.pages.OpsOperationPage;
52 import org.openecomp.sdc.ci.tests.pages.ResourceCreatePage;
53 import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
54 import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage;
55 import org.openecomp.sdc.ci.tests.pages.TesterOperationPage;
56 import org.openecomp.sdc.ci.tests.pages.TopNavComponent;
57 import org.openecomp.sdc.ci.tests.pages.VspValidationPage;
58 import org.openecomp.sdc.ci.tests.pages.VspValidationResultsPage;
59 import org.openecomp.sdc.ci.tests.utilities.FileHandling;
60 import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
61 import org.openecomp.sdc.ci.tests.utilities.OnboardingUiUtils;
62 import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
63 import org.openecomp.sdc.ci.tests.utils.Utils;
64 import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
65 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
66 import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils;
67 import org.openecomp.sdc.ci.tests.utils.general.VendorLicenseModelRestUtils;
68 import org.openecomp.sdc.ci.tests.utils.general.VendorSoftwareProductRestUtils;
69 import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator;
70 import org.openqa.selenium.WebDriver;
71 import org.openqa.selenium.WebElement;
72 import org.slf4j.Logger;
73 import org.slf4j.LoggerFactory;
74 import org.testng.AssertJUnit;
75 import org.testng.annotations.BeforeMethod;
76 import org.testng.annotations.Optional;
77 import org.testng.annotations.Parameters;
78 import org.testng.annotations.Test;
81 import java.util.Arrays;
82 import java.util.HashMap;
83 import java.util.List;
85 import java.util.stream.Collectors;
87 import static org.openecomp.sdc.ci.tests.pages.GeneralPageElements.clickOKButton;
88 import static org.testng.AssertJUnit.assertEquals;
89 import static org.testng.AssertJUnit.assertFalse;
90 import static org.testng.AssertJUnit.assertNotNull;
91 import static org.testng.AssertJUnit.assertTrue;
92 import static org.testng.AssertJUnit.fail;
94 public class OnboardingFlowsUi extends SetupCDTest {
96 private static final Logger LOGGER = LoggerFactory.getLogger(OnboardingFlowsUi.class);
97 private static final String NO_TESTS_ARE_AVAILABLE = "No Tests are Available";
98 private static final String NEXT_BUTTON_IS_ENABLED_IT_SHOULD_HAVE_BEEN_ENABLED =
99 "Next Button is enabled, it should have been enabled";
100 private static final String NEXT_BUTTON_IS_DISABLED_IT_SHOULD_HAVE_BEEN_ENABLED =
101 "Next Button is disabled, it should have been enabled";
102 private static final String RESULTS_ARE_NOT_AVAILABLE = "Results are not available";
103 private static final String THE_TESTS_ARE_ALREADY_SELECTED_THE_LIST_SHOULD_INITIALLY_BE_EMPTY =
104 "The tests are already selected, the list should initially be empty";
105 private static final String THE_SELECTED_TESTS_ARE_NOT_POPULATED_IN_THE_LIST =
106 "The selected tests are not populated in the list";
107 private static final String THE_SELECTED_TESTS_ARE_NOT_DELETED_FROM_THE_LIST =
108 "The selected tests are not deleted from the list";
109 private static final String NEXT_BUTTON_IS_ENABLED_IT_SHOULD_HAVE_BEEN_DISABLED =
110 "Next Button is enabled, it should have been disabled";
112 protected static String filePath = FileHandling.getVnfRepositoryPath();
113 private Boolean makeDistributionValue;
115 @Parameters({"makeDistribution"})
117 public void beforeTestReadParams(@Optional("true") String makeDistributionReadValue) {
118 LOGGER.debug("makeDistribution parameter is '{}'", makeDistributionReadValue);
119 makeDistributionValue = Boolean.valueOf(makeDistributionReadValue);
123 public void onboardVNFTestSanityOneFile() throws Exception {
124 String vnfFile = "1-VF-vUSP-vCCF-DB_v11.1.zip";
125 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
126 ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
127 runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, vnfFile);
131 public void performanceTest() throws Exception {
132 LOGGER.debug("Start test");
133 Long actualTestRunTime = Utils.getActionDuration(() -> {
135 onboardVNFTestSanityOneFile();
136 } catch (final Exception e) {
137 LOGGER.debug("An error has occurred during the performance test", e);
140 long regularTestRunTime = 400L;
142 assertTrue("Expected test run time should be less from " + regularTestRunTime * factor + ", actual time is " + actualTestRunTime, regularTestRunTime * factor > actualTestRunTime);
146 public void onboardVNFTestSanity() throws Exception {
147 List<String> fileNamesFromFolder = OnboardingUtils.getXnfNamesFileList(XnfTypeEnum.VNF);
148 String vnfFile = fileNamesFromFolder.get(0);
149 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
150 ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
151 runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, vnfFile);
154 @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Single_VNF")
155 public void onapOnboardVNFflow(String filePath, String vnfFile) throws Exception {
157 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
158 ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
159 runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, vnfFile);
162 @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Single_VNF")
163 public void onapOnboardVSPValidationsSanityFlow(String filePath, String vnfFile) throws Exception {
165 String vspName = createNewVSP(filePath, vnfFile);
166 if (OnboardingUiUtils.getVspValidationCongiguration()) {
167 goToVspScreen(true, vspName);
169 //check links are available
170 checkVspValidationLinksVisibility();
172 VspValidationPage.navigateToVspValidationPageUsingNavbar();
173 assertTrue(NEXT_BUTTON_IS_ENABLED_IT_SHOULD_HAVE_BEEN_DISABLED,
174 VspValidationPage.checkNextButtonDisabled());
175 VspValidationResultsPage.navigateToVspValidationResultsPageUsingNavbar();
176 GeneralUIUtils.ultimateWait();
177 assertNotNull(GeneralUIUtils.findByText("No Test Performed"));
179 goToVspScreen(true, vspName);
181 //check links are not available
182 checkVspValidationLinksInvisibility();
186 @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "softwareInformationPnf")
187 public void onboardPNFSoftwareInformationFlow(final String rootFolder, final String pnfFile,
188 final List<String> softwareVersionList) {
190 final String resourceName = ElementFactory.addRandomSuffixToName(ElementFactory.getResourcePrefix());
191 runOnboardPnfSoftwareVersion(resourceName, rootFolder, pnfFile, softwareVersionList);
194 @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Single_VNF")
195 public void onapOnboardVSPValidationsConfigurationChangeCheck(String filePath, String vnfFile) throws Exception {
197 String vspName = createNewVSP(filePath, vnfFile);
198 if (OnboardingUiUtils.getVspValidationCongiguration()) {
199 goToVspScreen(true, vspName);
200 //check links are available
201 checkVspValidationLinksVisibility();
204 changeVspValidationConfig(false, vspName, OnboardingUiUtils.getVspValidationCongiguration());
206 //check links are not available
207 checkVspValidationLinksInvisibility();
209 goToVspScreen(true, vspName);
210 //check links are not available
211 checkVspValidationLinksInvisibility();
213 changeVspValidationConfig(false, vspName, OnboardingUiUtils.getVspValidationCongiguration());
215 //check links are available
216 checkVspValidationLinksVisibility();
220 @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Single_VNF")
221 public void onapOnboardVSPCertificationQueryFlow(String filePath, String vnfFile) throws Exception {
223 String vspName = createNewVSP(filePath, vnfFile);
224 if (!OnboardingUiUtils.getVspValidationCongiguration()) {
225 //change config to true to test the feature
226 changeVspValidationConfig(true, vspName, OnboardingUiUtils.getVspValidationCongiguration());
228 goToVspScreen(true, vspName);
230 VspValidationPage.navigateToVspValidationPageUsingNavbar();
231 assertTrue(NEXT_BUTTON_IS_ENABLED_IT_SHOULD_HAVE_BEEN_DISABLED, VspValidationPage.checkNextButtonDisabled());
233 if (VspValidationPage.checkCertificationQueryExists()) {
234 VspValidationPage.clickCertificationQueryAll();
235 GeneralUIUtils.ultimateWait();
236 assertTrue(NEXT_BUTTON_IS_DISABLED_IT_SHOULD_HAVE_BEEN_ENABLED,
237 !VspValidationPage.checkNextButtonDisabled());
238 VspValidationPage.clickOnNextButton();
239 GeneralUIUtils.ultimateWait();
240 VspValidationPage.clickOnSubmitButton();
241 GeneralUIUtils.waitForLoader();
242 assertTrue(RESULTS_ARE_NOT_AVAILABLE, VspValidationResultsPage.checkResultsExist());
244 assertNotNull(GeneralUIUtils.findByText("No Certifications Query are Available"));
249 @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "Single_Vsp_Test_Csar")
250 public void onapOnboardVSPComplianceCheckFlow(String filePath, String vnfFile) throws Exception {
252 String vspName = createNewVSP(filePath, vnfFile);
253 if (!OnboardingUiUtils.getVspValidationCongiguration()) {
254 //change config to true to test the feature
255 changeVspValidationConfig(true, vspName, OnboardingUiUtils.getVspValidationCongiguration());
257 goToVspScreen(true, vspName);
260 VspValidationPage.navigateToVspValidationPageUsingNavbar();
261 assertTrue(NEXT_BUTTON_IS_ENABLED_IT_SHOULD_HAVE_BEEN_ENABLED, VspValidationPage.checkNextButtonDisabled());
262 if (VspValidationPage.checkComplianceCheckExists()) {
263 VspValidationPage.clickComplianceChecksAll();
264 GeneralUIUtils.ultimateWait();
265 assertFalse(NEXT_BUTTON_IS_DISABLED_IT_SHOULD_HAVE_BEEN_ENABLED,
266 VspValidationPage.checkNextButtonDisabled());
267 VspValidationPage.clickOnNextButton();
268 GeneralUIUtils.ultimateWait();
269 VspValidationPage.loadVSPFile(filePath, vnfFile);
270 VspValidationPage.clickOnSubmitButton();
271 GeneralUIUtils.ultimateWait();
272 assertTrue(RESULTS_ARE_NOT_AVAILABLE, VspValidationResultsPage.checkResultsExist());
274 assertNotNull(GeneralUIUtils.findByText(NO_TESTS_ARE_AVAILABLE));
279 @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Single_VNF")
280 public void onapOnboardVSPComplianceCheckOperations(String filePath, String vnfFile) throws Exception {
282 String vspName = createNewVSP(filePath, vnfFile);
283 if (!OnboardingUiUtils.getVspValidationCongiguration()) {
284 //change config to true to test the feature
285 changeVspValidationConfig(true, vspName, OnboardingUiUtils.getVspValidationCongiguration());
287 goToVspScreen(true, vspName);
290 VspValidationPage.navigateToVspValidationPageUsingNavbar();
291 assertTrue(NEXT_BUTTON_IS_ENABLED_IT_SHOULD_HAVE_BEEN_ENABLED, VspValidationPage.checkNextButtonDisabled());
292 if (VspValidationPage.checkComplianceCheckExists()) {
293 assertFalse(THE_TESTS_ARE_ALREADY_SELECTED_THE_LIST_SHOULD_INITIALLY_BE_EMPTY,
294 VspValidationPage.checkSelectedComplianceCheckExists());
295 VspValidationPage.clickComplianceChecksAll();
296 GeneralUIUtils.ultimateWait();
297 assertTrue(THE_SELECTED_TESTS_ARE_NOT_POPULATED_IN_THE_LIST,
298 VspValidationPage.checkSelectedComplianceCheckExists());
299 VspValidationPage.clickComplianceChecksAll();
300 GeneralUIUtils.ultimateWait();
301 assertFalse(THE_SELECTED_TESTS_ARE_NOT_DELETED_FROM_THE_LIST,
302 VspValidationPage.checkSelectedComplianceCheckExists());
304 assertNotNull(GeneralUIUtils.findByText(NO_TESTS_ARE_AVAILABLE));
309 @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Single_VNF")
310 public void onapOnboardVSPCertificationQueryOperations(String filePath, String vnfFile) throws Exception {
312 String vspName = createNewVSP(filePath, vnfFile);
313 if (!OnboardingUiUtils.getVspValidationCongiguration()) {
314 //change config to true to test the feature
315 changeVspValidationConfig(true, vspName, OnboardingUiUtils.getVspValidationCongiguration());
317 goToVspScreen(true, vspName);
320 VspValidationPage.navigateToVspValidationPageUsingNavbar();
321 assertTrue(NEXT_BUTTON_IS_ENABLED_IT_SHOULD_HAVE_BEEN_ENABLED, VspValidationPage.checkNextButtonDisabled());
322 if (VspValidationPage.checkCertificationQueryExists()) {
323 assertFalse(THE_TESTS_ARE_ALREADY_SELECTED_THE_LIST_SHOULD_INITIALLY_BE_EMPTY,
324 VspValidationPage.checkSelectedCertificationQueryExists());
325 VspValidationPage.clickCertificationQueryAll();
326 GeneralUIUtils.ultimateWait();
327 assertTrue(THE_SELECTED_TESTS_ARE_NOT_POPULATED_IN_THE_LIST, VspValidationPage.checkSelectedCertificationQueryExists());
328 VspValidationPage.clickCertificationQueryAll();
329 GeneralUIUtils.ultimateWait();
330 assertFalse(THE_SELECTED_TESTS_ARE_NOT_DELETED_FROM_THE_LIST,
331 VspValidationPage.checkSelectedCertificationQueryExists());
333 assertNotNull(GeneralUIUtils.findByText(NO_TESTS_ARE_AVAILABLE));
338 private void checkVspValidationLinksVisibility() {
339 //check links are available
340 assertTrue("Validation Link is not available", GeneralUIUtils.isElementVisibleByTestId(DataTestIdEnum.VspValidationPage.VSP_VALIDATION_PAGE_NAVBAR.getValue()));
341 assertTrue("Validation Results Link is not available", GeneralUIUtils.isElementVisibleByTestId(DataTestIdEnum.VspValidationResultsPage.VSP_VALIDATION_RESULTS_PAGE_NAVBAR.getValue()));
344 private void checkVspValidationLinksInvisibility() {
345 //check links not available
346 assertTrue("Validation Link is still available", GeneralUIUtils.isElementInvisibleByTestId(DataTestIdEnum.VspValidationPage.VSP_VALIDATION_PAGE_NAVBAR.getValue()));
347 assertTrue("Validation Results Link is still available", GeneralUIUtils.isElementInvisibleByTestId(DataTestIdEnum.VspValidationResultsPage.VSP_VALIDATION_RESULTS_PAGE_NAVBAR.getValue()));
350 private void changeVspValidationConfig(boolean isCurrentScreenCatalogPage, String vspName, boolean vspConfig) throws Exception {
352 OnboardingUiUtils.putVspValidationCongiguration(!vspConfig);
353 assertTrue(String.format("Failed to set Congiguration to %s", !vspConfig), OnboardingUiUtils.getVspValidationCongiguration() != vspConfig);
355 if (!isCurrentScreenCatalogPage) {
356 GeneralUIUtils.refreshWebpage();
357 GeneralUIUtils.ultimateWait();
360 goToVspScreen(isCurrentScreenCatalogPage, vspName);
363 OnboardingUiUtils.putVspValidationCongiguration(vspConfig);
364 assertEquals(String.format("Failed to revert Configuration to %s", vspConfig), vspConfig,
365 OnboardingUiUtils.getVspValidationCongiguration());
368 private void goToVspScreen(boolean isCurrentScreenCatalogPage, String vspName) {
369 if (isCurrentScreenCatalogPage) {
370 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.MainMenuButtons.ONBOARD_BUTTON.getValue());
372 GeneralUIUtils.clickOnElementByText(vspName);
373 GeneralUIUtils.ultimateWait();
376 private String createNewVSP(String filePath, String vnfFile) throws Exception {
377 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
378 return OnboardingUiUtils.createVSP(resourceReqDetails, vnfFile, filePath, getUser()).getName();
381 public void runOnboardPnfSoftwareVersion(final String resourceName, final String rootFolder,
382 final String pnfFile, final List<String> softwareVersionList) {
383 final ExtentTest extendTest = getExtendTest();
385 final String swVersionsToString = String.join(", ", softwareVersionList);
387 extendTest.log(Status.INFO,
388 String.format("Creating VSP '%s' by onboarding package '%s' with software version '%s'",
389 resourceName, pnfFile, swVersionsToString)
391 final WebDriver webDriver = DriverFactory.getDriver();
392 final CreateVspFlow createVspFlow = new CreateVspFlow(webDriver, resourceName, pnfFile, rootFolder);
393 createVspFlow.run(new TopNavComponent(webDriver));
395 final ImportVspFlow importVspFlow = new ImportVspFlow(webDriver, resourceName);
396 final ResourceCreatePage resourceCreatePage =
397 (ResourceCreatePage) importVspFlow.run()
398 .orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected return ResourceCreatePage"));
400 final CreateResourceFlow createResourceFlow = new CreateResourceFlow(webDriver, resourceName);
401 createResourceFlow.run(resourceCreatePage);
403 final CheckSoftwareVersionPropertyFlow checkSoftwareVersionPropertyFlow =
404 new CheckSoftwareVersionPropertyFlow(webDriver, softwareVersionList);
405 checkSoftwareVersionPropertyFlow.run();
407 extendTest.log(Status.INFO,
408 String.format("Successfully onboarded the package '%s' with software version '%s'",
409 pnfFile, swVersionsToString)
413 private void runOnboardToDistributionFlow(ResourceReqDetails resourceReqDetails, ServiceReqDetails serviceMetadata, String filePath, String vnfFile) throws Exception {
414 getExtendTest().log(Status.INFO, "Going to create resource with category: " + resourceReqDetails.getCategories().get(0).getName()
415 + " subCategory: " + resourceReqDetails.getCategories().get(0).getSubcategories().get(0).getName()
416 + " and service category: " + serviceMetadata.getCategory());
417 final String vspName = onboardAndCertify(resourceReqDetails, filePath, vnfFile);
419 ServiceUIUtils.createService(serviceMetadata);
421 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
422 Service containerObject = AtomicOperationUtils.getServiceObjectByNameAndVersion(UserRoleEnum.DESIGNER, serviceMetadata.getName(), "0.1");
423 Resource instanceObject = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, vspName, "1.0");
424 ComponentInstance componentInstanceDetails = AtomicOperationUtils.addComponentInstanceToComponentContainer(instanceObject, containerObject, UserRoleEnum.DESIGNER, true).left().value();
426 GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.LifeCyleChangeButtons.CERTIFY.getValue());
428 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DistributionChangeButtons.APPROVE_MESSAGE.getValue())
429 .sendKeys("service " + serviceMetadata.getName() + " certified successfully");
431 getExtendTest().log(Status.INFO, String.format("Successfully onboarded the package '%s'", vnfFile));
434 private void runDistributionFlow(final ServiceReqDetails serviceMetadata) throws Exception {
435 if (makeDistributionValue) {
436 reloginWithNewRole(UserRoleEnum.OPS);
437 GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
438 OpsOperationPage.distributeService();
439 OpsOperationPage.displayMonitor();
441 final List<WebElement> rowsFromMonitorTable = OpsOperationPage.getRowsFromMonitorTable();
442 AssertJUnit.assertEquals(1, rowsFromMonitorTable.size());
444 OpsOperationPage.waitUntilArtifactsDistributed(0);
448 private String onboardAndCertify(ResourceReqDetails resourceReqDetails, String filePath, String vnfFile) throws Exception {
449 VendorSoftwareProductObject onboardAndValidate = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, filePath, vnfFile, getUser());
450 String vspName = onboardAndValidate.getName();
452 DeploymentArtifactPage.getLeftPanel().moveToCompositionScreen();
453 ExtentTestActions.addScreenshot(Status.INFO, "TopologyTemplate_" + vnfFile, "The topology template for " + vnfFile + " is as follows : ");
455 DeploymentArtifactPage.clickCertifyButton(vspName);
460 @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "VNF_List")
461 public void onboardVNFTest(String filePath, String vnfFile) throws Exception {
463 ResourceReqDetails resourceReqDetails = ElementFactory.getRandomCategoryResource();
464 ServiceReqDetails serviceReqDetails = ElementFactory.getRandomCategoryService();
465 runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, vnfFile);
468 @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "VNF_List")
469 public void onboardVNFShotFlow(String filePath, String vnfFile) throws Exception {
471 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
472 onboardAndCertify(resourceReqDetails, filePath, vnfFile);
475 @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "randomVNF_List")
476 public void onboardRandomVNFsTest(String filePath, String vnfFile) throws Exception {
478 LOGGER.debug("Vnf File name is: {}", vnfFile);
479 ResourceReqDetails resourceReqDetails = ElementFactory.getRandomCategoryResource();
480 ServiceReqDetails serviceReqDetails = ElementFactory.getRandomCategoryService();
481 runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, vnfFile);
486 public void onboardUpdateVNFTest() throws Exception {
487 List<String> fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filePath);
488 String vnfFile = fileNamesFromFolder.get(0);
489 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
490 VendorSoftwareProductObject vsp = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, filePath, vnfFile, getUser());
491 String vspName = vsp.getName();
492 ResourceGeneralPage.clickCertifyButton(vspName);
495 ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
496 ServiceUIUtils.createService(serviceMetadata);
498 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
499 CompositionPage.searchForElement(vspName);
500 CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager();
501 CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vspName);
502 assertNotNull(vfElement);
503 ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 1, getUser());
505 if (!HomePage.navigateToHomePage()) {
506 fail("Could not go to the home page");
510 String updatedVnfFile = fileNamesFromFolder.get(1);
512 getExtendTest().log(Status.INFO, String.format("Going to update the VNF with %s......", updatedVnfFile));
513 // update VendorSoftwareProduct
514 OnboardingUiUtils.updateVnfAndValidate(filePath, vsp, updatedVnfFile, getUser());
515 ResourceGeneralPage.clickCertifyButton(vspName);
517 // replace exiting VFI in service with new updated
519 GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
520 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
521 serviceCanvasManager = CanvasManager.getCanvasManager();
522 CompositionPage.changeComponentVersion(serviceCanvasManager, vfElement, "2.0");
523 ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 1, getUser());
525 ServiceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
527 reloginWithNewRole(UserRoleEnum.TESTER);
528 GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
529 TesterOperationPage.certifyComponent(serviceMetadata.getName());
531 reloginWithNewRole(UserRoleEnum.GOVERNOR);
532 GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
533 GovernorOperationPage.approveService(serviceMetadata.getName());
536 reloginWithNewRole(UserRoleEnum.OPS);
537 GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
538 OpsOperationPage.distributeService();
539 OpsOperationPage.displayMonitor();
541 List<WebElement> rowsFromMonitorTable = OpsOperationPage.getRowsFromMonitorTable();
542 AssertJUnit.assertEquals(1, rowsFromMonitorTable.size());
544 OpsOperationPage.waitUntilArtifactsDistributed(0);
545 getExtendTest().log(Status.INFO, String.format("Onboarding %s test is passed ! ", vnfFile));
550 public void threeVMMSCsInServiceTest() throws Exception {
551 String pathFile = FileHandling.getFilePath("VmmscArtifacts");
552 final String[] list = new File(pathFile).list();
553 assertNotNull("Did not find vMMSCs", list);
554 assertFalse("Did not find vMMSCs", list.length == 0);
555 List<String> vmmscList = Arrays.stream(list).filter(e -> e.contains("vmmsc") && e.endsWith(".zip"))
556 .collect(Collectors.toList());
557 assertFalse("Did not find vMMSCs", vmmscList.isEmpty());
559 Map<String, String> vspNames = new HashMap<>();
560 for (String vnfFile : vmmscList) {
561 String msg = String.format("Going to onboard the VNF %s", vnfFile);
562 getExtendTest().log(Status.INFO, msg);
565 VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(getUser());
566 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
567 VendorSoftwareProductObject createVendorSoftwareProduct = VendorSoftwareProductRestUtils
568 .createVendorSoftwareProduct(resourceReqDetails, vnfFile, pathFile, getUser(), vendorLicenseModel);
570 getExtendTest().log(Status.INFO, String.format("Searching for onboarded %s", vnfFile));
571 HomePage.showVspRepository();
572 getExtendTest().log(Status.INFO, String.format("Going to import %s......", vnfFile.substring(0, vnfFile.indexOf("."))));
573 OnboardingUiUtils.importVSP(createVendorSoftwareProduct);
575 ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
576 DeploymentArtifactPage.verifyArtifactsExistInTable(pathFile, vnfFile);
578 String vspName = createVendorSoftwareProduct.getName();
579 DeploymentArtifactPage.clickCertifyButton(vspName);
580 vspNames.put(vnfFile, vspName);
584 ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
585 ServiceUIUtils.createService(serviceMetadata);
586 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
587 CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager();
589 for (String vsp : vspNames.values()) {
590 CompositionPage.searchForElement(vsp);
591 CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vsp);
592 assertNotNull(vfElement);
594 ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", vspNames.values().size(), getUser());
595 File imageFilePath = GeneralUIUtils.takeScreenshot(null, SetupCDTest.getScreenshotFolder(), "Info_" + getExtendTest().getModel().getName());
596 final String absolutePath = new File(SetupCDTest.getReportFolder()).toURI().relativize(imageFilePath.toURI()).getPath();
597 SetupCDTest.getExtendTest().log(Status.INFO, "Three kinds of vMMSC are in canvas now." + getExtendTest().addScreenCaptureFromPath(absolutePath));
599 ServiceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
601 reloginWithNewRole(UserRoleEnum.TESTER);
602 GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
603 TesterOperationPage.certifyComponent(serviceMetadata.getName());
605 reloginWithNewRole(UserRoleEnum.GOVERNOR);
606 GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
607 GovernorOperationPage.approveService(serviceMetadata.getName());
609 reloginWithNewRole(UserRoleEnum.OPS);
610 GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
611 OpsOperationPage.distributeService();
612 OpsOperationPage.displayMonitor();
614 List<WebElement> rowsFromMonitorTable = OpsOperationPage.getRowsFromMonitorTable();
615 AssertJUnit.assertEquals(1, rowsFromMonitorTable.size());
617 OpsOperationPage.waitUntilArtifactsDistributed(0);
622 protected UserRoleEnum getRole() {
623 return UserRoleEnum.DESIGNER;