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);
84 protected static String filePath = FileHandling.getVnfRepositoryPath();
85 private Boolean makeDistributionValue;
87 @Parameters({"makeDistribution"})
89 public void beforeTestReadParams(@Optional("true") String makeDistributionReadValue) {
90 LOGGER.debug("makeDistribution parameter is '{}'", makeDistributionReadValue);
91 makeDistributionValue = Boolean.valueOf(makeDistributionReadValue);
95 public void onboardVNFTestSanityOneFile() throws Exception {
96 String vnfFile = "1-VF-vUSP-vCCF-DB_v11.1.zip";
97 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
98 ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
99 runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, vnfFile);
103 public void performanceTest() throws Exception {
104 LOGGER.debug("Start test");
105 Long actualTestRunTime = Utils.getActionDuration(() -> {
107 onboardVNFTestSanityOneFile();
108 } catch (final Exception e) {
109 LOGGER.debug("An error has occurred during the performance test", e);
112 long regularTestRunTime = 400L;
114 assertTrue("Expected test run time should be less from " + regularTestRunTime * factor + ", actual time is " + actualTestRunTime, regularTestRunTime * factor > actualTestRunTime);
118 public void onboardVNFTestSanity() throws Exception {
119 List<String> fileNamesFromFolder = OnboardingUtils.getXnfNamesFileList(XnfTypeEnum.VNF);
120 String vnfFile = fileNamesFromFolder.get(0);
121 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
122 ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
123 runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, vnfFile);
126 @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Single_VNF")
127 public void onapOnboardVNFflow(String filePath, String vnfFile) throws Exception {
129 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
130 ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
131 runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, vnfFile);
134 @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Single_VNF")
135 public void onapOnboardVSPValidationsSanityFlow(String filePath, String vnfFile) throws Exception {
137 String vspName = createNewVSP(filePath, vnfFile);
138 if (OnboardingUiUtils.getVspValidationCongiguration()) {
139 goToVspScreen(true, vspName);
141 //check links are available
142 checkVspValidationLinksVisibility();
144 VspValidationPage.navigateToVspValidationPageUsingNavbar();
145 assertTrue("Next Button is enabled, it should have been disabled", VspValidationPage.checkNextButtonDisabled());
146 VspValidationResultsPage.navigateToVspValidationResultsPageUsingNavbar();
147 GeneralUIUtils.ultimateWait();
148 assertNotNull(GeneralUIUtils.findByText("No Validation Checks Performed"));
150 goToVspScreen(true, vspName);
152 //check links are not available
153 checkVspValidationLinksInvisibility();
157 @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Single_VNF")
158 public void onapOnboardVSPValidationsConfigurationChangeCheck(String filePath, String vnfFile) throws Exception {
160 String vspName = createNewVSP(filePath, vnfFile);
161 if (OnboardingUiUtils.getVspValidationCongiguration()) {
162 goToVspScreen(true, vspName);
163 //check links are available
164 checkVspValidationLinksVisibility();
167 changeVspValidationConfig(false, vspName, OnboardingUiUtils.getVspValidationCongiguration());
169 //check links are not available
170 checkVspValidationLinksInvisibility();
172 goToVspScreen(true, vspName);
173 //check links are not available
174 checkVspValidationLinksInvisibility();
176 changeVspValidationConfig(false, vspName, OnboardingUiUtils.getVspValidationCongiguration());
178 //check links are available
179 checkVspValidationLinksVisibility();
183 @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Single_VNF")
184 public void onapOnboardVSPCertificationQueryFlow(String filePath, String vnfFile) throws Exception {
186 String vspName = createNewVSP(filePath, vnfFile);
187 if (!OnboardingUiUtils.getVspValidationCongiguration()) {
188 //change config to true to test the feature
189 changeVspValidationConfig(true, vspName, OnboardingUiUtils.getVspValidationCongiguration());
191 goToVspScreen(true, vspName);
193 VspValidationPage.navigateToVspValidationPageUsingNavbar();
194 assertTrue("Next Button is enabled, it should have been disabled", VspValidationPage.checkNextButtonDisabled());
196 if (VspValidationPage.checkCertificationQueryExists()) {
197 VspValidationPage.clickCertificationQueryAll();
198 GeneralUIUtils.ultimateWait();
199 assertTrue("Next Button is disabled, it should have been enabled", !VspValidationPage.checkNextButtonDisabled());
200 VspValidationPage.clickOnNextButton();
201 GeneralUIUtils.ultimateWait();
202 VspValidationPage.clickOnSubmitButton();
203 GeneralUIUtils.waitForLoader();
204 assertTrue("Results are not available", VspValidationResultsPage.checkResultsExist());
206 assertNotNull(GeneralUIUtils.findByText("No Certifications Query are Available"));
211 @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Single_VNF")
212 public void onapOnboardVSPComplianceCheckFlow(String filePath, String vnfFile) throws Exception {
214 String vspName = createNewVSP(filePath, vnfFile);
215 final String complianceNotAvailableLabel = "No Compliance Checks are Available";
216 if (!OnboardingUiUtils.getVspValidationCongiguration()) {
217 //change config to true to test the feature
218 changeVspValidationConfig(true, vspName, OnboardingUiUtils.getVspValidationCongiguration());
220 goToVspScreen(true, vspName);
223 VspValidationPage.navigateToVspValidationPageUsingNavbar();
224 assertTrue("Next Button is enabled, it should have been enabled", VspValidationPage.checkNextButtonDisabled());
225 if (VspValidationPage.checkComplianceCheckExists()) {
226 VspValidationPage.clickComplianceChecksAll();
227 GeneralUIUtils.ultimateWait();
228 assertFalse("Next Button is disabled, it should have been enabled",
229 VspValidationPage.checkNextButtonDisabled());
230 VspValidationPage.clickOnNextButton();
231 GeneralUIUtils.ultimateWait();
232 VspValidationPage.clickOnSubmitButton();
233 GeneralUIUtils.ultimateWait();
234 assertTrue("Results are not available", VspValidationResultsPage.checkResultsExist());
236 assertNotNull(GeneralUIUtils.findByText(complianceNotAvailableLabel));
241 @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Single_VNF")
242 public void onapOnboardVSPComplianceCheckOperations(String filePath, String vnfFile) throws Exception {
244 String vspName = createNewVSP(filePath, vnfFile);
245 if (!OnboardingUiUtils.getVspValidationCongiguration()) {
246 //change config to true to test the feature
247 changeVspValidationConfig(true, vspName, OnboardingUiUtils.getVspValidationCongiguration());
249 goToVspScreen(true, vspName);
252 VspValidationPage.navigateToVspValidationPageUsingNavbar();
253 assertTrue("Next Button is enabled, it should have been enabled", VspValidationPage.checkNextButtonDisabled());
254 if (VspValidationPage.checkComplianceCheckExists()) {
255 assertFalse("The tests are already selected, the list should initially be empty",
256 VspValidationPage.checkSelectedComplianceCheckExists());
257 VspValidationPage.clickComplianceChecksAll();
258 GeneralUIUtils.ultimateWait();
259 assertTrue("The selected tests are not populated in the list", VspValidationPage.checkSelectedComplianceCheckExists());
260 VspValidationPage.clickComplianceChecksAll();
261 GeneralUIUtils.ultimateWait();
262 assertFalse("The selected tests are not deleted from the list",
263 VspValidationPage.checkSelectedComplianceCheckExists());
265 assertNotNull(GeneralUIUtils.findByText("No Compliance Checks are Available"));
270 @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Single_VNF")
271 public void onapOnboardVSPCertificationQueryOperations(String filePath, String vnfFile) throws Exception {
273 String vspName = createNewVSP(filePath, vnfFile);
274 if (!OnboardingUiUtils.getVspValidationCongiguration()) {
275 //change config to true to test the feature
276 changeVspValidationConfig(true, vspName, OnboardingUiUtils.getVspValidationCongiguration());
278 goToVspScreen(true, vspName);
281 VspValidationPage.navigateToVspValidationPageUsingNavbar();
282 assertTrue("Next Button is enabled, it should have been enabled", VspValidationPage.checkNextButtonDisabled());
283 if (VspValidationPage.checkCertificationQueryExists()) {
284 assertFalse("The tests are already selected, the list should initially be empty",
285 VspValidationPage.checkSelectedCertificationQueryExists());
286 VspValidationPage.clickCertificationQueryAll();
287 GeneralUIUtils.ultimateWait();
288 assertTrue("The selected tests are not populated in the list", VspValidationPage.checkSelectedCertificationQueryExists());
289 VspValidationPage.clickCertificationQueryAll();
290 GeneralUIUtils.ultimateWait();
291 assertFalse("The selected tests are not deleted from the list",
292 VspValidationPage.checkSelectedCertificationQueryExists());
294 assertNotNull(GeneralUIUtils.findByText("No Compliance Checks are Available"));
299 private void checkVspValidationLinksVisibility() {
300 //check links are available
301 assertTrue("Validation Link is not available", GeneralUIUtils.isElementVisibleByTestId(DataTestIdEnum.VspValidationPage.VSP_VALIDATION_PAGE_NAVBAR.getValue()));
302 assertTrue("Validation Results Link is not available", GeneralUIUtils.isElementVisibleByTestId(DataTestIdEnum.VspValidationResultsPage.VSP_VALIDATION_RESULTS_PAGE_NAVBAR.getValue()));
305 private void checkVspValidationLinksInvisibility() {
306 //check links not available
307 assertTrue("Validation Link is still available", GeneralUIUtils.isElementInvisibleByTestId(DataTestIdEnum.VspValidationPage.VSP_VALIDATION_PAGE_NAVBAR.getValue()));
308 assertTrue("Validation Results Link is still available", GeneralUIUtils.isElementInvisibleByTestId(DataTestIdEnum.VspValidationResultsPage.VSP_VALIDATION_RESULTS_PAGE_NAVBAR.getValue()));
311 private void changeVspValidationConfig(boolean isCurrentScreenCatalogPage, String vspName, boolean vspConfig) throws Exception {
313 OnboardingUiUtils.putVspValidationCongiguration(!vspConfig);
314 assertTrue(String.format("Failed to set Congiguration to %s", !vspConfig), OnboardingUiUtils.getVspValidationCongiguration() != vspConfig);
316 if (!isCurrentScreenCatalogPage) {
317 GeneralUIUtils.refreshWebpage();
318 GeneralUIUtils.ultimateWait();
321 goToVspScreen(isCurrentScreenCatalogPage, vspName);
324 OnboardingUiUtils.putVspValidationCongiguration(vspConfig);
325 assertEquals(String.format("Failed to revert Configuration to %s", vspConfig), vspConfig,
326 OnboardingUiUtils.getVspValidationCongiguration());
329 private void goToVspScreen(boolean isCurrentScreenCatalogPage, String vspName) {
330 if (isCurrentScreenCatalogPage) {
331 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.MainMenuButtons.ONBOARD_BUTTON.getValue());
333 GeneralUIUtils.clickOnElementByText(vspName);
334 GeneralUIUtils.ultimateWait();
337 private String createNewVSP(String filePath, String vnfFile) throws Exception {
338 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
339 return OnboardingUiUtils.createVSP(resourceReqDetails, vnfFile, filePath, getUser()).getName();
342 private void runOnboardToDistributionFlow(ResourceReqDetails resourceReqDetails, ServiceReqDetails serviceMetadata, String filePath, String vnfFile) throws Exception {
343 getExtendTest().log(Status.INFO, "Going to create resource with category: " + resourceReqDetails.getCategories().get(0).getName()
344 + " subCategory: " + resourceReqDetails.getCategories().get(0).getSubcategories().get(0).getName()
345 + " and service category: " + serviceMetadata.getCategory());
346 final String vspName = onboardAndCertify(resourceReqDetails, filePath, vnfFile);
348 ServiceUIUtils.createService(serviceMetadata);
350 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
351 CompositionPage.searchForElement(vspName);
352 final CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager();
353 final CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vspName);
354 ArtifactsCorrelationManager.addVNFtoServiceArtifactCorrelation(serviceMetadata.getName(), vspName);
356 assertNotNull(vfElement);
357 ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 1, getUser());
358 ExtentTestActions.addScreenshot(Status.INFO, "ServiceComposition_" + vnfFile, "The service topology is as follows: ");
360 ServiceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
362 reloginWithNewRole(UserRoleEnum.TESTER);
363 GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
364 TesterOperationPage.certifyComponent(serviceMetadata.getName());
366 reloginWithNewRole(UserRoleEnum.GOVERNOR);
367 HomePage.waitForElement(PageElement.COMPONENT_PANEL);
368 HomePage.findComponentAndClick(serviceMetadata.getName());
369 GovernorOperationPage.approveService(serviceMetadata.getName());
371 runDistributionFlow(serviceMetadata);
373 getExtendTest().log(Status.INFO, String.format("Successfully onboarded the package '%s'", vnfFile));
376 private void runDistributionFlow(final ServiceReqDetails serviceMetadata) throws Exception {
377 if (makeDistributionValue) {
378 reloginWithNewRole(UserRoleEnum.OPS);
379 GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
380 OpsOperationPage.distributeService();
381 OpsOperationPage.displayMonitor();
383 final List<WebElement> rowsFromMonitorTable = OpsOperationPage.getRowsFromMonitorTable();
384 AssertJUnit.assertEquals(1, rowsFromMonitorTable.size());
386 OpsOperationPage.waitUntilArtifactsDistributed(0);
390 private String onboardAndCertify(ResourceReqDetails resourceReqDetails, String filePath, String vnfFile) throws Exception {
391 VendorSoftwareProductObject onboardAndValidate = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, filePath, vnfFile, getUser());
392 String vspName = onboardAndValidate.getName();
394 DeploymentArtifactPage.getLeftPanel().moveToCompositionScreen();
395 ExtentTestActions.addScreenshot(Status.INFO, "TopologyTemplate_" + vnfFile, "The topology template for " + vnfFile + " is as follows : ");
397 DeploymentArtifactPage.clickCertifyButton(vspName);
402 @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "VNF_List")
403 public void onboardVNFTest(String filePath, String vnfFile) throws Exception {
405 ResourceReqDetails resourceReqDetails = ElementFactory.getRandomCategoryResource();
406 ServiceReqDetails serviceReqDetails = ElementFactory.getRandomCategoryService();
407 runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, vnfFile);
410 @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "VNF_List")
411 public void onboardVNFShotFlow(String filePath, String vnfFile) throws Exception {
413 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
414 onboardAndCertify(resourceReqDetails, filePath, vnfFile);
417 @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "randomVNF_List")
418 public void onboardRandomVNFsTest(String filePath, String vnfFile) throws Exception {
420 LOGGER.debug("Vnf File name is: {}", vnfFile);
421 ResourceReqDetails resourceReqDetails = ElementFactory.getRandomCategoryResource();
422 ServiceReqDetails serviceReqDetails = ElementFactory.getRandomCategoryService();
423 runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, vnfFile);
428 public void onboardUpdateVNFTest() throws Exception {
429 List<String> fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filePath);
430 String vnfFile = fileNamesFromFolder.get(0);
431 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
432 VendorSoftwareProductObject vsp = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, filePath, vnfFile, getUser());
433 String vspName = vsp.getName();
434 ResourceGeneralPage.clickCertifyButton(vspName);
437 ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
438 ServiceUIUtils.createService(serviceMetadata);
440 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
441 CompositionPage.searchForElement(vspName);
442 CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager();
443 CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vspName);
444 assertNotNull(vfElement);
445 ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 1, getUser());
447 if (!HomePage.navigateToHomePage()) {
448 fail("Could not go to the home page");
452 String updatedVnfFile = fileNamesFromFolder.get(1);
454 getExtendTest().log(Status.INFO, String.format("Going to update the VNF with %s......", updatedVnfFile));
455 // update VendorSoftwareProduct
456 OnboardingUiUtils.updateVnfAndValidate(filePath, vsp, updatedVnfFile, getUser());
457 ResourceGeneralPage.clickCertifyButton(vspName);
459 // replace exiting VFI in service with new updated
461 GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
462 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
463 serviceCanvasManager = CanvasManager.getCanvasManager();
464 CompositionPage.changeComponentVersion(serviceCanvasManager, vfElement, "2.0");
465 ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 1, getUser());
467 ServiceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
469 reloginWithNewRole(UserRoleEnum.TESTER);
470 GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
471 TesterOperationPage.certifyComponent(serviceMetadata.getName());
473 reloginWithNewRole(UserRoleEnum.GOVERNOR);
474 GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
475 GovernorOperationPage.approveService(serviceMetadata.getName());
478 reloginWithNewRole(UserRoleEnum.OPS);
479 GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
480 OpsOperationPage.distributeService();
481 OpsOperationPage.displayMonitor();
483 List<WebElement> rowsFromMonitorTable = OpsOperationPage.getRowsFromMonitorTable();
484 AssertJUnit.assertEquals(1, rowsFromMonitorTable.size());
486 OpsOperationPage.waitUntilArtifactsDistributed(0);
487 getExtendTest().log(Status.INFO, String.format("Onboarding %s test is passed ! ", vnfFile));
492 public void threeVMMSCsInServiceTest() throws Exception {
493 String pathFile = FileHandling.getFilePath("VmmscArtifacts");
494 final String[] list = new File(pathFile).list();
495 assertNotNull("Did not find vMMSCs", list);
496 assertFalse("Did not find vMMSCs", list.length == 0);
497 List<String> vmmscList = Arrays.stream(list).filter(e -> e.contains("vmmsc") && e.endsWith(".zip"))
498 .collect(Collectors.toList());
499 assertFalse("Did not find vMMSCs", vmmscList.isEmpty());
501 Map<String, String> vspNames = new HashMap<>();
502 for (String vnfFile : vmmscList) {
503 String msg = String.format("Going to onboard the VNF %s", vnfFile);
504 getExtendTest().log(Status.INFO, msg);
507 VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(getUser());
508 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
509 VendorSoftwareProductObject createVendorSoftwareProduct = VendorSoftwareProductRestUtils
510 .createVendorSoftwareProduct(resourceReqDetails, vnfFile, pathFile, getUser(), vendorLicenseModel);
512 getExtendTest().log(Status.INFO, String.format("Searching for onboarded %s", vnfFile));
513 HomePage.showVspRepository();
514 getExtendTest().log(Status.INFO, String.format("Going to import %s......", vnfFile.substring(0, vnfFile.indexOf("."))));
515 OnboardingUiUtils.importVSP(createVendorSoftwareProduct);
517 ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
518 DeploymentArtifactPage.verifyArtifactsExistInTable(pathFile, vnfFile);
520 String vspName = createVendorSoftwareProduct.getName();
521 DeploymentArtifactPage.clickCertifyButton(vspName);
522 vspNames.put(vnfFile, vspName);
526 ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
527 ServiceUIUtils.createService(serviceMetadata);
528 ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
529 CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager();
531 for (String vsp : vspNames.values()) {
532 CompositionPage.searchForElement(vsp);
533 CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vsp);
534 assertNotNull(vfElement);
536 ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", vspNames.values().size(), getUser());
537 File imageFilePath = GeneralUIUtils.takeScreenshot(null, SetupCDTest.getScreenshotFolder(), "Info_" + getExtendTest().getModel().getName());
538 final String absolutePath = new File(SetupCDTest.getReportFolder()).toURI().relativize(imageFilePath.toURI()).getPath();
539 SetupCDTest.getExtendTest().log(Status.INFO, "Three kinds of vMMSC are in canvas now." + getExtendTest().addScreenCaptureFromPath(absolutePath));
541 ServiceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
543 reloginWithNewRole(UserRoleEnum.TESTER);
544 GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
545 TesterOperationPage.certifyComponent(serviceMetadata.getName());
547 reloginWithNewRole(UserRoleEnum.GOVERNOR);
548 GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
549 GovernorOperationPage.approveService(serviceMetadata.getName());
551 reloginWithNewRole(UserRoleEnum.OPS);
552 GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
553 OpsOperationPage.distributeService();
554 OpsOperationPage.displayMonitor();
556 List<WebElement> rowsFromMonitorTable = OpsOperationPage.getRowsFromMonitorTable();
557 AssertJUnit.assertEquals(1, rowsFromMonitorTable.size());
559 OpsOperationPage.waitUntilArtifactsDistributed(0);
564 protected UserRoleEnum getRole() {
565 return UserRoleEnum.DESIGNER;