{"id":306840,"date":"2020-07-13T09:00:51","date_gmt":"2020-07-13T09:00:51","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=306840"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=306840","title":{"rendered":"\u0413\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0442\u0440\u0430\u0444\u0438\u043a\u0430 Cisco TRex: \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043d\u0430\u0433\u0440\u0443\u0437\u043e\u0447\u043d\u043e\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/510086\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/vm\/jy\/z0\/vmjyz0syr7vtnlybsggog5mx6z8.jpeg\"><\/p>\n<p>  \u041f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0433\u043e \u0440\u043e\u0443\u0442\u0435\u0440\u0430 \u043c\u044b \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u0435\u0442\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439 open-source-\u0448\u0442\u0443\u043a\u0438 \u2014 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0442\u0440\u0430\u0444\u0438\u043a\u0430 Cisco TRex. \u0427\u0442\u043e \u044d\u0442\u043e \u0437\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442? \u041a\u0430\u043a \u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f? \u0418 \u0447\u0435\u043c \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u0430\u043c-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c? \u041f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c \u2014 \u043e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u044d\u0442\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u044b.<a name=\"habracut\"><\/a><\/p>\n<h2>1. \u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 Cisco TRex<\/h2>\n<p>  \u042d\u0442\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c, \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430\u0445 Intel \u043d\u0430 \u0431\u0430\u0437\u0435 DPDK, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0440\u0435\u0436\u0438\u043c\u044b \u0441 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0435\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043f\u043e\u0442\u043e\u043a\u0430 \u0438 \u0431\u0435\u0437 (stateful \/ stateless modes). \u0421\u0440\u0430\u0432\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u043c\u044b\u0439. <\/p>\n<p>  \u0410\u043d\u0433\u043b\u043e\u044f\u0437\u044b\u0447\u043d\u0430\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 <a href=\"https:\/\/trex-tgn.cisco.com\/trex\/doc\" rel=\"nofollow\">\u043d\u0430 \u0441\u0430\u0439\u0442\u0435<\/a>.<\/p>\n<p>  Trex \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u0438 \u0438\u0445 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438. \u041f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 MAC \u0438 IP. \u041c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0438 \u0438\u0445 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e, \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. <\/p>\n<p>  \u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0432 \u0441\u0440\u0435\u0434\u0435 Linux. <\/p>\n<p>  \u041e\u0434\u043d\u043e \u0438\u0437 \u0432\u0430\u0436\u043d\u044b\u0445 \u043e\u0442\u043b\u0438\u0447\u0438\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 Trex \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 DPDK, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0431\u043e\u0439\u0442\u0438 \u00ab\u0443\u0437\u043a\u0438\u0435 \u043c\u0435\u0441\u0442\u0430\u00bb \u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0441\u0435\u0442\u0435\u0432\u043e\u0433\u043e \u0441\u0442\u0435\u043a\u0430 Linux. DPDK \u0438\u043b\u0438 Data Plane Development Kit \u2014 \u044d\u0442\u043e \u0446\u0435\u043b\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u0432 \u0434\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0430\u043a\u0435\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u0441\u0442\u0435\u043a Linux \u0438\u0437 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 \u0441\u0435\u0442\u0435\u0432\u044b\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\u043c \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e. <\/p>\n<p>  DPDK \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 \u043e\u0431\u0449\u0435\u0433\u043e \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u043a\u0438 \u043f\u0430\u043a\u0435\u0442\u043e\u0432. \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u044d\u0442\u043e\u0439 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e\u0442\u043f\u0430\u0434\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0432 \u0434\u043e\u0440\u043e\u0433\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0445 \u043a\u043e\u043c\u043c\u0443\u0442\u0430\u0442\u043e\u0440\u0430\u0445 \u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0442\u043e\u0440\u0430\u0445. \u041e\u0434\u043d\u0430\u043a\u043e DPDK \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0430\u0434\u0430\u043f\u0442\u0435\u0440\u043e\u0432, \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u0436\u0435\u043b\u0435\u0437\u0430 \u0443\u043a\u0430\u0437\u0430\u043d \u043d\u0430 <a href=\"http:\/\/core.dpdk.org\/supported\" rel=\"nofollow\">\u043d\u0430 \u0441\u0441\u044b\u043b\u043a\u0435<\/a> \u2014 \u0442\u0443\u0442 \u0441\u0430\u043c\u0430\u044f \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u0430\u044f \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430 \u043e\u0442 <a href=\"http:\/\/core.dpdk.org\/supported\/nics\/intel\/\" rel=\"nofollow\">Intel<\/a>, \u0442.\u0435. \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0434\u043a\u0430 \u0436\u0435\u043b\u0435\u0437\u0430, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 linux-\u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430\u043c\u0438 e1000, ixgbe, i40e, ice, fm10k, ipn3ke, ifc, igc.<\/p>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u0432\u0430\u0436\u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b TRex-\u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043d\u0430 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044f\u0445 10 \u0413\u0431\u0438\u0442\/\u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u043c\u043d\u043e\u0433\u043e\u044f\u0434\u0435\u0440\u043d\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 \u2014 \u043e\u0442 4 \u044f\u0434\u0435\u0440 \u0438 \u0432\u044b\u0448\u0435, \u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e CPU \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u0430 Intel c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 (hyper-threading). <\/p>\n<h2>2. \u041a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c TRex<\/h2>\n<p>  <b>1) \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0430\u0440\u0445\u0438\u0432 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 trex-tgn.cisco.com:<\/b> <a href=\"https:\/\/trex-tgn.cisco.com\/trex\/release\/\" rel=\"nofollow\">trex-tgn.cisco.com\/trex\/release\/<\/a><\/p>\n<p>  \u0420\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u0430\u0440\u0445\u0438\u0432 \u0432 \u0434\u043e\u043c\u0430\u0448\u043d\u0435\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u00ab\/home\/user\u00bb, \u0433\u0434\u0435 user \u2014 \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. <\/p>\n<pre><code class=\"bash\">[bash]&gt;wget --no-cache https:\/\/trex-tgn.cisco.com\/trex\/release\/latest [bash]&gt;tar -xzvf latest<\/code><\/pre>\n<p>  <b>2) \u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0438 \u043f\u0440\u0438\u0435\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445<\/b><\/p>\n<p>  \u0412\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0443\u0442\u0438\u043b\u0438\u0442\u044b \u00abdpdk_setup_ports.py\u00bb, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u0434\u0435\u0442 \u0432 \u0430\u0440\u0445\u0438\u0432\u0435 \u0441 TRex. \u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0435\u0442\u0435\u0432\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 TRex, \u043c\u043e\u0436\u043d\u043e \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 MAC \u0438\u043b\u0438 IP. \u0414\u043b\u044f \u0441\u0442\u0430\u0440\u0442\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u0443\u044e \u0443\u0442\u0438\u043b\u0438\u0442\u0443 \u0441 \u043a\u043b\u044e\u0447\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u00absudo .\/dpdk_setup_ports.py \u2013i\u00bb. <\/p>\n<p>  \u041f\u0435\u0440\u0432\u044b\u043c \u0448\u0430\u0433\u043e\u043c \u043e\u0442\u043a\u0430\u0436\u0435\u043c\u0441\u044f \u043e\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043d\u0430 MAC-\u0443\u0440\u043e\u0432\u043d\u0435 (Do you want to use MAC based config? (y\/N) n). <\/p>\n<p>  \u0412\u0442\u043e\u0440\u044b\u043c \u0448\u0430\u0433\u043e\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043f\u0430\u0440\u0443 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u0435\u0442\u0435\u0432\u0430\u044f \u043a\u0430\u0440\u0442\u0430 Intel X710 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 4 \u0441\u0435\u0442\u0435\u0432\u044b\u043c\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430\u043c\u0438, \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c 1-\u0435 \u0438 4-\u0435 \u0433\u043d\u0435\u0437\u0434\u043e \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u043a\u0430\u0440\u0442\u044b.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/x4\/r0\/ge\/x4r0gem37ajipnnikop2bkel1yo.png\"><\/p>\n<p>  \u0422\u0440\u0435\u0442\u044c\u0438\u043c \u0448\u0430\u0433\u043e\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0437\u0430\u043c\u043a\u043d\u0443\u0442\u0443\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u2013 \u043a\u043e\u0433\u0434\u0430 \u0434\u0430\u043d\u043d\u044b\u0435 \u0443\u0445\u043e\u0434\u044f\u0442 \u0441 \u043f\u043e\u0440\u0442\u0430 1 \u0438 \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0442 \u0432 \u043f\u043e\u0440\u0442 2 (\u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e), \u0432\u0441\u0435 \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u041f\u041a. \u041d\u0430\u043c \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043e\u0442\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0445\u0435\u043c\u044b \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0441\u0445\u0435\u043c\u0443 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430 2 \u041f\u041a.<\/p>\n<p>  \u0427\u0435\u0442\u0432\u0435\u0440\u0442\u044b\u043c \u0438 \u043f\u044f\u0442\u044b\u043c \u0448\u0430\u0433\u043e\u043c \u0434\u0430\u0435\u043c \u0441\u043e\u0433\u043b\u0430\u0441\u0438\u0435 \u043d\u0430 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0432 \u0444\u0430\u0439\u043b \/etc\/trex_cfg.yaml.<\/p>\n<p>  \u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u043d\u0430 IP-\u0443\u0440\u043e\u0432\u043d\u0435 \u0434\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0445\u0435\u043c\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/qv\/ot\/f0\/qvotf0vblmwfbbocao-ax02zvvo.png\"><\/p>\n<p>  \u0424\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0442\u0443\u0442: \u00ab\/etc\/trex_cfg.yaml\u00bb. \u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u043f\u043e\u043a\u0430\u0437\u0430\u043d \u043d\u0438\u0436\u0435 \u0434\u043b\u044f \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u043a\u0430\u0440\u0442\u044b \u0441 2 \u043f\u043e\u0440\u0442\u0430\u043c\u0438 \u0438 CPU, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0449\u0435\u043c 8 \u043f\u043e\u0442\u043e\u043a\u043e\u0432:<\/p>\n<pre><code class=\"bash\">### Config file generated by dpdk_setup_ports.py ### - version: 2   interfaces: ['01:00.0', '01:00.3']   port_info:       - ip: 192.168.253.106         default_gw: 192.168.253.107       - ip: 192.168.254.106         default_gw: 192.168.254.107     platform:       master_thread_id: 0       latency_thread_id: 1       dual_if:     \t- socket: 0       \tthreads: [2,3,4,5,6,7]<\/code><\/pre>\n<p>  \u0412 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438: <\/p>\n<ul>\n<li>&#8217;01:00.0&#8242;, &#8217;01:00.3&#8242; \u2014 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 Eth-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432 \u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 Linux.<\/li>\n<li>ip: 192.168.253.106 \u2014 \u0430\u0434\u0440\u0435\u0441 \u043f\u043e\u0440\u0442\u0430 \u041f\u041a Server TRex, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0442\u0440\u0430\u0444\u0438\u043a.<\/li>\n<li>default_gw: 192.168.253.107 \u2014 \u0430\u0434\u0440\u0435\u0441 1 \u043f\u043e\u0440\u0442\u0430 \u041f\u041a DUT (Device under test).<\/li>\n<li>ip: 192.168.254.106 \u2014 \u0430\u0434\u0440\u0435\u0441 \u043f\u043e\u0440\u0442\u0430 \u041f\u041a Server TRex, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0442\u0440\u0430\u0444\u0438\u043a \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 QOS.<\/li>\n<li>default_gw: 192.168.253.107 \u2014 \u0430\u0434\u0440\u0435\u0441 2 \u043f\u043e\u0440\u0442\u0430 \u041f\u041a DUT.<\/li>\n<\/ul>\n<p>  \u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435! \u0421\u0438\u0441\u0442\u0435\u043c\u0430 TRex \u0437\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u043e\u0439 \u0436\u0435 \u043f\u043e\u0434\u0441\u0435\u0442\u0438 \u043f\u0440\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043f\u043e\u0434\u0441\u0435\u0442\u0438 16.0.0.0 \u0438 48.0.0.0. <\/p>\n<p>  <b>3) \u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b \u043d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435<\/b><\/p>\n<p>  \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u043a\u0443 (forwarding) \u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b, \u0447\u0442\u043e\u0431\u044b \u0441\u0438\u0441\u0442\u0435\u043c\u0430 (DUT), \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0442\u0440\u0430\u0444\u0438\u043a, \u0437\u043d\u0430\u043b\u0430, \u043e\u0442\u043a\u0443\u0434\u0430 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0438 \u043a\u0443\u0434\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0430\u043a\u0435\u0442\u044b.<\/p>\n<p>  \u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u043d\u0430 \u041f\u041a DUT \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u0442\u043e\u043a\u043e\u0432:<\/p>\n<pre><code class=\"bash\">sudo echo 1 &gt; \/proc\/sys\/net\/ipv4\/ip_forward sudo route add -net 16.0.0.0 netmask 255.0.0.0 gw 192.168.253.106 sudo route add -net 48.0.0.0 netmask 255.0.0.0 gw 192.168.254.106<\/code><\/pre>\n<p>  <b>4) \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c TRex-\u0441\u0435\u0440\u0432\u0435\u0440 \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 astf:<\/b><\/p>\n<pre><code class=\"bash\">cd v2.XX sudo .\/t-rex-64 -i --astf<\/code><\/pre>\n<p>  \u041f\u0440\u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0435 TRex-\u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0443\u0432\u0438\u0434\u0438\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e Ethernet-\u043f\u043e\u0440\u0442\u0430\u0445, \u0437\u0430\u043d\u044f\u0442\u044b\u0445 \u043f\u043e\u0434 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435:<\/p>\n<pre><code class=\"bash\">The ports are bound\/configured. port : 0  ------------ link         :  link : Link Up - speed 10000 Mbps - full-duplex promiscuous  : 0  port : 1  ------------ link         :  link : Link Up - speed 10000 Mbps - full-duplex promiscuous  : 0  number of ports         : 2  max cores for 2 ports   : 1  tx queues per port      : 3<\/code><\/pre>\n<p>  <b>5) \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043a\u043e\u043d\u0441\u043e\u043b\u044c TRex<\/b><\/p>\n<p>  \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u043e\u043a\u043d\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u043f\u043e\u0442\u043e\u043a\u0430 \u0438\u0437 \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 (\u043f\u0430\u043f\u043a\u0430 \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 astf \u0435\u0441\u0442\u044c \u0432 \u0430\u0440\u0445\u0438\u0432\u0435 \u043a TRex):<\/p>\n<pre><code class=\"bash\">cd v2.XX .\/trex-console start -f astf\/http_simple.py -m 1   start (options): -a (all ports) -port 1 2 3 (ports 1 2 3) -d duration (-d 100 -d 10m -d 1h) -m stream strength (-m 1 -m 1gb -m 40%) -f load from disk the streams file<\/code><\/pre>\n<p>  \u041f\u0440\u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0443\u0432\u0438\u0434\u0438\u043c \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u043f\u043e \u043f\u0440\u043e\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044e \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 TRex-\u0441\u0435\u0440\u0432\u0435\u0440\u0430:<\/p>\n<pre><code class=\"bash\">Global stats enabled Cpu Utilization : 0.3  %  0.6 Gb\/core  Platform_factor : 1.0   Total-Tx        :     759.81 Kbps   Total-Rx        :     759.81 Kbps   Total-PPS       :      82.81  pps   Total-CPS       :       2.69  cps     Expected-PPS    :       0.00  pps   Expected-CPS    :       0.00  cps   Expected-L7-BPS :       0.00  bps     Active-flows    :        2  Clients :        0   Socket-util : 0.0000 %     Open-flows      :      641<\/code><\/pre>\n<p>  <\/p>\n<h2>3. \u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e TRex<\/h2>\n<p>  \u0412 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u0435\u0442\u0435\u0432\u043e\u0433\u043e \u0440\u043e\u0443\u0442\u0435\u0440\u0430 \u043c\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u043c\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u043e\u0432 \u0434\u043b\u044f TRex, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432\u0441\u0442\u0430\u043b \u0432\u043e\u043f\u0440\u043e\u0441 \u043f\u043e \u0438\u0445 \u043f\u0440\u043e\u0433\u043e\u043d\u0443 \u0432 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e python. \u041a\u0430\u043a \u043c\u044b \u044d\u0442\u043e \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u043b\u0438: <\/p>\n<p>  \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0438 TRex-\u0441\u0435\u0440\u0432\u0435\u0440 \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 stl:<\/p>\n<pre><code class=\"bash\">cd v2.XX sudo .\/t-rex-64 -i --stl<\/code><\/pre>\n<p>  \u0417\u0430\u0434\u0430\u043b\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f python, \u0442\u0430\u043a \u043a\u0430\u043a TRex \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u0441\u0432\u044f\u0437\u043a\u0435 \u0441 python.<\/p>\n<p>  export PYTHONPATH=\/home\/!!!user!!!\/v2.XX\/automation\/trex_control_plane\/interactive, \u0433\u0434\u0435 \u00ab!!!user!!!\u00bb \u2014 \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u0434\u043e\u043c\u0430\u0448\u043d\u044f\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f, v2.XX \u2014 \u0432\u0435\u0440\u0441\u0438\u044f \u041f\u041e TRex, \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u0430\u044f \u0438 \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0432 \u0434\u0430\u043d\u043d\u0443\u044e \u043f\u0430\u043f\u043a\u0443. <\/p>\n<p>  \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e python, \u043b\u0438\u0441\u0442\u0438\u043d\u0433 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043d\u0438\u0436\u0435.<\/p>\n<p>  python example_test_2bidirectstream.py<\/p>\n<p>  \u041e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<pre><code class=\"bash\">Transmit: 10000.24576MByte\/s Receive: 10000.272384MByte\/s Stream 1 TX: 4487179200 Bit\/s RX: 4487179200 Bit\/s Stream 2 TX: 2492873600 Bit\/s RX: 2492873600 Bit\/s Stream 3 TX: 1994294400 Bit\/s RX: 1994294400 Bit\/s Stream 4 TX: 997147200 Bit\/s RX: 997147200 Bit\/s<\/code><\/pre>\n<p>  \u0420\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p>  c = STLClient(server = &#8216;127.0.0.1&#8217;)<\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a TRex-\u0441\u0435\u0440\u0432\u0435\u0440\u0443, \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u043a \u0442\u043e\u0439 \u0436\u0435 \u043c\u0430\u0448\u0438\u043d\u0435, \u0433\u0434\u0435 \u0438 \u0441\u0435\u0440\u0432\u0435\u0440.<\/p>\n<ul>\n<li>\u00abbase_pkt_dir_a, base_pkt_dir_b, base_pkt_dir_c, base_pkt_dir_d\u00bb \u2014 \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u043f\u0430\u043a\u0435\u0442\u043e\u0432, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u0430\u0434\u0440\u0435\u0441\u0430 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044f, \u0438 \u043f\u043e\u0440\u0442\u044b \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044f. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f 4 \u043f\u043e\u0442\u043e\u043a\u0430, 2 \u0432 \u043e\u0434\u043d\u0443 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u0438 2 \u0432 \u043e\u0431\u0440\u0430\u0442\u043d\u0443\u044e.<\/li>\n<li>\u00abs1, s2, s3, s4\u00bb \u2014 \u0443 \u043a\u043b\u0430\u0441\u0441\u0430 STLStream \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a ID \u043f\u043e\u0442\u043e\u043a\u0430 \u0438 bitrate, \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 ID1=4.5 \u0413\u0431\u0438\u0442\/\u0441, ID2=2.5 \u0413\u0431\u0438\u0442\/\u0441, ID3=2 \u0413\u0431\u0438\u0442\/\u0441, ID4=1 \u0413\u0431\u0438\u0442\/\u0441.<\/li>\n<\/ul>\n<p>  \u041b\u0438\u0441\u0442\u0438\u043d\u0433 \u0444\u0430\u0439\u043b\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 example_test_2bidirectstream.py<\/p>\n<pre><code class=\"bash\"># get TRex APIs from trex_stl_lib.api import *   c = STLClient(server = '127.0.0.1') c.connect()   try:     # create a base packet with scapy     base_pkt_dir_a = Ether()\/IP(src=&quot;16.0.0.1&quot;,dst=&quot;48.0.0.1&quot;)\/UDP(dport=5001,sport=50001)     base_pkt_dir_b = Ether()\/IP(src=&quot;48.0.0.1&quot;,dst=&quot;16.0.0.1&quot;)\/UDP(dport=50001,sport=5001)       base_pkt_dir_c = Ether()\/IP(src=&quot;16.0.0.2&quot;,dst=&quot;48.0.0.2&quot;)\/UDP(dport=5002,sport=50002)     base_pkt_dir_d = Ether()\/IP(src=&quot;48.0.0.2&quot;,dst=&quot;16.0.0.2&quot;)\/UDP(dport=50002,sport=5002)       # pps : float     # Packets per second     #     # bps_L1 : float     # Bits per second L1 (with IPG)     #     # bps_L2 : float     # Bits per second L2 (Ethernet-FCS)     packet_size = 1400       def pad(base_pkt):         pad = (packet_size - len(base_pkt)) * 'x'         return pad       s1 = STLStream(packet=STLPktBuilder(base_pkt_dir_a\/pad(base_pkt_dir_a)), mode=STLTXCont(bps_L2=4500000000), flow_stats=STLFlowStats(pg_id=1))     s2 = STLStream(packet=STLPktBuilder(base_pkt_dir_b\/pad(base_pkt_dir_b)), mode=STLTXCont(bps_L2=2500000000), flow_stats=STLFlowStats(pg_id=2))     s3 = STLStream(packet=STLPktBuilder(base_pkt_dir_c\/pad(base_pkt_dir_c)), mode=STLTXCont(bps_L2=2000000000), flow_stats=STLFlowStats(pg_id=3))     s4 = STLStream(packet=STLPktBuilder(base_pkt_dir_d\/pad(base_pkt_dir_d)), mode=STLTXCont(bps_L2=1000000000), flow_stats=STLFlowStats(pg_id=4))       my_ports = [0, 1]       c.reset(ports = [my_ports[0], my_ports[1]])       # add the streams     c.add_streams(s1, ports = my_ports[0])     c.add_streams(s2, ports = my_ports[1])     c.add_streams(s3, ports = my_ports[0])     c.add_streams(s4, ports = my_ports[1])       # start traffic with limit of 10 seconds (otherwise it will continue forever)     # bi direction     testduration = 10     c.start(ports=[my_ports[0], my_ports[1]], duration=testduration)     # hold until traffic ends     c.wait_on_traffic()       # check out the stats     stats = c.get_stats()       # get global stats     totalstats = stats['global']     totaltx = round(totalstats.get('tx_bps'))     totalrx = round(totalstats.get('rx_bps'))     print('Transmit: {}MByte\/s Receive: {}MByte\/s'.format((totaltx \/ 1000000), (totalrx \/ 1000000)))     c.clear_stats(ports = [my_ports[0], my_ports[1]])       # get flow stats     totalstats = stats['flow_stats']     stream1 = totalstats[1]       stream2 = totalstats[2]     stream3 = totalstats[3]     stream4 = totalstats[4]     totaltx_1 = stream1.get('tx_pkts')     totalrx_1 = stream1.get('rx_pkts')     print('Stream 1 TX: {} Bit\/s RX: {} Bit\/s'.format((totaltx_1['total'] \/ testduration * packet_size * 8),                                                                (totalrx_1['total'] \/ testduration * packet_size * 8)))     totaltx_2 = stream2.get('tx_pkts')     totalrx_2 = stream2.get('rx_pkts')     print('Stream 2 TX: {} Bit\/s RX: {} Bit\/s'.format((totaltx_2['total'] \/ testduration * packet_size * 8),                                                                (totalrx_2['total'] \/ testduration * packet_size * 8)))     totaltx_3 = stream3.get('tx_pkts')     totalrx_3 = stream3.get('rx_pkts')     print('Stream 3 TX: {} Bit\/s RX: {} Bit\/s'.format((totaltx_3['total'] \/ testduration * packet_size * 8),                                                                (totalrx_3['total'] \/ testduration * packet_size * 8)))     totaltx_4 = stream4.get('tx_pkts')     totalrx_4 = stream4.get('rx_pkts')     print('Stream 4 TX: {} Bit\/s RX: {} Bit\/s'.format((totaltx_4['total'] \/ testduration * packet_size * 8),                                                                (totalrx_4['total'] \/ testduration * packet_size * 8))) except STLError as e:     print(e)   finally:     c.disconnect() <\/code><\/pre>\n<p>  <\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  \u041f\u0440\u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0435 \u044d\u0442\u043e\u0433\u043e \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430 \u0434\u043b\u044f \u0425\u0430\u0431\u0440\u0430 \u043c\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0438 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441\u0438\u0441\u0442\u0435\u043c\u044b DUT \u0441 4 \u043f\u043e\u0442\u043e\u043a\u0430\u043c\u0438, \u0441\u043e\u0431\u0440\u0430\u043b\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043f\u043e \u043f\u043e\u0442\u043e\u043a\u0430\u043c \u0438 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443. <\/p>\n<p>  \u041e\u043f\u0438\u0441\u0430\u043d\u043d\u0430\u044f \u0432\u044b\u0448\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e python, \u0437\u043d\u0430\u0447\u0438\u0442 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e TRex \u043c\u043e\u0436\u043d\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u043e\u0442\u043b\u0430\u0434\u043a\u0443 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432 \u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0445 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u043e\u0432 \u2014 \u0432 \u0446\u0438\u043a\u043b\u0435 \u0438\u043b\u0438 \u043f\u0440\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0442\u0435\u0441\u0442\u043e\u0432 \u043d\u0430 python.<\/p>\n<p>  \u0422\u0430\u043a \u0447\u0435\u043c \u0436\u0435 TRex \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 Cisco \u043b\u0443\u0447\u0448\u0435 \u0438\u043b\u0438 \u0445\u0443\u0436\u0435 \u0434\u0440\u0443\u0433\u0438\u0445 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0445 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 \u0442\u0440\u0430\u0444\u0438\u043a\u0430? \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0439 \u043a\u043b\u0438\u0435\u043d\u0442-\u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b iperf? \u0412 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f TRex \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043f\u043e\u0442\u043e\u043a\u0430\u043c\u0438. \u041e\u0431\u0430 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u0445\u043e\u0440\u043e\u0448\u0438: iperf \u2014 \u0434\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043d\u0430 \u0445\u043e\u0434\u0443, \u0430 TRex \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432 \u0438 \u0441\u0438\u0441\u0442\u0435\u043c, \u0433\u0434\u0435 \u0432\u0430\u0436\u043d\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u044b\u0445 \u0441\u0442\u0440\u0438\u043c\u043e\u0432, \u0447\u0442\u043e\u0431\u044b \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435. <\/p>\n<p>  TRex \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043b\u044e\u0431\u043e\u0433\u043e \u0432\u0438\u0434\u0430 \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u0438 \u0443\u0441\u0438\u043b\u0438\u0432\u0430\u0442\u044c \u0438\u0445 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u0440\u0443\u043f\u043d\u043e\u043c\u0430\u0441\u0448\u0442\u0430\u0431\u043d\u044b\u0445 DDoS-\u0430\u0442\u0430\u043a, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 TCP-SYN, UDP \u0438 ICMP-\u043f\u043e\u0442\u043e\u043a\u043e\u0432. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0430\u0442\u0430\u043a\u0438 \u043e\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u043d\u0430 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0446\u0435\u043b\u0435\u0432\u044b\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432.<\/p>\n<p>  \u0422\u0430\u043a \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0432\u044b \u0435\u0449\u0435 \u043d\u0435 \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b\u0438 \u044d\u0442\u043e\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u2014 \u043c\u043e\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c \u043d\u0430 \u0437\u0430\u043c\u0435\u0442\u043a\u0443. \u0410 \u0435\u0441\u043b\u0438 \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b\u0438 \u2014 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u0435\u0441\u044c \u0441\u0432\u043e\u0438\u043c\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u0438 \u043e\u0442\u0437\u044b\u0432\u0430\u043c\u0438 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445. \u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c, \u0447\u0442\u043e \u043e TRex \u0434\u0443\u043c\u0430\u044e\u0442 \u0438 \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043a\u043e\u043b\u043b\u0435\u0433\u0438-\u0438\u043d\u0436\u0435\u043d\u0435\u0440\u044b.<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/510086\/\"> https:\/\/habr.com\/ru\/post\/510086\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/510086\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/vm\/jy\/z0\/vmjyz0syr7vtnlybsggog5mx6z8.jpeg\"><\/p>\n<p>  \u041f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0433\u043e \u0440\u043e\u0443\u0442\u0435\u0440\u0430 \u043c\u044b \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u0435\u0442\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439 open-source-\u0448\u0442\u0443\u043a\u0438 \u2014 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0442\u0440\u0430\u0444\u0438\u043a\u0430 Cisco TRex. \u0427\u0442\u043e \u044d\u0442\u043e \u0437\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442? \u041a\u0430\u043a \u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f? \u0418 \u0447\u0435\u043c \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u0430\u043c-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c? \u041f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c \u2014 \u043e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u044d\u0442\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u044b.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-306840","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/306840","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=306840"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/306840\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=306840"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=306840"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=306840"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}