summaryrefslogtreecommitdiffstats
path: root/test/test_papi.py
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2017-10-20 13:28:20 +0200
committerDave Wallace <dwallacelf@gmail.com>2017-10-25 17:16:56 +0000
commit895b6e8b4408108a9b5cea99dcb378c3524b18b2 (patch)
treee9100c39d04dfa65469e8c9895c8e3d1fe44c394 /test/test_papi.py
parent5f3fcb96296a4769f55f60270e10c6294c604db9 (diff)
VPP-1033: Python API support arbitrary sized input parameters.
Dynamically calculate the required buffer size to pack into based on message definition. Also add input parameter length checking. Change-Id: I7633bec596e4833bb328fbf63a65b866c7985de5 Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'test/test_papi.py')
-rw-r--r--test/test_papi.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/test_papi.py b/test/test_papi.py
new file mode 100644
index 00000000000..1a5f6ae63e4
--- /dev/null
+++ b/test/test_papi.py
@@ -0,0 +1,31 @@
+import binascii
+from framework import VppTestCase
+
+""" TestPAPI is a subclass of VPPTestCase classes.
+
+Basic test for sanity check of the Python API binding.
+
+"""
+
+
+class TestPAPI(VppTestCase):
+ """ PAPI Test Case """
+
+ @classmethod
+ def setUpClass(cls):
+ super(TestPAPI, cls).setUpClass()
+ cls.v = cls.vapi.papi
+
+ def test_show_version(self):
+ rv = self.v.show_version()
+ self.assertEqual(rv.retval, 0)
+
+ def test_show_version_invalid_param(self):
+ self.assertRaises(ValueError, self.v.show_version, foobar='foo')
+
+ def test_u8_array(self):
+ rv = self.v.get_node_index(node_name='ip4-lookup')
+ self.assertEqual(rv.retval, 0)
+ node_name = 'X' * 100
+ self.assertRaises(ValueError, self.v.get_node_index,
+ node_name=node_name)