Add UI/Rest sanity checks for helm package onboarding 46/118346/3
authorRemigiusz Janeczek <remigiusz.janeczek@nokia.com>
Wed, 24 Feb 2021 08:15:48 +0000 (09:15 +0100)
committerChristophe Closset <christophe.closset@intl.att.com>
Thu, 25 Feb 2021 13:30:20 +0000 (13:30 +0000)
Issue-ID: SDC-3185
Signed-off-by: Remigiusz Janeczek <remigiusz.janeczek@nokia.com>
Change-Id: I17f19987c76647b448a409fda6b4a85e058d9612

integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/data/providers/OnboardingDataProviders.java
integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/datatypes/enums/XnfTypeEnum.java
integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/sanity/Onboard.java
integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/utils/general/FileHandling.java
integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/dataProvider/OnbordingDataProviders.java
integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/OnboardingFlowsUi.java
integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/utilities/FileHandling.java
integration-tests/src/test/resources/Files/CNFs/helm-package-valid.zip [new file with mode: 0644]
integration-tests/src/test/resources/ci/testSuites/backend/onapApiSanity.xml
integration-tests/src/test/resources/ci/testSuites/frontend/onapUiSanity.xml

index 5b6ecbf..a743521 100644 (file)
@@ -69,6 +69,13 @@ public final class OnboardingDataProviders {
             FileHandling.getXnfRepositoryPath(XnfTypeEnum.PNF));
     }
 
+    @DataProvider(name = "CNF_List", parallel = true)
+    private static Object[][] cnfList() {
+        final List<String> fileNamesFromFolder = OnboardingUtils.getXnfNamesFileList(XnfTypeEnum.CNF);
+        LOGGER.debug(String.format("There are %s package file(s) to test", fileNamesFromFolder.size()));
+        return provideData(fileNamesFromFolder, FileHandling.getXnfRepositoryPath(XnfTypeEnum.CNF));
+    }
+
     @DataProvider(name = "Single_VNF", parallel = true)
     private static Object[][] singleVNF() {
         final List<String> fileNamesFromFolder = OnboardingUtils.getXnfNamesFileList(XnfTypeEnum.VNF);
index 88f6b6c..0ee3e65 100644 (file)
@@ -23,7 +23,8 @@ package org.onap.sdc.backend.ci.tests.datatypes.enums;
 public enum XnfTypeEnum {
 
     VNF ("VNF"),
-    PNF ("PNF");
+    PNF ("PNF"),
+    CNF ("CNF");
 
     private String value;
 
index da2d9f7..a16fa3e 100644 (file)
@@ -78,6 +78,12 @@ public class Onboard extends ComponentBaseTest {
                runOnboardToDistributionFlow(filePath, pnfFile, ResourceTypeEnum.PNF);
        }
 
+       @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "CNF_List")
+       public void onboardCNFFlow(String filePath, String cnfFile) throws Exception {
+               setLog(cnfFile);
+               runOnboardToDistributionFlow(filePath, cnfFile, ResourceTypeEnum.VF);
+       }
+
        private void runOnboardToDistributionFlow(String packageFilePath, String packageFileName, ResourceTypeEnum resourceTypeEnum) throws Exception {
                ExtentTestActions.log(Status.INFO, String.format("Going to onboard the %s %s", resourceTypeEnum.getValue(), packageFileName));
                User user = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
index 19533e9..d4191d7 100644 (file)
@@ -32,6 +32,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.nio.file.Paths;
 import java.util.ArrayList;
+import java.util.EnumMap;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.List;
@@ -130,12 +131,27 @@ public class FileHandling {
                return getCiFilesPath() + File.separator + "conf" + File.separator;
        }
 
+
+       private static EnumMap<XnfTypeEnum, String> XNF_REPOSITORY_PATHS_MAP = new EnumMap<>(Map.of(
+               XnfTypeEnum.PNF, getPnfRepositoryPath(),
+               XnfTypeEnum.CNF, getCnfRepositoryPath(),
+               XnfTypeEnum.VNF, getVnfRepositoryPath()
+       ));
+
        public static String getVnfRepositoryPath() {
                return getFilePath("VNFs");
        }
 
+       private static String getPnfRepositoryPath() {
+               return getFilePath("PNFs");
+       }
+
+       private static String getCnfRepositoryPath() {
+               return getFilePath("CNFs");
+       }
+
        public static String getXnfRepositoryPath(XnfTypeEnum xnfTypeEnum) {
-               return xnfTypeEnum.getValue().equals(XnfTypeEnum.PNF.name()) ? getFilePath("PNFs") : getFilePath("VNFs");
+               return XNF_REPOSITORY_PATHS_MAP.get(xnfTypeEnum);
        }
 
        public static String getPortMirroringRepositoryPath() {
index 0dee90f..d8dc5f9 100644 (file)
@@ -56,6 +56,15 @@ public class OnbordingDataProviders {
         return provideData(fileNamesFromFolder, filepath);
     }
 
+    @DataProvider(name = "CNF_List", parallel = true)
+    private static Object[][] cnfList() {
+
+        List<String> fileNamesFromFolder = OnboardingUtils.getXnfNamesFileList(XnfTypeEnum.CNF);
+
+        System.out.println(String.format("There are %s zip file(s) to test", fileNamesFromFolder.size()));
+        return provideData(fileNamesFromFolder, FileHandling.getCnfRepositoryPath());
+    }
+
     @DataProvider(name = "updateList")
     private static Object[][] updateList() throws Exception {
 
index 24451d6..9327d6c 100644 (file)
@@ -465,6 +465,14 @@ public class OnboardingFlowsUi extends SetupCDTest {
         runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, vnfFile);
     }
 
+    @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "CNF_List")
+    public void onboardCNFTest(String filePath, String cnfFile) throws Exception {
+        setLog(cnfFile);
+        ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
+        ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
+        runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, cnfFile);
+    }
+
     @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "VNF_List")
     public void onboardVNFShotFlow(String filePath, String vnfFile) throws Exception {
         setLog(vnfFile);
index b7f199d..7ae346c 100644 (file)
@@ -145,6 +145,9 @@ public class FileHandling {
     public static String getVnfRepositoryPath() {
         return getFilePath("VNFs");
     }
+    public static String getCnfRepositoryPath() {
+        return getFilePath("CNFs");
+    }
 
     public static String getUpdateVSPVnfRepositoryPath() {
         return getFilePath("UpdateVSP");
diff --git a/integration-tests/src/test/resources/Files/CNFs/helm-package-valid.zip b/integration-tests/src/test/resources/Files/CNFs/helm-package-valid.zip
new file mode 100644 (file)
index 0000000..349a9ee
Binary files /dev/null and b/integration-tests/src/test/resources/Files/CNFs/helm-package-valid.zip differ
index fbd796e..9753798 100644 (file)
@@ -8,4 +8,4 @@
       <class name="org.onap.sdc.backend.ci.tests.sanity.Onboard"/>
     </classes>
   </test>
-</suite>
\ No newline at end of file
+</suite>
index 48e28fc..c53dd4a 100644 (file)
@@ -19,6 +19,7 @@
       <class name="org.onap.sdc.frontend.ci.tests.execute.sanity.OnboardingFlowsUi">
         <methods>
           <include name="onapOnboardVNFflow"/>
+          <include name="onboardCNFTest"/>
           <include name="onapOnboardVSPValidationsSanityFlow"/>
           <include name="onboardPNFSoftwareInformationFlow"/>
         </methods>