summaryrefslogtreecommitdiffstats
path: root/vpp-api/python/tests
diff options
context:
space:
mode:
Diffstat (limited to 'vpp-api/python/tests')
-rw-r--r--vpp-api/python/tests/test_base.py7
-rwxr-xr-xvpp-api/python/tests/test_modules.py2
-rwxr-xr-xvpp-api/python/tests/test_papi.py13
-rwxr-xr-xvpp-api/python/tests/test_version.py35
4 files changed, 40 insertions, 17 deletions
diff --git a/vpp-api/python/tests/test_base.py b/vpp-api/python/tests/test_base.py
deleted file mode 100644
index 8ff5dd4782c..00000000000
--- a/vpp-api/python/tests/test_base.py
+++ /dev/null
@@ -1,7 +0,0 @@
-# Manipulate sys.path to allow tests be run inside the build environment.
-import os, sys, glob
-scriptdir = os.path.dirname(os.path.realpath(__file__))
-sys.path.append(os.path.dirname(glob.glob(scriptdir+'/../../../build-root/install*/vpp-api/lib64/vpp_api.so')[0]))
-sys.path.append(os.path.dirname(glob.glob(scriptdir+'/../../../build-root/install*/vlib-api/vlibmemory/memclnt.py')[0]))
-sys.path.append(os.path.dirname(glob.glob(scriptdir+'/../../../build-root/install*/vpp/vpp-api/vpe.py')[0]))
-sys.path.append(glob.glob(scriptdir+'/../../../build-root/install*/plugins/vpp_papi_plugins')[0])
diff --git a/vpp-api/python/tests/test_modules.py b/vpp-api/python/tests/test_modules.py
index 48df17559a0..fdcd092c927 100755
--- a/vpp-api/python/tests/test_modules.py
+++ b/vpp-api/python/tests/test_modules.py
@@ -1,7 +1,5 @@
-#!/usr/bin/env python
from __future__ import print_function
import unittest
-import test_base
import vpp_papi
import pot, snat
print('Plugins:')
diff --git a/vpp-api/python/tests/test_papi.py b/vpp-api/python/tests/test_papi.py
index ab90eeaa45c..8cbbfc59e03 100755
--- a/vpp-api/python/tests/test_papi.py
+++ b/vpp-api/python/tests/test_papi.py
@@ -1,13 +1,10 @@
-#!/usr/bin/env python
-
from __future__ import print_function
-import unittest, sys, time, threading, struct, logging
-import test_base
+import unittest, sys, time, threading, struct, logging, os
import vpp_papi
from ipaddress import *
-
+scriptdir = os.path.dirname(os.path.realpath(__file__))
papi_event = threading.Event()
-print(vpp_papi.VL_API_SW_INTERFACE_SET_FLAGS)
+print(vpp_papi.vpe.VL_API_SW_INTERFACE_SET_FLAGS)
def papi_event_handler(result):
if result.vl_msg_id == vpp_papi.vpe.VL_API_SW_INTERFACE_SET_FLAGS:
return
@@ -27,7 +24,7 @@ class TestPAPI(unittest.TestCase):
def setUpClass(cls):
#
# Start main VPP process
- cls.vpp_bin = glob.glob(test_base.scriptdir+'/../../../build-root/install-vpp*-native/vpp/bin/vpp')[0]
+ cls.vpp_bin = glob.glob(scriptdir+'/../../../build-root/install-vpp*-native/vpp/bin/vpp')[0]
print("VPP BIN:", cls.vpp_bin)
cls.vpp = subprocess.Popen([cls.vpp_bin, "unix", "nodaemon"], stderr=subprocess.PIPE)
print('Started VPP')
@@ -89,7 +86,7 @@ class TestPAPI(unittest.TestCase):
self.assertEqual(t.retval, 0)
ifindex = t.sw_if_index
- addr = str(IPv6Address('1::1').packed)
+ addr = str(IPv6Address(u'1::1').packed)
t = vpp_papi.sw_interface_add_del_address(ifindex, 1, 1, 0, 16, addr)
print(t)
self.assertEqual(t.retval, 0)
diff --git a/vpp-api/python/tests/test_version.py b/vpp-api/python/tests/test_version.py
new file mode 100755
index 00000000000..de39cc24ebd
--- /dev/null
+++ b/vpp-api/python/tests/test_version.py
@@ -0,0 +1,35 @@
+from __future__ import print_function
+import unittest, sys, time, threading, struct
+
+import vpp_papi
+from ipaddress import *
+import glob, subprocess
+class TestPAPI(unittest.TestCase):
+ def setUp(self):
+ print("Connecting API")
+ r = vpp_papi.connect("test_papi")
+ self.assertEqual(r, 0)
+
+ def tearDown(self):
+ r = vpp_papi.disconnect()
+ self.assertEqual(r, 0)
+
+ #
+ # The tests themselves
+ #
+
+ #
+ # Basic request / reply
+ #
+ def test_show_version(self):
+ print(vpp_papi.show_version())
+
+ #
+ # Details / Dump
+ #
+ def test_details_dump(self):
+ t = vpp_papi.sw_interface_dump(0, b'')
+ print('Dump/details T', t)
+
+if __name__ == '__main__':
+ unittest.main()