[Fuego] [PATCH] Add test cases of service openvpn.

Wang Mingyu wangmy at cn.fujitsu.com
Wed Nov 14 09:30:22 UTC 2018


This test set is used to check if the service openvpn can be started.
And check the process file, syslog file, tap0 can be created or not.

Signed-off-by: Wang Mingyu <wangmy at cn.fujitsu.com>
---
 .../tests/Functional.openvpn/data/host-target.key  | 22 +++++++++
 engine/tests/Functional.openvpn/data/testcli.conf  |  7 +++
 engine/tests/Functional.openvpn/data/testenv.sh    | 18 +++++++
 engine/tests/Functional.openvpn/data/testsrv.conf  | 16 +++++++
 engine/tests/Functional.openvpn/fuego_test.sh      | 19 ++++++++
 engine/tests/Functional.openvpn/openvpn_test.sh    |  4 ++
 engine/tests/Functional.openvpn/parser.py          | 22 +++++++++
 engine/tests/Functional.openvpn/spec.json          |  7 +++
 .../Functional.openvpn/tests/openvpn_genkey.sh     | 15 ++++++
 .../tests/openvpn_lport_client.sh                  | 54 +++++++++++++++++++++
 .../tests/openvpn_lport_server.sh                  | 53 +++++++++++++++++++++
 .../Functional.openvpn/tests/openvpn_pid_client.sh | 52 ++++++++++++++++++++
 .../Functional.openvpn/tests/openvpn_pid_server.sh | 52 ++++++++++++++++++++
 .../Functional.openvpn/tests/openvpn_ps_client.sh  | 55 ++++++++++++++++++++++
 .../Functional.openvpn/tests/openvpn_ps_server.sh  | 55 ++++++++++++++++++++++
 .../tests/openvpn_syslog-ng_client.sh              | 52 ++++++++++++++++++++
 .../tests/openvpn_syslog-ng_server.sh              | 52 ++++++++++++++++++++
 .../Functional.openvpn/tests/openvpn_tun_client.sh | 44 +++++++++++++++++
 .../Functional.openvpn/tests/openvpn_tun_server.sh | 44 +++++++++++++++++
 19 files changed, 643 insertions(+)
 create mode 100644 engine/tests/Functional.openvpn/data/host-target.key
 create mode 100644 engine/tests/Functional.openvpn/data/testcli.conf
 create mode 100644 engine/tests/Functional.openvpn/data/testenv.sh
 create mode 100644 engine/tests/Functional.openvpn/data/testsrv.conf
 create mode 100644 engine/tests/Functional.openvpn/fuego_test.sh
 create mode 100755 engine/tests/Functional.openvpn/openvpn_test.sh
 create mode 100644 engine/tests/Functional.openvpn/parser.py
 create mode 100644 engine/tests/Functional.openvpn/spec.json
 create mode 100644 engine/tests/Functional.openvpn/tests/openvpn_genkey.sh
 create mode 100644 engine/tests/Functional.openvpn/tests/openvpn_lport_client.sh
 create mode 100644 engine/tests/Functional.openvpn/tests/openvpn_lport_server.sh
 create mode 100644 engine/tests/Functional.openvpn/tests/openvpn_pid_client.sh
 create mode 100644 engine/tests/Functional.openvpn/tests/openvpn_pid_server.sh
 create mode 100644 engine/tests/Functional.openvpn/tests/openvpn_ps_client.sh
 create mode 100644 engine/tests/Functional.openvpn/tests/openvpn_ps_server.sh
 create mode 100644 engine/tests/Functional.openvpn/tests/openvpn_syslog-ng_client.sh
 create mode 100644 engine/tests/Functional.openvpn/tests/openvpn_syslog-ng_server.sh
 create mode 100644 engine/tests/Functional.openvpn/tests/openvpn_tun_client.sh
 create mode 100644 engine/tests/Functional.openvpn/tests/openvpn_tun_server.sh

