summaryrefslogtreecommitdiffstats
path: root/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute
diff options
context:
space:
mode:
Diffstat (limited to 'ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute')
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/CreatePath.java997
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/PathValidations.java23
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/AdminUserManagment.java14
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CatalogLeftPanelTest.java25
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ImportDCAE.java6
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ImportVFCAsset.java9
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardViaApis.java62
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardingFlowsThroughAPI.java (renamed from ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardingFlows.java)142
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardingFlowsUI.java (renamed from ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Onboard.java)97
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PNF.java48
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PortMirroring.java648
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PropertiesAssignment.java43
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Service.java85
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ToscaValidationTest.java434
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VFCArtifacts.java76
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java21
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfAPI.java738
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfArtifacts.java52
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfDeploymentInformationalArtifacts.java42
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/DriverFactory.java16
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentManager.java39
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestManager.java7
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java33
23 files changed, 3005 insertions, 652 deletions
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/CreatePath.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/CreatePath.java
new file mode 100644
index 0000000000..66bb693778
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/CreatePath.java
@@ -0,0 +1,997 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.AmdocsComplexService;
+
+import static org.testng.AssertJUnit.assertNotNull;
+import static org.testng.AssertJUnit.assertTrue;
+
+import java.awt.AWTException;
+import java.io.Console;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+import java.util.Random;
+import com.mongodb.util.JSON;
+import org.apache.commons.lang.RandomStringUtils;
+import org.json.JSONObject;
+import org.openecomp.sdc.ci.tests.dataProvider.OnbordingDataProviders;
+import org.openecomp.sdc.ci.tests.datatypes.*;
+import org.openecomp.sdc.ci.tests.datatypes.enums.CircleSize;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.sanity.Service;
+import org.openecomp.sdc.ci.tests.execute.setup.ArtifactsCorrelationManager;
+import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.CompositionPage;
+import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.GovernorOperationPage;
+import org.openecomp.sdc.ci.tests.pages.HomePage;
+import org.openecomp.sdc.ci.tests.pages.OpsOperationPage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.TesterOperationPage;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.OnboardingUiUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.stringtemplate.v4.ST;
+import org.testng.Assert;
+import org.testng.AssertJUnit;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Optional;
+import org.testng.annotations.Parameters;
+import org.testng.annotations.Test;
+
+import com.aventstack.extentreports.Status;
+import com.clearspring.analytics.util.Pair;
+
+public class CreatePath extends SetupCDTest {
+
+ protected static String filepath = FileHandling.getVnfRepositoryPath();
+ protected String makeDistributionValue;
+
+ @Parameters({"makeDistribution"})
+ @BeforeMethod
+ public void beforeTestReadParams(@Optional("true") String makeDistributionReadValue) {
+ makeDistributionValue = makeDistributionReadValue;
+ }
+
+ //------------------------------------------Tests-----------------------------------------------------
+
+
+ // Jira issue 5610
+ @Test
+ public void AssertPathButtons() throws Exception, Throwable {
+ filepath = "C:\\Users\\ShiraShe\\Desktop";
+ String vnfFile = "fullComposition.zip";
+ String vspName = getToPathFlow(filepath, vnfFile);
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+ ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ openCreatePath();
+ AssertCreatePath();
+ AssertExtendPath();
+ //SetupCDTest.getExtendTest().log(Status.INFO, String.format("disables buttons are OK"));
+ }
+
+ // Jira issue 5441
+ @Test
+ public void CreatePathTestSanity() throws Exception, Throwable {
+ filepath = "C:\\Users\\ShiraShe\\Desktop";
+ // List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileList();
+ //String vnfFile = fileNamesFromFolder.get(0).toString();
+ String vnfFile = "fullComposition.zip";
+ String vspName = getToPathFlow(filepath, vnfFile);
+ createPath(vspName);
+ }
+
+ // Jira issue 5611
+ @Test
+ public void CreatePathCheckIO() throws Exception, Throwable {
+ filepath = "C:\\Users\\ShiraShe\\Desktop";
+ // List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileList();
+ //String vnfFile = fileNamesFromFolder.get(0).toString();
+ String vnfFile = "fullComposition.zip";
+
+ // getToPathFlow
+ String vspName = onboardAndCertify(filepath, vnfFile);
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+
+ // create service
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+ ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+
+ // create path
+ String pathName = createPath(vspName);
+
+ // @@ check in @@
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.LifeCyleChangeButtons.CHECK_IN.getValue());
+ GeneralUIUtils.getWebElementByTestID("checkindialog").sendKeys("check in automated confirmation message");
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.OK.getValue());
+ GeneralUIUtils.ultimateWait();
+
+ // go to service composition
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtons.SEARCH_BOX.getValue()).sendKeys(serviceMetadata.getName());
+ getDriver().findElements(By.xpath("//*[@data-tests-id='dashboard-Elements']//*[@data-tests-id='" + serviceMetadata.getName() + "']")).get(0).click();
+ GeneralUIUtils.ultimateWait();
+ ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+
+ AssertCreatedPathExistInCompositionPage(pathName);
+
+ // @@ check out @@
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.LifeCyleChangeButtons.CHECKOUT.getValue());
+ GeneralUIUtils.ultimateWait();
+
+ AssertCreatedPathExistInCompositionPage(pathName);
+
+ }
+
+ // Jira issue 5441
+ @Test
+ public void CreateMultiplePaths() throws Exception, Throwable {
+ filepath = "C:\\Users\\ShiraShe\\Desktop";
+ // List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileList();
+ //String vnfFile = fileNamesFromFolder.get(0).toString();
+ String vnfFile = "fullComposition.zip";
+ String vspName = getToPathFlow(filepath, vnfFile);
+ createPath(vspName);
+ createPath(vspName);
+ createPathNumOfRows(7);
+ createPathNumOfRows(6);
+ createPathNumOfRows(4);
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("multiple paths have been created"));
+ }
+
+ // Jira issue 5506
+ @Test
+ public void CreatePathWithComplex() throws Exception, Throwable {
+ List<String> vnfFiles = new ArrayList<>();
+ vnfFiles.add("fullComposition.zip");
+ vnfFiles.add("fullCompositionNew.zip");
+ filepath = "C:\\Users\\ShiraShe\\Desktop";
+ CreatePathComplexServiceFlow(filepath, vnfFiles);
+ //String vnfFile = "fullComposition.zip";
+ // String vnfFile2 = "fullCompositionNew.zip";
+ // runCreatePathComplexServiceFlow(filepath, vnfFile, vnfFile2);
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("path with complex service has been created"));
+ }
+
+ // Jira issue 5506
+ @Test
+ public void RealScenarioComplex() throws Exception, Throwable {
+ filepath = "C:\\Users\\ShiraShe\\Desktop\\Srini";
+ List<String> vnfFiles = new ArrayList<>();
+ vnfFiles.add("HSS.zip");
+ vnfFiles.add("VMME.zip");
+ CreatePathComplexServiceFlow(filepath, vnfFiles);
+ ExtentTestActions.addScreenshot(Status.INFO, "Complex service_" + vnfFiles.get(0) ,"Complex service created " + vnfFiles.get(1) + " is as follows : ");
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("path with complex service has been created"));
+ }
+
+ // Jira issue 5506
+ @Test
+ public void CreateExtendedPathWithComplex() throws Exception, Throwable {
+ filepath = "C:\\Users\\ShiraShe\\Desktop";
+ List<String> vnfFiles = new ArrayList<>();
+ vnfFiles.add("fullComposition.zip");
+ vnfFiles.add("fullCompositionNew.zip");
+ //String vnfFile = "fullComposition.zip";
+ //String vnfFile2 = "fullCompositionNew.zip";
+ String[] services = ToComplexService(filepath, vnfFiles);
+ createComplexExtendedPath(services[0], services[1]);
+ ExtentTestActions.addScreenshot(Status.INFO, "Complex service_" + services[0] ,"Complex service created " + services[1] + " is as follows : ");
+
+ }
+
+ // Jira issue 5441
+ @Test
+ public void CreatePathExtendedTest() throws Exception, Throwable {
+ filepath = "C:\\Users\\ShiraShe\\Desktop";
+ // List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileList();
+ //String vnfFile = fileNamesFromFolder.get(0).toString();
+ String vnfFile = "fullComposition.zip";
+ runCreateExtendedPathFlow(filepath, vnfFile);
+ }
+
+ //create service
+ public ServiceReqDetails createService() throws Exception, AWTException {
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+ return serviceMetadata;
+ }
+
+ // workflow leading to path
+ public String onboardAndCertify(String filepath, String vnfFile) throws Exception, IOException {
+
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
+ Pair<String, VendorSoftwareProductObject> onboardAndValidate = OnboardingUiUtils.onboardAndValidate(resourceReqDetails,filepath, vnfFile, getUser());
+ String vspName = onboardAndValidate.left;
+
+ DeploymentArtifactPage.getLeftPanel().moveToCompositionScreen();
+ ExtentTestActions.addScreenshot(Status.INFO, "TopologyTemplate_" + vnfFile ,"The topology template for " + vnfFile + " is as follows : ");
+
+ DeploymentArtifactPage.clickSubmitForTestingButton(vspName);
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("relogin as TESTER"));
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(vspName);
+ TesterOperationPage.certifyComponent(vspName);
+ return vspName;
+ }
+
+ public List<String> onboardAndCertifyMultipleVFs(String filepath, List<String> vnfFiles) throws Exception, IOException {
+
+ List<String> VFNames = new ArrayList<>();
+ for(int i = 0; i<vnfFiles.size(); i++)
+ {
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
+ Pair<String, VendorSoftwareProductObject> onboardAndValidate = OnboardingUiUtils.onboardAndValidate(resourceReqDetails,filepath, vnfFiles.get(i), getUser());
+ VFNames.add(i, onboardAndValidate.left);
+ DeploymentArtifactPage.getLeftPanel().moveToCompositionScreen();
+ ExtentTestActions.addScreenshot(Status.INFO, "TopologyTemplate_" + vnfFiles.get(i) ,"The topology template for " + vnfFiles.get(i) + " is as follows : ");
+ DeploymentArtifactPage.clickSubmitForTestingButton(VFNames.get(i));
+ }
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("relogin as TESTER"));
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ for (int j = 0; j< VFNames.size(); j++)
+ {
+ GeneralUIUtils.findComponentAndClick(VFNames.get(j));
+ TesterOperationPage.certifyComponent(VFNames.get(j));
+ }
+
+ return VFNames;
+ }
+
+ // path components
+
+ public void AssertCreatePath() throws Exception, IOException {
+ String check = getDriver().findElements(By.xpath("//*[@data-tests-id='Create']")).get(0).getAttribute("disabled");
+ if (check.intern() != "true")
+ {
+ throw new Exception("Button create path should be disabled. open bug to UI team");
+ }
+ }
+
+ public void AssertCreatedPathExistInCompositionPage(String pathName) throws Exception, IOException {
+ // check path in the list filter
+ checkPathFilter(pathName, true);
+
+ openPathList();
+
+ // assert path is in the list
+ String PathListName1 = getDriver().findElements(By.xpath("//*[text()='"+pathName+"']")).get(0).getText();
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.PropertiesAssignmentScreen.INPUT_DELETE_DIALOG_CLOSE.getValue());
+ }
+
+ public void AssertExtendPath() throws Exception, IOException {
+ String check = getDriver().findElements(By.xpath("//*[@data-tests-id='extendPathlnk']")).get(0).getAttribute("class");
+ if (check.intern() != "disabled")
+ {
+ throw new Exception("Button extend path should be disabled. open bug to UI team");
+ }
+ }
+
+ public void createPathNumOfRows(int numOfPathRows)throws Exception, AWTException{
+ openCreatePath();
+ insertValues("extended" + RandomStringUtils.randomAlphanumeric(8),"pathProtocol1", "pathPortNumbers1");
+ selectFirstLineParam();
+ extendPath(numOfPathRows);
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.CREATE_BUTTON.getValue());
+ }
+
+ public void linkVFs(String vspName, int linksNum)throws Exception, AWTException {
+
+ CompositionPage.searchForElement(vspName);
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+ List <CanvasElement> VFs = new ArrayList<CanvasElement>();
+
+ VFs.add(canvasManager.createElementOnCanvas(vspName));
+
+ for (int i = 1; i<linksNum; i++)
+ {
+ VFs.add(canvasManager.createElementOnCanvas(vspName));
+ GeneralUIUtils.ultimateWait();
+ canvasManager.linkElements(VFs.get(i), CircleSize.VF, VFs.get(i-1), CircleSize.VF);
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("link VFs"));
+ GeneralUIUtils.ultimateWait();
+ }
+ }
+
+ public void linkServices(String Service1, String Service2, int linksNum)throws Exception, AWTException {
+
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+ List <CanvasElement> VFs = new ArrayList<CanvasElement>();
+
+ // get first service
+ CompositionPage.searchForElement(Service1);
+ VFs.add(canvasManager.createElementOnCanvas(Service1));
+
+ String service = Service2;
+ for (int i = 1; i<linksNum; i++)
+ {
+ CompositionPage.searchForElement(service);
+ VFs.add(canvasManager.createElementOnCanvas(service));
+ GeneralUIUtils.ultimateWait();
+ canvasManager.linkElements(VFs.get(i), CircleSize.SERVICE, VFs.get(i-1), CircleSize.SERVICE);
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("link services"));
+ GeneralUIUtils.ultimateWait();
+
+ // change service to link
+ if (service.equals(Service2)) {
+ service = Service1;
+ }
+ else {
+ service = Service2;
+ }
+ }
+ }
+
+ public void openCreatePath() throws Exception, AWTException{
+
+ getDriver().findElements(By.xpath("//*[@data-tests-id='pathsMenuBtn']/parent::*")).get(0).click();
+ GeneralUIUtils.ultimateWait();
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.CREATE_PATH_MENU_BUTTON.getValue());
+ }
+
+ public void openPathList() throws Exception, AWTException {
+ getDriver().findElements(By.xpath("//*[@data-tests-id='pathsMenuBtn']/parent::*")).get(0).click();
+ GeneralUIUtils.ultimateWait();
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.PATH_LIST_BUTTON.getValue());
+ }
+
+ public void sendValue(String DataTestId, String value) throws Exception, AWTException {
+
+ GeneralUIUtils.getWebElementByTestID(DataTestId).sendKeys(value);
+ GeneralUIUtils.ultimateWait();
+ }
+
+ public void insertValues(String pathName, String pathProtocol, String pathPortNumbers) throws Exception, AWTException {
+
+ sendValue(DataTestIdEnum.ComplexServiceAmdocs.PATH_NAME.getValue(),pathName);
+ sendValue(DataTestIdEnum.ComplexServiceAmdocs.PATH_PROTOCOL.getValue(),pathProtocol);
+ sendValue(DataTestIdEnum.ComplexServiceAmdocs.PATH_PORT_NUMBER.getValue(),pathPortNumbers);
+ }
+
+ public void selectFirstLineParam() throws Exception, AWTException{
+ getDriver().findElements(By.xpath("//*[@data-tests-id='linkSrc']//option")).get(0).click();
+ GeneralUIUtils.ultimateWait();
+ getDriver().findElements(By.xpath("//*[@data-tests-id='linkSrcCP']//option")).get(0).click();
+ GeneralUIUtils.ultimateWait();
+ getDriver().findElements(By.xpath("//*[@data-tests-id='linkTarget']//option")).get(0).click();
+ GeneralUIUtils.ultimateWait();
+ getDriver().findElements(By.xpath("//*[@data-tests-id='linkTargetCP']//option")).get(0).click();
+ GeneralUIUtils.ultimateWait();
+ }
+
+ public void checkPathFilter(String pathName, boolean isFound) throws Exception, AWTException{
+ GeneralUIUtils.ultimateWait();
+ List<WebElement> pathFilterList = getDriver().findElements(By.xpath("//*[@data-tests-id='service-path-selector']//option"));
+ if (isFound) {
+ for (int i = 0; i < pathFilterList.size(); i++) {
+ String element_text = pathFilterList.get(i).getText();
+ if (element_text.equals(pathName))
+ {
+ break;
+ }
+ if (i == pathFilterList.size() -1 )
+ {
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("path list filter check failed"));
+ throw new Exception("path filter list is missing a path");
+ }
+ }
+ }
+ else {
+ for (int i = 0; i < pathFilterList.size(); i++) {
+ String element_text = pathFilterList.get(i).getText();
+ if (element_text.equals(pathName))
+ {
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("path list filter check failed"));
+ throw new Exception("path filter list is has a path that should be deleted");
+ }
+ }
+ }
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("path list filter check passed"));
+ }
+
+ public void extendPath(int numOfLines) throws Exception, AWTException {
+
+ int i;
+ for (i = 0; i < numOfLines; i++) {
+ String check;
+ String index = Integer.toString(i + 2);
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.EXTEND_BUTTON.getValue());
+ List<WebElement> linkSrcs = getDriver().findElements(By.xpath("//*[@data-tests-id='linkSrc']//select"));
+ List<WebElement> linkSrcCPs = getDriver().findElements(By.xpath("//*[@data-tests-id='linkSrcCP']//select"));
+ List<WebElement> linkTargets = getDriver().findElements(By.xpath("//*[@data-tests-id='linkTarget']//select"));
+ List<WebElement> linkTargetCPs = getDriver().findElements(By.xpath("//*[@data-tests-id='linkTargetCP']//select"));
+
+ for (int j = 0; j < i + 2; j++) {
+ check = linkSrcs.get(j).getAttribute("class");
+ if (!check.intern().contains("disabled")) {
+ throw new Exception("Source should be disabled. open bug to UI team");
+ }
+ check = linkSrcCPs.get(j).getAttribute("class");
+ if (!check.intern().contains("disabled")) {
+ throw new Exception("Source connection point of last lines should be disabled. open bug to UI team");
+ }
+ }
+ for (int j = 0; j < i + 1; j++) {
+
+ check = linkTargets.get(j).getAttribute("class");
+ if (!check.intern().contains("disabled")) {
+ throw new Exception("Target of last lines should be disabled. open bug to UI team");
+ }
+ check = linkTargetCPs.get(j).getAttribute("class");
+ if (!check.intern().contains("disabled")) {
+ throw new Exception("Target connection point of last lines should be disabled. open bug to UI team");
+ }
+ }
+
+ List <WebElement> choices = getDriver().findElements(By.xpath("//*[" + index + "]/*[@data-tests-id='linkTarget']//option"));
+ choices.get((new Random()).nextInt(choices.size())).click();
+ choices = getDriver().findElements(By.xpath("//*[" + index + "]/*[@data-tests-id='linkTargetCP']//option"));
+ choices.get((new Random()).nextInt(choices.size())).click();
+ }
+ }
+
+ public String editPath(String pathName) throws Exception, AWTException{
+ getDriver().findElements(By.xpath("//*[text()='"+pathName+"']/parent::*//span")).get(0).click();
+ pathName = "name2";
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ComplexServiceAmdocs.PATH_NAME.getValue()).clear();
+ sendValue(DataTestIdEnum.ComplexServiceAmdocs.PATH_NAME.getValue(), pathName);
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.SAVE.getValue());
+ return pathName;
+ }
+
+ public int deleteLines(int numOfLinesToDelete,int numOfLines)throws Exception, AWTException{
+
+ for (int i=0; i<numOfLinesToDelete; i++){
+ getDriver().findElements(By.xpath("//*[@data-tests-id='removeLnk']//span")).get(0).click();
+ numOfLines--;
+ }
+ if (getDriver().findElements(By.xpath("//*[@data-tests-id='linkTargetCP']//option")).size()>(numOfLines+1))
+ {
+ throw new Exception("Path element was not deleted");
+ }
+ GeneralUIUtils.ultimateWait();
+ return numOfLines;
+ }
+
+ public String getToPathFlow(String filepath, String vnfFile) throws Exception, AWTException {
+
+ String vspName = onboardAndCertify(filepath, vnfFile);
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+ // create service
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+ ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ return vspName;
+ }
+
+ // path scenarios
+
+ public String createPath(String vspName) throws Exception, AWTException {
+
+ linkVFs(vspName, 3);
+ openCreatePath();
+ String pathName = "name1";
+ insertValues(pathName, "pathProtocol1", "pathPortNumbers1");
+ //select path elements
+ selectFirstLineParam();
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.CREATE_BUTTON.getValue());
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("path has been created"));
+ return pathName;
+ }
+
+ // flows
+
+ public void createExtendedPath(String vspName) throws Exception, AWTException {
+ //drag and drop VFs and link them
+ linkVFs(vspName, 5);
+
+ //open create path box
+ openCreatePath();
+ String pathName = "name1";
+ insertValues(pathName, "pathProtocol1", "pathPortNumbers1");
+ selectFirstLineParam();
+ //extend path
+ int numOfLines = 3;
+ extendPath(numOfLines);
+ //delete line
+ int numOfLinesToDelete = 1;
+ numOfLines = deleteLines(numOfLinesToDelete, numOfLines);
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.CREATE_BUTTON.getValue());
+ ExtentTestActions.log(Status.INFO, "path has been created");
+
+ // check that path exist in the path filter list
+ checkPathFilter(pathName, true);
+
+ // check that path exist in the path list
+ getDriver().findElements(By.xpath("//*[@data-tests-id='pathsMenuBtn']/parent::*")).get(0).click();
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.PATH_LIST_BUTTON.getValue());
+ String PathListName1 = getDriver().findElements(By.xpath("//*[text()='"+pathName+"']")).get(0).getText();
+
+ // edit path
+ pathName = editPath(pathName);
+
+ // go back to path's list
+ getDriver().findElements(By.xpath("//*[@data-tests-id='pathsMenuBtn']/parent::*")).get(0).click();
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.PATH_LIST_BUTTON.getValue());
+
+ // get name
+ String PathListName2 = getDriver().findElements(By.xpath("//*[text()='"+pathName+"']")).get(0).getText();
+
+ // assert names changed
+ if (PathListName1.equals(PathListName2))
+ {
+ throw new Exception("path name expected to change after edit but did not");
+ }
+
+ // delete path
+ int paths_before_deletion = getDriver().findElements(By.xpath("//*[text()='"+pathName+"']/parent::*//span")).size();
+ getDriver().findElements(By.xpath("//*[text()='"+pathName+"']/parent::*//span")).get(1).click();
+ GeneralUIUtils.ultimateWait();
+ int paths_after_deletion = getDriver().findElements(By.xpath("//*[text()='"+pathName+"']/parent::*//span")).size();
+ if (paths_after_deletion == paths_before_deletion)
+ {
+ throw new Exception("path expected to be deleted but did not");
+ }
+
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.PropertiesAssignmentScreen.INPUT_DELETE_DIALOG_CLOSE.getValue());
+ //ArtifactsCorrelationManager.addVNFtoServiceArtifactCorrelation(serviceMetadata.getName(), vspName);
+ //ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 1, getUser());
+ //ExtentTestActions.addScreenshot(Status.INFO, "ServiceComposition_" + vnfFile, "The service topology is as follows: ");
+ //ServiceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Path has been created"));
+
+ // check that path got deleted in the path filter list
+ checkPathFilter(pathName, false);
+ }
+
+ public void createComplexExtendedPath(String Service1, String Service2) throws Exception, AWTException {
+ //drag and drop Services and link them
+ linkServices(Service1, Service2, 5);
+
+ //-----------------------------------------create path-------------------------------------------------
+
+ //open create path box
+ openCreatePath();
+
+ String pathName = "name1";
+ String pathProtocol = "pathProtocol1";
+ String pathPortNumbers = "pathPortNumbers1";
+
+ insertValues(pathName, pathProtocol, pathPortNumbers);
+
+ //select path parameters
+ selectFirstLineParam();
+ //extend path
+ int numOfLines = 3;
+ extendPath(numOfLines);
+
+ //delete line
+ int numOfLinesToDelete = 1;
+ numOfLines = deleteLines(numOfLinesToDelete, numOfLines);
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.CREATE_BUTTON.getValue());
+ ExtentTestActions.log(Status.INFO, "path has been created");
+
+ //---------------------------------------check path's list-----------------------------
+
+ // go to path's list
+ openPathList();
+
+ // get name
+ String PathListName1 = getDriver().findElements(By.xpath("//*[text()='"+pathName+"']")).get(0).getText();
+
+ // edit path
+ pathName = editPath(pathName);
+
+ // go back to path's list
+ getDriver().findElements(By.xpath("//*[@data-tests-id='pathsMenuBtn']/parent::*")).get(0).click();
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.PATH_LIST_BUTTON.getValue());
+
+ // get name
+ String PathListName2 = getDriver().findElements(By.xpath("//*[text()='"+pathName+"']")).get(0).getText();
+
+ // assert names changed
+ if (PathListName1.equals(PathListName2))
+ {
+ throw new Exception("path name expected to change after edit but did not");
+ }
+
+ // delete path
+ int paths_before_deletion = getDriver().findElements(By.xpath("//*[text()='"+pathName+"']/parent::*//span")).size();
+ getDriver().findElements(By.xpath("//*[text()='"+pathName+"']/parent::*//span")).get(1).click();
+ Thread.sleep(1000);
+ int paths_after_deletion = getDriver().findElements(By.xpath("//*[text()='"+pathName+"']/parent::*//span")).size();
+ if (paths_after_deletion == paths_before_deletion)
+ {
+ throw new Exception("path expected to be deleted but did not");
+ }
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.PropertiesAssignmentScreen.INPUT_DELETE_DIALOG_CLOSE.getValue());
+ //ArtifactsCorrelationManager.addVNFtoServiceArtifactCorrelation(serviceMetadata.getName(), vspName);
+
+ //assertNotNull(vfElement);
+ //ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 1, getUser());
+ //ExtentTestActions.addScreenshot(Status.INFO, "ServiceComposition_" + vnfFile, "The service topology is as follows: ");
+
+ //ServiceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Path has been created"));
+ }
+
+ public String[] getToComplexService(String filepath, String vnfFile, String vnfFile2) throws Exception, AWTException{
+ // create & certify 2 VF
+ String vspName1 = onboardAndCertify(filepath, vnfFile);
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+ String vspName2 = onboardAndCertify(filepath, vnfFile2);
+
+ // create service 1
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+ ServiceReqDetails serviceMetadata1 = createService();
+ // go to composition
+ ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ // create path
+ createPath(vspName1);
+ getDriver().findElements(By.xpath("//*[@data-tests-id='submit_for_testing']")).get(0).click();
+ getDriver().findElements(By.xpath("//*[@data-tests-id='changeLifeCycleMessage']")).get(0).sendKeys("new Service to test");
+ getDriver().findElements(By.xpath("//*[@data-tests-id='OK']")).get(0).click();
+
+ // create service 2
+ ServiceReqDetails serviceMetadata2 = createService();
+ // go to composition
+ ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ // create path
+ createPath(vspName2);
+ getDriver().findElements(By.xpath("//*[@data-tests-id='submit_for_testing']")).get(0).click();
+ getDriver().findElements(By.xpath("//*[@data-tests-id='changeLifeCycleMessage']")).get(0).sendKeys("new Service to test");
+ getDriver().findElements(By.xpath("//*[@data-tests-id='OK']")).get(0).click();
+
+ //tester
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(serviceMetadata1.getName());
+ TesterOperationPage.certifyComponent(serviceMetadata1.getName());
+ GeneralUIUtils.findComponentAndClick(serviceMetadata2.getName());
+ TesterOperationPage.certifyComponent(serviceMetadata2.getName());
+
+ //governor
+ reloginWithNewRole(UserRoleEnum.GOVERNOR);
+ GeneralUIUtils.findComponentAndClick(serviceMetadata1.getName());
+ GovernorOperationPage.approveSerivce(serviceMetadata1.getName());
+ GeneralUIUtils.findComponentAndClick(serviceMetadata2.getName());
+ GovernorOperationPage.approveSerivce(serviceMetadata2.getName());
+
+ //create service for complex service
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+ // create service
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+ // go to composition
+ ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+
+ return new String[]{serviceMetadata1.getName(), serviceMetadata2.getName()};
+ }
+
+ public String[] ToComplexService(String filepath, List<String> vnfFiles) throws Exception, AWTException{
+ // create & certify 2 VF
+ List<String> VFNames = onboardAndCertifyMultipleVFs(filepath, vnfFiles);
+
+ // create service 1
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+ ServiceReqDetails serviceMetadata1 = createService();
+ // go to composition
+ ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ // create path
+ createPath(VFNames.get(0));
+ getDriver().findElements(By.xpath("//*[@data-tests-id='submit_for_testing']")).get(0).click();
+ getDriver().findElements(By.xpath("//*[@data-tests-id='changeLifeCycleMessage']")).get(0).sendKeys("new Service to test");
+ getDriver().findElements(By.xpath("//*[@data-tests-id='OK']")).get(0).click();
+ GeneralUIUtils.ultimateWait();;
+
+ // create service 2
+ ServiceReqDetails serviceMetadata2 = createService();
+ GeneralUIUtils.ultimateWait();;
+ // go to composition
+ ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ // create path
+ createPath(VFNames.get(1));
+ getDriver().findElements(By.xpath("//*[@data-tests-id='submit_for_testing']")).get(0).click();
+ getDriver().findElements(By.xpath("//*[@data-tests-id='changeLifeCycleMessage']")).get(0).sendKeys("new Service to test");
+ getDriver().findElements(By.xpath("//*[@data-tests-id='OK']")).get(0).click();
+
+ //tester
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(serviceMetadata1.getName());
+ TesterOperationPage.certifyComponent(serviceMetadata1.getName());
+ GeneralUIUtils.findComponentAndClick(serviceMetadata2.getName());
+ TesterOperationPage.certifyComponent(serviceMetadata2.getName());
+
+ //governor
+ reloginWithNewRole(UserRoleEnum.GOVERNOR);
+ GeneralUIUtils.findComponentAndClick(serviceMetadata1.getName());
+ GovernorOperationPage.approveSerivce(serviceMetadata1.getName());
+ GeneralUIUtils.findComponentAndClick(serviceMetadata2.getName());
+ GovernorOperationPage.approveSerivce(serviceMetadata2.getName());
+
+ //create service for complex service
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+ // create service
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+ // go to composition
+ ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+
+ return new String[]{serviceMetadata1.getName(), serviceMetadata2.getName()};
+ }
+
+ public void runCreatePathComplexServiceFlow(String filepath, String vnfFile, String vnfFile2) throws Exception, AWTException {
+ // create & certify 2 VF
+ String vspName1 = onboardAndCertify(filepath, vnfFile);
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+ String vspName2 = onboardAndCertify(filepath, vnfFile2);
+
+ // create service 1
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+ ServiceReqDetails serviceMetadata1 = createService();
+ // go to composition
+ ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ // create path
+ createPath(vspName1);
+ getDriver().findElements(By.xpath("//*[@data-tests-id='submit_for_testing']")).get(0).click();
+ getDriver().findElements(By.xpath("//*[@data-tests-id='changeLifeCycleMessage']")).get(0).sendKeys("new Service to test");
+ getDriver().findElements(By.xpath("//*[@data-tests-id='OK']")).get(0).click();
+
+ // create service 2
+ ServiceReqDetails serviceMetadata2 = createService();
+ // go to composition
+ ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ // create path
+ createPath(vspName2);
+ getDriver().findElements(By.xpath("//*[@data-tests-id='submit_for_testing']")).get(0).click();
+ getDriver().findElements(By.xpath("//*[@data-tests-id='changeLifeCycleMessage']")).get(0).sendKeys("new Service to test");
+ getDriver().findElements(By.xpath("//*[@data-tests-id='OK']")).get(0).click();
+
+ //tester
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(serviceMetadata1.getName());
+ TesterOperationPage.certifyComponent(serviceMetadata1.getName());
+ GeneralUIUtils.findComponentAndClick(serviceMetadata2.getName());
+ TesterOperationPage.certifyComponent(serviceMetadata2.getName());
+
+ //governor
+ reloginWithNewRole(UserRoleEnum.GOVERNOR);
+ GeneralUIUtils.findComponentAndClick(serviceMetadata1.getName());
+ GovernorOperationPage.approveSerivce(serviceMetadata1.getName());
+ GeneralUIUtils.findComponentAndClick(serviceMetadata2.getName());
+ GovernorOperationPage.approveSerivce(serviceMetadata2.getName());
+
+ //create service for complex service
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+ // create service
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+ // go to composition
+ ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ // link services
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+ CompositionPage.searchForElement(serviceMetadata1.getName());
+ CanvasElement service1 = canvasManager.createElementOnCanvas(serviceMetadata1.getName());
+ CompositionPage.searchForElement(serviceMetadata2.getName());
+ CanvasElement service2 = canvasManager.createElementOnCanvas(serviceMetadata2.getName());
+ canvasManager.linkElements(service1,CircleSize.SERVICE, service2, CircleSize.SERVICE);
+
+ // create path
+ openCreatePath();
+ insertValues("name1", "pathProtocol1", "pathPortNumbers1");
+ selectFirstLineParam();
+ GeneralUIUtils.getWebElementByTestID("Create").click();
+ }
+
+ public void CreatePathComplexServiceFlow(String filepath, List<String> vnfFiles) throws Exception, AWTException {
+ // create & certify 2 VF
+ List<String> vfNames = onboardAndCertifyMultipleVFs(filepath, vnfFiles);
+
+ // create service 1
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+ ServiceReqDetails serviceMetadata1 = createService();
+ // go to composition
+ ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ // create path
+ createPath(vfNames.get(0));
+ getDriver().findElements(By.xpath("//*[@data-tests-id='submit_for_testing']")).get(0).click();
+ getDriver().findElements(By.xpath("//*[@data-tests-id='changeLifeCycleMessage']")).get(0).sendKeys("new Service to test");
+ getDriver().findElements(By.xpath("//*[@data-tests-id='OK']")).get(0).click();
+
+ // create service 2
+ ServiceReqDetails serviceMetadata2 = createService();
+ // go to composition
+ ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ // create path
+ createPath(vfNames.get(0));
+ getDriver().findElements(By.xpath("//*[@data-tests-id='submit_for_testing']")).get(0).click();
+ getDriver().findElements(By.xpath("//*[@data-tests-id='changeLifeCycleMessage']")).get(0).sendKeys("new Service to test");
+ getDriver().findElements(By.xpath("//*[@data-tests-id='OK']")).get(0).click();
+
+ //tester
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(serviceMetadata1.getName());
+ TesterOperationPage.certifyComponent(serviceMetadata1.getName());
+ GeneralUIUtils.findComponentAndClick(serviceMetadata2.getName());
+ TesterOperationPage.certifyComponent(serviceMetadata2.getName());
+
+ //governor
+ reloginWithNewRole(UserRoleEnum.GOVERNOR);
+ GeneralUIUtils.findComponentAndClick(serviceMetadata1.getName());
+ GovernorOperationPage.approveSerivce(serviceMetadata1.getName());
+ GeneralUIUtils.findComponentAndClick(serviceMetadata2.getName());
+ GovernorOperationPage.approveSerivce(serviceMetadata2.getName());
+
+ //create service for complex service
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+ // create service
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+ // go to composition
+ ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ // link services
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+ CompositionPage.searchForElement(serviceMetadata1.getName());
+ CanvasElement service1 = canvasManager.createElementOnCanvas(serviceMetadata1.getName());
+ CompositionPage.searchForElement(serviceMetadata2.getName());
+ CanvasElement service2 = canvasManager.createElementOnCanvas(serviceMetadata2.getName());
+ canvasManager.linkElements(service1,CircleSize.SERVICE, service2, CircleSize.SERVICE);
+
+ // create path
+ openCreatePath();
+ insertValues("name1", "pathProtocol1", "pathPortNumbers1");
+ selectFirstLineParam();
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.CREATE_BUTTON.getValue());
+ }
+
+ public void runCreateExtendedPathFlow(String filepath, String vnfFile) throws Exception, AWTException {
+
+ String vspName = getToPathFlow(filepath, vnfFile);
+
+ //drag and drop VFs and link them
+ linkVFs(vspName, 5);
+
+ //-----------------------------------------create path-------------------------------------------------
+
+ //open create path box
+ openCreatePath();
+ String pathName = "name1";
+ insertValues(pathName, "pathProtocol1", "pathPortNumbers1");
+
+ //select path parameters
+ selectFirstLineParam();
+ //extend path
+ int numOfLines = 3;
+ extendPath(numOfLines);
+
+ //delete line
+ int numOfLinesToDelete = 1;
+ numOfLines = deleteLines(numOfLinesToDelete, numOfLines);
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.CREATE_BUTTON.getValue());
+ ExtentTestActions.log(Status.INFO, "path has been created");
+
+ // check path is on the list
+ openPathList();
+ String PathListName1 = getDriver().findElements(By.xpath("//*[text()='"+pathName+"']")).get(0).getText();
+
+ // edit path
+ pathName = editPath(pathName);
+
+ // go back to path's list
+ getDriver().findElements(By.xpath("//*[@data-tests-id='pathsMenuBtn']/parent::*")).get(0).click();
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.PATH_LIST_BUTTON.getValue());
+
+ // get name
+ String PathListName2 = getDriver().findElements(By.xpath("//*[text()='"+pathName+"']")).get(0).getText();
+
+ // assert names changes
+ if (PathListName1.equals(PathListName2))
+ {
+ throw new Exception("path name expected to change after edit but did not");
+ }
+
+ // delete path
+ int paths_before_deletion = getDriver().findElements(By.xpath("//*[text()='"+pathName+"']/parent::*//span")).size();
+ getDriver().findElements(By.xpath("//*[text()='"+pathName+"']/parent::*//span")).get(1).click();
+ GeneralUIUtils.ultimateWait();
+ int paths_after_deletion = getDriver().findElements(By.xpath("//*[text()='"+pathName+"']/parent::*//span")).size();
+ if (paths_after_deletion == paths_before_deletion)
+ {
+ throw new Exception("path expected to be deleted but did not");
+ }
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.PropertiesAssignmentScreen.INPUT_DELETE_DIALOG_CLOSE.getValue());
+ //ArtifactsCorrelationManager.addVNFtoServiceArtifactCorrelation(serviceMetadata.getName(), vspName);
+ //ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 1, getUser());
+ //ExtentTestActions.addScreenshot(Status.INFO, "ServiceComposition_" + vnfFile, "The service topology is as follows: ");
+ //ServiceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Path has been created"));
+ }
+
+ public void runCreatePathFlow(String filepath, String vnfFile) throws Exception, AWTException {
+ String vspName = onboardAndCertify(filepath, vnfFile);
+
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+ // create service
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+
+ ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+
+ CompositionPage.searchForElement(vspName);
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+ CanvasElement vfElement1 = canvasManager.createElementOnCanvas(vspName);
+ CanvasElement vfElement2 = canvasManager.createElementOnCanvas(vspName);
+ CanvasElement vfElement3 = canvasManager.createElementOnCanvas(vspName);
+ CanvasElement vfElement4 = canvasManager.createElementOnCanvas(vspName);
+ CanvasElement vfElement5 = canvasManager.createElementOnCanvas(vspName);
+ canvasManager.linkElements(vfElement1, CircleSize.VF, vfElement2, CircleSize.VF);
+ canvasManager.linkElements(vfElement3,CircleSize.VF, vfElement2, CircleSize.VF);
+ canvasManager.linkElements(vfElement3, CircleSize.VF, vfElement4, CircleSize.VF);
+ canvasManager.linkElements(vfElement5, CircleSize.VF, vfElement4, CircleSize.VF);
+ canvasManager.linkElements(vfElement5, CircleSize.VF, vfElement1, CircleSize.VF);
+
+ //create path
+
+ getDriver().findElements(By.xpath("//*[@data-tests-id='pathsMenuBtn']/parent::*")).get(0).click();
+// GeneralUIUtils.getWebElementByTestID("pathsMenuBtn").click();
+ GeneralUIUtils.getWebElementByTestID("createPathMenuItem").click();
+ //insert values
+ GeneralUIUtils.getWebElementByTestID("pathName").sendKeys("name");
+ GeneralUIUtils.getWebElementByTestID("pathProtocol").sendKeys("pathProtocol");
+ GeneralUIUtils.getWebElementByTestID("pathPortNumbers").sendKeys("pathPortNumbers");
+ //select path parameters
+
+ getDriver().findElements(By.xpath("//*[@data-tests-id='linkSrc']//option")).get(0).click();
+ getDriver().findElements(By.xpath("//*[@data-tests-id='linkSrcCP']//option")).get(0).click();
+ getDriver().findElements(By.xpath("//*[@data-tests-id='linkTarget']//option")).get(0).click();
+ getDriver().findElements(By.xpath("//*[@data-tests-id='linkTargetCP']//option")).get(0).click();
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.CREATE_BUTTON.getValue());
+
+ //ArtifactsCorrelationManager.addVNFtoServiceArtifactCorrelation(serviceMetadata.getName(), vspName);
+
+ //assertNotNull(vfElement);
+ //ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 1, getUser());
+ //ExtentTestActions.addScreenshot(Status.INFO, "ServiceComposition_" + vnfFile, "The service topology is as follows: ");
+
+ //ServiceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
+ }
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+
+} \ No newline at end of file
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/PathValidations.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/PathValidations.java
new file mode 100644
index 0000000000..42c45699f3
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/AmdocsComplexService/PathValidations.java
@@ -0,0 +1,23 @@
+package org.openecomp.sdc.ci.tests.execute.AmdocsComplexService;
+
+/**
+ * validation tests for future validations
+ */
+
+import java.util.ArrayList;
+
+public class PathValidations {
+
+ String name;
+ String destinationPortNumber;
+ String protocol;
+
+ ArrayList<String> elements;
+
+ public void Ph(String parameter1 )
+ {
+ elements = new ArrayList<String>();
+ elements.add(parameter1);
+ elements.get(1);
+ }
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/AdminUserManagment.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/AdminUserManagment.java
index e4423dd7d0..4df09a660d 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/AdminUserManagment.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/AdminUserManagment.java
@@ -48,6 +48,7 @@ import org.openecomp.sdc.ci.tests.verificator.UserManagementVerificator;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.testng.Assert;
+import org.testng.SkipException;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@@ -72,21 +73,23 @@ public class AdminUserManagment extends SetupCDTest {
//TC915100
@Test
- public void creatNewUserTest() throws Exception {
+ public void createNewUserTest() throws Exception {
String userId = generateValidUserId();
UserRoleEnum userRole = UserRoleEnum.DESIGNER;
AdminWorkspaceUIUtilies.createNewUser(userId, userRole);
+ GeneralUIUtils.ultimateWait();
UserManagementVerificator.validateUserCreated(userId, userRole);
}
//TC922253
@Test
- public void creatNewUser_MacIdTest() throws Exception {
+ public void createNewUser_MacIdTest() throws Exception {
String macId = generateValidMacId();
UserRoleEnum userRole = UserRoleEnum.DESIGNER;
AdminWorkspaceUIUtilies.createNewUser(macId, userRole);
+ GeneralUIUtils.ultimateWait();
UserManagementVerificator.validateUserCreated(macId, userRole);
}
@@ -106,9 +109,9 @@ public class AdminUserManagment extends SetupCDTest {
@Test
public void createInvalidMacIdTest(){
-// if(true){
-// throw new SkipException("Open bug 324032");
-// }
+ if(true){
+ throw new SkipException("Open bug 324032");
+ }
String macId = generateValidMacId();
StringBuilder invalidMacId = new StringBuilder(macId);
@@ -116,6 +119,7 @@ public class AdminUserManagment extends SetupCDTest {
UserRoleEnum userRole = UserRoleEnum.DESIGNER;
ExtentTestActions.log(Status.INFO, "Trying to create an invalid macId.");
AdminWorkspaceUIUtilies.createNewUser(invalidMacId.toString(), userRole);
+ GeneralUIUtils.ultimateWait();
ErrorMessageUIVerificator.validateErrorMessage(ActionStatus.INVALID_USER_ID);
}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CatalogLeftPanelTest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CatalogLeftPanelTest.java
index 5533eb38f5..cd73dfba4f 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CatalogLeftPanelTest.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CatalogLeftPanelTest.java
@@ -20,28 +20,14 @@
package org.openecomp.sdc.ci.tests.execute.sanity;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.Arrays;
-import java.util.List;
-
+import com.aventstack.extentreports.Status;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
-import org.openecomp.sdc.ci.tests.datatypes.CheckBoxStatusEnum;
-import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.*;
import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.CatalogPageLeftPanelSubCategoryCheckbox;
-import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum;
-import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum;
-import org.openecomp.sdc.ci.tests.datatypes.TypesEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
-import org.openecomp.sdc.ci.tests.utilities.CatalogUIUtilitis;
-import org.openecomp.sdc.ci.tests.utilities.FileHandling;
-import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
-import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
-import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.*;
import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
import org.openecomp.sdc.ci.tests.verificator.CatalogVerificator;
import org.openqa.selenium.WebElement;
@@ -49,7 +35,10 @@ import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
-import com.aventstack.extentreports.Status;
+import java.util.Arrays;
+import java.util.List;
+
+import static org.testng.AssertJUnit.assertTrue;
@Test(singleThreaded = true)
public class CatalogLeftPanelTest extends SetupCDTest{
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ImportDCAE.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ImportDCAE.java
index cf510578ef..ad8347fbbe 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ImportDCAE.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ImportDCAE.java
@@ -71,6 +71,7 @@ import org.openecomp.sdc.ci.tests.verificator.VfVerificator;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.testng.Assert;
+import org.testng.SkipException;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -197,6 +198,11 @@ public class ImportDCAE extends SetupCDTest {
@Test
public void addPropertiesToVfcInstanceInDCAEAssetTest() throws Exception {
+
+ if(true){
+ throw new SkipException("Open bug 373762, can't update properties on CP or VFC instance on Composition screen");
+ }
+
String fileName = "importVFC_VFC15.yml";
ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ImportVFCAsset.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ImportVFCAsset.java
index 273a502895..9ed8ba5029 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ImportVFCAsset.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ImportVFCAsset.java
@@ -57,6 +57,7 @@ import org.openecomp.sdc.ci.tests.verificator.PropertyVerificator;
import org.openecomp.sdc.ci.tests.verificator.VFCverificator;
import org.openecomp.sdc.ci.tests.verificator.VfVerificator;
import org.testng.Assert;
+import org.testng.SkipException;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@@ -360,9 +361,11 @@ public class ImportVFCAsset extends SetupCDTest {
ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
ResourceUIUtils.fillMaxValueResourceGeneralInformationPage(atomicResourceMetaData);
- GeneralPageElements.clickUpdateButton();
- VFCverificator.verifyVFCUpdatedInUI(atomicResourceMetaData);
- GeneralPageElements.clickDeleteVersionButton();
+// GeneralPageElements.clickUpdateButton();
+// VFCverificator.verifyVFCUpdatedInUI(atomicResourceMetaData);
+// GeneralPageElements.clickDeleteVersionButton();
+ // Validate that button disabled
+ assertTrue(GeneralUIUtils.checkForDisabledAttribute(DataTestIdEnum.GeneralElementsEnum.CREATE_BUTTON.getValue()));
}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardViaApis.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardViaApis.java
index 6cea8d6c6f..bf2bda906c 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardViaApis.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardViaApis.java
@@ -20,13 +20,10 @@
package org.openecomp.sdc.ci.tests.execute.sanity;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.awt.AWTException;
-import java.sql.Timestamp;
-import java.util.List;
-import java.util.Map;
-
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.LoggerContext;
+import com.clearspring.analytics.util.Pair;
+import fj.data.Either;
import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.Service;
@@ -40,19 +37,16 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
import org.openecomp.sdc.ci.tests.utilities.FileHandling;
-import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
-import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
-import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtillViaApis;
-import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils;
+import org.openecomp.sdc.ci.tests.utils.general.*;
import org.slf4j.LoggerFactory;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-import com.clearspring.analytics.util.Pair;
+import java.awt.*;
+import java.sql.Timestamp;
+import java.util.List;
-import ch.qos.logback.classic.Level;
-import ch.qos.logback.classic.LoggerContext;
-import fj.data.Either;
+import static org.testng.AssertJUnit.assertTrue;
public class OnboardViaApis{
@@ -100,10 +94,11 @@ public class OnboardViaApis{
{
//CREATE DATA REQUIRED FOR TEST
boolean skipReport = true;
- AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUtils.createVendorLicense(sdncDesignerDetails1);
+ AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(sdncDesignerDetails1);
ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
- Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, filepath, sdncDesignerDetails1, amdocsLicenseMembers);
- VendorSoftwareProductObject vendorSoftwareProductObject = fillVendorSoftwareProductObjectWithMetaData(vnfFile, createVendorSoftwareProduct);
+ Pair<String, VendorSoftwareProductObject> createVendorSoftwareProduct = VendorSoftwareProductRestUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, filepath, sdncDesignerDetails1, amdocsLicenseMembers);
+// VendorSoftwareProductObject vendorSoftwareProductObject = fillVendorSoftwareProductObjectWithMetaData(vnfFile, createVendorSoftwareProduct);
+ VendorSoftwareProductObject vendorSoftwareProductObject = createVendorSoftwareProduct.right;
resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject);
Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails);
resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
@@ -115,40 +110,17 @@ public class OnboardViaApis{
service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
// TEST START
- // Update exist VLM Version (From 1.0 to 2.0)
- OnboardingUtils.updateVendorLicense(amdocsLicenseMembers, sdncDesignerDetails1, "1.0");
- // Set VLM version to 2.0 in VLM Meta data object
- amdocsLicenseMembers.setLicenseVersionId("2.0");
- amdocsLicenseMembers.setLicenseVersionLabel("2.0");
- OnboardingUtils.validateVlmExist(amdocsLicenseMembers.getVendorId(), amdocsLicenseMembers.getLicenseVersionId(), sdncDesignerDetails1);
+ VendorLicenseModelRestUtils.updateVendorLicense(amdocsLicenseMembers, sdncDesignerDetails1, false);
+ VendorLicenseModelRestUtils.validateVlmExist(amdocsLicenseMembers.getVendorId(), amdocsLicenseMembers.getVersion(), sdncDesignerDetails1);
// Update the VSP With the VLM new version and submit the VSP
- vendorSoftwareProductObject = OnboardingUtils.updateVSPWithNewVLMParameters(vendorSoftwareProductObject, amdocsLicenseMembers, sdncDesignerDetails1, "1.1", "2.0");
- OnboardingUtils.validateVspExist(vendorSoftwareProductObject.getVspId(),vendorSoftwareProductObject.getVersion(), sdncDesignerDetails1);
+ vendorSoftwareProductObject = VendorSoftwareProductRestUtils.updateVSPWithNewVLMParameters(vendorSoftwareProductObject, amdocsLicenseMembers, sdncDesignerDetails1);
+ VendorSoftwareProductRestUtils.validateVspExist(vendorSoftwareProductObject, sdncDesignerDetails1);
Boolean distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service);
assertTrue("Distribution status is " + distributeAndValidateService, distributeAndValidateService);
System.out.println(distributeAndValidateService);
}
- public static VendorSoftwareProductObject fillVendorSoftwareProductObjectWithMetaData(String vnfFile, Pair<String, Map<String, String>> createVendorSoftwareProduct) {
- VendorSoftwareProductObject vendorSoftwareProductObject = new VendorSoftwareProductObject();
- Map<String, String> map = createVendorSoftwareProduct.right;
- vendorSoftwareProductObject.setAttContact(map.get("attContact"));
- vendorSoftwareProductObject.setCategory(map.get("category"));
- vendorSoftwareProductObject.setComponentId(map.get("componentId"));
- vendorSoftwareProductObject.setDescription(map.get("description"));
- vendorSoftwareProductObject.setSubCategory(map.get("subCategory"));
- vendorSoftwareProductObject.setVendorName(map.get("vendorName"));
- vendorSoftwareProductObject.setVspId(map.get("vspId"));
- vendorSoftwareProductObject.setName(createVendorSoftwareProduct.left);
- String[] arrFileNameAndExtension = vnfFile.split("\\.");
- vendorSoftwareProductObject.setOnboardingMethod("NetworkPackage");
- vendorSoftwareProductObject.setNetworkPackageName(arrFileNameAndExtension[0]);
- vendorSoftwareProductObject.setOnboardingOrigin(arrFileNameAndExtension[1]);
-
- return vendorSoftwareProductObject;
- }
-
public Service runOnboardViaApisOnly(ServiceReqDetails serviceReqDetails, ResourceReqDetails resourceReqDetails, String filepath, String vnfFile) throws Exception, AWTException {
Pair<String, VendorSoftwareProductObject> createVendorSoftwareProduct = OnboardingUtillViaApis.createVspViaApis(resourceReqDetails, filepath, vnfFile, sdncDesignerDetails1);
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardingFlows.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardingFlowsThroughAPI.java
index da43435cdf..837f834ffa 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardingFlows.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardingFlowsThroughAPI.java
@@ -1,18 +1,10 @@
package org.openecomp.sdc.ci.tests.execute.sanity;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.openecomp.sdc.be.model.ArtifactDefinition;
-import org.openecomp.sdc.be.model.ComponentInstance;
-import org.openecomp.sdc.be.model.Resource;
+import com.aventstack.extentreports.Status;
+import com.clearspring.analytics.util.Pair;
+import fj.data.Either;
+import org.openecomp.sdc.be.model.*;
import org.openecomp.sdc.be.model.Service;
-import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.ci.tests.dataProviders.OnbordingDataProviders;
import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers;
import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
@@ -23,21 +15,19 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
-import org.openecomp.sdc.ci.tests.utilities.OnboardingUiUtils;
-import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
-import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
-import org.openecomp.sdc.ci.tests.utils.general.FileHandling;
-import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtillViaApis;
-import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils;
+import org.openecomp.sdc.ci.tests.utils.general.*;
import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
import org.testng.annotations.Test;
-import com.aventstack.extentreports.Status;
-import com.clearspring.analytics.util.Pair;
+import java.io.File;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
-import fj.data.Either;
+import static org.testng.AssertJUnit.assertTrue;
-public class OnboardingFlows extends SetupCDTest{
+public class OnboardingFlowsThroughAPI extends SetupCDTest{
protected boolean skipReport = false;
protected User sdncDesignerDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
@@ -57,9 +47,9 @@ public class OnboardingFlows extends SetupCDTest{
cvfcArtifacts.put(CvfcTypeEnum.VES_EVENTS, vesArtifactFileLocation);
getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile);
- AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUiUtils.createVendorLicense(getUser());
+ AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(getUser());
ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
- VendorSoftwareProductObject vendorSoftwareProductObject = OnboardingUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, cvfcArtifacts);
+ VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, cvfcArtifacts);
resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject);
Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails);
List<ComponentInstance> componentInstances = resource.getComponentInstances();
@@ -98,41 +88,56 @@ public class OnboardingFlows extends SetupCDTest{
String vnfFile = newRandomFileNamesFromFolder.get(0);
getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile);
// setLog(vnfFile);
- AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUiUtils.createVendorLicense(getUser());
+ getExtendTest().log(Status.INFO, "Create Vendor License");
+ AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(getUser());
ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
- VendorSoftwareProductObject vendorSoftwareProductObject = OnboardingUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null);
+ getExtendTest().log(Status.INFO, "Create Vendor Software Product: " + resourceReqDetails.getName());
+ VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null);
resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject);
+ getExtendTest().log(Status.INFO, "Create Resource: " + resourceReqDetails.getName());
Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails);
+ getExtendTest().log(Status.INFO, "Certify the Resource: " + resourceReqDetails.getName());
resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
ServiceReqDetails serviceReqDetails = OnboardingUtillViaApis.prepareServiceDetailsBeforeCreate(sdncDesignerDetails);
+ getExtendTest().log(Status.INFO, "Create Service: " + serviceReqDetails.getName());
org.openecomp.sdc.be.model.Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
-
+
+ getExtendTest().log(Status.INFO, "Add VF to service");
Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true);
addComponentInstanceToComponentContainer.left().value();
+ getExtendTest().log(Status.INFO, "Certify the service");
service = (org.openecomp.sdc.be.model.Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+ getExtendTest().log(Status.INFO, "Start distributing the service");
Boolean distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service);
+ getExtendTest().log(Status.INFO, "Service distributed");
assertTrue("Distribution of service " + service.getName() + " failed", distributeAndValidateService);
// update
vnfFile = newRandomFileNamesFromFolder.get(1);
- getExtendTest().log(Status.INFO, "Going to update VNF with file " + vnfFile);
- OnboardingUtils.updateVendorLicense(amdocsLicenseMembers, sdncDesignerDetails, "1.0");
- vendorSoftwareProductObject = OnboardingUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null);
+ getExtendTest().log(Status.INFO, "Going to update VLM with new file " + vnfFile);
+ VendorLicenseModelRestUtils.updateVendorLicense(amdocsLicenseMembers, sdncDesignerDetails, false);
+ vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null);
+ getExtendTest().log(Status.INFO, "Create new VSP: " + vendorSoftwareProductObject.getName());
resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject);
+ getExtendTest().log(Status.INFO, "Create new resource: " + resourceReqDetails.getName());
resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails);
+ getExtendTest().log(Status.INFO, "Certify the resource");
resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
serviceReqDetails = OnboardingUtillViaApis.prepareServiceDetailsBeforeCreate(sdncDesignerDetails);
+ getExtendTest().log(Status.INFO, "Create new service: " + serviceReqDetails.getName());
service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
-
+
+ getExtendTest().log(Status.INFO, "Add VF to service");
addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true);
addComponentInstanceToComponentContainer.left().value();
+ getExtendTest().log(Status.INFO, "Certify the service");
service = (org.openecomp.sdc.be.model.Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+ getExtendTest().log(Status.INFO, "Start distributing the service");
distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service);
+ getExtendTest().log(Status.INFO, "Service distributed");
assertTrue("Distribution of service " + service.getName() + " failed", distributeAndValidateService);
-
-
}
@@ -144,9 +149,9 @@ public class OnboardingFlows extends SetupCDTest{
String filePath = FileHandling.getVnfRepositoryPath();
String vnfFile = newRandomFileNamesFromFolder.get(0);
getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile);
- AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUiUtils.createVendorLicense(getUser());
+ AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(getUser());
ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
- VendorSoftwareProductObject vendorSoftwareProductObject = OnboardingUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null);
+ VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null);
resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject);
Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails);
resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
@@ -159,11 +164,11 @@ public class OnboardingFlows extends SetupCDTest{
service = (org.openecomp.sdc.be.model.Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
Boolean distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service);
assertTrue("Distribution of service " + service.getName() + " failed", distributeAndValidateService);
-
+
// update resource to v2.0
String updateVnfFile = newRandomFileNamesFromFolder.get(1);
getExtendTest().log(Status.INFO, "Going to update VNF with file " + vnfFile);
- OnboardingUiUtils.updateVendorSoftwareProduct(vendorSoftwareProductObject.getVspId(), updateVnfFile, filePath, sdncDesignerDetails, "2.0");
+ VendorSoftwareProductRestUtils.updateVendorSoftwareProductToNextVersion(vendorSoftwareProductObject, sdncDesignerDetails, filePath, updateVnfFile);
resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft();
resourceReqDetails.setUniqueId(resource.getUniqueId());
resourceReqDetails.setVersion(resource.getVersion());
@@ -207,12 +212,11 @@ public class OnboardingFlows extends SetupCDTest{
String vnfFile = newRandomFileNamesFromFolder.get(0);
getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile);
User sdncDesignerDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
- AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUiUtils.createVendorLicense(sdncDesignerDetails1);
+ AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(sdncDesignerDetails1);
getExtendTest().log(Status.INFO, "Create Vendor License Model " + amdocsLicenseMembers.getVendorLicenseName());
ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
getExtendTest().log(Status.INFO, "Create Vendor Software Product " + resourceReqDetails.getName());
- Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails1, amdocsLicenseMembers);
- VendorSoftwareProductObject vendorSoftwareProductObject = OnboardViaApis.fillVendorSoftwareProductObjectWithMetaData(vnfFile, createVendorSoftwareProduct);
+ VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null);
// 2. Create VF, certify - v1.0 is created
resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject);
getExtendTest().log(Status.INFO, "Create VF " + resourceReqDetails.getName());
@@ -221,8 +225,8 @@ public class OnboardingFlows extends SetupCDTest{
resource_v1 = (Resource) AtomicOperationUtils.changeComponentState(resource_v1, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
// 3. Update VSP to v2.0
getExtendTest().log(Status.INFO, "Update VSP to version 2.0");
- OnboardingUtils.updateVendorSoftwareProductToNextVersion(vendorSoftwareProductObject, "2.0", sdncDesignerDetails1, filePath, vnfFile);
- OnboardingUtils.validateVspExist(vendorSoftwareProductObject.getVspId(),vendorSoftwareProductObject.getVersion(),sdncDesignerDetails1);
+ VendorSoftwareProductRestUtils.updateVendorSoftwareProductToNextVersion(vendorSoftwareProductObject, sdncDesignerDetails1, filePath, vnfFile);
+ VendorSoftwareProductRestUtils.validateVspExist(vendorSoftwareProductObject, sdncDesignerDetails1);
// 4. Update the VF with v2.0 of the VSP
getExtendTest().log(Status.INFO, "Checkout VF v1.1");
resource_v1 = (Resource) AtomicOperationUtils.changeComponentState(resource_v1, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft();
@@ -235,8 +239,8 @@ public class OnboardingFlows extends SetupCDTest{
Resource resource_v2 = (Resource) AtomicOperationUtils.changeComponentState(resource_v1, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
// 5. Update VSP to v3.0 wih the zip from v1.0
getExtendTest().log(Status.INFO, "Update VSP to version 3.0");
- OnboardingUtils.updateVendorSoftwareProductToNextVersion(vendorSoftwareProductObject, "3.0", sdncDesignerDetails1);
- OnboardingUtils.validateVspExist(vendorSoftwareProductObject.getVspId(),vendorSoftwareProductObject.getVersion(),sdncDesignerDetails1);
+ VendorSoftwareProductRestUtils.updateVendorSoftwareProductToNextVersion(vendorSoftwareProductObject, sdncDesignerDetails1, false);
+ VendorSoftwareProductRestUtils.validateVspExist(vendorSoftwareProductObject, sdncDesignerDetails1);
getExtendTest().log(Status.INFO, "Checkout VF v2.1");
resource_v1 = (Resource) AtomicOperationUtils.changeComponentState(resource_v1, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft();
resourceReqDetails.setUniqueId(resource_v1.getUniqueId());
@@ -262,18 +266,17 @@ public class OnboardingFlows extends SetupCDTest{
}
@Test(dataProviderClass = org.openecomp.sdc.ci.tests.dataProvider.OnbordingDataProviders.class, dataProvider = "updateList")
- public void distributeServiceAndUpgradeWithNewHeatFile(String vnfFile1, String vnfFile2) throws Throwable
+ public void updateVSPFlowFromOnboardToDistribution(String vnfFile1, String vnfFile2) throws Throwable
{
- setLog(String.format("Update VSP Test: Create VF from %s add it to service, distribute than upgrade the VF with file %s and update the service and distribute", vnfFile1, vnfFile2));
+ setLog(String.format("Create VSP from %s , update VSP with %s ", vnfFile1, vnfFile2));
// 1. Import VSP v1.0
String filePath = org.openecomp.sdc.ci.tests.utilities.FileHandling.getUpdateVSPVnfRepositoryPath();
User sdncDesignerDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
- AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUtils.createVendorLicense(sdncDesignerDetails1);
+ AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(sdncDesignerDetails1);
getExtendTest().log(Status.INFO, String.format("Creating Vendor Software License (VLM): %s v1.0", amdocsLicenseMembers.getVendorLicenseName()));
ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
getExtendTest().log(Status.INFO, String.format("Creating Vendor Software Product (VSP): %s v1.0 from heat file: %s ", resourceReqDetails.getName(), vnfFile1));
- Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile1, filePath, sdncDesignerDetails1, amdocsLicenseMembers);
- VendorSoftwareProductObject vendorSoftwareProductObject = OnboardViaApis.fillVendorSoftwareProductObjectWithMetaData(vnfFile1, createVendorSoftwareProduct);
+ VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile1, filePath, sdncDesignerDetails, amdocsLicenseMembers, null);
// 2. Create VF, certify - v1.0 is created
resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject);
Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails);
@@ -289,16 +292,16 @@ public class OnboardingFlows extends SetupCDTest{
getExtendTest().log(Status.INFO, String.format("Adding VF instance to Service"));
service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
getExtendTest().log(Status.INFO, String.format("Certify the Service"));
-// 5. Distribute the Service v1.0
+// 4. Distribute the Service v1.0
Boolean distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service);
getExtendTest().log(Status.INFO, String.format("Distribute and validate the Service"));
assertTrue("Distribution status is " + distributeAndValidateService, distributeAndValidateService);
-// 6. Update VSP to v2.0
+// 5. Update VSP to v2.0
getExtendTest().log(Status.INFO, "Upgrading the VSP with new file: " + vnfFile2);
- OnboardingUtils.updateVendorSoftwareProductToNextVersion(vendorSoftwareProductObject, "2.0", sdncDesignerDetails1, filePath, vnfFile2);
+ VendorSoftwareProductRestUtils.updateVendorSoftwareProductToNextVersion(vendorSoftwareProductObject, sdncDesignerDetails1, filePath, vnfFile2);
getExtendTest().log(Status.INFO, String.format("Validating VSP %s upgrade to version 2.0: " ,vnfFile2));
- OnboardingUtils.validateVspExist(vendorSoftwareProductObject.getVspId(),vendorSoftwareProductObject.getVersion(),sdncDesignerDetails1);
-// 7. Update the VF with v2.0 of the VSP and certify the VF
+ VendorSoftwareProductRestUtils.validateVspExist(vendorSoftwareProductObject, sdncDesignerDetails1);
+// 6. Update the VF with v2.0 of the VSP and certify the VF
getExtendTest().log(Status.INFO, String.format("Checkout the VF %s v1.1 " ,resourceReqDetails.getName()));
resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft();
resourceReqDetails.setUniqueId(resource.getUniqueId());
@@ -308,34 +311,35 @@ public class OnboardingFlows extends SetupCDTest{
resource = AtomicOperationUtils.updateResource(resourceReqDetails, sdncDesignerDetails, true).left().value();
getExtendTest().log(Status.INFO, String.format("Certify the VF to v2.0"));
Resource resource_v2 = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
-// 8. Update the Service with the VFi version 2.0
+// 7. Update the Service with the VFi version 2.0
getExtendTest().log(Status.INFO, String.format("Checkout the Service v1.1"));
service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft();
getExtendTest().log(Status.INFO, String.format("Change the instance of the VF in the service to VFi v2.0"));
AtomicOperationUtils.changeComponentInstanceVersion(service, componentInstance, resource, UserRoleEnum.DESIGNER, true);
getExtendTest().log(Status.INFO, String.format("Certify the Service to v2.0"));
service = (org.openecomp.sdc.be.model.Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
-// 9. Distribute the service v2.0
+// 8. Distribute the service v2.0
distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service);
getExtendTest().log(Status.INFO, String.format("Distribute and validate the Service"));
assertTrue("Distribution status is " + distributeAndValidateService, distributeAndValidateService);
}
@Test(dataProviderClass = org.openecomp.sdc.ci.tests.dataProvider.OnbordingDataProviders.class, dataProvider = "VNF_List")
- public void distributeServiceFromHeatFile(String filePath, String vnfFile) throws Throwable
+ public void fromOnboardToDistribution(String filePath, String vnfFile) throws Throwable
{
// String vnfFile1 = "1-2016-20-visbc3vf-(VOIP)_v2.1.zip";
// String vnfFile2 = "2-2016-20-visbc3vf-(VOIP)_v2.0.zip";
- setLog(String.format("Distribute Service Test: Create VF from %s add it to service than distribute", vnfFile));
+ setLog(String.format("%s", vnfFile));
// 1. Import VSP v1.0
//String filePath = FileHandling.getVnfRepositoryPath();
User sdncDesignerDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
- AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUtils.createVendorLicense(sdncDesignerDetails1);
+ AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(sdncDesignerDetails1);
getExtendTest().log(Status.INFO, String.format("Creating Vendor Software License (VLM): %s v1.0", amdocsLicenseMembers.getVendorLicenseName()));
ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
getExtendTest().log(Status.INFO, String.format("Creating Vendor Software Product (VSP): %s v1.0 from heat file: %s ", resourceReqDetails.getName(), vnfFile));
- Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails1, amdocsLicenseMembers);
- VendorSoftwareProductObject vendorSoftwareProductObject = OnboardViaApis.fillVendorSoftwareProductObjectWithMetaData(vnfFile, createVendorSoftwareProduct);
+ Pair<String, VendorSoftwareProductObject> createVendorSoftwareProduct = VendorSoftwareProductRestUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails1, amdocsLicenseMembers);
+// VendorSoftwareProductObject vendorSoftwareProductObject = OnboardViaApis.fillVendorSoftwareProductObjectWithMetaData(vnfFile, createVendorSoftwareProduct);
+ VendorSoftwareProductObject vendorSoftwareProductObject = createVendorSoftwareProduct.right;
// 2. Create VF, certify - v1.0 is created
resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject);
Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails);
@@ -351,7 +355,7 @@ public class OnboardingFlows extends SetupCDTest{
getExtendTest().log(Status.INFO, String.format("Adding VF instance to Service"));
service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
getExtendTest().log(Status.INFO, String.format("Certify the Service"));
-// 5. Distribute the Service v1.0
+// 4. Distribute the Service v1.0
Boolean distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service);
getExtendTest().log(Status.INFO, String.format("Distribute and validate the Service"));
assertTrue("Distribution status is " + distributeAndValidateService, distributeAndValidateService);
@@ -362,14 +366,15 @@ public class OnboardingFlows extends SetupCDTest{
{
// 1. Import VSP v1.0
String filePath = FileHandling.getVnfRepositoryPath();
- String vnfFile1 = "HeatCandidate_2017-09-20_13-37_70Name_2017-491-4vshaken-HTTP-CM-vf-v1.0-(VOIP)_10202017.zip";
+ String vnfFile1 = "1-VF-vCSCF-StateDB-new-update_v3.0.zip";
User sdncDesignerDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
- AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUtils.createVendorLicense(sdncDesignerDetails1);
+ AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(sdncDesignerDetails1);
getExtendTest().log(Status.INFO, String.format("Creating Vendor Software License (VLM): %s v1.0", amdocsLicenseMembers.getVendorLicenseName()));
ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
getExtendTest().log(Status.INFO, String.format("Creating Vendor Software Product (VSP): %s v1.0 from heat file: %s ", resourceReqDetails.getName(), vnfFile1));
- Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile1, filePath, sdncDesignerDetails1, amdocsLicenseMembers);
- VendorSoftwareProductObject vendorSoftwareProductObject = OnboardViaApis.fillVendorSoftwareProductObjectWithMetaData(vnfFile1, createVendorSoftwareProduct);
+ Pair<String, VendorSoftwareProductObject> createVendorSoftwareProduct = VendorSoftwareProductRestUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile1, filePath, sdncDesignerDetails1, amdocsLicenseMembers);
+// VendorSoftwareProductObject vendorSoftwareProductObject = OnboardViaApis.fillVendorSoftwareProductObjectWithMetaData(vnfFile1, createVendorSoftwareProduct);
+ VendorSoftwareProductObject vendorSoftwareProductObject = createVendorSoftwareProduct.right;
// 2. Create VF, certify - v1.0 is created
resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject);
Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails);
@@ -385,7 +390,7 @@ public class OnboardingFlows extends SetupCDTest{
getExtendTest().log(Status.INFO, String.format("Adding VF instance to Service"));
service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
getExtendTest().log(Status.INFO, String.format("Certify the Service"));
-// 5. Distribute the Service v1.0
+// 4. Distribute the Service v1.0
Boolean distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service);
getExtendTest().log(Status.INFO, String.format("Distribute and validate the Service"));
assertTrue("Distribution status is " + distributeAndValidateService, distributeAndValidateService);
@@ -395,6 +400,5 @@ public class OnboardingFlows extends SetupCDTest{
protected UserRoleEnum getRole() {
return UserRoleEnum.DESIGNER;
}
-
-
+
}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Onboard.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardingFlowsUI.java
index 7681af63c3..b2314af267 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Onboard.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardingFlowsUI.java
@@ -20,43 +20,24 @@
package org.openecomp.sdc.ci.tests.execute.sanity;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.awt.AWTException;
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
+import com.aventstack.extentreports.Status;
+import com.clearspring.analytics.util.Pair;
import org.openecomp.sdc.ci.tests.dataProvider.OnbordingDataProviders;
-import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers;
-import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
-import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
-import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.*;
import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
import org.openecomp.sdc.ci.tests.execute.setup.ArtifactsCorrelationManager;
import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
-import org.openecomp.sdc.ci.tests.pages.CompositionPage;
-import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
-import org.openecomp.sdc.ci.tests.pages.GovernorOperationPage;
-import org.openecomp.sdc.ci.tests.pages.HomePage;
-import org.openecomp.sdc.ci.tests.pages.OpsOperationPage;
-import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
-import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage;
-import org.openecomp.sdc.ci.tests.pages.TesterOperationPage;
+import org.openecomp.sdc.ci.tests.pages.*;
import org.openecomp.sdc.ci.tests.utilities.FileHandling;
import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
import org.openecomp.sdc.ci.tests.utilities.OnboardingUiUtils;
import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.Utils;
import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils;
+import org.openecomp.sdc.ci.tests.utils.general.VendorLicenseModelRestUtils;
+import org.openecomp.sdc.ci.tests.utils.general.VendorSoftwareProductRestUtils;
import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator;
import org.openqa.selenium.WebElement;
import org.testng.AssertJUnit;
@@ -65,10 +46,17 @@ import org.testng.annotations.Optional;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
-import com.aventstack.extentreports.Status;
-import com.clearspring.analytics.util.Pair;
+import java.io.File;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import static org.testng.AssertJUnit.assertNotNull;
+import static org.testng.AssertJUnit.assertTrue;
-public class Onboard extends SetupCDTest {
+public class OnboardingFlowsUI extends SetupCDTest {
protected static String filePath = FileHandling.getVnfRepositoryPath();
protected String makeDistributionValue;
@@ -80,18 +68,30 @@ public class Onboard extends SetupCDTest {
}
@Test
- public void onboardVNFTestSanityOneFile() throws Exception, Throwable {
-// List<String> fileNamesFromFolder = OnboardingUiUtils.getVnfNamesFileList();
-// String vnfFile = fileNamesFromFolder.get(0).toString();
- String vnfFile = "2017-302_vNSO.zip";
-// String vnfFile = "1-Fn-vprobe-be-11-2-5-1-vf-(MOBILITY)_v5.0.zip";
+ public void onboardVNFTestSanityOneFile() throws Throwable {
+ String vnfFile = "1-VF-vUSP-vCCF-DB_v11.1.zip";
ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();//getServiceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, vnfFile);
}
-
+
+ @Test
+ public void performanceTest() throws Throwable {
+ System.out.println("Start test");
+ Long actualTestRunTime = Utils.getActionDuration(() -> {
+ try {
+ onboardVNFTestSanityOneFile();
+ } catch (Throwable throwable) {
+ throwable.printStackTrace();
+ }
+ });
+ Long regularTestRunTime = 400L;
+ double factor = 1.5;
+ assertTrue("Expected test run time should be less from " + regularTestRunTime*factor + ", actual time is " + actualTestRunTime , regularTestRunTime*factor>actualTestRunTime);
+ }
+
@Test
- public void onboardVNFTestSanity() throws Exception, Throwable {
+ public void onboardVNFTestSanity() throws Throwable {
List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileList();
String vnfFile = fileNamesFromFolder.get(0).toString();
ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
@@ -100,7 +100,7 @@ public class Onboard extends SetupCDTest {
}
- public void runOnboardToDistributionFlow(ResourceReqDetails resourceReqDetails, ServiceReqDetails serviceMetadata, String filePath, String vnfFile) throws Exception, AWTException {
+ public void runOnboardToDistributionFlow(ResourceReqDetails resourceReqDetails, ServiceReqDetails serviceMetadata, String filePath, String vnfFile) throws Exception {
getExtendTest().log(Status.INFO, "Going to create resource with category: " + resourceReqDetails.getCategories().get(0).getName()
+ " subCategory: " + resourceReqDetails.getCategories().get(0).getSubcategories().get(0).getName()
+ " and service category: " + serviceMetadata.getCategory());
@@ -151,8 +151,8 @@ public class Onboard extends SetupCDTest {
getExtendTest().log(Status.INFO, String.format("The onboarding %s test is passed ! ", vnfFile));
}
- public String onboardAndCertify(ResourceReqDetails resourceReqDetails, String filePath, String vnfFile) throws Exception, IOException {
- Pair<String,Map<String,String>> onboardAndValidate = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, filePath, vnfFile, getUser());
+ public String onboardAndCertify(ResourceReqDetails resourceReqDetails, String filePath, String vnfFile) throws Exception {
+ Pair<String, VendorSoftwareProductObject> onboardAndValidate = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, filePath, vnfFile, getUser());
String vspName = onboardAndValidate.left;
DeploymentArtifactPage.getLeftPanel().moveToCompositionScreen();
@@ -168,7 +168,7 @@ public class Onboard extends SetupCDTest {
@Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "VNF_List")
- public void onboardVNFTest(String filePath, String vnfFile) throws Exception, Throwable {
+ public void onboardVNFTest(String filePath, String vnfFile) throws Throwable {
setLog(vnfFile);
System.out.println("printttttttttttttt - >" + makeDistributionValue);
ResourceReqDetails resourceReqDetails = ElementFactory.getRandomCategoryResource();
@@ -177,7 +177,7 @@ public class Onboard extends SetupCDTest {
}
@Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "VNF_List")
- public void onboardVNFShotFlow(String filePath, String vnfFile) throws Exception, Throwable {
+ public void onboardVNFShotFlow(String filePath, String vnfFile) throws Throwable {
setLog(vnfFile);
System.out.println("printttttttttttttt - >" + makeDistributionValue);
ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
@@ -185,7 +185,7 @@ public class Onboard extends SetupCDTest {
}
@Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "randomVNF_List")
- public void onboardRandomVNFsTest(String filePath, String vnfFile) throws Exception, Throwable {
+ public void onboardRandomVNFsTest(String filePath, String vnfFile) throws Throwable {
setLog(vnfFile);
System.out.println("printttttttttttttt - >" + makeDistributionValue);
System.out.println("Vnf File name is: " + vnfFile);
@@ -196,13 +196,13 @@ public class Onboard extends SetupCDTest {
@Test
- public void onboardUpdateVNFTest() throws Exception, Throwable {
+ public void onboardUpdateVNFTest() throws Throwable {
// Object[] fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filePath);
List<String> fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filePath);
// String vnfFile = fileNamesFromFolder[0].toString();
String vnfFile = fileNamesFromFolder.get(0);
ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
- Pair<String,Map<String,String>> vsp = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, filePath, vnfFile, getUser());
+ Pair<String, VendorSoftwareProductObject> vsp = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, filePath, vnfFile, getUser());
String vspName = vsp.left;
ResourceGeneralPage.clickSubmitForTestingButton(vspName);
@@ -280,18 +280,17 @@ public class Onboard extends SetupCDTest {
public void threeVMMSCsInServiceTest() throws Exception{
String pathFile = FileHandling.getFilePath("VmmscArtifacts");
- List<String> vmmscList = new ArrayList<String>();
- vmmscList = Arrays.asList(new File(pathFile).list()).stream().filter(e -> e.contains("vmmsc") && e.endsWith(".zip")).collect(Collectors.toList());
+ List<String> vmmscList = Arrays.asList(new File(pathFile).list()).stream().filter(e -> e.contains("vmmsc") && e.endsWith(".zip")).collect(Collectors.toList());
assertTrue("Did not find vMMSCs", vmmscList.size() > 0);
- Map<String, String> vspNames = new HashMap<String, String>();
+ Map<String, String> vspNames = new HashMap<>();
for (String vnfFile : vmmscList){
getExtendTest().log(Status.INFO, String.format("Going to onboard the VNF %s......", vnfFile));
System.out.println(String.format("Going to onboard the VNF %s......", vnfFile));
- AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUiUtils.createVendorLicense(getUser());
+ AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(getUser());
ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
- Pair<String,Map<String,String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, pathFile, getUser(), amdocsLicenseMembers);
+ Pair<String, VendorSoftwareProductObject> createVendorSoftwareProduct = VendorSoftwareProductRestUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, pathFile, getUser(), amdocsLicenseMembers);
getExtendTest().log(Status.INFO, String.format("Searching for onboarded %s", vnfFile));
HomePage.showVspRepository();
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PNF.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PNF.java
index d24000806e..fa55a1e66d 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PNF.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PNF.java
@@ -1,43 +1,14 @@
package org.openecomp.sdc.ci.tests.execute.sanity;
-import static org.testng.Assert.assertTrue;
-
-import java.util.List;
-
+import com.aventstack.extentreports.Status;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.model.LifecycleStateEnum;
-import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo;
-import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
-import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
-import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum;
-import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum;
-import org.openecomp.sdc.ci.tests.datatypes.TypesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.CircleSize;
-import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.*;
+import org.openecomp.sdc.ci.tests.datatypes.enums.*;
import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
-import org.openecomp.sdc.ci.tests.pages.CompositionPage;
-import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
-import org.openecomp.sdc.ci.tests.pages.GeneralPageElements;
-import org.openecomp.sdc.ci.tests.pages.GovernorOperationPage;
-import org.openecomp.sdc.ci.tests.pages.InformationalArtifactPage;
-import org.openecomp.sdc.ci.tests.pages.OpsOperationPage;
-import org.openecomp.sdc.ci.tests.pages.PropertiesPage;
-import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
-import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage;
-import org.openecomp.sdc.ci.tests.pages.TesterOperationPage;
-import org.openecomp.sdc.ci.tests.pages.ToscaArtifactsPage;
-import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
-import org.openecomp.sdc.ci.tests.utilities.CatalogUIUtilitis;
-import org.openecomp.sdc.ci.tests.utilities.FileHandling;
-import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
-import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
-import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
+import org.openecomp.sdc.ci.tests.pages.*;
+import org.openecomp.sdc.ci.tests.utilities.*;
import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
@@ -45,11 +16,14 @@ import org.openecomp.sdc.ci.tests.verificator.VfVerificator;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.testng.AssertJUnit;
+import org.testng.SkipException;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-import com.aventstack.extentreports.Status;
+import java.util.List;
+
+import static org.testng.Assert.assertTrue;
public class PNF extends SetupCDTest {
@@ -117,6 +91,10 @@ public class PNF extends SetupCDTest {
@Test
public void addPropertiesToVfcInstanceInPNFTest() throws Exception {
+ if(true){
+ throw new SkipException("Open bug 373762, can't update properties on CP or VFC instance on Composition screen");
+ }
+
String fileName = "CP02.yml";
ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.CP, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PortMirroring.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PortMirroring.java
index b4bd55c6ca..ef957c6e32 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PortMirroring.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PortMirroring.java
@@ -1,124 +1,610 @@
package org.openecomp.sdc.ci.tests.execute.sanity;
-import java.util.Map;
-
-import org.openecomp.sdc.be.model.ComponentInstance;
+import com.aventstack.extentreports.Status;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.Service;
-import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers;
-import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
-import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
-import org.openecomp.sdc.ci.tests.datatypes.ConnectionWizardPopUpObject;
-import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ServiceContainer;
-import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject;
+import org.openecomp.sdc.ci.tests.datatypes.*;
import org.openecomp.sdc.ci.tests.datatypes.enums.CircleSize;
import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
-import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
import org.openecomp.sdc.ci.tests.pages.CompositionPage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage;
-import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.CatalogUIUtilitis;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.HomeUtils;
+import org.openecomp.sdc.ci.tests.utilities.PortMirroringUtils;
import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
import org.openecomp.sdc.ci.tests.utils.general.FileHandling;
-import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtillViaApis;
-import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils;
+import org.openecomp.sdc.ci.tests.verificator.PortMirroringVerificator;
import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator;
+import org.testng.AssertJUnit;
+import org.testng.SkipException;
import org.testng.annotations.Test;
-import com.aventstack.extentreports.Status;
-import com.clearspring.analytics.util.Pair;
+import java.io.File;
-import fj.data.Either;
+import static org.testng.Assert.assertTrue;
-public class PortMirroring extends SetupCDTest
-{
- @Override
- protected UserRoleEnum getRole() {
- return UserRoleEnum.DESIGNER3;
+public class PortMirroring extends SetupCDTest {
+
+ @Test
+ public void createPortMirroringConfigurationServiceProxy() throws Throwable {
+ PortMirrioringConfigurationObject portMirrioringConfigurationObject = PortMirroringUtils.createPortMirriongConfigurationStructure();
+ ServiceReqDetails serviceReqDetails = portMirrioringConfigurationObject.getServiceReqDetails();
+ CanvasManager canvasManager = portMirrioringConfigurationObject.getCanvasManager();
+ CanvasElement serviceElementVmmeSourceName = portMirrioringConfigurationObject.getServiceElementVmmeSourceName();
+ String vmmeSourceName = portMirrioringConfigurationObject.getVmmeSourceName();
+ CanvasElement serviceElementVprobeCollector = portMirrioringConfigurationObject.getServiceElementVprobeCollector();
+ String vprobeSourceName = portMirrioringConfigurationObject.getVprobeSourceName();
+
+ serviceReqDetails.setVersion("0.1");
+ getExtendTest().log(Status.INFO, "Validating links between elements were created");
+ ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 2);
+
+ canvasManager.clickOnCanvaElement(serviceElementVmmeSourceName);
+ PortMirroringVerificator.validatingProxyServiceNameAndType(vmmeSourceName, "0");
+
+ canvasManager.clickOnCanvaElement(serviceElementVprobeCollector);
+ PortMirroringVerificator.validatingProxyServiceNameAndType(vprobeSourceName, "0");
}
- String portMirroringElementNameInPallete = "Port Mirroring Configuration";
- String portMirroringCapReqType = "org.openecomp.capabilities.PortMirroring";
- String portMirroringSourceCapability = "Port Mirroring Configuration 0: source: [1, UNBOUNDED]";
- String portMirroringCollectorCapability = "Port Mirroring Configuration 0: collector: [1, 1]";
+ @Test
+ public void distributePortMirroringConfigurationServiceProxy() throws Throwable {
+ PortMirrioringConfigurationObject portMirrioringConfigurationObject = PortMirroringUtils.createPortMirriongConfigurationStructure();
+ ServiceReqDetails serviceReqDetails = portMirrioringConfigurationObject.getServiceReqDetails();
+ Service service = portMirrioringConfigurationObject.getService();
+
+ serviceReqDetails.setVersion("0.1");
+ getExtendTest().log(Status.INFO, "Validating links between elements were created");
+ ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 2);
+
+ getExtendTest().log(Status.INFO, String.format("Going to certify the Service"));
+ service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+ getExtendTest().log(Status.INFO, String.format("Service is certified"));
+ Boolean distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service);
+ getExtendTest().log(Status.INFO, String.format("Distribute and validate the Service"));
+ AssertJUnit.assertTrue("Distribution status is " + distributeAndValidateService, distributeAndValidateService);
+ }
@Test
- public void createPortMirroringServiceProxy() throws Throwable {
+ public void createPortMirroringByPolicyServiceProxy() throws Throwable {
//Using API onboard and certify 2 zip files Source: vmmme and Collector: Vprobe
String filePath = FileHandling.getPortMirroringRepositoryPath();
- ServiceContainer serviceContainerVmme_Source = createServiceFromHeatFile(filePath,"2016-227_vmme_vmme_30_1610_e2e.zip");
- ServiceContainer serviceContainerVprobe_Collector = createServiceFromHeatFile(filePath,"vProbe_2017-10-22_07-24.zip");
+ ServiceContainer serviceContainerVmme_Source = PortMirroringUtils.createServiceFromHeatFile(filePath, "2016-227_vmme_vmme_30_1610_e2e.zip");
+
+ // create service with required pnf's and certify it
+ Resource resourceCisco = PortMirroringUtils.GeneratePNFAndUpdateInput(PortMirroringEnum.CISCO_VENDOR_NAME.getValue(), PortMirroringEnum.CISCO_VENDOR_MODEL_NUMBER.getValue(), getUser());
+ Resource resourceAPCON1 = PortMirroringUtils.GeneratePNFAndUpdateInput(PortMirroringEnum.APCON1_VENDOR_NAME.getValue(), PortMirroringEnum.APCON1_VENDOR_MODEL_NUMBER.getValue(), getUser());
+ Resource resourceAPCON2 = PortMirroringUtils.GeneratePNFAndUpdateInput(PortMirroringEnum.APCON2_VENDOR_NAME.getValue(), PortMirroringEnum.APCON2_VENDOR_MODEL_NUMBER.getValue(), getUser());
+
+ ServiceReqDetails serviceReqDetailsCollector = ElementFactory.getDefaultService();
+ serviceReqDetailsCollector.setServiceType(PortMirroringEnum.SERVICE_TYPE.getValue());
+ getExtendTest().log(Status.INFO, String.format("Creating collector service %s (PNF container)", serviceReqDetailsCollector.getName()));
+ Service serviceCollector = AtomicOperationUtils.createCustomService(serviceReqDetailsCollector, UserRoleEnum.DESIGNER, true).left().value();
+
+ getExtendTest().log(Status.INFO, String.format("Adding pnf's: %s,%s,%s to service %s", resourceCisco.getName(), resourceAPCON1.getName(), resourceAPCON2.getName(), serviceCollector.getName()));
-// String vmmeSourceName = "ciServiceb560327d162f";
-// String vprobeSourceName = "ciService3d9933d31791";
+ AtomicOperationUtils.addComponentInstanceToComponentContainer(resourceCisco, serviceCollector, UserRoleEnum.DESIGNER, true, "80", "80");
+ AtomicOperationUtils.addComponentInstanceToComponentContainer(resourceAPCON1, serviceCollector, UserRoleEnum.DESIGNER, true, "80", "200");
+ AtomicOperationUtils.addComponentInstanceToComponentContainer(resourceAPCON2, serviceCollector, UserRoleEnum.DESIGNER, true, "200", "200");
- // create service
- ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
- ServiceUIUtils.createService(serviceMetadata, getUser());
+ serviceCollector = (Service) AtomicOperationUtils.changeComponentState(serviceCollector, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+
+ // create container service
+ ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
+ getExtendTest().log(Status.INFO, String.format("Creating container service %s", serviceReqDetails.getName()));
+ Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
String vmmeSourceName = serviceContainerVmme_Source.getService().getName();
- String vprobeSourceName = serviceContainerVprobe_Collector.getService().getName();
+ String collectorServiceName = serviceCollector.getName();
+
+ CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
+ GeneralUIUtils.findComponentAndClick(service.getName());
ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
CanvasManager canvasManager = CanvasManager.getCanvasManager();
CompositionPage.searchForElement(vmmeSourceName);
- CanvasElement serviceElementVmmeSourceName = canvasManager.createElementOnCanvas(vmmeSourceName);
-
- CompositionPage.searchForElement(vprobeSourceName);
- CanvasElement serviceElementVprobeCollector = canvasManager.createElementOnCanvas(vprobeSourceName);
-
- CompositionPage.searchForElement(portMirroringElementNameInPallete);
- CanvasElement portMirroringConfigurationElement = canvasManager.createElementOnCanvas(portMirroringElementNameInPallete);
-
- ConnectionWizardPopUpObject connectionWizardPopUpObjectVMME = new ConnectionWizardPopUpObject("","", portMirroringCapReqType, portMirroringSourceCapability);
- ConnectionWizardPopUpObject connectionWizardPopUpObjectVProbe = new ConnectionWizardPopUpObject("","", portMirroringCapReqType, portMirroringCollectorCapability);
-
- canvasManager.linkElementsAndSelectCapReqTypeAndCapReqName(serviceElementVmmeSourceName, CircleSize.SERVICE,portMirroringConfigurationElement, CircleSize.NORMATIVE, connectionWizardPopUpObjectVMME);
- canvasManager.linkElementsAndSelectCapReqTypeAndCapReqName(serviceElementVprobeCollector, CircleSize.SERVICE, portMirroringConfigurationElement, CircleSize.NORMATIVE, connectionWizardPopUpObjectVProbe);
-
- serviceMetadata.setVersion("0.1");
- ServiceVerificator.verifyLinkCreated(serviceMetadata, getUser(), 2);
-
- System.out.println("End");
- }
-
- public ServiceContainer createServiceFromHeatFile(String filePath, String vnfFile) throws Throwable
- {
- setLog(String.format("Distribute Service Test: Create VF from %s add it to service than distribute", vnfFile));
-// 1. Import VSP v1.0
- User sdncDesignerDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER3);
- AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUtils.createVendorLicense(sdncDesignerDetails1);
- getExtendTest().log(Status.INFO, String.format("Creating Vendor Software License (VLM): %s v1.0", amdocsLicenseMembers.getVendorLicenseName()));
- ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
- getExtendTest().log(Status.INFO, String.format("Creating Vendor Software Product (VSP): %s v1.0 from heat file: %s ", resourceReqDetails.getName(), vnfFile));
- Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails1, amdocsLicenseMembers);
- VendorSoftwareProductObject vendorSoftwareProductObject = OnboardViaApis.fillVendorSoftwareProductObjectWithMetaData(vnfFile, createVendorSoftwareProduct);
-// 2. Create VF, certify - v1.0 is created
- resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject);
- Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails);
- resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
- getExtendTest().log(Status.INFO, String.format("Creating Virtual Function (VF): %s v1.0", resourceReqDetails.getName()));
- getExtendTest().log(Status.INFO, String.format("Certify the VF"));
-// 3. Create Service add to it the certified VF and certify the Service v1.0
+ CanvasElement serviceElementVmmeSource = canvasManager.createElementOnCanvas(vmmeSourceName);
+
+ CompositionPage.searchForElement(collectorServiceName);
+ CanvasElement serviceElementCollectorService = canvasManager.createElementOnCanvas(collectorServiceName);
+
+ CompositionPage.searchForElement(PortMirroringEnum.PMCP_ELEMENT_IN_PALLETE.getValue());
+ CanvasElement portMirroringConfigurationByPolicyElement = canvasManager.createElementOnCanvas(PortMirroringEnum.PMCP_ELEMENT_IN_PALLETE.getValue());
+
+ ConnectionWizardPopUpObject connectionWizardPopUpObjectVMME = new ConnectionWizardPopUpObject("",
+ "",
+ PortMirroringEnum.PM_REQ_TYPE.getValue(),
+ PortMirroringEnum.PMCP_SOURCE_CAP.getValue());
+
+ canvasManager.linkElementsAndSelectCapReqTypeAndCapReqName(serviceElementVmmeSource,
+ CircleSize.SERVICE,
+ portMirroringConfigurationByPolicyElement,
+ CircleSize.NORMATIVE,
+ connectionWizardPopUpObjectVMME);
+
+ serviceReqDetails.setVersion("0.1");
+ getExtendTest().log(Status.INFO, "Validating link between elements was created");
+ ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 1);
+
+ canvasManager.clickOnCanvaElement(serviceElementVmmeSource);
+ PortMirroringVerificator.validatingProxyServiceNameAndType(vmmeSourceName, "0");
+
+ getExtendTest().log(Status.INFO, "Adding properties to PMCP");
+
+ if(true){
+ throw new SkipException("Open bug 373762, can't update properties on CP or VFC instance on Composition screen");
+ }
+
+ canvasManager.clickOnCanvaElement(portMirroringConfigurationByPolicyElement);
+ CompositionPage.showPropertiesAndAttributesTab();
+ CompositionPage.setSingleProperty(DataTestIdEnum.PortMirroring.COLLECTOR_NODE.getValue(), PortMirroringUtils.createProxyInstanceServiceName(collectorServiceName, "1"));
+ CompositionPage.setSingleProperty(DataTestIdEnum.PortMirroring.EQUIP_MODEL.getValue(), PortMirroringEnum.CISCO_VENDOR_MODEL_NUMBER.getValue());
+ CompositionPage.setSingleProperty(DataTestIdEnum.PortMirroring.EQUIP_VENDOR.getValue(), PortMirroringEnum.CISCO_VENDOR_NAME.getValue());
+
+ // Distribute the Port Mirroning Configuration By Policy
+ getExtendTest().log(Status.INFO, String.format("Going to certify the Service"));
+ service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+ getExtendTest().log(Status.INFO, String.format("Service is certified"));
+ Boolean distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service);
+ getExtendTest().log(Status.INFO, String.format("Distribute and validate the Service"));
+ AssertJUnit.assertTrue("Distribution status is " + distributeAndValidateService, distributeAndValidateService);
+ }
+
+ @Test
+ public void deletePMCPLink() throws Throwable {
+ ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
+ getExtendTest().log(Status.INFO, String.format("Creating container service %s", serviceReqDetails.getName()));
+ Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
+
+ String filePath = FileHandling.getPortMirroringRepositoryPath();
+ ServiceContainer serviceContainerVmme_Source = PortMirroringUtils.createServiceFromHeatFile(filePath, "2016-227_vmme_vmme_30_1610_e2e.zip");
+
+ String vmmeSourceName = serviceContainerVmme_Source.getService().getName();
+
+ CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
+ GeneralUIUtils.findComponentAndClick(service.getName());
+
+ ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+
+ CompositionPage.searchForElement(vmmeSourceName);
+ CanvasElement serviceElementVmmeSource = canvasManager.createElementOnCanvas(vmmeSourceName);
+
+ CompositionPage.searchForElement(PortMirroringEnum.PMCP_ELEMENT_IN_PALLETE.getValue());
+ CanvasElement portMirroringConfigurationByPolicyElement = canvasManager.createElementOnCanvas(PortMirroringEnum.PMCP_ELEMENT_IN_PALLETE.getValue());
+
+ ImmutablePair<Integer, Integer> linkLocation = canvasManager.calcMidOfLink(serviceElementVmmeSource.getLocation(), portMirroringConfigurationByPolicyElement.getLocation());
+
+ ConnectionWizardPopUpObject connectionWizardPopUpObjectVMME = new ConnectionWizardPopUpObject("",
+ "",
+ PortMirroringEnum.PM_REQ_TYPE.getValue(),
+ PortMirroringEnum.PMCP_SOURCE_CAP.getValue());
+
+ canvasManager.linkElementsAndSelectCapReqTypeAndCapReqName(serviceElementVmmeSource,
+ CircleSize.SERVICE,
+ portMirroringConfigurationByPolicyElement,
+ CircleSize.NORMATIVE,
+ connectionWizardPopUpObjectVMME);
+
+ CanvasElement linkBetweenPMCP_VMME = new CanvasElement("Link", linkLocation);
+
+ serviceReqDetails.setVersion("0.1");
+ getExtendTest().log(Status.INFO, "Validating link between elements was created");
+ ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 1);
+
+ canvasManager.openLinkPopupReqsCapsConnection(linkBetweenPMCP_VMME);
+ canvasManager.closeLinkPopupReqsCapsConnection();
+ canvasManager.deleteLinkPopupReqsCapsConnection(linkBetweenPMCP_VMME);
+
+ getExtendTest().log(Status.INFO, "Validating link deleted");
+ ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 0);
+ }
+
+ @Test
+ public void verifyPMCNotExistInVF() throws Exception {
+ Resource resource = PortMirroringUtils.getResourceByType(ResourceTypeEnum.VF, "VF", "VendorModel");
+
+ CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
+
+ GeneralUIUtils.findComponentAndClick(resource.getName());
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+
+ CompositionPage.searchForElement(PortMirroringEnum.PMC_ELEMENT_IN_PALLETE.getValue());
+
+ getExtendTest().log(Status.INFO, "Verify that Port Mirroring Configuration and Configuration by Policy doesn't exist for VF ");
+ boolean isPMCFound = GeneralUIUtils.isElementInvisibleByTestId(DataTestIdEnum.PortMirroring.PMC_NAME_IN_PALLETE.getValue());
+ boolean isPMCPFound = GeneralUIUtils.isElementInvisibleByTestId(DataTestIdEnum.PortMirroring.PMCP_NAME_IN_PALLETE.getValue());
+
+ assertTrue(isPMCFound);
+ assertTrue(isPMCPFound);
+ }
+
+ @Test
+ public void verifyPMCPTabs() throws Exception {
+
+ ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
+ getExtendTest().log(Status.INFO, String.format("Creating container service %s", serviceReqDetails.getName()));
+ Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
+
+ CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
+ GeneralUIUtils.findComponentAndClick(service.getName());
+
+ ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+
+ CompositionPage.searchForElement(PortMirroringEnum.PMCP_ELEMENT_IN_PALLETE.getValue());
+ CanvasElement portMirroringConfigurationByPolicyElement = canvasManager.createElementOnCanvas(PortMirroringEnum.PMCP_ELEMENT_IN_PALLETE.getValue());
+ canvasManager.clickOnCanvaElement(portMirroringConfigurationByPolicyElement);
+
+ PortMirroringVerificator.validateGeneralInfo();
+ PortMirroringVerificator.validateReqsAndCapsTabExist();
+ }
+
+
+ @Test
+ public void editPMCPName() throws Exception {
+
ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
+ getExtendTest().log(Status.INFO, String.format("Creating container service %s", serviceReqDetails.getName()));
Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
- getExtendTest().log(Status.INFO, String.format("Creating Service: %s v1.0", serviceReqDetails.getName()));
- Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true);
- ComponentInstance componentInstance = addComponentInstanceToComponentContainer.left().value();
- getExtendTest().log(Status.INFO, String.format("Adding VF instance to Service"));
+
+ CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
+ GeneralUIUtils.findComponentAndClick(service.getName());
+
+ ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+
+ CompositionPage.searchForElement(PortMirroringEnum.PMCP_ELEMENT_IN_PALLETE.getValue());
+ CanvasElement portMirroringConfigurationByPolicyElement = canvasManager.createElementOnCanvas(PortMirroringEnum.PMCP_ELEMENT_IN_PALLETE.getValue());
+
+ canvasManager.clickOnCanvaElement(portMirroringConfigurationByPolicyElement);
+
+ getExtendTest().log(Status.INFO, "Edit PMCP Name");
+ GeneralUIUtils.clickOnElementById(DataTestIdEnum.CompositionRightPanel.EDIT_PENCIL.getValue());
+ GeneralUIUtils.setTextInElementByDataTestID(DataTestIdEnum.CompositionRightPanel.INSTANCE_NAME_TEXTBOX.getValue(), PortMirroringEnum.PMCP_NEWNAME.getValue());
+ GeneralUIUtils.clickOnElementByTestId("OK");
+
+ PortMirroringVerificator.validateElementName(PortMirroringEnum.PMCP_NEWNAME.getValue());
+ }
+
+
+ @Test
+ public void deletePMCP() throws Exception {
+
+ ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
+ getExtendTest().log(Status.INFO, String.format("Creating container service %s", serviceReqDetails.getName()));
+ Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
+
+ CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
+ GeneralUIUtils.findComponentAndClick(service.getName());
+
+ ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+
+ CompositionPage.searchForElement(PortMirroringEnum.PMCP_ELEMENT_IN_PALLETE.getValue());
+ CanvasElement portMirroringConfigurationByPolicyElement = canvasManager.createElementOnCanvas(PortMirroringEnum.PMCP_ELEMENT_IN_PALLETE.getValue());
+
+ canvasManager.clickOnCanvaElement(portMirroringConfigurationByPolicyElement);
+
+ getExtendTest().log(Status.INFO, String.format("Delete element %s", portMirroringConfigurationByPolicyElement.getElementType()));
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.CompositionRightPanel.DELETE_ITEM.getValue());
+ GeneralUIUtils.clickOnElementByTestId("OK");
+
+ PortMirroringVerificator.validateElementName(service.getName());
+ }
+
+ @Test
+ public void createPortMirroringConfigurationMulipleInstances() throws Throwable {
+ PortMirrioringConfigurationObject portMirrioringConfigurationObject = PortMirroringUtils.createPortMirriongConfigurationStructure();
+ ServiceReqDetails serviceReqDetails = portMirrioringConfigurationObject.getServiceReqDetails();
+ CanvasElement serviceElementVmmeSourceName = portMirrioringConfigurationObject.getServiceElementVmmeSourceName();
+
+ serviceReqDetails.setVersion("0.1");
+ getExtendTest().log(Status.INFO, "Validating 2 links between elements were created");
+ ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 2);
+
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
+ GeneralUIUtils.ultimateWait();
+ GeneralUIUtils.findComponentAndClick(serviceReqDetails.getName());
+
+ getExtendTest().log(Status.INFO, "Adding second PMC to composition");
+ ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+ CompositionPage.searchForElement(PortMirroringEnum.PMC_ELEMENT_IN_PALLETE.getValue());
+ CanvasElement portMirroringConfigurationElement = canvasManager.createElementOnCanvas(PortMirroringEnum.PMC_ELEMENT_IN_PALLETE.getValue());
+
+ ConnectionWizardPopUpObject connectionWizardPopUpObjectVMME = new ConnectionWizardPopUpObject("", "",
+ PortMirroringEnum.PM_REQ_TYPE.getValue(), PortMirroringEnum.PMC1_SOURCE_CAP.getValue());
+
+ getExtendTest().log(Status.INFO, "Connect VMME to PMC again");
+ canvasManager.linkElementsAndSelectCapReqTypeAndCapReqName(serviceElementVmmeSourceName, CircleSize.SERVICE, portMirroringConfigurationElement,
+ CircleSize.NORMATIVE, connectionWizardPopUpObjectVMME);
+
+ getExtendTest().log(Status.INFO, "Connect VMME to PMC again");
+ canvasManager.linkElementsAndSelectCapReqTypeAndCapReqName(serviceElementVmmeSourceName, CircleSize.SERVICE, portMirroringConfigurationElement,
+ CircleSize.NORMATIVE, connectionWizardPopUpObjectVMME);
+
+ getExtendTest().log(Status.INFO, "Validating 4 links between elements exist");
+ ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 4);
+
+ getExtendTest().log(Status.INFO, "Adding second PMCP to composition");
+ CompositionPage.searchForElement(PortMirroringEnum.PMCP_ELEMENT_IN_PALLETE.getValue());
+ CanvasElement portMirroringConfigurationByPolicyElement = canvasManager.createElementOnCanvas(PortMirroringEnum.PMCP_ELEMENT_IN_PALLETE.getValue());
+
+ ConnectionWizardPopUpObject connectionWizardPopUpObjectVMME_PMCP = new ConnectionWizardPopUpObject("",
+ "",
+ PortMirroringEnum.PM_REQ_TYPE.getValue(),
+ PortMirroringEnum.PMCP_SOURCE_CAP.getValue());
+
+ getExtendTest().log(Status.INFO, "Connect VMME to PMCP again");
+ canvasManager.linkElementsAndSelectCapReqTypeAndCapReqName(serviceElementVmmeSourceName, CircleSize.SERVICE, portMirroringConfigurationByPolicyElement,
+ CircleSize.NORMATIVE, connectionWizardPopUpObjectVMME_PMCP);
+
+ getExtendTest().log(Status.INFO, "Connect VMME to PMCP again");
+ canvasManager.linkElementsAndSelectCapReqTypeAndCapReqName(serviceElementVmmeSourceName, CircleSize.SERVICE, portMirroringConfigurationByPolicyElement,
+ CircleSize.NORMATIVE, connectionWizardPopUpObjectVMME_PMCP);
+
+ serviceReqDetails.setVersion("0.1");
+ getExtendTest().log(Status.INFO, "Validating 6 links between elements exist");
+ ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 6);
+ }
+
+ @Test
+ public void downloadArtifactFromPMCService() throws Throwable {
+ //Scenario of bug 362271
+ PortMirrioringConfigurationObject portMirrioringConfigurationObject = PortMirroringUtils.createPortMirriongConfigurationStructure();
+ ServiceReqDetails serviceReqDetails = portMirrioringConfigurationObject.getServiceReqDetails();
+
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
+ GeneralUIUtils.ultimateWait();
+ GeneralUIUtils.findComponentAndClick(serviceReqDetails.getName());
+
+ ServiceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen();
+
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ToscaArtifactsScreenEnum.TOSCA_MODEL.getValue());
+ File latestFilefromDir = org.openecomp.sdc.ci.tests.utilities.FileHandling.getLastModifiedFileNameFromDir();
+ String actualToscaModelFilename = latestFilefromDir.getName();
+
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ToscaArtifactsScreenEnum.TOSCA_TEMPLATE.getValue());
+ latestFilefromDir = org.openecomp.sdc.ci.tests.utilities.FileHandling.getLastModifiedFileNameFromDir();
+ String actualToscaTemplateFilename = latestFilefromDir.getName();
+
+ String expectedToscaModelFilename = String.format("service-%s-csar.csar", serviceReqDetails.getName());
+ String expectedToscaTemplateFilename = String.format("service-%s-template.yml", serviceReqDetails.getName());
+
+ getExtendTest().log(Status.INFO, "Validating tosca artifact downloaded successfully");
+ AssertJUnit.assertTrue(actualToscaModelFilename.equalsIgnoreCase(expectedToscaModelFilename));
+ AssertJUnit.assertTrue(actualToscaTemplateFilename.equalsIgnoreCase(expectedToscaTemplateFilename));
+ }
+
+ @Test
+ public void checkoutMirroringConfigurationServiceProxyAndDeletePMC() throws Throwable {
+ PortMirrioringConfigurationObject portMirrioringConfigurationObject = PortMirroringUtils.createPortMirriongConfigurationStructure();
+ ServiceReqDetails serviceReqDetails = portMirrioringConfigurationObject.getServiceReqDetails();
+ Service service = portMirrioringConfigurationObject.getService();
+ CanvasElement portMirroringConfigurationElement = portMirrioringConfigurationObject.getPortMirroringConfigurationElement();
+
+ serviceReqDetails.setVersion("0.1");
+ getExtendTest().log(Status.INFO, "Validating links between elements were created");
+ ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 2);
+
+ getExtendTest().log(Status.INFO, String.format("Going to certify the Service"));
+ service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+
+ getExtendTest().log(Status.INFO, String.format("Checkout Port Mirroring Service"));
+ service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft();
+
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
+ GeneralUIUtils.ultimateWait();
+ HomeUtils.findComponentAndClickByVersion(service.getName(), "1.1");
+
+ ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+ GeneralUIUtils.ultimateWait();
+ canvasManager.clickOnCanvasPosition(portMirroringConfigurationElement.getLocation().getLeft(), portMirroringConfigurationElement.getLocation().getRight());
+ getExtendTest().log(Status.INFO, String.format("Delete element %s", portMirroringConfigurationElement.getElementType()));
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.CompositionRightPanel.DELETE_ITEM.getValue());
+ GeneralUIUtils.clickOnElementByTestId("OK");
+
+ PortMirroringVerificator.validateElementName(service.getName());
+ getExtendTest().log(Status.INFO, "Validating 0 links after delete the port mirroring element");
+ serviceReqDetails.setVersion("1.1");
+ ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 0);
+
+ getExtendTest().log(Status.INFO, String.format("Going to certify the Service"));
+ service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+
+ getExtendTest().log(Status.INFO, String.format("Service is certified"));
+ Boolean distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service);
+ getExtendTest().log(Status.INFO, String.format("Distribute and validate the Service"));
+ AssertJUnit.assertTrue("Distribution status is " + distributeAndValidateService, distributeAndValidateService);
+ }
+
+ @Test
+ public void updatePortMirroringServiceInstance() throws Throwable {
+
+ PortMirrioringConfigurationObject portMirrioringConfigurationObject = PortMirroringUtils.createPortMirriongConfigurationStructure();
+ Service service = portMirrioringConfigurationObject.getService();
+ CanvasElement vmmeCanvasElement = portMirrioringConfigurationObject.getServiceElementVmmeSourceName();
+
+ getExtendTest().log(Status.INFO, String.format("Going to certify the Service"));
+ service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+
+ Service serviceContainerVmme_Source = portMirrioringConfigurationObject.getServiceContainerVmme_Source();
+ getExtendTest().log(Status.INFO, String.format("Checkout the vmme Service"));
+ serviceContainerVmme_Source = (Service) AtomicOperationUtils.changeComponentState(serviceContainerVmme_Source, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft();
+ getExtendTest().log(Status.INFO, String.format("Going to certify the vmme Service"));
+ serviceContainerVmme_Source = (Service) AtomicOperationUtils.changeComponentState(serviceContainerVmme_Source, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+
+ getExtendTest().log(Status.INFO, String.format("Checkout Port Mirroring Service"));
+ service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft();
+
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
+ GeneralUIUtils.ultimateWait();
+ HomeUtils.findComponentAndClickByVersion(service.getName(), "1.1");
+
+ ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+
+ getExtendTest().log(Status.INFO, String.format("Change vmme source %s instance to version 2.0", serviceContainerVmme_Source.getName()));
+ CompositionPage.changeComponentVersion(canvasManager, vmmeCanvasElement, "2.0",false);
+
+ getExtendTest().log(Status.INFO, String.format("Going to certify the Service"));
service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
- getExtendTest().log(Status.INFO, String.format("Certify the Service"));
- return new ServiceContainer(service,resource,vendorSoftwareProductObject,amdocsLicenseMembers);
+ getExtendTest().log(Status.INFO, String.format("Service is certified"));
+ Boolean distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service);
+ getExtendTest().log(Status.INFO, String.format("Distribute and validate the Service"));
+ AssertJUnit.assertTrue("Distribution status is " + distributeAndValidateService, distributeAndValidateService);
}
+ @Test
+ public void updateLinkPropertiesPortMirroringService() throws Throwable {
+
+ ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
+ getExtendTest().log(Status.INFO, String.format("Creating container service %s", serviceReqDetails.getName()));
+ Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
+
+ String filePath = FileHandling.getPortMirroringRepositoryPath();
+ ServiceContainer serviceContainerVmme_Source = PortMirroringUtils.createServiceFromHeatFile(filePath, "2016-227_vmme_vmme_30_1610_e2e.zip");
+
+ String vmmeSourceName = serviceContainerVmme_Source.getService().getName();
+
+ CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
+ GeneralUIUtils.findComponentAndClick(service.getName());
+
+ ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+
+ CompositionPage.searchForElement(vmmeSourceName);
+ CanvasElement serviceElementVmmeSource = canvasManager.createElementOnCanvas(vmmeSourceName);
+
+ CompositionPage.searchForElement(PortMirroringEnum.PMCP_ELEMENT_IN_PALLETE.getValue());
+ CanvasElement portMirroringConfigurationByPolicyElement = canvasManager.createElementOnCanvas(PortMirroringEnum.PMCP_ELEMENT_IN_PALLETE.getValue());
+
+ ImmutablePair<Integer, Integer> linkLocation = canvasManager.calcMidOfLink(serviceElementVmmeSource.getLocation(), portMirroringConfigurationByPolicyElement.getLocation());
+
+ ConnectionWizardPopUpObject connectionWizardPopUpObjectVMME = new ConnectionWizardPopUpObject("",
+ "",
+ PortMirroringEnum.PM_REQ_TYPE.getValue(),
+ PortMirroringEnum.PMCP_SOURCE_CAP.getValue());
+
+ canvasManager.linkElementsAndSelectCapReqTypeAndCapReqName(serviceElementVmmeSource,
+ CircleSize.SERVICE,
+ portMirroringConfigurationByPolicyElement,
+ CircleSize.NORMATIVE,
+ connectionWizardPopUpObjectVMME);
+
+ CanvasElement linkBetweenPMCP_VMME = new CanvasElement("Link", linkLocation);
+
+ serviceReqDetails.setVersion("0.1");
+ getExtendTest().log(Status.INFO, "Validating link between elements was created");
+ ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 1);
+
+ canvasManager.openLinkPopupReqsCapsConnection(linkBetweenPMCP_VMME);
+
+ getExtendTest().log(Status.INFO, "Fill link properties with data");
+ GeneralUIUtils.setTextInElementByXpath(PortMirroringEnum.NETWORK_ROLE_XPATH.getValue(),PortMirroringEnum.NETWORK_ROLE_VALUE.getValue());
+ GeneralUIUtils.setTextInElementByXpath(PortMirroringEnum.NFC_TYPE_XPATH.getValue(),PortMirroringEnum.NFC_TYPE_VALUE.getValue());
+ GeneralUIUtils.setTextInElementByXpath(PortMirroringEnum.PPS_CAPACITY_XPATH.getValue(),PortMirroringEnum.PPS_CAPACITY_VALUE.getValue());
+ GeneralUIUtils.setTextInElementByXpath(PortMirroringEnum.NF_TYPE_XPATH.getValue(),PortMirroringEnum.NF_TYPE_VALUE.getValue());
+ GeneralUIUtils.ultimateWait();
+
+ if(true){
+ throw new SkipException("Open bug 373765, Can't update link property on Port Mirroring connection");
+ }
+
+ canvasManager.clickSaveOnLinkPopup();
+ Thread.sleep(3000); //Temp solution. Don't remove.
+ canvasManager.openLinkPopupReqsCapsConnection(linkBetweenPMCP_VMME);
+
+ PortMirroringVerificator.validateLinkProperties();
+ }
+
+ @Test
+ public void restorePortMirroringServiceLink() throws Throwable {
+ //Scenario is taken from bug 361475 - Second Scenario
+ PortMirrioringConfigurationObject portMirrioringConfigurationObject = PortMirroringUtils.createPortMirriongConfigurationStructure();
+ ServiceReqDetails serviceReqDetails = portMirrioringConfigurationObject.getServiceReqDetails();
+ Service service = portMirrioringConfigurationObject.getService();
+ CanvasElement vmmeCanvasElement = portMirrioringConfigurationObject.getServiceElementVmmeSourceName();
+ Service serviceContainerVmme_Source = portMirrioringConfigurationObject.getServiceContainerVmme_Source();
+
+ getExtendTest().log(Status.INFO, String.format("Checkout the vmme Service"));
+ serviceContainerVmme_Source = (Service) AtomicOperationUtils.changeComponentState(serviceContainerVmme_Source, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft();
+ getExtendTest().log(Status.INFO, String.format("Going to certify the vmme Service"));
+ serviceContainerVmme_Source = (Service) AtomicOperationUtils.changeComponentState(serviceContainerVmme_Source, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
+ GeneralUIUtils.ultimateWait();
+ HomeUtils.findComponentAndClick(service.getName());
+
+ ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+
+ getExtendTest().log(Status.INFO, String.format("Changing vmme source %s instance to version 2.0", serviceContainerVmme_Source.getName()));
+ CompositionPage.changeComponentVersion(canvasManager, vmmeCanvasElement, "2.0",false);
+
+ getExtendTest().log(Status.INFO, "Validating 1 link exist after change version to the vmme service (Newer version)");
+ ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 2);
+
+ getExtendTest().log(Status.INFO, String.format("Changing vmme source %s instance to version 1.0", serviceContainerVmme_Source.getName()));
+ CompositionPage.changeComponentVersion(canvasManager, vmmeCanvasElement, "1.0",false);
+
+ ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 2);
+ }
+
+ @Test
+ public void restoreServiceVersionOnContainerService() throws Throwable {
+ //Scenario is taken from bug 361475 - First Scenario
+ PortMirrioringConfigurationObject portMirrioringConfigurationObject = PortMirroringUtils.createPortMirriongConfigurationStructure();
+ ServiceReqDetails serviceReqDetails = portMirrioringConfigurationObject.getServiceReqDetails();
+ Service service = portMirrioringConfigurationObject.getService();
+ CanvasElement vmmeCanvasElement = portMirrioringConfigurationObject.getServiceElementVmmeSourceName();
+ Service serviceContainerVmme_Source = portMirrioringConfigurationObject.getServiceContainerVmme_Source();
+ Service serviceContainerVprobe_Vprobe_Collector = portMirrioringConfigurationObject.getServiceContainerVprobe_Collector();
+ CanvasElement vprobeCanvasElement = portMirrioringConfigurationObject.getServiceElementVprobeCollector();
+
+
+ getExtendTest().log(Status.INFO, String.format("Checkout the vmme Service"));
+ serviceContainerVmme_Source = (Service) AtomicOperationUtils.changeComponentState(serviceContainerVmme_Source, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft();
+ getExtendTest().log(Status.INFO, String.format("Going to certify the vmme Service"));
+ serviceContainerVmme_Source = (Service) AtomicOperationUtils.changeComponentState(serviceContainerVmme_Source, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
+ GeneralUIUtils.ultimateWait();
+ HomeUtils.findComponentAndClick(service.getName());
+
+ ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+
+ canvasManager.linkElements(vmmeCanvasElement, CircleSize.SERVICE, vprobeCanvasElement, CircleSize.SERVICE);
+
+ getExtendTest().log(Status.INFO, String.format("Changing vmme source %s instance to version 2.0", serviceContainerVmme_Source.getName()));
+ CompositionPage.changeComponentVersion(canvasManager, vmmeCanvasElement, "2.0",false);
+
+ getExtendTest().log(Status.INFO, "Validating 1 link exist after change version to the vmme service (Newer version)");
+ ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 3);
+
+ getExtendTest().log(Status.INFO, String.format("Changing vmme source %s instance to version 1.0", serviceContainerVmme_Source.getName()));
+ CompositionPage.changeComponentVersion(canvasManager, vmmeCanvasElement, "1.0",false);
+
+ ServiceVerificator.verifyLinkCreated(serviceReqDetails, getUser(), 3);
+ }
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PropertiesAssignment.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PropertiesAssignment.java
index 4ccc7b024b..ae7d4770ba 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PropertiesAssignment.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PropertiesAssignment.java
@@ -20,7 +20,10 @@
package org.openecomp.sdc.ci.tests.execute.sanity;
+import static org.testng.Assert.assertTrue;
+
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
@@ -29,8 +32,10 @@ import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
import org.openecomp.sdc.ci.tests.pages.PropertiesAssignmentPage;
import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.verificator.PropertiesAssignmentVerificator;
import org.testng.AssertJUnit;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
@@ -41,7 +46,9 @@ import com.aventstack.extentreports.Status;
public class PropertiesAssignment extends SetupCDTest {
- private String filePath;
+ private static String filePath;
+ private static String csarFile = "PCRF_OS_FIXED.csar";
+
@BeforeClass
public void beforeClass(){
filePath = FileHandling.getFilePath("");
@@ -60,13 +67,13 @@ public class PropertiesAssignment extends SetupCDTest {
// ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
// ResourceUIUtils.createResource(vfMetaData, getUser());
- String csarFile = "PCRF_OS_FIXED.csar";
+ String csarTestFile = csarFile;
String componentName = "abstract_pcm";
String propertyName = "min_instances";
ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
resourceMetaData.setVersion("0.1");
- ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, csarFile, getUser());
+ ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, csarTestFile, getUser());
ResourceGeneralPage.getLeftMenu().moveToPropertiesAssignmentScreen();
@@ -85,6 +92,36 @@ public class PropertiesAssignment extends SetupCDTest {
}
+
+
+ @Test
+ public void filterAllVfTest() throws Exception {
+// ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+// ResourceUIUtils.createResource(vfMetaData, getUser());
+
+ String csarTestFile = csarFile;
+ String propertyName = "name";
+ String propertyLocation = DataTestIdEnum.PropertiesAssignmentScreen.PROPERTY_NAME_COLUMN.getValue();
+ int propertiesCountFilter = 22;
+ int propertiesCountWithoutFilter = 0;
+
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+ resourceMetaData.setVersion("0.1");
+ ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, csarTestFile, getUser());
+
+
+ ResourceGeneralPage.getLeftMenu().moveToPropertiesAssignmentScreen();
+ //Count current properties number before filter is applied
+ propertiesCountWithoutFilter = GeneralUIUtils.getWebElementsListByContainsClassName(propertyLocation).size();
+ PropertiesAssignmentPage.clickOnFilterButton();
+ PropertiesAssignmentPage.clickOnFilterAllCheckbox();
+ PropertiesAssignmentPage.findFilterBoxAndClick(propertyName);
+ PropertiesAssignmentPage.clickOnFilterApplyButton();
+ PropertiesAssignmentVerificator.validateFilteredPropertiesCount(propertiesCountFilter, propertyLocation);
+
+ PropertiesAssignmentPage.clickOnFilterClearAllButton();
+ PropertiesAssignmentVerificator.validateFilteredPropertiesCount(propertiesCountWithoutFilter, propertyLocation);
+ }
@Override
protected UserRoleEnum getRole() {
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Service.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Service.java
index d6370c10dc..71466f3211 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Service.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Service.java
@@ -20,45 +20,22 @@
package org.openecomp.sdc.ci.tests.execute.sanity;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.awt.AWTException;
-import java.util.Arrays;
-import java.util.List;
-
+import com.aventstack.extentreports.Status;
import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.GroupDefinition;
import org.openecomp.sdc.be.model.LifecycleStateEnum;
-import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo;
-import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
-import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
-import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.datatypes.*;
import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.CompositionScreenEnum;
import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ServiceMetadataEnum;
-import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum;
-import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.*;
import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
-import org.openecomp.sdc.ci.tests.pages.CompositionPage;
-import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
-import org.openecomp.sdc.ci.tests.pages.DeploymentPage;
-import org.openecomp.sdc.ci.tests.pages.GeneralPageElements;
-import org.openecomp.sdc.ci.tests.pages.InputsPage;
-import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
-import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage;
-import org.openecomp.sdc.ci.tests.pages.TesterOperationPage;
-import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
-import org.openecomp.sdc.ci.tests.utilities.CatalogUIUtilitis;
-import org.openecomp.sdc.ci.tests.utilities.FileHandling;
-import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
-import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
-import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
+import org.openecomp.sdc.ci.tests.pages.*;
+import org.openecomp.sdc.ci.tests.utilities.*;
+import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
@@ -68,11 +45,17 @@ import org.openecomp.sdc.ci.tests.verificator.VfVerificator;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.testng.AssertJUnit;
+import org.testng.SkipException;
import org.testng.TestException;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-import com.aventstack.extentreports.Status;
+import java.awt.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import static org.testng.AssertJUnit.assertTrue;
public class Service extends SetupCDTest {
@@ -579,21 +562,35 @@ public class Service extends SetupCDTest {
}
@Test
- public void deploymentViewServiceTest() throws Exception{
- String fileName2 = "vSeGWNew.csar";
+ public void deploymentViewServiceTest() throws Exception{
+ User user = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+ String fileName2 = "vSeGWNew.csar";
+
ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName2, getUser());
+ Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, resourceMetaData.getName(), "0.1");
+ List<GroupDefinition> groups = resource.getGroups();
+ for (GroupDefinition group : groups) {
+ if(group.getType().equals("org.openecomp.groups.VfModule")) {
+ for(PropertyDataDefinition property : group.getProperties()){
+ if(property.getName().equals("max_vf_module_instances")) {
+ property.setValue("100");
+ List<PropertyDataDefinition> propertyList = new ArrayList<>();
+ propertyList.add(property);
+ AtomicOperationUtils.updateGroupPropertyOnResource(propertyList, resource, group.getUniqueId(), user, true);
+ break;
+ }
+ }
+ }
+ }
+
ResourceGeneralPage.clickCheckinButton(resourceMetaData.getName());
-
ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
ServiceUIUtils.createService(serviceMetadata, getUser());
-
addResourceToServiceInCanvas(resourceMetaData);
-
GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
DeploymentArtifactPage.getLeftMenu().moveToDeploymentViewScreen();
-
serviceMetadata.setVersion("0.1");
List<WebElement> instanceRowsFromTable = GeneralUIUtils.getElementsByCSS("div[data-tests-id^='hierarchy-instance'] span[class^='expand-collapse-title-text']");
for(WebElement instanceRow: instanceRowsFromTable){
@@ -602,14 +599,14 @@ public class Service extends SetupCDTest {
for (WebElement instanceModule: instanceModulesList){
String instanceModuleText = instanceModule.getText();
ResourceUIUtils.clickOnElementByText(instanceModuleText, "instance");
-
ServiceVerificator.verifyDeploymentPageSubElements(instanceModuleText.split("\\.\\.")[2], new DeploymentViewVerificator(filePath + fileName2));
-
ServiceVerificator.verifyDisabledServiceProperties();
- String isBaseValue = ServiceVerificator.getVFModulePropertieValue(serviceMetadata, "isBase", instanceModuleText);
+ if(true){
+ throw new SkipException("Sent email to Edith Ronen, waiting for answer");
+ }
+ String isBaseValue = ServiceVerificator.getVFModulePropertyValue(serviceMetadata, "isBase", instanceModuleText);
if (isBaseValue.equals("false"))
ServiceVerificator.verifyEnabledServiceProperties();
-
ResourceUIUtils.clickOnElementByText(instanceModuleText, "instance");
}
}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ToscaValidationTest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ToscaValidationTest.java
index d42df64a5a..14583607c7 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ToscaValidationTest.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ToscaValidationTest.java
@@ -1,34 +1,24 @@
package org.openecomp.sdc.ci.tests.execute.sanity;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
-
+import com.aventstack.extentreports.Status;
+import com.clearspring.analytics.util.Pair;
+import fj.data.Either;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
-import org.openecomp.sdc.be.model.Component;
-import org.openecomp.sdc.be.model.ComponentInstance;
-import org.openecomp.sdc.be.model.ComponentInstanceInput;
-import org.openecomp.sdc.be.model.PropertyDefinition;
-import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.model.*;
import org.openecomp.sdc.be.model.Service;
-import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject;
+import org.openecomp.sdc.ci.tests.dataProvider.OnbordingDataProviders;
+import org.openecomp.sdc.ci.tests.datatypes.*;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
-import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition;
-import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaInputsTopologyTemplateDefinition;
-import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaTopologyTemplateDefinition;
+import org.openecomp.sdc.ci.tests.tosca.datatypes.*;
import org.openecomp.sdc.ci.tests.tosca.model.ToscaMetadataFieldsPresentationEnum;
import org.openecomp.sdc.ci.tests.utilities.DownloadManager;
import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utils.CsarParserUtils;
import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils;
import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
@@ -37,15 +27,14 @@ import org.openecomp.sdc.ci.tests.utils.rest.PropertyRestUtils;
import org.openecomp.sdc.ci.tests.verificator.ToscaValidation;
import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper;
import org.openecomp.sdc.tosca.parser.impl.SdcToscaParserFactory;
+import org.openecomp.sdc.toscaparser.api.Group;
import org.openecomp.sdc.toscaparser.api.NodeTemplate;
import org.openecomp.sdc.toscaparser.api.elements.Metadata;
import org.testng.Assert;
import org.testng.annotations.Test;
-import com.aventstack.extentreports.Status;
-import com.clearspring.analytics.util.Pair;
-
-import fj.data.Either;
+import java.io.File;
+import java.util.*;
public class ToscaValidationTest extends SetupCDTest{
@@ -53,50 +42,11 @@ public class ToscaValidationTest extends SetupCDTest{
private static final String GENERIC_VF = "Generic_VF";
private static final String GENERIC_PNF = "Generic_PNF";
-// private ToscaDefinition toscaMainAmdocsDefinition, toscaMainVfDefinition, toscaMainServiceDefinition, toscaExpectedMainServiceDefinition;
- protected String vnfFile;
- protected String filepath;
-// protected File filesFolder = new File(SetupCDTest.getWindowTest().getDownloadDirectory());
protected SdcToscaParserFactory factory = SdcToscaParserFactory.getInstance();
-// protected ISdcCsarHelper fdntCsarHelper;
-// protected ResourceReqDetails resourceReqDetails;
-// protected Resource resource;
-// protected ServiceReqDetails serviceReqDetails;
-// protected Service service;
-// protected ComponentInstance componentInstanceDefinition;
User user = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
-// File importToscaFilesFolder = new File("C:/Git_work/sdc/catalog-be/src/main/resources/import/tosca/");
-
-// File dataTypesLocation = new File(importToscaFilesFolder.getPath() + "/data-types/dataTypes.yml");
-// List<Boolean> status = new ArrayList<>();
-
-// File genericVfFileLocation = new File(importToscaFilesFolder.getPath() + "/heat-types/Generic_VF/Generic_VF.yml");
-// File genericVfcFileLocation = new File (importToscaFilesFolder.getPath() + "/heat-types/Generic_VFC/Generic_VFC.yml");
-// File genericPnfFileLocation = new File (importToscaFilesFolder.getPath() + "/heat-types/Generic_PNF/Generic_PNF.yml");
-// File genericServiceFileLocation = new File (importToscaFilesFolder.getPath() + "/heat-types/Generic_Service/Generic_Service.yml");
-
-// Map<String, DataTypeDefinition> parseDataTypesYaml = FileHandling.parseDataTypesYaml(dataTypesLocation.getAbsoluteFile().toString());
-
-// toscaMainAmdocsDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + amdocsCsarFileName));
-// toscaMainVfDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + VfCsarFileName));
-// toscaMainServiceDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + serviceCsarFileName));
-// ToscaTopologyTemplateDefinition topologyTemplate = toscaMainAmdocsDefinition.getTopology_template();
-// ToscaDefinition objectHelper = ToscaParserUtils.parseToscaYamlToJavaObject(genericVfFileLocation);
-
- public ToscaValidationTest(String filepath, String vnfFile) {
- this.filepath = filepath;
- this.vnfFile = vnfFile;
- }
-
- public ToscaValidationTest() {
- }
-
-
-
-// @BeforeClass
- @Test()
- public void toscaFileValidator() throws Exception{
+ @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "VNF_List")
+ public void toscaFileValidator(String filePath, String vnfFile) throws Exception, Throwable{
//--------------------------GENERAL--------------------------------
/*// for debugging only
setLog("Test");
@@ -104,40 +54,35 @@ public class ToscaValidationTest extends SetupCDTest{
toscaMainAmdocsDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(amdocsCsarFileName);
toscaMainVfDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File("C:\\Users\\al714h\\Downloads\\resource-Civfonboarded2016073VmxBv301072E2eE60f5c15-csar.csar"));
*/
+// vnfFile = "BE-HEAT.zip";
setLog(vnfFile);
List<Boolean> status = new ArrayList<>();
ISdcCsarHelper fdntCsarHelper;
File filesFolder = new File(SetupCDTest.getWindowTest().getDownloadDirectory());
-// filesFolder = new File(SetupCDTest.getWindowTest().getDownloadDirectory());
-//--------------------------AMDOCS--------------------------------
-// vnfFile = "HeatCandidate_2017-09-22_01-32_60Name_Vdbe-vsp-15.1x49-d50.3-v1.0-(VOIP).zip";
+//--------------------------AMDOCS--------------------------------
ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, user);//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
- resourceReqDetails = createCustomizedVsp(resourceReqDetails, filepath, vnfFile);
-
+ resourceReqDetails = createCustomizedVsp(resourceReqDetails, filePath, vnfFile);
ToscaDefinition toscaMainAmdocsDefinition = downloadAndGetToscaMainYamlObjectUI(resourceReqDetails, filesFolder);
//------adding generic inputs to expected object
toscaMainAmdocsDefinition = addGenericPropertiesToToscaDefinitionObject(toscaMainAmdocsDefinition, GENERIC_VF);
// copy object
ToscaDefinition toscaExpectedMainServiceDefinition = new ToscaDefinition(toscaMainAmdocsDefinition);
+// create list of modules from HEAT.meta file
+ File latestFilefromDir = FileHandling.getLastModifiedFileNameFromDir();
+ List<TypeHeatMetaDefinition> listTypeHeatMetaDefinition = CsarParserUtils.getListTypeHeatMetaDefinition(latestFilefromDir);
+//TODO VfModuleVerificator.verifyGroupMetadata();
//TODO--------------------------AMDOCS DOWNLOAD VIA APIS--------------------------------
-
//--------------------------VF--------------------------------
// create VF base on VNF imported from previous step - have, resourceReqDetails object include part of resource metadata
Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails);
resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
-
ToscaDefinition toscaMainVfDefinition = downloadAndGetToscaMainYamlObjectApi(resource, filesFolder);
-
-//--------------------------SERVICE--------------------------------
+//--------------------------SERVICE--------------------------------
ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();//getServiceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
-// serviceReqDetails = OnboardingUtillViaApis.prepareServiceDetailsBeforeCreate(serviceReqDetails, user);
Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
-
Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true);
ComponentInstance componentInstanceDefinition = addComponentInstanceToComponentContainer.left().value();
-
//--------------------------getProperties set values and declare--------------------
-
Component componentObject = AtomicOperationUtils.getComponentObject(service, UserRoleEnum.DESIGNER);
Map<String, List<ComponentInstanceInput>> componentInstancesInputs = componentObject.getComponentInstancesInputs();
setValuesToPropertiesList(componentInstancesInputs, toscaExpectedMainServiceDefinition);
@@ -147,11 +92,70 @@ public class ToscaValidationTest extends SetupCDTest{
File ServiceCsarFileName = new File(File.separator + "ServiceCsar_" + ElementFactory.generateUUIDforSufix() + ".csar");
OnboardingUtillViaApis.downloadToscaCsarToDirectory(service, new File(filesFolder.getPath() + ServiceCsarFileName));
ToscaDefinition toscaMainServiceDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + ServiceCsarFileName));
+//--------------------------initialization of Tosca Parser--------------------------------
+ fdntCsarHelper = initSdcCsarHelper(ServiceCsarFileName, filesFolder);
+////---------------------------TESTS--------------------------------------------------
+ status = validateVfMetadata(toscaMainAmdocsDefinition, toscaMainVfDefinition, resourceReqDetails, resource, vnfFile, status);
+ status = validateResourceNodeTemplateMetadata(toscaMainVfDefinition, resource, vnfFile, status);
+ status = validateServiceMetadata(toscaMainServiceDefinition, serviceReqDetails, service, vnfFile, status);
+ status = validateServiceNodeTemplateMetadata(toscaMainServiceDefinition, componentInstanceDefinition, resourceReqDetails, resource, vnfFile, status);
+ status = validateServiceMetadataUsingParser(fdntCsarHelper, serviceReqDetails, service, vnfFile, status);
+ status = validateServiceNodeTemplateMetadataUsingParser(fdntCsarHelper, resourceReqDetails, resource, componentInstanceDefinition, vnfFile, status);
+ status = validateResourceInputs(toscaMainAmdocsDefinition, toscaMainVfDefinition, vnfFile, status);
+ status = validateServiceInputs(toscaExpectedMainServiceDefinition, toscaMainServiceDefinition, vnfFile, status);
+ status = validateServiceInputsUsingParser(fdntCsarHelper, toscaExpectedMainServiceDefinition, vnfFile, status);
+ Map<String, ToscaGroupsTopologyTemplateDefinition> expectedToscaServiceGroupsDefinitionObject = createExpectedToscaServiceGroupsDefinitionObject(resource, service, listTypeHeatMetaDefinition);
+ status = validateServiceModuleMetadata(expectedToscaServiceGroupsDefinitionObject, toscaMainServiceDefinition, vnfFile, status);
+ status = validateServiceModuleProperty(expectedToscaServiceGroupsDefinitionObject, toscaMainServiceDefinition, vnfFile, status);
+ status = validateServiceModuleMetadataUsingParser(fdntCsarHelper, expectedToscaServiceGroupsDefinitionObject, vnfFile, status);
+ status = validateServiceModulePropertyUsingParser(fdntCsarHelper, expectedToscaServiceGroupsDefinitionObject, vnfFile, status);
+ if(status.contains(false)){
+ SetupCDTest.getExtendTest().log(Status.FAIL, "Summary: tosca validation test failed with zip file " + vnfFile);
+ Assert.assertFalse(true);
+ }
+ }
+ @Test()
+ public void NetworkModel() throws Exception{
+//--------------------------GENERAL--------------------------------
+ String vnfFile = "networkModel";
+ setLog(vnfFile);
+ List<Boolean> status = new ArrayList<>();
+ ISdcCsarHelper fdntCsarHelper;
+ ToscaDefinition toscaMainAmdocsDefinition = new ToscaDefinition();
+ File filesFolder = new File(SetupCDTest.getWindowTest().getDownloadDirectory());
+// filesFolder = new File(SetupCDTest.getWindowTest().getDownloadDirectory());
+
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.PNF, user);
+ toscaMainAmdocsDefinition = addGenericPropertiesToToscaDefinitionObject(toscaMainAmdocsDefinition, GENERIC_PNF);
+ ToscaDefinition toscaExpectedMainServiceDefinition = new ToscaDefinition(toscaMainAmdocsDefinition);
+//--------------------------VF--------------------------------
+ Resource resource = AtomicOperationUtils.createResourceByResourceDetails(resourceReqDetails,UserRoleEnum.DESIGNER,true).left().value();
+ resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+
+ ToscaDefinition toscaMainVfDefinition = downloadAndGetToscaMainYamlObjectApi(resource, filesFolder);
+
+//--------------------------SERVICE--------------------------------
+ ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
+ Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
+
+ Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true);
+ ComponentInstance componentInstanceDefinition = addComponentInstanceToComponentContainer.left().value();
+
+//--------------------------getProperties set values and declare--------------------
+
+ Component componentObject = AtomicOperationUtils.getComponentObject(service, UserRoleEnum.DESIGNER);
+ Map<String, List<ComponentInstanceInput>> componentInstancesInputs = componentObject.getComponentInstancesInputs();
+ setValuesToPropertiesList(componentInstancesInputs, toscaExpectedMainServiceDefinition);
+ PropertyRestUtils.declareProporties(componentObject, componentInstancesInputs, user);
+
+ service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+ File ServiceCsarFileName = new File(File.separator + "ServiceCsar_" + ElementFactory.generateUUIDforSufix() + ".csar");
+ OnboardingUtillViaApis.downloadToscaCsarToDirectory(service, new File(filesFolder.getPath() + ServiceCsarFileName));
+ ToscaDefinition toscaMainServiceDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + ServiceCsarFileName));
-
//--------------------------initialization of Tosca Parser--------------------------------
fdntCsarHelper = initSdcCsarHelper(ServiceCsarFileName, filesFolder);
@@ -167,20 +171,14 @@ public class ToscaValidationTest extends SetupCDTest{
status = validateResourceInputs(toscaMainAmdocsDefinition, toscaMainVfDefinition, vnfFile, status);
status = validateServiceInputs(toscaExpectedMainServiceDefinition, toscaMainServiceDefinition, vnfFile, status);
status = validateServiceInputsUsingParser(fdntCsarHelper, toscaExpectedMainServiceDefinition, vnfFile, status);
-
+
if(status.contains(false)){
SetupCDTest.getExtendTest().log(Status.FAIL, "Summary: tosca validation test failed with zip file " + vnfFile);
Assert.assertFalse(true);
}
}
-
-
-
-
-
-
- /**The method set values to toscaDefinition object service level only, to resource level should put instead of setDefault --> setValue
+ /**The method set values to toscaDefinition object service level only, to resource level should put instead of setDefault --> setValue
* inputs.get(componentInstanceInput.getName()).setValue(randomString);
* @param componentInstancesInputs
* @param toscaDefinition
@@ -225,7 +223,17 @@ public class ToscaValidationTest extends SetupCDTest{
componentInstanceInput.setValue(myListofStrings);
inputs.get(componentInstanceInput.getName()).setDefault(myListofStrings);
}
-
+ else if (type.equals("json") ){
+ String myJson = "{\"firstParam\":\"my First Param Value\",\"secondParam\":\"my Second Param Value\",\"numberParam\":666}";
+ componentInstanceInput.setValue(myJson);
+ inputs.get(componentInstanceInput.getName()).setDefault(myJson);
+ }
+ else if (type.equals("comma_delimited_list") ){
+ String commaDelimitedList = "[\"one\", \"two\"]";
+ componentInstanceInput.setValue(commaDelimitedList);
+ inputs.get(componentInstanceInput.getName()).setDefault(commaDelimitedList);
+ }
+
String expectedServiceInputName = expectedServiceInputPrefix + componentInstanceInput.getName();
ToscaInputsTopologyTemplateDefinition oldInput = inputs.get(componentInstanceInput.getName());
inputs.put(expectedServiceInputName, oldInput);
@@ -258,7 +266,6 @@ public class ToscaValidationTest extends SetupCDTest{
}
-
//--------------------------Metadata verification--------------------------------
//--------------------------Resource--------------------------------
@@ -331,8 +338,6 @@ public class ToscaValidationTest extends SetupCDTest{
return status;
}
-
-
//--------------------------Input verification--------------------------------
//--------------------------Resource--------------------------------
@@ -357,11 +362,29 @@ public class ToscaValidationTest extends SetupCDTest{
status.add(false);
return status;
}
-
+
+ public List<Boolean> validateServiceModuleMetadata(Map<String, ToscaGroupsTopologyTemplateDefinition> expectedToscaServiceGroupsDefinitionObject, ToscaDefinition toscaMainServiceDefinition, String vnfFile, List<Boolean> status) {
+ reportStartTestPrint("validateServiceModuleMetadata", vnfFile);
+
+ Either<Boolean,Map<String, Object>> toscaServiceModuleMetadataValidator = ToscaValidation.serviceToscaGroupMetadataValidator(expectedToscaServiceGroupsDefinitionObject, toscaMainServiceDefinition);
+ if(toscaServiceModuleMetadataValidator.isRight())
+ status.add(false);
+ return status;
+ }
+
+ public List<Boolean> validateServiceModuleProperty(Map<String, ToscaGroupsTopologyTemplateDefinition> expectedToscaServiceGroupsDefinitionObject, ToscaDefinition toscaMainServiceDefinition, String vnfFile, List<Boolean> status) {
+ reportStartTestPrint("validateServiceModuleProperty", vnfFile);
+
+ Either<Boolean,Map<String, Object>> toscaServiceModulePropertyValidator = ToscaValidation.serviceToscaGroupPropertyValidator(expectedToscaServiceGroupsDefinitionObject, toscaMainServiceDefinition);
+ if(toscaServiceModulePropertyValidator.isRight())
+ status.add(false);
+ return status;
+ }
+
//--------------------------Service verification against Pavel Parser--------------------------------
public List<Boolean> validateServiceInputsUsingParser(ISdcCsarHelper fdntCsarHelper, ToscaDefinition toscaExpectedMainServiceDefinition, String vnfFile, List<Boolean> status) throws Exception{
if(fdntCsarHelper == null){
- reportSkipTestPrint("validateServiceInputsUsingParser", status);
+ reportSkipTestPrint("validateServiceInputsUsingParser", status);
}else{
reportStartTestPrint("validateServiceInputsUsingParser", vnfFile);
Map<String, ToscaInputsTopologyTemplateDefinition> expectedInputsMap = toscaExpectedMainServiceDefinition.getTopology_template().getInputs();
@@ -371,24 +394,143 @@ public class ToscaValidationTest extends SetupCDTest{
}
return status;
}
-
- //--------------------------XXX verification--------------------------------
-
- //--------------------------Resource--------------------------------
-
-
- //--------------------------Service--------------------------------
-
-
- //--------------------------Service verification against Pavel Parser--------------------------------
-
-
-
-
-
-
-
-
+
+ public List<Boolean> validateServiceModuleMetadataUsingParser(ISdcCsarHelper fdntCsarHelper, Map<String, ToscaGroupsTopologyTemplateDefinition> expectedToscaServiceGroupsDefinitionObject, String vnfFile, List<Boolean> status) {
+ reportStartTestPrint("validateServiceModuleMetadataUsingParser", vnfFile);
+ String customizationUUID = fdntCsarHelper.getServiceNodeTemplates().get(0).getMetaData().getValue("customizationUUID");
+ List<Group> actualGroups = fdntCsarHelper.getVfModulesByVf(customizationUUID);
+ Either<Boolean,Map<String, Object>> toscaServiceModuleMetadataValidator = ToscaValidation.serviceToscaGroupMetadataValidatorUsingParser(expectedToscaServiceGroupsDefinitionObject, actualGroups);
+ if(toscaServiceModuleMetadataValidator.isRight())
+ status.add(false);
+ return status;
+ }
+
+ public List<Boolean> validateServiceModulePropertyUsingParser(ISdcCsarHelper fdntCsarHelper, Map<String, ToscaGroupsTopologyTemplateDefinition> expectedToscaServiceGroupsDefinitionObject, String vnfFile, List<Boolean> status) {
+ reportStartTestPrint("validateServiceModuleMetadataUsingParser", vnfFile);
+ String customizationUUID = fdntCsarHelper.getServiceNodeTemplates().get(0).getMetaData().getValue("customizationUUID");
+ List<Group> actualGroups = fdntCsarHelper.getVfModulesByVf(customizationUUID);
+ Either<Boolean,Map<String, Object>> toscaServiceModuleMetadataValidator = ToscaValidation.serviceToscaGroupPropertyValidatorUsingParser(expectedToscaServiceGroupsDefinitionObject, actualGroups);
+ if(toscaServiceModuleMetadataValidator.isRight())
+ status.add(false);
+ return status;
+ }
+
+ private Map<String, ToscaGroupsTopologyTemplateDefinition> createExpectedToscaServiceGroupsDefinitionObject(Resource resource, Service service, List<TypeHeatMetaDefinition> listTypeHeatMetaDefinition) {
+ Map<String, ToscaGroupsTopologyTemplateDefinition> toscaGroupsTopologyTemplateDefinitionMap = new HashMap<>();
+
+ for (TypeHeatMetaDefinition moduleType : listTypeHeatMetaDefinition) {
+ if (!moduleType.getTypeName().equals("artifacts")) {
+ for(GroupHeatMetaDefinition module : moduleType.getGroupHeatMetaDefinition()){
+ ToscaGroupsTopologyTemplateDefinition toscaGroupsTopologyTemplateDefinition = new ToscaGroupsTopologyTemplateDefinition();
+ String resourceModuleName = buildResourceModuleName(resource, module.getGroupName());
+ ToscaServiceGroupsMetadataDefinition toscaServiceGroupsMetadataDefinition = setGroupMetadataFromResourceObject(resourceModuleName, resource);
+ if(!toscaServiceGroupsMetadataDefinition.equals("")){
+ String serviceModuleName = buildServiceModuleName(service.getComponentInstances().get(0).getNormalizedName(), toscaServiceGroupsMetadataDefinition.getVfModuleModelName());
+ toscaServiceGroupsMetadataDefinition = setGroupMetadataFromServiceObject(toscaServiceGroupsMetadataDefinition, serviceModuleName, service);
+ toscaGroupsTopologyTemplateDefinition.setMetadata(toscaServiceGroupsMetadataDefinition);
+ ToscaGroupPropertyDefinition toscaGroupPropertyDefinition = setGroupProperty(module);
+ toscaGroupsTopologyTemplateDefinition.setProperties(toscaGroupPropertyDefinition);
+ toscaGroupsTopologyTemplateDefinitionMap.put(serviceModuleName,toscaGroupsTopologyTemplateDefinition);
+
+ }else{
+ getExtendTest().log(Status.FAIL, "module name [" + module.getGroupName() + "] didn't represent in resource");
+ }
+ }
+ }
+ }
+ return toscaGroupsTopologyTemplateDefinitionMap;
+
+ }
+
+ private ToscaGroupPropertyDefinition setGroupProperty(GroupHeatMetaDefinition module) {
+ ToscaGroupPropertyDefinition toscaGroupPropertyDefinition = new ToscaGroupPropertyDefinition();
+ toscaGroupPropertyDefinition.setVf_module_label(module.getGroupName());
+ Boolean isBase = module.getPropertyHeatMetaDefinition().getValue();
+ if(isBase){
+ toscaGroupPropertyDefinition.setInitial_count("1");
+ toscaGroupPropertyDefinition.setMin_vf_module_instances("1");
+ toscaGroupPropertyDefinition.setMax_vf_module_instances("1");
+ toscaGroupPropertyDefinition.setVf_module_type("Base");
+ }else{
+ toscaGroupPropertyDefinition.setInitial_count("0");
+ toscaGroupPropertyDefinition.setMin_vf_module_instances("0");
+ toscaGroupPropertyDefinition.setMax_vf_module_instances(null);
+ toscaGroupPropertyDefinition.setVf_module_type("Expansion");
+ }
+ toscaGroupPropertyDefinition.setAvailability_zone_count(null);
+ toscaGroupPropertyDefinition.setVfc_list(null);
+ toscaGroupPropertyDefinition.setVf_module_description(null);
+ toscaGroupPropertyDefinition.setVolume_group(isVolumeGroup(module));
+
+ return toscaGroupPropertyDefinition;
+ }
+
+ private String isVolumeGroup(GroupHeatMetaDefinition module) {
+ String isVolumeGroup = "false";
+ for( HeatMetaFirstLevelDefinition artifactList : module.getArtifactList()){
+ if(artifactList.getType().equals(ArtifactTypeEnum.HEAT_VOL.getType())){
+ isVolumeGroup = "true";
+ return isVolumeGroup;
+ }
+ }
+ return isVolumeGroup;
+ }
+
+ private Map<String,ToscaServiceGroupsMetadataDefinition> createExpectedToscaServiceGroupsPropertyDefinitionObject(Resource resource, Service service, List<TypeHeatMetaDefinition> listTypeHeatMetaDefinition) {
+
+ Map<String,ToscaServiceGroupsMetadataDefinition> toscaServiceGroupsMetadataDefinitionMap = new HashMap<>();
+ for (TypeHeatMetaDefinition moduleType : listTypeHeatMetaDefinition) {
+ Map<String, String> groupProperty = new HashMap<>();
+
+ ToscaServiceGroupsMetadataDefinition toscaServiceGroupsMetadataDefinition = new ToscaServiceGroupsMetadataDefinition();
+ for(GroupHeatMetaDefinition module : moduleType.getGroupHeatMetaDefinition()){
+ String resourceModuleName = buildResourceModuleName(resource, module.getGroupName());
+ toscaServiceGroupsMetadataDefinition = setGroupMetadataFromResourceObject(resourceModuleName, resource);
+ if(!toscaServiceGroupsMetadataDefinition.equals("")){
+ String serviceModuleName = buildServiceModuleName(service.getComponentInstances().get(0).getNormalizedName(), toscaServiceGroupsMetadataDefinition.getVfModuleModelName());
+ toscaServiceGroupsMetadataDefinition = setGroupMetadataFromServiceObject(toscaServiceGroupsMetadataDefinition, serviceModuleName, service);
+ toscaServiceGroupsMetadataDefinitionMap.put(serviceModuleName, toscaServiceGroupsMetadataDefinition);
+ }else{
+ getExtendTest().log(Status.FAIL, "module name [" + module.getGroupName() + "] didn't represent in resource");
+ }
+ }
+ }
+ return toscaServiceGroupsMetadataDefinitionMap;
+
+ }
+
+ private ToscaServiceGroupsMetadataDefinition setGroupMetadataFromServiceObject(ToscaServiceGroupsMetadataDefinition toscaServiceGroupsMetadataDefinition, String serviceModuleName, Service service) {
+ for (GroupInstance groupInstance : service.getComponentInstances().get(0).getGroupInstances()) {
+ if (groupInstance.getName().equals(serviceModuleName)) {
+ toscaServiceGroupsMetadataDefinition.setVfModuleModelCustomizationUUID(groupInstance.getCustomizationUUID());
+ return toscaServiceGroupsMetadataDefinition;
+ }
+ }
+ return toscaServiceGroupsMetadataDefinition;
+ }
+
+ private ToscaServiceGroupsMetadataDefinition setGroupMetadataFromResourceObject(String resourceModuleName, Resource resource) {
+ ToscaServiceGroupsMetadataDefinition toscaServiceGroupsMetadataDefinition = new ToscaServiceGroupsMetadataDefinition();
+ for (GroupDefinition group : resource.getGroups()) {
+ if (group.getName().contains(resourceModuleName)) {
+ toscaServiceGroupsMetadataDefinition.setVfModuleModelName(group.getName());
+ toscaServiceGroupsMetadataDefinition.setVfModuleModelInvariantUUID(group.getInvariantUUID());
+ toscaServiceGroupsMetadataDefinition.setVfModuleModelUUID(group.getGroupUUID());
+ toscaServiceGroupsMetadataDefinition.setVfModuleModelVersion(group.getVersion());
+ return toscaServiceGroupsMetadataDefinition;
+ }
+ }
+ return toscaServiceGroupsMetadataDefinition;
+ }
+
+ public static String buildResourceModuleName(Resource resource, String groupName ){
+ return resource.getSystemName()+".."+groupName+".."+"module-";
+ }
+ public static String buildServiceModuleName(String resourceInstanceNormalizedName, String resourceGroupName ){
+ return resourceInstanceNormalizedName+".."+resourceGroupName;
+ }
+
+
@Override
protected UserRoleEnum getRole() {
return UserRoleEnum.DESIGNER;
@@ -427,8 +569,6 @@ public class ToscaValidationTest extends SetupCDTest{
return toscaDefinition;
}
-
-
public static ToscaDefinition addAndGenerateResourceMetadataToExpectedObject(ToscaDefinition toscaDefinition, ResourceReqDetails resourceReqDetails, Component component) {
Map<String, String> metadata = convertResourceMetadataToMap(resourceReqDetails, component);
@@ -436,7 +576,6 @@ public class ToscaValidationTest extends SetupCDTest{
return toscaDefinition;
}
-
public static Map<String, String> convertResourceMetadataToMap(ResourceReqDetails resourceReqDetails, Component component) {
Map<String, String> metadata = new HashMap<>();
@@ -474,8 +613,8 @@ public class ToscaValidationTest extends SetupCDTest{
metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.VERSION.value, componentInstance.getComponentVersion());
return metadata;
-
}
+
public static Map<String, String> generateServiceNodeTemplateMetadataToExpectedObject(ResourceReqDetails resourceReqDetails, Component component, ComponentInstance componentInstanceDefinition) {
Map<String, String> metadata = convertResourceMetadataToMap(resourceReqDetails, component);
@@ -580,71 +719,11 @@ public class ToscaValidationTest extends SetupCDTest{
SetupCDTest.getExtendTest().log(Status.FAIL, "Summary: allottedResourceModelTest tosca validation test failed with zip file " + vnfFile);
Assert.assertFalse(true);
}
- }
-
-
-
- @Test()
- public void NetworkModel() throws Exception{
-//--------------------------GENERAL--------------------------------
- String vnfFile = "networkModel";
- setLog(vnfFile);
- List<Boolean> status = new ArrayList<>();
- ISdcCsarHelper fdntCsarHelper;
- ToscaDefinition toscaMainAmdocsDefinition = new ToscaDefinition();
- File filesFolder = new File(SetupCDTest.getWindowTest().getDownloadDirectory());
-// filesFolder = new File(SetupCDTest.getWindowTest().getDownloadDirectory());
-
- ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.PNF, user);
- toscaMainAmdocsDefinition = addGenericPropertiesToToscaDefinitionObject(toscaMainAmdocsDefinition, GENERIC_PNF);
- ToscaDefinition toscaExpectedMainServiceDefinition = new ToscaDefinition(toscaMainAmdocsDefinition);
-//--------------------------VF--------------------------------
- Resource resource = AtomicOperationUtils.createResourceByResourceDetails(resourceReqDetails,UserRoleEnum.DESIGNER,true).left().value();
- resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
-
- ToscaDefinition toscaMainVfDefinition = downloadAndGetToscaMainYamlObjectApi(resource, filesFolder);
-
-//--------------------------SERVICE--------------------------------
- ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
- Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
-
- Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true);
- ComponentInstance componentInstanceDefinition = addComponentInstanceToComponentContainer.left().value();
-
-//--------------------------getProperties set values and declare--------------------
-
- Component componentObject = AtomicOperationUtils.getComponentObject(service, UserRoleEnum.DESIGNER);
- Map<String, List<ComponentInstanceInput>> componentInstancesInputs = componentObject.getComponentInstancesInputs();
- setValuesToPropertiesList(componentInstancesInputs, toscaExpectedMainServiceDefinition);
- PropertyRestUtils.declareProporties(componentObject, componentInstancesInputs, user);
-
- service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
- File ServiceCsarFileName = new File(File.separator + "ServiceCsar_" + ElementFactory.generateUUIDforSufix() + ".csar");
- OnboardingUtillViaApis.downloadToscaCsarToDirectory(service, new File(filesFolder.getPath() + ServiceCsarFileName));
- ToscaDefinition toscaMainServiceDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + ServiceCsarFileName));
+ }*/
-//--------------------------initialization of Tosca Parser--------------------------------
- fdntCsarHelper = initSdcCsarHelper(ServiceCsarFileName, filesFolder);
-//---------------------------TESTS--------------------------------------------------
- status = validateVfMetadata(toscaMainAmdocsDefinition, toscaMainVfDefinition, resourceReqDetails, resource, vnfFile, status);
- status = validateResourceNodeTemplateMetadata(toscaMainVfDefinition, resource, vnfFile, status);
- status = validateServiceMetadata(toscaMainServiceDefinition, serviceReqDetails, service, vnfFile, status);
- status = validateServiceNodeTemplateMetadata(toscaMainServiceDefinition, componentInstanceDefinition, resourceReqDetails, resource, vnfFile, status);
- status = validateServiceMetadataUsingParser(fdntCsarHelper, serviceReqDetails, service, vnfFile, status);
- status = validateServiceNodeTemplateMetadataUsingParser(fdntCsarHelper, resourceReqDetails, resource, componentInstanceDefinition, vnfFile, status);
- status = validateResourceInputs(toscaMainAmdocsDefinition, toscaMainVfDefinition, vnfFile, status);
- status = validateServiceInputs(toscaExpectedMainServiceDefinition, toscaMainServiceDefinition, vnfFile, status);
- status = validateServiceInputsUsingParser(fdntCsarHelper, toscaExpectedMainServiceDefinition, vnfFile, status);
-
- if(status.contains(false)){
- SetupCDTest.getExtendTest().log(Status.FAIL, "Summary: tosca validation test failed with zip file " + vnfFile);
- Assert.assertFalse(true);
- }
- }*/
-
// help method to toscaValidation tests
private ISdcCsarHelper initSdcCsarHelper(File serviceCsarFileName, File filesFolder) {
@@ -704,11 +783,6 @@ public class ToscaValidationTest extends SetupCDTest{
return ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + VfCsarFileName));
}
- /*public static void main(String[] args) {
- ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
- List<CategoryDefinition> categories = resourceReqDetails.getCategories();
- System.out.println(categories);
- }*/
}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VFCArtifacts.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VFCArtifacts.java
index b79393a0c9..20cd8886fd 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VFCArtifacts.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VFCArtifacts.java
@@ -20,18 +20,13 @@
package org.openecomp.sdc.ci.tests.execute.sanity;
-import static org.testng.Assert.assertTrue;
-
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
+import com.aventstack.extentreports.Status;
+import com.clearspring.analytics.util.Pair;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers;
import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition;
import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject;
import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
@@ -43,20 +38,21 @@ import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
import org.openecomp.sdc.ci.tests.pages.HomePage;
import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
import org.openecomp.sdc.ci.tests.pages.TesterOperationPage;
-import org.openecomp.sdc.ci.tests.utilities.DownloadManager;
-import org.openecomp.sdc.ci.tests.utilities.FileHandling;
-import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
-import org.openecomp.sdc.ci.tests.utilities.OnboardingUiUtils;
-import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
-import org.openecomp.sdc.ci.tests.utilities.RestCDUtils;
+import org.openecomp.sdc.ci.tests.utilities.*;
import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
-import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils;
import org.openecomp.sdc.ci.tests.verificator.VFCArtifactVerificator;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
-import com.aventstack.extentreports.Status;
-import com.clearspring.analytics.util.Pair;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import static org.testng.Assert.assertTrue;
+import org.openecomp.sdc.ci.tests.utils.general.VendorLicenseModelRestUtils;
+import org.openecomp.sdc.ci.tests.utils.general.VendorSoftwareProductRestUtils;
public class VFCArtifacts extends SetupCDTest {
@@ -215,17 +211,17 @@ public class VFCArtifacts extends SetupCDTest {
ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
- String vnfFile = "vProbes_FE.zip";
+ String vnfFile = "2016-043_vsaegw_fdnt_30_1607_e2e.zip";
String snmpFile = "Fault-alarms-ASDC-vprobes-vLB.zip";
- AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUiUtils.createVendorLicense(getUser());
- Pair<String, Map<String, String>> createVSP = OnboardingUtils.createVSP(resourceMetaData, vnfFile, filePath, getUser(), amdocsLicenseMembers);
+ AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(getUser());
+ Pair<String, VendorSoftwareProductObject> createVSP = VendorSoftwareProductRestUtils.createVSP(resourceMetaData, vnfFile, filePath, getUser(), amdocsLicenseMembers);
String vspName = createVSP.left;
resourceMetaData.setName(vspName);
- Map<String, String> resourceMeta = createVSP.right;
- String vspid = resourceMeta.get("vspId");
- OnboardingUtils.addVFCArtifacts(filePath, snmpFile, null, vspid, getUser());
- OnboardingUtils.prepareVspForUse(getUser(), vspid, "0.1");
+ VendorSoftwareProductObject resourceMeta = createVSP.right;
+ String vspid = resourceMeta.getVspId();
+ VendorSoftwareProductRestUtils.addVFCArtifacts(filePath, snmpFile, null, resourceMeta, getUser());
+ VendorSoftwareProductRestUtils.prepareVspForUse(getUser(), resourceMeta, true);
String downloadDirectory = getWindowTest().getDownloadDirectory();
String csarFile = vspid + ".csar";
@@ -248,18 +244,18 @@ public class VFCArtifacts extends SetupCDTest {
//check of version is 1
ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
- String vnfFile = "vProbes_FE.zip";
+ String vnfFile = "2016-043_vsaegw_fdnt_30_1607_e2e.zip";
String snmpPollFile = "vprobes-vLB.zip";
String updatedSnmpPollFile = "vprobes-vLBAgent.zip";
- AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUiUtils.createVendorLicense(getUser());
- Pair<String, Map<String, String>> createVSP = OnboardingUtils.createVSP(resourceMetaData, vnfFile, filePath, getUser(), amdocsLicenseMembers);
+ AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(getUser());
+ Pair<String, VendorSoftwareProductObject> createVSP = VendorSoftwareProductRestUtils.createVSP(resourceMetaData, vnfFile, filePath, getUser(), amdocsLicenseMembers);
String vspName = createVSP.left;
resourceMetaData.setName(vspName);
- Map<String, String> resourceMeta = createVSP.right;
- String vspid = resourceMeta.get("vspId");
- String montoringComponentId = OnboardingUtils.addVFCArtifacts(filePath, snmpPollFile, null, vspid, getUser());
- OnboardingUiUtils.prepareVspForUse(getUser(), vspid, "0.1");
+ VendorSoftwareProductObject resourceMeta = createVSP.right;
+ String vspid = resourceMeta.getVspId();
+ String montoringComponentId = VendorSoftwareProductRestUtils.addVFCArtifacts(filePath, snmpPollFile, null, resourceMeta, getUser());
+ VendorSoftwareProductRestUtils.prepareVspForUse(getUser(), resourceMeta, true);
String downloadDirectory = getWindowTest().getDownloadDirectory();
String csarFile = vspid + ".csar";
@@ -275,7 +271,7 @@ public class VFCArtifacts extends SetupCDTest {
TesterOperationPage.certifyComponent(vspName);
reloginWithNewRole(UserRoleEnum.DESIGNER);
- OnboardingUtils.updateVspWithVfcArtifacts(filePath, vspid, updatedSnmpPollFile, null, montoringComponentId, getUser(), "0.1");
+ VendorSoftwareProductRestUtils.updateVspWithVfcArtifacts(filePath, updatedSnmpPollFile, null, montoringComponentId, getUser(), resourceMeta);
DownloadManager.downloadCsarByNameFromVSPRepository(vspName, vspid);
HomePage.showVspRepository();
OnboardingUiUtils.updateVSP(createVSP);
@@ -294,18 +290,18 @@ public class VFCArtifacts extends SetupCDTest {
//check of version is 2
ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
- String vnfFile = "vProbes_FE.zip";
+ String vnfFile = "2016-043_vsaegw_fdnt_30_1607_e2e.zip";
String snmpFile = "vprobes-vLB.zip";
String updatedSnmpFile = "vprobes-vLB-Modified.zip";
- AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUiUtils.createVendorLicense(getUser());
- Pair<String, Map<String, String>> createVSP = OnboardingUtils.createVSP(resourceMetaData, vnfFile, filePath, getUser(), amdocsLicenseMembers);
+ AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(getUser());
+ Pair<String, VendorSoftwareProductObject> createVSP = VendorSoftwareProductRestUtils.createVSP(resourceMetaData, vnfFile, filePath, getUser(), amdocsLicenseMembers);
String vspName = createVSP.left;
resourceMetaData.setName(vspName);
- Map<String, String> resourceMeta = createVSP.right;
- String vspid = resourceMeta.get("vspId");
- String monitoringId = OnboardingUtils.addVFCArtifacts(filePath, snmpFile, null, vspid, getUser());
- OnboardingUiUtils.prepareVspForUse(getUser(), vspid, "0.1");
+ VendorSoftwareProductObject resourceMeta = createVSP.right;
+ String vspid = resourceMeta.getVspId();
+ String monitoringId = VendorSoftwareProductRestUtils.addVFCArtifacts(filePath, snmpFile, null, resourceMeta, getUser());
+ VendorSoftwareProductRestUtils.prepareVspForUse(getUser(), resourceMeta, true);
String downloadDirectory = getWindowTest().getDownloadDirectory();
String csarFile = vspid + ".csar";
@@ -328,7 +324,7 @@ public class VFCArtifacts extends SetupCDTest {
TesterOperationPage.certifyComponent(vspName);
reloginWithNewRole(UserRoleEnum.DESIGNER);
- OnboardingUtils.updateVspWithVfcArtifacts(filePath, vspid, updatedSnmpFile, null, monitoringId, getUser(), "0.1");
+ VendorSoftwareProductRestUtils.updateVspWithVfcArtifacts(filePath, updatedSnmpFile, null, monitoringId, getUser(), resourceMeta);
DownloadManager.downloadCsarByNameFromVSPRepository(vspName, vspid);
HomePage.showVspRepository();
OnboardingUiUtils.updateVSP(createVSP);
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java
index fe2187f338..dbe0a971c6 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java
@@ -32,16 +32,11 @@ import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.model.LifecycleStateEnum;
import org.openecomp.sdc.be.model.Resource;
-import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo;
-import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
-import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
-import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.*;
import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.InformationalArtifactsPlaceholders;
import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems;
import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ResourceMetadataEnum;
import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ToscaArtifactsScreenEnum;
-import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum;
-import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.PropertyTypeEnum;
@@ -60,13 +55,8 @@ import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
import org.openecomp.sdc.ci.tests.pages.TesterOperationPage;
import org.openecomp.sdc.ci.tests.pages.ToscaArtifactsPage;
import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition;
-import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
-import org.openecomp.sdc.ci.tests.utilities.FileHandling;
-import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.*;
import org.openecomp.sdc.ci.tests.utilities.OnboardingUiUtils;
-import org.openecomp.sdc.ci.tests.utilities.PropertiesUIUtils;
-import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
-import org.openecomp.sdc.ci.tests.utilities.RestCDUtils;
import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils;
import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
@@ -79,6 +69,7 @@ import org.openecomp.sdc.ci.tests.verificator.VfVerificator;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.testng.AssertJUnit;
+import org.testng.SkipException;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -225,6 +216,10 @@ public class Vf extends SetupCDTest {
@Test
public void addPropertiesToVfcInstanceInVfTest() throws Exception {
+ if(true){
+ throw new SkipException("Open bug 373762, can't update properties on CP or VFC instance on Composition screen");
+ }
+
String fileName = "vFW_VFC.yml";
ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
@@ -648,7 +643,7 @@ public class Vf extends SetupCDTest {
public void exportToscaWithModulePropertiesVFTest() throws AWTException, Exception {
String vnfFile = "1-Vf-zrdm5bpxmc02-092017-(MOBILITY)_v2.0.zip";
ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
- Pair<String, Map<String, String>> vsp= OnboardingUiUtils.onboardAndValidate(resourceReqDetails, FileHandling.getVnfRepositoryPath(), vnfFile, getUser());
+ Pair<String, VendorSoftwareProductObject> vsp= OnboardingUiUtils.onboardAndValidate(resourceReqDetails, FileHandling.getVnfRepositoryPath(), vnfFile, getUser());
String vspName = vsp.left;
ResourceGeneralPage.clickSubmitForTestingButton(vsp.left);
Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, vspName, "0.1");
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfAPI.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfAPI.java
new file mode 100644
index 0000000000..e0eaf74de6
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfAPI.java
@@ -0,0 +1,738 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.sanity;
+
+import java.awt.AWTException;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.LifecycleStateEnum;
+import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.ci.tests.datatypes.*;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.InformationalArtifactsPlaceholders;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ResourceMetadataEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ToscaArtifactsScreenEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.PropertyTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.execute.setup.AttFtpClient;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.CompositionPage;
+import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.GeneralPageElements;
+import org.openecomp.sdc.ci.tests.pages.InformationalArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.InputsPage;
+import org.openecomp.sdc.ci.tests.pages.PropertiesPage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.TesterOperationPage;
+import org.openecomp.sdc.ci.tests.pages.ToscaArtifactsPage;
+import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition;
+import org.openecomp.sdc.ci.tests.utilities.*;
+import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils;
+import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
+import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
+import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator;
+import org.openecomp.sdc.ci.tests.verificator.VfModuleVerificator;
+import org.openecomp.sdc.ci.tests.verificator.VfVerificator;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.testng.AssertJUnit;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import com.aventstack.extentreports.Status;
+import com.clearspring.analytics.util.Pair;
+
+
+public class VfAPI extends SetupCDTest {
+
+ private String filePath;
+ @BeforeClass
+ public void beforeClass(){
+ filePath = FileHandling.getFilePath("");
+ }
+
+ @BeforeMethod
+ public void beforeTest(){
+ System.out.println("File repository is : " + filePath);
+ getExtendTest().log(Status.INFO, "File repository is : " + filePath);
+ }
+
+ private ResourceReqDetails createVFviaAPI() {
+ ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating VF %s", vfMetaData.getName()));
+ AtomicOperationUtils.createResourceByResourceDetails(vfMetaData, UserRoleEnum.DESIGNER, true).left().value();
+ return vfMetaData;
+ }
+
+
+ @Test
+ public void updateVF() throws Exception {
+
+ // create Resource
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createVF(resourceMetaData, getUser());
+
+ // update Resource
+ ResourceReqDetails updatedResource = new ResourceReqDetails();
+ updatedResource.setName(ElementFactory.getResourcePrefix() + "UpdatedName" + resourceMetaData.getName());
+ updatedResource.setDescription("kuku");
+ updatedResource.setVendorName("updatedVendor");
+ updatedResource.setVendorRelease("updatedRelease");
+ updatedResource.setContactId("ab0001");
+ updatedResource.setCategories(resourceMetaData.getCategories());
+ updatedResource.setVersion("0.1");
+ updatedResource.setResourceType(ResourceTypeEnum.VF.getValue());
+ List<String> newTags = resourceMetaData.getTags();
+ newTags.remove(resourceMetaData.getName());
+ newTags.add(updatedResource.getName());
+ updatedResource.setTags(newTags);
+ ResourceUIUtils.updateResource(updatedResource, getUser());
+
+ VfVerificator.verifyVFMetadataInUI(updatedResource);
+ VfVerificator.verifyVFUpdated(updatedResource, getUser());
+ }
+
+
+
+ @Test
+ public void vfcLinkedToComputeInVfFlowApi() throws Exception {
+ String fileName = "vFW_VFC2.yml";
+ ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+
+ try{
+ //Create VFC via API
+ Resource vfc = AtomicOperationUtils.importResource(filePath, fileName).left().value();
+ atomicResourceMetaData.setName(vfc.getName());
+
+ //Certify VFC via API
+ vfc = (Resource) AtomicOperationUtils.changeComponentState(vfc, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+
+ //Create VF via API
+ ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ AtomicOperationUtils.createResourceByResourceDetails(vfMetaData, UserRoleEnum.DESIGNER, true).left().value();
+
+ //Go to Catalog and find the created VF
+ CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
+ GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+
+ //Composition - drag the created VFC and another element, link between them
+ DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+ CompositionPage.searchForElement(String.format("%s %s", LeftPanelCanvasItems.COMPUTE.getValue() , "1.0"));
+ CanvasElement computeElement = canvasManager.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE);
+ CompositionPage.searchForElement(atomicResourceMetaData.getName());
+ CanvasElement cpElement = canvasManager.createElementOnCanvas(atomicResourceMetaData.getName());
+ AssertJUnit.assertNotNull(cpElement);
+ ServiceVerificator.verifyNumOfComponentInstances(vfMetaData, "0.1", 2, getUser());
+ canvasManager.linkElements(cpElement, computeElement);
+
+ vfMetaData.setVersion("0.1");
+ VfVerificator.verifyLinkCreated(vfMetaData, getUser(), 1);
+ }
+ finally{
+ ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "1.0");
+ }
+
+ }
+
+
+ @Test
+ public void addUpdateDeleteDeploymentArtifactToVfTestApi() throws Exception {
+ //Create VF via API
+ ResourceReqDetails vfMetaData = createVFviaAPI();
+
+ //Go to Catalog and find the created VF
+ CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
+ GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+
+ ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+
+ List<ArtifactInfo> deploymentArtifactList = new ArrayList<ArtifactInfo>();
+ deploymentArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER"));
+ deploymentArtifactList.add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "cuku", "artifact2", "YANG_XML"));
+ for (ArtifactInfo deploymentArtifact : deploymentArtifactList) {
+ DeploymentArtifactPage.clickAddNewArtifact();
+ ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact);
+ }
+ AssertJUnit.assertTrue("artifact table does not contain artifacts uploaded", DeploymentArtifactPage.checkElementsCountInTable(deploymentArtifactList.size()));
+
+ String newDescription = "new description";
+ DeploymentArtifactPage.clickEditArtifact(deploymentArtifactList.get(0).getArtifactLabel());
+ DeploymentArtifactPage.artifactPopup().insertDescription(newDescription);
+ DeploymentArtifactPage.artifactPopup().clickDoneButton();
+ String actualArtifactDescription = DeploymentArtifactPage.getArtifactDescription(deploymentArtifactList.get(0).getArtifactLabel());
+ AssertJUnit.assertTrue("artifact description is not updated", newDescription.equals(actualArtifactDescription));
+
+ DeploymentArtifactPage.clickDeleteArtifact(deploymentArtifactList.get(0).getArtifactLabel());
+ DeploymentArtifactPage.clickOK();
+ AssertJUnit.assertTrue("artifact "+ deploymentArtifactList.get(0).getArtifactLabel() + "is not deleted", DeploymentArtifactPage.checkElementsCountInTable(deploymentArtifactList.size() - 1));
+
+ AssertJUnit.assertTrue("artifact "+ deploymentArtifactList.get(1).getArtifactLabel() + "is not displayed", DeploymentArtifactPage.clickOnArtifactDescription(deploymentArtifactList.get(1).getArtifactLabel()).isDisplayed());
+ }
+
+
+ @Test
+ public void addUpdateDeleteInformationalArtifactApi() throws Exception {
+ //Create VF via API
+ ResourceReqDetails vfMetaData = createVFviaAPI();
+
+ //Go to Catalog and find the created VF
+ CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
+ GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+
+ ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
+
+ ArtifactInfo informationalArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER");
+ InformationalArtifactPage.clickAddNewArtifact();
+ ArtifactUIUtils.fillAndAddNewArtifactParameters(informationalArtifact);
+
+ AssertJUnit.assertTrue("artifact table does not contain artifacts uploaded", InformationalArtifactPage.checkElementsCountInTable(1));
+
+ String newDescription = "new description";
+ InformationalArtifactPage.clickEditArtifact(informationalArtifact.getArtifactLabel());
+ InformationalArtifactPage.artifactPopup().insertDescription(newDescription);
+ InformationalArtifactPage.artifactPopup().clickDoneButton();
+ String actualArtifactDescription = InformationalArtifactPage.getArtifactDescription(informationalArtifact.getArtifactLabel());
+ AssertJUnit.assertTrue("artifact description is not updated", newDescription.equals(actualArtifactDescription));
+
+ InformationalArtifactPage.clickDeleteArtifact(informationalArtifact.getArtifactLabel());
+ InformationalArtifactPage.clickOK();
+ AssertJUnit.assertTrue("artifact "+ informationalArtifact.getArtifactLabel() + "is not deleted", InformationalArtifactPage.checkElementsCountInTable(0));
+ }
+
+
+ @Test
+ public void addPropertiesToVfcInstanceInVfTestApi() throws Exception {
+
+ String fileName = "vFW_VFC.yml";
+ ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+
+ try{
+ //Create VFC via API
+ Resource vfc = AtomicOperationUtils.importResource(filePath, fileName).left().value();
+ atomicResourceMetaData.setName(vfc.getName());
+
+ //Certify VFC via API
+ vfc = (Resource) AtomicOperationUtils.changeComponentState(vfc, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+
+ //Create VF via API
+ ResourceReqDetails vfMetaData = createVFviaAPI();
+
+ //Go to Catalog and find the created VF
+ CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
+ GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
+ CompositionPage.searchForElement(atomicResourceMetaData.getName());
+ CanvasElement vfcElement = vfCanvasManager.createElementOnCanvas(atomicResourceMetaData.getName());
+
+ vfCanvasManager.clickOnCanvaElement(vfcElement);
+ CompositionPage.showPropertiesAndAttributesTab();
+ List<WebElement> properties = CompositionPage.getProperties();
+ String propertyValue = "abc123";
+ for (int i = 0; i < 2; i++) {
+ WebElement findElement = properties.get(i).findElement(By.className("i-sdc-designer-sidebar-section-content-item-property-and-attribute-label"));
+ findElement.click();
+ PropertiesPage.getPropertyPopup().insertPropertyDefaultValue(propertyValue);
+ PropertiesPage.getPropertyPopup().clickSave();
+
+
+ findElement = properties.get(i).findElement(By.className("i-sdc-designer-sidebar-section-content-item-property-value"));
+ AssertJUnit.assertTrue(findElement.getText().equals(propertyValue));
+ }
+ }
+ finally{
+ ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "0.1");
+ }
+ }
+
+ @Test
+ public void changeInstanceVersionTest() throws Exception{
+
+ ResourceReqDetails atomicResourceMetaData = null;
+ ResourceReqDetails vfMetaData = null;
+ CanvasManager vfCanvasManager;
+ CanvasElement vfcElement = null;
+ String fileName = "vFW_VFC3.yml";
+ try{
+ atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+ ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+ ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName());
+
+ vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createVF(vfMetaData, getUser());
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ vfCanvasManager = CanvasManager.getCanvasManager();
+ CompositionPage.searchForElement(atomicResourceMetaData.getName());
+ vfcElement = vfCanvasManager.createElementOnCanvas(atomicResourceMetaData.getName());
+
+
+ CompositionPage.clickSubmitForTestingButton(vfMetaData.getName());
+ assert(false);
+ }
+ catch(Exception e){
+ String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+ String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.VALIDATED_RESOURCE_NOT_FOUND.name());
+ AssertJUnit.assertTrue(errorMessage.contains(checkUIResponseOnError));
+
+
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName());
+ TesterOperationPage.certifyComponent(atomicResourceMetaData.getName());
+
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+ GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ vfCanvasManager = CanvasManager.getCanvasManager();
+ CompositionPage.changeComponentVersion(vfCanvasManager, vfcElement, "1.0");
+
+ //verification
+ VfVerificator.verifyInstanceVersion(vfMetaData, getUser(), atomicResourceMetaData.getName(), "1.0");
+ }
+
+ finally{
+ ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "1.0");
+ }
+
+ }
+
+ // future removed from ui
+ @Test(enabled = false)
+ public void addUpdateDeleteSimplePropertiesToVfTest() throws Exception{
+ ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createVF(vfMetaData, getUser());
+
+ ResourceGeneralPage.getLeftMenu().moveToPropertiesScreen();
+ List<PropertyTypeEnum> propertyList = Arrays.asList(PropertyTypeEnum.STRING, PropertyTypeEnum.INTEGER);
+ int propertiesCount = PropertiesPage.getElemenetsFromTable().size();
+ for (PropertyTypeEnum prop : propertyList){
+ PropertiesUIUtils.addNewProperty(prop);
+ }
+ AssertJUnit.assertTrue(GeneralUIUtils.checkElementsCountInTable(propertiesCount + propertyList.size(), () -> PropertiesPage.getElemenetsFromTable()));
+ VfVerificator.verifyPropertiesInUI(propertyList);
+ PropertiesPage.verifyTotalProperitesField(propertiesCount + propertyList.size());
+
+
+ PropertyTypeEnum prop = propertyList.get(0);
+ prop.setDescription("updatedDescription");
+ prop.setValue("value");
+ PropertiesUIUtils.updateProperty(prop);
+
+ PropertiesPage.clickDeletePropertyArtifact(prop.getName());
+ AssertJUnit.assertTrue(GeneralUIUtils.checkElementsCountInTable(propertiesCount + propertyList.size() - 1, () -> PropertiesPage.getElemenetsFromTable()));
+ }
+
+ // future removed from ui
+ @Test(enabled = false)
+ public void vfcInstancesInputScreenTest() throws Exception{
+ ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createVF(vfMetaData, getUser());
+
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
+
+ Map<String, String> elementsIntancesMap = new HashMap<String, String>();
+ for (LeftPanelCanvasItems element : Arrays.asList(LeftPanelCanvasItems.DATABASE, LeftPanelCanvasItems.BLOCK_STORAGE)){
+ CanvasElement elementOnCanvas = vfCanvasManager.createElementOnCanvas(element);
+ vfCanvasManager.clickOnCanvaElement(elementOnCanvas);
+ String selectedInstanceName = CompositionPage.getSelectedInstanceName();
+ elementsIntancesMap.put(selectedInstanceName, element.getValue());
+ }
+
+ CompositionPage.moveToInputsScreen();
+ int canvasElementsSize = vfCanvasManager.getCanvasElements().size();
+ AssertJUnit.assertTrue("Instances count is not as expected: " + canvasElementsSize, InputsPage.checkElementsCountInTable(canvasElementsSize));
+
+ for (String element : elementsIntancesMap.keySet()){
+ String resourceName = elementsIntancesMap.get(element);
+ ResourceReqDetails resource = new ResourceReqDetails();
+ resource.setName(resourceName);
+ resource.setVersion("1.0");
+ resource.setResourceType(ResourceTypeEnum.VFC.toString());
+ RestResponse restResponse = RestCDUtils.getResource(resource, getUser());
+ Map<String, String> propertiesNameTypeJson = ResponseParser.getPropertiesNameType(restResponse);
+
+ List<WebElement> propertyRowsFromTable = InputsPage.getInstancePropertiesList(element);
+ AssertJUnit.assertTrue("Some properties are missing in table. Instance name is : " + element, propertyRowsFromTable.size() == propertiesNameTypeJson.size());
+ VfVerificator.verifyVfInputs(element, propertiesNameTypeJson, propertyRowsFromTable);
+
+ GeneralUIUtils.clickOnElementByText(element);
+ }
+
+ }
+
+
+ @Test
+ public void addAllInformationalArtifactPlaceholdersInVfTestApi() throws Exception{
+ //Create VF via API
+ ResourceReqDetails vfMetaData = createVFviaAPI();
+
+ //Go to Catalog and find the created VF
+ CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
+ GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+
+ ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
+
+ for(InformationalArtifactsPlaceholders informArtifact : InformationalArtifactsPlaceholders.values()){
+ ArtifactUIUtils.fillPlaceHolderInformationalArtifact(informArtifact, filePath,"asc_heat 0 2.yaml", informArtifact.getValue());
+ }
+
+ AssertJUnit.assertTrue(InformationalArtifactPage.checkElementsCountInTable(InformationalArtifactsPlaceholders.values().length));
+ }
+
+ @Test
+ public void verifyToscaArtifactsExistApi() throws Exception{
+ //Create VF via API
+ ResourceReqDetails vfMetaData = createVFviaAPI();
+
+ //Go to Catalog and find the created VF
+ CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
+ GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+
+ final int numOfToscaArtifacts = 2;
+ ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen();
+ AssertJUnit.assertTrue(ToscaArtifactsPage.checkElementsCountInTable(numOfToscaArtifacts));
+
+ for(int i = 0; i < numOfToscaArtifacts; i++){
+ String typeFromScreen = ToscaArtifactsPage.getArtifactType(i);
+ AssertJUnit.assertTrue(typeFromScreen.equals(ArtifactTypeEnum.TOSCA_CSAR.getType()) || typeFromScreen.equals(ArtifactTypeEnum.TOSCA_TEMPLATE.getType()));
+ }
+
+ ToscaArtifactsPage.clickSubmitForTestingButton(vfMetaData.getName());
+ VfVerificator.verifyToscaArtifactsInfo(vfMetaData, getUser());
+ }
+
+ @Test(enabled=false)
+ public void testDownload() throws Exception{
+// ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+// ResourceUIUtils.createResource(vfMetaData, getUser());
+//
+// final int numOfToscaArtifacts = 2;
+// ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen();
+// assertTrue(ToscaArtifactsPage.checkElementsCountInTable(numOfToscaArtifacts));
+// GeneralUIUtils.clickOnElementByTestId("download-Tosca Model");
+// System.out.println("download me");
+
+ AttFtpClient attFtpClient = AttFtpClient.getInstance();
+
+ File retrieveLastModifiedFileFromFTP = attFtpClient.retrieveLastModifiedFileFromFTP();
+ attFtpClient.deleteFilesFromFTPserver();
+ }
+
+ @Test
+ public void vfCertificationTestApi() throws Exception{
+ //Create VF via API
+ ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ Resource vf = AtomicOperationUtils.createResourceByResourceDetails(vfMetaData, UserRoleEnum.DESIGNER, true).left().value();
+
+ //Certify VF via API
+ vf = (Resource) AtomicOperationUtils.changeComponentState(vf, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+
+ //Go to Catalog and find the created VF
+ CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
+ GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+
+ VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CERTIFIED);
+ }
+
+ @Test
+ public void deleteVfCheckedoutTestApi() throws Exception{
+ //Create VF via API
+ ResourceReqDetails vfMetaData = createVFviaAPI();
+
+ //Go to Catalog and find the created VF
+ CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
+ GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+
+ GeneralPageElements.clickTrashButtonAndConfirm();
+
+ vfMetaData.setVersion("0.1");
+ VfVerificator.verifyVfDeleted(vfMetaData, getUser());
+ }
+
+ @Test
+ public void revertVfMetadataTestApi() throws Exception{
+ //Create VF via API
+ ResourceReqDetails vfMetaData = createVFviaAPI();
+
+ //Go to Catalog and find the created VF
+ CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
+ GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+
+ ResourceReqDetails vfRevertDetails = new ResourceReqDetails();
+ vfRevertDetails.setName("ciUpdatedName");
+ vfRevertDetails.setDescription("kuku");
+ vfRevertDetails.setCategories(vfMetaData.getCategories());
+ vfRevertDetails.setVendorName("updatedVendor");
+ vfRevertDetails.setVendorRelease("updatedRelease");
+ ResourceUIUtils.fillResourceGeneralInformationPage(vfRevertDetails, getUser(), false);
+
+ GeneralPageElements.clickRevertButton();
+
+ VfVerificator.verifyVFMetadataInUI(vfMetaData);
+
+ }
+
+ @Test
+ public void addDeploymentArtifactInCompositionScreenTestApi() throws Exception{
+ //Create VF via API
+ ResourceReqDetails vfMetaData = createVFviaAPI();
+
+ //Go to Catalog and find the created VF
+ CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
+ GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+
+ ArtifactInfo artifact = new ArtifactInfo(filePath, "Heat-File.yaml", "kuku", "artifact3","OTHER");
+ CompositionPage.showDeploymentArtifactTab();
+ CompositionPage.clickAddArtifactButton();
+ ArtifactUIUtils.fillAndAddNewArtifactParameters(artifact, CompositionPage.artifactPopup());
+
+ List<WebElement> actualArtifactList = GeneralUIUtils.getWebElementsListBy(By.className("i-sdc-designer-sidebar-section-content-item-artifact"));
+ AssertJUnit.assertEquals(1, actualArtifactList.size());
+ }
+
+ // future removed from ui
+ @Test(enabled = false)
+ public void addPropertyInCompositionScreenTest() throws Exception{
+ ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createVF(vfMetaData, getUser());
+
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+
+ CompositionPage.showPropertiesAndAttributesTab();
+ List<PropertyTypeEnum> propertyList = Arrays.asList(PropertyTypeEnum.STRING, PropertyTypeEnum.INTEGER);
+ int propertiesCount = CompositionPage.getProperties().size();
+ for (PropertyTypeEnum prop : propertyList){
+ PropertiesUIUtils.addNewProperty(prop);
+ }
+ AssertJUnit.assertTrue(GeneralUIUtils.checkElementsCountInTable(propertiesCount + propertyList.size(), () -> CompositionPage.getProperties()));
+ }
+
+ @Test
+ public void addDeploymentArtifactAndVerifyInCompositionScreenApi() throws Exception{
+ //Create VF via API
+ ResourceReqDetails vfMetaData = createVFviaAPI();
+
+ //Go to Catalog and find the created VF
+ CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
+ GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+
+ ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+
+ ArtifactInfo deploymentArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER");
+ DeploymentArtifactPage.clickAddNewArtifact();
+ ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact);
+ AssertJUnit.assertTrue(DeploymentArtifactPage.checkElementsCountInTable(1));
+
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+
+ CompositionPage.showDeploymentArtifactTab();
+ List<WebElement> deploymentArtifactsFromScreen = CompositionPage.getDeploymentArtifacts();
+ AssertJUnit.assertTrue(1 == deploymentArtifactsFromScreen.size());
+
+ String actualArtifactFileName = deploymentArtifactsFromScreen.get(0).getText();
+ AssertJUnit.assertTrue("asc_heat-0-2.yaml".equals(actualArtifactFileName));
+ }
+
+ @Test
+ public void checkoutVfTest() throws Exception{
+ ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createVF(vfMetaData, getUser());
+
+ ResourceGeneralPage.clickCheckinButton(vfMetaData.getName());
+ GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+ GeneralPageElements.clickCheckoutButton();
+
+ vfMetaData.setVersion("0.2");
+ VfVerificator.verifyVFLifecycle(vfMetaData, getUser(), LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
+ VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKOUT);
+
+ ResourceGeneralPage.clickSubmitForTestingButton(vfMetaData.getName());
+
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+ TesterOperationPage.certifyComponent(vfMetaData.getName());
+
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+ GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+ ResourceGeneralPage.clickCheckoutButton();
+
+ vfMetaData.setVersion("1.1");
+ vfMetaData.setUniqueId(null);
+ VfVerificator.verifyVFLifecycle(vfMetaData, getUser(), LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
+ VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKOUT);
+ }
+
+ @Test
+ public void deleteInstanceFromVfCanvasApi() throws Exception{
+ //Create VF via API
+ ResourceReqDetails vfMetaData = createVFviaAPI();
+
+ //Go to Catalog and find the created VF
+ CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
+ GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
+ CanvasElement computeElement = vfCanvasManager.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE);
+ vfCanvasManager.createElementOnCanvas(LeftPanelCanvasItems.PORT);
+
+ vfCanvasManager.clickOnCanvaElement(computeElement);
+ vfCanvasManager.deleteElementFromCanvas(computeElement);
+
+ VfVerificator.verifyNumOfComponentInstances(vfMetaData, 1, getUser());
+ }
+
+ @Test
+ public void changeInstanceNameInVfTestApi() throws Exception{
+ //Create VF via API
+ ResourceReqDetails vfMetaData = createVFviaAPI();
+
+ //Go to Catalog and find the created VF
+ CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
+ GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
+ CanvasElement computeElement = vfCanvasManager.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE);
+
+ String updatedInstanceName = "updatedName";
+ vfCanvasManager.updateElementNameInCanvas(computeElement, updatedInstanceName);
+
+ String actualSelectedInstanceName = CompositionPage.getSelectedInstanceName();
+ AssertJUnit.assertTrue(updatedInstanceName.equals(actualSelectedInstanceName));
+ }
+
+
+ @Test
+ public void submitVfForTestingWithNonCertifiedAssetApi() throws Exception{
+ String fileName = "vFW_VFC4.yml";
+ ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+
+ //Create VFC via API
+ Resource vfc = AtomicOperationUtils.importResource(filePath, fileName).left().value();
+ atomicResourceMetaData.setName(vfc.getName());
+
+ //Submit VFC for testing via API
+ vfc = (Resource) AtomicOperationUtils.changeComponentState(vfc, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFICATIONREQUEST, true).getLeft();
+
+ //Create VF via API
+ ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ AtomicOperationUtils.createResourceByResourceDetails(vfMetaData, UserRoleEnum.DESIGNER, true).left().value();
+
+ //Go to Catalog and find the created VF
+ CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
+ GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+
+ DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+ CompositionPage.searchForElement(atomicResourceMetaData.getName());
+ canvasManager.createElementOnCanvas(atomicResourceMetaData.getName());
+
+ try{
+ CompositionPage.clickSubmitForTestingButton(vfMetaData.getName());
+ assert(false);
+ }
+ catch(Exception e){
+ String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+ String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.VALIDATED_RESOURCE_NOT_FOUND.name());
+ AssertJUnit.assertTrue(errorMessage.contains(checkUIResponseOnError));
+ }
+ finally{
+ ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "0.1");
+ }
+ }
+
+ @Test
+ public void isDisabledAndReadOnlyInCheckinApi() throws Exception{
+ //Create VF via API
+ ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ Resource vf = AtomicOperationUtils.createResourceByResourceDetails(vfMetaData, UserRoleEnum.DESIGNER, true).left().value();
+
+ //Check in VF via API
+ vf = (Resource) AtomicOperationUtils.changeComponentState(vf, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();
+
+ //Go to Catalog and find the created VF
+ CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
+ GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+
+ ResourceMetadataEnum[] fieldsForCheck = {ResourceMetadataEnum.RESOURCE_NAME,
+ ResourceMetadataEnum.DESCRIPTION, ResourceMetadataEnum.VENDOR_NAME, ResourceMetadataEnum.VENDOR_RELEASE,
+ ResourceMetadataEnum.CONTACT_ID};
+
+ for (ResourceMetadataEnum field: fieldsForCheck){
+ AssertJUnit.assertTrue(GeneralUIUtils.isElementReadOnly(field.getValue()));
+ }
+
+ AssertJUnit.assertTrue(GeneralUIUtils.isElementDisabled(ResourceMetadataEnum.CATEGORY.getValue()));
+ AssertJUnit.assertTrue(GeneralUIUtils.isElementDisabled(DataTestIdEnum.LifeCyleChangeButtons.CREATE.getValue()));
+ }
+
+ @Test
+ public void exportToscaWithModulePropertiesVFTest() throws AWTException, Exception {
+ String vnfFile = "1-Vf-zrdm5bpxmc02-092017-(MOBILITY)_v2.0.zip";
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
+ Pair<String, VendorSoftwareProductObject> vsp= OnboardingUiUtils.onboardAndValidate(resourceReqDetails, FileHandling.getVnfRepositoryPath(), vnfFile, getUser());
+ String vspName = vsp.left;
+ ResourceGeneralPage.clickSubmitForTestingButton(vsp.left);
+ Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, vspName, "0.1");
+ VfModuleVerificator.validateSpecificModulePropertiesFromRequest(resource);
+ }
+
+ @Test
+ public void exportToscaWithModulePropertiesTemplateCheckVFTest() throws AWTException, Exception {
+ String vnfFile = "1-Vf-zrdm5bpxmc02-092017-(MOBILITY)_v2.0.zip";
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
+ OnboardingUiUtils.onboardAndValidate(resourceReqDetails, FileHandling.getVnfRepositoryPath(), vnfFile, getUser());
+ ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen();
+ GeneralUIUtils.clickOnElementByTestId(ToscaArtifactsScreenEnum.TOSCA_MODEL.getValue());
+ File latestFilefromDir = FileHandling.getLastModifiedFileNameFromDir();
+ ToscaDefinition toscaDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(latestFilefromDir);
+ VfModuleVerificator.validateSpecificModulePropertiesFromFile(toscaDefinition);
+ }
+
+
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfArtifacts.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfArtifacts.java
index 8055a86d58..9847d341c0 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfArtifacts.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfArtifacts.java
@@ -20,16 +20,8 @@
package org.openecomp.sdc.ci.tests.execute.sanity;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.awt.AWTException;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
+import com.aventstack.extentreports.Status;
+import com.clearspring.analytics.util.Pair;
import org.openecomp.sdc.be.datatypes.elements.HeatParameterDataDefinition;
import org.openecomp.sdc.be.model.ArtifactDefinition;
import org.openecomp.sdc.be.model.Resource;
@@ -40,6 +32,7 @@ import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.CompositionScreenEnum
import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum;
import org.openecomp.sdc.ci.tests.datatypes.HeatWithParametersDefinition;
import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject;
import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
@@ -47,11 +40,7 @@ import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
import org.openecomp.sdc.ci.tests.pages.CompositionPage;
import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
-import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
-import org.openecomp.sdc.ci.tests.utilities.FileHandling;
-import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
-import org.openecomp.sdc.ci.tests.utilities.HomeUtils;
-import org.openecomp.sdc.ci.tests.utilities.OnboardingUiUtils;
+import org.openecomp.sdc.ci.tests.utilities.*;
import org.openecomp.sdc.ci.tests.utils.Utils;
import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
@@ -61,8 +50,15 @@ import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
-import com.aventstack.extentreports.Status;
-import com.clearspring.analytics.util.Pair;
+import java.awt.*;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import static org.testng.AssertJUnit.assertTrue;
public class VfArtifacts extends SetupCDTest{
@@ -115,10 +111,10 @@ public class VfArtifacts extends SetupCDTest{
@Test
public void uploadUpdatedHeatEnv() throws Exception{
- String vnfFile = VMSP_PXMC_30_1607_E2E_ZIP;
+ String vnfFile = VFW_FNAT_30_1607_E2E_ZIP;
File updateEnvFile = null;
ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
- Pair<String,Map<String,String>> vsp = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser());
+ Pair<String, VendorSoftwareProductObject> vsp = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser());
String vspName = vsp.left;
Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, vspName, "0.1");
Map<String, ArtifactDefinition> deploymentArtifacts = resource.getDeploymentArtifacts();
@@ -143,7 +139,7 @@ public class VfArtifacts extends SetupCDTest{
String vnfFile = VFW_FNAT_30_1607_E2E_ZIP;
File updateEnvFile = null;
ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
- Pair<String,Map<String,String>> vsp = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser());
+ Pair<String, VendorSoftwareProductObject> vsp = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser());
String vspName = vsp.left;
Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, vspName, "0.1");
Map<String, ArtifactDefinition> deploymentArtifacts = resource.getDeploymentArtifacts();
@@ -167,7 +163,7 @@ public class VfArtifacts extends SetupCDTest{
String vnfFile = VLANDSLIDE_LDST_30_1607_E2E_ZIP;
File updateEnvFile = null;
ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
- Pair<String,Map<String,String>> vsp = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser());
+ Pair<String, VendorSoftwareProductObject> vsp = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser());
String vspName = vsp.left;
Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, vspName, "0.1");
Map<String, ArtifactDefinition> deploymentArtifacts = resource.getDeploymentArtifacts();
@@ -196,7 +192,7 @@ public class VfArtifacts extends SetupCDTest{
String updatedVnfFile= VLANDSLIDE_LDSA_30_1607_E2E_ZIP;
String downloadDirPath=SetupCDTest.getConfig().getWindowsDownloadDirectory();
ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
- Pair<String, Map<String, String>> CreatedVsp= OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser());
+ Pair<String, VendorSoftwareProductObject> CreatedVsp= OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser());
String vspName = CreatedVsp.left;
GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
OnboardingUiUtils.updateVnfAndValidate(vnfsRepositoryPath, CreatedVsp, updatedVnfFile, getUser());
@@ -222,7 +218,7 @@ public class VfArtifacts extends SetupCDTest{
String vnfFile = VSAEGW_FDNT_30_1607_E2E_ZIP;
String downloadDirPath=SetupCDTest.getConfig().getWindowsDownloadDirectory();
ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
- Pair<String, Map<String, String>> vsp= OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser());
+ Pair<String,VendorSoftwareProductObject> vsp= OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser());
Map<String, File> currentZipEnvfiles=ArtifactBusinessLogic.createEnvFilesListFromCsar(vsp.left,downloadDirPath);
GeneralUIUtils.findComponentAndClick(vsp.left);
ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
@@ -246,7 +242,7 @@ public class VfArtifacts extends SetupCDTest{
String downloadDirPath=SetupCDTest.getConfig().getWindowsDownloadDirectory();
String vnfFile = VSAEGW_FDNT_30_1607_E2E_ZIP;
ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
- Pair<String, Map<String, String>> vsp= OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser());
+ Pair<String, VendorSoftwareProductObject> vsp= OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser());
Map<String, File> currentZipEnvfiles=ArtifactBusinessLogic.createEnvFilesListFromCsar(vsp.left,downloadDirPath);
GeneralUIUtils.findComponentAndClick(vsp.left);
ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
@@ -271,7 +267,7 @@ public class VfArtifacts extends SetupCDTest{
String vnfFile = VFW_FCGI_30_1607_E2E_ZIP;
String downloadDirPath=SetupCDTest.getConfig().getWindowsDownloadDirectory();
ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
- Pair<String, Map<String, String>> CreatedVsp= OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser());
+ Pair<String, VendorSoftwareProductObject> CreatedVsp= OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser());
Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, CreatedVsp.left, "0.1");
Map<String, ArtifactDefinition> deploymentArtifacts = resource.getDeploymentArtifacts();
List<HeatWithParametersDefinition> envFilesList = ArtifactBusinessLogic.extractHeatWithParametersDefinition(deploymentArtifacts);
@@ -315,7 +311,7 @@ public class VfArtifacts extends SetupCDTest{
public void checkDefaultCreatedEnvArtifacts() throws Exception{
String vnfFile = VIXIA_IXLA_30_1607_E2E_ZIP;
ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
- Pair<String,Map<String,String>> vsp = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser());
+ Pair<String, VendorSoftwareProductObject> vsp = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser());
String vspName = vsp.left;
Map<String, File> generatedEnvFileList = ArtifactBusinessLogic.createEnvFilesListFromCsar(vspName, filePath);
HomeUtils.findComponentAndClick(vspName);
@@ -337,7 +333,7 @@ public class VfArtifacts extends SetupCDTest{
String stringForLog = String.format("%s:%s:%s:%s", vnfFile, updatedVnfFile, expectedHeatVersion, expectedHeatEnvVersion);
setLog(stringForLog);
ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
- Pair<String,Map<String,String>> vsp = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser());
+ Pair<String, VendorSoftwareProductObject> vsp = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser());
String vspName = vsp.left;
GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
OnboardingUiUtils.updateVnfAndValidate(vnfsRepositoryPath, vsp, updatedVnfFile, getUser());
@@ -362,7 +358,7 @@ public class VfArtifacts extends SetupCDTest{
String vnfFile = VFW_FCGI_30_1607_E2E_ZIP;
String updatedVnfFile = VFW_FCGI_30_1607_E2E_ZIP;
ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
- Pair<String,Map<String,String>> vsp = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser());
+ Pair<String, VendorSoftwareProductObject> vsp = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser());
String vspName = vsp.left;
GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfDeploymentInformationalArtifacts.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfDeploymentInformationalArtifacts.java
index ef8a337394..bb4d754bbf 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfDeploymentInformationalArtifacts.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfDeploymentInformationalArtifacts.java
@@ -43,6 +43,7 @@ import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
import org.openecomp.sdc.common.api.ArtifactTypeEnum;
import org.openqa.selenium.WebElement;
import org.testng.Assert;
+import org.testng.SkipException;
import org.testng.annotations.Test;
@@ -234,6 +235,11 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest {
// TC1443736 - Update With One New Deployment Artifact
@Test
public void updateWithOneNewDeploymentArtifact() throws Exception {
+
+ if(true){
+ throw new SkipException("Open bug 310971 and 369139");
+ }
+
String fileName = "ImportTC1443736.csar";
String folder ="US825779";
@@ -257,6 +263,11 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest {
// TC1443737 - Update With One Removed Deployment Artifact
@Test
public void updateWithOneRemovedDeploymentArtifact() throws Exception {
+
+ if(true){
+ throw new SkipException("Open bug 310971 and 369139");
+ }
+
String fileName = "ImportTC1443737.csar";
String folder ="US825779";
@@ -284,6 +295,11 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest {
// TC1443738 - Update With One New Version Deployment Artifact
@Test
public void updateWithOneNewVersionDeploymentArtifact() throws Exception {
+
+ if(true){
+ throw new SkipException("Open bug 310971 and 369139");
+ }
+
String fileName = "ImportTC1443738.csar";
String folder ="US825779";
@@ -309,6 +325,11 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest {
// TC1443887 - Update With One New Informational Artifact
@Test
public void updateWithOneNewInformationalArtifact() throws Exception {
+
+ if(true){
+ throw new SkipException("Open bug 310971 and 369139");
+ }
+
String fileName = "ImportTC1443887.csar";
String folder ="US825779";
@@ -332,6 +353,11 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest {
// TC1443888 - Update With One Removed Informational Artifact
@Test
public void updateWithOneRemovedInformationalArtifact() throws Exception {
+
+ if(true){
+ throw new SkipException("Open bug 310971 and 369139");
+ }
+
String folder ="US825779";
String fileName = "ImportTC1443888.csar";
@@ -361,6 +387,11 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest {
// TC1443890 - Update With One New Artifact Version Informational Artifact
@Test
public void updateWithOneNewArtifactVersionInformationalArtifact() throws Exception {
+
+ if(true){
+ throw new SkipException("Open bug 310971 and 369139");
+ }
+
String folder ="US825779";
String fileName = "ImportTC1443890.csar";
@@ -385,7 +416,12 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest {
// US825779 - Story: [BE] Import VSP - VF informational artifacts - Update
// TC1443893 - Update CSAR With Same Artifacts As Imported
@Test
- public void updateCSARWithSameArtifactsAsImported() throws Exception {
+ public void updateCSARWithSameArtifactsAsImported() throws Exception {
+
+ if(true){
+ throw new SkipException("Open bug 310971 and 369139");
+ }
+
String folder ="US825779";
String fileName = "ImportUpdateTC1443893.csar";
@@ -611,6 +647,10 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest {
// TC1444530 - Update Deployment Artifact With Invalid Type
@Test
public void updateDeploymentArtifactWithInvalidType() throws Exception {
+
+ if(true){
+ throw new SkipException("Open bug 310971 and 369139");
+ }
String folder ="US825779";
String fileName = "ImportTC1444530.csar";
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/DriverFactory.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/DriverFactory.java
index 6c76e327f0..0ba51de87a 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/DriverFactory.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/DriverFactory.java
@@ -21,16 +21,6 @@
package org.openecomp.sdc.ci.tests.execute.setup;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-
import org.apache.commons.io.FileUtils;
import org.openecomp.sdc.ci.tests.config.Config;
import org.openecomp.sdc.ci.tests.utilities.FileHandling;
@@ -40,6 +30,12 @@ import org.openqa.selenium.firefox.FirefoxProfile;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeSuite;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.util.*;
+
public class DriverFactory {
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentManager.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentManager.java
index 09dcad7c36..0a66f5f610 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentManager.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentManager.java
@@ -20,8 +20,11 @@
package org.openecomp.sdc.ci.tests.execute.setup;
-import java.io.File;
-
+import com.aventstack.extentreports.ExtentReports;
+import com.aventstack.extentreports.reporter.ExtentHtmlReporter;
+import com.aventstack.extentreports.reporter.ExtentXReporter;
+import com.aventstack.extentreports.reporter.configuration.Protocol;
+import com.aventstack.extentreports.reporter.configuration.Theme;
import org.openecomp.sdc.ci.tests.config.Config;
import org.openecomp.sdc.ci.tests.utilities.FileHandling;
import org.openecomp.sdc.ci.tests.utilities.RestCDUtils;
@@ -29,11 +32,12 @@ import org.openecomp.sdc.ci.tests.utils.Utils;
import org.openecomp.sdc.ci.tests.utils.rest.AutomationUtils;
import org.testng.ITestContext;
-import com.aventstack.extentreports.ExtentReports;
-import com.aventstack.extentreports.reporter.ExtentHtmlReporter;
-import com.aventstack.extentreports.reporter.ExtentXReporter;
-import com.aventstack.extentreports.reporter.configuration.Protocol;
-import com.aventstack.extentreports.reporter.configuration.Theme;
+import java.io.File;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
public class ExtentManager {
@@ -70,9 +74,8 @@ public class ExtentManager {
if (extent == null) {
extentxReporter = new ExtentXReporter(dbIp, dbPort);
- extent = new ExtentReports();
- initAndSetExtentHtmlReporter(filePath, htmlFile, isAppend);
-
+ extent = new ExtentReports();
+ initAndSetExtentHtmlReporter(filePath, htmlFile, isAppend);
if(extentxReporter.config().getReportObjectId() != null){
setExtentXReporter(isAppend);
}else{
@@ -88,7 +91,7 @@ public class ExtentManager {
}
public synchronized static void initAndSetExtentHtmlReporter(String filePath, String htmlFile, Boolean isAppend) throws Exception{
- htmlReporter = new ExtentHtmlReporter(filePath + htmlFile);
+ htmlReporter = new ExtentHtmlReporter(filePath + htmlFile);
setConfiguration(htmlReporter);
htmlReporter.setAppendExisting(isAppend);
extent.attachReporter(htmlReporter);
@@ -105,11 +108,11 @@ public class ExtentManager {
Config config = Utils.getConfig();
String envData = config.getUrl();
String suiteName = getSuiteName(context);
-
+ String reportStartDate = null;
if(suiteName.equals(suiteNameXml.TESTNG_FAILED_XML_NAME.getValue())){
- if (config.getUseBrowserMobProxy())
- setTrafficCaptue(config);
-
+ if (config.getUseBrowserMobProxy()) {
+ setTrafficCaptue(config);
+ }
setReporter(filepath, htmlFile, true);
String suiteNameFromVersionInfoFile = FileHandling.getKeyByValueFromPropertyFormatFile(filepath + VERSIONS_INFO_FILE_NAME, "suiteName");
reporterDataDefinition(onboardVersion, osVersion, envData, suiteNameFromVersionInfoFile);
@@ -117,8 +120,11 @@ public class ExtentManager {
FileHandling.deleteDirectory(SetupCDTest.getReportFolder());
FileHandling.createDirectory(filepath);
setReporter(filepath, htmlFile, false);
+ Calendar calendar = new GregorianCalendar();
+ SimpleDateFormat formatter = new SimpleDateFormat("MMM dd, yyyy hh:mm:ss a");
+ reportStartDate = formatter.format(calendar.getTime());
reporterDataDefinition(onboardVersion, osVersion, envData, suiteName);
- AutomationUtils.createVersionsInfoFile(filepath + VERSIONS_INFO_FILE_NAME, onboardVersion, osVersion, envData, suiteName);
+ AutomationUtils.createVersionsInfoFile(filepath + VERSIONS_INFO_FILE_NAME, onboardVersion, osVersion, envData, suiteName, reportStartDate);
}
}
@@ -152,6 +158,7 @@ public class ExtentManager {
htmlReporter.config().setReportName("SDC Automation Report");
htmlReporter.config().setChartVisibilityOnOpen(false);
htmlReporter.config().setJS(icon);
+ htmlReporter.setStartTime(null);
return htmlReporter;
}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestManager.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestManager.java
index 6d9b367460..4d28e9a8b4 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestManager.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestManager.java
@@ -20,12 +20,11 @@
package org.openecomp.sdc.ci.tests.execute.setup;
-import java.util.HashMap;
-
-import org.openecomp.sdc.ci.tests.api.SomeInterface;
-
import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.ExtentTest;
+import org.openecomp.sdc.ci.tests.api.SomeInterface;
+
+import java.util.HashMap;
public class ExtentTestManager implements SomeInterface{
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java
index 3bb4c7598c..2e05c2c059 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java
@@ -26,14 +26,21 @@ import java.io.IOException;
import java.util.Arrays;
import java.util.Map;
import java.util.UUID;
+import java.util.logging.FileHandler;
+import java.util.logging.Handler;
+import java.util.logging.LogManager;
+import java.util.logging.Logger;
import org.json.simple.JSONObject;
+import org.littleshoot.proxy.impl.ClientToProxyConnection;
+import org.littleshoot.proxy.impl.ProxyToServerConnection;
import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestManager;
import org.openecomp.sdc.ci.tests.api.SomeInterface;
import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
import org.openecomp.sdc.ci.tests.datatypes.UserCredentials;
import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
-import org.openecomp.sdc.ci.tests.execute.sanity.Onboard;
+import org.openecomp.sdc.ci.tests.execute.sanity.OnboardingFlowsUI;
import org.openecomp.sdc.ci.tests.execute.setup.ExtentManager.suiteNameXml;
import org.openecomp.sdc.ci.tests.pages.HomePage;
import org.openecomp.sdc.ci.tests.run.StartTest;
@@ -59,11 +66,14 @@ import org.testng.annotations.Optional;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
+import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.ExtentTest;
import com.aventstack.extentreports.Status;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.LoggerContext;
+import groovyjarjarantlr.Utils;
+import net.lightbody.bmp.BrowserMobProxyServer;
import net.lightbody.bmp.core.har.Har;
public abstract class SetupCDTest extends DriverFactory {
@@ -195,9 +205,9 @@ public abstract class SetupCDTest extends DriverFactory {
addTrafficFileToReport(result);
}
- if (result.getInstanceName().equals(Onboard.class.getName()) && result.getStatus() == ITestResult.FAILURE){
+ if (result.getInstanceName().equals(OnboardingFlowsUI.class.getName()) && result.getStatus() == ITestResult.FAILURE){
System.out.println("Onboarding test failed, closign browser....");
- getExtendTest().log(Status.INFO, "Onboarding test failed, closign browser....");
+ getExtendTest().log(Status.INFO, "Onboarding test failed, closing browser....");
quitDriver();
}
else if (!getUser().getRole().toLowerCase().equals(UserRoleEnum.ADMIN.name().toLowerCase())){
@@ -217,21 +227,28 @@ public abstract class SetupCDTest extends DriverFactory {
ExtentTestManager.endTest();
- addResultToCSV(result, context);
+ String suiteName = ExtentManager.getSuiteName(context);
+// write result to csv file
+ if((!suiteName.equals(suiteNameXml.TESTNG_FAILED_XML_NAME.getValue())) && (result.getStatus() == ITestResult.SKIP)) {
+ addResultToCSV(result, context);
+ }
+ if(suiteName.equals(suiteNameXml.TESTNG_FAILED_XML_NAME.getValue()) && !(result.getStatus() == ITestResult.SUCCESS)) {
+ addResultToCSV(result, context);
+ }
// ExtentManager.closeReporter();
FileHandling.cleanCurrentDownloadDir();
}
}
public void addResultToCSV(ITestResult result, ITestContext context) {
- String suiteName = ExtentManager.getSuiteName(context);
+// String suiteName = ExtentManager.getSuiteName(context);
ExtentTest test = getExtendTest();
com.aventstack.extentreports.model.Test model = test.getModel();
String name = model.getName();
String status = model.getStatus().toString();
- if (suiteName.equals(suiteNameXml.TESTNG_FAILED_XML_NAME.getValue()) && !(result.getStatus() == ITestResult.SUCCESS)) {
+// if (suiteName.equals(suiteNameXml.TESTNG_FAILED_XML_NAME.getValue()) && !(result.getStatus() == ITestResult.SUCCESS)) {
getCsvReport().writeRow(result.getInstanceName(), name.replace(RE_RUN,""), status);
- }
+// }
}
public void generateReport4Jenkins(ITestContext context) {
@@ -288,7 +305,7 @@ public abstract class SetupCDTest extends DriverFactory {
String message = "no URL found";
System.out.println(message);
Assert.fail(message);
- } else if (!url.contains("localhost") && !url.contains("127.0.0.1")) {
+ } else if (!url.contains("localhost") && !url.contains("192.168.33.10") && !url.contains("127.0.0.1")) {
localEnv = false;
}
return url;