blob: 81a8f48c290bf4cc195ef554ad0afc3ee55c4e3c [file] [log] [blame]
Ole Troan895b6e82017-10-20 13:28:20 +02001import binascii
2from framework import VppTestCase
Ole Troanca3b6f12017-10-31 14:50:13 +01003from vpp_papi import VPP
Ole Troana5ee9002018-06-12 21:06:44 +02004from socket import inet_pton, AF_INET, AF_INET6
5
Ole Troanca3b6f12017-10-31 14:50:13 +01006import json
Ole Troan895b6e82017-10-20 13:28:20 +02007
8""" TestPAPI is a subclass of VPPTestCase classes.
9
10Basic test for sanity check of the Python API binding.
11
12"""
13
14
15class TestPAPI(VppTestCase):
16 """ PAPI Test Case """
17
18 @classmethod
19 def setUpClass(cls):
20 super(TestPAPI, cls).setUpClass()
21 cls.v = cls.vapi.papi
22
23 def test_show_version(self):
Ole Troan034e0552017-12-14 11:28:21 +010024 """ show version """
Ole Troan895b6e82017-10-20 13:28:20 +020025 rv = self.v.show_version()
26 self.assertEqual(rv.retval, 0)
27
28 def test_show_version_invalid_param(self):
Ole Troan034e0552017-12-14 11:28:21 +010029 """ show version - invalid parameters"""
Ole Troan895b6e82017-10-20 13:28:20 +020030 self.assertRaises(ValueError, self.v.show_version, foobar='foo')
31
32 def test_u8_array(self):
Ole Troan034e0552017-12-14 11:28:21 +010033 """ u8 array """
Ole Troan895b6e82017-10-20 13:28:20 +020034 rv = self.v.get_node_index(node_name='ip4-lookup')
35 self.assertEqual(rv.retval, 0)
36 node_name = 'X' * 100
37 self.assertRaises(ValueError, self.v.get_node_index,
38 node_name=node_name)