nat: nat44-ed add session timing out indicator in api
[vpp.git] / test / test_bihash.py
1 #!/usr/bin/env python3
2
3 import unittest
4
5 from framework import VppTestCase, VppTestRunner, running_gcov_tests
6 from vpp_ip_route import VppIpTable, VppIpRoute, VppRoutePath
7
8
9 class TestBihash(VppTestCase):
10     """ Bihash Test Cases """
11
12     @classmethod
13     def setUpClass(cls):
14         # increase vapi timeout, to avoid spurious "test bihash ..."
15         # failures reported on aarch64 w/ test-debug
16         cls.vapi_response_timeout = 20
17         super(TestBihash, cls).setUpClass()
18
19     @classmethod
20     def tearDownClass(cls):
21         super(TestBihash, cls).tearDownClass()
22
23     def setUp(self):
24         super(TestBihash, self).setUp()
25
26     def tearDown(self):
27         super(TestBihash, self).tearDown()
28
29     def test_bihash_unittest(self):
30         """ Bihash Add/Del Test """
31         error = self.vapi.cli("test bihash careful 0 verbose 0")
32
33         if error:
34             self.logger.critical(error)
35             self.assertNotIn('failed', error)
36
37     def test_bihash_thread(self):
38         """ Bihash Thread Test """
39
40         error = self.vapi.cli("test bihash threads 2 nbuckets" +
41                               " 64000 careful 0 verbose 0")
42
43         if error:
44             self.logger.critical(error)
45             self.assertNotIn('failed', error)
46
47     def test_bihash_vec64(self):
48         """ Bihash vec64 Test """
49
50         error = self.vapi.cli("test bihash vec64")
51
52         if error:
53             self.logger.critical(error)
54             self.assertNotIn('failed', error)
55
56     @unittest.skipUnless(running_gcov_tests, "part of code coverage tests")
57     def test_bihash_coverage(self):
58         """ Improve Code Coverage """
59
60         error = self.vapi.cli("test bihash nitems 10 ncycles 3" +
61                               "search 2 careful 1 verbose 2 non-random-keys")
62
63         if error:
64             self.logger.critical(error)
65             self.assertNotIn('failed', error)
66
67         error = self.vapi.cli("test bihash nitems 10 nbuckets 1 ncycles 3" +
68                               "search 2 careful 1 verbose 2 non-random-keys")
69         if error:
70             self.logger.critical(error)
71             self.assertNotIn('failed', error)
72
73 if __name__ == '__main__':
74     unittest.main(testRunner=VppTestRunner)