[v3,1/2] test_plans: add cloud_filter_with_l4_port_test_plan.rst
Commit Message
Enables the cloud filter for IPv4_UDP/IPv4_TCP/IPv4_SCTP
with SRC port only or DST port only.
This supports different filter types for the same packet type.
E.g. one IPv4_UDP rules with SRC port only and another IPv4_UDP rule
with DST port only.
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
---
.../cloud_filter_with_l4_port_test_plan.rst | 520 ++++++++++++++++++
1 file changed, 520 insertions(+)
create mode 100644 test_plans/cloud_filter_with_l4_port_test_plan.rst
Comments
Acked-by: Xueqin Lin <Xueqin.lin@intel.com>
> -----Original Message-----
> From: dts <dts-bounces@dpdk.org> On Behalf Of Guinan Sun
> Sent: Tuesday, August 18, 2020 11:08 AM
> To: dts@dpdk.org
> Cc: Sun, GuinanX <guinanx.sun@intel.com>
> Subject: [dts] [PATCH v3 1/2] test_plans: add
> cloud_filter_with_l4_port_test_plan.rst
>
> Enables the cloud filter for IPv4_UDP/IPv4_TCP/IPv4_SCTP with SRC port only
> or DST port only.
> This supports different filter types for the same packet type.
> E.g. one IPv4_UDP rules with SRC port only and another IPv4_UDP rule with
> DST port only.
>
> Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
> ---
> .../cloud_filter_with_l4_port_test_plan.rst | 520 ++++++++++++++++++
> 1 file changed, 520 insertions(+)
> create mode 100644 test_plans/cloud_filter_with_l4_port_test_plan.rst
>
> diff --git a/test_plans/cloud_filter_with_l4_port_test_plan.rst
> b/test_plans/cloud_filter_with_l4_port_test_plan.rst
> new file mode 100644
> index 0000000..50987f3
> --- /dev/null
> +++ b/test_plans/cloud_filter_with_l4_port_test_plan.rst
> @@ -0,0 +1,520 @@
> +.. Copyright (c) <2020>, Intel Corporation
> + All rights reserved.
> +
> + Redistribution and use in source and binary forms, with or without
> + modification, are permitted provided that the following conditions
> + are met:
> +
> + - Redistributions of source code must retain the above copyright
> + notice, this list of conditions and the following disclaimer.
> +
> + - Redistributions in binary form must reproduce the above copyright
> + notice, this list of conditions and the following disclaimer in
> + the documentation and/or other materials provided with the
> + distribution.
> +
> + - Neither the name of Intel Corporation nor the names of its
> + contributors may be used to endorse or promote products derived
> + from this software without specific prior written permission.
> +
> + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
> CONTRIBUTORS
> + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
> + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
> + COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
> INDIRECT,
> + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
> + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
> OR
> + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
> CONTRACT,
> + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
> + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
> ADVISED
> + OF THE POSSIBILITY OF SUCH DAMAGE.
> +
> +===================================
> +Cloud filter with l4 port test plan
> +===================================
> +
> +Prerequisites
> +=============
> +
> +1. Hardware:
> + Fortville
> +
> +2. software:
> + dpdk: http://dpdk.org/git/dpdk
> + scapy: http://www.secdev.org/projects/scapy/
> +
> +3. bind the pf to dpdk driver::
> +
> + ./usertools/dpdk-devbind.py --force --bind=vfio-pci 0000:81:00.0
> +
> +4.Launch the testpmd::
> + ./testpmd -l 0-3 -n 4 -w 81:00.0 --file-prefix=test -- -i --rxq=16 --txq=16 --
> disable-rss
> + testpmd> set fwd rxonly
> + testpmd> set promisc all off
> + testpmd> set verbose 1
> + testpmd> start
> +
> +Test Case 1: ipv4-udp_sport only
> +================================
> +
> + 1. validate a source port rule::
> + testpmd> flow validate 0 ingress pattern eth / ipv4 / udp src
> + is 156 / end actions pf / queue index 1 / end
> +
> + Verify the command can validate::
> + Flow rule validated
> +
> + 2. create a source port rule::
> + testpmd> flow create 0 ingress pattern eth / ipv4 / udp src is
> + 156 / end actions pf / queue index 1 / end
> +
> + testpmd> flow list 0
> +
> + Verify there is one rule.
> +
> + send matched packets::
> + p =
> + Ether(dst="3C:FD:FE:CF:31:D8")/IP()/UDP(sport=156)/Raw('x' * 80)
> +
> + Verify packets will be received in queue 1.
> +
> + send no matched packet::
> + p =
> + Ether(dst="3C:FD:FE:CF:31:D8")/IP()/UDP(sport=111)/Raw('x' * 80)
> +
> + Verify packets will not be received in queue 1.
> +
> + 3. flush the rule::
> + testpmd> flow flush 0
> +
> + send packets match rule 0::
> + p =
> + Ether(dst="3C:FD:FE:CF:31:D8")/IP()/UDP(sport=156)/Raw('x' * 80)
> +
> + packets should be in queue 0.
> +
> +Test Case 2: ipv4-udp_dport only
> +================================
> +
> + 1. validate a destination port rule::
> + testpmd> flow validate 0 ingress pattern eth / ipv4 / udp dst
> + is 156 / end actions pf / queue index 1 / end
> +
> + Verify the command can validate::
> + Flow rule validated
> +
> + 2. create a destination port rule::
> + testpmd> flow create 0 ingress pattern eth / ipv4 / udp dst is
> + 156 / end actions pf / queue index 1 / end
> +
> + testpmd> flow list 0
> +
> + Verify there is one rule.
> +
> + send matched packets::
> + p =
> + Ether(dst="3C:FD:FE:CF:31:D8")/IP()/UDP(dport=156)/Raw('x' * 80)
> +
> + Verify packets will be received in queue 1.
> +
> + send no matched packet::
> + p =
> + Ether(dst="3C:FD:FE:CF:31:D8")/IP()/UDP(dport=111)/Raw('x' * 80)
> +
> + Verify packets will not be received in queue 1.
> +
> + 3. flush the rule::
> + testpmd> flow flush 0
> +
> + send packets match rule 0::
> + p =
> + Ether(dst="3C:FD:FE:CF:31:D8")/IP()/UDP(dport=156)/Raw('x' * 80)
> +
> + packets should be in queue 0.
> +
> +Test Case 3: ipv4-tcp_sport only
> +================================
> +
> + 1. validate a source port rule::
> + testpmd> flow validate 0 ingress pattern eth / ipv4 / tcp src
> + is 156 / end actions pf / queue index 1 / end
> +
> + Verify the command can validate::
> + Flow rule validated
> +
> + 2. testpmd> flow create 0 ingress pattern eth / ipv4 / tcp src is
> + 156 / end actions pf / queue index 1 / end
> +
> + testpmd> flow list 0
> +
> + Verify there is one rule.
> +
> + send matched packets::
> + p =
> + Ether(dst="3C:FD:FE:CF:31:D8")/IP()/TCP(sport=156)/Raw('x' * 80)
> +
> + Verify packets will be received in queue 1.
> +
> + send no matched packet::
> + p =
> + Ether(dst="3C:FD:FE:CF:31:D8")/IP()/TCP(sport=111)/Raw('x' * 80)
> +
> + Verify packets will not be received in queue 1.
> +
> + 3. flush the rule::
> + testpmd> flow flush 0
> +
> + send packets match rule 0::
> + p =
> + Ether(dst="3C:FD:FE:CF:31:D8")/IP()/TCP(sport=156)/Raw('x' * 80)
> +
> + packets should be in queue 0.
> +
> +Test Case 4: ipv4-tcp_dport only
> +================================
> +
> + 1. validate a destination port rule::
> + testpmd> flow validate 0 ingress pattern eth / ipv4 / tcp dst
> + is 156 / end actions pf / queue index 1 / end
> +
> + Verify the command can validate::
> + Flow rule validated
> +
> + 2. create a destination port rule::
> + testpmd> flow create 0 ingress pattern eth / ipv4 / tcp dst is
> + 156 / end actions pf / queue index 1 / end
> +
> + testpmd> flow list 0
> +
> + Verify there is one rule.
> +
> + send matched packets::
> + p =
> + Ether(dst="3C:FD:FE:CF:31:D8")/IP()/TCP(dport=156)/Raw('x' * 80)
> +
> + Verify packets will be received in queue 1.
> +
> + send no matched packet::
> + p =
> + Ether(dst="3C:FD:FE:CF:31:D8")/IP()/TCP(dport=111)/Raw('x' * 80)
> +
> + Verify packets will not be received in queue 1.
> +
> + 3. flush the rule::
> + testpmd> flow flush 0
> +
> + send packets match rule 0::
> + p =
> + Ether(dst="3C:FD:FE:CF:31:D8")/IP()/TCP(dport=156)/Raw('x' * 80)
> +
> + packets should be in queue 0.
> +
> +Test Case 5: ipv4-sctp_sport only
> +================================
> +
> + 1. validate a source port rule::
> + testpmd> flow validate 0 ingress pattern eth / ipv4 / sctp src
> + is 156 / end actions pf / queue index 1 / end
> +
> + Verify the command can validate::
> + Flow rule validated
> +
> + 2. create a source port rule::
> + testpmd> flow create 0 ingress pattern eth / ipv4 / sctp src is
> + 156 / end actions pf / queue index 1 / end
> +
> + testpmd> flow list 0
> +
> + Verify there is one rule.
> +
> + send matched packets::
> + p =
> + Ether(dst="3C:FD:FE:CF:31:D8")/IP()/SCTP(sport=156)/Raw('x' * 80)
> +
> + Verify packets will be received in queue 1.
> +
> + send no matched packet::
> + p =
> + Ether(dst="3C:FD:FE:CF:31:D8")/IP()/SCTP(sport=111)/Raw('x' * 80)
> +
> + Verify packets will not be received in queue 1.
> +
> + 3. flush the rule::
> + testpmd> flow flush 0
> +
> + send packets match rule 0::
> + p =
> + Ether(dst="3C:FD:FE:CF:31:D8")/IP()/SCTP(sport=156)/Raw('x' * 80)
> +
> + packets should be in queue 0.
> +
> +Test Case 6: ipv4-sctp_dport only
> +================================
> +
> + 1. validate a destination port rule::
> + testpmd> flow validate 0 ingress pattern eth / ipv4 / sctp dst
> + is 156 / end actions pf / queue index 1 / end
> +
> + Verify the command can validate::
> + Flow rule validated
> +
> + 2. create a destination port rule::
> + testpmd> flow create 0 ingress pattern eth / ipv4 / sctp dst is
> + 156 / end actions pf / queue index 1 / end
> +
> + testpmd> flow list 0
> +
> + Verify there is one rule.
> +
> + send matched packets::
> + p =
> + Ether(dst="3C:FD:FE:CF:31:D8")/IP()/SCTP(dport=156)/Raw('x' * 80)
> +
> + Verify packets will be received in queue 1.
> +
> + send no matched packet::
> + p =
> + Ether(dst="3C:FD:FE:CF:31:D8")/IP()/SCTP(dport=111)/Raw('x' * 80)
> +
> + Verify packets will not be received in queue 1.
> +
> + 3. flush the rule::
> + testpmd> flow flush 0
> +
> + send packets match rule 0::
> + p =
> + Ether(dst="3C:FD:FE:CF:31:D8")/IP()/SCTP(dport=156)/Raw('x' * 80)
> +
> + packets should be in queue 0.
> +
> +Test Case 7: ipv6-udp_sport only
> +================================
> +
> + 1. validate a source port rule::
> + testpmd> flow validate 0 ingress pattern eth / ipv6 / udp src
> + is 156 / end actions pf / queue index 1 / end
> +
> + Verify the command can validate::
> + Flow rule validated
> +
> + 2. create a source port rule::
> + testpmd> flow create 0 ingress pattern eth / ipv6 / udp src is
> + 156 / end actions pf / queue index 1 / end
> +
> + testpmd> flow list 0
> +
> + Verify there is one rule.
> +
> + send matched packets::
> + p =
> + Ether(dst="3C:FD:FE:CF:31:D8")/IPv6()/UDP(sport=156)/Raw('x' * 80)
> +
> + Verify packets will be received in queue 1.
> +
> + send no matched packet::
> + p =
> + Ether(dst="3C:FD:FE:CF:31:D8")/IPv6()/UDP(sport=111)/Raw('x' * 80)
> +
> + Verify packets will not be received in queue 1.
> +
> + 3. flush the rule::
> + testpmd> flow flush 0
> +
> + send packets match rule 0::
> + p =
> + Ether(dst="3C:FD:FE:CF:31:D8")/IPv6()/UDP(sport=156)/Raw('x' * 80)
> +
> + packets should be in queue 0.
> +
> +Test Case 8: ipv6-udp_dport only
> +================================
> +
> + 1. validate a destination port rule::
> + testpmd> flow validate 0 ingress pattern eth / ipv6 / udp dst
> + is 156 / end actions pf / queue index 1 / end
> +
> + Verify the command can validate::
> + Flow rule validated
> +
> + 2. create a destination port rule::
> + testpmd> flow create 0 ingress pattern eth / ipv6 / udp dst is
> + 156 / end actions pf / queue index 1 / end
> +
> + testpmd> flow list 0
> +
> + Verify there is one rule.
> +
> + send matched packets::
> + p =
> + Ether(dst="3C:FD:FE:CF:31:D8")/IPv6()/UDP(dport=156)/Raw('x' * 80)
> +
> + Verify packets will be received in queue 1.
> +
> + send no matched packet::
> + p =
> + Ether(dst="3C:FD:FE:CF:31:D8")/IPv6()/UDP(dport=111)/Raw('x' * 80)
> +
> + Verify packets will not be received in queue 1.
> +
> + 3. flush the rule::
> + testpmd> flow flush 0
> +
> + send packets match rule 0::
> + p =
> + Ether(dst="3C:FD:FE:CF:31:D8")/IPv6()/UDP(dport=156)/Raw('x' * 80)
> +
> + packets should be in queue 0.
> +
> +Test Case 9: ipv6-tcp_sport only
> +================================
> +
> + 1. validate a source port rule::
> + testpmd> flow validate 0 ingress pattern eth / ipv6 / tcp src
> + is 156 / end actions pf / queue index 1 / end
> +
> + Verify the command can validate::
> + Flow rule validated
> +
> + 2. testpmd> flow create 0 ingress pattern eth / ipv6 / tcp src is
> + 156 / end actions pf / queue index 1 / end
> +
> + testpmd> flow list 0
> +
> + Verify there is one rule.
> +
> + send matched packets::
> + p =
> + Ether(dst="3C:FD:FE:CF:31:D8")/IPv6()/TCP(sport=156)/Raw('x' * 80)
> +
> + Verify packets will be received in queue 1.
> +
> + send no matched packet::
> + p =
> + Ether(dst="3C:FD:FE:CF:31:D8")/IPv6()/TCP(sport=111)/Raw('x' * 80)
> +
> + Verify packets will not be received in queue 1.
> +
> + 3. flush the rule::
> + testpmd> flow flush 0
> +
> + send packets match rule 0::
> + p =
> + Ether(dst="3C:FD:FE:CF:31:D8")/IPv6()/TCP(sport=156)/Raw('x' * 80)
> +
> + packets should be in queue 0.
> +
> +Test Case 10: ipv6-tcp_dport only
> +================================
> +
> + 1. validate a destination port rule::
> + testpmd> flow validate 0 ingress pattern eth / ipv6 / tcp dst
> + is 156 / end actions pf / queue index 1 / end
> +
> + Verify the command can validate::
> + Flow rule validated
> +
> + 2. create a destination port rule::
> + testpmd> flow create 0 ingress pattern eth / ipv6 / tcp dst is
> + 156 / end actions pf / queue index 1 / end
> +
> + testpmd> flow list 0
> +
> + Verify there is one rule.
> +
> + send matched packets::
> + p =
> + Ether(dst="3C:FD:FE:CF:31:D8")/IPv6()/TCP(dport=156)/Raw('x' * 80)
> +
> + Verify packets will be received in queue 1.
> +
> + send no matched packet::
> + p =
> + Ether(dst="3C:FD:FE:CF:31:D8")/IPv6()/TCP(dport=111)/Raw('x' * 80)
> +
> + Verify packets will not be received in queue 1.
> +
> + 3. flush the rule::
> + testpmd> flow flush 0
> +
> + send packets match rule 0::
> + p =
> + Ether(dst="3C:FD:FE:CF:31:D8")/IPv6()/TCP(dport=156)/Raw('x' * 80)
> +
> + packets should be in queue 0.
> +
> +Test Case 11: ipv6-sctp_sport only
> +================================
> +
> + 1. validate a source port rule::
> + testpmd> flow validate 0 ingress pattern eth / ipv6 / sctp src
> + is 156 / end actions pf / queue index 1 / end
> +
> + Verify the command can validate::
> + Flow rule validated
> +
> + 2. create a source port rule::
> + testpmd> flow create 0 ingress pattern eth / ipv6 / sctp src is
> + 156 / end actions pf / queue index 1 / end
> +
> + testpmd> flow list 0
> +
> + Verify there is one rule.
> +
> + send matched packets::
> + p =
> + Ether(dst="3C:FD:FE:CF:31:D8")/IPv6()/SCTP(sport=156)/Raw('x' * 80)
> +
> + Verify packets will be received in queue 1.
> +
> + send no matched packet::
> + p =
> + Ether(dst="3C:FD:FE:CF:31:D8")/IPv6()/SCTP(sport=111)/Raw('x' * 80)
> +
> + Verify packets will not be received in queue 1.
> +
> + 3. flush the rule::
> + testpmd> flow flush 0
> +
> + send packets match rule 0::
> + p =
> + Ether(dst="3C:FD:FE:CF:31:D8")/IPv6()/SCTP(sport=156)/Raw('x' * 80)
> +
> + packets should be in queue 0.
> +
> +Test Case 12: ipv6-sctp_dport only
> +================================
> +
> + 1. validate a destination port rule::
> + testpmd> flow validate 0 ingress pattern eth / ipv6 / sctp dst
> + is 156 / end actions pf / queue index 1 / end
> +
> + Verify the command can validate::
> + Flow rule validated
> +
> + 2. create a destination port rule::
> + testpmd> flow create 0 ingress pattern eth / ipv6 / sctp dst is
> + 156 / end actions pf / queue index 1 / end
> +
> + testpmd> flow list 0
> +
> + Verify there is one rule.
> +
> + send matched packets::
> + p =
> + Ether(dst="3C:FD:FE:CF:31:D8")/IPv6()/SCTP(dport=156)/Raw('x' * 80)
> +
> + Verify packets will be received in queue 1.
> +
> + send no matched packet::
> + p =
> + Ether(dst="3C:FD:FE:CF:31:D8")/IPv6()/SCTP(dport=111)/Raw('x' * 80)
> +
> + Verify packets will not be received in queue 1.
> +
> + 3. flush the rule::
> + testpmd> flow flush 0
> +
> + send packets match rule 0::
> + p =
> + Ether(dst="3C:FD:FE:CF:31:D8")/IPv6()/SCTP(dport=156)/Raw('x' * 80)
> +
> + packets should be in queue 0.
> +
> +Test Case 13: multi-rule
> +============================================================
> +
> + 1. create multi-rule with different input set rules::
> + creat rules::
> + testpmd> flow create 0 ingress pattern eth / ipv4 / udp src is 11 / end
> actions pf / queue index 1 / end
> + testpmd> flow create 0 ingress pattern eth / ipv4 / tcp src is 22 / end
> actions pf / queue index 2 / end
> + testpmd> flow create 0 ingress pattern eth / ipv4 / sctp src is 33 / end
> actions pf / queue index 3 / end
> + testpmd> flow create 0 ingress pattern eth / ipv4 / udp dst is 44 / end
> actions pf / queue index 4 / end
> + testpmd> flow create 0 ingress pattern eth / ipv4 / tcp dst is 55 / end
> actions pf / queue index 5 / end
> + testpmd> flow create 0 ingress pattern eth / ipv4 / sctp
> + dst is 66 / end actions pf / queue index 6 / end
> +
> + send packets::
> + p = Ether(dst="3C:FD:FE:CF:31:D8")/IP()/UDP(sport=11)/Raw('x' * 80)
> + p = Ether(dst="3C:FD:FE:CF:31:D8")/IP()/TCP(sport=22)/Raw('x' * 80)
> + p = Ether(dst="3C:FD:FE:CF:31:D8")/IP()/SCTP(sport=33)/Raw('x' * 80)
> + p = Ether(dst="3C:FD:FE:CF:31:D8")/IP()/UDP(dport=44)/Raw('x' * 80)
> + p = Ether(dst="3C:FD:FE:CF:31:D8")/IP()/TCP(dport=55)/Raw('x' * 80)
> + p =
> + Ether(dst="3C:FD:FE:CF:31:D8")/IP()/SCTP(dport=66)/Raw('x' * 80)
> +
> + Verify each packet can match the right queue.
> +
> + 2. destroy the rule::
> + testpmd> flow destroy 0 rule 0
> +
> + send packets match rule 0::
> + p =
> + Ether(dst="3C:FD:FE:CF:31:D8")/IP()/UDP(sport=11)/Raw('x' * 80)
> +
> + packets should be in queue 0.
> +
> + 3. flush the rule::
> + testpmd> flow flush 0
> +
> + send packets match rule 0::
> + p =
> + Ether(dst="3C:FD:FE:CF:31:D8")/IP()/TCP(sport=22)/Raw('x' * 80)
> +
> + packets should be in queue 0.
> +
> +Test Case 3: NEGATIVE_TEST
> +====================================
> +
> +1. rules can not create
> +
> + 1) unsupported rules::
> + create rules::
> + testpmd> flow create 0 ingress pattern eth / ipv4 / udp src
> + is 156 dst is 156 / end actions pf / queue index 1 / end
> +
> + Verify rules can not create.
> +
> + 2) conflicted rules::
> + create one rule::
> + testpmd> flow create 0 ingress pattern eth / ipv4 / udp src
> + is 156 / end actions pf / queue index 1 / end
> +
> + create conflicted rules::
> + testpmd> flow create 0 ingress pattern eth / ipv4 / udp src
> + is 156 / end actions pf / queue index 2 / end
> +
> + Verify rules can not create.
> \ No newline at end of file
> --
> 2.17.1
> > Enables the cloud filter for IPv4_UDP/IPv4_TCP/IPv4_SCTP with SRC port only or
> > DST port only.
> > This supports different filter types for the same packet type.
> > E.g. one IPv4_UDP rules with SRC port only and another IPv4_UDP rule with DST
> > port only.
> >
> > Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
> Acked-by: Xueqin Lin <Xueqin.lin@intel.com>
Applied
new file mode 100644
@@ -0,0 +1,520 @@
+.. Copyright (c) <2020>, Intel Corporation
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ - Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ OF THE POSSIBILITY OF SUCH DAMAGE.
+
+===================================
+Cloud filter with l4 port test plan
+===================================
+
+Prerequisites
+=============
+
+1. Hardware:
+ Fortville
+
+2. software:
+ dpdk: http://dpdk.org/git/dpdk
+ scapy: http://www.secdev.org/projects/scapy/
+
+3. bind the pf to dpdk driver::
+
+ ./usertools/dpdk-devbind.py --force --bind=vfio-pci 0000:81:00.0
+
+4.Launch the testpmd::
+ ./testpmd -l 0-3 -n 4 -w 81:00.0 --file-prefix=test -- -i --rxq=16 --txq=16 --disable-rss
+ testpmd> set fwd rxonly
+ testpmd> set promisc all off
+ testpmd> set verbose 1
+ testpmd> start
+
+Test Case 1: ipv4-udp_sport only
+================================
+
+ 1. validate a source port rule::
+ testpmd> flow validate 0 ingress pattern eth / ipv4 / udp src is 156 / end actions pf / queue index 1 / end
+
+ Verify the command can validate::
+ Flow rule validated
+
+ 2. create a source port rule::
+ testpmd> flow create 0 ingress pattern eth / ipv4 / udp src is 156 / end actions pf / queue index 1 / end
+
+ testpmd> flow list 0
+
+ Verify there is one rule.
+
+ send matched packets::
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IP()/UDP(sport=156)/Raw('x' * 80)
+
+ Verify packets will be received in queue 1.
+
+ send no matched packet::
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IP()/UDP(sport=111)/Raw('x' * 80)
+
+ Verify packets will not be received in queue 1.
+
+ 3. flush the rule::
+ testpmd> flow flush 0
+
+ send packets match rule 0::
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IP()/UDP(sport=156)/Raw('x' * 80)
+
+ packets should be in queue 0.
+
+Test Case 2: ipv4-udp_dport only
+================================
+
+ 1. validate a destination port rule::
+ testpmd> flow validate 0 ingress pattern eth / ipv4 / udp dst is 156 / end actions pf / queue index 1 / end
+
+ Verify the command can validate::
+ Flow rule validated
+
+ 2. create a destination port rule::
+ testpmd> flow create 0 ingress pattern eth / ipv4 / udp dst is 156 / end actions pf / queue index 1 / end
+
+ testpmd> flow list 0
+
+ Verify there is one rule.
+
+ send matched packets::
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IP()/UDP(dport=156)/Raw('x' * 80)
+
+ Verify packets will be received in queue 1.
+
+ send no matched packet::
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IP()/UDP(dport=111)/Raw('x' * 80)
+
+ Verify packets will not be received in queue 1.
+
+ 3. flush the rule::
+ testpmd> flow flush 0
+
+ send packets match rule 0::
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IP()/UDP(dport=156)/Raw('x' * 80)
+
+ packets should be in queue 0.
+
+Test Case 3: ipv4-tcp_sport only
+================================
+
+ 1. validate a source port rule::
+ testpmd> flow validate 0 ingress pattern eth / ipv4 / tcp src is 156 / end actions pf / queue index 1 / end
+
+ Verify the command can validate::
+ Flow rule validated
+
+ 2. testpmd> flow create 0 ingress pattern eth / ipv4 / tcp src is 156 / end actions pf / queue index 1 / end
+
+ testpmd> flow list 0
+
+ Verify there is one rule.
+
+ send matched packets::
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IP()/TCP(sport=156)/Raw('x' * 80)
+
+ Verify packets will be received in queue 1.
+
+ send no matched packet::
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IP()/TCP(sport=111)/Raw('x' * 80)
+
+ Verify packets will not be received in queue 1.
+
+ 3. flush the rule::
+ testpmd> flow flush 0
+
+ send packets match rule 0::
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IP()/TCP(sport=156)/Raw('x' * 80)
+
+ packets should be in queue 0.
+
+Test Case 4: ipv4-tcp_dport only
+================================
+
+ 1. validate a destination port rule::
+ testpmd> flow validate 0 ingress pattern eth / ipv4 / tcp dst is 156 / end actions pf / queue index 1 / end
+
+ Verify the command can validate::
+ Flow rule validated
+
+ 2. create a destination port rule::
+ testpmd> flow create 0 ingress pattern eth / ipv4 / tcp dst is 156 / end actions pf / queue index 1 / end
+
+ testpmd> flow list 0
+
+ Verify there is one rule.
+
+ send matched packets::
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IP()/TCP(dport=156)/Raw('x' * 80)
+
+ Verify packets will be received in queue 1.
+
+ send no matched packet::
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IP()/TCP(dport=111)/Raw('x' * 80)
+
+ Verify packets will not be received in queue 1.
+
+ 3. flush the rule::
+ testpmd> flow flush 0
+
+ send packets match rule 0::
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IP()/TCP(dport=156)/Raw('x' * 80)
+
+ packets should be in queue 0.
+
+Test Case 5: ipv4-sctp_sport only
+================================
+
+ 1. validate a source port rule::
+ testpmd> flow validate 0 ingress pattern eth / ipv4 / sctp src is 156 / end actions pf / queue index 1 / end
+
+ Verify the command can validate::
+ Flow rule validated
+
+ 2. create a source port rule::
+ testpmd> flow create 0 ingress pattern eth / ipv4 / sctp src is 156 / end actions pf / queue index 1 / end
+
+ testpmd> flow list 0
+
+ Verify there is one rule.
+
+ send matched packets::
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IP()/SCTP(sport=156)/Raw('x' * 80)
+
+ Verify packets will be received in queue 1.
+
+ send no matched packet::
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IP()/SCTP(sport=111)/Raw('x' * 80)
+
+ Verify packets will not be received in queue 1.
+
+ 3. flush the rule::
+ testpmd> flow flush 0
+
+ send packets match rule 0::
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IP()/SCTP(sport=156)/Raw('x' * 80)
+
+ packets should be in queue 0.
+
+Test Case 6: ipv4-sctp_dport only
+================================
+
+ 1. validate a destination port rule::
+ testpmd> flow validate 0 ingress pattern eth / ipv4 / sctp dst is 156 / end actions pf / queue index 1 / end
+
+ Verify the command can validate::
+ Flow rule validated
+
+ 2. create a destination port rule::
+ testpmd> flow create 0 ingress pattern eth / ipv4 / sctp dst is 156 / end actions pf / queue index 1 / end
+
+ testpmd> flow list 0
+
+ Verify there is one rule.
+
+ send matched packets::
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IP()/SCTP(dport=156)/Raw('x' * 80)
+
+ Verify packets will be received in queue 1.
+
+ send no matched packet::
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IP()/SCTP(dport=111)/Raw('x' * 80)
+
+ Verify packets will not be received in queue 1.
+
+ 3. flush the rule::
+ testpmd> flow flush 0
+
+ send packets match rule 0::
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IP()/SCTP(dport=156)/Raw('x' * 80)
+
+ packets should be in queue 0.
+
+Test Case 7: ipv6-udp_sport only
+================================
+
+ 1. validate a source port rule::
+ testpmd> flow validate 0 ingress pattern eth / ipv6 / udp src is 156 / end actions pf / queue index 1 / end
+
+ Verify the command can validate::
+ Flow rule validated
+
+ 2. create a source port rule::
+ testpmd> flow create 0 ingress pattern eth / ipv6 / udp src is 156 / end actions pf / queue index 1 / end
+
+ testpmd> flow list 0
+
+ Verify there is one rule.
+
+ send matched packets::
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IPv6()/UDP(sport=156)/Raw('x' * 80)
+
+ Verify packets will be received in queue 1.
+
+ send no matched packet::
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IPv6()/UDP(sport=111)/Raw('x' * 80)
+
+ Verify packets will not be received in queue 1.
+
+ 3. flush the rule::
+ testpmd> flow flush 0
+
+ send packets match rule 0::
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IPv6()/UDP(sport=156)/Raw('x' * 80)
+
+ packets should be in queue 0.
+
+Test Case 8: ipv6-udp_dport only
+================================
+
+ 1. validate a destination port rule::
+ testpmd> flow validate 0 ingress pattern eth / ipv6 / udp dst is 156 / end actions pf / queue index 1 / end
+
+ Verify the command can validate::
+ Flow rule validated
+
+ 2. create a destination port rule::
+ testpmd> flow create 0 ingress pattern eth / ipv6 / udp dst is 156 / end actions pf / queue index 1 / end
+
+ testpmd> flow list 0
+
+ Verify there is one rule.
+
+ send matched packets::
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IPv6()/UDP(dport=156)/Raw('x' * 80)
+
+ Verify packets will be received in queue 1.
+
+ send no matched packet::
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IPv6()/UDP(dport=111)/Raw('x' * 80)
+
+ Verify packets will not be received in queue 1.
+
+ 3. flush the rule::
+ testpmd> flow flush 0
+
+ send packets match rule 0::
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IPv6()/UDP(dport=156)/Raw('x' * 80)
+
+ packets should be in queue 0.
+
+Test Case 9: ipv6-tcp_sport only
+================================
+
+ 1. validate a source port rule::
+ testpmd> flow validate 0 ingress pattern eth / ipv6 / tcp src is 156 / end actions pf / queue index 1 / end
+
+ Verify the command can validate::
+ Flow rule validated
+
+ 2. testpmd> flow create 0 ingress pattern eth / ipv6 / tcp src is 156 / end actions pf / queue index 1 / end
+
+ testpmd> flow list 0
+
+ Verify there is one rule.
+
+ send matched packets::
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IPv6()/TCP(sport=156)/Raw('x' * 80)
+
+ Verify packets will be received in queue 1.
+
+ send no matched packet::
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IPv6()/TCP(sport=111)/Raw('x' * 80)
+
+ Verify packets will not be received in queue 1.
+
+ 3. flush the rule::
+ testpmd> flow flush 0
+
+ send packets match rule 0::
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IPv6()/TCP(sport=156)/Raw('x' * 80)
+
+ packets should be in queue 0.
+
+Test Case 10: ipv6-tcp_dport only
+================================
+
+ 1. validate a destination port rule::
+ testpmd> flow validate 0 ingress pattern eth / ipv6 / tcp dst is 156 / end actions pf / queue index 1 / end
+
+ Verify the command can validate::
+ Flow rule validated
+
+ 2. create a destination port rule::
+ testpmd> flow create 0 ingress pattern eth / ipv6 / tcp dst is 156 / end actions pf / queue index 1 / end
+
+ testpmd> flow list 0
+
+ Verify there is one rule.
+
+ send matched packets::
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IPv6()/TCP(dport=156)/Raw('x' * 80)
+
+ Verify packets will be received in queue 1.
+
+ send no matched packet::
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IPv6()/TCP(dport=111)/Raw('x' * 80)
+
+ Verify packets will not be received in queue 1.
+
+ 3. flush the rule::
+ testpmd> flow flush 0
+
+ send packets match rule 0::
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IPv6()/TCP(dport=156)/Raw('x' * 80)
+
+ packets should be in queue 0.
+
+Test Case 11: ipv6-sctp_sport only
+================================
+
+ 1. validate a source port rule::
+ testpmd> flow validate 0 ingress pattern eth / ipv6 / sctp src is 156 / end actions pf / queue index 1 / end
+
+ Verify the command can validate::
+ Flow rule validated
+
+ 2. create a source port rule::
+ testpmd> flow create 0 ingress pattern eth / ipv6 / sctp src is 156 / end actions pf / queue index 1 / end
+
+ testpmd> flow list 0
+
+ Verify there is one rule.
+
+ send matched packets::
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IPv6()/SCTP(sport=156)/Raw('x' * 80)
+
+ Verify packets will be received in queue 1.
+
+ send no matched packet::
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IPv6()/SCTP(sport=111)/Raw('x' * 80)
+
+ Verify packets will not be received in queue 1.
+
+ 3. flush the rule::
+ testpmd> flow flush 0
+
+ send packets match rule 0::
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IPv6()/SCTP(sport=156)/Raw('x' * 80)
+
+ packets should be in queue 0.
+
+Test Case 12: ipv6-sctp_dport only
+================================
+
+ 1. validate a destination port rule::
+ testpmd> flow validate 0 ingress pattern eth / ipv6 / sctp dst is 156 / end actions pf / queue index 1 / end
+
+ Verify the command can validate::
+ Flow rule validated
+
+ 2. create a destination port rule::
+ testpmd> flow create 0 ingress pattern eth / ipv6 / sctp dst is 156 / end actions pf / queue index 1 / end
+
+ testpmd> flow list 0
+
+ Verify there is one rule.
+
+ send matched packets::
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IPv6()/SCTP(dport=156)/Raw('x' * 80)
+
+ Verify packets will be received in queue 1.
+
+ send no matched packet::
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IPv6()/SCTP(dport=111)/Raw('x' * 80)
+
+ Verify packets will not be received in queue 1.
+
+ 3. flush the rule::
+ testpmd> flow flush 0
+
+ send packets match rule 0::
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IPv6()/SCTP(dport=156)/Raw('x' * 80)
+
+ packets should be in queue 0.
+
+Test Case 13: multi-rule
+============================================================
+
+ 1. create multi-rule with different input set rules::
+ creat rules::
+ testpmd> flow create 0 ingress pattern eth / ipv4 / udp src is 11 / end actions pf / queue index 1 / end
+ testpmd> flow create 0 ingress pattern eth / ipv4 / tcp src is 22 / end actions pf / queue index 2 / end
+ testpmd> flow create 0 ingress pattern eth / ipv4 / sctp src is 33 / end actions pf / queue index 3 / end
+ testpmd> flow create 0 ingress pattern eth / ipv4 / udp dst is 44 / end actions pf / queue index 4 / end
+ testpmd> flow create 0 ingress pattern eth / ipv4 / tcp dst is 55 / end actions pf / queue index 5 / end
+ testpmd> flow create 0 ingress pattern eth / ipv4 / sctp dst is 66 / end actions pf / queue index 6 / end
+
+ send packets::
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IP()/UDP(sport=11)/Raw('x' * 80)
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IP()/TCP(sport=22)/Raw('x' * 80)
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IP()/SCTP(sport=33)/Raw('x' * 80)
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IP()/UDP(dport=44)/Raw('x' * 80)
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IP()/TCP(dport=55)/Raw('x' * 80)
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IP()/SCTP(dport=66)/Raw('x' * 80)
+
+ Verify each packet can match the right queue.
+
+ 2. destroy the rule::
+ testpmd> flow destroy 0 rule 0
+
+ send packets match rule 0::
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IP()/UDP(sport=11)/Raw('x' * 80)
+
+ packets should be in queue 0.
+
+ 3. flush the rule::
+ testpmd> flow flush 0
+
+ send packets match rule 0::
+ p = Ether(dst="3C:FD:FE:CF:31:D8")/IP()/TCP(sport=22)/Raw('x' * 80)
+
+ packets should be in queue 0.
+
+Test Case 3: NEGATIVE_TEST
+====================================
+
+1. rules can not create
+
+ 1) unsupported rules::
+ create rules::
+ testpmd> flow create 0 ingress pattern eth / ipv4 / udp src is 156 dst is 156 / end actions pf / queue index 1 / end
+
+ Verify rules can not create.
+
+ 2) conflicted rules::
+ create one rule::
+ testpmd> flow create 0 ingress pattern eth / ipv4 / udp src is 156 / end actions pf / queue index 1 / end
+
+ create conflicted rules::
+ testpmd> flow create 0 ingress pattern eth / ipv4 / udp src is 156 / end actions pf / queue index 2 / end
+
+ Verify rules can not create.
\ No newline at end of file