Dave Barach | 8b5dc4f | 2018-07-23 18:00:54 -0400 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | |
| 3 | import unittest |
| 4 | |
| 5 | from framework import VppTestCase, VppTestRunner |
| 6 | from vpp_ip_route import VppIpTable, VppIpRoute, VppRoutePath |
| 7 | |
| 8 | |
juraj.linkes | 8e26f6d | 2018-09-19 14:59:43 +0200 | [diff] [blame] | 9 | class TestBihash(VppTestCase): |
Dave Barach | 8b5dc4f | 2018-07-23 18:00:54 -0400 | [diff] [blame] | 10 | """ Bihash Test Cases """ |
| 11 | |
| 12 | @classmethod |
| 13 | def setUpClass(cls): |
juraj.linkes | 8e26f6d | 2018-09-19 14:59:43 +0200 | [diff] [blame] | 14 | super(TestBihash, cls).setUpClass() |
Dave Barach | 8b5dc4f | 2018-07-23 18:00:54 -0400 | [diff] [blame] | 15 | |
Paul Vinciguerra | 7f9b7f9 | 2019-03-12 19:23:27 -0700 | [diff] [blame] | 16 | @classmethod |
| 17 | def tearDownClass(cls): |
| 18 | super(TestBihash, cls).tearDownClass() |
| 19 | |
Dave Barach | 8b5dc4f | 2018-07-23 18:00:54 -0400 | [diff] [blame] | 20 | def setUp(self): |
juraj.linkes | 8e26f6d | 2018-09-19 14:59:43 +0200 | [diff] [blame] | 21 | super(TestBihash, self).setUp() |
Dave Barach | 8b5dc4f | 2018-07-23 18:00:54 -0400 | [diff] [blame] | 22 | |
| 23 | def tearDown(self): |
juraj.linkes | 8e26f6d | 2018-09-19 14:59:43 +0200 | [diff] [blame] | 24 | super(TestBihash, self).tearDown() |
Dave Barach | 8b5dc4f | 2018-07-23 18:00:54 -0400 | [diff] [blame] | 25 | |
| 26 | def test_bihash_unittest(self): |
| 27 | """ Bihash Add/Del Test """ |
Dave Barach | 749a89c | 2019-05-07 10:30:18 -0400 | [diff] [blame] | 28 | error = self.vapi.cli("test bihash careful 0 verbose 0") |
Dave Barach | 8b5dc4f | 2018-07-23 18:00:54 -0400 | [diff] [blame] | 29 | |
| 30 | if error: |
| 31 | self.logger.critical(error) |
Paul Vinciguerra | 9a6dafd | 2019-03-06 15:11:28 -0800 | [diff] [blame] | 32 | self.assertNotIn('failed', error) |
Dave Barach | 8b5dc4f | 2018-07-23 18:00:54 -0400 | [diff] [blame] | 33 | |
| 34 | def test_bihash_thread(self): |
| 35 | """ Bihash Thread Test """ |
| 36 | |
Dave Barach | 749a89c | 2019-05-07 10:30:18 -0400 | [diff] [blame] | 37 | error = self.vapi.cli("test bihash threads 2 nbuckets" + |
| 38 | " 64000 careful 0 verbose 0") |
Dave Barach | 8b5dc4f | 2018-07-23 18:00:54 -0400 | [diff] [blame] | 39 | |
| 40 | if error: |
| 41 | self.logger.critical(error) |
Paul Vinciguerra | 9a6dafd | 2019-03-06 15:11:28 -0800 | [diff] [blame] | 42 | self.assertNotIn('failed', error) |
Dave Barach | 8b5dc4f | 2018-07-23 18:00:54 -0400 | [diff] [blame] | 43 | |
Dave Barach | 749a89c | 2019-05-07 10:30:18 -0400 | [diff] [blame] | 44 | 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 Barach | 8b5dc4f | 2018-07-23 18:00:54 -0400 | [diff] [blame] | 64 | if __name__ == '__main__': |
| 65 | unittest.main(testRunner=VppTestRunner) |