aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMatej Perina <mperina@cisco.com>2017-07-18 13:59:41 +0200
committerFlorin Coras <florin.coras@gmail.com>2017-08-25 16:26:17 +0000
commitd135c19a1fde609b82be5a30413d6b9ab43811e3 (patch)
tree9d91f9cd63579bbb72611cc288912ea8ae0319f5 /test
parentacdc306093aaea2633cf765307d6cb7c1b80081c (diff)
jvpp: introducing callback api and future api tests for all plugins (VPP-591)
test can be run with: make test TEST=test_jvpp memory_shared.c: declaring and assigning variable in if statement makes it usage outside statement impossible. Looks like memory space assigned to variable declared in statement is freed when statement ends svm.c: - fixed case when root path can have a "/" at beggining - added option for test to operate over shared memory space with /vpe-api name and not create new one with name consisting of root path and region name which would require root permisions Change-Id: Iff1170dc6a5c1be134c152f2757c7ab9b919a8ed Signed-off-by: Matej Perina <mperina@cisco.com>
Diffstat (limited to 'test')
-rw-r--r--test/jvpp_connection.py54
-rw-r--r--test/test_jvpp.py82
2 files changed, 136 insertions, 0 deletions
diff --git a/test/jvpp_connection.py b/test/jvpp_connection.py
new file mode 100644
index 00000000000..bb48745c34c
--- /dev/null
+++ b/test/jvpp_connection.py
@@ -0,0 +1,54 @@
+#!/usr/bin/env python
+import os
+import subprocess
+from vpp_papi_provider import VppPapiProvider
+from threading import Timer
+
+from framework import VppTestCase
+
+# Api files path
+API_FILES_PATH = "vpp/vpp-api/java"
+
+# Registry jar file name prefix
+REGISTRY_JAR_PREFIX = "jvpp-registry"
+
+
+class TestJVppConnection(VppTestCase):
+
+ def full_jar_name(self, install_dir, jar_name, version):
+ return os.path.join(install_dir, API_FILES_PATH,
+ "{0}-{1}.jar".format(jar_name, version))
+
+ def jvpp_connection_test(self, api_jar_name, test_class_name, timeout):
+ install_dir = os.getenv('VPP_TEST_BUILD_DIR')
+ print("Install directory : {0}".format(install_dir))
+
+ version_reply = self.vapi.show_version()
+ version = version_reply.version.split("-")[0]
+ registry_jar_path = self.full_jar_name(install_dir,
+ REGISTRY_JAR_PREFIX, version)
+ print("JVpp Registry jar path : {0}".format(registry_jar_path))
+
+ api_jar_path = self.full_jar_name(install_dir, api_jar_name, version)
+ print("Api jar path : {0}".format(api_jar_path))
+
+ # passes shm prefix as parameter to create connection with same value
+ command = ["java", "-cp",
+ "{0}:{1}".format(registry_jar_path, api_jar_path),
+ test_class_name, "/{0}-vpe-api".format(self.shm_prefix)]
+ print("Test Command : {0}, Timeout : {1}".format(command, timeout))
+
+ self.process = subprocess.Popen(command, shell=False,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE, bufsize=1,
+ universal_newlines=True)
+
+ out, err = self.process.communicate()
+ print("Process output : {0}{1}".format(os.linesep, out))
+ print("Process error output : {0}{1}".format(os.linesep, err))
+ self.assert_equal(self.process.returncode, 0, "process return code")
+
+ def tearDown(self):
+ print("Tearing down jvpp test")
+ if self.process.poll() is None:
+ self.process.kill()
diff --git a/test/test_jvpp.py b/test/test_jvpp.py
new file mode 100644
index 00000000000..664ed2f97ce
--- /dev/null
+++ b/test/test_jvpp.py
@@ -0,0 +1,82 @@
+from jvpp_connection import TestJVppConnection
+
+
+class TestJVpp(TestJVppConnection):
+ """ JVPP Core Test Case """
+
+ def invoke_for_jvpp_core(self, api_jar_name, test_class_name):
+ self.jvpp_connection_test(api_jar_name=api_jar_name,
+ test_class_name=test_class_name,
+ timeout=10)
+
+ def test_vpp_core_callback_api(self):
+ """ JVPP Core Callback Api Test Case """
+ self.invoke_for_jvpp_core(api_jar_name="jvpp-core",
+ test_class_name="io.fd.vpp.jvpp.core.test."
+ "CallbackApiTest")
+
+ def test_vpp_core_future_api(self):
+ """JVPP Core Future Api Test Case"""
+ self.invoke_for_jvpp_core(api_jar_name="jvpp-core",
+ test_class_name="io.fd.vpp.jvpp.core.test."
+ "FutureApiTest")
+
+ def test_vpp_acl_callback_api(self):
+ """ JVPP Acl Callback Api Test Case """
+ self.invoke_for_jvpp_core(api_jar_name="jvpp-acl",
+ test_class_name="io.fd.vpp.jvpp.acl.test."
+ "CallbackApiTest")
+
+ def test_vpp_acl_future_api(self):
+ """JVPP Acl Future Api Test Case"""
+ self.invoke_for_jvpp_core(api_jar_name="jvpp-acl",
+ test_class_name="io.fd.vpp.jvpp.acl.test."
+ "FutureApiTest")
+
+ def test_vpp_ioamexport_callback_api(self):
+ """ JVPP Ioamexport Callback Api Test Case """
+ self.invoke_for_jvpp_core(api_jar_name="jvpp-ioamexport",
+ test_class_name="io.fd.vpp.jvpp.ioamexport."
+ "test.CallbackApiTest")
+
+ def test_vpp_ioamexport_future_api(self):
+ """JVPP Ioamexport Future Api Test Case"""
+ self.invoke_for_jvpp_core(api_jar_name="jvpp-ioamexport",
+ test_class_name="io.fd.vpp.jvpp.ioamexport."
+ "test.FutureApiTest")
+
+ def test_vpp_ioampot_callback_api(self):
+ """ JVPP Ioampot Callback Api Test Case """
+ self.invoke_for_jvpp_core(api_jar_name="jvpp-ioampot",
+ test_class_name="io.fd.vpp.jvpp.ioampot."
+ "test.CallbackApiTest")
+
+ def test_vpp_ioampot_future_api(self):
+ """JVPP Ioampot Future Api Test Case"""
+ self.invoke_for_jvpp_core(api_jar_name="jvpp-ioampot",
+ test_class_name="io.fd.vpp.jvpp.ioampot."
+ "test.FutureApiTest")
+
+ def test_vpp_ioamtrace_callback_api(self):
+ """ JVPP Ioamtrace Callback Api Test Case """
+ self.invoke_for_jvpp_core(api_jar_name="jvpp-ioamtrace",
+ test_class_name="io.fd.vpp.jvpp.ioamtrace."
+ "test.CallbackApiTest")
+
+ def test_vpp_ioamtrace_future_api(self):
+ """JVPP Ioamtrace Future Api Test Case"""
+ self.invoke_for_jvpp_core(api_jar_name="jvpp-ioamtrace",
+ test_class_name="io.fd.vpp.jvpp.ioamtrace."
+ "test.FutureApiTest")
+
+ def test_vpp_snat_callback_api(self):
+ """ JVPP Snat Callback Api Test Case """
+ self.invoke_for_jvpp_core(api_jar_name="jvpp-nat",
+ test_class_name="io.fd.vpp.jvpp.nat.test."
+ "CallbackApiTest")
+
+ def test_vpp_snat_future_api(self):
+ """JVPP Snat Future Api Test Case"""
+ self.invoke_for_jvpp_core(api_jar_name="jvpp-nat",
+ test_class_name="io.fd.vpp.jvpp.nat.test."
+ "FutureApiTest")