summaryrefslogtreecommitdiffstats
path: root/vnf-sdk-function-test/src/test
diff options
context:
space:
mode:
authorMurali-P <murali.p@huawei.com>2017-02-15 16:16:54 +0530
committerMurali-P <murali.p@huawei.com>2017-02-15 16:16:54 +0530
commit1a6861184c06c2e8ea41c8b5a86350fb2d2d227a (patch)
treecdd603fa0c4caf93ebebc4bfa2ca7776fd0dc479 /vnf-sdk-function-test/src/test
parent1b3e6286ab22c5a807e590e5d8188e5b34ae650d (diff)
Remove zip file
Resolved:VNFSDK-21 Function test base code Change-Id: Ib870745e42448ec7e3925d0ef9bac5489b03273d Signed-off-by: Murali-P <murali.p@huawei.com>
Diffstat (limited to 'vnf-sdk-function-test/src/test')
-rw-r--r--vnf-sdk-function-test/src/test/java/org/openo/vnfsdk/functest/resource/CommonManagerTest.java13
-rw-r--r--vnf-sdk-function-test/src/test/java/org/openo/vnfsdk/functests/FileUtilTest.java8
-rw-r--r--vnf-sdk-function-test/src/test/resources/RobotScript.zipbin970 -> 0 bytes
-rw-r--r--vnf-sdk-function-test/src/test/resources/RobotScript/config.args13
-rw-r--r--vnf-sdk-function-test/src/test/resources/RobotScript/main.robot31
5 files changed, 56 insertions, 9 deletions
diff --git a/vnf-sdk-function-test/src/test/java/org/openo/vnfsdk/functest/resource/CommonManagerTest.java b/vnf-sdk-function-test/src/test/java/org/openo/vnfsdk/functest/resource/CommonManagerTest.java
index 99fced0..5bda1ec 100644
--- a/vnf-sdk-function-test/src/test/java/org/openo/vnfsdk/functest/resource/CommonManagerTest.java
+++ b/vnf-sdk-function-test/src/test/java/org/openo/vnfsdk/functest/resource/CommonManagerTest.java
@@ -21,6 +21,7 @@ import static org.junit.Assert.assertNotNull;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
+import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.HashMap;
@@ -31,6 +32,7 @@ import javax.ws.rs.core.Response;
import org.junit.Before;
import org.junit.Test;
import org.openo.vnfsdk.functest.responsehandler.VnfFuncTestResponseHandler;
+import org.openo.vnfsdk.functest.util.ZipCompressor;
public class CommonManagerTest {
@@ -45,7 +47,16 @@ public class CommonManagerTest {
@Test
public void testexecuteFunc() throws FileNotFoundException {
- InputStream mockInputStream = new FileInputStream(new File("src//test//resources//RobotScript.zip"));
+
+ URL url = Thread.currentThread().getContextClassLoader().getResource("RobotScript");
+ String zipFileName = url.getPath() + ".zip";
+ try {
+ new ZipCompressor(zipFileName).compress(url.getPath());
+ } catch(IOException e) {
+
+ }
+
+ InputStream mockInputStream = new FileInputStream(zipFileName);
Response response = commonManger.executeFuncTest(mockInputStream);
instanceId = response.getEntity().toString();
assertNotNull(instanceId);
diff --git a/vnf-sdk-function-test/src/test/java/org/openo/vnfsdk/functests/FileUtilTest.java b/vnf-sdk-function-test/src/test/java/org/openo/vnfsdk/functests/FileUtilTest.java
index 106490d..ba3bd5d 100644
--- a/vnf-sdk-function-test/src/test/java/org/openo/vnfsdk/functests/FileUtilTest.java
+++ b/vnf-sdk-function-test/src/test/java/org/openo/vnfsdk/functests/FileUtilTest.java
@@ -20,8 +20,6 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.File;
-import java.io.IOException;
-import java.util.List;
import org.junit.Test;
import org.openo.vnfsdk.functest.FileUtil;
@@ -49,12 +47,6 @@ public class FileUtilTest {
}
@Test
- public void testUnzip() throws IOException {
- List<String> files = FileUtil.unzip(zipFileName, extractZip);
- assertNotNull(files);
- }
-
- @Test
public void testGetDirectory() {
String[] getDirectories = FileUtil.getDirectory(".");
assertNotNull(getDirectories);
diff --git a/vnf-sdk-function-test/src/test/resources/RobotScript.zip b/vnf-sdk-function-test/src/test/resources/RobotScript.zip
deleted file mode 100644
index 8b7b820..0000000
--- a/vnf-sdk-function-test/src/test/resources/RobotScript.zip
+++ /dev/null
Binary files differ
diff --git a/vnf-sdk-function-test/src/test/resources/RobotScript/config.args b/vnf-sdk-function-test/src/test/resources/RobotScript/config.args
new file mode 100644
index 0000000..4d33049
--- /dev/null
+++ b/vnf-sdk-function-test/src/test/resources/RobotScript/config.args
@@ -0,0 +1,13 @@
+######### System Under Test ####################
+
+--variable SUT:192.168.4.47
+--variable SUT_NAME:SystemUnderTest
+--variable SUT_USERNAME:root
+--variable SUT_PASSWORD:root123
+
+
+
+##########TEST_MACHINE##########################
+
+--variable TEST_MACHINE:192.168.4.83
+
diff --git a/vnf-sdk-function-test/src/test/resources/RobotScript/main.robot b/vnf-sdk-function-test/src/test/resources/RobotScript/main.robot
new file mode 100644
index 0000000..4e5705e
--- /dev/null
+++ b/vnf-sdk-function-test/src/test/resources/RobotScript/main.robot
@@ -0,0 +1,31 @@
+*** Settings ***
+Suite Teardown Close All Connections
+Library String
+Library OperatingSystem
+Library SSHLibrary
+Library BuiltIn
+Library Collections
+
+*** Test Cases ***
+Ping Remote Machine
+ ${PingResult} = Run ping ${SUT} -c 4
+ Should Contain ${PingResult} 4 received
+
+Open SSH Connection to Remote machine
+ Open Connection ${SUT} ${SUT_NAME}
+ Login ${SUT_USERNAME} ${SUT_PASSWORD}
+
+Block ICMP ping from Test machine
+ ${PingResult} = Execute Command iptables -A INPUT -p icmp -s ${TEST_MACHINE} --icmp-type 8 -j DROP
+
+Ping Remote Machine Should Fail
+ ${PingResult} = Run ping ${SUT} -c 4
+ Should Contain ${PingResult} 0 received
+
+UnBlock ICMP ping from Test machine
+ ${PingResult} = Execute Command iptables -D INPUT -p icmp -s ${TEST_MACHINE} --icmp-type 8 -j DROP
+
+Ping Remote Machine Should Now Pass
+ ${PingResult} = Run ping ${SUT} -c 4
+ Should Contain ${PingResult} 4 received
+