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