aboutsummaryrefslogtreecommitdiffstats
path: root/test-apis-ci
diff options
context:
space:
mode:
authorAndyWalshe <andy.walshe@est.tech>2019-04-25 11:20:38 +0000
committerOren Kleks <orenkle@amdocs.com>2019-04-28 06:29:38 +0000
commitc1835f3275dd047393e05f92085a42bd61a5bd39 (patch)
tree539311d765a0ad7cfef4d6fc201c473f3212adef /test-apis-ci
parenta490dfcbf9bb06484998362847715ec589abf2a9 (diff)
Update Sanity tests to verify PNF package onboarding
Change-Id: Ibf7af544bf5fb9c63cf8d9c1573dafe50a395560 Issue-ID: SDC-1970 Signed-off-by: AndyWalshe <andy.walshe@est.tech>
Diffstat (limited to 'test-apis-ci')
-rw-r--r--test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/PNFs/sample-pnf-1.0.1-SNAPSHOT.csarbin0 -> 22793 bytes
-rw-r--r--test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/PNFs/sample-signed-pnf-1.0.1-SNAPSHOT.zipbin0 -> 23132 bytes
-rw-r--r--test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/cert/root.cert21
-rw-r--r--test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/recipes/sanityApiTests_2_setup_configuration.rb9
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentBaseTest.java3
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProviders/OnboardingDataProviders.java3
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProviders/OnbordingDataProviders.java24
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/XnfTypeEnum.java17
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/Onboard.java18
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/FileHandling.java5
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtils.java27
11 files changed, 91 insertions, 36 deletions
diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/PNFs/sample-pnf-1.0.1-SNAPSHOT.csar b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/PNFs/sample-pnf-1.0.1-SNAPSHOT.csar
new file mode 100644
index 0000000000..6142b9bb95
--- /dev/null
+++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/PNFs/sample-pnf-1.0.1-SNAPSHOT.csar
Binary files differ
diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/PNFs/sample-signed-pnf-1.0.1-SNAPSHOT.zip b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/PNFs/sample-signed-pnf-1.0.1-SNAPSHOT.zip
new file mode 100644
index 0000000000..d97e639711
--- /dev/null
+++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/PNFs/sample-signed-pnf-1.0.1-SNAPSHOT.zip
Binary files differ
diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/cert/root.cert b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/cert/root.cert
new file mode 100644
index 0000000000..8db7c191a6
--- /dev/null
+++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/cert/root.cert
@@ -0,0 +1,21 @@
+-----BEGIN CERTIFICATE-----
+MIIDYDCCAkigAwIBAgIJAKqOa8IS4G5sMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV
+BAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBX
+aWRnaXRzIFB0eSBMdGQwHhcNMTkwNDAxMTY1NDU0WhcNMTkwNT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cookbooks/sdc-api-tests/recipes/sanityApiTests_2_setup_configuration.rb b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/recipes/sanityApiTests_2_setup_configuration.rb
index 7321155232..595b24a6d1 100644
--- a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/recipes/sanityApiTests_2_setup_configuration.rb
+++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/recipes/sanityApiTests_2_setup_configuration.rb
@@ -41,3 +41,12 @@ template "titan.properties" do
:DC_NAME => node['cassandra']['datacenter_name']+node.chef_environment
})
end
+
+bash "Make root cert file available" do
+cwd "#{tests_base}"
+code <<-EOH
+ cp /root/chef-solo/cookbooks/sdc-api-tests/files/default/cert/root.cert /var/lib/tests/cert/root.cert
+ echo "root.cert file made available for tests."
+EOH
+end
+
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentBaseTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentBaseTest.java
index c0f209fdd2..4f74345182 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentBaseTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentBaseTest.java
@@ -107,7 +107,8 @@ public abstract class ComponentBaseTest {
public void setupBeforeTest(java.lang.reflect.Method method, ITestContext context) throws Exception {
System.out.println(" method.getName() " + method.getName());
- if (!method.getName().equals("onboardVNFShotFlow")) {
+ if (!"onboardVNFShotFlow".equals(method.getName()) &&
+ !"onboardPNFFlow".equals(method.getName()) ) {
logger.info("ExtentReport instance started from BeforeMethod...");
ExtentTestManager.startTest(method.getName());
ExtentTestManager.assignCategory(this.getClass());
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProviders/OnboardingDataProviders.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProviders/OnboardingDataProviders.java
index 29de86adb3..6b58baf981 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProviders/OnboardingDataProviders.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProviders/OnboardingDataProviders.java
@@ -1,5 +1,6 @@
package org.openecomp.sdc.ci.tests.dataProviders;
+import org.openecomp.sdc.ci.tests.datatypes.enums.XnfTypeEnum;
import org.openecomp.sdc.ci.tests.utils.general.FileHandling;
import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils;
import org.testng.annotations.DataProvider;
@@ -25,7 +26,7 @@ public class OnboardingDataProviders {
@DataProvider(name = "VNF_List" , parallel = true)
private static final Object[][] VnfList() throws Exception {
- List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileList();
+ List<String> fileNamesFromFolder = OnboardingUtils.getXnfNamesFileList(XnfTypeEnum.VNF);
System.out.println(String.format("There are %s zip file(s) to test", fileNamesFromFolder.size()));
return provideData(fileNamesFromFolder, filepath);
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProviders/OnbordingDataProviders.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProviders/OnbordingDataProviders.java
index 9f9fd99bd9..e834d6e436 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProviders/OnbordingDataProviders.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProviders/OnbordingDataProviders.java
@@ -1,5 +1,6 @@
package org.openecomp.sdc.ci.tests.dataProviders;
+import org.openecomp.sdc.ci.tests.datatypes.enums.XnfTypeEnum;
import org.openecomp.sdc.ci.tests.utils.general.FileHandling;
import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils;
import org.testng.annotations.DataProvider;
@@ -12,7 +13,7 @@ import static org.testng.Assert.assertFalse;
public class OnbordingDataProviders {
- protected static String filepath = FileHandling.getVnfRepositoryPath();
+ protected static String vnfFilepath = FileHandling.getXnfRepositoryPath(XnfTypeEnum.VNF);
// -----------------------dataProviders-----------------------------------------
@DataProvider(name = "randomVNF_List", parallel = false)
@@ -21,26 +22,33 @@ public class OnbordingDataProviders {
List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileListExcludeToscaParserFailure();
List<String> newRandomFileNamesFromFolder = getRandomElements(randomElementNumber, fileNamesFromFolder);
if(newRandomFileNamesFromFolder == null){
- assertFalse(true,"Requered number of VNF files not exists under " + filepath);
+ assertFalse(true,"Requered number of VNF files not exists under " + vnfFilepath);
}
System.out.println(String.format("There are %s zip file(s) to test", newRandomFileNamesFromFolder.size()));
- return provideData(newRandomFileNamesFromFolder, filepath);
+ return provideData(newRandomFileNamesFromFolder, vnfFilepath);
}
@DataProvider(name = "VNF_List" , parallel = true)
private static final Object[][] VnfList() throws Exception {
- List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileList();
- System.out.println(String.format("There are %s zip file(s) to test", fileNamesFromFolder.size()));
- return provideData(fileNamesFromFolder, filepath);
+ List<String> fileNamesFromFolder = OnboardingUtils.getXnfNamesFileList(XnfTypeEnum.VNF);
+ System.out.println(String.format("There are %s package file(s) to test", fileNamesFromFolder.size()));
+ return provideData(fileNamesFromFolder, vnfFilepath);
+ }
+
+ @DataProvider(name = "PNF_List" , parallel = true)
+ private static final Object[][] nfList() throws Exception {
+ List<String> fileNamesFromFolder = OnboardingUtils.getXnfNamesFileList(XnfTypeEnum.PNF);
+ System.out.println(String.format("There are %s package file(s) to test", fileNamesFromFolder.size()));
+ return provideData(fileNamesFromFolder, FileHandling.getXnfRepositoryPath(XnfTypeEnum.PNF));
}
@DataProvider(name = "Single_VNF" , parallel = true)
private static final Object[][] SingleVNF() throws Exception {
- List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileList();
+ List<String> fileNamesFromFolder = OnboardingUtils.getXnfNamesFileList(XnfTypeEnum.VNF);
List<String> newList = new ArrayList<>();
newList.add(fileNamesFromFolder.get(0));
System.out.println(String.format("There are %s zip file(s) to test", fileNamesFromFolder.size()));
- return provideData(newList, filepath);
+ return provideData(newList, vnfFilepath);
}
// -----------------------factories-----------------------------------------
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/XnfTypeEnum.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/XnfTypeEnum.java
new file mode 100644
index 0000000000..b2181227f2
--- /dev/null
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/XnfTypeEnum.java
@@ -0,0 +1,17 @@
+package org.openecomp.sdc.ci.tests.datatypes.enums;
+
+public enum XnfTypeEnum {
+
+ VNF ("VNF"),
+ PNF ("PNF");
+
+ private String value;
+
+ private XnfTypeEnum(String value) {
+ this.value = value;
+ }
+
+ public String getValue() {
+ return value;
+ }
+}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/Onboard.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/Onboard.java
index 99bfad6bbd..1f8e8b5c06 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/Onboard.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/Onboard.java
@@ -80,9 +80,14 @@ public class Onboard extends ComponentBaseTest {
@Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "VNF_List")
public void onboardVNFShotFlow(String filePath, String vnfFile) throws Exception, Throwable {
setLog(vnfFile);
- System.out.println("print - >" + makeDistributionValue);
runOnboardToDistributionFlow(filePath, vnfFile);
}
+
+ @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "PNF_List")
+ public void onboardPNFFlow(String filePath, String pnfFile) throws Exception, Throwable {
+ setLog(pnfFile);
+ runOnboardToDistributionFlow(filePath, pnfFile);
+ }
@Test
public void passTest() {
@@ -99,10 +104,8 @@ public class Onboard extends ComponentBaseTest {
User user = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
VendorSoftwareProductObject vendorSoftwareProductObject = OnboardingUtillViaApis.createVspViaApis(resourceReqDetails, filePath, vnfFile, user);
-// vendorSoftwareProductObject.setName(vendorSoftwareProductObject.getName());
// create VF base on VNF imported from previous step - have, resourceReqDetails object include part of resource metadata
-// ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject);
ExtentTestActions.log(Status.INFO, String.format("Create VF %s From VSP", resourceReqDetails.getName()));
Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails, UserRoleEnum.DESIGNER);
@@ -126,18 +129,11 @@ public class Onboard extends ComponentBaseTest {
if (makeToscaValidationValue.equals("true")) {
- ExtentTestActions.log(Status.INFO, String.format("Start tosca validation"));
+ ExtentTestActions.log(Status.INFO, "Start tosca validation");
AtomicOperationUtils.toscaValidation(service ,vnfFile);
-
-
}
-
-
-
ExtentTestActions.log(Status.INFO, String.format("The onboarding %s test is passed ! ", vnfFile));
}
-
-
}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/FileHandling.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/FileHandling.java
index 72610331d9..4dbc8b2dee 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/FileHandling.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/FileHandling.java
@@ -25,6 +25,7 @@ import org.apache.commons.io.FileUtils;
import org.openecomp.sdc.be.model.DataTypeDefinition;
import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
import org.openecomp.sdc.ci.tests.config.Config;
+import org.openecomp.sdc.ci.tests.datatypes.enums.XnfTypeEnum;
import org.openecomp.sdc.common.util.GeneralUtility;
import org.yaml.snakeyaml.Yaml;
@@ -140,6 +141,10 @@ public class FileHandling {
return getFilePath("VNFs");
}
+ public static String getXnfRepositoryPath(XnfTypeEnum xnfTypeEnum) {
+ return xnfTypeEnum.getValue().equals(XnfTypeEnum.PNF.name()) ? getFilePath("PNFs") : getFilePath("VNFs");
+ }
+
public static String getPortMirroringRepositoryPath() {
return getFilePath("PortMirroring");
}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtils.java
index 8b5f91b53d..1a15f46c08 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtils.java
@@ -23,6 +23,7 @@ package org.openecomp.sdc.ci.tests.utils.general;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.ci.tests.api.Urls;
import org.openecomp.sdc.ci.tests.config.Config;
+import org.openecomp.sdc.ci.tests.datatypes.enums.XnfTypeEnum;
import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum;
import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest;
import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
@@ -34,9 +35,9 @@ import java.util.*;
public class OnboardingUtils {
/**
- * excluded VNF file list
+ * excluded VNF or PNF file list
*/
- public static List<String> exludeVnfList =
+ public static List<String> excludeXnfList =
// new ArrayList<>();
Arrays.asList(
// DUPLICATE_RESOURCE_ID_IN_DIFFERENT_FILES:
@@ -85,9 +86,9 @@ public class OnboardingUtils {
);
/**
- * additional files to exludeVnfList files for tosca parser tests
+ * additional files to excludeXnfList files for tosca parser tests
*/
- protected static List<String> exludeVnfListForToscaParser = //new ArrayList<String>();
+ protected static List<String> excludeXnfListForToscaParser = //new ArrayList<String>();
Arrays.asList(
"1-Vvig-062017-(MOBILITY)_v5.1.zip",
"1-Mvm-sbc-1710-092017-(MOBILITY)_v7.0.zip",
@@ -177,18 +178,14 @@ public class OnboardingUtils {
return headersMap;
}
-
/**
* @return
- * The method returns VNF names list from Files directory under sdc-vnfs repository
+ * The method returns XNF names list from Files directory under sdc repository
*/
- public static List<String> getVnfNamesFileList() {
- String filepath = FileHandling.getVnfRepositoryPath();
+ public static List<String> getXnfNamesFileList(XnfTypeEnum xnfTypeEnum) {
+ String filepath = FileHandling.getXnfRepositoryPath(xnfTypeEnum);
List<String> fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath);
- //Please remove the hardcoded configuration ONAP Tal G!!!!!!
- fileNamesFromFolder.removeAll(exludeVnfList);
- //List<String> halfResourceListByDay = divideListByDayOfMonth(fileNamesFromFolder);
- //System.out.println(halfResourceListByDay.toString());
+ fileNamesFromFolder.removeAll(excludeXnfList);
return fileNamesFromFolder;
}
@@ -213,8 +210,8 @@ public class OnboardingUtils {
* The method returns VNF names list from Files directory under sdc-vnfs repository excluding zip files that known as failed in tosca parser
*/
public static List<String> getVnfNamesFileListExcludeToscaParserFailure() {
- List<String> fileNamesFromFolder = getVnfNamesFileList();
- fileNamesFromFolder.removeAll(exludeVnfListForToscaParser);
+ List<String> fileNamesFromFolder = getXnfNamesFileList(XnfTypeEnum.VNF);
+ fileNamesFromFolder.removeAll(excludeXnfListForToscaParser);
return fileNamesFromFolder;
}
@@ -230,7 +227,7 @@ public class OnboardingUtils {
String vnfSourceFile = (String) objectArr[i][0];
String vnfUpdateFile = (String) objectArr[i][1];
- if(!exludeVnfList.contains(vnfSourceFile) && !exludeVnfList.contains(vnfUpdateFile))
+ if(!excludeXnfList.contains(vnfSourceFile) && !excludeXnfList.contains(vnfUpdateFile))
{
filteredArObject[index] = new Object[]{vnfSourceFile , vnfUpdateFile };
index++;