aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_bihash.py
blob: b57485a3e9a24ad3acfd8b03f151801e5d1a4336 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/env python3

import unittest

from config import config
from framework import VppTestCase, VppTestRunner
from vpp_ip_route import VppIpTable, VppIpRoute, VppRoutePath


class TestBihash(VppTestCase):
    """Bihash Test Cases"""

    @classmethod
    def setUpClass(cls):
        # increase vapi timeout, to avoid spurious "test bihash ..."
        # failures reported on aarch64 w/ test-debug
        cls.vapi_response_timeout = 20
        super(TestBihash, cls).setUpClass()

    @classmethod
    def tearDownClass(cls):
        super(TestBihash, cls).tearDownClass()

    def setUp(self):
        super(TestBihash, self).setUp()

    def tearDown(self):
        super(TestBihash, self).tearDown()

    def test_bihash_unittest(self):
        """Bihash Add/Del Test"""
        error = self.vapi.cli("test bihash careful 0 verbose 0")

        if error:
            self.logger.critical(error)
            self.assertNotIn("failed", error)

    def test_bihash_thread(self):
        """Bihash Thread Test"""

        error = self.vapi.cli(
            "test bihash threads 2 nbuckets" + " 64000 careful 0 verbose 0"
        )

        if error:
            self.logger.critical(error)
            self.assertNotIn("failed", error)

    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)

    @unittest.skipUnless(config.gcov, "part of code coverage tests")
    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)

        error = self.vapi.cli(
            "test bihash nitems 10 nbuckets 1 ncycles 3"
            + "search 2 careful 1 verbose 2 non-random-keys"
        )
        if error:
            self.logger.critical(error)
            self.assertNotIn("failed", error)


if __name__ == "__main__":
    unittest.main(testRunner=VppTestRunner)
class="go"> trex> The **-f ./stl/imix.py** argument specifies the file that is used to create the traffic profile. The argument **-p 0 1 2 3** specifies the ports to be used. The argument **-m 9475mbps** the number of packets/sec to be used. All the arguments can be displayed with the **-h** argument. In the other terminal the display shows the statistics related the traffic flows. .. code-block:: console -Per port stats table ports | 0 | 1 | 2 | 3 ----------------------------------------------------------------------------------------- opackets | 789907304 | 789894738 | 790017701 | 790017132 obytes | 285397726750 | 285392406754 | 285406864578 | 285405883070 ipackets | 1563501970 | 45 | 1563504693 | 44 ibytes | 564870783050 | 2880 | 564873491682 | 2816 ierrors | 15728759 | 0 | 15732451 | 0 oerrors | 0 | 0 | 0 | 0 Tx Bw | 606.55 Mbps | 606.19 Mbps | 606.25 Mbps | 606.51 Mbps -Global stats enabled Cpu Utilization : 100.0 % 2.4 Gb/core Platform_factor : 1.0 Total-Tx : 2.43 Gbps Total-Rx : 2.40 Gbps Total-PPS : 841.44 Kpps Total-CPS : 0.00 cps Expected-PPS : 0.00 pps Expected-CPS : 0.00 cps Expected-BPS : 0.00 bps Active-flows : 0 Clients : 0 Socket-util : 0.0000 % Open-flows : 0 Servers : 0 Socket : 0 Socket/Clients : -nan Total_queue_full : 6529970196 drop-rate : 0.00 bps current time : 4016.8 sec test duration : 0.0 sec More statistics can be displayed on the TRex console using the **tui** command. .. code-block:: console trex>tui Global Statistics connection : localhost, Port 4501 total_tx_L2 : 2.45 Gb/sec version : STL @ v2.46 total_tx_L1 : 2.59 Gb/sec cpu_util. : 99.89% @ 2 cores (1 per port) total_rx : 2.42 Gb/sec rx_cpu_util. : 4.03% / 837.39 Kpkt/sec total_pps : 846.96 Kpkt/sec async_util. : 0.05% / 1.76 KB/sec drop_rate : 0 b/sec queue_full : 42,750,771 pkts Port Statistics port | 0 | 1 | 2 | 3 | total -----------+-------------------+-------------------+-------------------+-------------------+------------------ owner | root | root | root | root | link | UP | UP | UP | UP | state | TRANSMITTING | TRANSMITTING | TRANSMITTING | TRANSMITTING | speed | 10 Gb/s | 10 Gb/s | 10 Gb/s | 10 Gb/s | CPU util. | 99.89% | 99.89% | 99.89% | 99.89% | -- | | | | | Tx bps L2 | 612.76 Mbps | 613.07 Mbps | 612.52 Mbps | 612.77 Mbps | 2.45 Gbps Tx bps L1 | 646.64 Mbps | 646.96 Mbps | 646.4 Mbps | 646.64 Mbps | 2.59 Gbps Tx pps | 211.72 Kpps | 211.8 Kpps | 211.73 Kpps | 211.71 Kpps | 846.96 Kpps Line Util. | 6.47 % | 6.47 % | 6.46 % | 6.47 % | --- | | | | | Rx bps | 1.21 Gbps | \u25bc\u25bc\u25bc 23.03 bps | 1.21 Gbps | 5.94 bps | 2.42 G bps Rx pps | 418.59 Kpps | 0.04 pps | 418.77 Kpps | 0.01 pps | 837.36 Kpps ---- | | | | | opackets | 5227126 | 5227271 | 5432528 | 5432354 | 21319279 ipackets | 10526000 | 5 | 10527054 | 4 | 21053063 obytes | 1890829910 | 1891039152 | 1965259162 | 1965124338 | 7712252562 ibytes | 3807894454 | 320 | 3808149896 | 256 | 7616044926 tx-pkts | 5.23 Mpkts | 5.23 Mpkts | 5.43 Mpkts | 5.43 Mpkts | 21.32 Mpkts rx-pkts | 10.53 Mpkts | 5 pkts | 10.53 Mpkts | 4 pkts | 21.05 Mpkts tx-bytes | 1.89 GB | 1.89 GB | 1.97 GB | 1.97 GB | 7.71 GB rx-bytes | 3.81 GB | 320 B | 3.81 GB | 256 B | 7.62 GB ----- | | | | | oerrors | 0 | 0 | 0 | 0 | 0 ierrors | 133,370 | 0 | 132,529 | 0 | 265,899