* [PATCH 1/3] test/metering_and_policing: removed the test suite as per dpdk changes
2022-11-08 15:06 [PATCH 0/3] update testsuites that uses softnic driver Yogesh Jangra
@ 2022-11-08 15:06 ` Yogesh Jangra
2022-11-08 15:06 ` [PATCH 2/3] test/flow_classify_softnic: " Yogesh Jangra
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Yogesh Jangra @ 2022-11-08 15:06 UTC (permalink / raw)
To: dts; +Cc: cristian.dumitrescu, kamalakannan.r, harshad.suresh.narayane
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 <yogesh.jangra@intel.com>
---
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^<Hg^W&xkH>)KJsBc~0#^;`Y5Fx?(r4wcq1$U6ic2
zZONn(p|6+UXC$fDY4nBKe>(7|A>hQB531+p%N<UByX9qj=AHAK1BFyyhSpD*@i8}}
z#Qucw<2RlrUVYn~6y7Q<P~Y^2=az1v%HJ^e&OUwCV<-Fcqudp?%`P)myVlC~;6%#I
zXz}lJ{`VH~-PgDK`(dBjM8CD)?2cQNo>aK_jOX9ae<wfh?O$AwRQg!PF0C?g(&~l3
zm469OnNWZ5`IVP~w|Jj<zL=zwn{Z>h^@+(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<ee*MGO&->$9rey287OO?2JI(2EpC9w>
zr2G7+Z!6vB?|<`Iy0<;}SDX4W-$_Rs-s?;A=<M5CRJg-ipgS?6Ri)MYH+KzdvG=jF
zxf0shM^;H~tn0n;`|ByG*LQWou6BH#-*r|kPb??De$mhUUA}ACa!n@PQsF3W-old@
z!X;NUnOEq~_xIe4o^`@L#VjH22OgNQ3GrAwUSzm~L*+s4Yn><8&*}M;+rO|VxhT*s
zx3(vBa=cWN{^rcWUB`ZA)lX^fEvj%klIpYn!s5WP>ZJCm>`H0OVO39~)<?bmdcCT7
z>%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^<xPxnXZ{BOR${@;Bk(fyONes5p>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|7C7<Z~m|BSMj9*|2N&u-29LK;JdH+8t%MLS1gn<owB&C=*omTo|nh55qmy=
z-2U<2`nCUl>i?72_WO_4%BBAurq2K0D8B)0Ong9}*p$VrPcs}XqkzmM^P9c|PpIR%
r<nQ=P)5D(i<#L6;B49zNL2s9C?o5<u!-H;`|7W)UvG*`T00RR6x?pCB
diff --git a/test_plans/index.rst b/test_plans/index.rst
index 570e1c35..dc782fdf 100644
--- a/test_plans/index.rst
+++ b/test_plans/index.rst
@@ -108,7 +108,6 @@ The following are the test plans for the DPDK DTS automated test system.
loopback_virtio_user_server_mode_dsa_test_plan
mac_filter_test_plan
macsec_for_ixgbe_test_plan
- metering_and_policing_test_plan
mtu_update_test_plan
multiple_pthread_test_plan
ntb_test_plan
diff --git a/test_plans/metering_and_policing_test_plan.rst b/test_plans/metering_and_policing_test_plan.rst
deleted file mode 100644
index 67fb7f0f..00000000
--- a/test_plans/metering_and_policing_test_plan.rst
+++ /dev/null
@@ -1,914 +0,0 @@
-.. SPDX-License-Identifier: BSD-3-Clause
- Copyright(c) 2015-2018 Intel Corporation
-
-=====================
-metering and policing
-=====================
-
-Description
------------
-The SoftNIC allows building custom NIC pipelines in SW. The Soft NIC pipeline
-is configurable through firmware (DPDK Packet Framework script).
-
-In RFC2698, the behavior of the Meter is specified as below:
-When a packet of size B bytes arrives at time t, the following
-happens if the trTCM is configured to operate:
-
-* in the Color-Blind mode:
-
- * If Tp(t)-B < 0, the packet is red, else
- * If Tc(t)-B < 0, the packet is yellow and Tp is decremented by B, else
- * The packet is green and both Tp and Tc are decremented by B.
-
-* in the Color-Aware mode:
-
- * If the packet has been precolored as red or if Tp(t)-B < 0, the packet is red, else
- * If the packet has been precolored as yellow or if Tc(t)-B < 0, the packet is yellow and Tp is decremented by B, else
- * The packet is green and both Tp and Tc are decremented by B.
-
-DPDK meter library (librte_meter) implements these two mode separately
-and made through different APIs. In table meter action implementation,
-always color aware mode API is invoked regardless of dscp table.
-
-Prerequisites
--------------
-The DUT must have four 10G Ethernet ports connected to four ports on
-Tester that are controlled by the Scapy packet generator,
-
- ::
-
- dut_port_0 <---> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/3] test/flow_classify_softnic: removed the test suite as per dpdk changes
2022-11-08 15:06 [PATCH 0/3] update testsuites that uses softnic driver Yogesh Jangra
2022-11-08 15:06 ` [PATCH 1/3] test/metering_and_policing: removed the test suite as per dpdk changes Yogesh Jangra
@ 2022-11-08 15:06 ` Yogesh Jangra
2022-11-08 15:06 ` [PATCH 3/3] test/softnic: updated softnic test suite as per dpdk 22.11 changes Yogesh Jangra
2022-11-30 6:32 ` [PATCH 0/3] update testsuites that uses softnic driver Tu, Lijuan
3 siblings, 0 replies; 5+ messages in thread
From: Yogesh Jangra @ 2022-11-08 15:06 UTC (permalink / raw)
To: dts; +Cc: cristian.dumitrescu, kamalakannan.r, harshad.suresh.narayane
Flow classify softnic testsuite used the Soft NIC driver. In dpdk 22.11
release Soft NIC driver is using rte_swx_pipeline_xxx library. Support for
the flow CLI has been removed. So removed the test suite and dependencies
related to that.
Signed-off-by: Yogesh Jangra <yogesh.jangra@intel.com>
---
dep/flow_classify_softnic.tar.gz | Bin 1610 -> 0 bytes
.../flow_classify_softnic_test_plan.rst | 1261 -------
test_plans/index.rst | 1 -
tests/TestSuite_flow_classify_softnic.py | 3003 -----------------
4 files changed, 4265 deletions(-)
delete mode 100644 dep/flow_classify_softnic.tar.gz
delete mode 100644 test_plans/flow_classify_softnic_test_plan.rst
delete mode 100644 tests/TestSuite_flow_classify_softnic.py
diff --git a/dep/flow_classify_softnic.tar.gz b/dep/flow_classify_softnic.tar.gz
deleted file mode 100644
index bbcfe73918dd2eb4efc68ec6662ef610c52bdd7f..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 1610
zcmaLV`CF3t0tIky=1Lna)MSXJWj0hUqY3D6uT}%2q2pwRsTlfbO^zmuqmK2)&5_ax
z+?QNiOf;9w(8=Xu<)oNvYNkn=;-H}^4Hyu--|61@{hrT1aL)4_OuDH-*f=@Zz;G$#
zIJ1bfNktXWd95Z<GQ@?&;TZoa22PkOQD+pHdv`}(H~PocE{%#Xk63%^@+O;zb{RwL
zu-=fK`f)yHV#@$z$#W;9O^Tm8e6UlDp!IQ0fqq8M9sVdY*9>T;d`SJjSXW4+a>$W`
z&h*8P4n2<Pbb_rEtJEhHg#>)cr28l7W#=W+TwL<~+uXNMV`Z3I+|$Y^0_)9n_hu?a
zY~)&zyrgBOHz>6TVJY)UkF#ehZti%oS|!>|6D8~7;c+x>xEm+3Bn-bQ`Hhl5hP7Hn
za51#9NR_Uu>oy@Km`Ofy)y+f8Dc`S_2K$D0eJ_97v2p2@s`3g)M!|?>a#8HQF9<{u
zBk@pG9C?9oqp2a;!eZT;!xwTmUa<by8atNW@l1|7n=I}05`u(zo>|{`)o5o)R_pwB
zWO0Oc19U0y89RFXMbp{Eftg&kQWsJSS4QxU+OQ8cT$JHDE%(sO%sio)>febXzpP%t
z91a=tol~M^>>{J#Z8n;3NpezL{nL3bzaQaP5oF=fFKYBH%bL<(c0H1`k~P_Pj8EBx
zjC_;Pt)CNIX`_}r#E&=sOs|+tJ2=pgJkr3HTRjp^aPCnERv&K?5hHisE5Byly1G^5
z6ht3rdKDG*;>W&1*69MY*zZ4*9n19-QbO<XwBF)h56h&k;Z0w?x!=#bxvy06V=UG~
znU&5u-A1aZp|O1n_hcuzhpsxs?_KRp4>a^TKKDECtoT{Y`)A_5S!>p!<6DdEV}*M^
z*`I3-X<kYI^)tXBEyw|^*`_;WA62B~J6m^vpusILty$qyl>3?@ef{p8aZG{4o{Mj4
z<J7(q?XEi0Dc^A|aw2tdywn4YqcWDvUJuNSI#%5rI#q?`i6n~mmlkj2d`tauYGQwU
zAZ{YSTe!adj7`f4qVU(mE#X6<foM`@uCUHHT=PrN`eSh<m%zz_F-bvwH1=H#_9fmw
zW+;=v$8UC{M2`W++0MoeCMu>Qq|C5dNzAVT`Ei+QfVD3N>}gvi#J%Jt0J++HLZWNo
zqpZ=Q2X1_pY<nzeH8i)Tm#NdqdnVII)h8Q0^$sqGK*;e1){&k^;+!m5VcP}QdgqN)
z2HZLsq}u(m-Bfsx>R<MQblbLodoj`$i>jA<ydNw^thoKV3+c|Aj+1Wns{l)xV?sbP
zjl8R+?YstP=S=4z^ktX}kJW(D0~KM!d_`CF%uUqa_(-;r_IlT#xxUM2Kn?XB0cMYJ
z%CZg0BLE%Twa^2wf;&x43vTT-q$|<o6&c3VYJ=56<HQGor{Dk$2&7Q|br-<I^MQG)
z&i8-;z!U(&EeK6PWw?=c*<P9yNP)sFI$s}P1BVCM17_ZeC<mpcnIt^{S3xmF7xmOR
zuHk}@bSmZ4vfSgM*Fvc2R%^eMe<If$_3+Gvi@Zg7l=2?+#^>`yYm@?`h8~vNX_u$*
zbw9yn#)=}=BeKr8)Fy#9jl;7?W&lqPiGB2k4%QykA2QU{8%~2+85m(d*a$DTh3_-@
zj9Xg%HCPTct4Rad^s@8tVU12R_2f?x>N42a3+i_?I?dAmRh!<DSYlyRpOnd*2*yjf
zW_Juf^CFy3h*Gs>Pr64SS)NNhu>a!kC83oXi~uBNtjoA4&JEd2Hb-V6ct<wdW?5yf
zy=F_Y6_;1Tt*Ki6x2g&ahJ2vl4t)FCM@abj9GDM~i$FB28E|dA=OSs@?1cOu1^dJT
zQKAAV_faa40d5-&LW9r^)s$2B+4#b+b+Nl5Q2*t}!E5W~TIhw(tmw(9Hn7JJP!UPD
zz=pb6)*Q6$g#YP6Wn_DFx5~3_JEOhj7#bd<0^eRaU_AZ~e1qr!CVv3lJdK-eWQ)i$
z5?dbLuc3MAiR57&hMcbgD{wwanF5diSEBY^I86^IO?_x(^?|v`&2!q6W3!gG%Gs~4
zybaS_VVm&}fcW@xQI8?WWGqgf4p^2Q=XSQ8+u6Z6Z(e8r+g*eIpD?}}W9J@^HRv`l
F_zU2)ON0Ob
diff --git a/test_plans/flow_classify_softnic_test_plan.rst b/test_plans/flow_classify_softnic_test_plan.rst
deleted file mode 100644
index f34608e8..00000000
--- a/test_plans/flow_classify_softnic_test_plan.rst
+++ /dev/null
@@ -1,1261 +0,0 @@
-.. SPDX-License-Identifier: BSD-3-Clause
- Copyright(c) 2017 Intel Corporation
-
-===================================
-Flow classification for softnic PMD
-===================================
-
-Description
-===========
-The SoftNIC allows building custom NIC pipelines in SW. The Soft NIC pipeline is configurable through firmware (DPDK Packet Framework script).
-
-Prerequisites
-=============
-The DUT can have 4*10G Ethernet ports or 2*10G Ethernet ports.
-We design case with 4*10G Ethernet ports.
-The DUT have four 10G Ethernet ports connected to four ports on tester that are controlled by the Scapy packet generator::
-
- dut_port_0 <---> 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 05:00.2 05:00.3
-
-Change ./drivers/net/softnic/firmware.cli to meet the specific test environment.
-Change ports info to your actual ports info::
-
- 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
-
-Other changes are shown in each case.
-
-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,cpu_id=1,conn_port=8086' \
- -- -i --portmask=0x10
- testpmd> start
-
-Test Case: ipv4 ACL table
-=========================
-1. Edit flow_classification_firmware.cli to change "table action" and "pipeline table" as below::
-
- table action profile AP0 ipv4 offset 270 fwd
- 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 0x1f -s 0x10 -n 4 --vdev 'net_softnic0, \
- firmware=./drivers/net/softnic/flow_ipv4_acl_firmware.cli,cpu_id=1,conn_port=8086' \
- -- -i --rxq=4 --txq=4 --disable-rss --portmask=0x10
-
-3. Validate a rule::
-
- flow validate 4 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 0.0.0.0 \
- dst mask 255.192.0.0 src spec 0.0.0.0 dst spec 2.0.0.0 proto spec 17 / udp src mask \
- 65535 dst mask 65535 src spec 100 dst spec 200 / end actions queue index 3 / end
-
-4. Add rules to table::
-
- flow create 4 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 0.0.0.0 \
- dst mask 255.192.0.0 src spec 0.0.0.0 dst spec 2.0.0.0 proto spec 17 / udp src mask \
- 65535 dst mask 65535 src spec 100 dst spec 200 / end actions queue index 3 / end
-
- flow create 4 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 0.0.0.0 \
- dst mask 255.192.0.0 src spec 0.0.0.0 dst spec 2.64.0.0 proto spec 6 / tcp src mask
- 65535 dst mask 65535 src spec 100 dst spec 200 / end actions queue index 2 / end
-
- flow create 4 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.192.0.0 \
- dst mask 0.0.0.0 src spec 2.128.0.0 dst spec 0.0.0.0 proto spec 132 / sctp src mask \
- 65535 dst mask 65535 src spec 100 dst spec 200 / end actions queue index 1 / end
-
- flow create 4 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 0.0.0.0 \
- dst mask 255.192.0.0 src spec 0.0.0.0 dst spec 4.0.0.0 proto spec 17 / udp src mask \
- 65535 dst mask 65535 src spec 100 dst spec 200 / end actions queue index 0 / end
- testpmd> start
-
-5. Sent packet, verify the packets were forwarded to the expected ports::
-
- sendp(Ether(dst='00:00:00:00:01:00')/IP(src='0.0.0.0', dst='2.0.0.0',proto=17)/UDP(sport=100, dport=200)/('X'*48), iface="enp131s0f3")
- sendp(Ether(dst='00:00:00:00:01:00')/IP(src='0.0.0.0', dst='2.64.0.0',proto=6)/TCP(sport=100, dport=200)/('X'*48), iface="enp131s0f3")
- sendp(Ether(dst='00:00:00:00:01:00')/IP(src='2.128.0.0', dst='0.0.0.0',proto=132)/SCTP(sport=100, dport=200)/('X'*48), iface="enp131s0f3")
- sendp(Ether(dst='00:00:00:00:01:00')/IP(src='0.0.0.0', dst='4.0.0.0',proto=17)/UDP(sport=100, dport=200)/('X'*48), iface="enp131s0f3")
- sendp(Ether(dst='00:00:00:00:01:00')/IP(src='0.0.0.0', dst='3.0.0.0',proto=17)/UDP(sport=100, dport=200)/('X'*48), iface="enp131s0f3")
- sendp(Ether(dst='00:00:00:00:01:00')/IP(src='0.0.0.0', dst='2.64.0.0',proto=17)/UDP(sport=100, dport=200)/('X'*48), iface="enp131s0f3")
- sendp(Ether(dst='00:00:00:00:01:00')/IP(src='2.128.0.0', dst='0.0.0.0',proto=132)/SCTP(sport=101, dport=200)/('X'*48), iface="enp131s0f3")
-
- The first 4 packets were forwarded to port3/2/1/0.
- The last 3 packets weren't forwarded.
-
-6. Query the rule::
-
- testpmd> flow query 4 3 queue
- Cannot query action type 6 (QUEUE)
-
-7. destroy and flush the rule::
-
- testpmd> flow list 4
- ID Group Prio Attr Rule
- 0 0 0 i-- ETH IPV4 UDP => QUEUE
- 1 0 0 i-- ETH IPV4 TCP => QUEUE
- 2 0 0 i-- ETH IPV4 SCTP => QUEUE
- 3 0 0 i-- ETH IPV4 UDP => QUEUE
-
- testpmd> flow destroy 4 rule 1
- Flow rule #1 destroyed
- testpmd> flow list 4
- ID Group Prio Attr Rule
- 0 0 0 i-- ETH IPV4 UDP => QUEUE
- 2 0 0 i-- ETH IPV4 SCTP => QUEUE
- 3 0 0 i-- ETH IPV4 UDP => QUEUE
-
-8. Send packets, pkt1 to port3, pkt2 can't be forwarded, pkt3 to port1, pkt4 to port0::
-
- testpmd> flow flush 4
- testpmd> flow list 4
-
- No rule listed.
- Send the first 4 packets, none of them was forwarded.
-
-9. Shutdown the port, the rules will be flushed.
- Re-add the four rules, then start forward.
- The first 4 packets can be forwarded to port3/2/1/0.
- Then::
-
- testpmd> stop
- testpmd> port stop 4
- testpmd> port start 4
- testpmd> start
-
- Send the first 4 packets, none of them was forwarded.
-
-Notes: The IPv4 header source address mask must be set from high bits to low bits.
-255.255.192.0 is legal.
-255.192.255.0 is illegal.
-
-Test Case: ipv4-5tuple hash table
-=================================
-1. Edit flow_classification_firmware.cli to change "table action" and "pipeline table" as below::
-
- table action profile AP0 ipv4 offset 270 fwd
- pipeline RX table match hash ext key 16 mask 00FF0000FFFFFFFFFFFFFFFFFFFFFFFF \
- offset 278 buckets 16K size 64K action AP0
- flowapi map group 0 ingress pipeline RX table 0
-
-2. Start softnic::
-
- ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x1f -s 0x10 -n 4 --vdev 'net_softnic0, \
- firmware=./drivers/net/softnic/flow_ipv4_5tuple_hash_firmware.cli,cpu_id=1,conn_port=8086' \
- -- -i --rxq=4 --txq=4 --disable-rss --portmask=0x10
-
-3. Add rules to table::
-
- 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 100.0.0.1 dst spec 200.0.0.1 proto spec 6 / udp src mask \
- 65535 dst mask 65535 src spec 101 dst spec 201 / end actions 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 100.0.0.2 dst spec 200.0.0.2 proto spec 17 / udp src mask \
- 65535 dst mask 65535 src spec 102 dst spec 202 / end actions 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 100.0.0.3 dst spec 200.0.0.3 proto spec 132 / udp src mask \
- 65535 dst mask 65535 src spec 103 dst spec 203 / end actions 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 100.0.0.4 dst spec 200.0.0.4 proto spec 17 / udp src mask \
- 65535 dst mask 65535 src spec 104 dst spec 204 / end actions queue index 0 / end
-
- testpmd> start
-
-4. Sent packet, verify the packets were forwarded to the expected ports::
-
- sendp(Ether(dst='00:00:00:00:01:00')/IP(src='100.0.0.1', dst='200.0.0.1',proto=6)/TCP(sport=101, dport=201)/('X'*48), iface="enp131s0f3")
- sendp(Ether(dst='00:00:00:00:01:00')/IP(src='100.0.0.2', dst='200.0.0.2',proto=17)/UDP(sport=102, dport=202)/('X'*48), iface="enp131s0f3")
- sendp(Ether(dst='00:00:00:00:01:00')/IP(src='100.0.0.3', dst='200.0.0.3',proto=132)/SCTP(sport=103, dport=203)/('X'*48), iface="enp131s0f3")
- sendp(Ether(dst='00:00:00:00:01:00')/IP(src='100.0.0.4', dst='200.0.0.4',proto=17)/UDP(sport=104, dport=204)/('X'*48), iface="enp131s0f3")
-
- The first 4 packets were forwarded to port3/2/1/0.
- Change any parameter of the 5 tuple, the packet can't forwarded to any port.
-
-Test Case: ipv4-addr hash table
-===============================
-1. Edit flow_classification_firmware.cli to change "table action" and "pipeline table" as below::
-
- table action profile AP0 ipv4 offset 270 fwd
-
-a) Match ipv4 src_addr::
-
- pipeline RX table match hash ext key 8 mask FFFFFFFF00000000 offset 282 buckets 16K size 64K action AP0
-
-b) Match ipv4 dst_addr::
-
- pipeline RX table match hash ext key 8 mask FFFFFF0000000000 offset 286 buckets 16K size 64K action AP0
-
-c) Match UDP SPORT::
-
- pipeline RX table match hash ext key 8 mask FFFF000000000000 offset 290 buckets 16K size 64K action AP0
-
- flowapi map group 0 ingress pipeline RX table 0
-
-2. Start softnic::
-
- ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x1f -s 0x10 -n 4 --vdev 'net_softnic0, \
- firmware=./drivers/net/softnic/flow_ipv4_addr_hash_firmware.cli,cpu_id=1,conn_port=8086' \
- -- -i --rxq=4 --txq=4 --disable-rss --portmask=0x10
-
-3. Add rules to table.
-
-a) Match the table a::
-
- testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 0 src mask \
- 255.255.255.255 dst mask 0.0.0.0 src spec 100.0.0.1 dst spec 200.0.0.1 proto spec 17 \
- / udp src mask 0 dst mask 0 src spec 100 dst spec 200 / end actions queue index 3 / end
-
- testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 0 src mask \
- 255.255.255.255 dst mask 0.0.0.0 src spec 100.0.0.2 dst spec 200.0.0.1 proto spec 17 \
- / udp src mask 0 dst mask 0 src spec 100 dst spec 200 / end actions queue index 2 / end
-
- testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 0 src mask \
- 255.255.255.255 dst mask 0.0.0.0 src spec 100.0.0.3 dst spec 200.0.0.1 proto spec 17 \
- / udp src mask 0 dst mask 0 src spec 100 dst spec 200 / end actions queue index 1 / end
-
- testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 0 src mask \
- 255.255.255.255 dst mask 0.0.0.0 src spec 100.0.0.4 dst spec 200.0.0.1 proto spec 17 \
- / udp src mask 0 dst mask 0 src spec 100 dst spec 200 / end actions queue index 0 / end
-
-b) Match the table b::
-
- testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 0 src mask 0.0.0.0 \
- dst mask 255.255.255.0 src spec 100.0.0.1 dst spec 200.0.0.1 proto spec 17 / udp src mask 0 \
- dst mask 0 src spec 100 dst spec 200 / end actions queue index 3 / end
-
- testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 0 src mask 0.0.0.0 \
- dst mask 255.255.255.0 src spec 100.0.0.1 dst spec 200.0.1.1 proto spec 6 / tcp src mask 0 \
- dst mask 0 src spec 100 dst spec 200 / end actions queue index 2 / end
-
- testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 0 src mask 0.0.0.0 \
- dst mask 255.255.255.0 src spec 100.0.0.1 dst spec 200.0.2.1 proto spec 132 / sctp src mask 0 \
- dst mask 0 src spec 100 dst spec 200 / end actions queue index 1 / end
-
- testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 0 src mask 0.0.0.0 \
- dst mask 255.255.255.0 src spec 100.0.0.1 dst spec 200.0.3.1 / end actions queue index 0 / end
-
-c) Match the table c::
-
- testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 0 src mask 0.0.0.0 \
- dst mask 0.0.0.0 src spec 100.0.0.1 dst spec 200.0.0.1 proto spec 17 / udp src mask 65535 \
- dst mask 0 src spec 100 dst spec 200 / end actions queue index 3 / end
-
- testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 0 src mask 0.0.0.0 \
- dst mask 0.0.0.0 src spec 100.0.0.1 dst spec 200.0.0.1 proto spec 6 / tcp src mask 65535 \
- dst mask 0 src spec 101 dst spec 200 / end actions queue index 2 / end
-
- testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 0 src mask 0.0.0.0 \
- dst mask 0.0.0.0 src spec 100.0.0.1 dst spec 200.0.0.1 proto spec 132 / sctp src mask 65535 \
- dst mask 0 src spec 102 dst spec 200 / end actions queue index 1 / end
-
- testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 0 src mask 0.0.0.0 \
- dst mask 0.0.0.0 src spec 100.0.0.1 dst spec 200.0.0.1 proto spec 17 / udp src mask 65535 \
- dst mask 0 src spec 103 dst spec 200 / end actions queue index 0 / end
-
- testpmd> start
-
- Notes: The added rule must be consistent with the match table format defined in firmware.cli
-
-4. Sent packet, verify the packets were forwarded to the expected ports.
-
-a) Match ipv4 src_addr::
-
- sendp(Ether(dst='00:00:00:00:01:00')/IP(src='100.0.0.1', dst='200.0.0.1',proto=6)/TCP(sport=101, dport=201)/('X'*48), iface="enp131s0f3")
- sendp(Ether(dst='00:00:00:00:01:00')/IP(src='100.0.0.2', dst='200.0.0.2',proto=17)/UDP(sport=102, dport=202)/('X'*48), iface="enp131s0f3")
- sendp(Ether(dst='00:00:00:00:01:00')/IP(src='100.0.0.3', dst='200.0.0.3',proto=132)/SCTP(sport=103, dport=203)/('X'*48), iface="enp131s0f3")
- sendp(Ether(dst='00:00:00:00:01:00')/IP(src='100.0.0.4', dst='200.0.0.4')/('X'*48), iface="enp131s0f3")
-
- The 4 packets were forwarded to port3/2/1/0.
- Change the ipv4 src address, the packet can't forwarded to any port.
-
-b) Match ipv4 dst_addr::
-
- sendp(Ether(dst='00:00:00:00:01:00')/IP(src='100.0.0.1', dst='200.0.0.1',proto=6)/TCP(sport=101, dport=201)/('X'*48), iface="enp131s0f3")
- sendp(Ether(dst='00:00:00:00:01:00')/IP(src='100.0.0.2', dst='200.0.1.2',proto=17)/UDP(sport=102, dport=202)/('X'*48), iface="enp131s0f3")
- sendp(Ether(dst='00:00:00:00:01:00')/IP(src='100.0.0.3', dst='200.0.2.3',proto=132)/SCTP(sport=103, dport=203)/('X'*48), iface="enp131s0f3")
- sendp(Ether(dst='00:00:00:00:01:00')/IP(src='100.0.0.4', dst='200.0.3.4')/('X'*48), iface="enp131s0f3")
-
- The 4 packets were forwarded to port3/2/1/0.
- Change the ipv4 first 6 bytes of dst address, the packet can't forwarded to any port.
-
-c) Match sport::
-
- sendp(Ether(dst='00:00:00:00:01:00')/IP(src='100.0.0.1', dst='200.0.0.1',proto=6)/TCP(sport=100, dport=201)/('X'*48), iface="enp131s0f3")
- sendp(Ether(dst='00:00:00:00:01:00')/IP(src='100.0.0.2', dst='200.0.1.2',proto=17)/UDP(sport=101, dport=202)/('X'*48), iface="enp131s0f3")
- sendp(Ether(dst='00:00:00:00:01:00')/IP(src='100.0.0.3', dst='200.0.2.3',proto=132)/SCTP(sport=102, dport=203)/('X'*48), iface="enp131s0f3")
- sendp(Ether(dst='00:00:00:00:01:00')/IP(src='100.0.0.2', dst='200.0.1.2',proto=17)/UDP(sport=103, dport=202)/('X'*48), iface="enp131s0f3")
- sendp(Ether(dst='00:00:00:00:01:00')/IP(src='100.0.0.4', dst='200.0.3.4')/('X'*48), iface="enp131s0f3")
-
- The first 4 packets were forwarded to port3/2/1/0.
- The last packet can't forwarded to any port.
- Change the udp/tcp/sctp sport, the packet can't forwarded to any port.
-
-Test Case: ipv6 ACL table
-=========================
-1. Edit flow_classification_firmware.cli to change "table action" and "pipeline table" as below::
-
- table action profile AP0 ipv6 offset 270 fwd
- 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 0x1f -s 0x10 -n 4 --vdev 'net_softnic0, \
- firmware=./drivers/net/softnic/flow_ipv6_acl_firmware.cli,cpu_id=1,conn_port=8086' \
- -- -i --rxq=4 --txq=4 --disable-rss --portmask=0x10
-
-3. Add rules to table::
-
- testpmd> flow create 4 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 0 dst mask 0 src spec 0 dst spec 0 / end actions queue index 3 / end
-
- testpmd> flow create 4 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:6789 dst spec 0:0:0:0:0:0:0:0 proto spec 6 \
- / tcp src mask 0 dst mask 0 src spec 0 dst spec 0 / end actions queue index 2 / end
-
- testpmd> flow create 4 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:7789 dst spec 0:0:0:0:0:0:0:0 proto spec 132 \
- / sctp src mask 0 dst mask 0 src spec 0 dst spec 0 / end actions queue index 1 / end
-
- testpmd> flow create 4 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:8789 dst spec 0:0:0:0:0:0:0:0 proto spec 17 \
- / udp src mask 65535 dst mask 0 src spec 101 dst spec 0 / end actions queue index 0 / end
-
- testpmd> start
-
-4. Sent packet, verify the packets were forwarded to the expected ports::
-
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:5789", dst="2001::2",nh=17)/UDP(sport=32, dport=33)/Raw('x'*48), iface="enp131s0f3")
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:6789", dst="2001::2",nh=6)/TCP(sport=32, dport=33)/Raw('x'*48), iface="enp131s0f3")
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:7789", dst="2001::2",nh=132)/SCTP(sport=32, dport=33)/Raw('x'*48), iface="enp131s0f3")
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:8789", dst="2001::2",nh=17)/UDP(sport=101, dport=33)/Raw('x'*48), iface="enp131s0f3")
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:9789", dst="2001::2",nh=17)/UDP(sport=32, dport=33)/Raw('x'*48), iface="enp131s0f3")
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:8789", dst="2001::2",nh=17)/UDP(sport=32, dport=33)/Raw('x'*48), iface="enp131s0f3")
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:6789", dst="2001::2",nh=17)/TCP(sport=32, dport=33)/Raw('x'*48), iface="enp131s0f3")
-
- The first 4 packets were forwarded to port3/2/1/0.
- The last 3 packets weren't forwarded.
-
-Test Case: ipv6-addr hash table
-===============================
-1. Edit flow_classification_firmware.cli to change "table action" and "pipeline table" as below::
-
- table action profile AP0 ipv6 offset 270 fwd
-
-a) Match ipv6 src_addr::
-
- pipeline RX table match hash ext key 16 mask FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF offset 278 buckets 16K size 64K action AP0
-
-b) Match ipv6 dst_addr::
-
- pipeline RX table match hash ext key 16 mask FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF offset 294 buckets 16K size 64K action AP0
-
- flowapi map group 0 ingress pipeline RX table 0
-
-2. Start softnic::
-
- ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x1f -s 0x10 -n 4 --vdev 'net_softnic0, \
- firmware=./drivers/net/softnic/flow_ipv6_addr_hash_firmware.cli,cpu_id=1,conn_port=8086' \
- -- -i --rxq=4 --txq=4 --disable-rss --portmask=0x10
-
-3. Add rules to table.
-
-a) Match ipv6 src_addr::
-
- testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 0 \
- 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 0 dst mask 0 src spec 0 dst spec 0 / end actions queue index 3 / end
-
- testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 0 \
- 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:6789 dst spec 0:0:0:0:0:0:0:0 proto spec 17 \
- / udp src mask 0 dst mask 0 src spec 0 dst spec 0 / end actions queue index 2 / end
-
- testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 0 \
- 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:7789 dst spec 0:0:0:0:0:0:0:0 proto spec 17 \
- / udp src mask 0 dst mask 0 src spec 0 dst spec 0 / end actions queue index 1 / end
-
- testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 0 \
- 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:8789 dst spec 0:0:0:0:0:0:0:0 proto spec 17 \
- / udp src mask 0 dst mask 0 src spec 0 dst spec 0 / end actions queue index 0 / end
-
-b) Match ipv6 dst_addr::
-
- testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 0 \
- dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff src mask 0:0:0:0:0:0:0:0 \
- dst spec ABCD:EF01:2345:6789:ABCD:EF01:2345:5789 src spec 0:0:0:0:0:0:0:0 proto spec 17 \
- / udp src mask 0 dst mask 0 src spec 0 dst spec 0 / end actions queue index 3 / end
-
- testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 0 \
- dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff src mask 0:0:0:0:0:0:0:0 \
- dst spec ABCD:EF01:2345:6789:ABCD:EF01:2345:6789 src spec 0:0:0:0:0:0:0:0 proto spec 17 \
- / udp src mask 0 dst mask 0 src spec 0 dst spec 0 / end actions queue index 2 / end
-
- testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 0 \
- dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff src mask 0:0:0:0:0:0:0:0 \
- dst spec ABCD:EF01:2345:6789:ABCD:EF01:2345:7789 src spec 0:0:0:0:0:0:0:0 proto spec 17 \
- / udp src mask 0 dst mask 0 src spec 0 dst spec 0 / end actions queue index 1 / end
-
- testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 0 \
- dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff src mask 0:0:0:0:0:0:0:0 \
- dst spec ABCD:EF01:2345:6789:ABCD:EF01:2345:8789 src spec 0:0:0:0:0:0:0:0 proto spec 17 \
- / udp src mask 0 dst mask 0 src spec 0 dst spec 0 / end actions queue index 0 / end
-
- testpmd> start
-
-4. Sent packet, verify the packets were forwarded to the expected ports.
-
-a) Match ipv6 src_addr::
-
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:5789", dst="2001::2")/TCP(sport=32, dport=33)/Raw('x'*48), iface="enp131s0f3")
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:6789", dst="2001::2")/TCP(sport=32, dport=33)/Raw('x'*48), iface="enp131s0f3")
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:7789", dst="2001::2")/TCP(sport=32, dport=33)/Raw('x'*48), iface="enp131s0f3")
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:8789", dst="2001::2")/TCP(sport=32, dport=33)/Raw('x'*48), iface="enp131s0f3")
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:9789", dst="2001::2")/TCP(sport=32, dport=33)/Raw('x'*48), iface="enp131s0f3")
-
-b) Match ipv6 dst_addr::
-
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="0::1", dst="ABCD:EF01:2345:6789:ABCD:EF01:2345:5789")/TCP(sport=32, dport=33)/Raw('x'*48), iface="enp131s0f3")
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="0::1", dst="ABCD:EF01:2345:6789:ABCD:EF01:2345:6789")/TCP(sport=32, dport=33)/Raw('x'*48), iface="enp131s0f3")
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="0::1", dst="ABCD:EF01:2345:6789:ABCD:EF01:2345:7789")/TCP(sport=32, dport=33)/Raw('x'*48), iface="enp131s0f3")
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="0::1", dst="ABCD:EF01:2345:6789:ABCD:EF01:2345:8789")/TCP(sport=32, dport=33)/Raw('x'*48), iface="enp131s0f3")
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="0::1", dst="ABCD:EF01:2345:6789:ABCD:EF01:2345:9789")/TCP(sport=32, dport=33)/Raw('x'*48), iface="enp131s0f3")
-
- The first 4 packets were forwarded to port3/2/1/0.
- The last packet weren't be forwarded to any port.
-
-Test Case: ipv6-5tuple hash table
-=================================
-1. Edit flow_classification_firmware.cli to change "table action" and "pipeline table" as below::
-
- table action profile AP0 ipv6 offset 270 fwd
- pipeline RX table match hash ext key 64 mask 0000FF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000 offset 274 buckets 16K size 64K action AP0
- flowapi map group 0 ingress pipeline RX table 0
-
-2. Start softnic::
-
- ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x1f -s 0x10 -n 4 --vdev 'net_softnic0, \
- firmware=./drivers/net/softnic/flow_ipv6_5tuple_hash_firmware.cli,cpu_id=1,conn_port=8086' \
- -- -i --rxq=4 --txq=4 --disable-rss --portmask=0x10
-
-3. Add rules to table::
-
- testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 255 \
- src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \
- src spec 2001::1 dst spec 0::1 proto spec 17 / udp src mask 65535 dst mask 65535 src spec 31 dst spec 41 \
- / end actions queue index 3 / end
-
- testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 255 \
- src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \
- src spec 2001::2 dst spec 0::2 proto spec 6 / tcp src mask 65535 dst mask 65535 src spec 32 dst spec 42
- / end actions queue index 2 / end
-
- testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 255 \
- src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \
- src spec 2001::3 dst spec 0::3 proto spec 132 / sctp src mask 65535 dst mask 65535 src spec 33 dst spec 43 \
- / end actions queue index 1 / end
-
- testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 255 \
- src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \
- src spec 2001::4 dst spec 0::4 proto spec 6 / tcp src mask 65535 dst mask 65535 src spec 34 dst spec 44 \
- / end actions queue index 0 / end
-
- testpmd> start
-
-4. Sent packet, verify the packets were forwarded to the expected ports::
-
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="2001::1", dst="0::1")/UDP(sport=31, dport=41)/Raw('x'*48), iface="enp131s0f3")
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="2001::2", dst="0::2")/TCP(sport=32, dport=42)/Raw('x'*48), iface="enp131s0f3")
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="2001::3", dst="0::3",nh=132)/SCTP(sport=33, dport=43)/Raw('x'*48), iface="enp131s0f3")
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="2001::4", dst="0::4")/TCP(sport=34, dport=44)/Raw('x'*48), iface="enp131s0f3")
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="2001::1", dst="0::1")/TCP(sport=31, dport=41)/Raw('x'*48), iface="enp131s0f3")
-
- The first 4 packets were forwarded to port3/2/1/0.
- The last packet weren't be forwarded to any port.
-
-Test Case: ipv4 rule item inconsistent with table match format
-==============================================================
-1. Edit flow_classification_firmware.cli to change "table action" and "pipeline table" as below::
-
- table action profile AP0 ipv4 offset 270 fwd
-
-a) Match ipv4 src_addr::
-
- pipeline RX table match hash ext key 8 mask FFFFFFFF00000000 offset 282 buckets 16K size 64K action AP0
-
-b) Match ipv4 dst_addr::
-
- pipeline RX table match hash ext key 8 mask FFFFFF0000000000 offset 286 buckets 16K size 64K action AP0
-
- Map the flowapi to softnic table::
-
- flowapi map group 0 ingress pipeline RX table 0
-
-2. Start softnic::
-
- ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x1f -s 0x10 -n 4 --vdev 'net_softnic0, \
- firmware=./drivers/net/softnic/flow_ipv4_addr_hash_firmware.cli,cpu_id=1,conn_port=8086' \
- -- -i --rxq=4 --txq=4 --disable-rss --portmask=0x10
-
-3. Add rules to table.
-
-a) Map the table a::
-
- flow create 4 group 0 ingress pattern eth / ipv4 proto mask 0 src mask 0.0.0.0 \
- dst mask 255.255.255.255 src spec 100.0.0.1 dst spec 200.0.0.1 proto spec 17 \
- / udp src mask 0 dst mask 0 src spec 100 dst spec 200 / end actions queue index 3 / end
-
- Error reported, rule item is inconsistent with the table match.
- Table with hask key mask for src addr, but the rule added is for dst addr.
-
-b) Map the table b::
-
- flow create 4 group 0 ingress pattern eth / ipv4 proto mask 0 src mask 0.0.0.0 \
- dst mask 255.255.255.255 src spec 100.0.0.1 dst spec 200.0.0.1 proto spec 17 \
- / udp src mask 0 dst mask 0 src spec 100 dst spec 200 / end actions queue index 3 / end
-
- Error reported, rule item is inconsistent with the table match.
- Table with hask key mask for dst addr 255.255.255.0, but the rule added is 255.255.255.255.
-
-Test Case: ipv6 rule item inconsistent with table match format
-==============================================================
-1. Edit flow_classification_firmware.cli to change "table action" and "pipeline table" as below::
-
- table action profile AP0 ipv6 offset 270 fwd
-
-a) Match ipv6 5tuple::
-
- pipeline RX table match hash ext key 64 mask 0000FF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000 offset 274 buckets 16K size 64K action AP0
- flowapi map group 0 ingress pipeline RX table 0
-
-b) Match ipv6 dst_addr::
-
- pipeline RX table match hash ext key 16 mask FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF offset 294 buckets 16K size 64K action AP0
- flowapi map group 0 ingress pipeline RX table 0
-
-2. Start softnic::
-
- ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x1f -s 0x10 -n 4 --vdev 'net_softnic0, \
- firmware=./drivers/net/softnic/flow_ipv6_5tuple_hash_firmware.cli,cpu_id=1,conn_port=8086' \
- -- -i --rxq=4 --txq=4 --disable-rss --portmask=0x10
-
-3. Add rules to table.
-
-a) Map the table a::
-
- flow create 4 group 0 ingress pattern eth / ipv6 proto mask 255 src mask \
- ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \
- src spec 2001::1 dst spec 0::1 proto spec 17 / udp src mask 0 dst mask 65535 \
- src spec 31 dst spec 41 / end actions queue index 3 / end
-
- Error reported, rule item is inconsistent with the table match.
- Table with hask key mask for 5 tuple, but the rule added mask udp src with 0.
-
-b) Map the table b::
-
- flow create 4 group 0 ingress pattern eth / ipv6 proto mask 0 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 0 dst mask 0 src spec 0 dst spec 0 / end actions queue index 3 / end
-
- Error reported, rule item is inconsistent with the table match.
- Table with hask key mask for dst addr, but the rule added is for src addr.
-
-Test Case: ipv4 hash table rss action
-=====================================
-1. Edit flow_classification_firmware.cli to change "table action" and "pipeline table" as below::
-
- table action profile AP0 ipv4 offset 270 fwd balance offset 278 mask 00FF0000FFFFFFFFFFFFFFFFFFFFFFFF outoffset 256
-
-a) Table a::
-
- pipeline RX table match hash ext key 16 mask 00FF0000FFFFFFFFFFFFFFFFFFFFFFFF offset 278 buckets 16K size 64K action AP0
-
-b) Table b::
-
- pipeline RX table match hash ext key 16 mask 00FF0000FFFFFF00FFFFFFFFFFFFFFFF offset 278 buckets 16K size 64K action AP0
-
-c) Table c::
-
- pipeline RX table match hash ext key 8 mask FFFF0000FFFFFFFF offset 282 buckets 16K size 64K action AP0
-
- Map the flowapi to softnic table::
-
- flowapi map group 0 ingress pipeline RX table 0
-
-2. Start softnic::
-
- ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x1f -s 0x10 -n 4 --vdev 'net_softnic0, \
- firmware=./drivers/net/softnic/flow_ipv4_rss_firmware.cli,cpu_id=1,conn_port=8086'
- -- -i --rxq=4 --txq=4 --disable-rss --portmask=0x10
-
-3. Add rules to table.
-
-a) Map the table a::
-
- 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.0 dst spec 2.20.21.0 proto spec 6 / tcp src mask 65535 \
- dst mask 65535 src spec 100 dst spec 200 / end actions rss queues 3 end / 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.1 dst spec 2.20.21.1 proto spec 17 / udp src mask 65535 \
- dst mask 65535 src spec 100 dst spec 200 / end actions rss queues 2 end / 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.2 dst spec 2.20.21.2 proto spec 132 / sctp src mask 65535 \
- dst mask 65535 src spec 100 dst spec 200 / end actions rss queues 1 end / 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.3 dst spec 2.20.21.3 proto spec 6 / tcp src mask 65535 \
- dst mask 65535 src spec 100 dst spec 200 / end actions rss queues 0 end / end
-
-b) Map the table b::
-
- testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.0 \
- dst mask 255.255.255.255 src spec 1.10.11.0 dst spec 2.20.21.0 proto spec 6 / tcp src mask 65535 \
- dst mask 65535 src spec 100 dst spec 200 / end actions rss queues 0 1 2 3 end / end
-
- testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.0 \
- dst mask 255.255.255.255 src spec 1.10.12.0 dst spec 2.20.21.0 proto spec 6 / tcp src mask 65535 \
- dst mask 65535 src spec 100 dst spec 200 / end actions rss queues 0 1 2 3 end / end
-
-c) Map the table c::
-
- testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 0 src mask 255.255.0.0 \
- dst mask 255.255.255.255 src spec 1.10.11.0 dst spec 2.20.21.0 proto spec 6 / tcp src mask 0 \
- dst mask 0 src spec 100 dst spec 200 / end actions rss queues 0 end / end
-
- testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 0 src mask 255.255.0.0 \
- dst mask 255.255.255.255 src spec 1.10.11.0 dst spec 2.20.21.1 proto spec 6 / tcp src mask 0 \
- dst mask 0 src spec 100 dst spec 200 / end actions rss queues 2 3 end / end
-
- testpmd> flow create 4 group 0 ingress pattern eth / ipv4 proto mask 0 src mask 255.255.0.0 \
- dst mask 255.255.255.255 src spec 2.10.11.0 dst spec 2.20.21.1 proto spec 6 / tcp src mask 0 \
- dst mask 0 src spec 100 dst spec 200 / end actions rss queues 1 2 end / end
-
- testpmd> start
-
-4. Sent packet, verify the packets were forwarded to the expected ports.
-
-a) Match the table a::
-
- sendp(Ether(dst="00:00:00:00:01:00")/IP(src="1.10.11.0", dst="2.20.21.0")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3")
- sendp(Ether(dst="00:00:00:00:01:00")/IP(src="1.10.11.1", dst="2.20.21.1")/UDP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3")
- sendp(Ether(dst="00:00:00:00:01:00")/IP(src="1.10.11.2", dst="2.20.21.2")/SCTP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3")
- sendp(Ether(dst="00:00:00:00:01:00")/IP(src="1.10.11.3", dst="2.20.21.3")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3")
- sendp(Ether(dst="00:00:00:00:01:00")/IP(src="1.10.11.3", dst="2.20.21.3")/TCP(sport=101, dport=200)/Raw('x'*48), iface="enp131s0f3")
-
- The first 4 packets were forwarded to port3/2/1/0.
- The last packet weren't be forwarded to any port.
-
-b) Match the table b::
-
- sendp(Ether(dst="00:00:00:00:01:00")/IP(src="1.10.11.0", dst="2.20.21.0")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3")
-
- Set the src address from 1.10.11.0 to 1.10.11.255, and other parameters keep constant,
- The packets were distributed from port0 to port3 according to RSS table.::
-
- sendp(Ether(dst="00:00:00:00:01:00")/IP(src="1.10.12.0", dst="2.20.21.0")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3")
-
- Set the src address from 1.10.12.0 to 1.10.12.255, and other parameters keep constant,
- The packets were distributed from port0 to port3 according to RSS table.::
-
- sendp(Ether(dst="00:00:00:00:01:00")/IP(src="1.10.13.0", dst="2.20.21.0")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3")
-
- The packet was not be forwarded to any port.
-
-c) Match the table c::
-
- sendp(Ether(dst="00:00:00:00:01:00")/IP(src="1.10.11.0", dst="2.20.21.0")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3")
-
- Set the IP src address from 1.10.0.0 to 1.10.255.255, the packet was forwarded to port0.::
-
- sendp(Ether(dst="00:00:00:00:01:00")/IP(src="1.10.11.0", dst="2.20.21.1")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3")
-
- Set the IP src address from 1.10.0.0 to 1.10.255.255, or set sport or dport to 0-65535, the packet was forwarded to port2 or port3.::
-
- sendp(Ether(dst="00:00:00:00:01:00")/IP(src="2.10.11.0", dst="2.20.21.1")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3")
-
- Set the IP src address from 1.10.0.0 to 1.10.255.255, or set sport or dport to 0-65535, the packet was forwarded to port1 or port2.::
-
- sendp(Ether(dst="00:00:00:00:01:00")/IP(src="1.10.11.0", dst="2.20.21.2")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3")
-
- The packet weren't be forwarded to any port.
-
-Test Case: ipv6 hash table rss action
-=====================================
-1. Edit flow_classification_firmware.cli to change "table action" and "pipeline table" as below::
-
- table action profile AP0 ipv6 offset 270 fwd balance offset 274 mask 0000FF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000 outoffset 256
-
-a) Table a::
-
- pipeline RX table match hash ext key 64 mask 0000FF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000 offset 274 buckets 16K size 64K action AP0
-
-b) Table b::
-
- pipeline RX table match hash ext key 64 mask 0000FF00FFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000 offset 274 buckets 16K size 64K action AP0
-
-c) Table c::
-
- pipeline RX table match hash ext key 64 mask 00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFF000000000000000000000000000000000000000000000000 offset 274 buckets 16K size 64K action AP0
-
- Map the flowapi to softnic table::
-
- flowapi map group 0 ingress pipeline RX table 0
-
-2. Start softnic::
-
- ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x1f -s 0x10 -n 4 --vdev 'net_softnic0, \
- firmware=./drivers/net/softnic/flow_ipv6_rss_firmware.cli,cpu_id=1,conn_port=8086' \
- -- -i --rxq=4 --txq=4 --disable-rss --portmask=0x10
-
-3. Add rules to table,
-
-a) Map the table a::
-
- testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 255 \
- src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \
- src spec 2001::1 dst spec 0::1 proto spec 17 / udp src mask 65535 dst mask 65535 \
- src spec 31 dst spec 41 / end actions rss queues 3 end / end
-
- testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 255 \
- src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \
- src spec 2001::2 dst spec 0::2 proto spec 6 / tcp src mask 65535 dst mask 65535 \
- src spec 32 dst spec 42 / end actions rss queues 2 end / end
-
- testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 255 \
- src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \
- src spec 2001::3 dst spec 0::3 proto spec 132 / sctp src mask 65535 dst mask 65535 \
- src spec 33 dst spec 43 / end actions rss queues 1 end / end
-
- testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 255 \
- src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \
- src spec 2001::4 dst spec 0::4 proto spec 6 / tcp src mask 65535 dst mask 65535 \
- src spec 34 dst spec 44 / end actions rss queues 0 end / end
-
-b) Map the table b::
-
- testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 255 \
- src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:0 dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \
- src spec ABCD:EF01:2345:6789:ABCD:EF01:2345:0 dst spec 0::1 proto spec 17 / udp src mask 65535 \
- dst mask 65535 src spec 31 dst spec 41 / end actions rss queues 0 1 2 3 end / end
-
- testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 255 \
- src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:0 dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \
- src spec ABCD:EF01:2345:6789:ABCD:EF01:2346:0 dst spec 0::1 proto spec 17 / udp src mask 65535 \
- dst mask 65535 src spec 31 dst spec 41 / end actions rss queues 0 1 2 3 end / end
-
-c) Map the table c::
-
- testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 0 \
- src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:0 \
- src spec 2001::1 dst spec 1001::1 proto spec 17 / udp src mask 65535 dst mask 65535 \
- src spec 31 dst spec 41 / end actions rss queues 0 end / end
-
- testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 0 \
- src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:0 \
- src spec 2001::2 dst spec 1001::1 proto spec 6 / tcp src mask 65535 dst mask 65535 \
- src spec 32 dst spec 42 / end actions rss queues 2 3 end / end
-
- testpmd> flow create 4 group 0 ingress pattern eth / ipv6 proto mask 0 \
- src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:0 \
- src spec 2001::1 dst spec 2001::3 proto spec 132 / sctp src mask 65535 dst mask 65535 \
- src spec 33 dst spec 43 / end actions rss queues 1 2 end / end
-
- testpmd> start
-
-4. Sent packet, verify the packets were forwarded to the expected ports.
-
-a) Match the table a::
-
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="2001::1", dst="0::1")/UDP(sport=31, dport=41)/Raw('x'*48), iface="enp131s0f3")
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="2001::2", dst="0::2")/TCP(sport=32, dport=42)/Raw('x'*48), iface="enp131s0f3")
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="2001::3", dst="0::3",nh=132)/SCTP(sport=33, dport=43)/Raw('x'*48), iface="enp131s0f3")
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="2001::4", dst="0::4")/TCP(sport=34, dport=44)/Raw('x'*48), iface="enp131s0f3")
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="2001::1", dst="0::1")/TCP(sport=31, dport=41)/Raw('x'*48), iface="enp131s0f3")
-
- The first 4 packets were forwarded to port3/2/1/0.
- The last packet weren't be forwarded to any port.
-
-b) Match the table b::
-
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:0", dst="0::1")/UDP(sport=31, dport=41)/Raw('x'*48), iface="enp131s0f3")
-
- Set the src address from ABCD:EF01:2345:6789:ABCD:EF01:2345:0 to ABCD:EF01:2345:6789:ABCD:EF01:2345:FFFF, and other parameters keep constant,
- The packets were distributed from port0 to port3 according to RSS table.::
-
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2346:0", dst="0::1")/UDP(sport=31, dport=41)/Raw('x'*48), iface="enp131s0f3")
-
- Set the src address from ABCD:EF01:2345:6789:ABCD:EF01:2346:0 to ABCD:EF01:2345:6789:ABCD:EF01:2346:FFFF, and other parameters keep constant,
- The packets were distributed from port0 to port3 according to RSS table.::
-
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2347:0", dst="0::1")/UDP(sport=31, dport=41)/Raw('x'*48), iface="enp131s0f3")
-
- The packet was not be forwarded to any port.
-
-c) Match the table c::
-
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="2001::1", dst="1001::1")/TCP(sport=31, dport=41)/Raw('x'*48), iface="enp131s0f3")
-
- Set the IPv6 dst address from 1001::0 to 1001::FFFF, the packet was forwarded to port0.::
-
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="2001::2", dst="1001::2")/TCP(sport=32, dport=42)/Raw('x'*48), iface="enp131s0f3")
-
- Set the IPv6 dst address from 1001::0 to 1001::FFFF, the packet was forwarded to port2 or port3.::
-
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="2001::1", dst="2001::3")/TCP(sport=33, dport=43)/Raw('x'*48), iface="enp131s0f3")
-
- Set the IPv6 dst address from 2001::0 to 2001::FFFF, the packet was forwarded to port1 or port2.::
-
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="2001::1", dst="0::1")/TCP(sport=31, dport=41)/Raw('x'*48), iface="enp131s0f3")
-
- The packet weren't be forwarded to any port.
-
-Test Case: ipv4 ACL table jump action
-=====================================
-1. Edit flow_classification_firmware.cli to change "table action" and "pipeline table" as below,
- Just two links::
-
- link LINK0 dev 0000:05:00.0
- link LINK1 dev 0000:05:00.1
-
- table action profile AP0 ipv4 offset 270 fwd
- pipeline RX table match acl ipv4 offset 270 size 4K action AP0
- pipeline RX table match acl ipv4 offset 270 size 4K action AP0
- flowapi map group 0 ingress pipeline RX table 0
- flowapi map group 1 ingress pipeline RX table 1
-
-2. Start softnic::
-
- ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x7 -s 0x4 -n 4 --vdev 'net_softnic0, \
- firmware=./drivers/net/softnic/flow_ipv4_acl_jump_firmware.cli,cpu_id=1,conn_port=8086' \
- -- -i --rxq=2 --txq=2 --disable-rss --portmask=0x4
-
-3. Add rules to table::
-
- testpmd> create 2 group 1 ingress pattern eth / ipv4 proto mask 255 src mask 0.0.0.0 \
- dst mask 255.192.0.0 src spec 0.0.0.0 dst spec 2.0.0.0 proto spec 6 / tcp src mask 65535 \
- dst mask 65535 src spec 100 dst spec 200 / end actions queue index 0 / end
-
- testpmd> create 2 group 1 ingress pattern eth / ipv4 proto mask 255 src mask 0.0.0.0 \
- dst mask 255.192.0.0 src spec 0.0.0.0 dst spec 2.64.0.0 proto spec 6 / tcp src mask 65535 \
- dst mask 65535 src spec 100 dst spec 200 / end actions queue index 1 / end
-
- testpmd> create 2 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 0.0.0.0 \
- dst mask 255.192.0.0 src spec 0.0.0.0 dst spec 2.0.0.0 proto spec 6 / tcp src mask 65535 \
- dst mask 65535 src spec 100 dst spec 200 / end actions jump group 1 / end
-
- testpmd> create 2 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 0.0.0.0 \
- dst mask 255.192.0.0 src spec 0.0.0.0 dst spec 2.64.0.0 proto spec 6 / tcp src mask 65535 \
- dst mask 65535 src spec 100 dst spec 200 / end actions jump group 1 / end
-
-4. Sent packet, verify the packets were forwarded to the expected ports::
-
- sendp(Ether(dst="00:00:00:00:01:00")/IP(src="0.0.0.0", dst="2.0.0.0")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3")
- sendp(Ether(dst="00:00:00:00:01:00")/IP(src="0.0.0.0", dst="2.64.0.0")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3")
-
- The first packet was forwarded to port 0, the second was forwarded to port 1.
- If change the TCP sport or dport, the packet can't be forwarded to any port.
-
-Notes: When only set the group 1 rules, the input packets match table 0, which map group 0, while there is no group 0 rule created.
-So the packets can't be forwarded.
-
-Test Case: ipv4 HASH table jump action
-======================================
-1. Edit flow_classification_firmware.cli to change "table action" and "pipeline table" as below,
- Just two links::
-
- link LINK0 dev 0000:05:00.0
- link LINK1 dev 0000:05:00.1
-
- table action profile AP0 ipv4 offset 270 fwd
- pipeline RX table match hash ext key 16 mask 00FF0000FFFFFFFFFFFFFFFF00000000 offset 278 buckets 16K size 64K action AP0
- pipeline RX table match hash ext key 16 mask 00FF0000FFFFFFFFFFFFFFFF00000000 offset 278 buckets 16K size 64K action AP0
- pipeline RX port in 0 table 0
- pipeline RX port in 1 table 0
- flowapi map group 0 ingress pipeline RX table 0
- flowapi map group 1 ingress pipeline RX table 1
-
-2. Start softnic::
-
- ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x7 -s 0x4 -n 4 --vdev 'net_softnic0, \
- firmware=./drivers/net/softnic/flow_ipv4_hash_jump_firmware.cli,cpu_id=1,conn_port=8086' \
- -- -i --rxq=2 --txq=2 --disable-rss --portmask=0x4
-
-3. Add rules to table::
-
- testpmd> flow create 2 group 1 ingress pattern eth / ipv4 proto mask 255 \
- src mask 255.255.255.255 dst mask 255.255.255.255 src spec 1.10.11.0 dst spec 2.20.21.0 proto spec 6 \
- / tcp src mask 0 dst mask 0 src spec 100 dst spec 200 / end actions queue index 0 / end
-
- testpmd> flow create 2 group 1 ingress pattern eth / ipv4 proto mask 255 \
- src mask 255.255.255.255 dst mask 255.255.255.255 src spec 1.10.11.1 dst spec 2.20.21.1 proto spec 6 \
- / tcp src mask 0 dst mask 0 src spec 100 dst spec 200 / end actions queue index 1 / end
-
- 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.0 dst spec 2.20.21.0 proto spec 6 \
- / tcp src mask 0 dst mask 0 src spec 100 dst spec 200 / end actions jump group 1 / end
-
- 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.1 dst spec 2.20.21.1 proto spec 6 \
- / tcp src mask 0 dst mask 0 src spec 100 dst spec 200 / end actions jump group 1 / end
-
-4. Sent packet, verify the packets were forwarded to the expected ports::
-
- sendp(Ether(dst='00:00:00:00:01:00')/IP(src='1.10.11.0', dst='2.20.21.0',proto=6)/TCP(sport=100, dport=200)/('X'*48), iface="enp131s0f3")
- sendp(Ether(dst='00:00:00:00:01:00')/IP(src='1.10.11.1', dst='2.20.21.1',proto=6)/TCP(sport=100, dport=200)/('X'*48), iface="enp131s0f3")
-
- The first packet was forwarded to port 0, the second was forwarded to port 1.
- If change the IPv4 dst address or src address, the packet can't be forwarded to any port.
-
-Notes: when only set the group 1 rules, the input packets match table 0, which map group 0, while there is no group 0 rule created.
-So the packets can't be forwarded.
-
-Test Case: ipv4 ACL jump to HASH table
-======================================
-1. Edit flow_classification_firmware.cli to change "table action" and "pipeline table" as below,
- Just two links::
-
- link LINK0 dev 0000:05:00.0
- link LINK1 dev 0000:05:00.1
-
- Group 0 with ACL table jump to group 1 with HASH table::
-
- table action profile AP0 ipv4 offset 270 fwd
- pipeline RX table match acl ipv4 offset 270 size 4K action AP0
- pipeline RX table match hash ext key 16 mask 00FF0000FFFFFFFFFFFFFFFFFFFFFFFF offset 278 buckets 16K size 64K action AP0
- pipeline RX port in 0 table 0
- pipeline RX port in 1 table 0
- flowapi map group 0 ingress pipeline RX table 0
- flowapi map group 1 ingress pipeline RX table 1
-
-2. Start softnic::
-
- ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x7 -s 0x4 -n 4 --vdev 'net_softnic0, \
- firmware=./drivers/net/softnic/flow_ipv4_acl_hash_jump_firmware.cli,cpu_id=1,conn_port=8086' \
- -- -i --rxq=2 --txq=2 --disable-rss --portmask=0x4
-
-3. Add rules to table::
-
- testpmd> flow create 2 group 1 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 \
- dst mask 255.255.255.255 src spec 1.10.11.0 dst spec 2.20.21.0 proto spec 6 / tcp src mask 65535 \
- dst mask 65535 src spec 100 dst spec 200 / end actions queue index 0 / end
-
- testpmd> flow create 2 group 1 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 \
- dst mask 255.255.255.255 src spec 1.10.11.1 dst spec 2.20.21.1 proto spec 6 / tcp src mask 65535 \
- dst mask 65535 src spec 100 dst spec 200 / end actions queue index 1 / end
-
- 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.0 dst spec 2.20.21.0 proto spec 6 / tcp src mask 0 \
- dst mask 0 src spec 100 dst spec 200 / end actions jump group 1 / end
-
- 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.1 dst spec 2.20.21.1 proto spec 6 / tcp src mask 0 \
- dst mask 0 src spec 100 dst spec 200 / end actions jump group 1 / end
-
-4. Sent packet, verify the packets were forwarded to the expected ports::
-
- sendp(Ether(dst='00:00:00:00:01:00')/IP(src='1.10.11.0', dst='2.20.21.0',proto=6)/TCP(sport=100, dport=200)/('X'*48), iface="enp131s0f3")
- sendp(Ether(dst='00:00:00:00:01:00')/IP(src='1.10.11.1', dst='2.20.21.1',proto=6)/TCP(sport=100, dport=200)/('X'*48), iface="enp131s0f3")
-
- The first packet was forwarded to port 0, the second was forwarded to port 1.
- If change the IPv4 dst address or src address, the packet can't be forwarded to any port::
-
- sendp(Ether(dst='00:00:00:00:01:00')/IP(src='1.10.11.0', dst='2.20.21.0',proto=6)/TCP(sport=101, dport=200)/('X'*48), iface="enp131s0f3")
- sendp(Ether(dst='00:00:00:00:01:00')/IP(src='1.10.11.1', dst='2.20.21.1',proto=6)/TCP(sport=100, dport=201)/('X'*48), iface="enp131s0f3")
-
- The two packets can't be forwarded to any port.
-
-Test Case: ipv4 HASH jump to ACL table
-======================================
-1. Edit flow_classification_firmware.cli to change "table action" and "pipeline table" as below,
- Just two links::
-
- link LINK0 dev 0000:05:00.0
- link LINK1 dev 0000:05:00.1
-
- Group 0 with ACL table jump to group 1 with HASH table::
-
- table action profile AP0 ipv4 offset 270 fwd
- pipeline RX table match hash ext key 16 mask 00FF0000FFFFFFFFFFFFFF00FFFFFFFF offset 278 buckets 16K size 64K action AP0
- pipeline RX table match acl ipv4 offset 270 size 4K action AP0
- pipeline RX port in 0 table 0
- pipeline RX port in 1 table 0
- flowapi map group 0 ingress pipeline RX table 0
- flowapi map group 1 ingress pipeline RX table 1
-
-2. Start softnic::
-
- ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x7 -s 0x4 -n 4 --vdev 'net_softnic0, \
- firmware=./drivers/net/softnic/flow_ipv4_hash_acl_jump_firmware.cli,cpu_id=1,conn_port=8086' \
- -- -i --rxq=2 --txq=2 --disable-rss --portmask=0x4
-
-3. Add rules to table::
-
- testpmd> flow create 2 group 1 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 \
- dst mask 255.255.255.255 src spec 1.10.11.0 dst spec 2.20.21.0 proto spec 6 / tcp src mask 0 \
- dst mask 0 src spec 100 dst spec 200 / end actions queue index 0 / end
-
- testpmd> flow create 2 group 1 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 \
- dst mask 255.255.255.255 src spec 1.10.11.1 dst spec 2.20.21.1 proto spec 6 / tcp src mask 0 \
- dst mask 0 src spec 100 dst spec 200 / end actions queue index 1 / end
-
- testpmd> flow create 2 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 \
- dst mask 255.255.255.0 src spec 1.10.11.0 dst spec 2.20.21.0 proto spec 6 / tcp src mask 65535 \
- dst mask 65535 src spec 100 dst spec 200 / end actions jump group 1 / end
-
- testpmd> flow create 2 group 0 ingress pattern eth / ipv4 proto mask 255 src mask 255.255.255.255 \
- dst mask 255.255.255.0 src spec 1.10.11.1 dst spec 2.20.21.1 proto spec 6 / tcp src mask 65535 \
- dst mask 65535 src spec 100 dst spec 200 / end actions jump group 1 / end
-
-4. Sent packet, verify the packets were forwarded to the expected ports::
-
- sendp(Ether(dst='00:00:00:00:01:00')/IP(src='1.10.11.0', dst='2.20.21.0',proto=6)/TCP(sport=100, dport=200)/('X'*48), iface="enp131s0f3")
- sendp(Ether(dst='00:00:00:00:01:00')/IP(src='1.10.11.1', dst='2.20.21.1',proto=6)/TCP(sport=100, dport=200)/('X'*48), iface="enp131s0f3")
- sendp(Ether(dst='00:00:00:00:01:00')/IP(src='1.10.11.0', dst='2.20.21.2',proto=6)/TCP(sport=100, dport=200)/('X'*48), iface="enp131s0f3")
- sendp(Ether(dst='00:00:00:00:01:00')/IP(src='1.10.11.1', dst='2.20.21.3',proto=6)/TCP(sport=100, dport=200)/('X'*48), iface="enp131s0f3")
-
- The first packet was forwarded to port 0, the second was forwarded to port 1.
- The last two packets can't be forwarded to any ports.
-
-Test Case: ipv6 ACL table jump action
-=====================================
-1. Edit flow_classification_firmware.cli to change "table action" and "pipeline table" as below,
- Just two links::
-
- link LINK0 dev 0000:05:00.0
- link LINK1 dev 0000:05:00.1
-
- table action profile AP0 ipv6 offset 270 fwd
- pipeline RX table match acl ipv6 offset 270 size 4K action AP0
- pipeline RX table match acl ipv6 offset 270 size 4K action AP0
- flowapi map group 0 ingress pipeline RX table 0
- flowapi map group 1 ingress pipeline RX table 1
-
-2. Start softnic::
-
- ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x7 -s 0x4 -n 4 --vdev 'net_softnic0, \
- firmware=./drivers/net/softnic/flow_ipv6_acl_jump_firmware.cli,cpu_id=1,conn_port=8086' \
- -- -i --rxq=2 --txq=2 --disable-rss --portmask=0x4
-
-3. Add rules to table::
-
- testpmd> flow create 2 group 1 ingress pattern eth / ipv6 proto mask 255 src mask 0:0:0:0:0:0:0:0 \
- dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff src spec 0::1 dst spec 2001::1 proto spec 6 \
- / tcp src mask 65535 dst mask 65535 src spec 100 dst spec 200 / end actions queue index 0 / end
-
- testpmd> flow create 2 group 1 ingress pattern eth / ipv6 proto mask 255 src mask \
- ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \
- src spec 0::1 dst spec 2001::2 proto spec 6 / tcp src mask 65535 dst mask 65535 \
- src spec 100 dst spec 200 / end actions queue index 1 / end
-
- testpmd> flow create 2 group 0 ingress pattern eth / ipv6 proto mask 255 src mask 0:0:0:0:0:0:0:0 \
- dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff src spec 0::1 dst spec 2001::1 proto spec 6 \
- / tcp src mask 65535 dst mask 65535 src spec 100 dst spec 200 / end actions jump group 1 / end
-
- testpmd> flow create 2 group 0 ingress pattern eth / ipv6 proto mask 255 src mask 0:0:0:0:0:0:0:0 \
- dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff src spec 0::1 dst spec 2001::2 proto spec 6 \
- / tcp src mask 65535 dst mask 65535 src spec 100 dst spec 200 / end actions jump group 1 / end
-
-4. Sent packet, verify the packets were forwarded to the expected ports::
-
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="0::1", dst="2001::1")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3")
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="0::1", dst="2001::2")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3")
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="0::2", dst="2001::1")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3")
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="0::2", dst="2001::2")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3")
-
- The first packet was forwarded to port 0, the second was forwarded to port 1.
- The third packet was forwarded to port 0, the fourth packet can't be forwarded to any port.
-
-Notes: When only set the group 1 rules, the input packets match table 0, which map group 0, while there is no group 0 rule created.
-So the packets can't be forwarded.
-
-Test Case: ipv6 HASH table jump action
-======================================
-1. Edit flow_classification_firmware.cli to change "table action" and "pipeline table" as below,
- Just two links::
-
- link LINK0 dev 0000:05:00.0
- link LINK1 dev 0000:05:00.1
-
- table action profile AP0 ipv6 offset 270 fwd
- pipeline RX table match hash ext key 64 mask 0000FF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000 offset 274 buckets 16K size 64K action AP0
- pipeline RX table match hash ext key 64 mask 0000FF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000 offset 274 buckets 16K size 64K action AP0
- pipeline RX port in 0 table 0
- pipeline RX port in 1 table 0
- flowapi map group 0 ingress pipeline RX table 0
- flowapi map group 1 ingress pipeline RX table 1
-
-2. Start softnic::
-
- ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x7 -s 0x4 -n 4 --vdev 'net_softnic0, \
- firmware=./drivers/net/softnic/flow_ipv6_hash_jump_firmware.cli,cpu_id=1,conn_port=8086' \
- -- -i --rxq=2 --txq=2 --disable-rss --portmask=0x4
-
-3. Add rules to table::
-
- testpmd> flow create 2 group 1 ingress pattern eth / ipv6 proto mask 255 \
- src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \
- src spec 0::1 dst spec 2001::1 proto spec 6 / tcp src mask 65535 dst mask 65535 \
- src spec 100 dst spec 200 / end actions queue index 0 / end
-
- testpmd> flow create 2 group 1 ingress pattern eth / ipv6 proto mask 255 \
- src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \
- src spec 0::2 dst spec 2001::2 proto spec 17 / udp src mask 65535 dst mask 65535 \
- src spec 100 dst spec 200 / end actions queue index 1 / 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 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \
- src spec 0::1 dst spec 2001::1 proto spec 6 / tcp src mask 65535 dst mask 65535 \
- src spec 100 dst spec 200 / end actions jump group 1 / 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 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \
- src spec 0::2 dst spec 2001::2 proto spec 17 / udp src mask 65535 dst mask 65535 \
- src spec 100 dst spec 200 / end actions jump group 1 / end
-
-4. Sent packet, verify the packets were forwarded to the expected ports::
-
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="0::1", dst="2001::1")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3")
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="0::2", dst="2001::2")/UDP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3")
-
- The first packet was forwarded to port 0, the second was forwarded to port 1.
- If change the IPv6 dst address or src address, the packet can't be forwarded to any port.
-
-Notes: When only set the group 1 rules, the input packets match table 0, which map group 0, while there is no group 0 rule created.
-So the packets can't be forwarded.
-
-Test Case: ipv6 ACL jump to HASH table
-======================================
-1. Edit flow_classification_firmware.cli to change "table action" and "pipeline table" as below,
- Just two links::
-
- link LINK0 dev 0000:05:00.0
- link LINK1 dev 0000:05:00.1
-
- Group 0 with ACL table jump to group 1 with HASH table::
-
- table action profile AP0 ipv6 offset 270 fwd
- pipeline RX table match acl ipv6 offset 270 size 4K action AP0
- pipeline RX table match hash ext key 64 mask 0000FF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000 offset 274 buckets 16K size 64K action AP0
- pipeline RX port in 0 table 0
- pipeline RX port in 1 table 0
- flowapi map group 0 ingress pipeline RX table 0
- flowapi map group 1 ingress pipeline RX table 1
-
-2. Start softnic::
-
- ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x7 -s 0x4 -n 4 --vdev 'net_softnic0, \
- firmware=./drivers/net/softnic/flow_ipv6_acl_hash_jump_firmware.cli,cpu_id=1,conn_port=8086' \
- -- -i --rxq=2 --txq=2 --disable-rss --portmask=0x4
-
-3. Add rules to table::
-
- testpmd> flow create 2 group 1 ingress pattern eth / ipv6 proto mask 255 \
- src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \
- src spec 0::1 dst spec 2001::1 proto spec 6 / tcp src mask 65535 dst mask 65535 \
- src spec 100 dst spec 200 / end actions queue index 0 / end
-
- testpmd> flow create 2 group 1 ingress pattern eth / ipv6 proto mask 255 \
- src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \
- src spec 0::2 dst spec 2001::2 proto spec 6 / tcp src mask 65535 dst mask 65535 \
- src spec 100 dst spec 200 / end actions queue index 1 / end
-
- testpmd> flow create 2 group 0 ingress pattern eth / ipv6 proto mask 255 \
- src mask 0:0:0:0:0:0:0:0 dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff src spec 0::1 \
- dst spec 2001::1 proto spec 6 / tcp src mask 65535 dst mask 65535 src spec 100 dst spec 200 / end actions jump group 1 / end
-
- testpmd> flow create 2 group 0 ingress pattern eth / ipv6 proto mask 255 \
- src mask 0:0:0:0:0:0:0:0 dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff src spec 0::2 dst spec 2001::2 proto spec 6 \
- / tcp src mask 65535 dst mask 65535 src spec 100 dst spec 200 / end actions jump group 1 / end
-
-4. sent packet, verify the packets were forwarded to the expected ports::
-
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="0::1", dst="2001::1")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3")
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="0::2", dst="2001::2")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3")
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="0::3", dst="2001::1")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3")
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="0::4", dst="2001::2")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3")
-
- The first packet was forwarded to port 0, the second was forwarded to port 1.
- The last two packets can't be forwarded to any ports.
-
-Test Case: ipv6 HASH jump to ACL table
-======================================
-1. Edit flow_classification_firmware.cli to change "table action" and "pipeline table" as below,
- Just two links::
-
- link LINK0 dev 0000:05:00.0
- link LINK1 dev 0000:05:00.1
-
- Group 0 with ACL table jump to group 1 with HASH table::
-
- table action profile AP0 ipv6 offset 270 fwd
- pipeline RX table match hash ext key 64 mask 0000FF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000000000000000 offset 274 buckets 16K size 64K action AP0
- pipeline RX table match acl ipv6 offset 270 size 4K action AP0
- pipeline RX port in 0 table 0
- pipeline RX port in 1 table 0
- flowapi map group 0 ingress pipeline RX table 0
- flowapi map group 1 ingress pipeline RX table 1
-
-2. Start softnic::
-
- ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0x7 -s 0x4 -n 4 --vdev 'net_softnic0, \
- firmware=./drivers/net/softnic/flow_ipv6_hash_acl_jump_firmware.cli,cpu_id=1,conn_port=8086' \
- -- -i --rxq=2 --txq=2 --disable-rss --portmask=0x4
-
-3. Add rules to table::
-
- testpmd> flow create 2 group 1 ingress pattern eth / ipv6 proto mask 255 src mask 0:0:0:0:0:0:0:0 \
- dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff src spec 0::1 dst spec 2001::1 proto spec 6 \
- / tcp src mask 65535 dst mask 65535 src spec 100 dst spec 200 / end actions queue index 0 / end
-
- testpmd> flow create 2 group 1 ingress pattern eth / ipv6 proto mask 255 \
- src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \
- src spec 0::2 dst spec 2001::2 proto spec 6 / tcp src mask 0 dst mask 65535 src spec 100 dst spec 200 / end actions queue index 1 / 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 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \
- src spec 0::1 dst spec 2001::1 proto spec 6 / tcp src mask 65535 dst mask 0 src spec 100 dst spec 200 / end actions jump group 1 / 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 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff \
- src spec 0::2 dst spec 2001::2 proto spec 6 / tcp src mask 65535 dst mask 0 src spec 100 dst spec 200 / end actions jump group 1 / end
-
-4. Sent packet, verify the packets were forwarded to the expected ports::
-
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="0::1", dst="2001::1")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3")
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="0::2", dst="2001::2")/TCP(sport=100, dport=200)/Raw('x'*48), iface="enp131s0f3")
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="0::1", dst="2001::1")/TCP(sport=100, dport=201)/Raw('x'*48), iface="enp131s0f3")
- sendp(Ether(dst="00:00:00:00:01:00")/IPv6(src="0::2", dst="2001::2")/TCP(sport=100, dport=202)/Raw('x'*48), iface="enp131s0f3")
-
- The first packet was forwarded to port 0, the second was forwarded to port 1.
- The last two packets can't be forwarded to any ports.
diff --git a/test_plans/index.rst b/test_plans/index.rst
index dc782fdf..a47e5eaf 100644
--- a/test_plans/index.rst
+++ b/test_plans/index.rst
@@ -70,7 +70,6 @@ The following are the test plans for the DPDK DTS automated test system.
external_mempool_handler_test_plan
firmware_version_test_plan
floating_veb_test_plan
- flow_classify_softnic_test_plan
i40e_rss_input_test_plan
generic_flow_api_test_plan
hotplug_mp_test_plan
diff --git a/tests/TestSuite_flow_classify_softnic.py b/tests/TestSuite_flow_classify_softnic.py
deleted file mode 100644
index a3a0eed5..00000000
--- a/tests/TestSuite_flow_classify_softnic.py
+++ /dev/null
@@ -1,3003 +0,0 @@
-# SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2010-2018 Intel Corporation
-#
-
-import os
-import random
-import re
-import time
-from time import sleep
-
-import scapy.layers.inet
-from scapy.arch import get_if_hwaddr
-from scapy.layers.inet import ICMP, IP, TCP, UDP, Ether
-from scapy.layers.inet6 import IPv6
-from scapy.layers.l2 import ARP, GRE, Dot1Q
-from scapy.layers.sctp import SCTP, SCTPChunkData
-from scapy.packet import Raw, bind_layers
-from scapy.route import *
-from scapy.sendrecv import sendp, sniff
-from scapy.utils import hexstr, rdpcap, wrpcap
-
-import framework.utils as utils
-from framework.crb import Crb
-from framework.dut import Dut
-from framework.exception import VerifyFailure
-from framework.packet import Packet
-from framework.pmd_output import PmdOutput
-from framework.project_dpdk import DPDKdut
-from framework.settings import DRIVERS, HEADER_SIZE
-from framework.test_case import TestCase
-from framework.virt_dut import VirtDut
-
-
-class TestFlowClassifySoftnic(TestCase):
- def copy_config_files_to_dut(self):
- """
- Copy firmware.cli from tester to DUT.
- """
- file = "flow_classify_softnic.tar.gz"
- src_file = r"./dep/%s" % file
- dst1 = "/tmp"
- dst2 = "/root/dpdk/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 start_testpmd(self, filename, port_num):
- """
- Start testpmd.
- """
- self.cores = self.dut.get_core_list("all")
- self.set_ports(filename, port_num)
- TESTPMD = self.dut.apps_name["test-pmd"]
- cmd = "cat /sys/bus/pci/devices/%s/numa_node" % self.dut_p0_pci
- numa_node = int(self.dut.send_expect(cmd, "# ", 60))
- cpu_id = numa_node if numa_node > 0 else 0
- ports_info = []
- for i in range(port_num):
- ports_info.append(i)
- eal_params = self.dut.create_eal_parameters(cores=self.cores, ports=ports_info)
- VDEV = (
- "--vdev 'net_softnic0,firmware=./drivers/net/softnic/flow_classify_softnic/%s,cpu_id=%s,conn_port=8086'"
- % (filename, cpu_id)
- )
- if port_num == 4:
- cmd = "{0} {1} {2} -s 0x10 -- -i --rxq=4 --txq=4 --disable-rss --portmask=0x10".format(
- TESTPMD, VDEV, eal_params
- )
- elif port_num == 2:
- cmd = "{0} {1} {2} -s 0x4 -- -i --rxq=2 --txq=2 --disable-rss --portmask=0x4".format(
- TESTPMD, VDEV, eal_params
- )
- else:
- raise Exception("The number of port is wrong!")
- self.dut.send_expect(cmd, "testpmd> ", 60)
-
- def set_ports(self, filename, port_num):
- """
- Set actual ports.
- """
- self.dut.send_expect(
- "sed -i '/^link LINK/d' ./drivers/net/softnic/flow_classify_softnic/%s"
- % filename,
- "# ",
- 20,
- )
- cmd = (
- "sed -i '1i\link LINK0 dev %s' ./drivers/net/softnic/flow_classify_softnic/%s"
- % (self.dut_p0_pci, filename)
- )
- self.dut.send_expect(cmd, "# ", 20)
- cmd = (
- "sed -i '2i\link LINK1 dev %s' ./drivers/net/softnic/flow_classify_softnic/%s"
- % (self.dut_p1_pci, filename)
- )
- self.dut.send_expect(cmd, "# ", 20)
- if port_num == 4:
- cmd = (
- "sed -i '3i\link LINK2 dev %s' ./drivers/net/softnic/flow_classify_softnic/%s"
- % (self.dut_p2_pci, filename)
- )
- self.dut.send_expect(cmd, "# ", 20)
- cmd = (
- "sed -i '4i\link LINK3 dev %s' ./drivers/net/softnic/flow_classify_softnic/%s"
- % (self.dut_p3_pci, filename)
- )
- self.dut.send_expect(cmd, "# ", 20)
- self.dut.send_expect(
- "sed -i 's/^thread 4 pipeline/thread %d pipeline/g' ./drivers/net/softnic/flow_classify_softnic/%s"
- % (self.port_num, filename),
- "# ",
- 20,
- )
-
- def set_table(self, cmd, filename):
- """
- Set pipeline table.
- """
- self.dut.send_expect(
- "sed -i '/^pipeline RX table match/d' ./drivers/net/softnic/flow_classify_softnic/%s"
- % filename,
- "# ",
- 20,
- )
- command = (
- "sed -i '/^table action/a"
- + cmd
- + "' ./drivers/net/softnic/flow_classify_softnic/%s" % filename
- )
- self.dut.send_expect(command, "# ", 20)
-
- def get_flow_direction_param_of_tcpdump(self):
- """
- get flow dirction param depend on tcpdump version
- """
- param = ""
- direct_param = r"(\s+)\[ (\S+) in\|out\|inout \]"
- out = self.tester.send_expect("tcpdump -h", "# ", trim_whitespace=False)
- for line in out.split("\n"):
- m = re.match(direct_param, line)
- if m:
- opt = re.search("-Q", m.group(2))
- if opt:
- param = "-Q" + " in"
- else:
- opt = re.search("-P", m.group(2))
- if opt:
- param = "-P" + " in"
- if len(param) == 0:
- self.logger.info("tcpdump not support direction choice!!!")
- return param
-
- def tcpdump_start_sniff(self, interface, filters=""):
- """
- Starts tcpdump in the background to sniff packets that received by interface.
- """
- command = "rm -f /tmp/tcpdump_{0}.pcap".format(interface)
- self.tester.send_expect(command, "#")
- command = "tcpdump -n -e {0} -w /tmp/tcpdump_{1}.pcap -i {1} {2} 2>/tmp/tcpdump_{1}.out &".format(
- self.param_flow_dir, interface, filters
- )
- self.tester.send_expect(command, "# ")
-
- def tcpdump_stop_sniff(self):
- """
- Stops the tcpdump process running in the background.
- """
- self.tester.send_expect("killall tcpdump", "# ")
- # For the [pid]+ Done tcpdump... message after killing the process
- sleep(1)
- self.tester.send_expect('echo "Cleaning buffer"', "# ")
- sleep(3)
-
- def write_pcap_file(self, pcap_file, pkts):
- try:
- wrpcap(pcap_file, pkts)
- except:
- raise Exception("write pcap error")
-
- def read_pcap_file(self, pcap_file):
- pcap_pkts = []
- try:
- pcap_pkts = rdpcap(pcap_file)
- except:
- raise Exception("write pcap error")
-
- return pcap_pkts
-
- def send_and_sniff_pkts(self, from_port, to_port, pcap_file, filters="", count=1):
- """
- Sent pkts that read from the pcap_file.
- Return the sniff pkts.
- """
- self.pmdout.wait_link_status_up("all")
- tx_port = self.tester.get_local_port(self.dut_ports[from_port % self.port_num])
- rx_port = self.tester.get_local_port(self.dut_ports[to_port % self.port_num])
-
- tx_interface = self.tester.get_interface(tx_port)
- rx_interface = self.tester.get_interface(rx_port)
- # check tester's link status before send packet
- for iface in [tx_interface, rx_interface]:
- self.verify(
- self.tester.is_interface_up(intf=iface),
- "Wrong link status, should be up",
- )
-
- self.tcpdump_start_sniff(rx_interface, filters)
-
- # Prepare the pkts to be sent
- self.tester.scapy_foreground()
- self.tester.scapy_append('pkt = rdpcap("%s")' % (pcap_file))
- self.tester.scapy_append(
- 'sendp(pkt, iface="%s", count=%d)' % (tx_interface, count)
- )
- self.tester.scapy_execute()
-
- self.tcpdump_stop_sniff()
-
- return self.read_pcap_file("/tmp/tcpdump_%s.pcap" % rx_interface)
-
- def send_pkts(self, from_port, pcap_file, count=1):
- """
- Sent pkts that read from the pcap_file.
- """
- tx_port = self.tester.get_local_port(self.dut_ports[from_port])
- tx_interface = self.tester.get_interface(tx_port)
-
- # Prepare the pkts to be sent
- self.tester.scapy_foreground()
- self.tester.scapy_append('pkt = rdpcap("%s")' % (pcap_file))
- self.tester.scapy_append(
- 'sendp(pkt, iface="%s", count=%d)' % (tx_interface, count)
- )
- self.tester.scapy_execute()
-
- def send_and_check_packets(
- self, pcap_file, pkt, ltype, src_dst, addr_port, from_port, to_port
- ):
- """
- Sent pkts that read from the pcap_file.
- Check if the rule works.
- """
- self.write_pcap_file(pcap_file, pkt)
- checklist = []
- if ltype in ["udp", "tcp", "sctp"]:
- filters = "%s %s port %d" % (ltype, src_dst, addr_port)
- sniff_pkts = self.send_and_sniff_pkts(
- from_port, to_port, pcap_file, filters
- )
- for packet in sniff_pkts:
- if src_dst == "src":
- checklist.append(packet.getlayer(2).sport)
- elif src_dst == "dst":
- checklist.append(packet.getlayer(2).dport)
- elif ltype in ["ipv4", "ipv6"]:
- filters = "%s host %s" % (src_dst, addr_port)
- sniff_pkts = self.send_and_sniff_pkts(
- from_port, to_port, pcap_file, filters
- )
-
- for packet in sniff_pkts:
- if src_dst == "src":
- checklist.append(packet.getlayer(1).src)
- elif src_dst == "dst":
- checklist.append(packet.getlayer(1).dst)
- addr_port = str.lower(addr_port)
- self.verify(addr_port in checklist, "rule test fail")
-
- def check_status(self, rx_pkt_num, tx_pkt_num, port):
- """
- Check port status
- """
- rx_num = 0
- tx_num = 0
- for i in range(port):
- stats = self.pmdout.get_pmd_stats(self.dut_ports[i])
- rx_num = rx_num + stats["RX-packets"]
- tx_num = tx_num + stats["TX-packets"]
- self.verify(
- (rx_num == rx_pkt_num) and (tx_num == tx_pkt_num), "The rule failed to work"
- )
-
- def generate_rules(
- self,
- operation="create",
- port=4,
- group=0,
- iptype="ipv4",
- src_mask="0.0.0.0",
- dst_mask="0.0.0.0",
- src_spec="0.0.0.0",
- dst_spec="0.0.0.0",
- protomask=0,
- protospec=17,
- l4type="udp",
- sportmask=0,
- dportmask=0,
- sportspec=0,
- dportspec=0,
- action="queue",
- index=[],
- ):
- """
- Generate flow rules
- """
- if port == 4:
- port = self.port_num
- if iptype == "ipv6":
- if src_mask == "0.0.0.0":
- src_mask = "0:0:0:0:0:0:0:0"
- if dst_mask == "0.0.0.0":
- dst_mask = "0:0:0:0:0:0:0:0"
- if src_spec == "0.0.0.0":
- src_spec = "0:0:0:0:0:0:0:0"
- if dst_spec == "0.0.0.0":
- dst_spec = "0:0:0:0:0:0:0:0"
- if action == "queue":
- actions = "queue index %d" % (index[0] % port)
- elif action == "jump":
- actions = "jump group %d" % (index[0] % port)
- elif action == "rss":
- queue_idx = ""
- for queue in index:
- queue_idx = queue_idx + str(queue % port) + " "
- actions = "rss queues %s end" % queue_idx
-
- if l4type == "":
- self.dut.send_expect(
- "flow %s %d group %d ingress pattern eth / %s proto mask %d src mask %s dst mask %s src spec %s dst spec %s / end actions %s / end"
- % (
- operation,
- port,
- group,
- iptype,
- protomask,
- src_mask,
- dst_mask,
- src_spec,
- dst_spec,
- actions,
- ),
- operation,
- 60,
- )
- else:
- self.dut.send_expect(
- "flow %s %d group %d ingress pattern eth / %s proto mask %d src mask %s dst mask %s src spec %s dst spec %s proto spec %d / %s src mask %d dst mask %d src spec %d dst spec %d / end actions %s / end"
- % (
- operation,
- port,
- group,
- iptype,
- protomask,
- src_mask,
- dst_mask,
- src_spec,
- dst_spec,
- protospec,
- l4type,
- sportmask,
- dportmask,
- sportspec,
- dportspec,
- actions,
- ),
- operation,
- 60,
- )
-
- def send_continuous_packet(self, ptype, src_dst, src_addr, dst_addr, itf):
- """
- Sends continuous packets.
- """
- self.pmdout.wait_link_status_up("all")
- self.verify(
- self.tester.is_interface_up(intf=itf), "Wrong link status, should be up"
- )
- self.tester.scapy_foreground()
- if src_dst == "src":
- if ptype == "ipv4":
- var = src_addr.split(".")
- string = "."
- ipaddr = string.join(var[0:3])
- for i in range(32):
- packet = (
- r'sendp([Ether(dst="%s", src=get_if_hwaddr("%s"))/IP(src="%s.%d", dst="%s", proto=17)/UDP(sport=100, dport=200)], iface="%s")'
- % (self.dut_p0_mac, itf, ipaddr, i, dst_addr, itf)
- )
- self.tester.scapy_append(packet)
- self.tester.scapy_execute()
- elif ptype == "ipv6":
- var = src_addr.split(":")
- string = ":"
- if len(var) == 8:
- ipaddr = string.join(var[0:7])
- else:
- ipaddr = string.join(var[0 : (len(var) - 1)])
- for i in range(16):
- packet = (
- r'sendp([Ether(dst="%s", src=get_if_hwaddr("%s"))/IPv6(src="%s:%d", dst="%s", nh=17)/UDP(sport=100, dport=200)], iface="%s")'
- % (self.dut_p0_mac, itf, ipaddr, i, dst_addr, itf)
- )
- self.tester.scapy_append(packet)
- self.tester.scapy_execute()
-
- elif src_dst == "dst":
- if ptype == "ipv4":
- var = dst_addr.split(".")
- string = "."
- ipaddr = string.join(var[0:3])
- for i in range(32):
- packet = (
- r'sendp([Ether(dst="%s", src=get_if_hwaddr("%s"))/IP(src="%s", dst="%s.%d", proto=17)/UDP(sport=100, dport=100)], iface="%s")'
- % (self.dut_p0_mac, itf, src_addr, ipaddr, i, itf)
- )
- self.tester.scapy_append(packet)
- self.tester.scapy_execute()
- elif ptype == "ipv6":
- var = dst_addr.split(":")
- string = ":"
- if len(var) == 8:
- ipaddr = string.join(var[0:7])
- else:
- ipaddr = string.join(var[0 : (len(var) - 1)])
- for i in range(16):
- packet = (
- r'sendp([Ether(dst="%s", src=get_if_hwaddr("%s"))/IPv6(src="%s", dst="%s:%d", nh=17)/UDP(sport=100, dport=200)], iface="%s")'
- % (self.dut_p0_mac, itf, src_addr, ipaddr, i, itf)
- )
- self.tester.scapy_append(packet)
- self.tester.scapy_execute()
-
- def check_packet_queue(self, queues=[], out=""):
- """
- Get the queue which packet enter.
- """
- time.sleep(2)
- for queue in queues:
- self.verify(
- "Queue= %d" % (queue % self.port_num) in out,
- "There is some queues doesn't work.",
- )
- lines = out.split("\r\n")
- reta_line = {}
- queue_flag = 0
- # collect the hash result and the queue id
- for line in lines:
- line = line.strip()
- if queue_flag == 1:
- result_scanner = r"RX-packets:\s?([0-9]+)"
- scanner = re.compile(result_scanner, re.DOTALL)
- m = scanner.search(line)
- rxpkt_num = m.group(1)
- result_scanner = r"TX-packets:\s?([0-9]+)"
- scanner = re.compile(result_scanner, re.DOTALL)
- m = scanner.search(line)
- txpkt_num = m.group(1)
- self.verify(
- rxpkt_num == txpkt_num, "There are some packets failed to forward."
- )
- queue_flag = 0
- elif line.strip().startswith("------- Forward"):
- queue_flag = 1
-
- def set_up_all(self):
- """
- Run at the start of each test suite.
- """
- self.dut_ports = self.dut.get_ports()
- self.port_num = len(self.dut_ports)
- self.verify(
- self.port_num == 2 or self.port_num == 4,
- "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])
- self.dut_p0_mac = self.dut.get_mac_address(self.dut_ports[0])
- self.dut_p1_mac = self.dut.get_mac_address(self.dut_ports[1])
- self.pf0_interface = self.dut.ports_info[self.dut_ports[0]]["intf"]
- self.pf1_interface = self.dut.ports_info[self.dut_ports[1]]["intf"]
-
- if self.port_num == 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.dut_p2_mac = self.dut.get_mac_address(self.dut_ports[2])
- self.dut_p3_mac = self.dut.get_mac_address(self.dut_ports[3])
- self.pf2_interface = self.dut.ports_info[self.dut_ports[2]]["intf"]
- self.pf3_interface = self.dut.ports_info[self.dut_ports[3]]["intf"]
-
- self.ipv4_mask = "255.255.255.255"
- self.ipv6_mask = "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"
- self.portmask = 65535
- self.protomask = 255
-
- self.pmdout = PmdOutput(self.dut)
- localPort = self.tester.get_local_port(self.dut_ports[0])
- self.tester_itf = self.tester.get_interface(localPort)
- self.copy_config_files_to_dut()
-
- self.param_flow_dir = self.get_flow_direction_param_of_tcpdump()
-
- def set_up(self):
- """
- Run before each test case.
- """
- pass
-
- def test_ipv4_acl_table(self):
- """
- Ipv4 ACL table
- """
- filename = "flow_ipv4_acl_firmware.cli"
- self.start_testpmd(filename, self.port_num)
-
- # validate rule
- self.generate_rules(
- operation="validate",
- dst_mask="255.192.0.0",
- dst_spec="2.0.0.0",
- sportspec=100,
- dportspec=200,
- index=[3],
- )
-
- # create rule
- self.generate_rules(
- dst_mask="255.192.0.0",
- dst_spec="2.0.0.0",
- protomask=self.protomask,
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=100,
- dportspec=200,
- index=[3],
- )
- self.generate_rules(
- dst_mask="255.192.0.0",
- dst_spec="2.64.0.0",
- protomask=self.protomask,
- protospec=6,
- l4type="tcp",
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=100,
- dportspec=200,
- index=[2],
- )
- self.generate_rules(
- src_mask="255.192.0.0",
- src_spec="2.128.0.0",
- protomask=self.protomask,
- protospec=132,
- l4type="sctp",
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=100,
- dportspec=200,
- index=[1],
- )
- self.generate_rules(
- dst_mask="255.192.0.0",
- dst_spec="4.0.0.0",
- protomask=self.protomask,
- sportspec=100,
- sportmask=self.portmask,
- dportmask=self.portmask,
- dportspec=200,
- index=[0],
- )
- self.dut.send_expect("start", "testpmd> ", 60)
-
- # rule 0 test
- pcap_file = "/tmp/route_0.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="0.0.0.0", dst="2.0.0.0", proto=17)
- / UDP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "2.0.0.0", 0, 3)
-
- # rule 1 test
- pcap_file = "/tmp/route_1.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="0.0.0.0", dst="2.64.0.0", proto=6)
- / TCP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "2.64.0.0", 0, 2)
-
- # rule 2 test
- pcap_file = "/tmp/route_2.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="2.128.0.0", dst="0.0.0.0", proto=132)
- / SCTP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv4", "src", "2.128.0.0", 0, 1)
-
- # rule 3 test
- pcap_file = "/tmp/route_3.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="0.0.0.0", dst="4.0.0.0", proto=17)
- / UDP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "4.0.0.0", 0, 0)
-
- # send another 3 packets
- pcap_file = "/tmp/route_4.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="0.0.0.0", dst="3.0.0.0", proto=17)
- / UDP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.write_pcap_file(pcap_file, pkt)
- self.send_pkts(0, pcap_file)
-
- pcap_file = "/tmp/route_4.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="0.0.0.0", dst="2.64.0.0", proto=17)
- / UDP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.write_pcap_file(pcap_file, pkt)
- self.send_pkts(0, pcap_file)
-
- pcap_file = "/tmp/route_4.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="2.128.0.0", dst="0.0.0.0", proto=17)
- / UDP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.write_pcap_file(pcap_file, pkt)
- self.send_pkts(0, pcap_file)
-
- self.check_status(7, 4, self.port_num)
-
- # query rule
- out = self.dut.send_expect("flow query %d 3 queue" % self.port_num, "QUEUE", 60)
-
- # destroy rule 1
- self.dut.send_expect(
- "flow destroy %d rule 1" % self.port_num, "Flow rule #1 destroyed", 60
- )
- destroy_out = self.dut.send_expect(
- "flow list %d" % self.port_num, "testpmd> ", 60
- )
- self.verify("1" not in destroy_out, "destroy rule fail")
-
- # rule 1 test
- pcap_file = "/tmp/route_1.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="0.0.0.0", dst="2.64.0.0", proto=6)
- / TCP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.write_pcap_file(pcap_file, pkt)
- filters = "dst host 2.64.0.0"
- sniff_pkts = self.send_and_sniff_pkts(0, 2, pcap_file, filters)
- dst_ip_list = []
- for packet in sniff_pkts:
- dst_ip_list.append(packet.getlayer(1).dst)
- self.verify("2.64.0.0" not in dst_ip_list, "rule 1 test fail")
-
- # flush rules
- self.dut.send_expect("flow flush %d" % self.port_num, "testpmd> ", 60)
- flush_out = self.dut.send_expect(
- "flow list %d" % self.port_num, "testpmd> ", 60
- )
- self.verify("Rule" not in flush_out, "flush rule fail")
- self.dut.send_expect("clear port stats all", "testpmd> ", 60)
-
- # test all the rules
- pcap_file = "/tmp/route_4.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="0.0.0.0", dst="2.0.0.0", proto=17)
- / UDP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.write_pcap_file(pcap_file, pkt)
- self.send_pkts(0, pcap_file)
-
- pcap_file = "/tmp/route_4.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="0.0.0.0", dst="2.64.0.0", proto=6)
- / TCP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.write_pcap_file(pcap_file, pkt)
- self.send_pkts(0, pcap_file)
-
- pcap_file = "/tmp/route_4.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="2.128.0.0", dst="0.0.0.0", proto=132)
- / SCTP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.write_pcap_file(pcap_file, pkt)
- self.send_pkts(0, pcap_file)
-
- pcap_file = "/tmp/route_4.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="0.0.0.0", dst="4.0.0.0", proto=17)
- / UDP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.write_pcap_file(pcap_file, pkt)
- self.send_pkts(0, pcap_file)
-
- self.check_status(4, 0, self.port_num)
- self.dut.send_expect("quit", "# ", 60)
-
- def test_ipv4_5tuple_hash_table(self):
- """
- Ipv4 5tuple hash table
- """
- filename = "flow_ipv4_5tuple_hash_firmware.cli"
- self.start_testpmd(filename, self.port_num)
-
- # create rule
- self.generate_rules(
- src_mask=self.ipv4_mask,
- dst_mask=self.ipv4_mask,
- src_spec="100.0.0.1",
- dst_spec="200.0.0.1",
- protomask=self.protomask,
- protospec=6,
- l4type="tcp",
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=101,
- dportspec=201,
- index=[3],
- )
- self.generate_rules(
- src_mask=self.ipv4_mask,
- dst_mask=self.ipv4_mask,
- src_spec="100.0.0.2",
- dst_spec="200.0.0.2",
- protomask=self.protomask,
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=102,
- dportspec=202,
- index=[2],
- )
- self.generate_rules(
- src_mask=self.ipv4_mask,
- dst_mask=self.ipv4_mask,
- src_spec="100.0.0.3",
- dst_spec="200.0.0.3",
- protomask=self.protomask,
- protospec=132,
- l4type="sctp",
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=103,
- dportspec=203,
- index=[1],
- )
- self.generate_rules(
- src_mask=self.ipv4_mask,
- dst_mask=self.ipv4_mask,
- src_spec="100.0.0.4",
- dst_spec="200.0.0.4",
- protomask=self.protomask,
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=104,
- dportspec=204,
- index=[0],
- )
- self.dut.send_expect("start", "testpmd> ", 60)
-
- # rule 0 test
- pcap_file = "/tmp/route_0.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="100.0.0.1", dst="200.0.0.1", proto=6)
- / TCP(sport=101, dport=201)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "200.0.0.1", 0, 3)
-
- # rule 1 test
- pcap_file = "/tmp/route_1.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="100.0.0.2", dst="200.0.0.2", proto=17)
- / UDP(sport=102, dport=202)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "200.0.0.2", 0, 2)
-
- # rule 2 test
- pcap_file = "/tmp/route_2.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="100.0.0.3", dst="200.0.0.3", proto=132)
- / SCTP(sport=103, dport=203)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "200.0.0.3", 0, 1)
-
- # rule 3 test
- pcap_file = "/tmp/route_3.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="100.0.0.4", dst="200.0.0.4", proto=17)
- / UDP(sport=104, dport=204)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "200.0.0.4", 0, 0)
-
- self.dut.send_expect("quit", "# ", 60)
-
- def test_ipv4_addr_hash_table(self):
- """
- Ipv4 addr hash table
- """
- filename = "flow_ipv4_addr_hash_firmware.cli"
-
- # match ipv4 src_addr
- cmd = "pipeline RX table match hash ext key 8 mask FFFFFFFF00000000 offset 282 buckets 16K size 64K action AP0"
- self.set_table(cmd, filename)
- self.start_testpmd(filename, self.port_num)
-
- # create rule
- self.generate_rules(
- src_mask=self.ipv4_mask,
- src_spec="100.0.0.1",
- dst_spec="200.0.0.1",
- sportspec=100,
- dportspec=200,
- index=[3],
- )
- self.generate_rules(
- src_mask=self.ipv4_mask,
- src_spec="100.0.0.2",
- dst_spec="200.0.0.1",
- sportspec=100,
- dportspec=200,
- index=[2],
- )
- self.generate_rules(
- src_mask=self.ipv4_mask,
- src_spec="100.0.0.3",
- dst_spec="200.0.0.1",
- sportspec=100,
- dportspec=200,
- index=[1],
- )
- self.generate_rules(
- src_mask=self.ipv4_mask,
- src_spec="100.0.0.4",
- dst_spec="200.0.0.1",
- sportspec=100,
- dportspec=200,
- index=[0],
- )
- self.dut.send_expect("start", "testpmd> ", 60)
-
- # rule 0 test
- pcap_file = "/tmp/route_0.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="100.0.0.1", dst="200.0.0.1", proto=6)
- / TCP(sport=101, dport=201)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv4", "src", "100.0.0.1", 0, 3)
-
- # rule 1 test
- pcap_file = "/tmp/route_1.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="100.0.0.2", dst="200.0.0.2", proto=17)
- / UDP(sport=102, dport=202)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv4", "src", "100.0.0.2", 0, 2)
-
- # rule 2 test
- pcap_file = "/tmp/route_2.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="100.0.0.3", dst="200.0.0.3", proto=132)
- / SCTP(sport=103, dport=203)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv4", "src", "100.0.0.3", 0, 1)
-
- # rule 3 test
- pcap_file = "/tmp/route_3.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="100.0.0.4", dst="200.0.0.4")
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv4", "src", "100.0.0.4", 0, 0)
- self.dut.send_expect("quit", "# ", 60)
-
- # match ipv4 dst_addr
- cmd = "pipeline RX table match hash ext key 8 mask FFFFFF0000000000 offset 286 buckets 16K size 64K action AP0"
- self.set_table(cmd, filename)
- self.start_testpmd(filename, self.port_num)
-
- # create rule
- self.generate_rules(
- dst_mask="255.255.255.0",
- src_spec="100.0.0.1",
- dst_spec="200.0.0.1",
- sportspec=100,
- dportspec=200,
- index=[3],
- )
- self.generate_rules(
- dst_mask="255.255.255.0",
- src_spec="100.0.0.1",
- dst_spec="200.0.1.1",
- protospec=6,
- l4type="tcp",
- sportspec=100,
- dportspec=200,
- index=[2],
- )
- self.generate_rules(
- dst_mask="255.255.255.0",
- src_spec="100.0.0.1",
- dst_spec="200.0.2.1",
- protospec=132,
- l4type="sctp",
- sportspec=100,
- dportspec=200,
- index=[1],
- )
- self.generate_rules(
- dst_mask="255.255.255.0",
- src_spec="100.0.0.1",
- dst_spec="200.0.3.1",
- l4type="",
- index=[0],
- )
- self.dut.send_expect("start", "testpmd> ", 60)
-
- # rule 0 test
- pcap_file = "/tmp/route_0.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="100.0.0.1", dst="200.0.0.1", proto=6)
- / TCP(sport=101, dport=201)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "200.0.0.1", 0, 3)
-
- # rule 1 test
- pcap_file = "/tmp/route_1.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="100.0.0.2", dst="200.0.1.2", proto=17)
- / UDP(sport=102, dport=202)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "200.0.1.2", 0, 2)
-
- # rule 2 test
- pcap_file = "/tmp/route_2.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="100.0.0.3", dst="200.0.2.3", proto=132)
- / SCTP(sport=103, dport=203)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "200.0.2.3", 0, 1)
-
- # rule 3 test
- pcap_file = "/tmp/route_3.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="100.0.0.4", dst="200.0.3.4")
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "200.0.3.4", 0, 0)
- self.dut.send_expect("quit", "# ", 60)
-
- # match sport
- cmd = "pipeline RX table match hash ext key 8 mask FFFF000000000000 offset 290 buckets 16K size 64K action AP0"
- self.set_table(cmd, filename)
- self.start_testpmd(filename, self.port_num)
-
- # create rule
- self.generate_rules(
- src_spec="100.0.0.1",
- dst_spec="200.0.0.1",
- sportmask=self.portmask,
- sportspec=100,
- dportspec=200,
- index=[3],
- )
- self.generate_rules(
- src_spec="100.0.0.1",
- dst_spec="200.0.0.1",
- protospec=6,
- l4type="tcp",
- sportmask=self.portmask,
- sportspec=101,
- dportspec=200,
- index=[2],
- )
- self.generate_rules(
- src_spec="100.0.0.1",
- dst_spec="200.0.0.1",
- protospec=132,
- l4type="sctp",
- sportmask=self.portmask,
- sportspec=102,
- dportspec=200,
- index=[1],
- )
- self.generate_rules(
- src_spec="100.0.0.1",
- dst_spec="200.0.0.1",
- sportmask=self.portmask,
- sportspec=103,
- dportspec=200,
- index=[0],
- )
- self.dut.send_expect("start", "testpmd> ", 60)
-
- # rule 0 test
- pcap_file = "/tmp/route_0.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="100.0.0.1", dst="200.0.0.1", proto=6)
- / TCP(sport=100, dport=201)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "tcp", "src", 100, 0, 3)
-
- # rule 1 test
- pcap_file = "/tmp/route_1.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="100.0.0.2", dst="200.0.1.2", proto=17)
- / UDP(sport=101, dport=202)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "udp", "src", 101, 0, 2)
-
- # rule 2 test
- pcap_file = "/tmp/route_2.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="100.0.0.3", dst="200.0.2.3", proto=132)
- / SCTP(sport=102, dport=203)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "sctp", "src", 102, 0, 1)
-
- # rule 3 test
- pcap_file = "/tmp/route_3.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="100.0.0.2", dst="200.0.1.2", proto=17)
- / UDP(sport=103, dport=202)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "udp", "src", 103, 0, 0)
-
- # send a packet without l4 info
- pcap_file = "/tmp/route_4.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="100.0.0.4", dst="200.0.3.4")
- / ("X" * 48)
- ]
- self.write_pcap_file(pcap_file, pkt)
- self.send_pkts(0, pcap_file)
- self.check_status(5, 4, self.port_num)
-
- self.dut.send_expect("quit", "# ", 60)
-
- def test_ipv6_acl_table(self):
- """
- Ipv6 acl table
- """
- filename = "flow_ipv6_acl_firmware.cli"
- self.start_testpmd(filename, self.port_num)
-
- # create rule
- self.generate_rules(
- iptype="ipv6",
- src_mask=self.ipv6_mask,
- src_spec="ABCD:EF01:2345:6789:ABCD:EF01:2345:5789",
- protomask=self.protomask,
- index=[3],
- )
- self.generate_rules(
- iptype="ipv6",
- src_mask=self.ipv6_mask,
- src_spec="ABCD:EF01:2345:6789:ABCD:EF01:2345:6789",
- protomask=self.protomask,
- protospec=6,
- l4type="tcp",
- index=[2],
- )
- self.generate_rules(
- iptype="ipv6",
- src_mask=self.ipv6_mask,
- src_spec="ABCD:EF01:2345:6789:ABCD:EF01:2345:7789",
- protomask=self.protomask,
- protospec=132,
- l4type="sctp",
- index=[1],
- )
- self.generate_rules(
- iptype="ipv6",
- src_mask=self.ipv6_mask,
- src_spec="ABCD:EF01:2345:6789:ABCD:EF01:2345:8789",
- protomask=self.protomask,
- sportmask=self.portmask,
- sportspec=100,
- index=[0],
- )
- self.dut.send_expect("start", "testpmd> ", 60)
-
- # rule 0 test
- pcap_file = "/tmp/route_0.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:5789", dst="2001::2", nh=17)
- / UDP(sport=101, dport=201)
- / ("X" * 48)
- ]
- self.send_and_check_packets(
- pcap_file,
- pkt,
- "ipv6",
- "src",
- "ABCD:EF01:2345:6789:ABCD:EF01:2345:5789",
- 0,
- 3,
- )
-
- # rule 1 test
- pcap_file = "/tmp/route_1.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:6789", dst="2001::2", nh=6)
- / TCP(sport=101, dport=201)
- / ("X" * 48)
- ]
- self.send_and_check_packets(
- pcap_file,
- pkt,
- "ipv6",
- "src",
- "ABCD:EF01:2345:6789:ABCD:EF01:2345:6789",
- 0,
- 2,
- )
-
- # rule 2 test
- pcap_file = "/tmp/route_2.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:7789", dst="2001::2", nh=132)
- / SCTP(sport=101, dport=201)
- / ("X" * 48)
- ]
- self.send_and_check_packets(
- pcap_file,
- pkt,
- "ipv6",
- "src",
- "ABCD:EF01:2345:6789:ABCD:EF01:2345:7789",
- 0,
- 1,
- )
-
- # rule 3 test
- pcap_file = "/tmp/route_3.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:8789", dst="2001::2", nh=17)
- / UDP(sport=100, dport=201)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "udp", "src", 100, 0, 0)
-
- # send another 3 packets
- pcap_file = "/tmp/route_4.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:9789", dst="2001::2", nh=17)
- / UDP(sport=101, dport=201)
- / ("X" * 48)
- ]
- self.write_pcap_file(pcap_file, pkt)
- self.send_pkts(0, pcap_file)
-
- pcap_file = "/tmp/route_4.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:8789", dst="2001::2", nh=17)
- / UDP(sport=101, dport=201)
- / ("X" * 48)
- ]
- self.write_pcap_file(pcap_file, pkt)
- self.send_pkts(0, pcap_file)
-
- pcap_file = "/tmp/route_4.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:6789", dst="2001::2", nh=17)
- / TCP(sport=101, dport=201)
- / ("X" * 48)
- ]
- self.write_pcap_file(pcap_file, pkt)
- self.send_pkts(0, pcap_file)
-
- self.check_status(7, 4, self.port_num)
- self.dut.send_expect("quit", "# ", 60)
-
- def test_ipv6_addr_hash_table(self):
- """
- Ipv6 addr hash table
- """
- filename = "flow_ipv6_addr_hash_firmware.cli"
-
- # match ipv6 src_addr
- cmd = "pipeline RX table match hash ext key 16 mask FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF offset 278 buckets 16K size 64K action AP0"
- self.set_table(cmd, filename)
- self.start_testpmd(filename, self.port_num)
-
- # create rule
- self.generate_rules(
- iptype="ipv6",
- src_mask=self.ipv6_mask,
- src_spec="ABCD:EF01:2345:6789:ABCD:EF01:2345:5789",
- index=[3],
- )
- self.generate_rules(
- iptype="ipv6",
- src_mask=self.ipv6_mask,
- src_spec="ABCD:EF01:2345:6789:ABCD:EF01:2345:6789",
- index=[2],
- )
- self.generate_rules(
- iptype="ipv6",
- src_mask=self.ipv6_mask,
- src_spec="ABCD:EF01:2345:6789:ABCD:EF01:2345:7789",
- index=[1],
- )
- self.generate_rules(
- iptype="ipv6",
- src_mask=self.ipv6_mask,
- src_spec="ABCD:EF01:2345:6789:ABCD:EF01:2345:8789",
- index=[0],
- )
- self.dut.send_expect("start", "testpmd> ", 60)
-
- # rule 0 test
- pcap_file = "/tmp/route_0.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:5789", dst="2001::2", nh=6)
- / TCP(sport=101, dport=201)
- / ("X" * 48)
- ]
- self.send_and_check_packets(
- pcap_file,
- pkt,
- "ipv6",
- "src",
- "ABCD:EF01:2345:6789:ABCD:EF01:2345:5789",
- 0,
- 3,
- )
-
- # rule 1 test
- pcap_file = "/tmp/route_1.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:6789", dst="2001::2", nh=6)
- / TCP(sport=101, dport=201)
- / ("X" * 48)
- ]
- self.send_and_check_packets(
- pcap_file,
- pkt,
- "ipv6",
- "src",
- "ABCD:EF01:2345:6789:ABCD:EF01:2345:6789",
- 0,
- 2,
- )
-
- # rule 2 test
- pcap_file = "/tmp/route_2.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:7789", dst="2001::2", nh=132)
- / SCTP(sport=101, dport=201)
- / ("X" * 48)
- ]
- self.send_and_check_packets(
- pcap_file,
- pkt,
- "ipv6",
- "src",
- "ABCD:EF01:2345:6789:ABCD:EF01:2345:7789",
- 0,
- 1,
- )
-
- # rule 3 test
- pcap_file = "/tmp/route_3.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:8789", dst="2001::2", nh=17)
- / UDP(sport=100, dport=201)
- / ("X" * 48)
- ]
- self.send_and_check_packets(
- pcap_file,
- pkt,
- "ipv6",
- "src",
- "ABCD:EF01:2345:6789:ABCD:EF01:2345:8789",
- 0,
- 0,
- )
-
- pcap_file = "/tmp/route_4.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IPv6(src="ABCD:EF01:2345:6789:ABCD:EF01:2345:9789", dst="2001::2", nh=17)
- / UDP(sport=101, dport=201)
- / ("X" * 48)
- ]
- self.write_pcap_file(pcap_file, pkt)
- self.send_pkts(0, pcap_file)
- self.check_status(5, 4, self.port_num)
- self.dut.send_expect("quit", "# ", 60)
-
- # match ipv6 dst_addr
- cmd = "pipeline RX table match hash ext key 16 mask FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF offset 294 buckets 16K size 64K action AP0"
- self.set_table(cmd, filename)
- self.start_testpmd(filename, self.port_num)
-
- # create rule
- self.generate_rules(
- iptype="ipv6",
- dst_mask=self.ipv6_mask,
- dst_spec="ABCD:EF01:2345:6789:ABCD:EF01:2345:5789",
- index=[3],
- )
- self.generate_rules(
- iptype="ipv6",
- dst_mask=self.ipv6_mask,
- dst_spec="ABCD:EF01:2345:6789:ABCD:EF01:2345:6789",
- index=[2],
- )
- self.generate_rules(
- iptype="ipv6",
- dst_mask=self.ipv6_mask,
- dst_spec="ABCD:EF01:2345:6789:ABCD:EF01:2345:7789",
- index=[1],
- )
- self.generate_rules(
- iptype="ipv6",
- dst_mask=self.ipv6_mask,
- dst_spec="ABCD:EF01:2345:6789:ABCD:EF01:2345:8789",
- index=[0],
- )
- self.dut.send_expect("start", "testpmd> ", 60)
-
- # rule 0 test
- pcap_file = "/tmp/route_0.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IPv6(dst="ABCD:EF01:2345:6789:ABCD:EF01:2345:5789", src="2001::2", nh=6)
- / TCP(sport=101, dport=201)
- / ("X" * 48)
- ]
- self.send_and_check_packets(
- pcap_file,
- pkt,
- "ipv6",
- "dst",
- "ABCD:EF01:2345:6789:ABCD:EF01:2345:5789",
- 0,
- 3,
- )
-
- # rule 1 test
- pcap_file = "/tmp/route_1.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IPv6(dst="ABCD:EF01:2345:6789:ABCD:EF01:2345:6789", src="2001::2", nh=6)
- / TCP(sport=101, dport=201)
- / ("X" * 48)
- ]
- self.send_and_check_packets(
- pcap_file,
- pkt,
- "ipv6",
- "dst",
- "ABCD:EF01:2345:6789:ABCD:EF01:2345:6789",
- 0,
- 2,
- )
-
- # rule 2 test
- pcap_file = "/tmp/route_2.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IPv6(dst="ABCD:EF01:2345:6789:ABCD:EF01:2345:7789", src="2001::2", nh=132)
- / SCTP(sport=101, dport=201)
- / ("X" * 48)
- ]
- self.send_and_check_packets(
- pcap_file,
- pkt,
- "ipv6",
- "dst",
- "ABCD:EF01:2345:6789:ABCD:EF01:2345:7789",
- 0,
- 1,
- )
-
- # rule 3 test
- pcap_file = "/tmp/route_3.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IPv6(dst="ABCD:EF01:2345:6789:ABCD:EF01:2345:8789", src="2001::2", nh=17)
- / UDP(sport=100, dport=201)
- / ("X" * 48)
- ]
- self.send_and_check_packets(
- pcap_file,
- pkt,
- "ipv6",
- "dst",
- "ABCD:EF01:2345:6789:ABCD:EF01:2345:8789",
- 0,
- 0,
- )
-
- pcap_file = "/tmp/route_4.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IPv6(dst="ABCD:EF01:2345:6789:ABCD:EF01:2345:9789", src="2001::2", nh=17)
- / UDP(sport=101, dport=201)
- / ("X" * 48)
- ]
- self.write_pcap_file(pcap_file, pkt)
- self.send_pkts(0, pcap_file)
- self.check_status(5, 4, self.port_num)
- self.dut.send_expect("quit", "# ", 60)
-
- def test_ipv6_5tuple_hash_table(self):
- """
- Ipv6 5tuple hash table
- """
- filename = "flow_ipv6_5tuple_hash_firmware.cli"
- cmd = "pipeline RX table match hash ext key 64 mask 0000FF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000 offset 274 buckets 16K size 64K action AP0"
- self.set_table(cmd, filename)
- self.start_testpmd(filename, self.port_num)
-
- # create rule
- self.generate_rules(
- iptype="ipv6",
- src_mask=self.ipv6_mask,
- dst_mask=self.ipv6_mask,
- src_spec="2001::1",
- dst_spec="0::1",
- protomask=self.protomask,
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=101,
- dportspec=201,
- index=[3],
- )
- self.generate_rules(
- iptype="ipv6",
- src_mask=self.ipv6_mask,
- dst_mask=self.ipv6_mask,
- src_spec="2001::2",
- dst_spec="0::2",
- protomask=self.protomask,
- protospec=6,
- l4type="tcp",
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=102,
- dportspec=202,
- index=[2],
- )
- self.generate_rules(
- iptype="ipv6",
- src_mask=self.ipv6_mask,
- dst_mask=self.ipv6_mask,
- src_spec="2001::3",
- dst_spec="0::3",
- protomask=self.protomask,
- protospec=132,
- l4type="sctp",
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=103,
- dportspec=203,
- index=[1],
- )
- self.generate_rules(
- iptype="ipv6",
- src_mask=self.ipv6_mask,
- dst_mask=self.ipv6_mask,
- src_spec="2001::4",
- dst_spec="0::4",
- protomask=self.protomask,
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=104,
- dportspec=204,
- index=[0],
- )
- self.dut.send_expect("start", "testpmd> ", 60)
-
- # rule 0 test
- pcap_file = "/tmp/route_0.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IPv6(src="2001::1", dst="0::1", nh=17)
- / UDP(sport=101, dport=201)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv6", "src", "2001::1", 0, 3)
-
- # rule 1 test
- pcap_file = "/tmp/route_1.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IPv6(src="2001::2", dst="0::2", nh=6)
- / TCP(sport=102, dport=202)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv6", "src", "2001::2", 0, 2)
-
- # rule 2 test
- pcap_file = "/tmp/route_2.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IPv6(src="2001::3", dst="0::3", nh=132)
- / SCTP(sport=103, dport=203)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv6", "src", "2001::3", 0, 1)
-
- # rule 3 test
- pcap_file = "/tmp/route_3.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IPv6(src="2001::4", dst="0::4", nh=17)
- / UDP(sport=104, dport=204)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv6", "src", "2001::4", 0, 0)
-
- pcap_file = "/tmp/route_4.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IPv6(src="2001::1", dst="0::1", nh=6)
- / TCP(sport=101, dport=201)
- / ("X" * 48)
- ]
- self.write_pcap_file(pcap_file, pkt)
- self.send_pkts(0, pcap_file)
- self.check_status(5, 4, self.port_num)
- self.dut.send_expect("quit", "# ", 60)
-
- def test_inconsistent_rules(self):
- """
- Flow rule item is inconsistent with table match format
- """
- # ipv4
- filename = "flow_ipv4_addr_hash_firmware.cli"
- cmd = "pipeline RX table match hash ext key 8 mask FFFFFFFF00000000 offset 282 buckets 16K size 64K action AP0"
- self.set_table(cmd, filename)
- self.start_testpmd(filename, self.port_num)
-
- # create rule
- self.dut.send_expect(
- "flow create 4 group 0 ingress pattern eth / ipv4 proto mask 0 src mask 0.0.0.0 dst mask 255.255.255.255 src spec 100.0.0.1 dst spec 200.0.0.1 proto spec 17 / udp src mask 0 dst mask 0 src spec 100 dst spec 200 / end actions queue index 3 / end",
- "error",
- 60,
- )
- self.dut.send_expect("quit", "# ", 60)
-
- cmd = "pipeline RX table match hash ext key 8 mask FFFFFF0000000000 offset 286 buckets 16K size 64K action AP0"
- self.set_table(cmd, filename)
- self.start_testpmd(filename, self.port_num)
- self.dut.send_expect(
- "flow create 4 group 0 ingress pattern eth / ipv4 proto mask 0 src mask 0.0.0.0 dst mask 255.255.255.255 src spec 100.0.0.1 dst spec 200.0.0.1 proto spec 17 / udp src mask 0 dst mask 0 src spec 100 dst spec 200 / end actions queue index 3 / end",
- "error",
- 60,
- )
- self.dut.send_expect("quit", "# ", 60)
-
- # ipv6
- filename = "flow_ipv6_5tuple_hash_firmware.cli"
- cmd = "pipeline RX table match hash ext key 64 mask 0000FF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000 offset 274 buckets 16K size 64K action AP0"
- self.set_table(cmd, filename)
- self.start_testpmd(filename, self.port_num)
- self.dut.send_expect(
- "flow create 4 group 0 ingress pattern eth / ipv6 proto mask 255 src mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff dst mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff src spec 2001::1 dst spec 0::1 proto spec 17 / udp src mask 0 dst mask 65535 src spec 31 dst spec 41 / end actions queue index 3 / end",
- "error",
- 60,
- )
- self.dut.send_expect("quit", "# ", 60)
-
- cmd = "pipeline RX table match hash ext key 16 mask FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF offset 294 buckets 16K size 64K action AP0"
- self.set_table(cmd, filename)
- self.start_testpmd(filename, self.port_num)
- self.dut.send_expect(
- "flow create 4 group 0 ingress pattern eth / ipv6 proto mask 0 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 0 dst mask 0 src spec 0 dst spec 0 / end actions queue index 3 / end",
- "error",
- 60,
- )
- self.dut.send_expect("quit", "# ", 60)
-
- def test_ipv4_hash_rss_action(self):
- """
- Set rss action using acl table.
- """
- filename = "flow_ipv4_rss_firmware.cli"
-
- # match ipv4 src_addr
- cmd = "pipeline RX table match hash ext key 16 mask 00FF0000FFFFFFFFFFFFFFFFFFFFFFFF offset 278 buckets 16K size 64K action AP0"
- self.set_table(cmd, filename)
- self.start_testpmd(filename, self.port_num)
-
- # create rule
- self.generate_rules(
- src_mask=self.ipv4_mask,
- dst_mask=self.ipv4_mask,
- src_spec="100.0.0.1",
- dst_spec="200.0.0.1",
- protomask=self.protomask,
- protospec=6,
- l4type="tcp",
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=100,
- dportspec=200,
- action="rss",
- index=[3],
- )
- self.generate_rules(
- src_mask=self.ipv4_mask,
- dst_mask=self.ipv4_mask,
- src_spec="100.0.0.2",
- dst_spec="200.0.0.2",
- protomask=self.protomask,
- protospec=17,
- l4type="udp",
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=100,
- dportspec=200,
- action="rss",
- index=[2],
- )
- self.generate_rules(
- src_mask=self.ipv4_mask,
- dst_mask=self.ipv4_mask,
- src_spec="100.0.0.3",
- dst_spec="200.0.0.3",
- protomask=self.protomask,
- protospec=132,
- l4type="sctp",
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=100,
- dportspec=200,
- action="rss",
- index=[1],
- )
- self.generate_rules(
- src_mask=self.ipv4_mask,
- dst_mask=self.ipv4_mask,
- src_spec="100.0.0.4",
- dst_spec="200.0.0.4",
- protomask=self.protomask,
- protospec=6,
- l4type="tcp",
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=100,
- dportspec=200,
- action="rss",
- index=[0],
- )
- self.dut.send_expect("start", "testpmd> ", 60)
-
- # rule 0 test
- pcap_file = "/tmp/route_0.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="100.0.0.1", dst="200.0.0.1", proto=6)
- / TCP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "200.0.0.1", 0, 3)
-
- # rule 1 test
- pcap_file = "/tmp/route_1.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="100.0.0.2", dst="200.0.0.2", proto=17)
- / UDP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "200.0.0.2", 0, 2)
-
- # rule 2 test
- pcap_file = "/tmp/route_2.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="100.0.0.3", dst="200.0.0.3", proto=132)
- / SCTP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv4", "src", "100.0.0.3", 0, 1)
-
- # rule 3 test
- pcap_file = "/tmp/route_3.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="100.0.0.4", dst="200.0.0.4", proto=6)
- / TCP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "200.0.0.4", 0, 0)
-
- # not match test
- pcap_file = "/tmp/route_4.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="100.0.0.4", dst="200.0.0.4", proto=6)
- / TCP(sport=101, dport=200)
- / ("X" * 48)
- ]
- self.write_pcap_file(pcap_file, pkt)
- self.send_pkts(0, pcap_file)
- self.check_status(5, 4, self.port_num)
- self.dut.send_expect("quit", "# ", 60)
-
- # match ipv4 src_addr
- cmd = "pipeline RX table match hash ext key 16 mask 00FF0000FFFFFF00FFFFFFFFFFFFFFFF offset 278 buckets 16K size 64K action AP0"
- self.set_table(cmd, filename)
- self.start_testpmd(filename, self.port_num)
-
- self.generate_rules(
- src_mask="255.255.255.0",
- dst_mask=self.ipv4_mask,
- src_spec="100.0.0.1",
- dst_spec="200.0.0.1",
- protomask=self.protomask,
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=100,
- dportspec=200,
- action="rss",
- index=[0, 1, 2, 3],
- )
- self.generate_rules(
- src_mask="255.255.255.0",
- dst_mask=self.ipv4_mask,
- src_spec="100.0.1.2",
- dst_spec="200.0.0.1",
- protomask=self.protomask,
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=100,
- dportspec=200,
- action="rss",
- index=[0, 1, 2, 3],
- )
- self.dut.send_expect("start", "testpmd> ", 60)
-
- self.send_continuous_packet(
- "ipv4", "src", "100.0.0.1", "200.0.0.1", self.tester_itf
- )
- out = self.dut.send_expect("stop", "testpmd> ", 120)
- self.check_packet_queue([0, 1, 2, 3], out)
- self.dut.send_expect("start", "testpmd> ", 120)
- self.send_continuous_packet(
- "ipv4", "src", "100.0.1.2", "200.0.0.1", self.tester_itf
- )
- out = self.dut.send_expect("stop", "testpmd> ", 120)
- self.check_packet_queue([0, 1, 2, 3], out)
- self.dut.send_expect("quit", "# ", 60)
-
- # match ipv4 src_addr
- cmd = "pipeline RX table match hash ext key 8 mask FFFF0000FFFFFFFF offset 282 buckets 16K size 64K action AP0"
- self.set_table(cmd, filename)
- self.start_testpmd(filename, self.port_num)
-
- self.generate_rules(
- src_mask="255.255.0.0",
- dst_mask=self.ipv4_mask,
- src_spec="100.0.0.1",
- dst_spec="200.0.0.1",
- sportspec=100,
- dportspec=200,
- action="rss",
- index=[0],
- )
- self.generate_rules(
- src_mask="255.255.0.0",
- dst_mask=self.ipv4_mask,
- src_spec="100.0.0.1",
- dst_spec="200.0.0.2",
- sportspec=100,
- dportspec=200,
- action="rss",
- index=[2, 3],
- )
- self.generate_rules(
- src_mask="255.255.0.0",
- dst_mask=self.ipv4_mask,
- src_spec="200.0.0.1",
- dst_spec="200.0.0.2",
- sportspec=100,
- dportspec=200,
- action="rss",
- index=[1, 2],
- )
- self.dut.send_expect("start", "testpmd> ", 60)
-
- self.send_continuous_packet(
- "ipv4", "src", "100.0.0.1", "200.0.0.1", self.tester_itf
- )
- out = self.dut.send_expect("stop", "testpmd> ", 120)
- self.check_packet_queue([0], out)
- self.dut.send_expect("start", "testpmd> ", 120)
- self.send_continuous_packet(
- "ipv4", "src", "100.0.1.1", "200.0.0.2", self.tester_itf
- )
- out = self.dut.send_expect("stop", "testpmd> ", 120)
- self.check_packet_queue([2, 3], out)
- self.dut.send_expect("start", "testpmd> ", 120)
- self.send_continuous_packet(
- "ipv4", "src", "200.0.0.1", "200.0.0.2", self.tester_itf
- )
- out = self.dut.send_expect("stop", "testpmd> ", 120)
- self.check_packet_queue([1, 2], out)
-
- self.dut.send_expect("quit", "# ", 60)
-
- def test_ipv6_hash_rss_action(self):
- """
- Set rss action using hash table.
- """
- filename = "flow_ipv6_rss_firmware.cli"
-
- # match ipv6 src_addr
- cmd = "pipeline RX table match hash ext key 64 mask 0000FF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000 offset 274 buckets 16K size 64K action AP0"
- self.set_table(cmd, filename)
- self.start_testpmd(filename, self.port_num)
-
- # create rule
- self.generate_rules(
- iptype="ipv6",
- src_mask=self.ipv6_mask,
- dst_mask=self.ipv6_mask,
- src_spec="2001::1",
- dst_spec="1001::1",
- protomask=self.protomask,
- protospec=6,
- l4type="tcp",
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=100,
- dportspec=200,
- action="rss",
- index=[3],
- )
- self.generate_rules(
- iptype="ipv6",
- src_mask=self.ipv6_mask,
- dst_mask=self.ipv6_mask,
- src_spec="2001::2",
- dst_spec="1001::2",
- protomask=self.protomask,
- protospec=17,
- l4type="udp",
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=100,
- dportspec=200,
- action="rss",
- index=[2],
- )
- self.generate_rules(
- iptype="ipv6",
- src_mask=self.ipv6_mask,
- dst_mask=self.ipv6_mask,
- src_spec="2001::3",
- dst_spec="1001::3",
- protomask=self.protomask,
- protospec=132,
- l4type="sctp",
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=100,
- dportspec=200,
- action="rss",
- index=[1],
- )
- self.generate_rules(
- iptype="ipv6",
- src_mask=self.ipv6_mask,
- dst_mask=self.ipv6_mask,
- src_spec="2001::4",
- dst_spec="1001::4",
- protomask=self.protomask,
- protospec=6,
- l4type="tcp",
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=100,
- dportspec=200,
- action="rss",
- index=[0],
- )
- self.dut.send_expect("start", "testpmd> ", 60)
-
- # rule 0 test
- pcap_file = "/tmp/route_0.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IPv6(src="2001::1", dst="1001::1", nh=6)
- / TCP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv6", "dst", "1001::1", 0, 3)
-
- # rule 1 test
- pcap_file = "/tmp/route_1.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IPv6(src="2001::2", dst="1001::2", nh=17)
- / UDP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv6", "dst", "1001::2", 0, 2)
-
- # rule 2 test
- pcap_file = "/tmp/route_2.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IPv6(src="2001::3", dst="1001::3", nh=132)
- / SCTP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv6", "dst", "1001::3", 0, 1)
-
- # rule 3 test
- pcap_file = "/tmp/route_3.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IPv6(src="2001::4", dst="1001::4", nh=6)
- / TCP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv6", "dst", "1001::4", 0, 0)
-
- # not match test
- pcap_file = "/tmp/route_4.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IPv6(src="2001::1", dst="1001::1", nh=17)
- / UDP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.write_pcap_file(pcap_file, pkt)
- self.send_pkts(0, pcap_file)
- self.check_status(5, 4, self.port_num)
- self.dut.send_expect("quit", "# ", 60)
-
- cmd = "pipeline RX table match hash ext key 64 mask 0000FF00FFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000 offset 274 buckets 16K size 64K action AP0"
- self.set_table(cmd, filename)
- self.start_testpmd(filename, self.port_num)
-
- # create rule
- self.generate_rules(
- iptype="ipv6",
- src_mask="ffff:ffff:ffff:ffff:ffff:ffff:ffff:0",
- dst_mask=self.ipv6_mask,
- src_spec="ABCD:EF01:2345:6789:ABCD:EF01:2345:0",
- dst_spec="0::1",
- protomask=self.protomask,
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=100,
- dportspec=200,
- action="rss",
- index=[0, 1, 2, 3],
- )
- self.generate_rules(
- iptype="ipv6",
- src_mask="ffff:ffff:ffff:ffff:ffff:ffff:ffff:0",
- dst_mask=self.ipv6_mask,
- src_spec="ABCD:EF01:2345:6789:ABCD:EF01:2346:0",
- dst_spec="0::1",
- protomask=self.protomask,
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=100,
- dportspec=200,
- action="rss",
- index=[0, 1, 2, 3],
- )
- self.dut.send_expect("start", "testpmd> ", 60)
-
- self.send_continuous_packet(
- "ipv6",
- "src",
- "ABCD:EF01:2345:6789:ABCD:EF01:2345:0",
- "0::1",
- self.tester_itf,
- )
- out = self.dut.send_expect("stop", "testpmd> ", 120)
- self.check_packet_queue([0, 1, 2, 3], out)
- self.dut.send_expect("start", "testpmd> ", 120)
- self.send_continuous_packet(
- "ipv6",
- "src",
- "ABCD:EF01:2345:6789:ABCD:EF01:2346:0",
- "0::1",
- self.tester_itf,
- )
- out = self.dut.send_expect("stop", "testpmd> ", 120)
- self.check_packet_queue([0, 1, 2, 3], out)
- self.dut.send_expect("quit", "# ", 60)
-
- cmd = "pipeline RX table match hash ext key 64 mask 00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFF000000000000000000000000000000000000000000000000 offset 274 buckets 16K size 64K action AP0"
- self.set_table(cmd, filename)
- self.start_testpmd(filename, self.port_num)
-
- # create rule
- self.generate_rules(
- iptype="ipv6",
- src_mask=self.ipv6_mask,
- dst_mask="ffff:ffff:ffff:ffff:ffff:ffff:ffff:0",
- src_spec="2001::1",
- dst_spec="1001::1",
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=100,
- dportspec=200,
- action="rss",
- index=[0],
- )
- self.generate_rules(
- iptype="ipv6",
- src_mask=self.ipv6_mask,
- dst_mask="ffff:ffff:ffff:ffff:ffff:ffff:ffff:0",
- src_spec="2001::2",
- dst_spec="1001::1",
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=100,
- dportspec=200,
- action="rss",
- index=[2, 3],
- )
- self.generate_rules(
- iptype="ipv6",
- src_mask=self.ipv6_mask,
- dst_mask="ffff:ffff:ffff:ffff:ffff:ffff:ffff:0",
- src_spec="2001::1",
- dst_spec="1002::1",
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=100,
- dportspec=200,
- action="rss",
- index=[1, 2],
- )
- self.dut.send_expect("start", "testpmd> ", 60)
-
- self.send_continuous_packet(
- "ipv6", "dst", "2001::1", "1001::1", self.tester_itf
- )
- out = self.dut.send_expect("stop", "testpmd> ", 120)
- self.check_packet_queue([0], out)
- self.dut.send_expect("start", "testpmd> ", 120)
- self.send_continuous_packet(
- "ipv6", "dst", "2001::2", "1001::1", self.tester_itf
- )
- out = self.dut.send_expect("stop", "testpmd> ", 120)
- self.check_packet_queue([2, 3], out)
- self.dut.send_expect("start", "testpmd> ", 120)
- self.send_continuous_packet(
- "ipv6", "dst", "2001::1", "1002::1", self.tester_itf
- )
- out = self.dut.send_expect("stop", "testpmd> ", 120)
- self.check_packet_queue([1, 2], out)
- self.dut.send_expect("quit", "# ", 60)
-
- def test_ipv4_acl_jump(self):
- """
- Set jump action using acl table.
- """
- filename = "flow_ipv4_acl_jump_firmware.cli"
- port_num = 2
- self.start_testpmd(filename, port_num)
-
- # create rule
- self.generate_rules(
- port=port_num,
- group=1,
- dst_mask="255.192.0.0",
- dst_spec="200.0.0.0",
- protomask=self.protomask,
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=100,
- dportspec=200,
- index=[0],
- )
- self.generate_rules(
- port=port_num,
- group=1,
- dst_mask="255.192.0.0",
- dst_spec="200.64.0.0",
- protomask=self.protomask,
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=100,
- dportspec=200,
- index=[1],
- )
- self.generate_rules(
- port=port_num,
- dst_mask="255.192.0.0",
- dst_spec="200.0.0.0",
- protomask=self.protomask,
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=100,
- dportspec=200,
- action="jump",
- index=[1],
- )
- self.generate_rules(
- port=port_num,
- dst_mask="255.192.0.0",
- dst_spec="200.64.0.0",
- protomask=self.protomask,
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=100,
- dportspec=200,
- action="jump",
- index=[1],
- )
- self.dut.send_expect("start", "testpmd> ", 60)
-
- # rule 0 test
- pcap_file = "/tmp/route_0.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="0.0.0.0", dst="200.0.0.0", proto=17)
- / UDP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "200.0.0.0", 0, 0)
-
- # rule 1 test
- pcap_file = "/tmp/route_1.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="0.0.0.0", dst="200.64.0.0", proto=17)
- / UDP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "200.64.0.0", 0, 1)
-
- # destroy rules of group 1
- self.dut.send_expect("flow destroy 2 rule 0", "testpmd> ", 60)
- self.dut.send_expect("flow destroy 2 rule 1", "testpmd> ", 60)
- destroy_out = self.dut.send_expect("flow list 2", "testpmd> ", 60)
- self.verify("QUEUE" not in destroy_out, "destroy rule fail")
-
- # rule 2 test
- pcap_file = "/tmp/route_1.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="0.0.0.0", dst="200.0.0.0", proto=17)
- / UDP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.write_pcap_file(pcap_file, pkt)
- filters = "dst host 200.0.0.0"
- sniff_pkts = self.send_and_sniff_pkts(0, 0, pcap_file, filters)
- dst_ip_list = []
- for packet in sniff_pkts:
- dst_ip_list.append(packet.getlayer(1).dst)
- self.verify("200.0.0.0" not in dst_ip_list, "rule 2 test fail")
-
- self.dut.send_expect("quit", "# ", 60)
-
- def test_ipv4_hash_jump(self):
- """
- Set jump action using hash table.
- """
- filename = "flow_ipv4_hash_jump_firmware.cli"
- port_num = 2
- self.start_testpmd(filename, port_num)
-
- # create rule
- self.generate_rules(
- port=port_num,
- group=1,
- src_mask=self.ipv4_mask,
- dst_mask=self.ipv4_mask,
- src_spec="1.10.11.0",
- dst_spec="2.20.21.0",
- protomask=self.protomask,
- sportspec=100,
- dportspec=200,
- index=[0],
- )
- self.generate_rules(
- port=port_num,
- group=1,
- src_mask=self.ipv4_mask,
- dst_mask=self.ipv4_mask,
- src_spec="1.10.11.1",
- dst_spec="2.20.21.1",
- protomask=self.protomask,
- sportspec=100,
- dportspec=200,
- index=[1],
- )
- self.generate_rules(
- port=port_num,
- src_mask=self.ipv4_mask,
- dst_mask=self.ipv4_mask,
- src_spec="1.10.11.0",
- dst_spec="2.20.21.0",
- protomask=self.protomask,
- sportspec=100,
- dportspec=200,
- action="jump",
- index=[1],
- )
- self.generate_rules(
- port=port_num,
- src_mask=self.ipv4_mask,
- dst_mask=self.ipv4_mask,
- src_spec="1.10.11.1",
- dst_spec="2.20.21.1",
- protomask=self.protomask,
- sportspec=100,
- dportspec=200,
- action="jump",
- index=[1],
- )
- self.dut.send_expect("start", "testpmd> ", 60)
-
- # rule 0 test
- pcap_file = "/tmp/route_0.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="1.10.11.0", dst="2.20.21.0", proto=17)
- / UDP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "2.20.21.0", 0, 0)
-
- # rule 1 test
- pcap_file = "/tmp/route_1.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="1.10.11.1", dst="2.20.21.1", proto=17)
- / UDP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "2.20.21.1", 0, 1)
-
- # destroy rules of group 1
- self.dut.send_expect("flow destroy 2 rule 0", "Flow rule #0 destroyed", 60)
- self.dut.send_expect("flow destroy 2 rule 1", "Flow rule #1 destroyed", 60)
- destroy_out = self.dut.send_expect("flow list 2", "testpmd> ", 60)
- self.verify("QUEUE" not in destroy_out, "destroy rule fail")
-
- # rule 2 test
- pcap_file = "/tmp/route_1.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="1.10.11.1", dst="2.20.21.1", proto=17)
- / UDP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.write_pcap_file(pcap_file, pkt)
- filters = "dst host 2.20.21.1"
- sniff_pkts = self.send_and_sniff_pkts(0, 1, pcap_file, filters)
- dst_ip_list = []
- for packet in sniff_pkts:
- dst_ip_list.append(packet.getlayer(1).dst)
- self.verify("2.20.21.1" not in dst_ip_list, "rule 3 test fail")
-
- self.dut.send_expect("quit", "# ", 60)
-
- def test_ipv4_acl_hash_jump(self):
- """
- Set jump action from acl table to hash table.
- """
- filename = "flow_ipv4_acl_hash_jump_firmware.cli"
- port_num = 2
- self.start_testpmd(filename, port_num)
-
- # create rule
- self.generate_rules(
- port=port_num,
- group=1,
- src_mask=self.ipv4_mask,
- dst_mask=self.ipv4_mask,
- src_spec="1.10.11.0",
- dst_spec="2.20.21.0",
- protomask=self.protomask,
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=100,
- dportspec=200,
- index=[0],
- )
- self.generate_rules(
- port=port_num,
- group=1,
- src_mask=self.ipv4_mask,
- dst_mask=self.ipv4_mask,
- src_spec="1.10.11.1",
- dst_spec="2.20.21.1",
- protomask=self.protomask,
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=100,
- dportspec=200,
- index=[1],
- )
- self.generate_rules(
- port=port_num,
- src_mask=self.ipv4_mask,
- dst_mask=self.ipv4_mask,
- src_spec="1.10.11.0",
- dst_spec="2.20.21.0",
- protomask=self.protomask,
- sportspec=100,
- dportspec=200,
- action="jump",
- index=[1],
- )
- self.generate_rules(
- port=port_num,
- src_mask=self.ipv4_mask,
- dst_mask=self.ipv4_mask,
- src_spec="1.10.11.1",
- dst_spec="2.20.21.1",
- protomask=self.protomask,
- sportspec=100,
- dportspec=200,
- action="jump",
- index=[1],
- )
- self.dut.send_expect("start", "testpmd> ", 60)
-
- # rule 0 test
- pcap_file = "/tmp/route_0.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="1.10.11.0", dst="2.20.21.0", proto=17)
- / UDP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "2.20.21.0", 0, 0)
-
- # rule 1 test
- pcap_file = "/tmp/route_1.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="1.10.11.1", dst="2.20.21.1", proto=17)
- / UDP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "2.20.21.1", 0, 1)
-
- # rule 2 test
- pcap_file = "/tmp/route_2.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="1.10.11.0", dst="2.20.21.0", proto=17)
- / UDP(sport=101, dport=200)
- / ("X" * 48)
- ]
- self.write_pcap_file(pcap_file, pkt)
- self.send_pkts(0, pcap_file)
-
- # rule 3 test
- pcap_file = "/tmp/route_3.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="1.10.11.1", dst="2.20.21.1", proto=17)
- / UDP(sport=100, dport=201)
- / ("X" * 48)
- ]
- self.write_pcap_file(pcap_file, pkt)
- self.send_pkts(0, pcap_file)
-
- self.check_status(4, 2, port_num)
- self.dut.send_expect("quit", "# ", 60)
-
- def test_ipv4_hash_acl_jump(self):
- """
- Set jump action from hash table to acl table.
- """
- filename = "flow_ipv4_hash_acl_jump_firmware.cli"
- port_num = 2
- self.start_testpmd(filename, port_num)
-
- # create rule
- self.generate_rules(
- port=port_num,
- group=1,
- src_mask=self.ipv4_mask,
- dst_mask=self.ipv4_mask,
- src_spec="1.10.11.0",
- dst_spec="2.20.21.0",
- protomask=self.protomask,
- sportspec=100,
- dportspec=200,
- index=[0],
- )
- self.generate_rules(
- port=port_num,
- group=1,
- src_mask=self.ipv4_mask,
- dst_mask=self.ipv4_mask,
- src_spec="1.10.11.1",
- dst_spec="2.20.21.1",
- protomask=self.protomask,
- sportspec=100,
- dportspec=200,
- index=[1],
- )
- self.generate_rules(
- port=port_num,
- src_mask=self.ipv4_mask,
- dst_mask="255.255.255.0",
- src_spec="1.10.11.0",
- dst_spec="2.20.21.0",
- protomask=self.protomask,
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=100,
- dportspec=200,
- action="jump",
- index=[1],
- )
- self.generate_rules(
- port=port_num,
- src_mask=self.ipv4_mask,
- dst_mask="255.255.255.0",
- src_spec="1.10.11.1",
- dst_spec="2.20.21.1",
- protomask=self.protomask,
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=100,
- dportspec=200,
- action="jump",
- index=[1],
- )
- self.dut.send_expect("start", "testpmd> ", 60)
-
- # rule 0 test
- pcap_file = "/tmp/route_0.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="1.10.11.0", dst="2.20.21.0", proto=17)
- / UDP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "2.20.21.0", 0, 0)
-
- # rule 1 test
- pcap_file = "/tmp/route_1.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="1.10.11.1", dst="2.20.21.1", proto=17)
- / UDP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv4", "dst", "2.20.21.1", 0, 1)
-
- # rule 2 test
- pcap_file = "/tmp/route_2.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="1.10.11.0", dst="2.20.21.2", proto=17)
- / UDP(sport=101, dport=200)
- / ("X" * 48)
- ]
- self.write_pcap_file(pcap_file, pkt)
- self.send_pkts(0, pcap_file)
-
- # rule 3 test
- pcap_file = "/tmp/route_3.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IP(src="1.10.11.1", dst="2.20.21.3", proto=17)
- / UDP(sport=100, dport=201)
- / ("X" * 48)
- ]
- self.write_pcap_file(pcap_file, pkt)
- self.send_pkts(0, pcap_file)
-
- self.check_status(4, 2, port_num)
- self.dut.send_expect("quit", "# ", 60)
-
- def test_ipv6_acl_jump(self):
- """
- Set jump action with ipv6 acl table.
- """
- filename = "flow_ipv6_acl_jump_firmware.cli"
- port_num = 2
- self.start_testpmd(filename, port_num)
-
- # create rule
- self.generate_rules(
- port=port_num,
- group=1,
- iptype="ipv6",
- dst_mask=self.ipv6_mask,
- src_spec="1001::1",
- dst_spec="2001::1",
- protomask=self.protomask,
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=100,
- dportspec=200,
- index=[0],
- )
- self.generate_rules(
- port=port_num,
- group=1,
- iptype="ipv6",
- src_mask=self.ipv6_mask,
- dst_mask=self.ipv6_mask,
- src_spec="1001::1",
- dst_spec="2001::2",
- protomask=self.protomask,
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=100,
- dportspec=200,
- index=[1],
- )
- self.generate_rules(
- port=port_num,
- iptype="ipv6",
- dst_mask=self.ipv6_mask,
- src_spec="1001::1",
- dst_spec="2001::1",
- protomask=self.protomask,
- sportspec=100,
- dportspec=200,
- action="jump",
- index=[1],
- )
- self.generate_rules(
- port=port_num,
- iptype="ipv6",
- dst_mask=self.ipv6_mask,
- src_spec="1001::1",
- dst_spec="2001::2",
- protomask=self.protomask,
- sportspec=100,
- dportspec=200,
- action="jump",
- index=[1],
- )
- self.dut.send_expect("start", "testpmd> ", 60)
-
- # rule 0 test
- pcap_file = "/tmp/route_0.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IPv6(src="1001::1", dst="2001::1")
- / UDP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv6", "dst", "2001::1", 0, 0)
-
- # rule 1 test
- pcap_file = "/tmp/route_1.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IPv6(src="1001::1", dst="2001::2")
- / UDP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv6", "dst", "2001::2", 0, 1)
-
- pcap_file = "/tmp/route_2.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IPv6(src="1001::2", dst="2001::1")
- / UDP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv6", "dst", "2001::1", 0, 0)
-
- pcap_file = "/tmp/route_3.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IPv6(src="1001::2", dst="2001::2")
- / UDP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.write_pcap_file(pcap_file, pkt)
- self.send_pkts(0, pcap_file)
-
- self.check_status(4, 3, port_num)
- self.dut.send_expect("quit", "# ", 60)
-
- def test_ipv6_hash_jump(self):
- """
- Set jump action with ipv6 hash table.
- """
- filename = "flow_ipv6_hash_jump_firmware.cli"
- port_num = 2
- self.start_testpmd(filename, port_num)
-
- # create rule
- self.generate_rules(
- port=port_num,
- group=1,
- iptype="ipv6",
- src_mask=self.ipv6_mask,
- dst_mask=self.ipv6_mask,
- src_spec="1001::1",
- dst_spec="2001::1",
- protomask=self.protomask,
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=100,
- dportspec=200,
- index=[0],
- )
- self.generate_rules(
- port=port_num,
- group=1,
- iptype="ipv6",
- src_mask=self.ipv6_mask,
- dst_mask=self.ipv6_mask,
- src_spec="1001::2",
- dst_spec="2001::2",
- protomask=self.protomask,
- protospec=6,
- l4type="tcp",
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=100,
- dportspec=200,
- index=[1],
- )
- self.generate_rules(
- port=port_num,
- iptype="ipv6",
- src_mask=self.ipv6_mask,
- dst_mask=self.ipv6_mask,
- src_spec="1001::1",
- dst_spec="2001::1",
- protomask=self.protomask,
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=100,
- dportspec=200,
- action="jump",
- index=[1],
- )
- self.generate_rules(
- port=port_num,
- iptype="ipv6",
- src_mask=self.ipv6_mask,
- dst_mask=self.ipv6_mask,
- src_spec="1001::2",
- dst_spec="2001::2",
- protomask=self.protomask,
- protospec=6,
- l4type="tcp",
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=100,
- dportspec=200,
- action="jump",
- index=[1],
- )
- self.dut.send_expect("start", "testpmd> ", 60)
-
- # rule 0 test
- pcap_file = "/tmp/route_0.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IPv6(src="1001::1", dst="2001::1")
- / UDP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv6", "dst", "2001::1", 0, 0)
-
- # rule 1 test
- pcap_file = "/tmp/route_1.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IPv6(src="1001::2", dst="2001::2")
- / TCP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv6", "dst", "2001::2", 0, 1)
-
- # destroy rules of group 1
- self.dut.send_expect("flow destroy 2 rule 0", "Flow rule #0 destroyed", 60)
- self.dut.send_expect("flow destroy 2 rule 1", "Flow rule #1 destroyed", 60)
- destroy_out = self.dut.send_expect("flow list 2", "testpmd> ", 60)
- self.verify("QUEUE" not in destroy_out, "destroy rule fail")
-
- # rule 2 test
- pcap_file = "/tmp/route_2.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IPv6(src="1001::1", dst="2001::1")
- / UDP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.write_pcap_file(pcap_file, pkt)
- filters = "dst host 2001::1"
- sniff_pkts = self.send_and_sniff_pkts(0, 0, pcap_file, filters)
- dst_ip_list = []
- for packet in sniff_pkts:
- dst_ip_list.append(packet.getlayer(1).dst)
- self.verify("2001::1" not in dst_ip_list, "rule 2 test fail")
-
- self.dut.send_expect("quit", "# ", 60)
-
- def test_ipv6_acl_hash_jump(self):
- """
- Set jump action from ipv6 acl table to hash table.
- """
- filename = "flow_ipv6_acl_hash_jump_firmware.cli"
- port_num = 2
- self.start_testpmd(filename, port_num)
-
- # create rule
- self.generate_rules(
- port=port_num,
- group=1,
- iptype="ipv6",
- src_mask=self.ipv6_mask,
- dst_mask=self.ipv6_mask,
- src_spec="1001::1",
- dst_spec="2001::1",
- protomask=self.protomask,
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=100,
- dportspec=200,
- index=[0],
- )
- self.generate_rules(
- port=port_num,
- group=1,
- iptype="ipv6",
- src_mask=self.ipv6_mask,
- dst_mask=self.ipv6_mask,
- src_spec="1001::2",
- dst_spec="2001::2",
- protomask=self.protomask,
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=100,
- dportspec=200,
- index=[1],
- )
- self.generate_rules(
- port=port_num,
- iptype="ipv6",
- dst_mask=self.ipv6_mask,
- src_spec="1001::1",
- dst_spec="2001::1",
- protomask=self.protomask,
- sportspec=100,
- dportspec=200,
- action="jump",
- index=[1],
- )
- self.generate_rules(
- port=port_num,
- iptype="ipv6",
- dst_mask=self.ipv6_mask,
- src_spec="1001::2",
- dst_spec="2001::2",
- protomask=self.protomask,
- sportspec=100,
- dportspec=200,
- action="jump",
- index=[1],
- )
- self.dut.send_expect("start", "testpmd> ", 60)
-
- # rule 0 test
- pcap_file = "/tmp/route_0.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IPv6(src="1001::1", dst="2001::1")
- / UDP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv6", "dst", "2001::1", 0, 0)
-
- # rule 1 test
- pcap_file = "/tmp/route_1.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IPv6(src="1001::2", dst="2001::2")
- / UDP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv6", "dst", "2001::2", 0, 1)
-
- pcap_file = "/tmp/route_2.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IPv6(src="1001::3", dst="2001::1")
- / UDP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.write_pcap_file(pcap_file, pkt)
- self.send_pkts(0, pcap_file)
-
- pcap_file = "/tmp/route_3.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IPv6(src="1001::4", dst="2001::2")
- / UDP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.write_pcap_file(pcap_file, pkt)
- self.send_pkts(0, pcap_file)
-
- self.check_status(4, 2, port_num)
- self.dut.send_expect("quit", "# ", 60)
-
- def test_ipv6_hash_acl_jump(self):
- """
- Set jump action from ipv6 hash table to acl table.
- """
- filename = "flow_ipv6_hash_acl_jump_firmware.cli"
- port_num = 2
- self.start_testpmd(filename, port_num)
-
- # create rule
- self.generate_rules(
- port=port_num,
- group=1,
- iptype="ipv6",
- dst_mask=self.ipv6_mask,
- src_spec="1001::1",
- dst_spec="2001::1",
- protomask=self.protomask,
- sportmask=self.portmask,
- dportmask=self.portmask,
- sportspec=100,
- dportspec=200,
- index=[0],
- )
- self.generate_rules(
- port=port_num,
- group=1,
- iptype="ipv6",
- src_mask=self.ipv6_mask,
- dst_mask=self.ipv6_mask,
- src_spec="1001::2",
- dst_spec="2001::2",
- protomask=self.protomask,
- dportmask=self.portmask,
- sportspec=100,
- dportspec=200,
- index=[1],
- )
- self.generate_rules(
- port=port_num,
- iptype="ipv6",
- src_mask=self.ipv6_mask,
- dst_mask=self.ipv6_mask,
- src_spec="1001::1",
- dst_spec="2001::1",
- protomask=self.protomask,
- sportmask=self.portmask,
- sportspec=100,
- dportspec=200,
- action="jump",
- index=[1],
- )
- self.generate_rules(
- port=port_num,
- iptype="ipv6",
- src_mask=self.ipv6_mask,
- dst_mask=self.ipv6_mask,
- src_spec="1001::2",
- dst_spec="2001::2",
- protomask=self.protomask,
- sportmask=self.portmask,
- sportspec=100,
- dportspec=200,
- action="jump",
- index=[1],
- )
- self.dut.send_expect("start", "testpmd> ", 60)
-
- # rule 0 test
- pcap_file = "/tmp/route_0.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IPv6(src="1001::1", dst="2001::1")
- / UDP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv6", "dst", "2001::1", 0, 0)
-
- # rule 1 test
- pcap_file = "/tmp/route_1.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IPv6(src="1001::2", dst="2001::2")
- / UDP(sport=100, dport=200)
- / ("X" * 48)
- ]
- self.send_and_check_packets(pcap_file, pkt, "ipv6", "dst", "2001::2", 0, 1)
-
- pcap_file = "/tmp/route_2.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IPv6(src="1001::1", dst="2001::1")
- / UDP(sport=100, dport=201)
- / ("X" * 48)
- ]
- self.write_pcap_file(pcap_file, pkt)
- self.send_pkts(0, pcap_file)
-
- pcap_file = "/tmp/route_3.pcap"
- pkt = [
- Ether(dst=self.dut_p0_mac)
- / IPv6(src="1001::2", dst="2001::2")
- / UDP(sport=100, dport=202)
- / ("X" * 48)
- ]
- self.write_pcap_file(pcap_file, pkt)
- self.send_pkts(0, pcap_file)
-
- self.check_status(4, 2, port_num)
- self.dut.send_expect("quit", "# ", 60)
-
- def tear_down(self):
-
- """
- Run after each test case.
- """
- self.dut.kill_all()
-
- def tear_down_all(self):
- """
- Run after each test suite.
- """
- pass
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread