From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E19BBA0093; Tue, 8 Nov 2022 16:16:33 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D9E6442D35; Tue, 8 Nov 2022 16:16:33 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 4E449400D4 for ; Tue, 8 Nov 2022 16:16:31 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667920591; x=1699456591; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5jEzd5zCHccX1RXHnQnhphb9pWujxQ9V5bIN80daoZY=; b=bZtAmECYC2KFJUlipR77GFRcNxHcsqsV7enrZHvobixeRkRWeIvporOd a2D782hb0BFqRybuqIrYsutP3gE1XxDnN/O2+lwKdouzz3JM6Vuouk/qx HGZmjj6GC7XlWekKJ6t+0N9p2/Aigj3VesHZRp6kGefwcIQalDZABjyUl RsRbpBqWRW6U+SApd3rMS5lrmIT8jVIve/aTPrRV2S1ezCCUF6LKxdAwp kKswceAyO/IzDZ87yU/7eOb2N4vGm6h3i+O+Ae8hBWrdoJqTWKoauYPKR fESsTpEeTNV5uQWhjkcue4nZYPE+WZqI/MzW956Nelaj61Taqr4d8m7RA A==; X-IronPort-AV: E=McAfee;i="6500,9779,10525"; a="310715260" X-IronPort-AV: E=Sophos;i="5.96,148,1665471600"; d="scan'208";a="310715260" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Nov 2022 07:06:46 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10525"; a="638816570" X-IronPort-AV: E=Sophos;i="5.96,148,1665471600"; d="scan'208";a="638816570" Received: from ena3-s2600wft.iind.intel.com ([10.235.221.73]) by fmsmga007.fm.intel.com with ESMTP; 08 Nov 2022 07:06:43 -0800 From: Yogesh Jangra To: dts@dpdk.org Cc: cristian.dumitrescu@intel.com, kamalakannan.r@intel.com, harshad.suresh.narayane@intel.com Subject: [PATCH 1/3] test/metering_and_policing: removed the test suite as per dpdk changes Date: Tue, 8 Nov 2022 20:36:34 +0530 Message-Id: <20221108150636.2459852-2-yogesh.jangra@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221108150636.2459852-1-yogesh.jangra@intel.com> References: <20221108150636.2459852-1-yogesh.jangra@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org Metering and Policing testsuite used the Soft NIC driver. In dpdk 22.11 release Soft NIC driver is using rte_swx_pipeline_xxx library. Support for the metering CLI has been removed. So removed the test suite and dependencies related to that. Signed-off-by: Yogesh Jangra --- dep/meter_and_policy_config.tar.gz | Bin 1182 -> 0 bytes test_plans/index.rst | 1 - .../metering_and_policing_test_plan.rst | 914 ------------ tests/TestSuite_metering_and_policing.py | 1296 ----------------- 4 files changed, 2211 deletions(-) delete mode 100644 dep/meter_and_policy_config.tar.gz delete mode 100644 test_plans/metering_and_policing_test_plan.rst delete mode 100644 tests/TestSuite_metering_and_policing.py diff --git a/dep/meter_and_policy_config.tar.gz b/dep/meter_and_policy_config.tar.gz deleted file mode 100644 index f704aa425d2f21dbf9e7d18ee2f70a2f704551e6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1182 zcmb2|=3wwIdlAdP{C1{y{%s3^)KJsBc~0#^;`Y5Fx?(r4wcq1$U6ic2 zZONn(p|6+UXC$fDY4nBKe>(7|A>hQB531+p%NaK_jOX9aeh^@+(b{gXnN%UTjM+8-P`J<+c1UcdW&*NnB& zvvP_|Z5CcUo_xlsK=OsPtnVB)^CR}Tv37lmXFeDAY?^G*Jo(w(%-#3-_K2wOy(q_L zzVk4{d#$cnKXT4lRSI@kTQZ!V=Fb?%#aMCAcTN5S=T))y)0n5LO|+P|v}SvxT(R-F z$FI|J3JQ{EOWc^lW_H|v_0lOP3#a)1^1LH@JaF2wzd?3)g9~r{YuMa0J;C|}58Ls3 z7Tu-gR$8;p-aVhU)5N@Xn(gt0d*4laoo7$9rey287OO?2JI(2EpC9w> zr2G7+Z!6vB?|<`Iy0<;}SDX4W-$_Rs-s?;A=<8&*}M;+rO|VxhT*s zx3(vBa=cWN{^rcWUB`ZA)lX^fEvj%klIpYn!s5WP>ZJCm>`H0OVO39~)%D7H`PFN;e|{kQVBcYzgVX087QMIM@|~Ez(c-nOUEx;cl3&br^Hgbf#;W<}D~8YS znJ9f^1#i-yt21`y%nRNfy+`sI>uIZltNb>^3)<*&zE+$5yC`hm87{^zVXOhQ5yp%m z@|S%W>W;4Z@NVvua&H-baf#QC7Lq$>zBw)3dTeD?aM9&+n-*=pwPo|F7jN=!?c8JA z?$&PTRT-CMrF(qkhp%!qzgPXAw=$#5=(zFM{rb`Wg8trrwZ%H-zkJj6!2j<*b2~iW z_m4lW^5^s66PjpM753rWv)xu218-4vK5-;fuD} zyGy9;X46vc6#ZhG;QyU{Imv&;H5Oex^ou|G;Me<#H*)`~e-IP8vo9k0{~yo)KP=Z? zu3fo*-oKBh6IRwQReAki;7#2B@EcxPqFe2@O?m@?U2h=J?q=<#-zncu{@Zu_{;}%) z+kQRw|7C7i?72_WO_4%BBAurq2K0D8B)0Ong9}*p$VrPcs}XqkzmM^P9c|PpIR% r tester_port_0 - dut_port_1 <---> tester_port_1 - dut_port_2 <---> tester_port_2 - dut_port_3 <---> tester_port_3 - -Assume four DUT 10G Ethernet ports' pci device id is as the following, - - :: - - dut_port_0 : "0000:05:00.0" - dut_port_1 : "0000:05:00.1" - dut_port_2 : "0000:05:00.2" - dut_port_3 : "0000:05:00.3" - -Bind them to dpdk igb_uio driver, - - :: - - ./usertools/dpdk-devbind.py -b igb_uio 05:00.0 05:00.1 - -1. change ./drivers/net/softnic/firmware.cli to meet the specific test environment. - - :: - - link LINK0 dev 0000:05:00.0 - link LINK1 dev 0000:05:00.1 - link LINK2 dev 0000:05:00.2 - link LINK3 dev 0000:05:00.3 - - pipeline RX period 10 offset_port_id 0 - pipeline RX port in bsz 32 link LINK0 rxq 0 - pipeline RX port in bsz 32 link LINK1 rxq 0 - pipeline RX port in bsz 32 link LINK2 rxq 0 - pipeline RX port in bsz 32 link LINK3 rxq 0 - pipeline RX port out bsz 32 swq RXQ0 - pipeline RX port out bsz 32 swq RXQ1 - pipeline RX port out bsz 32 swq RXQ2 - pipeline RX port out bsz 32 swq RXQ3 - - table action profile AP0 ipv4 offset 270 fwd meter trtcm tc 1 stats pkts - pipeline RX table match acl ipv4 offset 270 size 4K action AP0 - ;pipeline RX table 0 dscp /root/dpdk/drivers/net/softnic/dscp_yellow.sh - pipeline RX port in 0 table 0 - pipeline RX port in 1 table 0 - pipeline RX port in 2 table 0 - pipeline RX port in 3 table 0 - flowapi map group 0 ingress pipeline RX table 0 - - pipeline TX period 10 offset_port_id 0 - pipeline TX port in bsz 32 swq TXQ0 - pipeline TX port in bsz 32 swq TXQ1 - pipeline TX port in bsz 32 swq TXQ2 - pipeline TX port in bsz 32 swq TXQ3 - pipeline TX port out bsz 32 link LINK0 txq 0 - pipeline TX port out bsz 32 link LINK1 txq 0 - pipeline TX port out bsz 32 link LINK2 txq 0 - pipeline TX port out bsz 32 link LINK3 txq 0 - pipeline TX table match stub - pipeline TX table match stub - pipeline TX table match stub - pipeline TX table match stub - - pipeline TX port in 0 table 0 - pipeline TX port in 1 table 1 - pipeline TX port in 2 table 2 - pipeline TX port in 3 table 3 - pipeline TX table 0 rule add match default action fwd port 0 - pipeline TX table 1 rule add match default action fwd port 1 - pipeline TX table 2 rule add match default action fwd port 2 - pipeline TX table 3 rule add match default action fwd port 3 - - thread 4 pipeline RX enable - thread 4 pipeline TX enable - -2. start softnic with following command line, - - :: - - ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x1f -s 0x10 -n 4 \ - --vdev 'net_softnic0,firmware=./drivers/net/softnic/firmware.cli' \ - -- -i --portmask=0x10 --disable-rss - testpmd> start - -3. start softnic with default hierarchy Qos with following command line, - - :: - - ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x1f -s 0x10 -n 4 \ - --vdev 'net_softnic0,firmware=./drivers/net/softnic/firmware.cli' \ - -- -i --portmask=0x10 --disable-rss - testpmd> set port tm hierarchy default 1 - testpmd> start - -Test Case 1: ipv4 ACL table RFC2698 GYR ---------------------------------------- -1. Edit meter_and_policing_firmware.cli to change "table action" and "pipeline table" as below, - - :: - - table action profile AP0 ipv4 offset 270 fwd meter trtcm tc 1 stats pkts - pipeline RX table match acl ipv4 offset 270 size 4K action AP0 - flowapi map group 0 ingress pipeline RX table 0 - -2. Start softnic, - - :: - - ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x7 -s 0x4 -n 4 --vdev 'net_softnic0,firmware=/root/dpdk/drivers/net/softnic/meter_and_policing_firmware.cli' -- -i --rxq=2 --txq=2 --portmask=0x4 --disable-rss - - Add rules to table, set CBS to 400 bytes, PBS to 500 bytes - - :: - - testpmd> add port meter profile trtcm_rfc2698 2 0 3125000000 3125000000 400 500 0 - testpmd> add port meter policy 2 0 g_actions color type green / end y_actions color type yellow / end r_actions color type red / end - testpmd> create port meter 2 0 0 0 yes 0 0 0 - testpmd> flow create 2 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 dst mask 255.255.255.255 src spec 1.10.11.12 dst spec 2.20.21.22 proto spec 6 / tcp src mask 65535 dst mask 65535 src spec 2 dst spec 2 / end actions meter mtr_id 0 / queue index 0 / end - testpmd> start - -3. Configure the packets with specified src/dst IP address and TCP dport/sport. - - a. send a packet larger than PBS - :: - - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*461)], iface="enp131s0f3") - - The packet was forwarded to port 0. - - b. send a packet not larger than PBS but larger than CBS - :: - - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*460)], iface="enp131s0f3") - - The packet was forwarded to port 0. - - c. send a packet not larger than CBS - :: - - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*360)], iface="enp131s0f3") - - The packet was forwarded to port 0. - -**Notes**: the CBS/PBS includes IP header(20 bytes) and TCP header(20 bytes). -So when the payload is 460 bytes, the IP packet is 500 bytes. - - -Test Case 2: ipv4 ACL table RFC2698 GYD ---------------------------------------- -1. Edit meter_and_policing_firmware.cli to change "table action" and "pipeline table" as below, - - :: - - table action profile AP0 ipv4 offset 270 fwd meter trtcm tc 1 stats pkts - pipeline RX table match acl ipv4 offset 270 size 4K action AP0 - flowapi map group 0 ingress pipeline RX table 0 - -2. Start softnic, - - :: - - ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x7 -s 0x4 -n 4 --vdev 'net_softnic0,firmware=/root/dpdk/drivers/net/softnic/meter_and_policing_firmware.cli' -- -i --rxq=2 --txq=2 --portmask=0x4 --disable-rss - - Add rules to table, set CBS to 400 bytes, PBS to 500 bytes - :: - - testpmd> add port meter profile trtcm_rfc2698 2 0 3125000000 3125000000 400 500 0 - testpmd> add port meter policy 2 0 g_actions color type green / end y_actions color type yellow / end r_actions drop / end - testpmd> create port meter 2 0 0 0 yes 0 0 0 - testpmd> flow create 2 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 dst mask 255.255.255.255 src spec 1.10.11.12 dst spec 2.20.21.22 proto spec 6 / tcp src mask 65535 dst mask 65535 src spec 2 dst spec 2 / end actions meter mtr_id 0 / queue index 0 / end - testpmd> start - -3. Configure the packets with specified src/dst IP address and TCP dport/sport. - - a. send a packet larger than PBS - :: - - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*461)], iface="enp131s0f3") - - The packet was dropped. - - b. send a packet not larger than PBS but larger than CBS - :: - - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*460)], iface="enp131s0f3") - - The packet was forwarded to port 0. - - - c. send a packet not larger than CBS - :: - - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*360)], iface="enp131s0f3") - - The packet was forwarded to port 0. - -Test Case 3: ipv4 ACL table RFC2698 GDR ---------------------------------------- -1. Edit meter_and_policing_firmware.cli to change "table action" and "pipeline table" as below, - - :: - - table action profile AP0 ipv4 offset 270 fwd meter trtcm tc 1 stats pkts - pipeline RX table match acl ipv4 offset 270 size 4K action AP0 - flowapi map group 0 ingress pipeline RX table 0 - -2. Start softnic, - - :: - - ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x7 -s 0x4 -n 4 --vdev 'net_softnic0,firmware=/root/dpdk/drivers/net/softnic/meter_and_policing_firmware.cli' -- -i --rxq=2 --txq=2 --portmask=0x4 --disable-rss - - Add rules to table, set CBS to 400 bytes, PBS to 500 bytes - :: - - testpmd> add port meter profile trtcm_rfc2698 2 0 3125000000 3125000000 400 500 0 - testpmd> add port meter policy 2 0 g_actions color type green / end y_actions drop / end r_actions color type red / end - testpmd> create port meter 2 0 0 0 yes 0 0 0 - testpmd> flow create 2 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 dst mask 255.255.255.255 src spec 1.10.11.12 dst spec 2.20.21.22 proto spec 132 / sctp src mask 65535 dst mask 65535 src spec 2 dst spec 2 / end actions meter mtr_id 0 / queue index 1 / end - testpmd> start - -3. Configure the packets with specified src/dst IP address and SCTP dport/sport. - - a. send a packet larger than PBS - :: - - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=132)/SCTP(sport=2,dport=2)/Raw(load="P"*469)], iface="enp131s0f3") - - The packet was forwarded to port 1. - - b. send a packet not larger than PBS but larger than CBS - :: - - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=132)/SCTP(sport=2,dport=2)/Raw(load="P"*468)], iface="enp131s0f3") - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=132)/SCTP(sport=2,dport=2)/Raw(load="P"*369)], iface="enp131s0f3") - - The packets was dropped. - - c. send a packet not larger than CBS - :: - - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=132)/SCTP(sport=2,dport=2)/Raw(load="P"*368)], iface="enp131s0f3") - - The packet was forwarded to port 1. - -**Notes**: the CBS/PBS includes IP header(20 bytes) and SCTP header(12 bytes). -So when the payload is 468 bytes, the IP packet is 500 bytes. - -Test Case 4: ipv4 ACL table RFC2698 DYR ---------------------------------------- -1. Edit meter_and_policing_firmware.cli to change "table action" and "pipeline table" as below, - - :: - - table action profile AP0 ipv4 offset 270 fwd meter trtcm tc 1 stats pkts - pipeline RX table match acl ipv4 offset 270 size 4K action AP0 - flowapi map group 0 ingress pipeline RX table 0 - -2. Start softnic, - - :: - - ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x7 -s 0x4 -n 4 --vdev 'net_softnic0,firmware=/root/dpdk/drivers/net/softnic/meter_and_policing_firmware.cli' -- -i --rxq=2 --txq=2 --portmask=0x4 --disable-rss - - Add rules to table, set CBS to 400 bytes, PBS to 500 bytes - :: - - testpmd> add port meter profile trtcm_rfc2698 2 0 3125000000 3125000000 400 500 0 - testpmd> add port meter policy 2 0 g_actions drop / end y_actions color type yellow / end r_actions color type red / end - testpmd> create port meter 2 0 0 0 yes 0 0 0 - testpmd> flow create 2 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 dst mask 255.255.255.255 src spec 1.10.11.12 dst spec 2.20.21.22 proto spec 17 / udp src mask 65535 dst mask 65535 src spec 2 dst spec 2 / end actions meter mtr_id 0 / queue index 0 / end - testpmd> start - -3. Configure the packets with specified src/dst IP address and TCP dport/sport. - - a. send a packet larger than PBS - :: - - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=17)/UDP(sport=2,dport=2)/Raw(load="P"*473)], iface="enp131s0f3") - - The packet was forwarded to port 0. - - b. send a packet not larger than PBS but larger than CBS - :: - - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=17)/UDP(sport=2,dport=2)/Raw(load="P"*373)], iface="enp131s0f3") - - The packet was forwarded to port 0. - - c. send a packet not larger than CBS - :: - - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=17)/UDP(sport=2,dport=2)/Raw(load="P"*372)], iface="enp131s0f3") - - The packet was dropped. - -**Notes**: the CBS/PBS includes IP header(20 bytes) and UDP header(8 bytes). -So when the payload is 472 bytes, the IP packet is 500 bytes. - -Test Case 5: ipv4 ACL table RFC2698 DDD ---------------------------------------- -1. Edit meter_and_policing_firmware.cli to change "table action" and "pipeline table" as below, - - :: - - table action profile AP0 ipv4 offset 270 fwd meter trtcm tc 1 stats pkts - pipeline RX table match acl ipv4 offset 270 size 4K action AP0 - flowapi map group 0 ingress pipeline RX table 0 - -2. Start softnic, - - :: - - ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x7 -s 0x4 -n 4 --vdev 'net_softnic0,firmware=/root/dpdk/drivers/net/softnic/meter_and_policing_firmware.cli' -- -i --rxq=2 --txq=2 --portmask=0x4 --disable-rss - - Add rules to table, set CBS to 400 bytes, PBS to 500 bytes - :: - - testpmd> add port meter profile trtcm_rfc2698 2 0 3125000000 3125000000 400 500 0 - testpmd> add port meter policy 2 0 g_actions drop / end y_actions drop / end r_actions drop / end - testpmd> create port meter 2 0 0 0 yes 0 0 0 - testpmd> flow create 2 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 dst mask 255.255.255.255 src spec 1.10.11.12 dst spec 2.20.21.22 proto spec 6 / tcp src mask 65535 dst mask 65535 src spec 2 dst spec 2 / end actions meter mtr_id 0 / queue index 0 / end - testpmd> start - -3. Configure the packets with specified src/dst IP address and TCP dport/sport. - - a. send a packet larger than PBS - :: - - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*461)], iface="enp131s0f3") - - The packet was dropped. - - b. send a packet not larger than PBS but larger than CBS - :: - - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*460)], iface="enp131s0f3") - - The packet was dropped. - - c. send a packet not larger than CBS - :: - - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*360)], iface="enp131s0f3") - - The packet was dropped. - -Test Case 6: ipv4 with same CBS and PBS GDR -------------------------------------------- -1. Edit meter_and_policing_firmware.cli to change "table action" and "pipeline table" as below, - - :: - - table action profile AP0 ipv4 offset 270 fwd meter trtcm tc 1 stats pkts - pipeline RX table match acl ipv4 offset 270 size 4K action AP0 - flowapi map group 0 ingress pipeline RX table 0 - -2. Start softnic, - - :: - - ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x7 -s 0x4 -n 4 --vdev 'net_softnic0,firmware=/root/dpdk/drivers/net/softnic/meter_and_policing_firmware.cli' -- -i --rxq=2 --txq=2 --portmask=0x4 --disable-rss - - Add rules to table, set CBS to 400 bytes, PBS to 500 bytes - :: - - testpmd> add port meter profile trtcm_rfc2698 2 0 3125000000 3125000000 500 500 0 - testpmd> add port meter policy 2 0 g_actions color type green / end y_actions drop / end r_actions color type red / end - testpmd> create port meter 2 0 0 0 yes 0 0 0 - testpmd> flow create 2 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 dst mask 255.255.255.255 src spec 1.10.11.12 dst spec 2.20.21.22 proto spec 6 / tcp src mask 65535 dst mask 65535 src spec 2 dst spec 2 / end actions meter mtr_id 0 / queue index 0 / end - testpmd> start - -3. Configure the packets with specified src/dst IP address and TCP dport/sport. - - a. send a packet larger than PBS - :: - - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*461)], iface="enp131s0f3") - - The packet was forwarded to port 0. - - b. send a packet not larger than PBS - :: - - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*460)], iface="enp131s0f3") - - The packet was forwarded to port 0. - -Test Case 7: ipv4 HASH table RFC2698 ------------------------------------- -1. Edit meter_and_policing_firmware.cli to change "table action" and "pipeline table" as below, - - :: - - table action profile AP0 ipv4 offset 270 fwd meter trtcm tc 1 stats pkts - pipeline RX table match hash ext key 16 mask 00FF0000FFFFFFFFFFFFFFFFFFFFFFFF offset 278 buckets 16K size 65K action AP0 - flowapi map group 0 ingress pipeline RX table 0 - -2. Start softnic, - - :: - - ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x7 -s 0x4 -n 4 --vdev 'net_softnic0,firmware=/root/dpdk/drivers/net/softnic/meter_and_policing_firmware.cli' -- -i --rxq=2 --txq=2 --portmask=0x4 --disable-rss - - Add rules to table, - :: - - testpmd> add port meter profile trtcm_rfc2698 2 0 3125000000 3125000000 400 500 0 - a)GYR - testpmd> add port meter policy 2 0 g_actions color type green / end y_actions color type yellow / end r_actions color type red / end - testpmd> create port meter 2 0 0 0 yes 0 0 0 - b)GYD - testpmd> add port meter policy 2 0 g_actions color type green / end y_actions color type yellow / end r_actions drop / end - testpmd> create port meter 2 0 0 0 yes 0 0 0 - c)GDR - testpmd> add port meter policy 2 0 g_actions color type green / end y_actions drop / end r_actions color type red / end - testpmd> create port meter 2 0 0 0 yes 0 0 0 - d)DYR - testpmd> add port meter policy 2 0 g_actions drop / end y_actions color type yellow / end r_actions color type red / end - testpmd> create port meter 2 0 0 0 yes 0 0 0 - e)DDD - testpmd> add port meter policy 2 0 g_actions drop / end y_actions drop / end r_actions drop / end - testpmd> create port meter 2 0 0 0 yes 0 0 0 - testpmd> flow create 2 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 dst mask 255.255.255.255 src spec 1.10.11.12 dst spec 2.20.21.22 proto spec 6 / tcp src mask 65535 dst mask 65535 src spec 2 dst spec 2 / end actions meter mtr_id 0 / queue index 0 / end - testpmd> start - -3. Configure the packets with specified src/dst IP address and TCP dport/sport. Send packets same as ACL table, there will be the same result with ACL table. - -Test Case 8: ipv6 ACL table RFC2698 ------------------------------------ -1. Edit meter_and_policing_firmware.cli to change "table action" and "pipeline table" as below, - - :: - - table action profile AP0 ipv6 offset 270 fwd meter trtcm tc 1 stats pkts - pipeline RX table match acl ipv6 offset 270 size 4K action AP0 - flowapi map group 0 ingress pipeline RX table 0 - -2. Start softnic, - - :: - - ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x7 -s 0x4 -n 4 --vdev 'net_softnic0,firmware=/root/dpdk/drivers/net/softnic/meter_and_policing_firmware.cli' -- -i --rxq=2 --txq=2 --portmask=0x4 --disable-rss - - Add rules to table, - :: - - testpmd> add port meter profile trtcm_rfc2698 2 0 3125000000 3125000000 400 500 0 - testpmd> add port meter policy 2 0 g_actions color type green / end y_actions color type yellow / end r_actions drop / end - testpmd> create port meter 2 0 0 0 yes 0 0 0 - testpmd> add port meter policy 2 1 g_actions drop / end y_actions color type yellow / end r_actions color type red / end - testpmd> create port meter 2 1 0 1 yes 0 0 0 - testpmd> flow create 2 group 0 ingress pattern eth / ipv6 proto mask 255 src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask 0:0:0:0:0:0:0:0 src spec ABCD:EF01:2345:6789:ABCD:EF01:2345:5789 dst spec 0:0:0:0:0:0:0:0 proto spec 6 / tcp src mask 65535 dst mask 65535 src spec 2 dst spec 2 / end actions meter mtr_id 0 / queue index 0 / end - testpmd> flow create 2 group 0 ingress pattern eth / ipv6 proto mask 255 src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask 0:0:0:0:0:0:0:0 src spec ABCD:EF01:2345:6789:ABCD:EF01:2345:5789 dst spec 0:0:0:0:0:0:0:0 proto spec 17 / udp src mask 65535 dst mask 65535 src spec 2 dst spec 2 / end actions meter mtr_id 1 / queue index 1 / end - testpmd> start - testpmd> flow list 2 - ID Group Prio Attr Rule - 0 0 0 i-- ETH IPV6 TCP => METER QUEUE - 1 0 0 i-- ETH IPV6 UDP => METER QUEUE - -3. Configure the packets with specified src/dst IPv6 address and TCP dport/sport. - - :: - - sendp([Ether(dst="00:00:00:00:01:00")/IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:5789",dst="2001::1",nh=6)/TCP(sport=2,dport=2)/Raw(load="P"*441)], iface="enp131s0f3") - The packet was dropped. - sendp([Ether(dst="00:00:00:00:01:00")/IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:5789",dst="2001::1",nh=6)/TCP(sport=2,dport=2)/Raw(load="P"*440)], iface="enp131s0f3") - The packet was forwarded to port 0. - sendp([Ether(dst="00:00:00:00:01:00")/IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:5789",dst="2001::1",nh=6)/TCP(sport=2,dport=2)/Raw(load="P"*340)], iface="enp131s0f3") - The packet was forwarded to port 0. - sendp([Ether(dst="00:00:00:00:01:00")/IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:5789",dst="2001::1",nh=17)/UDP(sport=2,dport=2)/Raw(load="P"*453)], iface="enp131s0f3") - The packet was forwarded to port 1. - sendp([Ether(dst="00:00:00:00:01:00")/IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:5789",dst="2001::1",nh=17)/UDP(sport=2,dport=2)/Raw(load="P"*353)], iface="enp131s0f3") - The packet was forwarded to port 1. - sendp([Ether(dst="00:00:00:00:01:00")/IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:5789",dst="2001::1",nh=17)/UDP(sport=2,dport=2)/Raw(load="P"*352)], iface="enp131s0f3") - The packet was dropped. - -**Notes**: TCP header covers 20 bytes, UDP header covers 8 bytes. -The CBS/PBS includes IPv6 header(40 bytes) and TCP/UDP header(20/8 bytes). -So when the payload of IPv6-TCP packet is 440 bytes, the IPv6 packet is 500 bytes. -When the payload of IPv6-UDP packet is 452 bytes, the IPv6 packet is 500 bytes. - -Test Case 9: multiple meter and profile ---------------------------------------- -1. Edit meter_and_policing_firmware.cli to change "table action" and "pipeline table" as below, - - :: - - table action profile AP0 ipv4 offset 270 fwd meter trtcm tc 1 stats pkts - pipeline RX table match acl ipv4 offset 270 size 4K action AP0 - flowapi map group 0 ingress pipeline RX table 0 - -2. Start softnic, configure 4 ports, - - :: - - ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x1f -s 0x10 -n 4 --vdev 'net_softnic0,firmware=/root/dpdk/drivers/net/softnic/meter_and_policing_firmware.cli' -- -i --rxq=4 --txq=4 --portmask=0x10 --disable-rss - - Add rules to table, set CBS to 400 bytes, PBS to 500 bytes - :: - - testpmd> add port meter profile trtcm_rfc2698 4 0 3125000000 3125000000 400 500 0 - testpmd> add port meter profile trtcm_rfc2698 4 1 3125000000 3125000000 300 400 0 - testpmd> add port meter policy 4 0 g_actions color type green / end y_actions color type yellow / end r_actions color type red / end - testpmd> create port meter 4 0 0 0 yes 0 0 0 - testpmd> add port meter policy 4 1 g_actions color type green / end y_actions color type yellow / end r_actions drop / end - testpmd> create port meter 4 1 0 1 yes 0 0 0 - testpmd> add port meter policy 4 2 g_actions color type green / end y_actions drop / end r_actions color type red / end - testpmd> create port meter 4 2 0 2 yes 0 0 0 - testpmd> add port meter policy 4 3 g_actions drop / end y_actions color type yellow / end r_actions color type red / end - testpmd> create port meter 4 3 0 3 yes 0 0 0 - testpmd> add port meter policy 4 4 g_actions color type green / end y_actions color type yellow / end r_actions drop / end - testpmd> create port meter 4 4 1 4 yes 0 0 0 - testpmd> add port meter policy 4 5 g_actions color type green / end y_actions drop / end r_actions color type red / end - testpmd> create port meter 4 5 1 5 yes 0 0 0 - testpmd> add port meter policy 4 6 g_actions drop / end y_actions color type yellow / end r_actions color type red / end - testpmd> create port meter 4 6 1 6 yes 0 0 0 - testpmd> add port meter policy 4 7 g_actions drop / end y_actions drop / end r_actions drop / end - testpmd> create port meter 4 7 1 7 yes 0 0 0 - testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 dst mask 255.255.255.255 src spec 1.10.11.12 dst spec 2.20.21.22 proto spec 6 / tcp src mask 65535 dst mask 65535 src spec 0 dst spec 0 / end actions meter mtr_id 0 / queue index 0 / end - testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 dst mask 255.255.255.255 src spec 1.10.11.12 dst spec 2.20.21.22 proto spec 6 / tcp src mask 65535 dst mask 65535 src spec 1 dst spec 1 / end actions meter mtr_id 1 / queue index 1 / end - testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 dst mask 255.255.255.255 src spec 1.10.11.12 dst spec 2.20.21.22 proto spec 6 / tcp src mask 65535 dst mask 65535 src spec 2 dst spec 2 / end actions meter mtr_id 2 / queue index 2 / end - testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 dst mask 255.255.255.255 src spec 1.10.11.12 dst spec 2.20.21.22 proto spec 6 / tcp src mask 65535 dst mask 65535 src spec 3 dst spec 3 / end actions meter mtr_id 3 / queue index 3 / end - testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 dst mask 255.255.255.255 src spec 1.10.11.12 dst spec 2.20.21.22 proto spec 6 / tcp src mask 65535 dst mask 65535 src spec 4 dst spec 4 / end actions meter mtr_id 4 / queue index 0 / end - testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 dst mask 255.255.255.255 src spec 1.10.11.12 dst spec 2.20.21.22 proto spec 6 / tcp src mask 65535 dst mask 65535 src spec 5 dst spec 5 / end actions meter mtr_id 5 / queue index 1 / end - testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 dst mask 255.255.255.255 src spec 1.10.11.12 dst spec 2.20.21.22 proto spec 6 / tcp src mask 65535 dst mask 65535 src spec 6 dst spec 6 / end actions meter mtr_id 6 / queue index 2 / end - testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 dst mask 255.255.255.255 src spec 1.10.11.12 dst spec 2.20.21.22 proto spec 6 / tcp src mask 65535 dst mask 65535 src spec 7 dst spec 7 / end actions meter mtr_id 128 / queue index 3 / end - testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 dst mask 255.255.255.255 src spec 1.10.11.12 dst spec 2.20.21.22 proto spec 6 / tcp src mask 65535 dst mask 65535 src spec 8 dst spec 8 / end actions meter mtr_id 128 / queue index 0 / end - the last flow can't be created successfully with "METER: Meter already attached to a flow: Invalid argument" - testpmd> start - testpmd> flow list 4 - ID Group Prio Attr Rule - 0 0 0 i-- ETH IPV4 TCP => METER QUEUE - 1 0 0 i-- ETH IPV4 TCP => METER QUEUE - 2 0 0 i-- ETH IPV4 TCP => METER QUEUE - 3 0 0 i-- ETH IPV4 TCP => METER QUEUE - 4 0 0 i-- ETH IPV4 TCP => METER QUEUE - 5 0 0 i-- ETH IPV4 TCP => METER QUEUE - 6 0 0 i-- ETH IPV4 TCP => METER QUEUE - 7 0 0 i-- ETH IPV4 TCP => METER QUEUE - -3. Configure the packets with specified src/dst IP address and TCP dport/sport. - - :: - - pkt1: sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=0,dport=0)/Raw(load="P"*461)], iface="enp131s0f3") - pkt2: sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=0,dport=0)/Raw(load="P"*460)], iface="enp131s0f3") - pkt3: sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=0,dport=0)/Raw(load="P"*360)], iface="enp131s0f3") - pkt1/2/3 were forwarded to port 0 - pkt4: sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=1,dport=1)/Raw(load="P"*461)], iface="enp131s0f3") - pkt5: sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=1,dport=1)/Raw(load="P"*460)], iface="enp131s0f3") - pkt6: sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=1,dport=1)/Raw(load="P"*360)], iface="enp131s0f3") - pkt4 was dropped, pkt5/6 were forwarded to port1 - pkt7: sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*461)], iface="enp131s0f3") - pkt8: sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*460)], iface="enp131s0f3") - pkt9: sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*361)], iface="enp131s0f3") - pkt10: sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*360)], iface="enp131s0f3") - pkt8/9 were dropped, pkt7/10 were forwarded to port2 - pkt11: sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=3,dport=3)/Raw(load="P"*461)], iface="enp131s0f3") - pkt12: sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=3,dport=3)/Raw(load="P"*361)], iface="enp131s0f3") - pkt13: sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=3,dport=3)/Raw(load="P"*360)], iface="enp131s0f3") - pkt13 was dropped, pkt11/12 were forwarded to port3 - pkt14: sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=4,dport=4)/Raw(load="P"*361)], iface="enp131s0f3") - pkt15: sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=4,dport=4)/Raw(load="P"*360)], iface="enp131s0f3") - pkt16: sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=4,dport=4)/Raw(load="P"*260)], iface="enp131s0f3") - pkt14 was dropped, pkt15/16 were forwarded to port0 - pkt17: sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=5,dport=5)/Raw(load="P"*361)], iface="enp131s0f3") - pkt18: sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=5,dport=5)/Raw(load="P"*360)], iface="enp131s0f3") - pkt19: sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=5,dport=5)/Raw(load="P"*261)], iface="enp131s0f3") - pkt20: sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=5,dport=5)/Raw(load="P"*260)], iface="enp131s0f3") - pkt18/19 were dropped, pkt17/20 were forwarded to port1 - pkt21: sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=6,dport=6)/Raw(load="P"*361)], iface="enp131s0f3") - pkt22: sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=6,dport=6)/Raw(load="P"*261)], iface="enp131s0f3") - pkt23: sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=6,dport=6)/Raw(load="P"*260)], iface="enp131s0f3") - pkt23 was dropped, pkt21/22 were forwarded to port2 - pkt24: sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=7,dport=7)/Raw(load="P"*361)], iface="enp131s0f3") - pkt25: sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=7,dport=7)/Raw(load="P"*261)], iface="enp131s0f3") - pkt26: sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=7,dport=7)/Raw(load="P"*260)], iface="enp131s0f3") - pkt24/25/26 were dropped - -**Notes**: if create one flow with a mtr_id, then create the flow again with another mtr_id, -the last flow rule will overlap the previous one. -so the first flow rule will not take effect, just the last one can take effect. - -Test Case 10: ipv4 RFC2698 pre-colored red by DSCP table --------------------------------------------------------- -1. Set the DSCP table in dscp.sh, set all the packets from every tc and every queue to red color. Edit meter_and_policing_firmware.cli to change "table action" and "pipeline table" as below, - - :: - - table action profile AP0 ipv4 offset 270 fwd meter trtcm tc 1 stats pkts - pipeline RX table match acl ipv4 offset 270 size 4K action AP0 - pipeline RX table 0 dscp /root/dpdk/drivers/net/softnic/dscp_red.sh - flowapi map group 0 ingress pipeline RX table 0 - -2. Start softnic, - - :: - - ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x7 -s 0x4 -n 4 --vdev 'net_softnic0,firmware=/root/dpdk/drivers/net/softnic/meter_and_policing_firmware.cli' -- -i --rxq=2 --txq=2 --portmask=0x4 --disable-rss - - Add rules to table, set CBS to 400 bytes, PBS to 500 bytes - :: - - testpmd> add port meter profile trtcm_rfc2698 2 0 3125000000 3125000000 400 500 0 - testpmd> add port meter policy 2 0 g_actions color type green / end y_actions color type yellow / end r_actions color type red / end - testpmd> create port meter 2 0 0 0 yes 0 0 0 - testpmd> flow create 2 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 dst mask 255.255.255.255 src spec 1.10.11.12 dst spec 2.20.21.22 proto spec 6 / tcp src mask 65535 dst mask 65535 src spec 2 dst spec 2 / end actions meter mtr_id 0 / queue index 0 / end - testpmd> start - -3. Configure the packets with specified src/dst IP address and TCP dport/sport. - - :: - - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*461)], iface="enp131s0f3") - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*460)], iface="enp131s0f3") - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*360)], iface="enp131s0f3") - - All the packets were forwarded to port 0. - -4. Create another meter to drop all the packets with red color, - - :: - - testpmd> add port meter policy 2 1 g_actions color type green / end y_actions color type yellow / end r_actions drop / end - testpmd> create port meter 2 1 0 1 yes 0 0 0 - testpmd> flow create 2 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 dst mask 255.255.255.255 src spec 1.10.11.12 dst spec 2.20.21.22 proto spec 6 / tcp src mask 65535 dst mask 65535 src spec 2 dst spec 2 / end actions meter mtr_id 1 / queue index 0 / end - -5. Configure the packets with specified src/dst IP address and TCP dport/sport. - - :: - - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*461)], iface="enp131s0f3") - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*460)], iface="enp131s0f3") - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*360)], iface="enp131s0f3") - - All the packets were dropped. - -6. Create another meter to drop all the packets with yellow color, - - :: - - testpmd> add port meter policy 2 2 g_actions color type green / end y_actions drop / end r_actions color type red / end - testpmd> create port meter 2 2 0 2 yes 0 0 0 - testpmd> flow create 2 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 dst mask 255.255.255.255 src spec 1.10.11.12 dst spec 2.20.21.22 proto spec 6 / tcp src mask 65535 dst mask 65535 src spec 2 dst spec 2 / end actions meter mtr_id 2 / queue index 0 / end - -7. Configure the packets with specified src/dst IP address and TCP dport/sport. - - :: - - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*461)], iface="enp131s0f3") - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*460)], iface="enp131s0f3") - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*360)], iface="enp131s0f3") - - All the packets were forwarded to port 0 - -8. Create another meter to drop all the packets with green color, - - :: - - testpmd> add port meter policy 2 3 g_actions drop / end y_actions color type yellow / end r_actions color type red / end - testpmd> create port meter 2 3 0 3 yes 0 0 0 - testpmd> flow create 2 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 dst mask 255.255.255.255 src spec 1.10.11.12 dst spec 2.20.21.22 proto spec 6 / tcp src mask 65535 dst mask 65535 src spec 2 dst spec 2 / end actions meter mtr_id 3 / queue index 0 / end - -9. Configure the packets with specified src/dst IP address and TCP dport/sport. - - :: - - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*461)], iface="enp131s0f3") - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*460)], iface="enp131s0f3") - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*360)], iface="enp131s0f3") - - All the packets were forwarded to port 0 - -Test Case 11: ipv4 RFC2698 pre-colored yellow by DSCP table ------------------------------------------------------------ -1. Set the DSCP table in dscp.sh, set all the packets from every tc and every queue to yellow color. - - Edit meter_and_policing_firmware.cli to change "table action" and "pipeline table" as below, - :: - - table action profile AP0 ipv4 offset 270 fwd meter trtcm tc 1 stats pkts - pipeline RX table match acl ipv4 offset 270 size 4K action AP0 - pipeline RX table 0 dscp /root/dpdk/drivers/net/softnic/dscp_yellow.sh - flowapi map group 0 ingress pipeline RX table 0 - -2. Start softnic, - - :: - - ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x7 -s 0x4 -n 4 --vdev 'net_softnic0,firmware=/root/dpdk/drivers/net/softnic/meter_and_policing_firmware.cli' -- -i --rxq=2 --txq=2 --portmask=0x4 --disable-rss - - Add rules to table, set CBS to 400 bytes, PBS to 500 bytes - :: - - testpmd> add port meter profile trtcm_rfc2698 2 0 3125000000 3125000000 400 500 0 - testpmd> add port meter policy 2 0 g_actions color type green / end y_actions color type yellow / end r_actions color type red / end - testpmd> create port meter 2 0 0 0 yes 0 0 0 - testpmd> flow create 2 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 dst mask 255.255.255.255 src spec 1.10.11.12 dst spec 2.20.21.22 proto spec 6 / tcp src mask 65535 dst mask 65535 src spec 2 dst spec 2 / end actions meter mtr_id 0 / queue index 0 / end - testpmd> start - -3. Configure the packets with specified src/dst IP address and TCP dport/sport. - - :: - - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*461)], iface="enp131s0f3") - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*460)], iface="enp131s0f3") - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*360)], iface="enp131s0f3") - - All the packets were forwarded to port 0. - -4. Create another meter to drop all the packets with red color, - - :: - - testpmd> add port meter policy 2 1 g_actions color type green / end y_actions color type yellow / end r_actions drop / end - testpmd> create port meter 2 1 0 1 yes 0 0 0 - testpmd> flow create 2 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 dst mask 255.255.255.255 src spec 1.10.11.12 dst spec 2.20.21.22 proto spec 6 / tcp src mask 65535 dst mask 65535 src spec 2 dst spec 2 / end actions meter mtr_id 1 / queue index 0 / end - -5. Configure the packets with specified src/dst IP address and TCP dport/sport. - - :: - - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*461)], iface="enp131s0f3") - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*460)], iface="enp131s0f3") - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*360)], iface="enp131s0f3") - - pkt1 was dropped. - pkt2 and pkt3 were forwarded to port 0. - -6. Create another meter to drop all the packets with yellow color, - - :: - - testpmd> add port meter policy 2 2 g_actions color type green / end y_actions drop / end r_actions color type red / end - testpmd> create port meter 2 2 0 2 yes 0 0 0 - testpmd> flow create 2 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 dst mask 255.255.255.255 src spec 1.10.11.12 dst spec 2.20.21.22 proto spec 6 / tcp src mask 65535 dst mask 65535 src spec 2 dst spec 2 / end actions meter mtr_id 2 / queue index 0 / end - -7. Configure the packets with specified src/dst IP address and TCP dport/sport. - - :: - - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*461)], iface="enp131s0f3") - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*460)], iface="enp131s0f3") - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*360)], iface="enp131s0f3") - - pkt1 was forwarded to port 0. - pkt2 and pkt3 were dropped. - -8. Create another meter to drop all the packets with green color, - - :: - - testpmd> add port meter policy 2 3 g_actions drop / end y_actions color type yellow / end r_actions color type red / end - testpmd> create port meter 2 3 0 3 yes 0 0 0 - testpmd> flow create 2 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 dst mask 255.255.255.255 src spec 1.10.11.12 dst spec 2.20.21.22 proto spec 6 / tcp src mask 65535 dst mask 65535 src spec 2 dst spec 2 / end actions meter mtr_id 3 / queue index 0 / end - -9. Configure the packets with specified src/dst IP address and TCP dport/sport. - - :: - - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*461)], iface="enp131s0f3") - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*460)], iface="enp131s0f3") - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*360)], iface="enp131s0f3") - - All the packets were forwarded to port 0 - -Test Case 12: ipv4 RFC2698 pre-colored green by DSCP table ----------------------------------------------------------- -1. Set the DSCP table in dscp.sh, set all the packets from every tc and every queue to green color. - - Edit meter_and_policing_firmware.cli to change "table action" and "pipeline table" as below, - :: - - table action profile AP0 ipv4 offset 270 fwd meter trtcm tc 1 stats pkts - pipeline RX table match acl ipv4 offset 270 size 4K action AP0 - pipeline RX table 0 dscp /root/dpdk/drivers/net/softnic/dscp_green.sh - flowapi map group 0 ingress pipeline RX table 0 - -2. Start softnic, - - :: - - ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x7 -s 0x4 -n 4 --vdev 'net_softnic0,firmware=/root/dpdk/drivers/net/softnic/meter_and_policing_firmware.cli' -- -i --rxq=2 --txq=2 --portmask=0x4 --disable-rss - - Add rules to table, set CBS to 400 bytes, PBS to 500 bytes - :: - - testpmd> add port meter profile trtcm_rfc2698 2 0 3125000000 3125000000 400 500 0 - testpmd> add port meter policy 2 0 g_actions color type green / end y_actions color type yellow / end r_actions color type red / end - testpmd> create port meter 2 0 0 0 yes 0 0 0 - testpmd> flow create 2 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 dst mask 255.255.255.255 src spec 1.10.11.12 dst spec 2.20.21.22 proto spec 6 / tcp src mask 65535 dst mask 65535 src spec 2 dst spec 2 / end actions meter mtr_id 0 / queue index 0 / end - testpmd> start - -3. Configure the packets with specified src/dst IP address and TCP dport/sport. - - :: - - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*461)], iface="enp131s0f3") - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*460)], iface="enp131s0f3") - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*360)], iface="enp131s0f3") - - All the packets were forwarded to port 0. - -4. Create another meter to drop all the packets with red color, - - :: - - testpmd> add port meter policy 2 1 g_actions color type green / end y_actions color type yellow / end r_actions drop / end - testpmd> create port meter 2 1 0 1 yes 0 0 0 - testpmd> flow create 2 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 dst mask 255.255.255.255 src spec 1.10.11.12 dst spec 2.20.21.22 proto spec 6 / tcp src mask 65535 dst mask 65535 src spec 2 dst spec 2 / end actions meter mtr_id 1 / queue index 0 / end - -5. Configure the packets with specified src/dst IP address and TCP dport/sport. - - :: - - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*461)], iface="enp131s0f3") - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*460)], iface="enp131s0f3") - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*360)], iface="enp131s0f3") - - pkt1 was dropped. - pkt2 and pkt3 were forwarded to port 0. - -6. Create another meter to drop all the packets with yellow color, - - :: - - testpmd> add port meter policy 2 2 g_actions color type green / end y_actions drop / end r_actions color type red / end - testpmd> create port meter 2 2 0 2 yes 0 0 0 - testpmd> flow create 2 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 dst mask 255.255.255.255 src spec 1.10.11.12 dst spec 2.20.21.22 proto spec 6 / tcp src mask 65535 dst mask 65535 src spec 2 dst spec 2 / end actions meter mtr_id 2 / queue index 0 / end - -7. Configure the packets with specified src/dst IP address and TCP dport/sport. - - :: - - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*461)], iface="enp131s0f3") - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*460)], iface="enp131s0f3") - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*360)], iface="enp131s0f3") - - pkt1 and pkt3 were forwarded to port 0. - pkt2 was dropped. - -8. Create another meter to drop all the packets with green color, - - :: - - testpmd> add port meter policy 2 3 g_actions drop / end y_actions color type yellow / end r_actions color type red / end - testpmd> create port meter 2 3 0 3 yes 0 0 0 - testpmd> flow create 2 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 dst mask 255.255.255.255 src spec 1.10.11.12 dst spec 2.20.21.22 proto spec 6 / tcp src mask 65535 dst mask 65535 src spec 2 dst spec 2 / end actions meter mtr_id 3 / queue index 0 / end - -9. Configure the packets with specified src/dst IP address and TCP dport/sport. - - :: - - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*461)], iface="enp131s0f3") - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*460)], iface="enp131s0f3") - sendp([Ether(dst="00:00:00:00:01:00")/IP(src='1.10.11.12',dst='2.20.21.22',proto=6)/TCP(sport=2,dport=2)/Raw(load="P"*360)], iface="enp131s0f3") - - pkt1 and pkt2 were forwarded to port 0. - pkt3 was dropped. - -Test Case 13: ipv4 RFC2698 pre-colored by default DSCP table ------------------------------------------------------------- -1. Set the DSCP table in dscp.sh, - - The default DSCP table translate all input packets dscp values (0...64) to 0 0 0 - which means traffic class 0, queue id 0 , color 0 (i.e green). - - Edit meter_and_policing_firmware.cli to change "table action" and "pipeline table" as below,:: - - table action profile AP0 ipv4 offset 270 fwd meter trtcm tc 1 stats pkts - pipeline RX table match acl ipv4 offset 270 size 4K action AP0 - pipeline RX table 0 dscp /root/dpdk/drivers/net/softnic/dscp_default.sh - flowapi map group 0 ingress pipeline RX table 0 - -2. Execute the steps2-9 of the case pre-colored green by DSCP table, got the same result. diff --git a/tests/TestSuite_metering_and_policing.py b/tests/TestSuite_metering_and_policing.py deleted file mode 100644 index 02a83181..00000000 --- a/tests/TestSuite_metering_and_policing.py +++ /dev/null @@ -1,1296 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2010-2019 Intel Corporation -# - -""" -DPDK Test suite. -Test metering_and_policing. -""" - -import os -import re -import string -import time - -import framework.utils as utils -from framework.dut import Dut -from framework.plotting import Plotting -from framework.pmd_output import PmdOutput -from framework.settings import HEADER_SIZE -from framework.test_case import TestCase - - -class TestMeteringAndPolicing(TestCase): - scapyCmds = [] - - def start_scapy(self): - self.tester.scapy_foreground() - self.tester.send_expect("scapy", ">>> ", 10) - self.scapy_status = True - - def end_scapy(self): - self.tester.send_expect("exit()", "#") - self.scapy_status = False - - def scapy_execute(self, timeout=60): - for cmd in self.scapyCmds: - self.tester.send_expect(cmd, ">>> ", timeout) - - self.scapyCmds = [] - - def copy_config_files_to_dut(self): - """ - Copy firmware.cli, dscp_*.sh from tester to DUT. - """ - file = "meter_and_policy_config.tar.gz" - src_file = r"./dep/%s" % file - dst1 = "/tmp" - dst2 = os.sep.join([self.target_dir, "drivers/net/softnic"]) - self.dut.session.copy_file_to(src_file, dst1) - self.dut.send_expect("tar xf %s/%s -C %s" % (dst1, file, dst2), "#", 30) - - def update_firmware_cli(self, caseID): - """ - Update firmware.cli. - """ - self.ori_firmware_cli = os.sep.join( - [self.target_dir, "drivers/net/softnic/meter_and_policing_firmware.cli"] - ) - - if len(self.dut_ports) == 4: - self.ori_firmware_cli = os.sep.join( - [ - self.target_dir, - "drivers/net/softnic/meter_and_policing_firmware_4ports.cli", - ] - ) - self.new_firmware_cli = "%s-%s" % (self.ori_firmware_cli, caseID) - self.dut.send_expect("rm -f %s" % self.new_firmware_cli, "#") - self.dut.send_expect( - "cp %s %s" % (self.ori_firmware_cli, self.new_firmware_cli), "#" - ) - - # link dev - self.dut.send_expect( - "sed -i -e 's/^.*link LINK0 dev.*$/link LINK0 dev %s/g' %s" - % (self.dut_p0_pci, self.new_firmware_cli), - "#", - ) - self.dut.send_expect( - "sed -i -e 's/^.*link LINK1 dev.*$/link LINK1 dev %s/g' %s" - % (self.dut_p1_pci, self.new_firmware_cli), - "#", - ) - if len(self.dut_ports) == 4: - self.dut.send_expect( - "sed -i -e 's/^.*link LINK2 dev.*$/link LINK2 dev %s/g' %s" - % (self.dut_p2_pci, self.new_firmware_cli), - "#", - ) - self.dut.send_expect( - "sed -i -e 's/^.*link LINK3 dev.*$/link LINK3 dev %s/g' %s" - % (self.dut_p3_pci, self.new_firmware_cli), - "#", - ) - - # table action - temp = "table action profile AP0" - if caseID == 8: - self.dut.send_expect( - "sed -i -e 's/^.*%s.*$/%s ipv6 offset 270 fwd meter trtcm tc 1 stats pkts/g' %s" - % (temp, temp, self.new_firmware_cli), - "#", - ) - else: - self.dut.send_expect( - "sed -i -e 's/^.*%s.*$/%s ipv4 offset 270 fwd meter trtcm tc 1 stats pkts/g' %s" - % (temp, temp, self.new_firmware_cli), - "#", - ) - - # pipeline RX table - temp = "pipeline RX table match" - if caseID == 7: - target = "hash ext key 16 mask 00FF0000FFFFFFFFFFFFFFFFFFFFFFFF offset 278 buckets 16K size 65K action AP0" - self.dut.send_expect( - "sed -i -e 's/^.*%s.*$/%s %s/g' %s" - % (temp, temp, target, self.new_firmware_cli), - "#", - ) - elif caseID == 8: - self.dut.send_expect( - "sed -i -e 's/^.*%s.*$/%s acl ipv6 offset 270 size 4K action AP0/g' %s" - % (temp, temp, self.new_firmware_cli), - "#", - ) - else: - self.dut.send_expect( - "sed -i -e 's/^.*%s.*$/%s acl ipv4 offset 270 size 4K action AP0/g' %s" - % (temp, temp, self.new_firmware_cli), - "#", - ) - # use .sh file as RX table - temp = "pipeline RX table 0 dscp" - target_dir = "\/".join(self.target_dir.split("/")) - if caseID == 10: - self.dut.send_expect( - "sed -i -e 's/^.*%s.*$/%s %s\/drivers\/net\/softnic\/dscp_red.sh/g' %s" - % (temp, temp, target_dir, self.new_firmware_cli), - "#", - ) - elif caseID == 11: - self.dut.send_expect( - "sed -i -e 's/^.*%s.*$/%s %s\/drivers\/net\/softnic\/dscp_yellow.sh/g' %s" - % (temp, temp, target_dir, self.new_firmware_cli), - "#", - ) - elif caseID == 12: - self.dut.send_expect( - "sed -i -e 's/^.*%s.*$/%s %s\/drivers\/net\/softnic\/dscp_green.sh/g' %s" - % (temp, temp, target_dir, self.new_firmware_cli), - "#", - ) - elif caseID == 13: - self.dut.send_expect( - "sed -i -e 's/^.*%s.*$/%s %s\/drivers\/net\/softnic\/dscp_default.sh/g' %s" - % (temp, temp, target_dir, self.new_firmware_cli), - "#", - ) - - # thread * pipeline RX/TX enable - self.dut.send_expect( - "sed -i -e 's/thread 5 pipeline RX enable/thread %d pipeline RX enable/g' %s" - % (len(self.dut_ports), self.new_firmware_cli), - "#", - ) - self.dut.send_expect( - "sed -i -e 's/thread 5 pipeline TX enable/thread %d pipeline TX enable/g' %s" - % (len(self.dut_ports), self.new_firmware_cli), - "#", - ) - - def start_testpmd(self, filename): - """ - Start testpmd. - """ - if len(self.dut_ports) == 2: - portmask = "0x4" - Corelist = [0, 1, 2] - Servicecorelist = "0x4" - if len(self.dut_ports) == 4: - portmask = "0x10" - Corelist = [0, 1, 2, 3, 4] - Servicecorelist = "0x10" - self.path = self.dut.apps_name["test-pmd"] - self.pmd_out.start_testpmd( - Corelist, - "--rxq=%d --txq=%d --portmask=%s --disable-rss" - % (self.port_id, self.port_id, portmask), - eal_param="-s %s --vdev 'net_softnic0,firmware=%s'" - % (Servicecorelist, filename), - ) - if self.nic in ["ICE_25G-E810C_SFP", "ICE_100G-E810C_QSFP"]: - self.dut.send_expect("set fwd mac", "testpmd>") - - def add_port_meter_profile(self, profile_id, cbs=400, pbs=500): - """ - Add port meter profile (trTCM rfc2968). - """ - cir = 3125000000 - pir = 3125000000 - self.dut.send_expect( - "add port meter profile trtcm_rfc2698 %d %d %d %d %d %d 0" - % (self.port_id, profile_id, cir, pir, cbs, pbs), - "testpmd>", - ) - - def add_port_meter_policy( - self, port_id, policy_id, g_actions, y_actions, r_actions - ): - """ - Add port meter policy - """ - gyrd_action_list = [g_actions, y_actions, r_actions] - - for i in range(len(gyrd_action_list)): - if gyrd_action_list[i] != "drop": - gyrd_action_list[i] = "color type " + gyrd_action_list[i] - - self.dut.send_expect( - "add port meter policy %d %d g_actions %s / end y_actions %s / end r_actions %s / end" - % ( - port_id, - policy_id, - gyrd_action_list[0], - gyrd_action_list[1], - gyrd_action_list[2], - ), - "testpmd>", - ) - - def create_port_meter(self, port_id, mtr_id, profile_id, policy_id, gyrd_action): - """ - Create new meter object for the ethernet device. - """ - self.dut.send_expect( - "create port meter %d %d %d %d yes %s" - % (port_id, mtr_id, profile_id, policy_id, gyrd_action), - "testpmd>", - ) - - def create_flow_rule( - self, ret_id, ip_ver, protocol, spec_id, mtr_id, queue_index_id - ): - """ - Create flow rule based on port meter. - """ - if ip_ver == "ipv4": - src_mask = "255.255.255.255" - dst_mask = "255.255.255.255" - src_ip = "1.10.11.12" - dst_ip = "2.20.21.22" - if ip_ver == "ipv6": - src_mask = "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff" - dst_mask = "0:0:0:0:0:0:0:0" - src_ip = "ABCD:EF01:2345:6789:ABCD:EF01:2345:5789" - dst_ip = "0:0:0:0:0:0:0:0" - protocol = protocol.lower() - if protocol == "tcp": - proto_id = 6 - if protocol == "udp": - proto_id = 17 - if protocol == "sctp": - proto_id = 132 - - out = self.dut.send_expect( - "flow create %d group 0 ingress pattern eth / %s proto mask 255 src mask %s dst mask" - " %s src spec %s dst spec %s proto spec %d / %s src mask 65535 dst mask 65535 src " - "spec %d dst spec %d / end actions meter mtr_id %d / queue index %d / end" - % ( - self.port_id, - ip_ver, - src_mask, - dst_mask, - src_ip, - dst_ip, - proto_id, - protocol, - spec_id, - spec_id, - mtr_id, - queue_index_id, - ), - "testpmd>", - ) - if ret_id == 1: - self.verify("Flow rule #" in out, "flow create fail") - else: - self.verify( - "METER: Meter already attached to a flow: Invalid argument" in out, - "flow create should fail, but NOT failed", - ) - - def scapy_send_packet(self, ip_ver, protocol, fwd_port, pktsize): - """ - Send a packet to DUT port 0 - """ - source_port = self.tester.get_interface( - self.tester.get_local_port(self.dut_ports[0]) - ) - protocol = protocol.upper() - if ip_ver == "ipv4": - src_ip = "1.10.11.12" - dst_ip = "2.20.21.22" - tag = "IP" - if protocol == "TCP": - proto_str = "proto=6" - if protocol == "UDP": - proto_str = "proto=17" - if protocol == "SCTP": - proto_str = "proto=132" - - if ip_ver == "ipv6": - src_ip = "ABCD:EF01:2345:6789:ABCD:EF01:2345:5789" - dst_ip = "2001::1" - tag = "IPv6" - if protocol == "TCP": - proto_str = "nh=6" - if protocol == "UDP": - proto_str = "nh=17" - - self.scapyCmds.append( - 'sendp([Ether(dst="%s")/%s(src="%s",dst="%s",%s)/%s(sport=%d,dport=%d)/Raw(load="P"*%d)], iface="%s")' - % ( - self.dut_p0_mac, - tag, - src_ip, - dst_ip, - proto_str, - protocol, - fwd_port, - fwd_port, - pktsize, - source_port, - ) - ) - self.scapy_execute() - - def send_packet_and_check(self, ip_ver, protocol, fwd_port, pktsize, expect_port): - """ - Send packet and check the stats. If expect_port == -1, the packet should be dropped. - """ - # check the ports are UP before sending packets - res = self.pmd_out.wait_link_status_up("all", 30) - self.verify(res is True, "there have port link is down") - - rx_before = [] - tx_before = [] - for i in range(0, len(self.dut_ports)): - output = self.dut.send_expect("show port stats %d" % (i), "testpmd>") - if i == 0: - rx_before.append( - re.compile("RX-packets:\s+(.*?)\s+?").findall(output, re.S) - ) - tx_before.append( - re.compile("TX-packets:\s+(.*?)\s+?").findall(output, re.S) - ) - - self.scapy_send_packet(ip_ver, protocol, fwd_port, pktsize) - - rx_after = [] - tx_after = [] - for i in range(0, len(self.dut_ports)): - output = self.dut.send_expect("show port stats %d" % (i), "testpmd>") - if i == 0: - rx_after.append( - re.compile("RX-packets:\s+(.*?)\s+?").findall(output, re.S) - ) - tx_after.append(re.compile("TX-packets:\s+(.*?)\s+?").findall(output, re.S)) - - rx_packets_port = [] - tx_packets_port = [] - temp1 = int(rx_after[0][0]) - int(rx_before[0][0]) - rx_packets_port.append(temp1) - for i in range(0, len(self.dut_ports)): - temp2 = int(tx_after[i][0]) - int(tx_before[i][0]) - tx_packets_port.append(temp2) - self.verify( - int(rx_packets_port[0]) == 1, "Wrong: port 0 did not recieve any packet" - ) - if expect_port == -1: - for i in range(0, len(self.dut_ports)): - self.verify( - int(tx_packets_port[i]) == 0, "Wrong: the packet is not dropped" - ) - else: - self.verify( - int(tx_packets_port[expect_port]) == 1, - "Wrong: can't forward packet to port %d " % expect_port, - ) - - def run_param(self, cbs, pbs, head): - """ - Set cbs, pbs and head; return the packet size - """ - pkt1 = pbs - head + 1 - pkt2 = pbs - head - pkt3 = cbs - head + 1 - pkt4 = cbs - head - pkt_list = [pkt1, pkt2, pkt3, pkt4] - return pkt_list - - def run_port_list(self, ip_ver, protocol, fwd_port, pkt_list, port_list): - for i in range(len(port_list)): - self.send_packet_and_check( - ip_ver=ip_ver, - protocol=protocol, - fwd_port=fwd_port, - pktsize=pkt_list[i], - expect_port=port_list[i], - ) - - def set_up_all(self): - """ - Run at the start of each test suite. - """ - # get absolute directory of target source code - self.target_dir = ( - "/root" + self.dut.base_dir[1:] - if self.dut.base_dir.startswith("~") - else self.dut.base_dir - ) - self.dut_ports = self.dut.get_ports() - self.port_nums = 2 - self.verify( - len(self.dut_ports) >= self.port_nums, - "Insufficient ports for speed testing", - ) - self.dut_p0_pci = self.dut.get_port_pci(self.dut_ports[0]) - self.dut_p1_pci = self.dut.get_port_pci(self.dut_ports[1]) - if len(self.dut_ports) == 4: - self.dut_p2_pci = self.dut.get_port_pci(self.dut_ports[2]) - self.dut_p3_pci = self.dut.get_port_pci(self.dut_ports[3]) - self.pmd_out = PmdOutput(self.dut) - self.dut_p0_mac = self.dut.get_mac_address(self.dut_ports[0]) - self.port_id = len(self.dut_ports) - self.copy_config_files_to_dut() - self.start_scapy() - - def set_up(self): - """ - Run before each test case. - """ - pass - - def test_ipv4_ACL_table_RFC2698_GYR(self): - """ - Test Case 1: ipv4 ACL table RFC2698 GYR - """ - self.update_firmware_cli(caseID=1) - cbs = 400 - pbs = 500 - pkt_list = self.run_param(cbs=cbs, pbs=pbs, head=40) - self.start_testpmd(self.new_firmware_cli) - self.add_port_meter_profile(profile_id=0, cbs=cbs, pbs=pbs) - self.add_port_meter_policy( - self.port_id, - policy_id=0, - g_actions="green", - y_actions="yellow", - r_actions="red", - ) - self.create_port_meter( - self.port_id, mtr_id=0, profile_id=0, policy_id=0, gyrd_action="0 0 0" - ) - self.create_flow_rule( - ret_id=1, - ip_ver="ipv4", - protocol="tcp", - spec_id=2, - mtr_id=0, - queue_index_id=0, - ) - self.dut.send_expect("start", "testpmd>") - self.run_port_list("ipv4", "tcp", 2, pkt_list, [0, 0, 0, 0]) - - def test_ipv4_ACL_table_RFC2698_GYD(self): - """ - Test Case 2: ipv4 ACL table RFC2698 GYD - """ - self.update_firmware_cli(caseID=2) - cbs = 400 - pbs = 500 - pkt_list = self.run_param(cbs=cbs, pbs=pbs, head=40) - self.start_testpmd(self.new_firmware_cli) - self.add_port_meter_profile(profile_id=0, cbs=cbs, pbs=pbs) - self.add_port_meter_policy( - self.port_id, - policy_id=0, - g_actions="green", - y_actions="yellow", - r_actions="drop", - ) - self.create_port_meter( - self.port_id, mtr_id=0, profile_id=0, policy_id=0, gyrd_action="0 0 0" - ) - self.create_flow_rule( - ret_id=1, - ip_ver="ipv4", - protocol="tcp", - spec_id=2, - mtr_id=0, - queue_index_id=0, - ) - self.dut.send_expect("start", "testpmd>") - self.run_port_list("ipv4", "tcp", 2, pkt_list, [-1, 0, 0, 0]) - - def test_ipv4_ACL_table_RFC2698_GDR(self): - """ - Test Case 3: ipv4 ACL table RFC2698 GDR - """ - self.update_firmware_cli(caseID=3) - cbs = 400 - pbs = 500 - pkt_list = self.run_param(cbs=cbs, pbs=pbs, head=32) - self.start_testpmd(self.new_firmware_cli) - self.add_port_meter_profile(profile_id=0, cbs=cbs, pbs=pbs) - self.add_port_meter_policy( - self.port_id, - policy_id=0, - g_actions="green", - y_actions="drop", - r_actions="red", - ) - self.create_port_meter( - self.port_id, mtr_id=0, profile_id=0, policy_id=0, gyrd_action="0 0 0" - ) - self.create_flow_rule( - ret_id=1, - ip_ver="ipv4", - protocol="sctp", - spec_id=2, - mtr_id=0, - queue_index_id=1, - ) - self.dut.send_expect("start", "testpmd>") - self.run_port_list("ipv4", "sctp", 2, pkt_list, [1, -1, -1, 1]) - - def test_ipv4_ACL_table_RFC2698_DYR(self): - """ - Test Case 4: ipv4 ACL table RFC2698 DYR - """ - self.update_firmware_cli(caseID=4) - cbs = 400 - pbs = 500 - pkt_list = self.run_param(cbs=cbs, pbs=pbs, head=28) - self.start_testpmd(self.new_firmware_cli) - self.add_port_meter_profile(profile_id=0, cbs=cbs, pbs=pbs) - - self.add_port_meter_policy( - self.port_id, - policy_id=0, - g_actions="drop", - y_actions="yellow", - r_actions="red", - ) - self.create_port_meter( - self.port_id, mtr_id=0, profile_id=0, policy_id=0, gyrd_action="0 0 0" - ) - self.create_flow_rule( - ret_id=1, - ip_ver="ipv4", - protocol="udp", - spec_id=2, - mtr_id=0, - queue_index_id=0, - ) - self.dut.send_expect("start", "testpmd>") - self.run_port_list("ipv4", "udp", 2, pkt_list, [0, 0, 0, -1]) - - def test_ipv4_ACL_table_RFC2698_DDD(self): - """ - Test Case 5: ipv4 ACL table RFC2698 DDD - """ - self.update_firmware_cli(caseID=5) - cbs = 400 - pbs = 500 - pkt_list = self.run_param(cbs=cbs, pbs=pbs, head=40) - self.start_testpmd(self.new_firmware_cli) - self.add_port_meter_profile(profile_id=0, cbs=cbs, pbs=pbs) - self.add_port_meter_policy( - self.port_id, - policy_id=0, - g_actions="drop", - y_actions="drop", - r_actions="drop", - ) - self.create_port_meter( - self.port_id, mtr_id=0, profile_id=0, policy_id=0, gyrd_action="0 0 0" - ) - self.create_flow_rule( - ret_id=1, - ip_ver="ipv4", - protocol="tcp", - spec_id=2, - mtr_id=0, - queue_index_id=0, - ) - self.dut.send_expect("start", "testpmd>") - self.run_port_list("ipv4", "tcp", 2, pkt_list, [-1, -1, -1, -1]) - - def test_ipv4_with_same_cbs_and_pbs_GDR(self): - """ - Test Case 6: ipv4 with same cbs and pbs GDR - """ - self.update_firmware_cli(caseID=6) - cbs = 500 - pbs = 500 - pkt_list = self.run_param(cbs=cbs, pbs=pbs, head=32) - self.start_testpmd(self.new_firmware_cli) - self.add_port_meter_profile(profile_id=0, cbs=cbs, pbs=pbs) - self.add_port_meter_policy( - self.port_id, - policy_id=0, - g_actions="green", - y_actions="drop", - r_actions="red", - ) - self.create_port_meter( - self.port_id, mtr_id=0, profile_id=0, policy_id=0, gyrd_action="0 0 0" - ) - self.create_flow_rule( - ret_id=1, - ip_ver="ipv4", - protocol="sctp", - spec_id=2, - mtr_id=0, - queue_index_id=0, - ) - self.dut.send_expect("start", "testpmd>") - self.run_port_list("ipv4", "sctp", 2, pkt_list, [0, 0]) - - def test_ipv4_HASH_table_RFC2698(self): - """ - Test Case 7: ipv4 HASH table RFC2698 - """ - self.update_firmware_cli(caseID=7) - cbs = 400 - pbs = 500 - pkt_list = self.run_param(cbs=cbs, pbs=pbs, head=40) - - # test 1 'g y r 0 0 0' - self.start_testpmd(self.new_firmware_cli) - self.add_port_meter_profile(profile_id=0, cbs=cbs, pbs=pbs) - self.add_port_meter_policy( - self.port_id, - policy_id=0, - g_actions="green", - y_actions="yellow", - r_actions="red", - ) - self.create_port_meter( - self.port_id, mtr_id=0, profile_id=0, policy_id=0, gyrd_action="0 0 0" - ) - self.create_flow_rule( - ret_id=1, - ip_ver="ipv4", - protocol="tcp", - spec_id=2, - mtr_id=0, - queue_index_id=0, - ) - self.dut.send_expect("start", "testpmd>") - self.run_port_list("ipv4", "tcp", 2, pkt_list, [0, 0, 0, 0]) - self.dut.send_expect("quit", "#", 30) - - # test 2 'g y d 0 0 0' - self.start_testpmd(self.new_firmware_cli) - self.add_port_meter_profile(profile_id=0, cbs=cbs, pbs=pbs) - self.add_port_meter_policy( - self.port_id, - policy_id=0, - g_actions="green", - y_actions="yellow", - r_actions="drop", - ) - self.create_port_meter( - self.port_id, mtr_id=0, profile_id=0, policy_id=0, gyrd_action="0 0 0" - ) - self.create_flow_rule( - ret_id=1, - ip_ver="ipv4", - protocol="tcp", - spec_id=2, - mtr_id=0, - queue_index_id=0, - ) - self.dut.send_expect("start", "testpmd>") - self.run_port_list("ipv4", "tcp", 2, pkt_list, [-1, 0, 0, 0]) - self.dut.send_expect("quit", "#", 30) - - # test 5 'd d d 0 0 0' - self.start_testpmd(self.new_firmware_cli) - self.add_port_meter_profile(profile_id=0, cbs=cbs, pbs=pbs) - self.add_port_meter_policy( - self.port_id, - policy_id=0, - g_actions="drop", - y_actions="drop", - r_actions="drop", - ) - self.create_port_meter( - self.port_id, mtr_id=0, profile_id=0, policy_id=0, gyrd_action="0 0 0" - ) - self.create_flow_rule( - ret_id=1, - ip_ver="ipv4", - protocol="tcp", - spec_id=2, - mtr_id=0, - queue_index_id=0, - ) - self.dut.send_expect("start", "testpmd>") - self.run_port_list("ipv4", "tcp", 2, pkt_list, [-1, -1, -1, -1]) - self.dut.send_expect("quit", "#", 30) - - # test 3 'g d r 0 0 0' - pkt_list = self.run_param(cbs=cbs, pbs=pbs, head=32) - self.start_testpmd(self.new_firmware_cli) - self.add_port_meter_profile(profile_id=0, cbs=cbs, pbs=pbs) - self.add_port_meter_policy( - self.port_id, - policy_id=0, - g_actions="green", - y_actions="drop", - r_actions="red", - ) - self.create_port_meter( - self.port_id, mtr_id=0, profile_id=0, policy_id=0, gyrd_action="0 0 0" - ) - self.create_flow_rule( - ret_id=1, - ip_ver="ipv4", - protocol="sctp", - spec_id=2, - mtr_id=0, - queue_index_id=1, - ) - self.dut.send_expect("start", "testpmd>") - self.run_port_list("ipv4", "sctp", 2, pkt_list, [1, -1, -1, 1]) - self.dut.send_expect("quit", "#", 30) - - # test 4 'd y r 0 0 0' - pkt_list = self.run_param(cbs=cbs, pbs=pbs, head=28) - self.start_testpmd(self.new_firmware_cli) - self.add_port_meter_profile(profile_id=0, cbs=cbs, pbs=pbs) - self.add_port_meter_policy( - self.port_id, - policy_id=0, - g_actions="drop", - y_actions="yellow", - r_actions="red", - ) - self.create_port_meter( - self.port_id, mtr_id=0, profile_id=0, policy_id=0, gyrd_action="0 0 0" - ) - self.create_flow_rule( - ret_id=1, - ip_ver="ipv4", - protocol="udp", - spec_id=2, - mtr_id=0, - queue_index_id=0, - ) - self.dut.send_expect("start", "testpmd>") - self.run_port_list("ipv4", "udp", 2, pkt_list, [0, 0, 0, -1]) - self.dut.send_expect("quit", "#", 30) - - def test_ipv6_ACL_table_RFC2698(self): - """ - Test Case 8: ipv6 ACL table RFC2698 - """ - self.update_firmware_cli(caseID=8) - cbs = 400 - pbs = 500 - self.start_testpmd(self.new_firmware_cli) - self.add_port_meter_profile(profile_id=0, cbs=cbs, pbs=pbs) - self.add_port_meter_policy( - self.port_id, - policy_id=0, - g_actions="green", - y_actions="yellow", - r_actions="drop", - ) - self.create_port_meter( - self.port_id, mtr_id=0, profile_id=0, policy_id=0, gyrd_action="0 0 0" - ) - self.add_port_meter_policy( - self.port_id, - policy_id=1, - g_actions="drop", - y_actions="yellow", - r_actions="red", - ) - self.create_port_meter( - self.port_id, mtr_id=1, profile_id=0, policy_id=1, gyrd_action="0 0 0" - ) - self.create_flow_rule( - ret_id=1, - ip_ver="ipv6", - protocol="tcp", - spec_id=2, - mtr_id=0, - queue_index_id=0, - ) - self.create_flow_rule( - ret_id=1, - ip_ver="ipv6", - protocol="udp", - spec_id=2, - mtr_id=1, - queue_index_id=1, - ) - self.dut.send_expect("start", "testpmd>") - - pkt_list = self.run_param(cbs=cbs, pbs=pbs, head=60) - self.run_port_list("ipv6", "tcp", 2, pkt_list, [-1, 0, 0, 0]) - - pkt_list = self.run_param(cbs=cbs, pbs=pbs, head=48) - self.run_port_list("ipv6", "udp", 2, pkt_list, [1, 1, 1, -1]) - - def test_ipv4_multiple_meter_and_profile(self): - """ - Test Case 9: multiple meter and profile - """ - self.update_firmware_cli(caseID=9) - self.start_testpmd(self.new_firmware_cli) - self.add_port_meter_profile(profile_id=0, cbs=400, pbs=500) - self.add_port_meter_profile(profile_id=1, cbs=300, pbs=400) - - gyrd_action_list = [ - ["green", "yellow", "red"], - ["green", "yellow", "drop"], - ["green", "drop", "red"], - ["drop", "yellow", "red"], - ["green", "yellow", "drop"], - ["green", "drop", "red"], - ["drop", "yellow", "red"], - ["drop", "drop", "drop"], - ] - for i in range(0, len(gyrd_action_list)): - self.add_port_meter_policy( - self.port_id, - policy_id=i, - g_actions=gyrd_action_list[i][0], - y_actions=gyrd_action_list[i][1], - r_actions=gyrd_action_list[i][2], - ) - self.create_port_meter( - self.port_id, - mtr_id=i, - profile_id=i * 2 / len(gyrd_action_list), - policy_id=i, - gyrd_action="0 0 0", - ) - self.create_flow_rule( - ret_id=1, - ip_ver="ipv4", - protocol="tcp", - spec_id=i, - mtr_id=i, - queue_index_id=i % len(self.dut_ports), - ) - self.create_flow_rule( - ret_id=0, - ip_ver="ipv4", - protocol="tcp", - spec_id=8, - mtr_id=7, - queue_index_id=0, - ) - - self.dut.send_expect("start", "testpmd>") - output = self.dut.send_expect("flow list %d" % (self.port_id), "testpmd>") - print(output) - - pkt_list = self.run_param(cbs=400, pbs=500, head=40) - if len(self.dut_ports) == 4: - self.run_port_list("ipv4", "tcp", 0, pkt_list, [0, 0, 0, 0]) - self.run_port_list("ipv4", "tcp", 1, pkt_list, [-1, 1, 1, 1]) - self.run_port_list("ipv4", "tcp", 2, pkt_list, [2, -1, -1, 2]) - self.run_port_list("ipv4", "tcp", 3, pkt_list, [3, 3, 3, -1]) - if len(self.dut_ports) == 2: - self.run_port_list("ipv4", "tcp", 0, pkt_list, [0, 0, 0, 0]) - self.run_port_list("ipv4", "tcp", 1, pkt_list, [-1, 1, 1, 1]) - self.run_port_list("ipv4", "tcp", 2, pkt_list, [0, -1, -1, 0]) - self.run_port_list("ipv4", "tcp", 3, pkt_list, [1, 1, 1, -1]) - - pkt_list = self.run_param(cbs=300, pbs=400, head=40) - if len(self.dut_ports) == 4: - self.run_port_list("ipv4", "tcp", 4, pkt_list, [-1, 0, 0, 0]) - self.run_port_list("ipv4", "tcp", 5, pkt_list, [1, -1, -1, 1]) - self.run_port_list("ipv4", "tcp", 6, pkt_list, [2, 2, 2, -1]) - self.run_port_list("ipv4", "tcp", 7, pkt_list, [-1, -1, -1, -1]) - if len(self.dut_ports) == 2: - self.run_port_list("ipv4", "tcp", 4, pkt_list, [-1, 0, 0, 0]) - self.run_port_list("ipv4", "tcp", 5, pkt_list, [1, -1, -1, 1]) - self.run_port_list("ipv4", "tcp", 6, pkt_list, [0, 0, 0, -1]) - self.run_port_list("ipv4", "tcp", 7, pkt_list, [-1, -1, -1, -1]) - - def test_ipv4_RFC2698_pre_colored_red_by_DSCP_table(self): - """ - Test Case 10: ipv4 RFC2698 pre-colored red by DSCP table - """ - self.update_firmware_cli(caseID=10) - cbs = 400 - pbs = 500 - pkt_list = self.run_param(cbs=cbs, pbs=pbs, head=40) - self.start_testpmd(self.new_firmware_cli) - self.add_port_meter_profile(profile_id=0, cbs=cbs, pbs=pbs) - self.dut.send_expect("start", "testpmd>") - - # test 0: GYR - self.add_port_meter_policy( - self.port_id, - policy_id=0, - g_actions="green", - y_actions="yellow", - r_actions="red", - ) - self.create_port_meter( - self.port_id, mtr_id=0, profile_id=0, policy_id=0, gyrd_action="0 0 0" - ) - self.create_flow_rule( - ret_id=1, - ip_ver="ipv4", - protocol="tcp", - spec_id=2, - mtr_id=0, - queue_index_id=0, - ) - self.run_port_list("ipv4", "tcp", 2, pkt_list, [0, 0, 0, 0]) - - # test 1: GYD - self.add_port_meter_policy( - self.port_id, - policy_id=1, - g_actions="green", - y_actions="yellow", - r_actions="drop", - ) - self.create_port_meter( - self.port_id, mtr_id=1, profile_id=0, policy_id=1, gyrd_action="0 0 0" - ) - self.create_flow_rule( - ret_id=1, - ip_ver="ipv4", - protocol="tcp", - spec_id=2, - mtr_id=1, - queue_index_id=0, - ) - self.run_port_list("ipv4", "tcp", 2, pkt_list, [-1, -1, -1, -1]) - - # test 2: GDR - self.add_port_meter_policy( - self.port_id, - policy_id=2, - g_actions="green", - y_actions="drop", - r_actions="red", - ) - self.create_port_meter( - self.port_id, mtr_id=2, profile_id=0, policy_id=2, gyrd_action="0 0 0" - ) - self.create_flow_rule( - ret_id=1, - ip_ver="ipv4", - protocol="tcp", - spec_id=2, - mtr_id=2, - queue_index_id=0, - ) - self.run_port_list("ipv4", "tcp", 2, pkt_list, [0, 0, 0, 0]) - - # test 3: DYR - self.add_port_meter_policy( - self.port_id, - policy_id=3, - g_actions="drop", - y_actions="yellow", - r_actions="red", - ) - self.create_port_meter( - self.port_id, mtr_id=3, profile_id=0, policy_id=3, gyrd_action="0 0 0" - ) - self.create_flow_rule( - ret_id=1, - ip_ver="ipv4", - protocol="tcp", - spec_id=2, - mtr_id=3, - queue_index_id=0, - ) - self.run_port_list("ipv4", "tcp", 2, pkt_list, [0, 0, 0, 0]) - - def test_ipv4_RFC2698_pre_colored_yellow_by_DSCP_table(self): - """ - Test Case 11: ipv4 RFC2698 pre-colored yellow by DSCP table - """ - self.update_firmware_cli(caseID=11) - cbs = 400 - pbs = 500 - pkt_list = self.run_param(cbs=cbs, pbs=pbs, head=40) - self.start_testpmd(self.new_firmware_cli) - self.add_port_meter_profile(profile_id=0, cbs=cbs, pbs=pbs) - self.dut.send_expect("start", "testpmd>") - - # test 0: GYR - self.add_port_meter_policy( - self.port_id, - policy_id=0, - g_actions="green", - y_actions="yellow", - r_actions="red", - ) - self.create_port_meter( - self.port_id, mtr_id=0, profile_id=0, policy_id=0, gyrd_action="0 0 0" - ) - self.create_flow_rule( - ret_id=1, - ip_ver="ipv4", - protocol="tcp", - spec_id=2, - mtr_id=0, - queue_index_id=0, - ) - self.run_port_list("ipv4", "tcp", 2, pkt_list, [0, 0, 0, 0]) - - # test 1: GYD - self.add_port_meter_policy( - self.port_id, - policy_id=1, - g_actions="green", - y_actions="yellow", - r_actions="drop", - ) - self.create_port_meter( - self.port_id, mtr_id=1, profile_id=0, policy_id=1, gyrd_action="0 0 0" - ) - self.create_flow_rule( - ret_id=1, - ip_ver="ipv4", - protocol="tcp", - spec_id=2, - mtr_id=1, - queue_index_id=0, - ) - self.run_port_list("ipv4", "tcp", 2, pkt_list, [-1, 0, 0, 0]) - - # test 2: GDR - self.add_port_meter_policy( - self.port_id, - policy_id=2, - g_actions="green", - y_actions="drop", - r_actions="red", - ) - self.create_port_meter( - self.port_id, mtr_id=2, profile_id=0, policy_id=2, gyrd_action="0 0 0" - ) - self.create_flow_rule( - ret_id=1, - ip_ver="ipv4", - protocol="tcp", - spec_id=2, - mtr_id=2, - queue_index_id=0, - ) - self.run_port_list("ipv4", "tcp", 2, pkt_list, [0, -1, -1, -1]) - - # test 3: DYR - self.add_port_meter_policy( - self.port_id, - policy_id=3, - g_actions="drop", - y_actions="yellow", - r_actions="red", - ) - self.create_port_meter( - self.port_id, mtr_id=3, profile_id=0, policy_id=3, gyrd_action="0 0 0" - ) - self.create_flow_rule( - ret_id=1, - ip_ver="ipv4", - protocol="tcp", - spec_id=2, - mtr_id=3, - queue_index_id=0, - ) - self.run_port_list("ipv4", "tcp", 2, pkt_list, [0, 0, 0, 0]) - - def test_ipv4_RFC2698_pre_colored_green_by_DSCP_table(self): - """ - Test Case 12: ipv4 RFC2698 pre-colored green by DSCP table - """ - self.update_firmware_cli(caseID=12) - cbs = 400 - pbs = 500 - pkt_list = self.run_param(cbs=cbs, pbs=pbs, head=40) - self.start_testpmd(self.new_firmware_cli) - self.add_port_meter_profile(profile_id=0, cbs=cbs, pbs=pbs) - self.dut.send_expect("start", "testpmd>") - - # test 0: GYR - self.add_port_meter_policy( - self.port_id, - policy_id=0, - g_actions="green", - y_actions="yellow", - r_actions="red", - ) - self.create_port_meter( - self.port_id, mtr_id=0, profile_id=0, policy_id=0, gyrd_action="0 0 0" - ) - self.create_flow_rule( - ret_id=1, - ip_ver="ipv4", - protocol="tcp", - spec_id=2, - mtr_id=0, - queue_index_id=0, - ) - self.run_port_list("ipv4", "tcp", 2, pkt_list, [0, 0, 0, 0]) - - # test 1: GYD - self.add_port_meter_policy( - self.port_id, - policy_id=1, - g_actions="green", - y_actions="yellow", - r_actions="drop", - ) - self.create_port_meter( - self.port_id, mtr_id=1, profile_id=0, policy_id=1, gyrd_action="0 0 0" - ) - self.create_flow_rule( - ret_id=1, - ip_ver="ipv4", - protocol="tcp", - spec_id=2, - mtr_id=1, - queue_index_id=0, - ) - self.run_port_list("ipv4", "tcp", 2, pkt_list, [-1, 0, 0, 0]) - - # test 2: GDR - self.add_port_meter_policy( - self.port_id, - policy_id=2, - g_actions="green", - y_actions="drop", - r_actions="red", - ) - self.create_port_meter( - self.port_id, mtr_id=2, profile_id=0, policy_id=2, gyrd_action="0 0 0" - ) - self.create_flow_rule( - ret_id=1, - ip_ver="ipv4", - protocol="tcp", - spec_id=2, - mtr_id=2, - queue_index_id=0, - ) - self.run_port_list("ipv4", "tcp", 2, pkt_list, [0, -1, -1, 0]) - - # test 3: DYR - self.add_port_meter_policy( - self.port_id, - policy_id=3, - g_actions="drop", - y_actions="yellow", - r_actions="red", - ) - self.create_port_meter( - self.port_id, mtr_id=3, profile_id=0, policy_id=3, gyrd_action="0 0 0" - ) - self.create_flow_rule( - ret_id=1, - ip_ver="ipv4", - protocol="tcp", - spec_id=2, - mtr_id=3, - queue_index_id=0, - ) - self.run_port_list("ipv4", "tcp", 2, pkt_list, [0, 0, 0, -1]) - - def test_ipv4_RFC2698_pre_colored_default_by_DSCP_table(self): - """ - Test Case 13: ipv4 RFC2698 pre-colored by default DSCP table - """ - self.update_firmware_cli(caseID=13) - cbs = 400 - pbs = 500 - pkt_list = self.run_param(cbs=cbs, pbs=pbs, head=40) - self.start_testpmd(self.new_firmware_cli) - self.add_port_meter_profile(profile_id=0, cbs=cbs, pbs=pbs) - self.dut.send_expect("start", "testpmd>") - - # test 0: GYR - self.add_port_meter_policy( - self.port_id, - policy_id=0, - g_actions="green", - y_actions="yellow", - r_actions="red", - ) - self.create_port_meter( - self.port_id, mtr_id=0, profile_id=0, policy_id=0, gyrd_action="0 0 0" - ) - self.create_flow_rule( - ret_id=1, - ip_ver="ipv4", - protocol="tcp", - spec_id=2, - mtr_id=0, - queue_index_id=0, - ) - self.run_port_list("ipv4", "tcp", 2, pkt_list, [0, 0, 0, 0]) - - # test 1: GYD - self.add_port_meter_policy( - self.port_id, - policy_id=1, - g_actions="green", - y_actions="yellow", - r_actions="drop", - ) - self.create_port_meter( - self.port_id, mtr_id=1, profile_id=0, policy_id=1, gyrd_action="0 0 0" - ) - self.create_flow_rule( - ret_id=1, - ip_ver="ipv4", - protocol="tcp", - spec_id=2, - mtr_id=1, - queue_index_id=0, - ) - self.run_port_list("ipv4", "tcp", 2, pkt_list, [-1, 0, 0, 0]) - - # test 2: GDR - self.add_port_meter_policy( - self.port_id, - policy_id=2, - g_actions="green", - y_actions="drop", - r_actions="red", - ) - self.create_port_meter( - self.port_id, mtr_id=2, profile_id=0, policy_id=2, gyrd_action="0 0 0" - ) - self.create_flow_rule( - ret_id=1, - ip_ver="ipv4", - protocol="tcp", - spec_id=2, - mtr_id=2, - queue_index_id=0, - ) - self.run_port_list("ipv4", "tcp", 2, pkt_list, [0, -1, -1, 0]) - - # test 3: DYR - self.add_port_meter_policy( - self.port_id, - policy_id=3, - g_actions="drop", - y_actions="yellow", - r_actions="red", - ) - self.create_port_meter( - self.port_id, mtr_id=3, profile_id=0, policy_id=3, gyrd_action="0 0 0" - ) - self.create_flow_rule( - ret_id=1, - ip_ver="ipv4", - protocol="tcp", - spec_id=2, - mtr_id=3, - queue_index_id=0, - ) - self.run_port_list("ipv4", "tcp", 2, pkt_list, [0, 0, 0, -1]) - - def tear_down(self): - """ - Run after each test case. - """ - self.dut.kill_all() - time.sleep(2) - - def tear_down_all(self): - """ - Run after each test suite. - """ - if self.scapy_status: - self.end_scapy() -- 2.34.1