blob: 04b1b4f635adfe059e984458a6b287ae66690a45 [file] [log] [blame]
Renato Botelho do Coutoead1e532019-10-31 13:31:07 -05001#!/usr/bin/env python3
Dave Barach8b5dc4f2018-07-23 18:00:54 -04002
3import unittest
4
5from framework import VppTestCase, VppTestRunner
6from vpp_ip_route import VppIpTable, VppIpRoute, VppRoutePath
7
8
juraj.linkes8e26f6d2018-09-19 14:59:43 +02009class TestBihash(VppTestCase):
Dave Barach8b5dc4f2018-07-23 18:00:54 -040010 """ Bihash Test Cases """
11
12 @classmethod
13 def setUpClass(cls):
juraj.linkes8e26f6d2018-09-19 14:59:43 +020014 super(TestBihash, cls).setUpClass()
Dave Barach8b5dc4f2018-07-23 18:00:54 -040015
Paul Vinciguerra7f9b7f92019-03-12 19:23:27 -070016 @classmethod
17 def tearDownClass(cls):
18 super(TestBihash, cls).tearDownClass()
19
Dave Barach8b5dc4f2018-07-23 18:00:54 -040020 def setUp(self):
juraj.linkes8e26f6d2018-09-19 14:59:43 +020021 super(TestBihash, self).setUp()
Dave Barach8b5dc4f2018-07-23 18:00:54 -040022
23 def tearDown(self):
juraj.linkes8e26f6d2018-09-19 14:59:43 +020024 super(TestBihash, self).tearDown()
Dave Barach8b5dc4f2018-07-23 18:00:54 -040025
26 def test_bihash_unittest(self):
27 """ Bihash Add/Del Test """
Dave Barach749a89c2019-05-07 10:30:18 -040028 error = self.vapi.cli("test bihash careful 0 verbose 0")
Dave Barach8b5dc4f2018-07-23 18:00:54 -040029
30 if error:
31 self.logger.critical(error)
Paul Vinciguerra9a6dafd2019-03-06 15:11:28 -080032 self.assertNotIn('failed', error)
Dave Barach8b5dc4f2018-07-23 18:00:54 -040033
34 def test_bihash_thread(self):
35 """ Bihash Thread Test """
36
Dave Barach749a89c2019-05-07 10:30:18 -040037 error = self.vapi.cli("test bihash threads 2 nbuckets" +
38 " 64000 careful 0 verbose 0")
Dave Barach8b5dc4f2018-07-23 18:00:54 -040039
40 if error:
41 self.logger.critical(error)
Paul Vinciguerra9a6dafd2019-03-06 15:11:28 -080042 self.assertNotIn('failed', error)
Dave Barach8b5dc4f2018-07-23 18:00:54 -040043
Dave Barach749a89c2019-05-07 10:30:18 -040044 def test_bihash_vec64(self):
45 """ Bihash vec64 Test """
46
47 error = self.vapi.cli("test bihash vec64")
48
49 if error:
50 self.logger.critical(error)
51 self.assertNotIn('failed', error)
52
53 def test_bihash_coverage(self):
54 """ Improve Code Coverage """
55
56 error = self.vapi.cli("test bihash nitems 10 ncycles 3" +
57 "search 2 careful 1 verbose 2 non-random-keys")
58
59 if error:
60 self.logger.critical(error)
61 self.assertNotIn('failed', error)
62
63
Dave Barach8b5dc4f2018-07-23 18:00:54 -040064if __name__ == '__main__':
65 unittest.main(testRunner=VppTestRunner)