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 static org.testng.AssertJUnit.assertEquals;
24 import static org.testng.AssertJUnit.assertFalse;
25 import static org.testng.AssertJUnit.assertNotNull;
26 import static org.testng.AssertJUnit.assertTrue;
27 import static org.testng.AssertJUnit.fail;
29 import com.aventstack.extentreports.ExtentTest;
30 import com.aventstack.extentreports.Status;
32 import java.util.Arrays;
33 import java.util.HashMap;
34 import java.util.List;
36 import java.util.stream.Collectors;
37 import org.openecomp.sdc.ci.tests.data.providers.OnboardingDataProviders;
38 import org.openecomp.sdc.ci.tests.dataProvider.OnbordingDataProviders;
39 import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
40 import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
41 import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
42 import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
43 import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
44 import org.openecomp.sdc.ci.tests.datatypes.VendorLicenseModel;
45 import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject;
46 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
47 import org.openecomp.sdc.ci.tests.datatypes.enums.XnfTypeEnum;
48 import org.openecomp.sdc.ci.tests.execute.setup.ArtifactsCorrelationManager;
49 import org.openecomp.sdc.ci.tests.execute.setup.DriverFactory;
50 import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
51 import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
52 import org.openecomp.sdc.ci.tests.flow.CheckSoftwareVersionPropertyFlow;
53 import org.openecomp.sdc.ci.tests.flow.CreateResourceFlow;
54 import org.openecomp.sdc.ci.tests.flow.CreateVspFlow;
55 import org.openecomp.sdc.ci.tests.flow.ImportVspFlow;
56 import org.openecomp.sdc.ci.tests.flow.exception.UiTestFlowRuntimeException;
57 import org.openecomp.sdc.ci.tests.pages.CompositionPage;
58 import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
59 import org.openecomp.sdc.ci.tests.pages.GovernorOperationPage;
60 import org.openecomp.sdc.ci.tests.pages.HomePage;
61 import org.openecomp.sdc.ci.tests.pages.HomePage.PageElement;
62 import org.openecomp.sdc.ci.tests.pages.OpsOperationPage;
63 import org.openecomp.sdc.ci.tests.pages.ResourceCreatePage;
64 import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
65 import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage;
66 import org.openecomp.sdc.ci.tests.pages.TesterOperationPage;
67 import org.openecomp.sdc.ci.tests.pages.TopNavComponent;
68 import org.openecomp.sdc.ci.tests.pages.VspValidationPage;
69 import org.openecomp.sdc.ci.tests.pages.VspValidationResultsPage;
70 import org.openecomp.sdc.ci.tests.utilities.FileHandling;
71 import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
72 import org.openecomp.sdc.ci.tests.utilities.OnboardingUiUtils;
73 import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
74 import org.openecomp.sdc.ci.tests.utils.Utils;
75 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
76 import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils;
77 import org.openecomp.sdc.ci.tests.utils.general.VendorLicenseModelRestUtils;
78 import org.openecomp.sdc.ci.tests.utils.general.VendorSoftwareProductRestUtils;
79 import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator;
80 import org.openqa.selenium.WebDriver;
81 import org.openqa.selenium.WebElement;
82 import org.slf4j.Logger;
83 import org.slf4j.LoggerFactory;
84 import org.testng.AssertJUnit;
85 import org.testng.annotations.BeforeMethod;
86 import org.testng.annotations.Optional;
87 import org.testng.annotations.Parameters;
88 import org.testng.annotations.Test;
90 public class OnboardingFlowsUi extends SetupCDTest {
92 private static final Logger LOGGER = LoggerFactory.getLogger(OnboardingFlowsUi.class);
93 private static final String NO_TESTS_ARE_AVAILABLE = "No Tests are Available";
94 private static final String NEXT_BUTTON_IS_ENABLED_IT_SHOULD_HAVE_BEEN_ENABLED =
95 "Next Button is enabled, it should have been enabled";
96 private static final String NEXT_BUTTON_IS_DISABLED_IT_SHOULD_HAVE_BEEN_ENABLED =
97 "Next Button is disabled, it should have been enabled";
98 private static final String RESULTS_ARE_NOT_AVAILABLE = "Results are not available";
99 private static final String THE_TESTS_ARE_ALREADY_SELECTED_THE_LIST_SHOULD_INITIALLY_BE_EMPTY =
100 "The tests are already selected, the list should initially be empty";
101 private static final String THE_SELECTED_TESTS_ARE_NOT_POPULATED_IN_THE_LIST =
102 "The selected tests are not populated in the list";
103 private static final String THE_SELECTED_TESTS_ARE_NOT_DELETED_FROM_THE_LIST =
104 "The selected tests are not deleted from the list";
105 private static final String NEXT_BUTTON_IS_ENABLED_IT_SHOULD_HAVE_BEEN_DISABLED =
106 "Next Button is enabled, it should have been disabled";
108 protected static String filePath = FileHandling.getVnfRepositoryPath();
109 private Boolean makeDistributionValue;
111 @Parameters({"makeDistribution"})
113 public void beforeTestReadParams(@Optional("true") String makeDistributionReadValue) {
114 LOGGER.debug("makeDistribution parameter is '{}'", makeDistributionReadValue);
115 makeDistributionValue = Boolean.valueOf(makeDistributionReadValue);
119 public void onboardVNFTestSanityOneFile() throws Exception {
120 String vnfFile = "1-VF-vUSP-vCCF-DB_v11.1.zip";
121 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
122 ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
123 runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, vnfFile);
127 public void performanceTest() throws Exception {
128 LOGGER.debug("Start test");
129 Long actualTestRunTime = Utils.getActionDuration(() -> {
131 onboardVNFTestSanityOneFile();
132 } catch (final Exception e) {
133 LOGGER.debug("An error has occurred during the performance test", e);
136 long regularTestRunTime = 400L;
138 assertTrue("Expected test run time should be less from " + regularTestRunTime * factor + ", actual time is " + actualTestRunTime, regularTestRunTime * factor > actualTestRunTime);
142 public void onboardVNFTestSanity() throws Exception {
143 List<String> fileNamesFromFolder = OnboardingUtils.getXnfNamesFileList(XnfTypeEnum.VNF);
144 String vnfFile = fileNamesFromFolder.get(0);
145 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
146 ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
147 runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, vnfFile);
150 @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Single_VNF")
151 public void onapOnboardVNFflow(String filePath, String vnfFile) throws Exception {
153 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
154 ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
155 runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, vnfFile);
158 @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Single_VNF")
159 public void onapOnboardVSPValidationsSanityFlow(String filePath, String vnfFile) throws Exception {
161 String vspName = createNewVSP(filePath, vnfFile);
162 if (OnboardingUiUtils.getVspValidationCongiguration()) {
163 goToVspScreen(true, vspName);
165 //check links are available
166 checkVspValidationLinksVisibility();
168 VspValidationPage.navigateToVspValidationPageUsingNavbar();
169 assertTrue(NEXT_BUTTON_IS_ENABLED_IT_SHOULD_HAVE_BEEN_DISABLED,
170 VspValidationPage.checkNextButtonDisabled());
171 VspValidationResultsPage.navigateToVspValidationResultsPageUsingNavbar();
172 GeneralUIUtils.ultimateWait();
173 assertNotNull(GeneralUIUtils.findByText("No Test Performed"));
175 goToVspScreen(true, vspName);
177 //check links are not available
178 checkVspValidationLinksInvisibility();
182 @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "softwareInformationPnf")
183 public void onboardPNFSoftwareInformationFlow(final String rootFolder, final String pnfFile,
184 final List<String> softwareVersionList) {
186 final String resourceName = ElementFactory.addRandomSuffixToName(ElementFactory.getResourcePrefix());
187 runOnboardPnfSoftwareVersion(resourceName, rootFolder, pnfFile, softwareVersionList);
190 @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Single_VNF")
191 public void onapOnboardVSPValidationsConfigurationChangeCheck(String filePath, String vnfFile) throws Exception {
193 String vspName = createNewVSP(filePath, vnfFile);
194 if (OnboardingUiUtils.getVspValidationCongiguration()) {
195 goToVspScreen(true, vspName);
196 //check links are available
197 checkVspValidationLinksVisibility();
200 changeVspValidationConfig(false, vspName, OnboardingUiUtils.getVspValidationCongiguration());
202 //check links are not available
203 checkVspValidationLinksInvisibility();
205 goToVspScreen(true, vspName);
206 //check links are not available
207 checkVspValidationLinksInvisibility();
209 changeVspValidationConfig(false, vspName, OnboardingUiUtils.getVspValidationCongiguration());
211 //check links are available
212 checkVspValidationLinksVisibility();
216 @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Single_VNF")
217 public void onapOnboardVSPCertificationQueryFlow(String filePath, String vnfFile) throws Exception {
219 String vspName = createNewVSP(filePath, vnfFile);
220 if (!OnboardingUiUtils.getVspValidationCongiguration()) {
221 //change config to true to test the feature
222 changeVspValidationConfig(true, vspName, OnboardingUiUtils.getVspValidationCongiguration());
224 goToVspScreen(true, vspName);
226 VspValidationPage.navigateToVspValidationPageUsingNavbar();
227 assertTrue(NEXT_BUTTON_IS_ENABLED_IT_SHOULD_HAVE_BEEN_DISABLED, VspValidationPage.checkNextButtonDisabled());
229 if (VspValidationPage.checkCertificationQueryExists()) {
230 VspValidationPage.clickCertificationQueryAll();
231 GeneralUIUtils.ultimateWait();
232 assertTrue(NEXT_BUTTON_IS_DISABLED_IT_SHOULD_HAVE_BEEN_ENABLED,
233 !VspValidationPage.checkNextButtonDisabled());
234 VspValidationPage.clickOnNextButton();
235 GeneralUIUtils.ultimateWait();
236 VspValidationPage.clickOnSubmitButton();
237 GeneralUIUtils.waitForLoader();
238 assertTrue(RESULTS_ARE_NOT_AVAILABLE, VspValidationResultsPage.checkResultsExist());
240 assertNotNull(GeneralUIUtils.findByText("No Certifications Query are Available"));
245 @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "Single_Vsp_Test_Csar")
246 public void onapOnboardVSPComplianceCheckFlow(String filePath, String vnfFile) throws Exception {
248 String vspName = createNewVSP(filePath, vnfFile);
249 if (!OnboardingUiUtils.getVspValidationCongiguration()) {
250 //change config to true to test the feature
251 changeVspValidationConfig(true, vspName, OnboardingUiUtils.getVspValidationCongiguration());
253 goToVspScreen(true, vspName);
256 VspValidationPage.navigateToVspValidationPageUsingNavbar();
257 assertTrue(NEXT_BUTTON_IS_ENABLED_IT_SHOULD_HAVE_BEEN_ENABLED, VspValidationPage.checkNextButtonDisabled());
258 if (VspValidationPage.checkComplianceCheckExists()) {
259 VspValidationPage.clickComplianceChecksAll();
260 GeneralUIUtils.ultimateWait();
261 assertFalse(NEXT_BUTTON_IS_DISABLED_IT_SHOULD_HAVE_BEEN_ENABLED,
262 VspValidationPage.checkNextButtonDisabled());
263 VspValidationPage.clickOnNextButton();
264 GeneralUIUtils.ultimateWait();
265 VspValidationPage.loadVSPFile(filePath, vnfFile);
266 VspValidationPage.clickOnSubmitButton();
267 GeneralUIUtils.ultimateWait();
268 assertTrue(RESULTS_ARE_NOT_AVAILABLE, VspValidationResultsPage.checkResultsExist());
270 assertNotNull(GeneralUIUtils.findByText(NO_TESTS_ARE_AVAILABLE));
275 @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Single_VNF")
276 public void onapOnboardVSPComplianceCheckOperations(String filePath, String vnfFile) throws Exception {
278 String vspName = createNewVSP(filePath, vnfFile);
279 if (!OnboardingUiUtils.getVspValidationCongiguration()) {
280 //change config to true to test the feature
281 changeVspValidationConfig(true, vspName, OnboardingUiUtils.getVspValidationCongiguration());
283 goToVspScreen(true, vspName);
286 VspValidationPage.navigateToVspValidationPageUsingNavbar();
287 assertTrue(NEXT_BUTTON_IS_ENABLED_IT_SHOULD_HAVE_BEEN_ENABLED, VspValidationPage.checkNextButtonDisabled());
288 if (VspValidationPage.checkComplianceCheckExists()) {
289 assertFalse(THE_TESTS_ARE_ALREADY_SELECTED_THE_LIST_SHOULD_INITIALLY_BE_EMPTY,
290 VspValidationPage.checkSelectedComplianceCheckExists());
291 VspValidationPage.clickComplianceChecksAll();
292 GeneralUIUtils.ultimateWait();
293 assertTrue(THE_SELECTED_TESTS_ARE_NOT_POPULATED_IN_THE_LIST,
294 VspValidationPage.checkSelectedComplianceCheckExists());
295 VspValidationPage.clickComplianceChecksAll();
296 GeneralUIUtils.ultimateWait();
297 assertFalse(THE_SELECTED_TESTS_ARE_NOT_DELETED_FROM_THE_LIST,
298 VspValidationPage.checkSelectedComplianceCheckExists());
300 assertNotNull(GeneralUIUtils.findByText(NO_TESTS_ARE_AVAILABLE));
305 @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Single_VNF")
306 public void onapOnboardVSPCertificationQueryOperations(String filePath, String vnfFile) throws Exception {
308 String vspName = createNewVSP(filePath, vnfFile);
309 if (!OnboardingUiUtils.getVspValidationCongiguration()) {
310 //change config to true to test the feature
311 changeVspValidationConfig(true, vspName, OnboardingUiUtils.getVspValidationCongiguration());
313 goToVspScreen(true, vspName);
316 VspValidationPage.navigateToVspValidationPageUsingNavbar();
317 assertTrue(NEXT_BUTTON_IS_ENABLED_IT_SHOULD_HAVE_BEEN_ENABLED, VspValidationPage.checkNextButtonDisabled());
318 if (VspValidationPage.checkCertificationQueryExists()) {
319 assertFalse(THE_TESTS_ARE_ALREADY_SELECTED_THE_LIST_SHOULD_INITIALLY_BE_EMPTY,
320 VspValidationPage.checkSelectedCertificationQueryExists());
321 VspValidationPage.clickCertificationQueryAll();
322 GeneralUIUtils.ultimateWait();
323 assertTrue(THE_SELECTED_TESTS_ARE_NOT_POPULATED_IN_THE_LIST, VspValidationPage.checkSelectedCertificationQueryExists());
324 VspValidationPage.clickCertificationQueryAll();
325 GeneralUIUtils.ultimateWait();
326 assertFalse(THE_SELECTED_TESTS_ARE_NOT_DELETED_FROM_THE_LIST,
327 VspValidationPage.checkSelectedCertificationQueryExists());
329 assertNotNull(GeneralUIUtils.findByText(NO_TESTS_ARE_AVAILABLE));
334 private void checkVspValidationLinksVisibility() {
335 //check links are available
336 assertTrue("Validation Link is not available", GeneralUIUtils.isElementVisibleByTestId(DataTestIdEnum.VspValidationPage.VSP_VALIDATION_PAGE_NAVBAR.getValue()));
337 assertTrue("Validation Results Link is not available", GeneralUIUtils.isElementVisibleByTestId(DataTestIdEnum.VspValidationResultsPage.VSP_VALIDATION_RESULTS_PAGE_NAVBAR.getValue()));
340 private void checkVspValidationLinksInvisibility() {
341 //check links not available
342 assertTrue("Validation Link is still available", GeneralUIUtils.isElementInvisibleByTestId(DataTestIdEnum.VspValidationPage.VSP_VALIDATION_PAGE_NAVBAR.getValue()));
343 assertTrue("Validation Results Link is still available", GeneralUIUtils.isElementInvisibleByTestId(DataTestIdEnum.VspValidationResultsPage.VSP_VALIDATION_RESULTS_PAGE_NAVBAR.getValue()));
346 private void changeVspValidationConfig(boolean isCurrentScreenCatalogPage, String vspName, boolean vspConfig) throws Exception {
348 OnboardingUiUtils.putVspValidationCongiguration(!vspConfig);
349 assertTrue(String.format("Failed to set Congiguration to %s", !vspConfig), OnboardingUiUtils.getVspValidationCongiguration() != vspConfig);
351 if (!isCurrentScreenCatalogPage) {
352 GeneralUIUtils.refreshWebpage();
353 GeneralUIUtils.ultimateWait();
356 goToVspScreen(isCurrentScreenCatalogPage, vspName);
359 OnboardingUiUtils.putVspValidationCongiguration(vspConfig);
360 assertEquals(String.format("Failed to revert Configuration to %s", vspConfig), vspConfig,
361 OnboardingUiUtils.getVspValidationCongiguration());
364 private void goToVspScreen(boolean isCurrentScreenCatalogPage, String vspName) {
365 if (isCurrentScreenCatalogPage) {
366 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.MainMenuButtons.ONBOARD_BUTTON.getValue());
368 GeneralUIUtils.clickOnElementByText(vspName);
369 GeneralUIUtils.ultimateWait();
372 private String createNewVSP(String filePath, String vnfFile) throws Exception {
373 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
374 return OnboardingUiUtils.createVSP(resourceReqDetails, vnfFile, filePath, getUser()).getName();
377 public void runOnboardPnfSoftwareVersion(final String resourceName, final String rootFolder,
378 final String pnfFile, final List<String> softwareVersionList) {
379 final ExtentTest extendTest = getExtendTest();
381 final String swVersionsToString = String.join(", ", softwareVersionList);
383 extendTest.log(Status.INFO,
384 String.format("Creating VSP '%s' by onboarding package '%s' with software version '%s'",
385 resourceName, pnfFile, swVersionsToString)
387 final WebDriver webDriver = DriverFactory.getDriver();
388 final CreateVspFlow createVspFlow = new CreateVspFlow(webDriver, resourceName, pnfFile, rootFolder);
389 createVspFlow.run(new TopNavComponent(webDriver));
391 final ImportVspFlow importVspFlow = new ImportVspFlow(webDriver, resourceName);
392 final ResourceCreatePage resourceCreatePage =
393 (ResourceCreatePage) importVspFlow.run()
394 .orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected return ResourceCreatePage"));
396 final CreateResourceFlow createResourceFlow = new CreateResourceFlow(webDriver, resourceName);
397 createResourceFlow.run(resourceCreatePage);
399 final CheckSoftwareVersionPropertyFlow checkSoftwareVersionPropertyFlow =
400 new CheckSoftwareVersionPropertyFlow(webDriver, softwareVersionList);
401 checkSoftwareVersionPropertyFlow.run();
403 extendTest.log(Status.INFO,
404 String.format("Successfully onboarded the package '%s' with software version '%s'",
405 pnfFile, swVersionsToString)
409 private void runOnboardToDistributionFlow(ResourceReqDetails resourceReqDetails, ServiceReqDetails serviceMetadata, String filePath, String vnfFile) throws Exception {
410 getExtendTest().log(Status.INFO, "Going to create resource with category: " + resourceReqDetails.getCategories().get(0).getName()
411 + " subCategory: " + resourceReqDetails.getCategories().get(0).getSubcategories().get(0).getName()
412 + " and service category: " + serviceMetadata.getCategory());
413 final String vspName = onboardAndCertify(resourceReqDetails, filePath, vnfFile);
415 ServiceUIUtils.createService(serviceMetadata);
417 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
418 CompositionPage.searchForElement(vspName);
419 final CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager();
420 final CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vspName);
421 ArtifactsCorrelationManager.addVNFtoServiceArtifactCorrelation(serviceMetadata.getName(), vspName);
423 assertNotNull(vfElement);
424 ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 1, getUser());
425 ExtentTestActions.addScreenshot(Status.INFO, "ServiceComposition_" + vnfFile, "The service topology is as follows: ");
427 ServiceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
429 reloginWithNewRole(UserRoleEnum.TESTER);
430 GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
431 TesterOperationPage.certifyComponent(serviceMetadata.getName());
433 reloginWithNewRole(UserRoleEnum.GOVERNOR);
434 HomePage.waitForElement(PageElement.COMPONENT_PANEL);
435 HomePage.findComponentAndClick(serviceMetadata.getName());
436 GovernorOperationPage.approveService(serviceMetadata.getName());
438 runDistributionFlow(serviceMetadata);
440 getExtendTest().log(Status.INFO, String.format("Successfully onboarded the package '%s'", vnfFile));
443 private void runDistributionFlow(final ServiceReqDetails serviceMetadata) throws Exception {
444 if (makeDistributionValue) {
445 reloginWithNewRole(UserRoleEnum.OPS);
446 GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
447 OpsOperationPage.distributeService();
448 OpsOperationPage.displayMonitor();
450 final List<WebElement> rowsFromMonitorTable = OpsOperationPage.getRowsFromMonitorTable();
451 AssertJUnit.assertEquals(1, rowsFromMonitorTable.size());
453 OpsOperationPage.waitUntilArtifactsDistributed(0);
457 private String onboardAndCertify(ResourceReqDetails resourceReqDetails, String filePath, String vnfFile) throws Exception {
458 VendorSoftwareProductObject onboardAndValidate = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, filePath, vnfFile, getUser());
459 String vspName = onboardAndValidate.getName();
461 DeploymentArtifactPage.getLeftPanel().moveToCompositionScreen();
462 ExtentTestActions.addScreenshot(Status.INFO, "TopologyTemplate_" + vnfFile, "The topology template for " + vnfFile + " is as follows : ");
464 DeploymentArtifactPage.clickCertifyButton(vspName);
469 @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "VNF_List")
470 public void onboardVNFTest(String filePath, String vnfFile) throws Exception {
472 ResourceReqDetails resourceReqDetails = ElementFactory.getRandomCategoryResource();
473 ServiceReqDetails serviceReqDetails = ElementFactory.getRandomCategoryService();
474 runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, vnfFile);
477 @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "VNF_List")
478 public void onboardVNFShotFlow(String filePath, String vnfFile) throws Exception {
480 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
481 onboardAndCertify(resourceReqDetails, filePath, vnfFile);
484 @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "randomVNF_List")
485 public void onboardRandomVNFsTest(String filePath, String vnfFile) throws Exception {
487 LOGGER.debug("Vnf File name is: {}", vnfFile);
488 ResourceReqDetails resourceReqDetails = ElementFactory.getRandomCategoryResource();
489 ServiceReqDetails serviceReqDetails = ElementFactory.getRandomCategoryService();
490 runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, vnfFile);
495 public void onboardUpdateVNFTest() throws Exception {
496 List<String> fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filePath);
497 String vnfFile = fileNamesFromFolder.get(0);
498 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
499 VendorSoftwareProductObject vsp = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, filePath, vnfFile, getUser());
500 String vspName = vsp.getName();
501 ResourceGeneralPage.clickCertifyButton(vspName);
504 ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
505 ServiceUIUtils.createService(serviceMetadata);
507 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
508 CompositionPage.searchForElement(vspName);
509 CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager();
510 CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vspName);
511 assertNotNull(vfElement);
512 ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 1, getUser());
514 if (!HomePage.navigateToHomePage()) {
515 fail("Could not go to the home page");
519 String updatedVnfFile = fileNamesFromFolder.get(1);
521 getExtendTest().log(Status.INFO, String.format("Going to update the VNF with %s......", updatedVnfFile));
522 // update VendorSoftwareProduct
523 OnboardingUiUtils.updateVnfAndValidate(filePath, vsp, updatedVnfFile, getUser());
524 ResourceGeneralPage.clickCertifyButton(vspName);
526 // replace exiting VFI in service with new updated
528 GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
529 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
530 serviceCanvasManager = CanvasManager.getCanvasManager();
531 CompositionPage.changeComponentVersion(serviceCanvasManager, vfElement, "2.0");
532 ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 1, getUser());
534 ServiceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
536 reloginWithNewRole(UserRoleEnum.TESTER);
537 GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
538 TesterOperationPage.certifyComponent(serviceMetadata.getName());
540 reloginWithNewRole(UserRoleEnum.GOVERNOR);
541 GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
542 GovernorOperationPage.approveService(serviceMetadata.getName());
545 reloginWithNewRole(UserRoleEnum.OPS);
546 GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
547 OpsOperationPage.distributeService();
548 OpsOperationPage.displayMonitor();
550 List<WebElement> rowsFromMonitorTable = OpsOperationPage.getRowsFromMonitorTable();
551 AssertJUnit.assertEquals(1, rowsFromMonitorTable.size());
553 OpsOperationPage.waitUntilArtifactsDistributed(0);
554 getExtendTest().log(Status.INFO, String.format("Onboarding %s test is passed ! ", vnfFile));
559 public void threeVMMSCsInServiceTest() throws Exception {
560 String pathFile = FileHandling.getFilePath("VmmscArtifacts");
561 final String[] list = new File(pathFile).list();
562 assertNotNull("Did not find vMMSCs", list);
563 assertFalse("Did not find vMMSCs", list.length == 0);
564 List<String> vmmscList = Arrays.stream(list).filter(e -> e.contains("vmmsc") && e.endsWith(".zip"))
565 .collect(Collectors.toList());
566 assertFalse("Did not find vMMSCs", vmmscList.isEmpty());
568 Map<String, String> vspNames = new HashMap<>();
569 for (String vnfFile : vmmscList) {
570 String msg = String.format("Going to onboard the VNF %s", vnfFile);
571 getExtendTest().log(Status.INFO, msg);
574 VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(getUser());
575 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
576 VendorSoftwareProductObject createVendorSoftwareProduct = VendorSoftwareProductRestUtils
577 .createVendorSoftwareProduct(resourceReqDetails, vnfFile, pathFile, getUser(), vendorLicenseModel);
579 getExtendTest().log(Status.INFO, String.format("Searching for onboarded %s", vnfFile));
580 HomePage.showVspRepository();
581 getExtendTest().log(Status.INFO, String.format("Going to import %s......", vnfFile.substring(0, vnfFile.indexOf("."))));
582 OnboardingUiUtils.importVSP(createVendorSoftwareProduct);
584 ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
585 DeploymentArtifactPage.verifyArtifactsExistInTable(pathFile, vnfFile);
587 String vspName = createVendorSoftwareProduct.getName();
588 DeploymentArtifactPage.clickCertifyButton(vspName);
589 vspNames.put(vnfFile, vspName);
593 ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
594 ServiceUIUtils.createService(serviceMetadata);
595 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
596 CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager();
598 for (String vsp : vspNames.values()) {
599 CompositionPage.searchForElement(vsp);
600 CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vsp);
601 assertNotNull(vfElement);
603 ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", vspNames.values().size(), getUser());
604 File imageFilePath = GeneralUIUtils.takeScreenshot(null, SetupCDTest.getScreenshotFolder(), "Info_" + getExtendTest().getModel().getName());
605 final String absolutePath = new File(SetupCDTest.getReportFolder()).toURI().relativize(imageFilePath.toURI()).getPath();
606 SetupCDTest.getExtendTest().log(Status.INFO, "Three kinds of vMMSC are in canvas now." + getExtendTest().addScreenCaptureFromPath(absolutePath));
608 ServiceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
610 reloginWithNewRole(UserRoleEnum.TESTER);
611 GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
612 TesterOperationPage.certifyComponent(serviceMetadata.getName());
614 reloginWithNewRole(UserRoleEnum.GOVERNOR);
615 GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
616 GovernorOperationPage.approveService(serviceMetadata.getName());
618 reloginWithNewRole(UserRoleEnum.OPS);
619 GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
620 OpsOperationPage.distributeService();
621 OpsOperationPage.displayMonitor();
623 List<WebElement> rowsFromMonitorTable = OpsOperationPage.getRowsFromMonitorTable();
624 AssertJUnit.assertEquals(1, rowsFromMonitorTable.size());
626 OpsOperationPage.waitUntilArtifactsDistributed(0);
631 protected UserRoleEnum getRole() {
632 return UserRoleEnum.DESIGNER;