2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * Copyright (C) 2021 Nokia. All rights reserved.
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.onap.sdc.frontend.ci.tests.execute.sanity;
24 import static org.testng.AssertJUnit.assertEquals;
25 import static org.testng.AssertJUnit.assertFalse;
26 import static org.testng.AssertJUnit.assertNotNull;
27 import static org.testng.AssertJUnit.assertTrue;
28 import static org.testng.AssertJUnit.fail;
30 import com.aventstack.extentreports.ExtentTest;
31 import com.aventstack.extentreports.Status;
33 import java.util.Arrays;
34 import java.util.HashMap;
35 import java.util.List;
37 import java.util.stream.Collectors;
38 import org.onap.sdc.backend.ci.tests.data.providers.OnboardingDataProviders;
39 import org.onap.sdc.backend.ci.tests.datatypes.ResourceReqDetails;
40 import org.onap.sdc.backend.ci.tests.datatypes.ServiceReqDetails;
41 import org.onap.sdc.backend.ci.tests.datatypes.VendorLicenseModel;
42 import org.onap.sdc.backend.ci.tests.datatypes.VendorSoftwareProductObject;
43 import org.onap.sdc.backend.ci.tests.datatypes.enums.UserRoleEnum;
44 import org.onap.sdc.backend.ci.tests.datatypes.enums.XnfTypeEnum;
45 import org.onap.sdc.backend.ci.tests.utils.Utils;
46 import org.onap.sdc.backend.ci.tests.utils.general.AtomicOperationUtils;
47 import org.onap.sdc.backend.ci.tests.utils.general.ElementFactory;
48 import org.onap.sdc.backend.ci.tests.utils.general.OnboardingUtils;
49 import org.onap.sdc.backend.ci.tests.utils.general.VendorLicenseModelRestUtils;
50 import org.onap.sdc.backend.ci.tests.utils.general.VendorSoftwareProductRestUtils;
51 import org.onap.sdc.frontend.ci.tests.dataProvider.OnbordingDataProviders;
52 import org.onap.sdc.frontend.ci.tests.datatypes.CanvasElement;
53 import org.onap.sdc.frontend.ci.tests.datatypes.CanvasManager;
54 import org.onap.sdc.frontend.ci.tests.datatypes.DataTestIdEnum;
55 import org.onap.sdc.frontend.ci.tests.execute.setup.DriverFactory;
56 import org.onap.sdc.frontend.ci.tests.execute.setup.ExtentTestActions;
57 import org.onap.sdc.frontend.ci.tests.execute.setup.SetupCDTest;
58 import org.onap.sdc.frontend.ci.tests.flow.CheckSoftwareVersionPropertyFlow;
59 import org.onap.sdc.frontend.ci.tests.flow.CreateResourceFromVspFlow;
60 import org.onap.sdc.frontend.ci.tests.flow.CreateVspFlow;
61 import org.onap.sdc.frontend.ci.tests.flow.ImportVspFlow;
62 import org.onap.sdc.frontend.ci.tests.flow.exception.UiTestFlowRuntimeException;
63 import org.onap.sdc.frontend.ci.tests.pages.CompositionPage;
64 import org.onap.sdc.frontend.ci.tests.pages.DeploymentArtifactPage;
65 import org.onap.sdc.frontend.ci.tests.pages.GeneralPageElements;
66 import org.onap.sdc.frontend.ci.tests.pages.GovernorOperationPage;
67 import org.onap.sdc.frontend.ci.tests.pages.HomePage;
68 import org.onap.sdc.frontend.ci.tests.pages.OpsOperationPage;
69 import org.onap.sdc.frontend.ci.tests.pages.ResourceCreatePage;
70 import org.onap.sdc.frontend.ci.tests.pages.ResourceGeneralPage;
71 import org.onap.sdc.frontend.ci.tests.pages.ServiceGeneralPage;
72 import org.onap.sdc.frontend.ci.tests.pages.TesterOperationPage;
73 import org.onap.sdc.frontend.ci.tests.pages.TopNavComponent;
74 import org.onap.sdc.frontend.ci.tests.pages.VspValidationPage;
75 import org.onap.sdc.frontend.ci.tests.pages.VspValidationResultsPage;
76 import org.onap.sdc.frontend.ci.tests.utilities.FileHandling;
77 import org.onap.sdc.frontend.ci.tests.utilities.GeneralUIUtils;
78 import org.onap.sdc.frontend.ci.tests.utilities.OnboardingUiUtils;
79 import org.onap.sdc.frontend.ci.tests.utilities.ServiceUIUtils;
80 import org.onap.sdc.frontend.ci.tests.verificator.ServiceVerificator;
81 import org.openecomp.sdc.be.model.ComponentInstance;
82 import org.openecomp.sdc.be.model.Resource;
83 import org.openecomp.sdc.be.model.Service;
84 import org.openqa.selenium.WebDriver;
85 import org.openqa.selenium.WebElement;
86 import org.slf4j.Logger;
87 import org.slf4j.LoggerFactory;
88 import org.testng.Assert;
89 import org.testng.AssertJUnit;
90 import org.testng.annotations.BeforeMethod;
91 import org.testng.annotations.Optional;
92 import org.testng.annotations.Parameters;
93 import org.testng.annotations.Test;
95 public class OnboardingFlowsUi extends SetupCDTest {
97 private static final Logger LOGGER = LoggerFactory.getLogger(OnboardingFlowsUi.class);
98 private static final String NO_TESTS_ARE_AVAILABLE = "No Tests are Available";
99 private static final String NEXT_BUTTON_IS_ENABLED_IT_SHOULD_HAVE_BEEN_ENABLED =
100 "Next Button is enabled, it should have been enabled";
101 private static final String NEXT_BUTTON_IS_DISABLED_IT_SHOULD_HAVE_BEEN_ENABLED =
102 "Next Button is disabled, it should have been enabled";
103 private static final String RESULTS_ARE_NOT_AVAILABLE = "Results are not available";
104 private static final String THE_TESTS_ARE_ALREADY_SELECTED_THE_LIST_SHOULD_INITIALLY_BE_EMPTY =
105 "The tests are already selected, the list should initially be empty";
106 private static final String THE_SELECTED_TESTS_ARE_NOT_POPULATED_IN_THE_LIST =
107 "The selected tests are not populated in the list";
108 private static final String THE_SELECTED_TESTS_ARE_NOT_DELETED_FROM_THE_LIST =
109 "The selected tests are not deleted from the list";
110 private static final String NEXT_BUTTON_IS_ENABLED_IT_SHOULD_HAVE_BEEN_DISABLED =
111 "Next Button is enabled, it should have been disabled";
113 protected static String filePath = FileHandling.getVnfRepositoryPath();
114 private Boolean makeDistributionValue;
115 private WebDriver webDriver;
117 @Parameters({"makeDistribution"})
119 public void beforeTestReadParams(@Optional("true") String makeDistributionReadValue) {
120 LOGGER.debug("makeDistribution parameter is '{}'", makeDistributionReadValue);
121 makeDistributionValue = Boolean.valueOf(makeDistributionReadValue);
122 webDriver = DriverFactory.getDriver();
126 public void onboardVNFTestSanityOneFile() throws Exception {
127 String vnfFile = "1-VF-vUSP-vCCF-DB_v11.1.zip";
128 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
129 ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
130 runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, vnfFile);
134 public void performanceTest() throws Exception {
135 LOGGER.debug("Start test");
136 Long actualTestRunTime = Utils.getActionDuration(() -> {
138 onboardVNFTestSanityOneFile();
139 } catch (final Exception e) {
140 LOGGER.debug("An error has occurred during the performance test", e);
143 long regularTestRunTime = 400L;
145 assertTrue("Expected test run time should be less from " + regularTestRunTime * factor + ", actual time is " + actualTestRunTime, regularTestRunTime * factor > actualTestRunTime);
149 public void onboardVNFTestSanity() throws Exception {
150 List<String> fileNamesFromFolder = OnboardingUtils.getXnfNamesFileList(XnfTypeEnum.VNF);
151 String vnfFile = fileNamesFromFolder.get(0);
152 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
153 ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
154 runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, vnfFile);
157 @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Single_VNF")
158 public void onapOnboardVNFflow(String filePath, String vnfFile) throws Exception {
160 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
161 ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
162 runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, vnfFile);
165 @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Single_VNF")
166 public void onapOnboardVSPValidationsSanityFlow(String filePath, String vnfFile) throws Exception {
168 String vspName = createNewVSP(filePath, vnfFile);
169 if (OnboardingUiUtils.getVspValidationCongiguration()) {
170 goToVspScreen(true, vspName);
172 //check links are available
173 checkVspValidationLinksVisibility();
175 VspValidationPage.navigateToVspValidationPageUsingNavbar();
176 assertTrue(NEXT_BUTTON_IS_ENABLED_IT_SHOULD_HAVE_BEEN_DISABLED,
177 VspValidationPage.checkNextButtonDisabled());
178 VspValidationResultsPage.navigateToVspValidationResultsPageUsingNavbar();
179 GeneralUIUtils.ultimateWait();
180 assertNotNull(GeneralUIUtils.findByText("No Test Performed"));
182 goToVspScreen(true, vspName);
184 //check links are not available
185 checkVspValidationLinksInvisibility();
189 @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "softwareInformationPnf")
190 public void onboardPNFSoftwareInformationFlow(final String rootFolder, final String pnfFile,
191 final List<String> softwareVersionList) {
193 final String resourceName = ElementFactory.addRandomSuffixToName(ElementFactory.getResourcePrefix());
194 runOnboardPnfSoftwareVersion(resourceName, rootFolder, pnfFile, softwareVersionList);
197 @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Single_VNF")
198 public void onapOnboardVSPValidationsConfigurationChangeCheck(String filePath, String vnfFile) throws Exception {
200 String vspName = createNewVSP(filePath, vnfFile);
201 if (OnboardingUiUtils.getVspValidationCongiguration()) {
202 goToVspScreen(true, vspName);
203 //check links are available
204 checkVspValidationLinksVisibility();
207 changeVspValidationConfig(false, vspName, OnboardingUiUtils.getVspValidationCongiguration());
209 //check links are not available
210 checkVspValidationLinksInvisibility();
212 goToVspScreen(true, vspName);
213 //check links are not available
214 checkVspValidationLinksInvisibility();
216 changeVspValidationConfig(false, vspName, OnboardingUiUtils.getVspValidationCongiguration());
218 //check links are available
219 checkVspValidationLinksVisibility();
223 @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Single_VNF")
224 public void onapOnboardVSPCertificationQueryFlow(String filePath, String vnfFile) throws Exception {
226 String vspName = createNewVSP(filePath, vnfFile);
227 if (!OnboardingUiUtils.getVspValidationCongiguration()) {
228 //change config to true to test the feature
229 changeVspValidationConfig(true, vspName, OnboardingUiUtils.getVspValidationCongiguration());
231 goToVspScreen(true, vspName);
233 VspValidationPage.navigateToVspValidationPageUsingNavbar();
234 assertTrue(NEXT_BUTTON_IS_ENABLED_IT_SHOULD_HAVE_BEEN_DISABLED, VspValidationPage.checkNextButtonDisabled());
236 if (VspValidationPage.checkCertificationQueryExists()) {
237 VspValidationPage.clickCertificationQueryAll();
238 GeneralUIUtils.ultimateWait();
239 assertTrue(NEXT_BUTTON_IS_DISABLED_IT_SHOULD_HAVE_BEEN_ENABLED,
240 !VspValidationPage.checkNextButtonDisabled());
241 VspValidationPage.clickOnNextButton();
242 GeneralUIUtils.ultimateWait();
243 VspValidationPage.clickOnSubmitButton();
244 GeneralUIUtils.waitForLoader();
245 assertTrue(RESULTS_ARE_NOT_AVAILABLE, VspValidationResultsPage.checkResultsExist());
247 assertNotNull(GeneralUIUtils.findByText("No Certifications Query are Available"));
252 @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "Single_Vsp_Test_Csar")
253 public void onapOnboardVSPComplianceCheckFlow(String filePath, String vnfFile) throws Exception {
255 String vspName = createNewVSP(filePath, vnfFile);
256 if (!OnboardingUiUtils.getVspValidationCongiguration()) {
257 //change config to true to test the feature
258 changeVspValidationConfig(true, vspName, OnboardingUiUtils.getVspValidationCongiguration());
260 goToVspScreen(true, vspName);
263 VspValidationPage.navigateToVspValidationPageUsingNavbar();
264 assertTrue(NEXT_BUTTON_IS_ENABLED_IT_SHOULD_HAVE_BEEN_ENABLED, VspValidationPage.checkNextButtonDisabled());
265 if (VspValidationPage.checkComplianceCheckExists()) {
266 VspValidationPage.clickComplianceChecksAll();
267 GeneralUIUtils.ultimateWait();
268 assertFalse(NEXT_BUTTON_IS_DISABLED_IT_SHOULD_HAVE_BEEN_ENABLED,
269 VspValidationPage.checkNextButtonDisabled());
270 VspValidationPage.clickOnNextButton();
271 GeneralUIUtils.ultimateWait();
272 VspValidationPage.loadVSPFile(filePath, vnfFile);
273 VspValidationPage.clickOnSubmitButton();
274 GeneralUIUtils.ultimateWait();
275 assertTrue(RESULTS_ARE_NOT_AVAILABLE, VspValidationResultsPage.checkResultsExist());
277 assertNotNull(GeneralUIUtils.findByText(NO_TESTS_ARE_AVAILABLE));
282 @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Single_VNF")
283 public void onapOnboardVSPComplianceCheckOperations(String filePath, String vnfFile) throws Exception {
285 String vspName = createNewVSP(filePath, vnfFile);
286 if (!OnboardingUiUtils.getVspValidationCongiguration()) {
287 //change config to true to test the feature
288 changeVspValidationConfig(true, vspName, OnboardingUiUtils.getVspValidationCongiguration());
290 goToVspScreen(true, vspName);
293 VspValidationPage.navigateToVspValidationPageUsingNavbar();
294 assertTrue(NEXT_BUTTON_IS_ENABLED_IT_SHOULD_HAVE_BEEN_ENABLED, VspValidationPage.checkNextButtonDisabled());
295 if (VspValidationPage.checkComplianceCheckExists()) {
296 assertFalse(THE_TESTS_ARE_ALREADY_SELECTED_THE_LIST_SHOULD_INITIALLY_BE_EMPTY,
297 VspValidationPage.checkSelectedComplianceCheckExists());
298 VspValidationPage.clickComplianceChecksAll();
299 GeneralUIUtils.ultimateWait();
300 assertTrue(THE_SELECTED_TESTS_ARE_NOT_POPULATED_IN_THE_LIST,
301 VspValidationPage.checkSelectedComplianceCheckExists());
302 VspValidationPage.clickComplianceChecksAll();
303 GeneralUIUtils.ultimateWait();
304 assertFalse(THE_SELECTED_TESTS_ARE_NOT_DELETED_FROM_THE_LIST,
305 VspValidationPage.checkSelectedComplianceCheckExists());
307 assertNotNull(GeneralUIUtils.findByText(NO_TESTS_ARE_AVAILABLE));
312 @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Single_VNF")
313 public void onapOnboardVSPCertificationQueryOperations(String filePath, String vnfFile) throws Exception {
315 String vspName = createNewVSP(filePath, vnfFile);
316 if (!OnboardingUiUtils.getVspValidationCongiguration()) {
317 //change config to true to test the feature
318 changeVspValidationConfig(true, vspName, OnboardingUiUtils.getVspValidationCongiguration());
320 goToVspScreen(true, vspName);
323 VspValidationPage.navigateToVspValidationPageUsingNavbar();
324 assertTrue(NEXT_BUTTON_IS_ENABLED_IT_SHOULD_HAVE_BEEN_ENABLED, VspValidationPage.checkNextButtonDisabled());
325 if (VspValidationPage.checkCertificationQueryExists()) {
326 assertFalse(THE_TESTS_ARE_ALREADY_SELECTED_THE_LIST_SHOULD_INITIALLY_BE_EMPTY,
327 VspValidationPage.checkSelectedCertificationQueryExists());
328 VspValidationPage.clickCertificationQueryAll();
329 GeneralUIUtils.ultimateWait();
330 assertTrue(THE_SELECTED_TESTS_ARE_NOT_POPULATED_IN_THE_LIST, VspValidationPage.checkSelectedCertificationQueryExists());
331 VspValidationPage.clickCertificationQueryAll();
332 GeneralUIUtils.ultimateWait();
333 assertFalse(THE_SELECTED_TESTS_ARE_NOT_DELETED_FROM_THE_LIST,
334 VspValidationPage.checkSelectedCertificationQueryExists());
336 assertNotNull(GeneralUIUtils.findByText(NO_TESTS_ARE_AVAILABLE));
341 private void checkVspValidationLinksVisibility() {
342 //check links are available
343 assertTrue("Validation Link is not available", GeneralUIUtils.isElementVisibleByTestId(DataTestIdEnum.VspValidationPage.VSP_VALIDATION_PAGE_NAVBAR.getValue()));
344 assertTrue("Validation Results Link is not available", GeneralUIUtils.isElementVisibleByTestId(DataTestIdEnum.VspValidationResultsPage.VSP_VALIDATION_RESULTS_PAGE_NAVBAR.getValue()));
347 private void checkVspValidationLinksInvisibility() {
348 //check links not available
349 assertTrue("Validation Link is still available", GeneralUIUtils.isElementInvisibleByTestId(DataTestIdEnum.VspValidationPage.VSP_VALIDATION_PAGE_NAVBAR.getValue()));
350 assertTrue("Validation Results Link is still available", GeneralUIUtils.isElementInvisibleByTestId(DataTestIdEnum.VspValidationResultsPage.VSP_VALIDATION_RESULTS_PAGE_NAVBAR.getValue()));
353 private void changeVspValidationConfig(boolean isCurrentScreenCatalogPage, String vspName, boolean vspConfig) throws Exception {
355 OnboardingUiUtils.putVspValidationCongiguration(!vspConfig);
356 assertTrue(String.format("Failed to set Congiguration to %s", !vspConfig), OnboardingUiUtils.getVspValidationCongiguration() != vspConfig);
358 if (!isCurrentScreenCatalogPage) {
359 GeneralUIUtils.refreshWebpage();
360 GeneralUIUtils.ultimateWait();
363 goToVspScreen(isCurrentScreenCatalogPage, vspName);
366 OnboardingUiUtils.putVspValidationCongiguration(vspConfig);
367 assertEquals(String.format("Failed to revert Configuration to %s", vspConfig), vspConfig,
368 OnboardingUiUtils.getVspValidationCongiguration());
371 private void goToVspScreen(boolean isCurrentScreenCatalogPage, String vspName) {
372 if (isCurrentScreenCatalogPage) {
373 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.MainMenuButtons.ONBOARD_BUTTON.getValue());
375 GeneralUIUtils.clickOnElementByText(vspName);
376 GeneralUIUtils.ultimateWait();
379 private String createNewVSP(String filePath, String vnfFile) throws Exception {
380 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
381 return OnboardingUiUtils.createVSP(resourceReqDetails, vnfFile, filePath, getUser()).getName();
384 public void runOnboardPnfSoftwareVersion(final String resourceName, final String rootFolder,
385 final String pnfFile, final List<String> softwareVersionList) {
386 final ExtentTest extendTest = getExtendTest();
388 final String swVersionsToString = String.join(", ", softwareVersionList);
390 extendTest.log(Status.INFO,
391 String.format("Creating VSP '%s' by onboarding package '%s' with software version '%s'",
392 resourceName, pnfFile, swVersionsToString));
393 final WebDriver webDriver = DriverFactory.getDriver();
394 final CreateVspFlow createVspFlow = new CreateVspFlow(webDriver, resourceName, pnfFile, rootFolder);
395 createVspFlow.run(new TopNavComponent(webDriver));
397 final ImportVspFlow importVspFlow = new ImportVspFlow(webDriver, resourceName);
398 final ResourceCreatePage resourceCreatePage = importVspFlow.run()
399 .orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected return ResourceCreatePage"));
400 final CreateResourceFromVspFlow createResourceFlow = new CreateResourceFromVspFlow(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");
430 GeneralPageElements.clickOKButton();
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 = "CNF_List")
469 public void onboardCNFTest(String filePath, String cnfFile) throws Exception {
471 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
472 ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
473 runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, cnfFile);
476 @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "CNF_Helm_Validator_List")
477 public void onapOnboardVSPWithHelmValidationSuccessfulWithoutErrorsAndWarnings(String filePath, String cnfFile) throws Exception {
480 String vspName = createNewVSP(filePath, cnfFile);
481 goToVspScreen(true, vspName);
483 boolean isVspAttachmentValidationPage = VspValidationPage.isVspAttachmentsValidationPage();
484 if (!isVspAttachmentValidationPage) {
485 VspValidationPage.navigateToVspAttachmentsValidationPage();
488 assertTrue("Submit button should be enabled for correct helm chart",
489 VspValidationPage.isSubmitButtonEnabled());
490 assertFalse("Attachment should not have any warnings for correct helm chart",
491 VspValidationPage.hasHelmAttachmentsAnyWarnings());
492 assertFalse("Attachment should not have any error for correct helm chart",
493 VspValidationPage.hasHelmAttachmentsAnyError());
496 @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "CNF_With_Warning_Helm_Validator_List")
497 public void onapOnboardVSPWithHelmValidationSuccessfulWithWarnings(String filePath, String cnfFile) throws Exception {
499 String vspName = createNewVSP(filePath, cnfFile);
500 goToVspScreen(true, vspName);
502 boolean isVspAttachmentValidationPage = VspValidationPage.isVspAttachmentsValidationPage();
503 if (!isVspAttachmentValidationPage) {
504 VspValidationPage.navigateToVspAttachmentsValidationPage();
507 assertTrue("Submit button should be enabled for helm chart with warning",
508 VspValidationPage.isSubmitButtonEnabled());
509 assertTrue("Attachment should have warnings for helm chart with warning",
510 VspValidationPage.hasHelmAttachmentsAnyWarnings());
511 assertFalse("Attachment should not have error for helm chart with warning",
512 VspValidationPage.hasHelmAttachmentsAnyError());
515 @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "Invalid_CNF_Helm_Validator_List")
516 public void onapOnboardVSPWithHelmValidationUnsuccessfulWithErrors(String filePath, String cnfFile) throws Exception {
518 String vspName = createNewVSP(filePath, cnfFile);
519 goToVspScreen(true, vspName);
521 boolean isVspAttachmentValidationPage = VspValidationPage.isVspAttachmentsValidationPage();
522 if (!isVspAttachmentValidationPage) {
523 VspValidationPage.navigateToVspAttachmentsValidationPage();
526 assertFalse("Submit button should be disabled for helm chart with error",
527 VspValidationPage.isSubmitButtonEnabled());
528 assertTrue("Attachment should have error for helm chart with error",
529 VspValidationPage.hasHelmAttachmentsAnyError());
532 @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "Invalid_CNF_List")
533 public void onboardCNFTestShouldFailForInvalidHelmPackage(String filePath, String cnfFile) {
535 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
536 ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
537 Assert.assertThrows(() -> runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, cnfFile));
540 @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "VNF_List")
541 public void onboardVNFShotFlow(String filePath, String vnfFile) throws Exception {
543 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
544 onboardAndCertify(resourceReqDetails, filePath, vnfFile);
547 @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "randomVNF_List")
548 public void onboardRandomVNFsTest(String filePath, String vnfFile) throws Exception {
550 LOGGER.debug("Vnf File name is: {}", vnfFile);
551 ResourceReqDetails resourceReqDetails = ElementFactory.getRandomCategoryResource();
552 ServiceReqDetails serviceReqDetails = ElementFactory.getRandomCategoryService();
553 runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, vnfFile);
558 public void onboardUpdateVNFTest() throws Exception {
559 List<String> fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filePath);
560 String vnfFile = fileNamesFromFolder.get(0);
561 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
562 VendorSoftwareProductObject vsp = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, filePath, vnfFile, getUser());
563 String vspName = vsp.getName();
564 ResourceGeneralPage.clickCertifyButton(vspName);
567 ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
568 ServiceUIUtils.createService(serviceMetadata);
570 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
571 CompositionPage.searchForElement(vspName);
572 CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager();
573 CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vspName);
574 assertNotNull(vfElement);
575 ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 1, getUser());
577 if (!HomePage.navigateToHomePage()) {
578 fail("Could not go to the home page");
582 String updatedVnfFile = fileNamesFromFolder.get(1);
584 getExtendTest().log(Status.INFO, String.format("Going to update the VNF with %s......", updatedVnfFile));
585 // update VendorSoftwareProduct
586 OnboardingUiUtils.updateVnfAndValidate(filePath, vsp, updatedVnfFile, getUser());
587 ResourceGeneralPage.clickCertifyButton(vspName);
589 // replace exiting VFI in service with new updated
591 GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
592 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
593 serviceCanvasManager = CanvasManager.getCanvasManager();
594 CompositionPage.changeComponentVersion(serviceCanvasManager, vfElement, "2.0");
595 ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 1, getUser());
597 ServiceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
599 reloginWithNewRole(UserRoleEnum.TESTER);
600 GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
601 TesterOperationPage.certifyComponent(serviceMetadata.getName());
603 reloginWithNewRole(UserRoleEnum.GOVERNOR);
604 GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
605 GovernorOperationPage.approveService(serviceMetadata.getName());
608 reloginWithNewRole(UserRoleEnum.OPS);
609 GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
610 OpsOperationPage.distributeService();
611 OpsOperationPage.displayMonitor();
613 List<WebElement> rowsFromMonitorTable = OpsOperationPage.getRowsFromMonitorTable();
614 AssertJUnit.assertEquals(1, rowsFromMonitorTable.size());
616 OpsOperationPage.waitUntilArtifactsDistributed(0);
617 getExtendTest().log(Status.INFO, String.format("Onboarding %s test is passed ! ", vnfFile));
622 public void threeVMMSCsInServiceTest() throws Exception {
623 String pathFile = FileHandling.getFilePath("VmmscArtifacts");
624 final String[] list = new File(pathFile).list();
625 assertNotNull("Did not find vMMSCs", list);
626 assertFalse("Did not find vMMSCs", list.length == 0);
627 List<String> vmmscList = Arrays.stream(list).filter(e -> e.contains("vmmsc") && e.endsWith(".zip"))
628 .collect(Collectors.toList());
629 assertFalse("Did not find vMMSCs", vmmscList.isEmpty());
631 Map<String, String> vspNames = new HashMap<>();
632 for (String vnfFile : vmmscList) {
633 String msg = String.format("Going to onboard the VNF %s", vnfFile);
634 getExtendTest().log(Status.INFO, msg);
637 VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(getUser());
638 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
639 VendorSoftwareProductObject createVendorSoftwareProduct = VendorSoftwareProductRestUtils
640 .createVendorSoftwareProduct(resourceReqDetails, vnfFile, pathFile, getUser(), vendorLicenseModel);
642 getExtendTest().log(Status.INFO, String.format("Searching for onboarded %s", vnfFile));
643 HomePage.showVspRepository();
644 getExtendTest().log(Status.INFO, String.format("Going to import %s......", vnfFile.substring(0, vnfFile.indexOf("."))));
645 OnboardingUiUtils.importVSP(createVendorSoftwareProduct);
647 ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
648 DeploymentArtifactPage.verifyArtifactsExistInTable(pathFile, vnfFile);
650 String vspName = createVendorSoftwareProduct.getName();
651 DeploymentArtifactPage.clickCertifyButton(vspName);
652 vspNames.put(vnfFile, vspName);
656 ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
657 ServiceUIUtils.createService(serviceMetadata);
658 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
659 CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager();
661 for (String vsp : vspNames.values()) {
662 CompositionPage.searchForElement(vsp);
663 CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vsp);
664 assertNotNull(vfElement);
666 ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", vspNames.values().size(), getUser());
667 File imageFilePath = GeneralUIUtils.takeScreenshot(null, SetupCDTest.getScreenshotFolder(), "Info_" + getExtendTest().getModel().getName());
668 final String absolutePath = new File(SetupCDTest.getReportFolder()).toURI().relativize(imageFilePath.toURI()).getPath();
669 SetupCDTest.getExtendTest().log(Status.INFO, "Three kinds of vMMSC are in canvas now." + getExtendTest().addScreenCaptureFromPath(absolutePath));
671 ServiceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
673 reloginWithNewRole(UserRoleEnum.TESTER);
674 GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
675 TesterOperationPage.certifyComponent(serviceMetadata.getName());
677 reloginWithNewRole(UserRoleEnum.GOVERNOR);
678 GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
679 GovernorOperationPage.approveService(serviceMetadata.getName());
681 reloginWithNewRole(UserRoleEnum.OPS);
682 GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
683 OpsOperationPage.distributeService();
684 OpsOperationPage.displayMonitor();
686 List<WebElement> rowsFromMonitorTable = OpsOperationPage.getRowsFromMonitorTable();
687 AssertJUnit.assertEquals(1, rowsFromMonitorTable.size());
689 OpsOperationPage.waitUntilArtifactsDistributed(0);