diff --git a/engine/tests/Functional.openvpn/data/host-target.key b/engine/tests/Functional.openvpn/data/host-target.key
new file mode 100644
index 0000000..99743bf
--- /dev/null
+++ b/engine/tests/Functional.openvpn/data/host-target.key
@@ -0,0 +1,22 @@
+#
+# 2048 bit OpenVPN static key
+#
+-----BEGIN OpenVPN Static key V1-----
+debe9557c7eb224c5cf4f3369d5211ff
+fb9c375a4784759edf6b0f6eb8f5da31
+bb280394d40382cc8e02d6cbb3e47492
+3509eac6b48965078e3d317b0791dea2
+dbcf0eddcab0fb20780fcf0908ce94cd
+7cb65a913fea73ac6bfe0ab34f085aa3
+a6c8b89a97d189e5145c3199955c4b34
+6d51f864f2b49f3252d1548c3b3510ec
+0ecd4b9f17f2039439a79f41a46f6a54
+c0385b962b2b94fcbe73e0108b224a5b
+2efae27d872f0efef67b244c7eb6f525
+581e4c2b4e6aa193fb1d37798bdb46ff
+7c6727f08e9601c10ac7478d73d731e6
+f4b652252f3e5309cd1d6d30c7a433cc
+134bd6dd50fa6a6fc7a843fdc058d38d
+fb8679b48eb09745badf004fbf4a434c
+-----END OpenVPN Static key V1-----
+
diff --git a/engine/tests/Functional.openvpn/data/testcli.conf b/engine/tests/Functional.openvpn/data/testcli.conf
new file mode 100644
index 0000000..2c252bb
--- /dev/null
+++ b/engine/tests/Functional.openvpn/data/testcli.conf
@@ -0,0 +1,7 @@
+remote  192.168.0.1
+port    5000
+dev     tap
+#dev    tun
+verb    3
+ping    60
+
diff --git a/engine/tests/Functional.openvpn/data/testenv.sh b/engine/tests/Functional.openvpn/data/testenv.sh
new file mode 100644
index 0000000..8c01d58
--- /dev/null
+++ b/engine/tests/Functional.openvpn/data/testenv.sh
@@ -0,0 +1,18 @@
+#set the variable
+if [ "$init_manager" == "systemd" ]
+then
+        service_name="openvpn at loopback-server.service"
+        config_file="/etc/openvpn/loopback-server.conf"
+        pid_file="/var/run/openvpn/loopback-server.pid"
+else
+        service_name="openvpn"
+        if [ "$test_type" == "client" ]
+        then
+                config_file="/etc/openvpn/testcli.conf"
+                pid_file="/var/run/openvpn.testcli.pid"
+        elif [ "$test_type" == "server" ]
+        then
+                config_file="/etc/openvpn/testsrv.conf"
+                pid_file="/var/run/openvpn.testsrv.pid"
+        fi
+fi
diff --git a/engine/tests/Functional.openvpn/data/testsrv.conf b/engine/tests/Functional.openvpn/data/testsrv.conf
new file mode 100644
index 0000000..0c18a40
--- /dev/null
+++ b/engine/tests/Functional.openvpn/data/testsrv.conf
@@ -0,0 +1,16 @@
+#
+proto           udp
+port            5000
+
+dev             tap
+
+secret          /etc/openvpn/host-target.key
+#link-mtu       1200
+
+ping            10
+ping-restart    60
+ping-timer-rem
+persist-key
+persist-tun
+verb            3
+
diff --git a/engine/tests/Functional.openvpn/fuego_test.sh b/engine/tests/Functional.openvpn/fuego_test.sh
new file mode 100644
index 0000000..257fc16
--- /dev/null
+++ b/engine/tests/Functional.openvpn/fuego_test.sh
@@ -0,0 +1,19 @@
+function test_pre_check {
+    assert_has_program openvpn
+}
+
+function test_deploy {
+    put $TEST_HOME/openvpn_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put $FUEGO_CORE/engine/scripts/fuego_board_function_lib.sh $BOARD_TESTDIR/fuego.$TESTDIR
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/data $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./openvpn_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
diff --git a/engine/tests/Functional.openvpn/openvpn_test.sh b/engine/tests/Functional.openvpn/openvpn_test.sh
new file mode 100755
index 0000000..dd5ce37
--- /dev/null
+++ b/engine/tests/Functional.openvpn/openvpn_test.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
diff --git a/engine/tests/Functional.openvpn/parser.py b/engine/tests/Functional.openvpn/parser.py
new file mode 100644
index 0000000..d85abd7
--- /dev/null
+++ b/engine/tests/Functional.openvpn/parser.py
@@ -0,0 +1,22 @@
+#!/usr/bin/python
+# See common.py for description of command-line arguments
+
+import os, sys, collections
+
+sys.path.insert(0, os.environ['FUEGO_CORE'] + '/engine/scripts/parser')
+import common as plib
+
+measurements = {}
+measurements = collections.OrderedDict()
+
+regex_string = '^ -> (.*): TEST-(.*)$'
+matches = plib.parse_log(regex_string)
+
+if matches:
+    for m in matches:
+        measurements['default.' + m[0]] = 'PASS' if m[1] == 'PASS' else 'FAIL'
+
+# split the output for each testcase
+plib.split_output_per_testcase(regex_string, measurements)
+
+sys.exit(plib.process(measurements))
diff --git a/engine/tests/Functional.openvpn/spec.json b/engine/tests/Functional.openvpn/spec.json
new file mode 100644
index 0000000..4bd7ecb
--- /dev/null
+++ b/engine/tests/Functional.openvpn/spec.json
@@ -0,0 +1,7 @@
+{
+    "testName": "Functional.openvpn",
+    "specs": {
+        "default": {}
+    }
+}
+
diff --git a/engine/tests/Functional.openvpn/tests/openvpn_genkey.sh b/engine/tests/Functional.openvpn/tests/openvpn_genkey.sh
new file mode 100644
index 0000000..d951589
--- /dev/null
+++ b/engine/tests/Functional.openvpn/tests/openvpn_genkey.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In target, run command openvpn.
+#  option: --genkey
+
+test="genkey"
+
+openvpn --genkey --secret /etc/openvpn/host-target.key
+if ls /etc/openvpn/host-target.key
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -f /etc/openvpn/host-target.key
diff --git a/engine/tests/Functional.openvpn/tests/openvpn_lport_client.sh b/engine/tests/Functional.openvpn/tests/openvpn_lport_client.sh
new file mode 100644
index 0000000..483b24a
--- /dev/null
+++ b/engine/tests/Functional.openvpn/tests/openvpn_lport_client.sh
@@ -0,0 +1,54 @@
+#!/bin/sh
+
+#  In the target, run openvpn and check the Listening port.
+
+test="lport_client"
+
+test_type="client"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+. data/testenv.sh
+
+exec_service_on_target $service_name stop
+if [ ! -f $config_file ]
+then
+    touch $config_file
+fi
+
+mv $config_file $config_file"_bak"
+cp data/testcli.conf $config_file
+cp data/host-target.key /etc/openvpn/host-target.key
+
+mkdir -m 755 /dev/net
+mknod /dev/net/tun c 10 200
+
+restore_target() {
+    rm -fr /dev/net
+    mv $config_file"_bak" $config_file
+    rm -r /etc/openvpn/host-target.key
+    modprobe -r tun
+}
+
+if exec_service_on_target $service_name start
+then
+    echo " -> $test: service start succeeded."
+else
+    echo " -> $test: service start failed."
+    echo " -> $test: TEST-FAIL"
+    restore_target
+    exit
+fi
+
+sleep 5
+
+if netstat -ln | grep ":5000"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+exec_service_on_target $service_name stop
+restore_target
diff --git a/engine/tests/Functional.openvpn/tests/openvpn_lport_server.sh b/engine/tests/Functional.openvpn/tests/openvpn_lport_server.sh
new file mode 100644
index 0000000..dde8655
--- /dev/null
+++ b/engine/tests/Functional.openvpn/tests/openvpn_lport_server.sh
@@ -0,0 +1,53 @@
+#!/bin/sh
+
+#  In the target, run openvpn and check the Listening port.
+
+test="lport_server"
+
+test_type="server"
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+. data/testenv.sh
+
+if [ ! -f $config_file ]
+then
+    touch $config_file
+fi
+
+mv $config_file $config_file"_bak"
+cp data/testsrv.conf $config_file
+cp data/host-target.key /etc/openvpn/host-target.key
+
+mkdir -m 755 /dev/net
+mknod /dev/net/tun c 10 200
+
+restore_target() {
+    rm -fr /dev/net
+    mv $config_file"_bak" $config_file
+    rm -r /etc/openvpn/host-target.key
+    modprobe -r tun
+}
+
+if exec_service_on_target $service_name start
+then
+    echo " -> $test: service start succeeded."
+else
+    echo " -> $test: service start failed."
+    echo " -> $test: TEST-FAIL"
+    restore_target
+    exit
+fi
+
+sleep 5
+
+if netstat -ln | grep ":5000"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+exec_service_on_target $service_name stop
+restore_target
diff --git a/engine/tests/Functional.openvpn/tests/openvpn_pid_client.sh b/engine/tests/Functional.openvpn/tests/openvpn_pid_client.sh
new file mode 100644
index 0000000..72a6bab
--- /dev/null
+++ b/engine/tests/Functional.openvpn/tests/openvpn_pid_client.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+#  In the target, run openvpn and check the pidfile.
+
+test="pid_client"
+
+test_type="client"
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+. data/testenv.sh
+
+exec_service_on_target $service_name stop
+if [ ! -f $config_file ]
+then
+    touch $config_file
+fi
+
+mv $config_file $config_file"_bak"
+cp data/testcli.conf $config_file
+cp data/host-target.key /etc/openvpn/host-target.key
+
+mkdir -m 755 /dev/net
+mknod /dev/net/tun c 10 200
+
+restore_target() {
+    rm -fr /dev/net
+    mv $config_file"_bak" $config_file
+    rm -r /etc/openvpn/host-target.key
+    modprobe -r tun
+}
+
+if exec_service_on_target $service_name start
+then
+    echo " -> $test: service start succeeded."
+else
+    echo " -> $test: service start failed."
+    echo " -> $test: TEST-FAIL"
+    restore_target
+    exit
+fi
+
+if ls $pid_file
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+exec_service_on_target $service_name stop
+restore_target
diff --git a/engine/tests/Functional.openvpn/tests/openvpn_pid_server.sh b/engine/tests/Functional.openvpn/tests/openvpn_pid_server.sh
new file mode 100644
index 0000000..20dfb3b
--- /dev/null
+++ b/engine/tests/Functional.openvpn/tests/openvpn_pid_server.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+#  In the target, run openvpn and check the pidfile.
+
+test="pid_server"
+
+test_type="server"
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+. data/testenv.sh
+
+exec_service_on_target $service_name stop
+if [ ! -f $config_file ]
+then
+    touch $config_file
+fi
+
+mv $config_file $config_file"_bak"
+cp data/testsrv.conf $config_file
+cp data/host-target.key /etc/openvpn/host-target.key
+
+mkdir -m 755 /dev/net
+mknod /dev/net/tun c 10 200
+
+restore_target() {
+    rm -fr /dev/net
+    mv $config_file"_bak" $config_file
+    rm -r /etc/openvpn/host-target.key
+    modprobe -r tun
+}
+
+if exec_service_on_target $service_name start
+then
+    echo " -> $test: service start succeeded."
+else
+    echo " -> $test: service start failed."
+    echo " -> $test: TEST-FAIL"
+    restore_target
+    exit
+fi
+
+if ls $pid_file
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+exec_service_on_target $service_name stop
+restore_target
diff --git a/engine/tests/Functional.openvpn/tests/openvpn_ps_client.sh b/engine/tests/Functional.openvpn/tests/openvpn_ps_client.sh
new file mode 100644
index 0000000..ffaee79
--- /dev/null
+++ b/engine/tests/Functional.openvpn/tests/openvpn_ps_client.sh
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+#  In the target, run openvpn and check the status of process.
+
+test="ps_client"
+
+test_type="client"
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+. data/testenv.sh
+
+exec_service_on_target $service_name stop
+if [ ! -f $config_file ]
+then
+    touch $config_file
+fi
+
+mv $config_file $config_file"_bak"
+cp data/testcli.conf $config_file
+cp data/host-target.key /etc/openvpn/host-target.key
+
+mkdir -m 755 /dev/net
+mknod /dev/net/tun c 10 200
+
+restore_target() {
+    rm -fr /dev/net
+    mv $config_file"_bak" $config_file
+    rm -r /etc/openvpn/host-target.key
+    modprobe -r tun
+}
+
+exec_service_on_target $service_name start
+
+if ps aux | grep "[/]usr/sbin/openvpn"
+then
+    echo " -> $test: get the process of openvpn succeeded."
+else
+    echo " -> $test: get the process of openvpn failed."
+    echo " -> $test: TEST-FAIL"
+    exec_service_on_target $service_name stop
+    restore_target
+    exit
+fi
+
+exec_service_on_target $service_name stop
+
+if ! ps aux | grep "[/]usr/sbin/openvpn"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+restore_target
diff --git a/engine/tests/Functional.openvpn/tests/openvpn_ps_server.sh b/engine/tests/Functional.openvpn/tests/openvpn_ps_server.sh
new file mode 100644
index 0000000..333a24d
--- /dev/null
+++ b/engine/tests/Functional.openvpn/tests/openvpn_ps_server.sh
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+#  In the target, run openvpn and check the status of process.
+
+test="ps_server"
+
+test_type="server"
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+. data/testenv.sh
+
+exec_service_on_target $service_name stop
+if [ ! -f $config_file ]
+then
+    touch $config_file
+fi
+
+mv $config_file $config_file"_bak"
+cp data/testsrv.conf $config_file
+cp data/host-target.key /etc/openvpn/host-target.key
+
+mkdir -m 755 /dev/net
+mknod /dev/net/tun c 10 200
+
+restore_target() {
+    rm -fr /dev/net
+    mv $config_file"_bak" $config_file
+    rm -r /etc/openvpn/host-target.key
+    modprobe -r tun
+}
+
+exec_service_on_target $service_name start
+
+if ps aux | grep "[/]usr/sbin/openvpn"
+then
+    echo " -> $test: get the process of openvpn succeeded."
+else
+    echo " -> $test: get the process of openvpn failed."
+    echo " -> $test: TEST-FAIL"
+    exec_service_on_target $service_name stop
+    restore_target
+    exit
+fi
+
+exec_service_on_target $service_name stop
+
+if ! ps aux | grep "[/]usr/sbin/openvpn"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+restore_target
diff --git a/engine/tests/Functional.openvpn/tests/openvpn_syslog-ng_client.sh b/engine/tests/Functional.openvpn/tests/openvpn_syslog-ng_client.sh
new file mode 100644
index 0000000..344c97e
--- /dev/null
+++ b/engine/tests/Functional.openvpn/tests/openvpn_syslog-ng_client.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+#  In the target, run openvpn and check the message of syslog-ng.
+
+test="syslog-ng_client"
+
+test_type="client"
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+. data/testenv.sh
+
+exec_service_on_target $service_name stop
+rm -f /var/log/syslog
+if [ -e /var/run/syslog-ng.pid ]
+then
+    exec_service_on_target syslog-ng stop
+fi
+
+exec_service_on_target syslog-ng restart
+
+if [ ! -f $config_file ]
+then
+    touch $config_file
+fi
+
+mv $config_file $config_file"_bak"
+cp data/testcli.conf $config_file
+cp data/host-target.key /etc/openvpn/host-target.key
+
+mkdir -m 755 /dev/net
+mknod /dev/net/tun c 10 200
+
+exec_service_on_target $service_name start
+
+if cat /var/log/syslog | grep OpenVPN
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+exec_service_on_target $service_name stop
+
+rm -fr /dev/net
+
+mv $config_file"_bak" $config_file
+
+rm -r /etc/openvpn/host-target.key
+
+modprobe -r tun
diff --git a/engine/tests/Functional.openvpn/tests/openvpn_syslog-ng_server.sh b/engine/tests/Functional.openvpn/tests/openvpn_syslog-ng_server.sh
new file mode 100644
index 0000000..f337449
--- /dev/null
+++ b/engine/tests/Functional.openvpn/tests/openvpn_syslog-ng_server.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+#  In the target, run openvpn and check the message of syslog-ng.
+
+test="syslog-ng_server"
+
+test_type="server"
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+. data/testenv.sh
+
+exec_service_on_target $service_name stop
+rm -f /var/log/syslog
+if [ -e /var/run/syslog-ng.pid ]
+then
+    exec_service_on_target syslog-ng stop
+fi
+
+exec_service_on_target syslog-ng restart
+
+if [ ! -f $config_file ]
+then
+    touch $config_file
+fi
+
+mv $config_file $config_file"_bak"
+cp data/testsrv.conf $config_file
+cp data/host-target.key /etc/openvpn/host-target.key
+
+mkdir -m 755 /dev/net
+mknod /dev/net/tun c 10 200
+
+exec_service_on_target $service_name start
+
+if cat /var/log/syslog | grep OpenVPN
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+exec_service_on_target $service_name stop
+
+rm -fr /dev/net
+
+mv $config_file"_bak" $config_file
+
+rm -r /etc/openvpn/host-target.key
+
+modprobe -r tun
diff --git a/engine/tests/Functional.openvpn/tests/openvpn_tun_client.sh b/engine/tests/Functional.openvpn/tests/openvpn_tun_client.sh
new file mode 100644
index 0000000..798aa6a
--- /dev/null
+++ b/engine/tests/Functional.openvpn/tests/openvpn_tun_client.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+# Verify the creation of the tun device (tap0) interface by openvpn.
+
+test="tun_client"
+
+test_type="client"
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+. data/testenv.sh
+
+exec_service_on_target $service_name stop
+if [ ! -f $config_file ]
+then
+    touch $config_file
+fi
+
+mv $config_file $config_file"_bak"
+cp data/testcli.conf $config_file
+cp data/host-target.key /etc/openvpn/host-target.key
+
+mkdir -m 755 /dev/net
+mknod /dev/net/tun c 10 200
+
+exec_service_on_target $service_name start
+
+if ifconfig tap0
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+exec_service_on_target $service_name stop
+
+rm -fr /dev/net
+
+mv $config_file"_bak" $config_file
+
+rm -r /etc/openvpn/host-target.key
+
+modprobe -r tun
diff --git a/engine/tests/Functional.openvpn/tests/openvpn_tun_server.sh b/engine/tests/Functional.openvpn/tests/openvpn_tun_server.sh
new file mode 100644
index 0000000..6849501
--- /dev/null
+++ b/engine/tests/Functional.openvpn/tests/openvpn_tun_server.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+# Verify the creation of the tun device (tap0) interface by openvpn.
+
+test="tun_server"
+
+test_type="server"
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+. data/testenv.sh
+
+exec_service_on_target $service_name stop
+if [ ! -f $config_file ]
+then
+    touch $config_file
+fi
+
+mv $config_file $config_file"_bak"
+cp data/testsrv.conf $config_file
+cp data/host-target.key /etc/openvpn/host-target.key
+
+mkdir -m 755 /dev/net
+mknod /dev/net/tun c 10 200
+
+exec_service_on_target $service_name start
+
+if ifconfig tap0
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+exec_service_on_target $service_name stop
+
+rm -fr /dev/net
+
+mv $config_file"_bak" $config_file
+
+rm -r /etc/openvpn/host-target.key
+
+modprobe -r tun
-- 
1.8.3.1





More information about the Fuego mailing list