{"id":1384,"date":"2021-12-26T17:03:26","date_gmt":"2021-12-26T08:03:26","guid":{"rendered":"http:\/\/192.168.20.1\/?p=1384"},"modified":"2021-12-30T12:40:44","modified_gmt":"2021-12-30T03:40:44","slug":"cisco-trex-stateless-mode-traffic-single-stream-10mbps-two-direction","status":"publish","type":"post","link":"https:\/\/rlab.cavtime.net\/?p=1384","title":{"rendered":"TRex Stateless mode [ Traffic : Single Stream 10Mbps Two Direction \/ 2 Traffic Profile ]"},"content":{"rendered":"<h2>Overview<\/h2>\n<p>Stateless mode \u3067 2 Traffice Profile \u3092\u7528\u3044\u3066 Two Direction (\u53cc\u65b9\u5411\uff09\u306e Traffic \u3092\u767a\u751f\u3055\u305b\u308b\u3002<\/p>\n<h2>Network Diagram<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"img-responsive right-block\" src=\"https:\/\/rlab.cavtime.net\/wp-content\/uploads\/2021\/12\/CiscoTRex-BacktoBack_2Direction.png\" alt=\"\" width=\"521\" height=\"251\" \/><\/p>\n<h2>t-rex-64 -i<\/h2>\n<pre>root@svr-ub20:\/opt\/trex\/v2.92# .\/t-rex-64 -i\r\nStarting Scapy server.... Scapy server is started\r\nThe ports are bound\/configured.\r\nStarting  TRex v2.92 please wait  ...\r\n set driver name net_e1000_em\r\n driver capability  : TCP_UDP_OFFLOAD\r\n set dpdk queues mode to ONE_QUE\r\n Number of ports found: 2\r\nzmq publisher at: tcp:\/\/*:4500\r\n wait 1 sec .\r\nport : 0\r\n------------\r\nlink         :  link : Link Up - speed 1000 Mbps - full-duplex\r\npromiscuous  : 0\r\nport : 1\r\n------------\r\nlink         :  link : Link Up - speed 1000 Mbps - full-duplex\r\npromiscuous  : 0\r\n number of ports         : 2\r\n <span style=\"color: #ff0000;\">max cores for 2 ports   : 1  &lt;--- Traffic Transmit and Recieve CPU<\/span>\r\n tx queues per port      : 3\r\n -------------------------------\r\nRX core uses TX queue number 65535 on all ports\r\n core, c-port, c-queue, s-port, s-queue, lat-queue\r\n ------------------------------------------\r\n 1        0      0       1       0      0\r\n -------------------------------\r\n\r\n\r\n\r\n-Per port stats table\r\n      ports |               0 |               1\r\n -----------------------------------------------------------------------------------------\r\n   opackets |               0 |               0\r\n     obytes |               0 |               0\r\n   ipackets |               0 |               0\r\n     ibytes |               0 |               0\r\n    ierrors |               0 |               0\r\n    oerrors |               0 |               0\r\n      Tx Bw |       0.00  bps |       0.00  bps\r\n\r\n-Global stats enabled\r\n Cpu Utilization : 0.0  %\r\n Platform_factor : 1.0\r\n Total-Tx        :       0.00  bps\r\n Total-Rx        :       0.00  bps\r\n Total-PPS       :       0.00  pps\r\n Total-CPS       :       0.00  cps\r\n\r\n Expected-PPS    :       0.00  pps\r\n Expected-CPS    :       0.00  cps\r\n Expected-BPS    :       0.00  bps\r\n\r\n Active-flows    :        0  Clients :        0   Socket-util : 0.0000 %\r\n Open-flows      :        0  Servers :        0   Socket :        0 Socket\/Clients :  -nan\r\n drop-rate       :       0.00  bps\r\n current time    : 7.2 sec\r\n test duration   : 0.0 sec\r\n<\/pre>\n<h2>trex-console command<\/h2>\n<pre>trex&gt;start -p 0 -f rlab\/HostAtoHostB.py -p 1 -f rlab\/HostBtoHostA.py -m 10mbps -d 120\r\n<\/pre>\n<p>-p 0 -f rlab\/HostAtoHostB.py \/\/ Port 0 \u304b\u3089 Traffic Profile HostAtoHostB.py \u306e Traffic \u3092\u9001\u51fa<\/p>\n<p>-p 1 -f rlab\/HostBtoHostA.py \/\/ Port 1 \u304b\u3089 Traffic Profile HostBtoHost1.py \u306e Traffic \u3092\u9001\u51fa<\/p>\n<p>-m 10mbps \/\/ 10Mbps(L2) \u3067 Traffic \u3092\u9001\u51fa<\/p>\n<p>-d 120 \/\/ 120\u79d2\u9593 Traffic \u3092\u9001\u51fa<\/p>\n<h2>Environment<\/h2>\n<pre>$ cat \/etc\/os-release\r\nNAME=\"Ubuntu\"\r\nVERSION=\"20.04.3 LTS (Focal Fossa)\"\r\nID=ubuntu\r\nID_LIKE=debian\r\nPRETTY_NAME=\"Ubuntu 20.04.3 LTS\"\r\nVERSION_ID=\"20.04\"\r\nHOME_URL=\"https:\/\/www.ubuntu.com\/\"\r\nSUPPORT_URL=\"https:\/\/help.ubuntu.com\/\"\r\nBUG_REPORT_URL=\"https:\/\/bugs.launchpad.net\/ubuntu\/\"\r\nPRIVACY_POLICY_URL=\"https:\/\/www.ubuntu.com\/legal\/terms-and-policies\/privacy-policy\"\r\nVERSION_CODENAME=focal\r\nUBUNTU_CODENAME=focal\r\n$\r\n<\/pre>\n<h2>Traffic Profile<\/h2>\n<p>HostAtoHostB.py<\/p>\n<pre>#\r\n# Single Stream\r\n# One Direction\r\n#\r\n\r\nfrom trex_stl_lib.api import *\r\nimport argparse\r\n\r\nclass STLS1(object):\r\n\r\n    def __init__ (self):\r\n        self.mode  =0\r\n        self.fsize  =64\r\n\r\n    def create_pkt_base (self):\r\n        t=[\r\n        Ether()\/IP(<span style=\"color: #ff0000;\">src=\"16.0.0.1\",dst=\"48.0.0.1\"<\/span>)\/UDP(dport=12,sport=1025)\r\n        ]\r\n        return t[self.mode]\r\n\r\n    def create_stream (self):\r\n        # Create base packet and pad it to size\r\n        size = self.fsize - 4; # HW will add 4 bytes ethernet FCS\r\n\r\n        base_pkt = self.create_pkt_base ()\r\n\r\n        pad = max(0, size - len(base_pkt)) * 'x'\r\n\r\n        pkt = STLPktBuilder(pkt = base_pkt\/pad,\r\n                            vm = [])\r\n\r\n        return STLStream(packet = pkt,\r\n                         mode = STLTXCont())\r\n\r\n    def get_streams (self, tunables, **kwargs):\r\n        parser = argparse.ArgumentParser(description='Argparser for {}'.format(os.path.basename(__file__)), \r\n                                         formatter_class=argparse.ArgumentDefaultsHelpFormatter)\r\n\r\n        args = parser.parse_args(tunables)\r\n        # create 1 stream \r\n        return [ self.create_stream() ]\r\n\r\n# dynamic load - used for trex console or simulator\r\ndef register():\r\n    return STLS1()\r\n<\/pre>\n<p>HostBtoHostA.py<\/p>\n<pre>#\r\n# Single Stream\r\n# One Direction\r\n#\r\n\r\nfrom trex_stl_lib.api import *\r\nimport argparse\r\n\r\nclass STLS1(object):\r\n\r\n    def __init__ (self):\r\n        self.mode  =0\r\n        self.fsize  =64\r\n\r\n    def create_pkt_base (self):\r\n        t=[\r\n        Ether()\/IP(<span style=\"color: #ff0000;\">src=\"48.0.0.1\",dst=\"16.0.0.1\"<\/span>)\/UDP(dport=12,sport=1025)\r\n        ]\r\n        return t[self.mode]\r\n\r\n    def create_stream (self):\r\n        # Create base packet and pad it to size\r\n        size = self.fsize - 4; # HW will add 4 bytes ethernet FCS\r\n\r\n        base_pkt = self.create_pkt_base ()\r\n\r\n        pad = max(0, size - len(base_pkt)) * 'x'\r\n\r\n        pkt = STLPktBuilder(pkt = base_pkt\/pad,\r\n                            vm = [])\r\n\r\n        return STLStream(packet = pkt,\r\n                         mode = STLTXCont())\r\n\r\n    def get_streams (self, tunables, **kwargs):\r\n        parser = argparse.ArgumentParser(description='Argparser for {}'.format(os.path.basename(__file__)), \r\n                                         formatter_class=argparse.ArgumentDefaultsHelpFormatter)\r\n\r\n        args = parser.parse_args(tunables)\r\n        # create 1 stream \r\n        return [ self.create_stream() ]\r\n\r\n# dynamic load - used for trex console or simulator\r\ndef register():\r\n    return STLS1()\r\n<\/pre>\n<h2>trex-console<\/h2>\n<pre>trex&gt;clear  <span style=\"color: #ff0000;\">&lt;--- Counter Clear<\/span>\r\n\r\nClearing stats :                                             [SUCCESS]\r\n\r\n4.04 [ms]\r\n\r\ntrex&gt;\r\ntrex&gt;\r\ntrex&gt;stats\r\nGlobal Statistics\r\n\r\nconnection   : localhost, Port 4501                       total_tx_L2  : 0 bps                         \r\nversion      : STL @ v2.92                                total_tx_L1  : 0 bps                         \r\ncpu_util.    : 0.0% @ 1 cores (1 per dual port)           total_rx     : 0 bps                         \r\nrx_cpu_util. : 0.0% \/ 0 pps                               total_pps    : 0 pps                         \r\nasync_util.  : 0% \/ 9.62 bps                              drop_rate    : 0 bps                         \r\ntotal_cps.   : 0 cps                                      queue_full   : 0 pkts                        \r\n\r\nPort Statistics\r\n\r\n   port    |         0         |         1         |       total\r\n-----------+-------------------+-------------------+------------------\r\nowner      |              root |              root |\r\nlink       |                UP |                UP |\r\nstate      |              IDLE |              IDLE |\r\nspeed      |            1 Gb\/s |            1 Gb\/s |\r\nCPU util.  |              0.0% |              0.0% |\r\n--         |                   |                   |\r\nTx bps L2  |             0 bps |             0 bps |             0 bps\r\nTx bps L1  |             0 bps |             0 bps |             0 bps\r\nTx pps     |             0 pps |             0 pps |             0 pps\r\nLine Util. |               0 % |               0 % |\r\n---        |                   |                   |\r\nRx bps     |             0 bps |             0 bps |             0 bps\r\nRx pps     |             0 pps |             0 pps |             0 pps\r\n----       |                   |                   |\r\nopackets   |                 0 |                 0 |                 0\r\nipackets   |                 0 |                 0 |                 0\r\nobytes     |                 0 |                 0 |                 0\r\nibytes     |                 0 |                 0 |                 0\r\ntx-pkts    |            0 pkts |            0 pkts |            0 pkts\r\nrx-pkts    |            0 pkts |            0 pkts |            0 pkts\r\ntx-bytes   |               0 B |               0 B |               0 B\r\nrx-bytes   |               0 B |               0 B |               0 B\r\n-----      |                   |                   |\r\noerrors    |                 0 |                 0 |                 0\r\nierrors    |                 0 |                 0 |                 0\r\n\r\ntrex&gt;start -p 0 -f rlab\/HostAtoHostB.py -p 1 -f rlab\/HostBtoHostA.py -m 10mbps -d 120\r\n\r\nRemoving all streams from port(s) [0._, 1._]:                [SUCCESS]\r\n\r\n\r\nAttaching 1 streams to port(s) [0._]:                        [SUCCESS]\r\n\r\n\r\nAttaching 1 streams to port(s) [1._]:                        [SUCCESS]\r\n\r\n\r\nStarting traffic on port(s) [0._, 1._]:                      [SUCCESS]\r\n\r\n18.27 [ms]\r\n\r\ntrex&gt;\r\n\r\n2021-12-26 07:25:21 - [server][info]     - Profile 0._ job done\r\n\r\ntrex&gt;\r\n\r\n2021-12-26 07:25:21 - [server][info]     - Port 0 job done\r\n\r\ntrex&gt;\r\n\r\n2021-12-26 07:25:21 - [server][info]     - Profile 1._ job done\r\n\r\ntrex&gt;\r\n\r\n2021-12-26 07:25:21 - [server][info]     - Port 1 job done\r\n\r\ntrex&gt;stats\r\nGlobal Statistics\r\n\r\nconnection   : localhost, Port 4501                       <span style=\"color: #ff0000;\">total_tx_L2  : 2.07 Mbps<\/span>                     \r\nversion      : STL @ v2.92                                total_tx_L1  : 2.71 Mbps                     \r\ncpu_util.    : 0.42% @ 1 cores (1 per dual port)          <span style=\"color: #ff0000;\">total_rx     : 1.94 Mbps<\/span>                     \r\nrx_cpu_util. : 0.06% \/ 4.04 Kpps                          total_pps    : 4.04 Kpps                     \r\nasync_util.  : 0% \/ 10.56 bps                             drop_rate    : 0 bps                         \r\ntotal_cps.   : 0 cps                                      queue_full   : 0 pkts                        \r\n\r\nPort Statistics\r\n\r\n   port    |         0         |         1         |       total\r\n-----------+-------------------+-------------------+------------------\r\nowner      |              root |              root |\r\nlink       |                UP |                UP |\r\nstate      |              IDLE |              IDLE |\r\nspeed      |            1 Gb\/s |            1 Gb\/s |\r\nCPU util.  |              0.0% |              0.0% |\r\n--         |                   |                   |\r\n<span style=\"color: #ff0000;\">Tx bps L2  |         1.03 Mbps |         1.03 Mbps |         2.07 Mbps<\/span>\r\nTx bps L1  |         1.36 Mbps |         1.36 Mbps |         2.71 Mbps\r\nTx pps     |         2.02 Kpps |         2.02 Kpps |         4.04 Kpps\r\nLine Util. |            0.14 % |            0.14 % |\r\n---        |                   |                   |\r\n<span style=\"color: #ff0000;\">Rx bps     |       968.74 Kbps |       968.64 Kbps |         1.94 Mbps<\/span>\r\nRx pps     |         2.02 Kpps |         2.02 Kpps |         4.04 Kpps\r\n----       |                   |                   |\r\nopackets   |           2343750 |           2343750 |           4687500\r\nipackets   |           2343750 |           2343750 |           4687500\r\nobytes     |         150000000 |         150000000 |         300000000\r\nibytes     |         <span style=\"color: #ff0000;\">141233340<\/span> |         <span style=\"color: #ff0000;\">141241200<\/span> |         282474540  <span style=\"color: #ff0000;\">&lt;---- different input bytes<\/span>\r\ntx-pkts    |        2.34 Mpkts |        2.34 Mpkts |        4.69 Mpkts\r\nrx-pkts    |        2.34 Mpkts |        2.34 Mpkts |        4.69 Mpkts\r\ntx-bytes   |            150 MB |            150 MB |            300 MB\r\nrx-bytes   |         141.23 MB |         141.24 MB |         282.47 MB\r\n-----      |                   |                   |\r\noerrors    |                 0 |                 0 |                 0\r\nierrors    |                 0 |                 0 |                 0\r\n\r\ntrex&gt;\r\n<\/pre>\n<h2>Host CPU usage<\/h2>\n<pre>top - 07:24:21 up  1:10,  4 users,  load average: 1.42, 1.03, 0.60\r\nTasks: 166 total,   1 running, 165 sleeping,   0 stopped,   0 zombie\r\n%Cpu0  :  1.0 us,  0.0 sy,  0.0 ni, 99.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st\r\n%Cpu1  :100.0 us,  0.0 sy,  0.0 ni,  0.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st\r\n<span style=\"color: #ff0000;\">%Cpu2  :100.0 us,  0.0 sy,  0.0 ni,  0.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st<\/span>\r\n%Cpu3  :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st\r\n%Cpu4  :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st\r\n%Cpu5  :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st\r\nMiB Mem :  16013.3 total,  10850.0 free,   4459.1 used,    704.1 buff\/cache\r\nMiB Swap:      0.0 total,      0.0 free,      0.0 used.  11272.0 avail Mem\r\n\r\n    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND\r\n   <span style=\"color: #ff0000;\">2391 root      20   0   16.6g  19716  10216 S 200.7   0.1  12:48.32 _t-rex-64<\/span>\r\n      1 root      20   0  167468  11384   8304 S   0.0   0.1   0:01.32 systemd\r\n      2 root      20   0       0      0      0 S   0.0   0.0   0:00.00 kthreadd\r\n      3 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 rcu_gp\r\n      4 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 rcu_par_gp\r\n      6 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 kworker\/0:0H-kblockd\r\n      7 root      20   0       0      0      0 I   0.0   0.0   0:01.42 kworker\/0:1-cgroup_destroy\r\n      9 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 mm_percpu_wq\r\n     10 root      20   0       0      0      0 S   0.0   0.0   0:00.01 ksoftirqd\/0\r\n     11 root      20   0       0      0      0 I   0.0   0.0   0:01.02 rcu_sched\r\n     12 root      rt   0       0      0      0 S   0.0   0.0   0:00.03 migration\/0\r\n     13 root     -51   0       0      0      0 S   0.0   0.0   0:00.00 idle_inject\/0\r\n     14 root      20   0       0      0      0 S   0.0   0.0   0:00.00 cpuhp\/0\r\n     15 root      20   0       0      0      0 S   0.0   0.0   0:00.00 cpuhp\/1\r\n     16 root     -51   0       0      0      0 S   0.0   0.0   0:00.00 idle_inject\/1\r\n     17 root      rt   0       0      0      0 S   0.0   0.0   0:00.37 migration\/1\r\n     18 root      20   0       0      0      0 S   0.0   0.0   0:00.00 ksoftirqd\/1\r\n     20 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 kworker\/1:0H-kblockd\r\n     21 root      20   0       0      0      0 S   0.0   0.0   0:00.00 cpuhp\/2\r\n     22 root     -51   0       0      0      0 S   0.0   0.0   0:00.00 idle_inject\/2\r\n     23 root      rt   0       0      0      0 S   0.0   0.0   0:00.37 migration\/2\r\n     24 root      20   0       0      0      0 S   0.0   0.0   0:00.00 ksoftirqd\/2\r\n     26 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 kworker\/2:0H\r\n     27 root      20   0       0      0      0 S   0.0   0.0   0:00.00 cpuhp\/3\r\n     28 root     -51   0       0      0      0 S   0.0   0.0   0:00.00 idle_inject\/3\r\n     29 root      rt   0       0      0      0 S   0.0   0.0   0:00.37 migration\/3\r\n     30 root      20   0       0      0      0 S   0.0   0.0   0:00.02 ksoftirqd\/3\r\nhyamazak@svr-ub20:~$\r\n<\/pre>\n<h2>Result<\/h2>\n<p>Port 1 and Port 2 Input bytes are different. Because CPU 2 usage is 100%.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Overview Stateless mode \u3067 2 Traffice Profile \u3092\u7528\u3044\u3066 Two Direction (\u53cc\u65b9\u5411\uff09\u306e Traffic \u3092\u767a\u751f\u3055\u305b\u308b\u3002 Network Diagram t-rex-6 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[108],"tags":[],"class_list":["post-1384","post","type-post","status-publish","format-standard","hentry","category-traffic-generator"],"_links":{"self":[{"href":"https:\/\/rlab.cavtime.net\/index.php?rest_route=\/wp\/v2\/posts\/1384","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rlab.cavtime.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rlab.cavtime.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rlab.cavtime.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/rlab.cavtime.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1384"}],"version-history":[{"count":9,"href":"https:\/\/rlab.cavtime.net\/index.php?rest_route=\/wp\/v2\/posts\/1384\/revisions"}],"predecessor-version":[{"id":1433,"href":"https:\/\/rlab.cavtime.net\/index.php?rest_route=\/wp\/v2\/posts\/1384\/revisions\/1433"}],"wp:attachment":[{"href":"https:\/\/rlab.cavtime.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1384"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rlab.cavtime.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1384"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rlab.cavtime.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1384"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}