VPP-1033: Python API support arbitrary sized input parameters.
[vpp.git] / test / test_papi.py
1 import binascii
2 from framework import VppTestCase
3
4 """ TestPAPI is a subclass of  VPPTestCase classes.
5
6 Basic test for sanity check of the Python API binding.
7
8 """
9
10
11 class TestPAPI(VppTestCase):
12     """ PAPI Test Case """
13
14     @classmethod
15     def setUpClass(cls):
16         super(TestPAPI, cls).setUpClass()
17         cls.v = cls.vapi.papi
18
19     def test_show_version(self):
20         rv = self.v.show_version()
21         self.assertEqual(rv.retval, 0)
22
23     def test_show_version_invalid_param(self):
24         self.assertRaises(ValueError, self.v.show_version, foobar='foo')
25
26     def test_u8_array(self):
27         rv = self.v.get_node_index(node_name='ip4-lookup')
28         self.assertEqual(rv.retval, 0)
29         node_name = 'X' * 100
30         self.assertRaises(ValueError, self.v.get_node_index,
31                           node_name=node_name)