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.Status;
31 import java.util.Arrays;
32 import java.util.HashMap;
33 import java.util.List;
35 import java.util.stream.Collectors;
36 import org.openecomp.sdc.ci.tests.data.providers.OnboardingDataProviders;
37 import org.openecomp.sdc.ci.tests.dataProvider.OnbordingDataProviders;
38 import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
39 import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
40 import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
41 import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
42 import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
43 import org.openecomp.sdc.ci.tests.datatypes.VendorLicenseModel;
44 import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject;
45 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
46 import org.openecomp.sdc.ci.tests.datatypes.enums.XnfTypeEnum;
47 import org.openecomp.sdc.ci.tests.execute.setup.ArtifactsCorrelationManager;
48 import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
49 import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
50 import org.openecomp.sdc.ci.tests.pages.CompositionPage;
51 import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
52 import org.openecomp.sdc.ci.tests.pages.GovernorOperationPage;
53 import org.openecomp.sdc.ci.tests.pages.HomePage;
54 import org.openecomp.sdc.ci.tests.pages.HomePage.PageElement;
55 import org.openecomp.sdc.ci.tests.pages.OpsOperationPage;
56 import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
57 import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage;
58 import org.openecomp.sdc.ci.tests.pages.TesterOperationPage;
59 import org.openecomp.sdc.ci.tests.pages.VspValidationPage;
60 import org.openecomp.sdc.ci.tests.pages.VspValidationResultsPage;
61 import org.openecomp.sdc.ci.tests.utilities.FileHandling;
62 import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
63 import org.openecomp.sdc.ci.tests.utilities.OnboardingUiUtils;
64 import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
65 import org.openecomp.sdc.ci.tests.utils.Utils;
66 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
67 import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils;
68 import org.openecomp.sdc.ci.tests.utils.general.VendorLicenseModelRestUtils;
69 import org.openecomp.sdc.ci.tests.utils.general.VendorSoftwareProductRestUtils;
70 import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator;
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;
80 public class OnboardingFlowsUi extends SetupCDTest {
82 private static final Logger LOGGER = LoggerFactory.getLogger(OnboardingFlowsUi.class);
83 private static final String NO_TESTS_ARE_AVAILABLE = "No Tests are Available";
84 private static final String NEXT_BUTTON_IS_ENABLED_IT_SHOULD_HAVE_BEEN_ENABLED =
85 "Next Button is enabled, it should have been enabled";
86 private static final String NEXT_BUTTON_IS_DISABLED_IT_SHOULD_HAVE_BEEN_ENABLED =
87 "Next Button is disabled, it should have been enabled";
88 private static final String RESULTS_ARE_NOT_AVAILABLE = "Results are not available";
89 private static final String THE_TESTS_ARE_ALREADY_SELECTED_THE_LIST_SHOULD_INITIALLY_BE_EMPTY =
90 "The tests are already selected, the list should initially be empty";
91 private static final String THE_SELECTED_TESTS_ARE_NOT_POPULATED_IN_THE_LIST =
92 "The selected tests are not populated in the list";
93 private static final String THE_SELECTED_TESTS_ARE_NOT_DELETED_FROM_THE_LIST =
94 "The selected tests are not deleted from the list";
95 private static final String NEXT_BUTTON_IS_ENABLED_IT_SHOULD_HAVE_BEEN_DISABLED =
96 "Next Button is enabled, it should have been disabled";
98 protected static String filePath = FileHandling.getVnfRepositoryPath();
99 private Boolean makeDistributionValue;
101 @Parameters({"makeDistribution"})
103 public void beforeTestReadParams(@Optional("true") String makeDistributionReadValue) {
104 LOGGER.debug("makeDistribution parameter is '{}'", makeDistributionReadValue);
105 makeDistributionValue = Boolean.valueOf(makeDistributionReadValue);
109 public void onboardVNFTestSanityOneFile() throws Exception {
110 String vnfFile = "1-VF-vUSP-vCCF-DB_v11.1.zip";
111 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
112 ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
113 runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, vnfFile);
117 public void performanceTest() throws Exception {
118 LOGGER.debug("Start test");
119 Long actualTestRunTime = Utils.getActionDuration(() -> {
121 onboardVNFTestSanityOneFile();
122 } catch (final Exception e) {
123 LOGGER.debug("An error has occurred during the performance test", e);
126 long regularTestRunTime = 400L;
128 assertTrue("Expected test run time should be less from " + regularTestRunTime * factor + ", actual time is " + actualTestRunTime, regularTestRunTime * factor > actualTestRunTime);
132 public void onboardVNFTestSanity() throws Exception {
133 List<String> fileNamesFromFolder = OnboardingUtils.getXnfNamesFileList(XnfTypeEnum.VNF);
134 String vnfFile = fileNamesFromFolder.get(0);
135 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
136 ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
137 runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, vnfFile);
140 @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Single_VNF")
141 public void onapOnboardVNFflow(String filePath, String vnfFile) throws Exception {
143 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
144 ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
145 runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, vnfFile);
148 @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Single_VNF")
149 public void onapOnboardVSPValidationsSanityFlow(String filePath, String vnfFile) throws Exception {
151 String vspName = createNewVSP(filePath, vnfFile);
152 if (OnboardingUiUtils.getVspValidationCongiguration()) {
153 goToVspScreen(true, vspName);
155 //check links are available
156 checkVspValidationLinksVisibility();
158 VspValidationPage.navigateToVspValidationPageUsingNavbar();
159 assertTrue(NEXT_BUTTON_IS_ENABLED_IT_SHOULD_HAVE_BEEN_DISABLED,
160 VspValidationPage.checkNextButtonDisabled());
161 VspValidationResultsPage.navigateToVspValidationResultsPageUsingNavbar();
162 GeneralUIUtils.ultimateWait();
163 assertNotNull(GeneralUIUtils.findByText("No Test Performed"));
165 goToVspScreen(true, vspName);
167 //check links are not available
168 checkVspValidationLinksInvisibility();
172 @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Single_VNF")
173 public void onapOnboardVSPValidationsConfigurationChangeCheck(String filePath, String vnfFile) throws Exception {
175 String vspName = createNewVSP(filePath, vnfFile);
176 if (OnboardingUiUtils.getVspValidationCongiguration()) {
177 goToVspScreen(true, vspName);
178 //check links are available
179 checkVspValidationLinksVisibility();
182 changeVspValidationConfig(false, vspName, OnboardingUiUtils.getVspValidationCongiguration());
184 //check links are not available
185 checkVspValidationLinksInvisibility();
187 goToVspScreen(true, vspName);
188 //check links are not available
189 checkVspValidationLinksInvisibility();
191 changeVspValidationConfig(false, vspName, OnboardingUiUtils.getVspValidationCongiguration());
193 //check links are available
194 checkVspValidationLinksVisibility();
198 @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Single_VNF")
199 public void onapOnboardVSPCertificationQueryFlow(String filePath, String vnfFile) throws Exception {
201 String vspName = createNewVSP(filePath, vnfFile);
202 if (!OnboardingUiUtils.getVspValidationCongiguration()) {
203 //change config to true to test the feature
204 changeVspValidationConfig(true, vspName, OnboardingUiUtils.getVspValidationCongiguration());
206 goToVspScreen(true, vspName);
208 VspValidationPage.navigateToVspValidationPageUsingNavbar();
209 assertTrue(NEXT_BUTTON_IS_ENABLED_IT_SHOULD_HAVE_BEEN_DISABLED, VspValidationPage.checkNextButtonDisabled());
211 if (VspValidationPage.checkCertificationQueryExists()) {
212 VspValidationPage.clickCertificationQueryAll();
213 GeneralUIUtils.ultimateWait();
214 assertTrue(NEXT_BUTTON_IS_DISABLED_IT_SHOULD_HAVE_BEEN_ENABLED,
215 !VspValidationPage.checkNextButtonDisabled());
216 VspValidationPage.clickOnNextButton();
217 GeneralUIUtils.ultimateWait();
218 VspValidationPage.clickOnSubmitButton();
219 GeneralUIUtils.waitForLoader();
220 assertTrue(RESULTS_ARE_NOT_AVAILABLE, VspValidationResultsPage.checkResultsExist());
222 assertNotNull(GeneralUIUtils.findByText("No Certifications Query are Available"));
227 @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "Single_Vsp_Test_Csar")
228 public void onapOnboardVSPComplianceCheckFlow(String filePath, String vnfFile) throws Exception {
230 String vspName = createNewVSP(filePath, vnfFile);
231 if (!OnboardingUiUtils.getVspValidationCongiguration()) {
232 //change config to true to test the feature
233 changeVspValidationConfig(true, vspName, OnboardingUiUtils.getVspValidationCongiguration());
235 goToVspScreen(true, vspName);
238 VspValidationPage.navigateToVspValidationPageUsingNavbar();
239 assertTrue(NEXT_BUTTON_IS_ENABLED_IT_SHOULD_HAVE_BEEN_ENABLED, VspValidationPage.checkNextButtonDisabled());
240 if (VspValidationPage.checkComplianceCheckExists()) {
241 VspValidationPage.clickComplianceChecksAll();
242 GeneralUIUtils.ultimateWait();
243 assertFalse(NEXT_BUTTON_IS_DISABLED_IT_SHOULD_HAVE_BEEN_ENABLED,
244 VspValidationPage.checkNextButtonDisabled());
245 VspValidationPage.clickOnNextButton();
246 GeneralUIUtils.ultimateWait();
247 VspValidationPage.loadVSPFile(filePath, vnfFile);
248 VspValidationPage.clickOnSubmitButton();
249 GeneralUIUtils.ultimateWait();
250 assertTrue(RESULTS_ARE_NOT_AVAILABLE, VspValidationResultsPage.checkResultsExist());
252 assertNotNull(GeneralUIUtils.findByText(NO_TESTS_ARE_AVAILABLE));
257 @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Single_VNF")
258 public void onapOnboardVSPComplianceCheckOperations(String filePath, String vnfFile) throws Exception {
260 String vspName = createNewVSP(filePath, vnfFile);
261 if (!OnboardingUiUtils.getVspValidationCongiguration()) {
262 //change config to true to test the feature
263 changeVspValidationConfig(true, vspName, OnboardingUiUtils.getVspValidationCongiguration());
265 goToVspScreen(true, vspName);
268 VspValidationPage.navigateToVspValidationPageUsingNavbar();
269 assertTrue(NEXT_BUTTON_IS_ENABLED_IT_SHOULD_HAVE_BEEN_ENABLED, VspValidationPage.checkNextButtonDisabled());
270 if (VspValidationPage.checkComplianceCheckExists()) {
271 assertFalse(THE_TESTS_ARE_ALREADY_SELECTED_THE_LIST_SHOULD_INITIALLY_BE_EMPTY,
272 VspValidationPage.checkSelectedComplianceCheckExists());
273 VspValidationPage.clickComplianceChecksAll();
274 GeneralUIUtils.ultimateWait();
275 assertTrue(THE_SELECTED_TESTS_ARE_NOT_POPULATED_IN_THE_LIST,
276 VspValidationPage.checkSelectedComplianceCheckExists());
277 VspValidationPage.clickComplianceChecksAll();
278 GeneralUIUtils.ultimateWait();
279 assertFalse(THE_SELECTED_TESTS_ARE_NOT_DELETED_FROM_THE_LIST,
280 VspValidationPage.checkSelectedComplianceCheckExists());
282 assertNotNull(GeneralUIUtils.findByText(NO_TESTS_ARE_AVAILABLE));
287 @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Single_VNF")
288 public void onapOnboardVSPCertificationQueryOperations(String filePath, String vnfFile) throws Exception {
290 String vspName = createNewVSP(filePath, vnfFile);
291 if (!OnboardingUiUtils.getVspValidationCongiguration()) {
292 //change config to true to test the feature
293 changeVspValidationConfig(true, vspName, OnboardingUiUtils.getVspValidationCongiguration());
295 goToVspScreen(true, vspName);
298 VspValidationPage.navigateToVspValidationPageUsingNavbar();
299 assertTrue(NEXT_BUTTON_IS_ENABLED_IT_SHOULD_HAVE_BEEN_ENABLED, VspValidationPage.checkNextButtonDisabled());
300 if (VspValidationPage.checkCertificationQueryExists()) {
301 assertFalse(THE_TESTS_ARE_ALREADY_SELECTED_THE_LIST_SHOULD_INITIALLY_BE_EMPTY,
302 VspValidationPage.checkSelectedCertificationQueryExists());
303 VspValidationPage.clickCertificationQueryAll();
304 GeneralUIUtils.ultimateWait();
305 assertTrue(THE_SELECTED_TESTS_ARE_NOT_POPULATED_IN_THE_LIST, VspValidationPage.checkSelectedCertificationQueryExists());
306 VspValidationPage.clickCertificationQueryAll();
307 GeneralUIUtils.ultimateWait();
308 assertFalse(THE_SELECTED_TESTS_ARE_NOT_DELETED_FROM_THE_LIST,
309 VspValidationPage.checkSelectedCertificationQueryExists());
311 assertNotNull(GeneralUIUtils.findByText(NO_TESTS_ARE_AVAILABLE));
316 private void checkVspValidationLinksVisibility() {
317 //check links are available
318 assertTrue("Validation Link is not available", GeneralUIUtils.isElementVisibleByTestId(DataTestIdEnum.VspValidationPage.VSP_VALIDATION_PAGE_NAVBAR.getValue()));
319 assertTrue("Validation Results Link is not available", GeneralUIUtils.isElementVisibleByTestId(DataTestIdEnum.VspValidationResultsPage.VSP_VALIDATION_RESULTS_PAGE_NAVBAR.getValue()));
322 private void checkVspValidationLinksInvisibility() {
323 //check links not available
324 assertTrue("Validation Link is still available", GeneralUIUtils.isElementInvisibleByTestId(DataTestIdEnum.VspValidationPage.VSP_VALIDATION_PAGE_NAVBAR.getValue()));
325 assertTrue("Validation Results Link is still available", GeneralUIUtils.isElementInvisibleByTestId(DataTestIdEnum.VspValidationResultsPage.VSP_VALIDATION_RESULTS_PAGE_NAVBAR.getValue()));
328 private void changeVspValidationConfig(boolean isCurrentScreenCatalogPage, String vspName, boolean vspConfig) throws Exception {
330 OnboardingUiUtils.putVspValidationCongiguration(!vspConfig);
331 assertTrue(String.format("Failed to set Congiguration to %s", !vspConfig), OnboardingUiUtils.getVspValidationCongiguration() != vspConfig);
333 if (!isCurrentScreenCatalogPage) {
334 GeneralUIUtils.refreshWebpage();
335 GeneralUIUtils.ultimateWait();
338 goToVspScreen(isCurrentScreenCatalogPage, vspName);
341 OnboardingUiUtils.putVspValidationCongiguration(vspConfig);
342 assertEquals(String.format("Failed to revert Configuration to %s", vspConfig), vspConfig,
343 OnboardingUiUtils.getVspValidationCongiguration());
346 private void goToVspScreen(boolean isCurrentScreenCatalogPage, String vspName) {
347 if (isCurrentScreenCatalogPage) {
348 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.MainMenuButtons.ONBOARD_BUTTON.getValue());
350 GeneralUIUtils.clickOnElementByText(vspName);
351 GeneralUIUtils.ultimateWait();
354 private String createNewVSP(String filePath, String vnfFile) throws Exception {
355 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
356 return OnboardingUiUtils.createVSP(resourceReqDetails, vnfFile, filePath, getUser()).getName();
359 private void runOnboardToDistributionFlow(ResourceReqDetails resourceReqDetails, ServiceReqDetails serviceMetadata, String filePath, String vnfFile) throws Exception {
360 getExtendTest().log(Status.INFO, "Going to create resource with category: " + resourceReqDetails.getCategories().get(0).getName()
361 + " subCategory: " + resourceReqDetails.getCategories().get(0).getSubcategories().get(0).getName()
362 + " and service category: " + serviceMetadata.getCategory());
363 final String vspName = onboardAndCertify(resourceReqDetails, filePath, vnfFile);
365 ServiceUIUtils.createService(serviceMetadata);
367 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
368 CompositionPage.searchForElement(vspName);
369 final CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager();
370 final CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vspName);
371 ArtifactsCorrelationManager.addVNFtoServiceArtifactCorrelation(serviceMetadata.getName(), vspName);
373 assertNotNull(vfElement);
374 ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 1, getUser());
375 ExtentTestActions.addScreenshot(Status.INFO, "ServiceComposition_" + vnfFile, "The service topology is as follows: ");
377 ServiceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
379 reloginWithNewRole(UserRoleEnum.TESTER);
380 GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
381 TesterOperationPage.certifyComponent(serviceMetadata.getName());
383 reloginWithNewRole(UserRoleEnum.GOVERNOR);
384 HomePage.waitForElement(PageElement.COMPONENT_PANEL);
385 HomePage.findComponentAndClick(serviceMetadata.getName());
386 GovernorOperationPage.approveService(serviceMetadata.getName());
388 runDistributionFlow(serviceMetadata);
390 getExtendTest().log(Status.INFO, String.format("Successfully onboarded the package '%s'", vnfFile));
393 private void runDistributionFlow(final ServiceReqDetails serviceMetadata) throws Exception {
394 if (makeDistributionValue) {
395 reloginWithNewRole(UserRoleEnum.OPS);
396 GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
397 OpsOperationPage.distributeService();
398 OpsOperationPage.displayMonitor();
400 final List<WebElement> rowsFromMonitorTable = OpsOperationPage.getRowsFromMonitorTable();
401 AssertJUnit.assertEquals(1, rowsFromMonitorTable.size());
403 OpsOperationPage.waitUntilArtifactsDistributed(0);
407 private String onboardAndCertify(ResourceReqDetails resourceReqDetails, String filePath, String vnfFile) throws Exception {
408 VendorSoftwareProductObject onboardAndValidate = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, filePath, vnfFile, getUser());
409 String vspName = onboardAndValidate.getName();
411 DeploymentArtifactPage.getLeftPanel().moveToCompositionScreen();
412 ExtentTestActions.addScreenshot(Status.INFO, "TopologyTemplate_" + vnfFile, "The topology template for " + vnfFile + " is as follows : ");
414 DeploymentArtifactPage.clickCertifyButton(vspName);
419 @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "VNF_List")
420 public void onboardVNFTest(String filePath, String vnfFile) throws Exception {
422 ResourceReqDetails resourceReqDetails = ElementFactory.getRandomCategoryResource();
423 ServiceReqDetails serviceReqDetails = ElementFactory.getRandomCategoryService();
424 runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, vnfFile);
427 @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "VNF_List")
428 public void onboardVNFShotFlow(String filePath, String vnfFile) throws Exception {
430 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
431 onboardAndCertify(resourceReqDetails, filePath, vnfFile);
434 @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "randomVNF_List")
435 public void onboardRandomVNFsTest(String filePath, String vnfFile) throws Exception {
437 LOGGER.debug("Vnf File name is: {}", vnfFile);
438 ResourceReqDetails resourceReqDetails = ElementFactory.getRandomCategoryResource();
439 ServiceReqDetails serviceReqDetails = ElementFactory.getRandomCategoryService();
440 runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, vnfFile);
445 public void onboardUpdateVNFTest() throws Exception {
446 List<String> fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filePath);
447 String vnfFile = fileNamesFromFolder.get(0);
448 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
449 VendorSoftwareProductObject vsp = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, filePath, vnfFile, getUser());
450 String vspName = vsp.getName();
451 ResourceGeneralPage.clickCertifyButton(vspName);
454 ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
455 ServiceUIUtils.createService(serviceMetadata);
457 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
458 CompositionPage.searchForElement(vspName);
459 CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager();
460 CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vspName);
461 assertNotNull(vfElement);
462 ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 1, getUser());
464 if (!HomePage.navigateToHomePage()) {
465 fail("Could not go to the home page");
469 String updatedVnfFile = fileNamesFromFolder.get(1);
471 getExtendTest().log(Status.INFO, String.format("Going to update the VNF with %s......", updatedVnfFile));
472 // update VendorSoftwareProduct
473 OnboardingUiUtils.updateVnfAndValidate(filePath, vsp, updatedVnfFile, getUser());
474 ResourceGeneralPage.clickCertifyButton(vspName);
476 // replace exiting VFI in service with new updated
478 GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
479 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
480 serviceCanvasManager = CanvasManager.getCanvasManager();
481 CompositionPage.changeComponentVersion(serviceCanvasManager, vfElement, "2.0");
482 ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 1, getUser());
484 ServiceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
486 reloginWithNewRole(UserRoleEnum.TESTER);
487 GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
488 TesterOperationPage.certifyComponent(serviceMetadata.getName());
490 reloginWithNewRole(UserRoleEnum.GOVERNOR);
491 GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
492 GovernorOperationPage.approveService(serviceMetadata.getName());
495 reloginWithNewRole(UserRoleEnum.OPS);
496 GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
497 OpsOperationPage.distributeService();
498 OpsOperationPage.displayMonitor();
500 List<WebElement> rowsFromMonitorTable = OpsOperationPage.getRowsFromMonitorTable();
501 AssertJUnit.assertEquals(1, rowsFromMonitorTable.size());
503 OpsOperationPage.waitUntilArtifactsDistributed(0);
504 getExtendTest().log(Status.INFO, String.format("Onboarding %s test is passed ! ", vnfFile));
509 public void threeVMMSCsInServiceTest() throws Exception {
510 String pathFile = FileHandling.getFilePath("VmmscArtifacts");
511 final String[] list = new File(pathFile).list();
512 assertNotNull("Did not find vMMSCs", list);
513 assertFalse("Did not find vMMSCs", list.length == 0);
514 List<String> vmmscList = Arrays.stream(list).filter(e -> e.contains("vmmsc") && e.endsWith(".zip"))
515 .collect(Collectors.toList());
516 assertFalse("Did not find vMMSCs", vmmscList.isEmpty());
518 Map<String, String> vspNames = new HashMap<>();
519 for (String vnfFile : vmmscList) {
520 String msg = String.format("Going to onboard the VNF %s", vnfFile);
521 getExtendTest().log(Status.INFO, msg);
524 VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(getUser());
525 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
526 VendorSoftwareProductObject createVendorSoftwareProduct = VendorSoftwareProductRestUtils
527 .createVendorSoftwareProduct(resourceReqDetails, vnfFile, pathFile, getUser(), vendorLicenseModel);
529 getExtendTest().log(Status.INFO, String.format("Searching for onboarded %s", vnfFile));
530 HomePage.showVspRepository();
531 getExtendTest().log(Status.INFO, String.format("Going to import %s......", vnfFile.substring(0, vnfFile.indexOf("."))));
532 OnboardingUiUtils.importVSP(createVendorSoftwareProduct);
534 ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
535 DeploymentArtifactPage.verifyArtifactsExistInTable(pathFile, vnfFile);
537 String vspName = createVendorSoftwareProduct.getName();
538 DeploymentArtifactPage.clickCertifyButton(vspName);
539 vspNames.put(vnfFile, vspName);
543 ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
544 ServiceUIUtils.createService(serviceMetadata);
545 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
546 CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager();
548 for (String vsp : vspNames.values()) {
549 CompositionPage.searchForElement(vsp);
550 CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vsp);
551 assertNotNull(vfElement);
553 ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", vspNames.values().size(), getUser());
554 File imageFilePath = GeneralUIUtils.takeScreenshot(null, SetupCDTest.getScreenshotFolder(), "Info_" + getExtendTest().getModel().getName());
555 final String absolutePath = new File(SetupCDTest.getReportFolder()).toURI().relativize(imageFilePath.toURI()).getPath();
556 SetupCDTest.getExtendTest().log(Status.INFO, "Three kinds of vMMSC are in canvas now." + getExtendTest().addScreenCaptureFromPath(absolutePath));
558 ServiceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
560 reloginWithNewRole(UserRoleEnum.TESTER);
561 GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
562 TesterOperationPage.certifyComponent(serviceMetadata.getName());
564 reloginWithNewRole(UserRoleEnum.GOVERNOR);
565 GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
566 GovernorOperationPage.approveService(serviceMetadata.getName());
568 reloginWithNewRole(UserRoleEnum.OPS);
569 GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
570 OpsOperationPage.distributeService();
571 OpsOperationPage.displayMonitor();
573 List<WebElement> rowsFromMonitorTable = OpsOperationPage.getRowsFromMonitorTable();
574 AssertJUnit.assertEquals(1, rowsFromMonitorTable.size());
576 OpsOperationPage.waitUntilArtifactsDistributed(0);
581 protected UserRoleEnum getRole() {
582 return UserRoleEnum.DESIGNER;