aboutsummaryrefslogtreecommitdiffstats
path: root/ui-ci/src/main
diff options
context:
space:
mode:
authorMichael Lando <ml636r@att.com>2017-07-17 21:12:03 +0300
committerMichael Lando <ml636r@att.com>2017-07-17 21:12:03 +0300
commit75aacbbe1acf78fa53378f07f0a8c7769449a17e (patch)
tree68a9799eb8f4704dd9a3d513401df9bb11af7739 /ui-ci/src/main
parentdec02e7cc74e1c401be51bd9d266575e1e008f5f (diff)
[SDC] rebase 1710 code
Change-Id: I532ed68979fee7840ea8a5395e7e965b155fb9f9 Signed-off-by: Michael Lando <ml636r@att.com>
Diffstat (limited to 'ui-ci/src/main')
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MIBsArtifactsOnResourceInstance.java4
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/DataTestIdEnum.java22
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Onboard.java41
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardViaApis.java32
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Service.java12
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java4
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtils.java29
7 files changed, 105 insertions, 39 deletions
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MIBsArtifactsOnResourceInstance.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MIBsArtifactsOnResourceInstance.java
index 949a20b4a9..4e4192fe7e 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MIBsArtifactsOnResourceInstance.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MIBsArtifactsOnResourceInstance.java
@@ -78,10 +78,6 @@ public class MIBsArtifactsOnResourceInstance extends SetupCDTest {
setLog("mibsArtifactCRUDUi");
String filePath = FileHandling.getFilePath(folder);
- if(true){
- throw new SkipException("Open bug 197101");
- }
-
// import Resource
ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(resourceTypeEnum, getUser());
ResourceUIUtils.importVfc(resourceMetaData, filePath, fileName, getUser());
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/DataTestIdEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/DataTestIdEnum.java
index ef510b8a12..5bbc8ad9e0 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/DataTestIdEnum.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/DataTestIdEnum.java
@@ -433,19 +433,19 @@ public final class DataTestIdEnum {
}
public enum StepsEnum {
- GENERAL("Generalstep"),
+ GENERAL("General"),
ICON("Iconstep"),
- DEPLOYMENT_ARTIFACT("Deployment Artifactstep"),
- INFORMATION_ARTIFACT("Information Artifactstep"),
- PROPERTIES("Propertiesstep"),
- COMPOSITION("Compositionstep"),
- ACTIVITY_LOG("Activity Logstep"),
- DEPLOYMENT_VIEW("Deploymentstep"),
- TOSCA_ARTIFACTS("TOSCA Artifactsstep"),
+ DEPLOYMENT_ARTIFACT("Deployment Artifact"),
+ INFORMATION_ARTIFACT("Information Artifact"),
+ PROPERTIES("Properties"),
+ COMPOSITION("Composition"),
+ ACTIVITY_LOG("Activity Log"),
+ DEPLOYMENT_VIEW("Deployment"),
+ TOSCA_ARTIFACTS("TOSCA Artifacts"),
MONITOR("Monitor step"),
- MANAGEMENT_WORKFLOW("Management Workflowstep"),
- INPUTS("Inputsstep"),
- HIERARCHY("Hierarchystep");
+ MANAGEMENT_WORKFLOW("Management Workflow"),
+ INPUTS("Inputs"),
+ HIERARCHY("Hierarchy");
private String value;
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/Onboard.java
index fddb97ace3..76723bba11 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/Onboard.java
@@ -27,9 +27,11 @@ import java.awt.AWTException;
import java.io.File;
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.Random;
import java.util.stream.Collectors;
import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
@@ -94,6 +96,36 @@ public class Onboard extends SetupCDTest {
return provideData(fileNamesFromFolder, filepath);
}
+
+ @DataProvider(name = "randomVNF_List", parallel = false)
+ private static final Object[][] randomVnfList() throws Exception {
+ int randomElementNumber = 3; //how many VNFs to onboard randomly
+ String filepath = getFilePath();
+ Object[] fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath);
+ Object[] newRandomFileNamesFromFolder = getRandomElements(randomElementNumber, fileNamesFromFolder);
+ System.out.println(String.format("There are %s zip file(s) to test", newRandomFileNamesFromFolder.length));
+ return provideData(newRandomFileNamesFromFolder, filepath);
+ }
+
+
+ private static Object[] getRandomElements(int randomElementNumber, Object[] fileNamesFromFolder) {
+ if(fileNamesFromFolder.length == 0 || fileNamesFromFolder.length < randomElementNumber){
+ return null;
+ }else{
+ List<Integer> indexList = new ArrayList<>();
+ Object[] newRandomFileNamesFromFolder = new Object[randomElementNumber];
+ for(int i = 0; i < fileNamesFromFolder.length; i++){
+ indexList.add(i);
+ }
+ Collections.shuffle(indexList);
+ Integer[] randomArray = indexList.subList(0, randomElementNumber).toArray(new Integer[randomElementNumber]);
+ for(int i = 0; i < randomArray.length; i++){
+ newRandomFileNamesFromFolder[i] = fileNamesFromFolder[randomArray[i]];
+ }
+ return newRandomFileNamesFromFolder;
+ }
+ }
+
public static String getFilePath() {
String filepath = System.getProperty("filepath");
if (filepath == null && System.getProperty("os.name").contains("Windows")) {
@@ -116,6 +148,7 @@ public class Onboard extends SetupCDTest {
runOnboardToDistributionFlow(filepath, vnfFile);
}
+
public void runOnboardToDistributionFlow(String filepath, String vnfFile) throws Exception, AWTException {
Pair<String,Map<String,String>> onboardAndValidate = OnboardingUtils.onboardAndValidate(filepath, vnfFile, getUser());
String vspName = onboardAndValidate.left;
@@ -193,6 +226,14 @@ public class Onboard extends SetupCDTest {
runOnboardToDistributionFlow(filepath, vnfFile);
}
+ @Test(dataProvider = "randomVNF_List")
+ public void onboardRandomVNFsTest(String filepath, String vnfFile) throws Exception, Throwable {
+ setLog(vnfFile);
+ System.out.println("printttttttttttttt - >" + makeDistributionValue);
+ System.out.println("vnf File name is: " + vnfFile);
+ runOnboardToDistributionFlow(filepath, vnfFile);
+ }
+
@Test
public void onboardUpdateVNFTest() throws Exception, Throwable {
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 cb647aec6d..0dc6740c30 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
@@ -25,6 +25,7 @@ import static org.testng.AssertJUnit.assertEquals;
import java.awt.AWTException;
import java.io.File;
import java.io.FileOutputStream;
+import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.sql.Timestamp;
import java.util.ArrayList;
@@ -40,6 +41,7 @@ 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.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceDistributionStatus;
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;
@@ -49,6 +51,8 @@ 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.tosca.parser.exceptions.SdcToscaParserException;
+import org.openecomp.sdc.toscaparser.api.common.JToscaException;
import org.slf4j.LoggerFactory;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
@@ -125,6 +129,34 @@ public class OnboardViaApis{
}
+
+ @Test
+ public void onboardingAndParser() throws Exception {
+ Service service = null;
+ String filepath = getFilePath();
+ Object[] fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath);
+ String vnfFile = fileNamesFromFolder[7].toString();
+ System.err.println(timestamp + " Starting test with VNF: " + vnfFile);
+ service = runOnboardViaApisOnly(filepath, vnfFile);
+
+// AtomicOperationUtils.getServiceObjectByNameAndVersion(sdncModifierDetails, serviceName, serviceVersion);
+// RestResponse distributeService = AtomicOperationUtils.distributeService(service, true);
+// Map<Long, ServiceDistributionStatus> convertServiceDistributionStatusToObject = ResponseParser.convertServiceDistributionStatusToObject(distributeService.getResponse());
+// convertServiceDistributionStatusToObject.
+ }
+
+ public static String getFilePath() {
+ String filepath = System.getProperty("filepath");
+ if (filepath == null && System.getProperty("os.name").contains("Windows")) {
+ filepath = FileHandling.getResourcesFilesPath() +"VNFs";
+ }
+
+ else if(filepath.isEmpty() && !System.getProperty("os.name").contains("Windows")){
+ filepath = FileHandling.getBasePath() + File.separator + "Files" + File.separator +"VNFs";
+ }
+ return filepath;
+ }
+
public static void downloadToscaCsarToDirectory(Service service, File file) {
try {
Either<String,RestResponse> serviceToscaArtifactPayload = AtomicOperationUtils.getServiceToscaArtifactPayload(service, "assettoscacsar");
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 d5920a22ca..3a42d22d0e 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
@@ -387,10 +387,6 @@ public class Service extends SetupCDTest {
@Test
public void deleteDeploymentArtifactFromVFInstanceTest() throws Exception{
- if(true){
- throw new SkipException("Open bug 300513");
- }
-
ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
ArtifactInfo artifact = new ArtifactInfo(filePath, HEAT_FILE_YAML_NAME, DESCRIPTION, ARTIFACT_LABEL,ArtifactTypeEnum.SNMP_POLL.getType());
@@ -405,10 +401,6 @@ public class Service extends SetupCDTest {
@Test
public void deleteDeploymentArtifactFromVFInstanceNextVersionTest() throws Exception{
- if(true){
- throw new SkipException("Open bug 300513");
- }
-
ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
ArtifactInfo artifact = new ArtifactInfo(filePath, HEAT_FILE_YAML_NAME, DESCRIPTION, ARTIFACT_LABEL,ArtifactTypeEnum.SNMP_POLL.getType());
@@ -434,10 +426,6 @@ public class Service extends SetupCDTest {
@Test
public void updateDeploymentArtifactOnVFInstanceNextVersionTest() throws Exception{
- if(true){
- throw new SkipException("Open bug 300513");
- }
-
ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
ArtifactInfo artifact = new ArtifactInfo(filePath, HEAT_FILE_YAML_NAME, DESCRIPTION, ARTIFACT_LABEL,ArtifactTypeEnum.SNMP_POLL.getType());
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 a94a63500d..ef7a534ee9 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
@@ -231,10 +231,6 @@ public class Vf extends SetupCDTest {
@Test
public void addPropertiesToVfcInstanceInVfTest() throws Exception {
- if(true){
- throw new SkipException("Open bug 292047");
- }
-
String fileName = "vFW_VFC.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/utilities/OnboardingUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtils.java
index 621cc26a12..ae05e77aff 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtils.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtils.java
@@ -506,6 +506,7 @@ public class OnboardingUtils {
jObject.put("description", "new VSP description");
jObject.put("category", "resourceNewCategory.generic");
jObject.put("subCategory", "resourceNewCategory.generic.database");
+ jObject.put("onboardingMethod", "HEAT");
jObject.put("licensingVersion", jlicensingVersionObj);
jObject.put("vendorName", vendorName);
jObject.put("vendorId", vendorId);
@@ -669,7 +670,7 @@ public class OnboardingUtils {
boolean vspFound = HomePage.searchForVSP(vspName);
if (vspFound){
-
+
List<WebElement> elemenetsFromTable = HomePage.getElemenetsFromTable();
// WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 30);
// WebElement findElement = wait.until(ExpectedConditions.visibilityOf(elemenetsFromTable.get(1)));
@@ -767,24 +768,36 @@ public class OnboardingUtils {
LinkedList<HeatMetaFirstLevelDefinition> deploymentArtifacts = ((LinkedList<HeatMetaFirstLevelDefinition>) combinedMap.get("Deployment"));
ArtifactsCorrelationManager.addVNFartifactDetails(vspName, deploymentArtifacts);
- validateDeploymentArtifactsVersion(deploymentArtifacts);
+ List<String> heatEnvFilesFromCSAR = deploymentArtifacts.stream().filter(e -> e.getType().equals("HEAT_ENV")).
+ map(e -> e.getFileName()).
+ collect(Collectors.toList());
+
+ validateDeploymentArtifactsVersion(deploymentArtifacts, heatEnvFilesFromCSAR);
+
DeploymentArtifactPage.verifyArtifactsExistInTable(filepath, vnfFile);
return createVendorSoftwareProduct;
}
- public static void validateDeploymentArtifactsVersion(LinkedList<HeatMetaFirstLevelDefinition> deploymentArtifacts) {
- String artifactVersion = "1";
+ public static void validateDeploymentArtifactsVersion(LinkedList<HeatMetaFirstLevelDefinition> deploymentArtifacts,
+ List<String> heatEnvFilesFromCSAR) {
+ String artifactVersion;
String artifactName;
-
+
for(HeatMetaFirstLevelDefinition deploymentArtifact: deploymentArtifacts) {
+ artifactVersion = "1";
+
if(deploymentArtifact.getType().equals("HEAT_ENV")) {
continue;
} else if(deploymentArtifact.getFileName().contains(".")) {
- artifactName = deploymentArtifact.getFileName().trim().substring(0, deploymentArtifact.getFileName().lastIndexOf("."));
+ artifactName = deploymentArtifact.getFileName().trim().substring(0, deploymentArtifact.getFileName().lastIndexOf("."));
} else {
- artifactName = deploymentArtifact.getFileName().trim();
+ artifactName = deploymentArtifact.getFileName().trim();
+ }
+
+ if (heatEnvFilesFromCSAR.contains(artifactName + ".env")){
+ artifactVersion = "2";
}
- ArtifactUIUtils.validateArtifactNameVersionType(artifactName, artifactVersion, deploymentArtifact.getType());
+ ArtifactUIUtils.validateArtifactNameVersionType(artifactName, artifactVersion, deploymentArtifact.getType());
}
}