diff options
Diffstat (limited to 'test-apis-ci/src/main/java')
7 files changed, 61 insertions, 36 deletions
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++; |