2018-07-23 18:00:54 -04:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
import unittest
|
|
|
|
|
|
|
|
from framework import VppTestCase, VppTestRunner
|
|
|
|
from vpp_ip_route import VppIpTable, VppIpRoute, VppRoutePath
|
|
|
|
|
|
|
|
|
2018-09-19 14:59:43 +02:00
|
|
|
class TestBihash(VppTestCase):
|
2018-07-23 18:00:54 -04:00
|
|
|
""" Bihash Test Cases """
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def setUpClass(cls):
|
2018-09-19 14:59:43 +02:00
|
|
|
super(TestBihash, cls).setUpClass()
|
2018-07-23 18:00:54 -04:00
|
|
|
|
2019-03-12 19:23:27 -07:00
|
|
|
@classmethod
|
|
|
|
def tearDownClass(cls):
|
|
|
|
super(TestBihash, cls).tearDownClass()
|
|
|
|
|
2018-07-23 18:00:54 -04:00
|
|
|
def setUp(self):
|
2018-09-19 14:59:43 +02:00
|
|
|
super(TestBihash, self).setUp()
|
2018-07-23 18:00:54 -04:00
|
|
|
|
|
|
|
def tearDown(self):
|
2018-09-19 14:59:43 +02:00
|
|
|
super(TestBihash, self).tearDown()
|
2018-07-23 18:00:54 -04:00
|
|
|
|
|
|
|
def test_bihash_unittest(self):
|
|
|
|
""" Bihash Add/Del Test """
|
2019-05-07 10:30:18 -04:00
|
|
|
error = self.vapi.cli("test bihash careful 0 verbose 0")
|
2018-07-23 18:00:54 -04:00
|
|
|
|
|
|
|
if error:
|
|
|
|
self.logger.critical(error)
|
2019-03-06 15:11:28 -08:00
|
|
|
self.assertNotIn('failed', error)
|
2018-07-23 18:00:54 -04:00
|
|
|
|
|
|
|
def test_bihash_thread(self):
|
|
|
|
""" Bihash Thread Test """
|
|
|
|
|
2019-05-07 10:30:18 -04:00
|
|
|
error = self.vapi.cli("test bihash threads 2 nbuckets" +
|
|
|
|
" 64000 careful 0 verbose 0")
|
2018-07-23 18:00:54 -04:00
|
|
|
|
|
|
|
if error:
|
|
|
|
self.logger.critical(error)
|
2019-03-06 15:11:28 -08:00
|
|
|
self.assertNotIn('failed', error)
|
2018-07-23 18:00:54 -04:00
|
|
|
|
2019-05-07 10:30:18 -04:00
|
|
|
def test_bihash_vec64(self):
|
|
|
|
""" Bihash vec64 Test """
|
|
|
|
|
|
|
|
error = self.vapi.cli("test bihash vec64")
|
|
|
|
|
|
|
|
if error:
|
|
|
|
self.logger.critical(error)
|
|
|
|
self.assertNotIn('failed', error)
|
|
|
|
|
|
|
|
def test_bihash_coverage(self):
|
|
|
|
""" Improve Code Coverage """
|
|
|
|
|
|
|
|
error = self.vapi.cli("test bihash nitems 10 ncycles 3" +
|
|
|
|
"search 2 careful 1 verbose 2 non-random-keys")
|
|
|
|
|
|
|
|
if error:
|
|
|
|
self.logger.critical(error)
|
|
|
|
self.assertNotIn('failed', error)
|
|
|
|
|
|
|
|
|
2018-07-23 18:00:54 -04:00
|
|
|
if __name__ == '__main__':
|
|
|
|
unittest.main(testRunner=VppTestRunner)
|