test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH v1 1/2] test_plans: add cloud_filter_with_l4_port_test_plan.rst
@ 2020-08-17  5:54 Guinan Sun
  2020-08-17  5:54 ` [dts] [PATCH v1 2/2] tests/TestSuite_cloud_filter_with_l4_port.py add test cases Guinan Sun
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Guinan Sun @ 2020-08-17  5:54 UTC (permalink / raw)
  To: dts; +Cc: Guinan Sun

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   | 631 ++++++++++++++++++
 1 file changed, 631 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..9143dae
--- /dev/null
+++ b/test_plans/cloud_filter_with_l4_port_test_plan.rst
@@ -0,0 +1,631 @@
+.. 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
+
+Test Case 1: ipv4-udp_sport only
+================================
+
+    1. 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
+
+    2. 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
+
+    3. 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 are 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.
+
+    4. 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. 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
+
+    2. 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
+
+    3. 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 are 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.
+
+    4. 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. 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
+
+    2. 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
+
+    3. 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 are 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.
+
+    4. 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. 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
+
+    3. 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
+
+    3. 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 are 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.
+
+    4. 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. 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
+
+    2. 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
+
+    3. 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 are 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.
+
+    4. 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. 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
+
+    2. 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
+
+    3. 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 are 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.
+
+    4. 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. 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
+
+    2. 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
+
+    3. 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 are 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.
+
+    4. 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. 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
+
+    2. 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
+
+    3. 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 are 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.
+
+    4. 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. 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
+
+    2. 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
+
+    3. 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 are 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.
+
+    4. 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. 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
+
+    3. 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
+
+    3. 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 are 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.
+
+    4. 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. 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
+
+    2. 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
+
+    3. 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 are 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.
+
+    4. 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. 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
+
+    2. 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
+
+    3. 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 are 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.
+
+    4. 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. 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
+
+    2. 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.
+
+    3. 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.
+
+    4. 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
+====================================
+    Prerequisites
+
+    1. bind the port to dpdk driver in DUT::
+
+        modprobe vfio-pci
+        usertools/dpdk-devbind.py --force --bind=vfio-pci 0000:81:00.0
+
+    2. 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
+
+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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [dts] [PATCH v1 2/2] tests/TestSuite_cloud_filter_with_l4_port.py add test cases
  2020-08-17  5:54 [dts] [PATCH v1 1/2] test_plans: add cloud_filter_with_l4_port_test_plan.rst Guinan Sun
@ 2020-08-17  5:54 ` Guinan Sun
  2020-08-17  6:11 ` [dts] [PATCH v1 1/2] test_plans: add cloud_filter_with_l4_port_test_plan.rst Lin, Xueqin
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 14+ messages in thread
From: Guinan Sun @ 2020-08-17  5:54 UTC (permalink / raw)
  To: dts; +Cc: Guinan Sun

add test cases for the new cloud filter.

Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
---
 tests/TestSuite_cloud_filter_with_l4_port.py | 400 +++++++++++++++++++
 1 file changed, 400 insertions(+)
 create mode 100644 tests/TestSuite_cloud_filter_with_l4_port.py

diff --git a/tests/TestSuite_cloud_filter_with_l4_port.py b/tests/TestSuite_cloud_filter_with_l4_port.py
new file mode 100644
index 0000000..bf62c01
--- /dev/null
+++ b/tests/TestSuite_cloud_filter_with_l4_port.py
@@ -0,0 +1,400 @@
+# BSD LICENSE
+#
+# Copyright(c) 2020 Intel Corporation. All rights reserved.
+# 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.
+
+"""
+DPDK Test suite.
+
+Test the support of generic flow API by Poll Mode Drivers.
+
+"""
+
+import utils
+import time
+import re
+
+from test_case import TestCase
+from pmd_output import PmdOutput
+from settings import DRIVERS
+from crb import Crb
+from dut import Dut
+import packet
+from exception import VerifyFailure
+import scapy.layers.inet
+from scapy.utils import rdpcap
+
+MAX_QUEUE = 16
+
+class TestCloudFilterWithL4Port(TestCase):
+
+    def set_up_all(self):
+        """
+        Run at the start of each test suite.
+        Generic filter Prerequistites
+        """
+        # Based on h/w type, choose how many ports to use
+        self.dut_ports = self.dut.get_ports(self.nic)
+        # Verify that enough ports are available
+        self.verify(len(self.dut_ports) >= 1, "Insufficient ports")
+        self.cores = "1S/8C/1T"
+        self.pf_cores = "1S/8C/1T"
+        self.pmdout = PmdOutput(self.dut)
+
+        localPort = self.tester.get_local_port(self.dut_ports[0])
+        self.tester_itf = self.tester.get_interface(localPort)
+        self.pf_interface = self.dut.ports_info[self.dut_ports[0]]['intf']
+        self.pf_mac = self.dut.get_mac_address(0)
+        self.pf_pci = self.dut.ports_info[self.dut_ports[0]]['pci']
+        self.pkt_obj = packet.Packet()
+
+    def set_up(self):
+        """
+        Run before each test case.
+        """
+        self.dut.kill_all()
+
+        self.verify(self.nic in ["fortville_eagle", "fortville_spirit", "carlsville",
+                            "fortville_spirit_single", "fortpark_TLV",
+                            "fortpark_BASE-T","fortville_25g"], "%s nic not support fdir vlan filter" % self.nic)
+
+        self.pmdout.start_testpmd("%s" % self.cores, "--rxq=%d --txq=%d --disable-rss" % (MAX_QUEUE, MAX_QUEUE), "-w %s --file-prefix=test1" % self.pf_pci)
+        self.dut.send_expect("set fwd rxonly", "testpmd> ", 120)
+        self.dut.send_expect("set promisc all off", "testpmd> ", 120)
+        self.dut.send_expect("set verbose 1", "testpmd> ", 120)
+        self.dut.send_expect("start", "testpmd> ", 120)
+        time.sleep(2)
+
+    def destroy_env(self):
+        """
+        This is to stop testpmd.
+        """
+        self.dut.send_expect("quit", "# ")
+        time.sleep(2)
+
+    def compare_memory_rules(self, expectedRules):
+        """
+        dump all flow rules that have been created in memory and compare that total rules number with the given expected number
+        to see if they are equal, as to get your conclusion after you have deleted any flow rule entry.
+        """
+        outstring = self.dut.send_expect("flow list 0", "testpmd> ", 20)
+        result_scanner = r'\d*.*?\d*.*?\d*.*?=>*'
+        scanner = re.compile(result_scanner, re.DOTALL)
+        m = scanner.findall(outstring)
+        print("All flow entries are: ")
+        for i in range(len(m)):
+            print(m[i])
+        print('Expected rules are: %d - actual are: %d' % (expectedRules, len(m)))
+        self.verify(expectedRules == len(m), 'Total rules number mismatched')
+
+    def verify_rulenum(self, rule_num):
+        """
+        Verify all the rules created.
+        """
+        # check if there are expected flow rules have been created
+        self.compare_memory_rules(rule_num)
+        # check if one rule destoried with success
+        self.dut.send_expect("flow destroy 0 rule 0", "testpmd> ")
+        self.compare_memory_rules(rule_num - 1)
+        # check if all flow rules have been removed with success
+        self.dut.send_expect("flow flush 0", "testpmd> ")
+        self.compare_memory_rules(0)
+
+    def sendpkt(self, pktstr, count=1):
+        import sys
+        py_version = sys.version
+        if py_version.startswith('3.'):
+            self.pkt_obj.pktgen.pkts.clear()
+        else:
+            del self.pkt_obj.pktgen.pkts[:]
+        self.pkt_obj.append_pkt(pktstr)
+        self.pkt_obj.send_pkt(self.tester, tx_port=self.tester_itf, count=count)
+
+    def sendpkt_check_result(self, src_port, dst_port, queue, match, pctype=""):
+        match_info = "/queue %d: " % queue
+        # source port
+        if src_port != "" and dst_port == "":
+            if pctype == "ipv4-udp":
+                self.sendpkt(pktstr='Ether()/IP()/UDP(sport=%s)' % src_port)
+            elif pctype == "ipv4-tcp":
+                self.sendpkt(pktstr='Ether()/IP()/TCP(sport=%s)' % src_port)
+            elif pctype == "ipv4-sctp":
+                self.sendpkt(pktstr='Ether()/IP()/SCTP(sport=%s)' % src_port)
+            elif pctype == "ipv6-udp":
+                self.sendpkt(pktstr='Ether()/IPv6()/UDP(sport=%s)' % src_port)
+            elif pctype == "ipv6-tcp":
+                self.sendpkt(pktstr='Ether()/IPv6()/TCP(sport=%s)' % src_port)
+            elif pctype == "ipv6-sctp":
+                self.sendpkt(pktstr='Ether()/IPv6()/SCTP(sport=%s)' % src_port)
+        elif src_port == "" and dst_port != "":
+            if pctype == "ipv4-udp":
+                self.sendpkt(pktstr='Ether()/IP()/UDP(dport=%s)' % dst_port)
+            elif pctype == "ipv4-tcp":
+                self.sendpkt(pktstr='Ether()/IP()/TCP(dport=%s)' % dst_port)
+            elif pctype == "ipv4-sctp":
+                self.sendpkt(pktstr='Ether()/IP()/SCTP(dport=%s)' % dst_port)
+            elif pctype == "ipv6-udp":
+                self.sendpkt(pktstr='Ether()/IPv6()/UDP(dport=%s)' % dst_port)
+            elif pctype == "ipv6-tcp":
+                self.sendpkt(pktstr='Ether()/IPv6()/TCP(dport=%s)' % dst_port)
+            elif pctype == "ipv6-sctp":
+                self.sendpkt(pktstr='Ether()/IPv6()/SCTP(dport=%s)' % dst_port)
+        elif src_port != "" and dst_port != "":
+            if pctype == "ipv4-udp":
+                self.sendpkt(pktstr='Ether()/IP()/UDP(sport=%s, dport=%s)' % (src_port, dst_port))
+
+        out_pf = self.dut.get_session_output(timeout=2)
+        print("out_pf is %s" % out_pf)
+
+        if match == 1:
+            self.verify(match_info in out_pf, "the packet not match the expect queue %d." % queue)
+        else:
+            if match_info in out_pf:
+                raise Exception("the packet should not match the queue %d." % queue)
+
+    def cloudfilter_test(
+            self, ip_type='ipv4', l4_port_type='udp', src_dst='src', port_value=156, queue_id=0):
+            
+            # validate
+            self.dut.send_expect(
+                "flow validate 0 ingress pattern eth / %s / %s %s is %d / end actions pf / queue index %d / end"
+                    % (ip_type, l4_port_type, src_dst, port_value, queue_id),
+                "validated")
+
+            # create
+            self.dut.send_expect(
+                "flow create 0 ingress pattern eth / %s / %s %s is %d / end actions pf / queue index %d / end"
+                    % (ip_type, l4_port_type, src_dst, port_value, queue_id),
+                "created")
+
+            # list
+            self.compare_memory_rules(1)
+
+            if src_dst is 'src':
+                self.sendpkt_check_result("%d"%port_value, "", queue_id, 1, "%s-%s"%(ip_type,l4_port_type))
+                self.sendpkt_check_result("%d"%(port_value-1), "", queue_id, 0, "%s-%s"%(ip_type,l4_port_type))
+            else:
+                self.sendpkt_check_result("", "%d"%port_value, queue_id, 1, "%s-%s"%(ip_type,l4_port_type))
+                self.sendpkt_check_result("", "%d"%(port_value-1), queue_id, 0, "%s-%s"%(ip_type,l4_port_type))
+
+            # flush
+            self.dut.send_expect("flow flush 0", "testpmd> ")
+
+            if src_dst is 'src':
+                self.sendpkt_check_result("%d"%(port_value-1), "", queue_id, 0, "%s-%s"%(ip_type,l4_port_type))
+            else:
+                self.sendpkt_check_result("", "%d"%(port_value-1), queue_id, 0, "%s-%s"%(ip_type,l4_port_type))
+
+            self.compare_memory_rules(0)
+
+    def test_ipv4_udp_sport_only(self):
+        """
+        only supported by i40e
+        """
+        # ipv4-udp
+        # only src port
+        self.cloudfilter_test(
+            ip_type='ipv4', l4_port_type='udp', src_dst='src', port_value=156, queue_id=1)
+
+    def test_ipv4_udp_dport_only(self):
+        """
+        only supported by i40e
+        """
+        # ipv4-udp
+        # only dst port
+        self.cloudfilter_test(
+            ip_type='ipv4', l4_port_type='udp', src_dst='dst', port_value=156, queue_id=1)
+
+    def test_ipv4_tcp_sport_only(self):
+        """
+        only supported by i40e
+        """
+        # ipv4-tcp
+        # only src port
+        self.cloudfilter_test(
+            ip_type='ipv4', l4_port_type='tcp', src_dst='src', port_value=156, queue_id=1)
+
+    def test_ipv4_tcp_dport_only(self):
+        """
+        only supported by i40e
+        """
+        #ipv4-tcp
+        # only dst port
+        self.cloudfilter_test(
+            ip_type='ipv4', l4_port_type='tcp', src_dst='dst', port_value=156, queue_id=1)
+
+    def test_ipv4_sctp_sport_only(self):
+        """
+        only supported by i40e
+        """
+        # ipv4-sctp
+        # only src port
+        self.cloudfilter_test(
+            ip_type='ipv4', l4_port_type='sctp', src_dst='src', port_value=156, queue_id=1)
+
+    def test_ipv4_sctp_dport_only(self):
+        """
+        only supported by i40e
+        """
+        #ipv4-sctp
+        # only dst port
+        self.cloudfilter_test(
+            ip_type='ipv4', l4_port_type='sctp', src_dst='dst', port_value=156, queue_id=1)
+
+    def test_ipv6_udp_sport_only(self):
+        """
+        only supported by i40e
+        """
+        # ipv6-udp
+        # only src port
+        self.cloudfilter_test(
+            ip_type='ipv6', l4_port_type='udp', src_dst='src', port_value=156, queue_id=1)
+
+    def test_ipv6_udp_dport_only(self):
+        """
+        only supported by i40e
+        """
+        # ipv6-udp
+        # only dst port
+        self.cloudfilter_test(
+            ip_type='ipv6', l4_port_type='udp', src_dst='dst', port_value=156, queue_id=1)
+
+    def test_ipv6_tcp_sport_only(self):
+        """
+        only supported by i40e
+        """
+        # ipv6-tcp
+        # only src port
+        self.cloudfilter_test(
+            ip_type='ipv6', l4_port_type='tcp', src_dst='src', port_value=156, queue_id=1)
+
+    def test_ipv6_tcp_dport_only(self):
+        """
+        only supported by i40e
+        """
+        #ipv6-tcp
+        # only dst port
+        self.cloudfilter_test(
+            ip_type='ipv6', l4_port_type='tcp', src_dst='dst', port_value=156, queue_id=1)
+
+    def test_ipv6_sctp_sport_only(self):
+        """
+        only supported by i40e
+        """
+        # ipv6-sctp
+        # only src port
+        self.cloudfilter_test(
+            ip_type='ipv6', l4_port_type='sctp', src_dst='src', port_value=156, queue_id=1)
+
+    def test_ipv6_sctp_dport_only(self):
+        """
+        only supported by i40e
+        """
+        #ipv6-sctp
+        # only dst port
+        self.cloudfilter_test(
+            ip_type='ipv6', l4_port_type='sctp', src_dst='dst', port_value=156, queue_id=1)
+
+    def test_multi_rule(self):
+        """
+        only supported by i40e
+        """
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth / ipv4 / udp src is 11 / end actions pf / queue index 1 / end",
+            "created")
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth / ipv4 / tcp src is 22 / end actions pf / queue index 2 / end",
+            "created")
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth / ipv4 / sctp src is 33 / end actions pf / queue index 3 / end",
+            "created")
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth / ipv4 / udp dst is 44 / end actions pf / queue index 4 / end",
+            "created")
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth / ipv4 / tcp dst is 55 / end actions pf / queue index 5 / end",
+            "created")
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth / ipv4 / sctp dst is 66 / end actions pf / queue index 6 / end",
+            "created")
+
+        self.sendpkt_check_result("11", "", 1, 1, "ipv4-udp")
+        self.sendpkt_check_result("22", "", 2, 1, "ipv4-tcp")
+        self.sendpkt_check_result("33", "", 3, 1, "ipv4-sctp")
+        self.sendpkt_check_result("", "44", 4, 1, "ipv4-udp")
+        self.sendpkt_check_result("", "55", 5, 1, "ipv4-tcp")
+        self.sendpkt_check_result("", "66", 6, 1, "ipv4-sctp")
+
+        # destroy
+        self.dut.send_expect("flow destroy 0 rule 0", "testpmd> ")
+
+        self.sendpkt_check_result("11", "", 1, 0, "ipv4-udp")
+
+        self.compare_memory_rules(5)
+
+        # flush
+        self.dut.send_expect("flow flush 0", "testpmd> ")
+
+        self.sendpkt_check_result("22", "", 2, 0, "ipv4-tcp")
+
+        self.compare_memory_rules(0)
+
+    def test_negative(self):
+        """
+        only supported by i40e
+        """
+        # unsupported rules
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth / ipv4 / udp src is 156 dst is 156 / end actions pf / queue index 1 / end",
+            "error")
+
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth / ipv4 / udp src is 156 / end actions pf / queue index 1 / end",
+            "create")
+
+        # conflicted rules
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth / ipv4 / udp src is 156 / end actions pf / queue index 2 / end",
+            "error")
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth / ipv6 / udp src is 156 / end actions pf / queue index 2 / end",
+            "error")
+
+    def tear_down(self):
+        """
+        Run after each test case.
+        """
+        self.destroy_env()
+        self.dut.kill_all()
+
+    def tear_down_all(self):
+        """
+        Run after each test suite.
+        """
+        self.dut.kill_all()
-- 
2.17.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [dts] [PATCH v1 1/2] test_plans: add cloud_filter_with_l4_port_test_plan.rst
  2020-08-17  5:54 [dts] [PATCH v1 1/2] test_plans: add cloud_filter_with_l4_port_test_plan.rst Guinan Sun
  2020-08-17  5:54 ` [dts] [PATCH v1 2/2] tests/TestSuite_cloud_filter_with_l4_port.py add test cases Guinan Sun
@ 2020-08-17  6:11 ` Lin, Xueqin
  2020-08-17  8:34 ` [dts] [PATCH v2 " Guinan Sun
  2020-08-18  3:07 ` [dts] [PATCH v3 " Guinan Sun
  3 siblings, 0 replies; 14+ messages in thread
From: Lin, Xueqin @ 2020-08-17  6:11 UTC (permalink / raw)
  To: Sun, GuinanX, dts; +Cc: Sun, GuinanX


Acked-by: Xueqin Lin <Xueqin.lin@intel.com>

> -----Original Message-----
> From: dts <dts-bounces@dpdk.org> On Behalf Of Guinan Sun
> Sent: Monday, August 17, 2020 1:55 PM
> To: dts@dpdk.org
> Cc: Sun, GuinanX <guinanx.sun@intel.com>
> Subject: [dts] [PATCH v1 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   | 631 ++++++++++++++++++
>  1 file changed, 631 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..9143dae
> --- /dev/null
> +++ b/test_plans/cloud_filter_with_l4_port_test_plan.rst
> @@ -0,0 +1,631 @@
> +.. 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
> +
> +Test Case 1: ipv4-udp_sport only
> +================================
> +
> +    1. 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
> +
> +    2. 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
> +
> +    3. 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 are 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.
> +
> +    4. 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. 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
> +
> +    2. 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
> +
> +    3. 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 are 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.
> +
> +    4. 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. 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
> +
> +    2. 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
> +
> +    3. 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 are 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.
> +
> +    4. 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. 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
> +
> +    3. 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
> +
> +    3. 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 are 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.
> +
> +    4. 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. 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
> +
> +    2. 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
> +
> +    3. 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 are 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.
> +
> +    4. 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. 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
> +
> +    2. 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
> +
> +    3. 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 are 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.
> +
> +    4. 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. 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
> +
> +    2. 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
> +
> +    3. 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 are 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.
> +
> +    4. 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. 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
> +
> +    2. 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
> +
> +    3. 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 are 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.
> +
> +    4. 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. 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
> +
> +    2. 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
> +
> +    3. 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 are 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.
> +
> +    4. 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. 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
> +
> +    3. 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
> +
> +    3. 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 are 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.
> +
> +    4. 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. 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
> +
> +    2. 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
> +
> +    3. 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 are 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.
> +
> +    4. 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. 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
> +
> +    2. 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
> +
> +    3. 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 are 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.
> +
> +    4. 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. 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
> +
> +    2. 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.
> +
> +    3. 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.
> +
> +    4. 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
> +====================================
> +    Prerequisites
> +
> +    1. bind the port to dpdk driver in DUT::
> +
> +        modprobe vfio-pci
> +        usertools/dpdk-devbind.py --force --bind=vfio-pci 0000:81:00.0
> +
> +    2. 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
> +
> +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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [dts] [PATCH v2 1/2] test_plans: add cloud_filter_with_l4_port_test_plan.rst
  2020-08-17  5:54 [dts] [PATCH v1 1/2] test_plans: add cloud_filter_with_l4_port_test_plan.rst Guinan Sun
  2020-08-17  5:54 ` [dts] [PATCH v1 2/2] tests/TestSuite_cloud_filter_with_l4_port.py add test cases Guinan Sun
  2020-08-17  6:11 ` [dts] [PATCH v1 1/2] test_plans: add cloud_filter_with_l4_port_test_plan.rst Lin, Xueqin
@ 2020-08-17  8:34 ` Guinan Sun
  2020-08-17  8:34   ` [dts] [PATCH v2 2/2] tests/TestSuite_cloud_filter_with_l4_port.py add test cases Guinan Sun
  2020-08-18  2:08   ` [dts] [PATCH v2 1/2] test_plans: add cloud_filter_with_l4_port_test_plan.rst Lin, Xueqin
  2020-08-18  3:07 ` [dts] [PATCH v3 " Guinan Sun
  3 siblings, 2 replies; 14+ messages in thread
From: Guinan Sun @ 2020-08-17  8:34 UTC (permalink / raw)
  To: dts; +Cc: Guinan Sun

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..beef55c
--- /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 are 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 are 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 are 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 are 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 are 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 are 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 are 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 are 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 are 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 are 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 are 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 are 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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [dts] [PATCH v2 2/2] tests/TestSuite_cloud_filter_with_l4_port.py add test cases
  2020-08-17  8:34 ` [dts] [PATCH v2 " Guinan Sun
@ 2020-08-17  8:34   ` Guinan Sun
  2020-08-18  1:59     ` Lin, Xueqin
  2020-08-18  2:08   ` [dts] [PATCH v2 1/2] test_plans: add cloud_filter_with_l4_port_test_plan.rst Lin, Xueqin
  1 sibling, 1 reply; 14+ messages in thread
From: Guinan Sun @ 2020-08-17  8:34 UTC (permalink / raw)
  To: dts; +Cc: Guinan Sun

add test cases for the new cloud filter.

Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
---
 tests/TestSuite_cloud_filter_with_l4_port.py | 400 +++++++++++++++++++
 1 file changed, 400 insertions(+)
 create mode 100644 tests/TestSuite_cloud_filter_with_l4_port.py

diff --git a/tests/TestSuite_cloud_filter_with_l4_port.py b/tests/TestSuite_cloud_filter_with_l4_port.py
new file mode 100644
index 0000000..37b646e
--- /dev/null
+++ b/tests/TestSuite_cloud_filter_with_l4_port.py
@@ -0,0 +1,400 @@
+# BSD LICENSE
+#
+# Copyright(c) 2020 Intel Corporation. All rights reserved.
+# 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.
+
+"""
+DPDK Test suite.
+
+Test the support of generic flow API by Poll Mode Drivers.
+
+"""
+
+import utils
+import time
+import re
+
+from test_case import TestCase
+from pmd_output import PmdOutput
+from settings import DRIVERS
+from crb import Crb
+from dut import Dut
+import packet
+from exception import VerifyFailure
+import scapy.layers.inet
+from scapy.utils import rdpcap
+
+MAX_QUEUE = 16
+
+class TestCloudFilterWithL4Port(TestCase):
+
+    def set_up_all(self):
+        """
+        Run at the start of each test suite.
+        Generic filter Prerequistites
+        """
+        # Based on h/w type, choose how many ports to use
+        self.dut_ports = self.dut.get_ports(self.nic)
+        # Verify that enough ports are available
+        self.verify(len(self.dut_ports) >= 1, "Insufficient ports")
+        self.cores = "1S/8C/1T"
+        self.pf_cores = "1S/8C/1T"
+        self.pmdout = PmdOutput(self.dut)
+
+        localPort = self.tester.get_local_port(self.dut_ports[0])
+        self.tester_itf = self.tester.get_interface(localPort)
+        self.pf_interface = self.dut.ports_info[self.dut_ports[0]]['intf']
+        self.pf_mac = self.dut.get_mac_address(0)
+        self.pf_pci = self.dut.ports_info[self.dut_ports[0]]['pci']
+        self.pkt_obj = packet.Packet()
+
+        self.verify(self.nic in ["fortville_eagle", "fortville_spirit", "carlsville",
+                    "fortville_spirit_single", "fortpark_TLV",
+                    "fortpark_BASE-T","fortville_25g"], "%s nic not support fdir vlan filter" % self.nic)
+
+    def set_up(self):
+        """
+        Run before each test case.
+        """
+        self.dut.kill_all()
+
+        self.pmdout.start_testpmd("%s" % self.cores, "--rxq=%d --txq=%d --disable-rss" % (MAX_QUEUE, MAX_QUEUE), "-w %s --file-prefix=test1" % self.pf_pci)
+        self.dut.send_expect("set fwd rxonly", "testpmd> ", 120)
+        self.dut.send_expect("set promisc all off", "testpmd> ", 120)
+        self.dut.send_expect("set verbose 1", "testpmd> ", 120)
+        self.dut.send_expect("start", "testpmd> ", 120)
+        time.sleep(2)
+
+    def destroy_env(self):
+        """
+        This is to stop testpmd.
+        """
+        self.dut.send_expect("quit", "# ")
+        time.sleep(2)
+
+    def compare_memory_rules(self, expectedRules):
+        """
+        dump all flow rules that have been created in memory and compare that total rules number with the given expected number
+        to see if they are equal, as to get your conclusion after you have deleted any flow rule entry.
+        """
+        outstring = self.dut.send_expect("flow list 0", "testpmd> ", 20)
+        result_scanner = r'\d*.*?\d*.*?\d*.*?=>*'
+        scanner = re.compile(result_scanner, re.DOTALL)
+        m = scanner.findall(outstring)
+        print("All flow entries are: ")
+        for i in range(len(m)):
+            print(m[i])
+        print('Expected rules are: %d - actual are: %d' % (expectedRules, len(m)))
+        self.verify(expectedRules == len(m), 'Total rules number mismatched')
+
+    def verify_rulenum(self, rule_num):
+        """
+        Verify all the rules created.
+        """
+        # check if there are expected flow rules have been created
+        self.compare_memory_rules(rule_num)
+        # check if one rule destroied with success
+        self.dut.send_expect("flow destroy 0 rule 0", "testpmd> ")
+        self.compare_memory_rules(rule_num - 1)
+        # check if all flow rules have been removed with success
+        self.dut.send_expect("flow flush 0", "testpmd> ")
+        self.compare_memory_rules(0)
+
+    def sendpkt(self, pktstr, count=1):
+        import sys
+        py_version = sys.version
+        if py_version.startswith('3.'):
+            self.pkt_obj.pktgen.pkts.clear()
+        else:
+            del self.pkt_obj.pktgen.pkts[:]
+        self.pkt_obj.append_pkt(pktstr)
+        self.pkt_obj.send_pkt(self.tester, tx_port=self.tester_itf, count=count)
+
+    def sendpkt_check_result(self, src_port, dst_port, queue, match, pctype=""):
+        match_info = "/queue %d: " % queue
+        # source port
+        if src_port != "" and dst_port == "":
+            if pctype == "ipv4-udp":
+                self.sendpkt(pktstr='Ether()/IP()/UDP(sport=%s)' % src_port)
+            elif pctype == "ipv4-tcp":
+                self.sendpkt(pktstr='Ether()/IP()/TCP(sport=%s)' % src_port)
+            elif pctype == "ipv4-sctp":
+                self.sendpkt(pktstr='Ether()/IP()/SCTP(sport=%s)' % src_port)
+            elif pctype == "ipv6-udp":
+                self.sendpkt(pktstr='Ether()/IPv6()/UDP(sport=%s)' % src_port)
+            elif pctype == "ipv6-tcp":
+                self.sendpkt(pktstr='Ether()/IPv6()/TCP(sport=%s)' % src_port)
+            elif pctype == "ipv6-sctp":
+                self.sendpkt(pktstr='Ether()/IPv6()/SCTP(sport=%s)' % src_port)
+        elif src_port == "" and dst_port != "":
+            if pctype == "ipv4-udp":
+                self.sendpkt(pktstr='Ether()/IP()/UDP(dport=%s)' % dst_port)
+            elif pctype == "ipv4-tcp":
+                self.sendpkt(pktstr='Ether()/IP()/TCP(dport=%s)' % dst_port)
+            elif pctype == "ipv4-sctp":
+                self.sendpkt(pktstr='Ether()/IP()/SCTP(dport=%s)' % dst_port)
+            elif pctype == "ipv6-udp":
+                self.sendpkt(pktstr='Ether()/IPv6()/UDP(dport=%s)' % dst_port)
+            elif pctype == "ipv6-tcp":
+                self.sendpkt(pktstr='Ether()/IPv6()/TCP(dport=%s)' % dst_port)
+            elif pctype == "ipv6-sctp":
+                self.sendpkt(pktstr='Ether()/IPv6()/SCTP(dport=%s)' % dst_port)
+        elif src_port != "" and dst_port != "":
+            if pctype == "ipv4-udp":
+                self.sendpkt(pktstr='Ether()/IP()/UDP(sport=%s, dport=%s)' % (src_port, dst_port))
+
+        out_pf = self.dut.get_session_output(timeout=2)
+        print("out_pf is %s" % out_pf)
+
+        if match == 1:
+            self.verify(match_info in out_pf, "the packet not match the expect queue %d." % queue)
+        else:
+            if match_info in out_pf:
+                raise Exception("the packet should not match the queue %d." % queue)
+
+    def cloudfilter_test(
+            self, ip_type='ipv4', l4_port_type='udp', src_dst='src', port_value=156, queue_id=0):
+
+            # validate
+            self.dut.send_expect(
+                "flow validate 0 ingress pattern eth / %s / %s %s is %d / end actions pf / queue index %d / end"
+                    % (ip_type, l4_port_type, src_dst, port_value, queue_id),
+                "validated")
+
+            # create
+            self.dut.send_expect(
+                "flow create 0 ingress pattern eth / %s / %s %s is %d / end actions pf / queue index %d / end"
+                    % (ip_type, l4_port_type, src_dst, port_value, queue_id),
+                "created")
+
+            # list
+            self.compare_memory_rules(1)
+
+            if src_dst is 'src':
+                self.sendpkt_check_result("%d"%port_value, "", queue_id, 1, "%s-%s"%(ip_type,l4_port_type))
+                self.sendpkt_check_result("%d"%(port_value-1), "", queue_id, 0, "%s-%s"%(ip_type,l4_port_type))
+            else:
+                self.sendpkt_check_result("", "%d"%port_value, queue_id, 1, "%s-%s"%(ip_type,l4_port_type))
+                self.sendpkt_check_result("", "%d"%(port_value-1), queue_id, 0, "%s-%s"%(ip_type,l4_port_type))
+
+            # flush
+            self.dut.send_expect("flow flush 0", "testpmd> ")
+
+            if src_dst is 'src':
+                self.sendpkt_check_result("%d"%(port_value-1), "", queue_id, 0, "%s-%s"%(ip_type,l4_port_type))
+            else:
+                self.sendpkt_check_result("", "%d"%(port_value-1), queue_id, 0, "%s-%s"%(ip_type,l4_port_type))
+
+            self.compare_memory_rules(0)
+
+    def test_ipv4_udp_sport_only(self):
+        """
+        only supported by i40e
+        """
+        # ipv4-udp
+        # only src port
+        self.cloudfilter_test(
+            ip_type='ipv4', l4_port_type='udp', src_dst='src', port_value=156, queue_id=1)
+
+    def test_ipv4_udp_dport_only(self):
+        """
+        only supported by i40e
+        """
+        # ipv4-udp
+        # only dst port
+        self.cloudfilter_test(
+            ip_type='ipv4', l4_port_type='udp', src_dst='dst', port_value=156, queue_id=1)
+
+    def test_ipv4_tcp_sport_only(self):
+        """
+        only supported by i40e
+        """
+        # ipv4-tcp
+        # only src port
+        self.cloudfilter_test(
+            ip_type='ipv4', l4_port_type='tcp', src_dst='src', port_value=156, queue_id=1)
+
+    def test_ipv4_tcp_dport_only(self):
+        """
+        only supported by i40e
+        """
+        #ipv4-tcp
+        # only dst port
+        self.cloudfilter_test(
+            ip_type='ipv4', l4_port_type='tcp', src_dst='dst', port_value=156, queue_id=1)
+
+    def test_ipv4_sctp_sport_only(self):
+        """
+        only supported by i40e
+        """
+        # ipv4-sctp
+        # only src port
+        self.cloudfilter_test(
+            ip_type='ipv4', l4_port_type='sctp', src_dst='src', port_value=156, queue_id=1)
+
+    def test_ipv4_sctp_dport_only(self):
+        """
+        only supported by i40e
+        """
+        #ipv4-sctp
+        # only dst port
+        self.cloudfilter_test(
+            ip_type='ipv4', l4_port_type='sctp', src_dst='dst', port_value=156, queue_id=1)
+
+    def test_ipv6_udp_sport_only(self):
+        """
+        only supported by i40e
+        """
+        # ipv6-udp
+        # only src port
+        self.cloudfilter_test(
+            ip_type='ipv6', l4_port_type='udp', src_dst='src', port_value=156, queue_id=1)
+
+    def test_ipv6_udp_dport_only(self):
+        """
+        only supported by i40e
+        """
+        # ipv6-udp
+        # only dst port
+        self.cloudfilter_test(
+            ip_type='ipv6', l4_port_type='udp', src_dst='dst', port_value=156, queue_id=1)
+
+    def test_ipv6_tcp_sport_only(self):
+        """
+        only supported by i40e
+        """
+        # ipv6-tcp
+        # only src port
+        self.cloudfilter_test(
+            ip_type='ipv6', l4_port_type='tcp', src_dst='src', port_value=156, queue_id=1)
+
+    def test_ipv6_tcp_dport_only(self):
+        """
+        only supported by i40e
+        """
+        #ipv6-tcp
+        # only dst port
+        self.cloudfilter_test(
+            ip_type='ipv6', l4_port_type='tcp', src_dst='dst', port_value=156, queue_id=1)
+
+    def test_ipv6_sctp_sport_only(self):
+        """
+        only supported by i40e
+        """
+        # ipv6-sctp
+        # only src port
+        self.cloudfilter_test(
+            ip_type='ipv6', l4_port_type='sctp', src_dst='src', port_value=156, queue_id=1)
+
+    def test_ipv6_sctp_dport_only(self):
+        """
+        only supported by i40e
+        """
+        #ipv6-sctp
+        # only dst port
+        self.cloudfilter_test(
+            ip_type='ipv6', l4_port_type='sctp', src_dst='dst', port_value=156, queue_id=1)
+
+    def test_multi_rule(self):
+        """
+        only supported by i40e
+        """
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth / ipv4 / udp src is 11 / end actions pf / queue index 1 / end",
+            "created")
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth / ipv4 / tcp src is 22 / end actions pf / queue index 2 / end",
+            "created")
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth / ipv4 / sctp src is 33 / end actions pf / queue index 3 / end",
+            "created")
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth / ipv4 / udp dst is 44 / end actions pf / queue index 4 / end",
+            "created")
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth / ipv4 / tcp dst is 55 / end actions pf / queue index 5 / end",
+            "created")
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth / ipv4 / sctp dst is 66 / end actions pf / queue index 6 / end",
+            "created")
+
+        self.sendpkt_check_result("11", "", 1, 1, "ipv4-udp")
+        self.sendpkt_check_result("22", "", 2, 1, "ipv4-tcp")
+        self.sendpkt_check_result("33", "", 3, 1, "ipv4-sctp")
+        self.sendpkt_check_result("", "44", 4, 1, "ipv4-udp")
+        self.sendpkt_check_result("", "55", 5, 1, "ipv4-tcp")
+        self.sendpkt_check_result("", "66", 6, 1, "ipv4-sctp")
+
+        # destroy
+        self.dut.send_expect("flow destroy 0 rule 0", "testpmd> ")
+
+        self.sendpkt_check_result("11", "", 1, 0, "ipv4-udp")
+
+        self.compare_memory_rules(5)
+
+        # flush
+        self.dut.send_expect("flow flush 0", "testpmd> ")
+
+        self.sendpkt_check_result("22", "", 2, 0, "ipv4-tcp")
+
+        self.compare_memory_rules(0)
+
+    def test_negative(self):
+        """
+        only supported by i40e
+        """
+        # unsupported rules
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth / ipv4 / udp src is 156 dst is 156 / end actions pf / queue index 1 / end",
+            "error")
+
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth / ipv4 / udp src is 156 / end actions pf / queue index 1 / end",
+            "create")
+
+        # conflicted rules
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth / ipv4 / udp src is 156 / end actions pf / queue index 2 / end",
+            "error")
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth / ipv6 / udp src is 156 / end actions pf / queue index 2 / end",
+            "error")
+
+    def tear_down(self):
+        """
+        Run after each test case.
+        """
+        self.destroy_env()
+        self.dut.kill_all()
+
+    def tear_down_all(self):
+        """
+        Run after each test suite.
+        """
+        self.dut.kill_all()
-- 
2.17.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [dts] [PATCH v2 2/2] tests/TestSuite_cloud_filter_with_l4_port.py add test cases
  2020-08-17  8:34   ` [dts] [PATCH v2 2/2] tests/TestSuite_cloud_filter_with_l4_port.py add test cases Guinan Sun
@ 2020-08-18  1:59     ` Lin, Xueqin
  0 siblings, 0 replies; 14+ messages in thread
From: Lin, Xueqin @ 2020-08-18  1:59 UTC (permalink / raw)
  To: Sun, GuinanX, dts; +Cc: Sun, GuinanX

Some comment as below. 

Best regards,
Xueqin

> -----Original Message-----
> From: dts <dts-bounces@dpdk.org> On Behalf Of Guinan Sun
> Sent: Monday, August 17, 2020 4:34 PM
> To: dts@dpdk.org
> Cc: Sun, GuinanX <guinanx.sun@intel.com>
> Subject: [dts] [PATCH v2 2/2] tests/TestSuite_cloud_filter_with_l4_port.py
> add test cases
> 
> add test cases for the new cloud filter.
> 
> Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
> ---
>  tests/TestSuite_cloud_filter_with_l4_port.py | 400 +++++++++++++++++++
>  1 file changed, 400 insertions(+)
>  create mode 100644 tests/TestSuite_cloud_filter_with_l4_port.py
> 
> diff --git a/tests/TestSuite_cloud_filter_with_l4_port.py
> b/tests/TestSuite_cloud_filter_with_l4_port.py
> new file mode 100644
> index 0000000..37b646e
> --- /dev/null
> +++ b/tests/TestSuite_cloud_filter_with_l4_port.py
> @@ -0,0 +1,400 @@
> +# BSD LICENSE
> +#
> +# Copyright(c) 2020 Intel Corporation. All rights reserved.
> +# 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.
> +
> +"""
> +DPDK Test suite.
> +
> +Test the support of generic flow API by Poll Mode Drivers.
> +
> +"""
> +
> +import utils
> +import time
> +import re
> +
> +from test_case import TestCase
> +from pmd_output import PmdOutput
> +from settings import DRIVERS
> +from crb import Crb
> +from dut import Dut
> +import packet
> +from exception import VerifyFailure
> +import scapy.layers.inet
> +from scapy.utils import rdpcap
> +
> +MAX_QUEUE = 16
> +
> +class TestCloudFilterWithL4Port(TestCase):
> +
> +    def set_up_all(self):
> +        """
> +        Run at the start of each test suite.
> +        Generic filter Prerequistites
> +        """
> +        # Based on h/w type, choose how many ports to use
> +        self.dut_ports = self.dut.get_ports(self.nic)
> +        # Verify that enough ports are available
> +        self.verify(len(self.dut_ports) >= 1, "Insufficient ports")
> +        self.cores = "1S/8C/1T"
> +        self.pf_cores = "1S/8C/1T"
> +        self.pmdout = PmdOutput(self.dut)
> +
> +        localPort = self.tester.get_local_port(self.dut_ports[0])
> +        self.tester_itf = self.tester.get_interface(localPort)
> +        self.pf_interface = self.dut.ports_info[self.dut_ports[0]]['intf']
> +        self.pf_mac = self.dut.get_mac_address(0)
> +        self.pf_pci = self.dut.ports_info[self.dut_ports[0]]['pci']
> +        self.pkt_obj = packet.Packet()
> +
> +        self.verify(self.nic in ["fortville_eagle", "fortville_spirit", "carlsville",
> +                    "fortville_spirit_single", "fortpark_TLV",
> +                    "fortpark_BASE-T","fortville_25g"], "%s nic not
> + support fdir vlan filter" % self.nic)
Wrong for "not support fdir vlan filter"
> +
> +    def set_up(self):
> +        """
> +        Run before each test case.
> +        """
> +        self.dut.kill_all()
> +
> +        self.pmdout.start_testpmd("%s" % self.cores, "--rxq=%d --txq=%d --
> disable-rss" % (MAX_QUEUE, MAX_QUEUE), "-w %s --file-prefix=test1" %
> self.pf_pci)
> +        self.dut.send_expect("set fwd rxonly", "testpmd> ", 120)
> +        self.dut.send_expect("set promisc all off", "testpmd> ", 120)
> +        self.dut.send_expect("set verbose 1", "testpmd> ", 120)
> +        self.dut.send_expect("start", "testpmd> ", 120)
> +        time.sleep(2)
> +
> +    def destroy_env(self):
> +        """
> +        This is to stop testpmd.
> +        """
> +        self.dut.send_expect("quit", "# ")
> +        time.sleep(2)
> +
> +    def compare_memory_rules(self, expectedRules):
> +        """
> +        dump all flow rules that have been created in memory and compare
> that total rules number with the given expected number
> +        to see if they are equal, as to get your conclusion after you have
> deleted any flow rule entry.
> +        """
> +        outstring = self.dut.send_expect("flow list 0", "testpmd> ", 20)
> +        result_scanner = r'\d*.*?\d*.*?\d*.*?=>*'
> +        scanner = re.compile(result_scanner, re.DOTALL)
> +        m = scanner.findall(outstring)
> +        print("All flow entries are: ")
> +        for i in range(len(m)):
> +            print(m[i])
> +        print('Expected rules are: %d - actual are: %d' % (expectedRules, len(m)))
> +        self.verify(expectedRules == len(m), 'Total rules number
> + mismatched')
> +
> +    def verify_rulenum(self, rule_num):
> +        """
> +        Verify all the rules created.
> +        """
> +        # check if there are expected flow rules have been created
> +        self.compare_memory_rules(rule_num)
> +        # check if one rule destroied with success

destroyed

> +        self.dut.send_expect("flow destroy 0 rule 0", "testpmd> ")
> +        self.compare_memory_rules(rule_num - 1)
> +        # check if all flow rules have been removed with success
> +        self.dut.send_expect("flow flush 0", "testpmd> ")
> +        self.compare_memory_rules(0)
> +
> +    def sendpkt(self, pktstr, count=1):
> +        import sys
> +        py_version = sys.version
> +        if py_version.startswith('3.'):
> +            self.pkt_obj.pktgen.pkts.clear()
> +        else:
> +            del self.pkt_obj.pktgen.pkts[:]
> +        self.pkt_obj.append_pkt(pktstr)
> +        self.pkt_obj.send_pkt(self.tester, tx_port=self.tester_itf,
> + count=count)
> +
> +    def sendpkt_check_result(self, src_port, dst_port, queue, match,
> pctype=""):
> +        match_info = "/queue %d: " % queue
> +        # source port
> +        if src_port != "" and dst_port == "":
> +            if pctype == "ipv4-udp":
> +                self.sendpkt(pktstr='Ether()/IP()/UDP(sport=%s)' % src_port)
> +            elif pctype == "ipv4-tcp":
> +                self.sendpkt(pktstr='Ether()/IP()/TCP(sport=%s)' % src_port)
> +            elif pctype == "ipv4-sctp":
> +                self.sendpkt(pktstr='Ether()/IP()/SCTP(sport=%s)' % src_port)
> +            elif pctype == "ipv6-udp":
> +                self.sendpkt(pktstr='Ether()/IPv6()/UDP(sport=%s)' % src_port)
> +            elif pctype == "ipv6-tcp":
> +                self.sendpkt(pktstr='Ether()/IPv6()/TCP(sport=%s)' % src_port)
> +            elif pctype == "ipv6-sctp":
> +                self.sendpkt(pktstr='Ether()/IPv6()/SCTP(sport=%s)' % src_port)
> +        elif src_port == "" and dst_port != "":
> +            if pctype == "ipv4-udp":
> +                self.sendpkt(pktstr='Ether()/IP()/UDP(dport=%s)' % dst_port)
> +            elif pctype == "ipv4-tcp":
> +                self.sendpkt(pktstr='Ether()/IP()/TCP(dport=%s)' % dst_port)
> +            elif pctype == "ipv4-sctp":
> +                self.sendpkt(pktstr='Ether()/IP()/SCTP(dport=%s)' % dst_port)
> +            elif pctype == "ipv6-udp":
> +                self.sendpkt(pktstr='Ether()/IPv6()/UDP(dport=%s)' % dst_port)
> +            elif pctype == "ipv6-tcp":
> +                self.sendpkt(pktstr='Ether()/IPv6()/TCP(dport=%s)' % dst_port)
> +            elif pctype == "ipv6-sctp":
> +                self.sendpkt(pktstr='Ether()/IPv6()/SCTP(dport=%s)' % dst_port)
> +        elif src_port != "" and dst_port != "":
> +            if pctype == "ipv4-udp":
> +                self.sendpkt(pktstr='Ether()/IP()/UDP(sport=%s,
> + dport=%s)' % (src_port, dst_port))
> +
> +        out_pf = self.dut.get_session_output(timeout=2)
> +        print("out_pf is %s" % out_pf)
> +
> +        if match == 1:
> +            self.verify(match_info in out_pf, "the packet not match the expect
> queue %d." % queue)
> +        else:
> +            if match_info in out_pf:
> +                raise Exception("the packet should not match the queue
> + %d." % queue)
> +
> +    def cloudfilter_test(
> +            self, ip_type='ipv4', l4_port_type='udp', src_dst='src', port_value=156,
> queue_id=0):
> +
> +            # validate
> +            self.dut.send_expect(
> +                "flow validate 0 ingress pattern eth / %s / %s %s is %d / end actions
> pf / queue index %d / end"
> +                    % (ip_type, l4_port_type, src_dst, port_value, queue_id),
> +                "validated")
> +
> +            # create
> +            self.dut.send_expect(
> +                "flow create 0 ingress pattern eth / %s / %s %s is %d / end actions
> pf / queue index %d / end"
> +                    % (ip_type, l4_port_type, src_dst, port_value, queue_id),
> +                "created")
> +
> +            # list
> +            self.compare_memory_rules(1)
> +
> +            if src_dst is 'src':
> +                self.sendpkt_check_result("%d"%port_value, "", queue_id, 1, "%s-
> %s"%(ip_type,l4_port_type))
> +                self.sendpkt_check_result("%d"%(port_value-1), "", queue_id, 0,
> "%s-%s"%(ip_type,l4_port_type))
> +            else:
> +                self.sendpkt_check_result("", "%d"%port_value, queue_id, 1, "%s-
> %s"%(ip_type,l4_port_type))
> +                self.sendpkt_check_result("", "%d"%(port_value-1),
> + queue_id, 0, "%s-%s"%(ip_type,l4_port_type))
> +
> +            # flush
> +            self.dut.send_expect("flow flush 0", "testpmd> ")
> +
> +            if src_dst is 'src':
> +                self.sendpkt_check_result("%d"%(port_value-1), "", queue_id, 0,
> "%s-%s"%(ip_type,l4_port_type))
> +            else:
> +                self.sendpkt_check_result("", "%d"%(port_value-1),
> + queue_id, 0, "%s-%s"%(ip_type,l4_port_type))
> +
> +            self.compare_memory_rules(0)
> +
> +    def test_ipv4_udp_sport_only(self):
> +        """
> +        only supported by i40e
> +        """
Should not have the sentence, above have check the NIC type,  same as below. 
> +        # ipv4-udp
> +        # only src port
> +        self.cloudfilter_test(
> +            ip_type='ipv4', l4_port_type='udp', src_dst='src',
> + port_value=156, queue_id=1)
> +
> +    def test_ipv4_udp_dport_only(self):
> +        """
> +        only supported by i40e
> +        """
> +        # ipv4-udp
> +        # only dst port
> +        self.cloudfilter_test(
> +            ip_type='ipv4', l4_port_type='udp', src_dst='dst',
> + port_value=156, queue_id=1)
> +
> +    def test_ipv4_tcp_sport_only(self):
> +        """
> +        only supported by i40e
> +        """
> +        # ipv4-tcp
> +        # only src port
> +        self.cloudfilter_test(
> +            ip_type='ipv4', l4_port_type='tcp', src_dst='src',
> + port_value=156, queue_id=1)
> +
> +    def test_ipv4_tcp_dport_only(self):
> +        """
> +        only supported by i40e
> +        """
> +        #ipv4-tcp
> +        # only dst port
> +        self.cloudfilter_test(
> +            ip_type='ipv4', l4_port_type='tcp', src_dst='dst',
> + port_value=156, queue_id=1)
> +
> +    def test_ipv4_sctp_sport_only(self):
> +        """
> +        only supported by i40e
> +        """
> +        # ipv4-sctp
> +        # only src port
> +        self.cloudfilter_test(
> +            ip_type='ipv4', l4_port_type='sctp', src_dst='src',
> + port_value=156, queue_id=1)
> +
> +    def test_ipv4_sctp_dport_only(self):
> +        """
> +        only supported by i40e
> +        """
> +        #ipv4-sctp
> +        # only dst port
> +        self.cloudfilter_test(
> +            ip_type='ipv4', l4_port_type='sctp', src_dst='dst',
> + port_value=156, queue_id=1)
> +
> +    def test_ipv6_udp_sport_only(self):
> +        """
> +        only supported by i40e
> +        """
> +        # ipv6-udp
> +        # only src port
> +        self.cloudfilter_test(
> +            ip_type='ipv6', l4_port_type='udp', src_dst='src',
> + port_value=156, queue_id=1)
> +
> +    def test_ipv6_udp_dport_only(self):
> +        """
> +        only supported by i40e
> +        """
> +        # ipv6-udp
> +        # only dst port
> +        self.cloudfilter_test(
> +            ip_type='ipv6', l4_port_type='udp', src_dst='dst',
> + port_value=156, queue_id=1)
> +
> +    def test_ipv6_tcp_sport_only(self):
> +        """
> +        only supported by i40e
> +        """
> +        # ipv6-tcp
> +        # only src port
> +        self.cloudfilter_test(
> +            ip_type='ipv6', l4_port_type='tcp', src_dst='src',
> + port_value=156, queue_id=1)
> +
> +    def test_ipv6_tcp_dport_only(self):
> +        """
> +        only supported by i40e
> +        """
> +        #ipv6-tcp
> +        # only dst port
> +        self.cloudfilter_test(
> +            ip_type='ipv6', l4_port_type='tcp', src_dst='dst',
> + port_value=156, queue_id=1)
> +
> +    def test_ipv6_sctp_sport_only(self):
> +        """
> +        only supported by i40e
> +        """
> +        # ipv6-sctp
> +        # only src port
> +        self.cloudfilter_test(
> +            ip_type='ipv6', l4_port_type='sctp', src_dst='src',
> + port_value=156, queue_id=1)
> +
> +    def test_ipv6_sctp_dport_only(self):
> +        """
> +        only supported by i40e
> +        """
> +        #ipv6-sctp
> +        # only dst port
> +        self.cloudfilter_test(
> +            ip_type='ipv6', l4_port_type='sctp', src_dst='dst',
> + port_value=156, queue_id=1)
> +
> +    def test_multi_rule(self):
> +        """
> +        only supported by i40e
> +        """
> +        self.dut.send_expect(
> +            "flow create 0 ingress pattern eth / ipv4 / udp src is 11 / end actions
> pf / queue index 1 / end",
> +            "created")
> +        self.dut.send_expect(
> +            "flow create 0 ingress pattern eth / ipv4 / tcp src is 22 / end actions
> pf / queue index 2 / end",
> +            "created")
> +        self.dut.send_expect(
> +            "flow create 0 ingress pattern eth / ipv4 / sctp src is 33 / end actions
> pf / queue index 3 / end",
> +            "created")
> +        self.dut.send_expect(
> +            "flow create 0 ingress pattern eth / ipv4 / udp dst is 44 / end actions
> pf / queue index 4 / end",
> +            "created")
> +        self.dut.send_expect(
> +            "flow create 0 ingress pattern eth / ipv4 / tcp dst is 55 / end actions
> pf / queue index 5 / end",
> +            "created")
> +        self.dut.send_expect(
> +            "flow create 0 ingress pattern eth / ipv4 / sctp dst is 66 / end actions
> pf / queue index 6 / end",
> +            "created")
> +
> +        self.sendpkt_check_result("11", "", 1, 1, "ipv4-udp")
> +        self.sendpkt_check_result("22", "", 2, 1, "ipv4-tcp")
> +        self.sendpkt_check_result("33", "", 3, 1, "ipv4-sctp")
> +        self.sendpkt_check_result("", "44", 4, 1, "ipv4-udp")
> +        self.sendpkt_check_result("", "55", 5, 1, "ipv4-tcp")
> +        self.sendpkt_check_result("", "66", 6, 1, "ipv4-sctp")
> +
> +        # destroy
> +        self.dut.send_expect("flow destroy 0 rule 0", "testpmd> ")
> +
> +        self.sendpkt_check_result("11", "", 1, 0, "ipv4-udp")
> +
> +        self.compare_memory_rules(5)
> +
> +        # flush
> +        self.dut.send_expect("flow flush 0", "testpmd> ")
> +
> +        self.sendpkt_check_result("22", "", 2, 0, "ipv4-tcp")
> +
> +        self.compare_memory_rules(0)
> +
> +    def test_negative(self):
> +        """
> +        only supported by i40e
> +        """
> +        # unsupported rules
> +        self.dut.send_expect(
> +            "flow create 0 ingress pattern eth / ipv4 / udp src is 156 dst is 156 /
> end actions pf / queue index 1 / end",
> +            "error")
> +
> +        self.dut.send_expect(
> +            "flow create 0 ingress pattern eth / ipv4 / udp src is 156 / end actions
> pf / queue index 1 / end",
> +            "create")
> +
> +        # conflicted rules
> +        self.dut.send_expect(
> +            "flow create 0 ingress pattern eth / ipv4 / udp src is 156 / end actions
> pf / queue index 2 / end",
> +            "error")
> +        self.dut.send_expect(
> +            "flow create 0 ingress pattern eth / ipv6 / udp src is 156 / end actions
> pf / queue index 2 / end",
> +            "error")
> +
> +    def tear_down(self):
> +        """
> +        Run after each test case.
> +        """
> +        self.destroy_env()
> +        self.dut.kill_all()
> +
> +    def tear_down_all(self):
> +        """
> +        Run after each test suite.
> +        """
> +        self.dut.kill_all()
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [dts] [PATCH v2 1/2] test_plans: add cloud_filter_with_l4_port_test_plan.rst
  2020-08-17  8:34 ` [dts] [PATCH v2 " Guinan Sun
  2020-08-17  8:34   ` [dts] [PATCH v2 2/2] tests/TestSuite_cloud_filter_with_l4_port.py add test cases Guinan Sun
@ 2020-08-18  2:08   ` Lin, Xueqin
  1 sibling, 0 replies; 14+ messages in thread
From: Lin, Xueqin @ 2020-08-18  2:08 UTC (permalink / raw)
  To: Sun, GuinanX, dts; +Cc: Sun, GuinanX

Verify there are one rule.
there are ->there is

Best regards,
Xueqin

> -----Original Message-----
> From: dts <dts-bounces@dpdk.org> On Behalf Of Guinan Sun
> Sent: Monday, August 17, 2020 4:34 PM
> To: dts@dpdk.org
> Cc: Sun, GuinanX <guinanx.sun@intel.com>
> Subject: [dts] [PATCH v2 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..beef55c
> --- /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 are one rule.
there are ->there is 
> +
> +        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 are 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 are 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 are 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 are 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 are 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 are 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 are 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 are 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 are 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 are 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 are 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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [dts] [PATCH v3 1/2] test_plans: add cloud_filter_with_l4_port_test_plan.rst
  2020-08-17  5:54 [dts] [PATCH v1 1/2] test_plans: add cloud_filter_with_l4_port_test_plan.rst Guinan Sun
                   ` (2 preceding siblings ...)
  2020-08-17  8:34 ` [dts] [PATCH v2 " Guinan Sun
@ 2020-08-18  3:07 ` Guinan Sun
  2020-08-18  3:07   ` [dts] [PATCH v3 2/2] tests/TestSuite_cloud_filter_with_l4_port.py add test cases Guinan Sun
                     ` (2 more replies)
  3 siblings, 3 replies; 14+ messages in thread
From: Guinan Sun @ 2020-08-18  3:07 UTC (permalink / raw)
  To: dts; +Cc: Guinan Sun

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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [dts] [PATCH v3 2/2] tests/TestSuite_cloud_filter_with_l4_port.py add test cases
  2020-08-18  3:07 ` [dts] [PATCH v3 " Guinan Sun
@ 2020-08-18  3:07   ` Guinan Sun
  2020-08-18  5:11     ` Lin, Xueqin
                       ` (2 more replies)
  2020-08-18  5:07   ` [dts] [PATCH v3 1/2] test_plans: add cloud_filter_with_l4_port_test_plan.rst Lin, Xueqin
  2020-08-21  3:28   ` Tu, Lijuan
  2 siblings, 3 replies; 14+ messages in thread
From: Guinan Sun @ 2020-08-18  3:07 UTC (permalink / raw)
  To: dts; +Cc: Guinan Sun

add test cases for the new cloud filter.

Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
---
 tests/TestSuite_cloud_filter_with_l4_port.py | 358 +++++++++++++++++++
 1 file changed, 358 insertions(+)
 create mode 100644 tests/TestSuite_cloud_filter_with_l4_port.py

diff --git a/tests/TestSuite_cloud_filter_with_l4_port.py b/tests/TestSuite_cloud_filter_with_l4_port.py
new file mode 100644
index 0000000..005983d
--- /dev/null
+++ b/tests/TestSuite_cloud_filter_with_l4_port.py
@@ -0,0 +1,358 @@
+# BSD LICENSE
+#
+# Copyright(c) 2020 Intel Corporation. All rights reserved.
+# 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.
+
+"""
+DPDK Test suite.
+
+Test the support of generic flow API by Poll Mode Drivers.
+
+"""
+
+import utils
+import time
+import re
+
+from test_case import TestCase
+from pmd_output import PmdOutput
+from settings import DRIVERS
+from crb import Crb
+from dut import Dut
+import packet
+from exception import VerifyFailure
+import scapy.layers.inet
+from scapy.utils import rdpcap
+
+MAX_QUEUE = 16
+
+class TestCloudFilterWithL4Port(TestCase):
+
+    def set_up_all(self):
+        """
+        Run at the start of each test suite.
+        Generic filter Prerequistites
+        """
+        # Based on h/w type, choose how many ports to use
+        self.dut_ports = self.dut.get_ports(self.nic)
+        # Verify that enough ports are available
+        self.verify(len(self.dut_ports) >= 1, "Insufficient ports")
+        self.cores = "1S/8C/1T"
+        self.pf_cores = "1S/8C/1T"
+        self.pmdout = PmdOutput(self.dut)
+
+        localPort = self.tester.get_local_port(self.dut_ports[0])
+        self.tester_itf = self.tester.get_interface(localPort)
+        self.pf_interface = self.dut.ports_info[self.dut_ports[0]]['intf']
+        self.pf_mac = self.dut.get_mac_address(0)
+        self.pf_pci = self.dut.ports_info[self.dut_ports[0]]['pci']
+        self.pkt_obj = packet.Packet()
+
+        self.verify(self.nic in ["fortville_eagle", "fortville_spirit", "carlsville",
+                    "fortville_spirit_single", "fortpark_TLV",
+                    "fortpark_BASE-T","fortville_25g"], "%s nic not support cloud filter" % self.nic)
+
+    def set_up(self):
+        """
+        Run before each test case.
+        """
+        self.dut.kill_all()
+
+        self.pmdout.start_testpmd("%s" % self.cores, "--rxq=%d --txq=%d --disable-rss" % (MAX_QUEUE, MAX_QUEUE), "-w %s --file-prefix=test1" % self.pf_pci)
+        self.dut.send_expect("set fwd rxonly", "testpmd> ", 120)
+        self.dut.send_expect("set promisc all off", "testpmd> ", 120)
+        self.dut.send_expect("set verbose 1", "testpmd> ", 120)
+        self.dut.send_expect("start", "testpmd> ", 120)
+        time.sleep(2)
+
+    def destroy_env(self):
+        """
+        This is to stop testpmd.
+        """
+        self.dut.send_expect("quit", "# ")
+        time.sleep(2)
+
+    def compare_memory_rules(self, expectedRules):
+        """
+        dump all flow rules that have been created in memory and compare that total rules number with the given expected number
+        to see if they are equal, as to get your conclusion after you have deleted any flow rule entry.
+        """
+        outstring = self.dut.send_expect("flow list 0", "testpmd> ", 20)
+        result_scanner = r'\d*.*?\d*.*?\d*.*?=>*'
+        scanner = re.compile(result_scanner, re.DOTALL)
+        m = scanner.findall(outstring)
+        print("All flow entries are: ")
+        for i in range(len(m)):
+            print(m[i])
+        print('Expected rules are: %d - actual are: %d' % (expectedRules, len(m)))
+        self.verify(expectedRules == len(m), 'Total rules number mismatched')
+
+    def verify_rulenum(self, rule_num):
+        """
+        Verify all the rules created.
+        """
+        # check if there are expected flow rules have been created
+        self.compare_memory_rules(rule_num)
+        # check if one rule destroyed with success
+        self.dut.send_expect("flow destroy 0 rule 0", "testpmd> ")
+        self.compare_memory_rules(rule_num - 1)
+        # check if all flow rules have been removed with success
+        self.dut.send_expect("flow flush 0", "testpmd> ")
+        self.compare_memory_rules(0)
+
+    def sendpkt(self, pktstr, count=1):
+        import sys
+        py_version = sys.version
+        if py_version.startswith('3.'):
+            self.pkt_obj.pktgen.pkts.clear()
+        else:
+            del self.pkt_obj.pktgen.pkts[:]
+        self.pkt_obj.append_pkt(pktstr)
+        self.pkt_obj.send_pkt(self.tester, tx_port=self.tester_itf, count=count)
+
+    def sendpkt_check_result(self, src_port, dst_port, queue, match, pctype=""):
+        match_info = "/queue %d: " % queue
+        # source port
+        if src_port != "" and dst_port == "":
+            if pctype == "ipv4-udp":
+                self.sendpkt(pktstr='Ether()/IP()/UDP(sport=%s)' % src_port)
+            elif pctype == "ipv4-tcp":
+                self.sendpkt(pktstr='Ether()/IP()/TCP(sport=%s)' % src_port)
+            elif pctype == "ipv4-sctp":
+                self.sendpkt(pktstr='Ether()/IP()/SCTP(sport=%s)' % src_port)
+            elif pctype == "ipv6-udp":
+                self.sendpkt(pktstr='Ether()/IPv6()/UDP(sport=%s)' % src_port)
+            elif pctype == "ipv6-tcp":
+                self.sendpkt(pktstr='Ether()/IPv6()/TCP(sport=%s)' % src_port)
+            elif pctype == "ipv6-sctp":
+                self.sendpkt(pktstr='Ether()/IPv6()/SCTP(sport=%s)' % src_port)
+        elif src_port == "" and dst_port != "":
+            if pctype == "ipv4-udp":
+                self.sendpkt(pktstr='Ether()/IP()/UDP(dport=%s)' % dst_port)
+            elif pctype == "ipv4-tcp":
+                self.sendpkt(pktstr='Ether()/IP()/TCP(dport=%s)' % dst_port)
+            elif pctype == "ipv4-sctp":
+                self.sendpkt(pktstr='Ether()/IP()/SCTP(dport=%s)' % dst_port)
+            elif pctype == "ipv6-udp":
+                self.sendpkt(pktstr='Ether()/IPv6()/UDP(dport=%s)' % dst_port)
+            elif pctype == "ipv6-tcp":
+                self.sendpkt(pktstr='Ether()/IPv6()/TCP(dport=%s)' % dst_port)
+            elif pctype == "ipv6-sctp":
+                self.sendpkt(pktstr='Ether()/IPv6()/SCTP(dport=%s)' % dst_port)
+        elif src_port != "" and dst_port != "":
+            if pctype == "ipv4-udp":
+                self.sendpkt(pktstr='Ether()/IP()/UDP(sport=%s, dport=%s)' % (src_port, dst_port))
+
+        out_pf = self.dut.get_session_output(timeout=2)
+        print("out_pf is %s" % out_pf)
+
+        if match == 1:
+            self.verify(match_info in out_pf, "the packet not match the expect queue %d." % queue)
+        else:
+            if match_info in out_pf:
+                raise Exception("the packet should not match the queue %d." % queue)
+
+    def cloudfilter_test(
+            self, ip_type='ipv4', l4_port_type='udp', src_dst='src', port_value=156, queue_id=0):
+
+            # validate
+            self.dut.send_expect(
+                "flow validate 0 ingress pattern eth / %s / %s %s is %d / end actions pf / queue index %d / end"
+                    % (ip_type, l4_port_type, src_dst, port_value, queue_id),
+                "validated")
+
+            # create
+            self.dut.send_expect(
+                "flow create 0 ingress pattern eth / %s / %s %s is %d / end actions pf / queue index %d / end"
+                    % (ip_type, l4_port_type, src_dst, port_value, queue_id),
+                "created")
+
+            # list
+            self.compare_memory_rules(1)
+
+            if src_dst is 'src':
+                self.sendpkt_check_result("%d"%port_value, "", queue_id, 1, "%s-%s"%(ip_type,l4_port_type))
+                self.sendpkt_check_result("%d"%(port_value-1), "", queue_id, 0, "%s-%s"%(ip_type,l4_port_type))
+            else:
+                self.sendpkt_check_result("", "%d"%port_value, queue_id, 1, "%s-%s"%(ip_type,l4_port_type))
+                self.sendpkt_check_result("", "%d"%(port_value-1), queue_id, 0, "%s-%s"%(ip_type,l4_port_type))
+
+            # flush
+            self.dut.send_expect("flow flush 0", "testpmd> ")
+
+            if src_dst is 'src':
+                self.sendpkt_check_result("%d"%(port_value-1), "", queue_id, 0, "%s-%s"%(ip_type,l4_port_type))
+            else:
+                self.sendpkt_check_result("", "%d"%(port_value-1), queue_id, 0, "%s-%s"%(ip_type,l4_port_type))
+
+            self.compare_memory_rules(0)
+
+    def test_ipv4_udp_sport_only(self):
+        # ipv4-udp
+        # only src port
+        self.cloudfilter_test(
+            ip_type='ipv4', l4_port_type='udp', src_dst='src', port_value=156, queue_id=1)
+
+    def test_ipv4_udp_dport_only(self):
+        # ipv4-udp
+        # only dst port
+        self.cloudfilter_test(
+            ip_type='ipv4', l4_port_type='udp', src_dst='dst', port_value=156, queue_id=1)
+
+    def test_ipv4_tcp_sport_only(self):
+        # ipv4-tcp
+        # only src port
+        self.cloudfilter_test(
+            ip_type='ipv4', l4_port_type='tcp', src_dst='src', port_value=156, queue_id=1)
+
+    def test_ipv4_tcp_dport_only(self):
+        #ipv4-tcp
+        # only dst port
+        self.cloudfilter_test(
+            ip_type='ipv4', l4_port_type='tcp', src_dst='dst', port_value=156, queue_id=1)
+
+    def test_ipv4_sctp_sport_only(self):
+        # ipv4-sctp
+        # only src port
+        self.cloudfilter_test(
+            ip_type='ipv4', l4_port_type='sctp', src_dst='src', port_value=156, queue_id=1)
+
+    def test_ipv4_sctp_dport_only(self):
+        #ipv4-sctp
+        # only dst port
+        self.cloudfilter_test(
+            ip_type='ipv4', l4_port_type='sctp', src_dst='dst', port_value=156, queue_id=1)
+
+    def test_ipv6_udp_sport_only(self):
+        # ipv6-udp
+        # only src port
+        self.cloudfilter_test(
+            ip_type='ipv6', l4_port_type='udp', src_dst='src', port_value=156, queue_id=1)
+
+    def test_ipv6_udp_dport_only(self):
+        # ipv6-udp
+        # only dst port
+        self.cloudfilter_test(
+            ip_type='ipv6', l4_port_type='udp', src_dst='dst', port_value=156, queue_id=1)
+
+    def test_ipv6_tcp_sport_only(self):
+        # ipv6-tcp
+        # only src port
+        self.cloudfilter_test(
+            ip_type='ipv6', l4_port_type='tcp', src_dst='src', port_value=156, queue_id=1)
+
+    def test_ipv6_tcp_dport_only(self):
+        #ipv6-tcp
+        # only dst port
+        self.cloudfilter_test(
+            ip_type='ipv6', l4_port_type='tcp', src_dst='dst', port_value=156, queue_id=1)
+
+    def test_ipv6_sctp_sport_only(self):
+        # ipv6-sctp
+        # only src port
+        self.cloudfilter_test(
+            ip_type='ipv6', l4_port_type='sctp', src_dst='src', port_value=156, queue_id=1)
+
+    def test_ipv6_sctp_dport_only(self):
+        #ipv6-sctp
+        # only dst port
+        self.cloudfilter_test(
+            ip_type='ipv6', l4_port_type='sctp', src_dst='dst', port_value=156, queue_id=1)
+
+    def test_multi_rule(self):
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth / ipv4 / udp src is 11 / end actions pf / queue index 1 / end",
+            "created")
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth / ipv4 / tcp src is 22 / end actions pf / queue index 2 / end",
+            "created")
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth / ipv4 / sctp src is 33 / end actions pf / queue index 3 / end",
+            "created")
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth / ipv4 / udp dst is 44 / end actions pf / queue index 4 / end",
+            "created")
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth / ipv4 / tcp dst is 55 / end actions pf / queue index 5 / end",
+            "created")
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth / ipv4 / sctp dst is 66 / end actions pf / queue index 6 / end",
+            "created")
+
+        self.sendpkt_check_result("11", "", 1, 1, "ipv4-udp")
+        self.sendpkt_check_result("22", "", 2, 1, "ipv4-tcp")
+        self.sendpkt_check_result("33", "", 3, 1, "ipv4-sctp")
+        self.sendpkt_check_result("", "44", 4, 1, "ipv4-udp")
+        self.sendpkt_check_result("", "55", 5, 1, "ipv4-tcp")
+        self.sendpkt_check_result("", "66", 6, 1, "ipv4-sctp")
+
+        # destroy
+        self.dut.send_expect("flow destroy 0 rule 0", "testpmd> ")
+
+        self.sendpkt_check_result("11", "", 1, 0, "ipv4-udp")
+
+        self.compare_memory_rules(5)
+
+        # flush
+        self.dut.send_expect("flow flush 0", "testpmd> ")
+
+        self.sendpkt_check_result("22", "", 2, 0, "ipv4-tcp")
+
+        self.compare_memory_rules(0)
+
+    def test_negative(self):
+        # unsupported rules
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth / ipv4 / udp src is 156 dst is 156 / end actions pf / queue index 1 / end",
+            "error")
+
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth / ipv4 / udp src is 156 / end actions pf / queue index 1 / end",
+            "create")
+
+        # conflicted rules
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth / ipv4 / udp src is 156 / end actions pf / queue index 2 / end",
+            "error")
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth / ipv6 / udp src is 156 / end actions pf / queue index 2 / end",
+            "error")
+
+    def tear_down(self):
+        """
+        Run after each test case.
+        """
+        self.destroy_env()
+        self.dut.kill_all()
+
+    def tear_down_all(self):
+        """
+        Run after each test suite.
+        """
+        self.dut.kill_all()
-- 
2.17.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [dts] [PATCH v3 1/2] test_plans: add cloud_filter_with_l4_port_test_plan.rst
  2020-08-18  3:07 ` [dts] [PATCH v3 " Guinan Sun
  2020-08-18  3:07   ` [dts] [PATCH v3 2/2] tests/TestSuite_cloud_filter_with_l4_port.py add test cases Guinan Sun
@ 2020-08-18  5:07   ` Lin, Xueqin
  2020-08-21  3:28   ` Tu, Lijuan
  2 siblings, 0 replies; 14+ messages in thread
From: Lin, Xueqin @ 2020-08-18  5:07 UTC (permalink / raw)
  To: Sun, GuinanX, dts; +Cc: Sun, GuinanX

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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [dts] [PATCH v3 2/2] tests/TestSuite_cloud_filter_with_l4_port.py add test cases
  2020-08-18  3:07   ` [dts] [PATCH v3 2/2] tests/TestSuite_cloud_filter_with_l4_port.py add test cases Guinan Sun
@ 2020-08-18  5:11     ` Lin, Xueqin
  2020-08-18  8:38     ` Chen, LingliX
  2020-08-21  3:31     ` Tu, Lijuan
  2 siblings, 0 replies; 14+ messages in thread
From: Lin, Xueqin @ 2020-08-18  5:11 UTC (permalink / raw)
  To: Sun, GuinanX, dts; +Cc: Sun, GuinanX

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 2/2] tests/TestSuite_cloud_filter_with_l4_port.py add
> test cases
> 
> add test cases for the new cloud filter.
> 
> Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
> ---
>  tests/TestSuite_cloud_filter_with_l4_port.py | 358 +++++++++++++++++++
>  1 file changed, 358 insertions(+)
>  create mode 100644 tests/TestSuite_cloud_filter_with_l4_port.py
> 
> diff --git a/tests/TestSuite_cloud_filter_with_l4_port.py
> b/tests/TestSuite_cloud_filter_with_l4_port.py
> new file mode 100644
> index 0000000..005983d
> --- /dev/null
> +++ b/tests/TestSuite_cloud_filter_with_l4_port.py
> @@ -0,0 +1,358 @@
> +# BSD LICENSE
> +#
> +# Copyright(c) 2020 Intel Corporation. All rights reserved.
> +# 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.
> +
> +"""
> +DPDK Test suite.
> +
> +Test the support of generic flow API by Poll Mode Drivers.
> +
> +"""
> +
> +import utils
> +import time
> +import re
> +
> +from test_case import TestCase
> +from pmd_output import PmdOutput
> +from settings import DRIVERS
> +from crb import Crb
> +from dut import Dut
> +import packet
> +from exception import VerifyFailure
> +import scapy.layers.inet
> +from scapy.utils import rdpcap
> +
> +MAX_QUEUE = 16
> +
> +class TestCloudFilterWithL4Port(TestCase):
> +
> +    def set_up_all(self):
> +        """
> +        Run at the start of each test suite.
> +        Generic filter Prerequistites
> +        """
> +        # Based on h/w type, choose how many ports to use
> +        self.dut_ports = self.dut.get_ports(self.nic)
> +        # Verify that enough ports are available
> +        self.verify(len(self.dut_ports) >= 1, "Insufficient ports")
> +        self.cores = "1S/8C/1T"
> +        self.pf_cores = "1S/8C/1T"
> +        self.pmdout = PmdOutput(self.dut)
> +
> +        localPort = self.tester.get_local_port(self.dut_ports[0])
> +        self.tester_itf = self.tester.get_interface(localPort)
> +        self.pf_interface = self.dut.ports_info[self.dut_ports[0]]['intf']
> +        self.pf_mac = self.dut.get_mac_address(0)
> +        self.pf_pci = self.dut.ports_info[self.dut_ports[0]]['pci']
> +        self.pkt_obj = packet.Packet()
> +
> +        self.verify(self.nic in ["fortville_eagle", "fortville_spirit", "carlsville",
> +                    "fortville_spirit_single", "fortpark_TLV",
> +                    "fortpark_BASE-T","fortville_25g"], "%s nic not
> + support cloud filter" % self.nic)
> +
> +    def set_up(self):
> +        """
> +        Run before each test case.
> +        """
> +        self.dut.kill_all()
> +
> +        self.pmdout.start_testpmd("%s" % self.cores, "--rxq=%d --txq=%d --
> disable-rss" % (MAX_QUEUE, MAX_QUEUE), "-w %s --file-prefix=test1" %
> self.pf_pci)
> +        self.dut.send_expect("set fwd rxonly", "testpmd> ", 120)
> +        self.dut.send_expect("set promisc all off", "testpmd> ", 120)
> +        self.dut.send_expect("set verbose 1", "testpmd> ", 120)
> +        self.dut.send_expect("start", "testpmd> ", 120)
> +        time.sleep(2)
> +
> +    def destroy_env(self):
> +        """
> +        This is to stop testpmd.
> +        """
> +        self.dut.send_expect("quit", "# ")
> +        time.sleep(2)
> +
> +    def compare_memory_rules(self, expectedRules):
> +        """
> +        dump all flow rules that have been created in memory and compare that
> total rules number with the given expected number
> +        to see if they are equal, as to get your conclusion after you have deleted
> any flow rule entry.
> +        """
> +        outstring = self.dut.send_expect("flow list 0", "testpmd> ", 20)
> +        result_scanner = r'\d*.*?\d*.*?\d*.*?=>*'
> +        scanner = re.compile(result_scanner, re.DOTALL)
> +        m = scanner.findall(outstring)
> +        print("All flow entries are: ")
> +        for i in range(len(m)):
> +            print(m[i])
> +        print('Expected rules are: %d - actual are: %d' % (expectedRules, len(m)))
> +        self.verify(expectedRules == len(m), 'Total rules number
> + mismatched')
> +
> +    def verify_rulenum(self, rule_num):
> +        """
> +        Verify all the rules created.
> +        """
> +        # check if there are expected flow rules have been created
> +        self.compare_memory_rules(rule_num)
> +        # check if one rule destroyed with success
> +        self.dut.send_expect("flow destroy 0 rule 0", "testpmd> ")
> +        self.compare_memory_rules(rule_num - 1)
> +        # check if all flow rules have been removed with success
> +        self.dut.send_expect("flow flush 0", "testpmd> ")
> +        self.compare_memory_rules(0)
> +
> +    def sendpkt(self, pktstr, count=1):
> +        import sys
> +        py_version = sys.version
> +        if py_version.startswith('3.'):
> +            self.pkt_obj.pktgen.pkts.clear()
> +        else:
> +            del self.pkt_obj.pktgen.pkts[:]
> +        self.pkt_obj.append_pkt(pktstr)
> +        self.pkt_obj.send_pkt(self.tester, tx_port=self.tester_itf,
> + count=count)
> +
> +    def sendpkt_check_result(self, src_port, dst_port, queue, match, pctype=""):
> +        match_info = "/queue %d: " % queue
> +        # source port
> +        if src_port != "" and dst_port == "":
> +            if pctype == "ipv4-udp":
> +                self.sendpkt(pktstr='Ether()/IP()/UDP(sport=%s)' % src_port)
> +            elif pctype == "ipv4-tcp":
> +                self.sendpkt(pktstr='Ether()/IP()/TCP(sport=%s)' % src_port)
> +            elif pctype == "ipv4-sctp":
> +                self.sendpkt(pktstr='Ether()/IP()/SCTP(sport=%s)' % src_port)
> +            elif pctype == "ipv6-udp":
> +                self.sendpkt(pktstr='Ether()/IPv6()/UDP(sport=%s)' % src_port)
> +            elif pctype == "ipv6-tcp":
> +                self.sendpkt(pktstr='Ether()/IPv6()/TCP(sport=%s)' % src_port)
> +            elif pctype == "ipv6-sctp":
> +                self.sendpkt(pktstr='Ether()/IPv6()/SCTP(sport=%s)' % src_port)
> +        elif src_port == "" and dst_port != "":
> +            if pctype == "ipv4-udp":
> +                self.sendpkt(pktstr='Ether()/IP()/UDP(dport=%s)' % dst_port)
> +            elif pctype == "ipv4-tcp":
> +                self.sendpkt(pktstr='Ether()/IP()/TCP(dport=%s)' % dst_port)
> +            elif pctype == "ipv4-sctp":
> +                self.sendpkt(pktstr='Ether()/IP()/SCTP(dport=%s)' % dst_port)
> +            elif pctype == "ipv6-udp":
> +                self.sendpkt(pktstr='Ether()/IPv6()/UDP(dport=%s)' % dst_port)
> +            elif pctype == "ipv6-tcp":
> +                self.sendpkt(pktstr='Ether()/IPv6()/TCP(dport=%s)' % dst_port)
> +            elif pctype == "ipv6-sctp":
> +                self.sendpkt(pktstr='Ether()/IPv6()/SCTP(dport=%s)' % dst_port)
> +        elif src_port != "" and dst_port != "":
> +            if pctype == "ipv4-udp":
> +                self.sendpkt(pktstr='Ether()/IP()/UDP(sport=%s,
> + dport=%s)' % (src_port, dst_port))
> +
> +        out_pf = self.dut.get_session_output(timeout=2)
> +        print("out_pf is %s" % out_pf)
> +
> +        if match == 1:
> +            self.verify(match_info in out_pf, "the packet not match the expect
> queue %d." % queue)
> +        else:
> +            if match_info in out_pf:
> +                raise Exception("the packet should not match the queue
> + %d." % queue)
> +
> +    def cloudfilter_test(
> +            self, ip_type='ipv4', l4_port_type='udp', src_dst='src', port_value=156,
> queue_id=0):
> +
> +            # validate
> +            self.dut.send_expect(
> +                "flow validate 0 ingress pattern eth / %s / %s %s is %d / end actions
> pf / queue index %d / end"
> +                    % (ip_type, l4_port_type, src_dst, port_value, queue_id),
> +                "validated")
> +
> +            # create
> +            self.dut.send_expect(
> +                "flow create 0 ingress pattern eth / %s / %s %s is %d / end actions pf
> / queue index %d / end"
> +                    % (ip_type, l4_port_type, src_dst, port_value, queue_id),
> +                "created")
> +
> +            # list
> +            self.compare_memory_rules(1)
> +
> +            if src_dst is 'src':
> +                self.sendpkt_check_result("%d"%port_value, "", queue_id, 1, "%s-
> %s"%(ip_type,l4_port_type))
> +                self.sendpkt_check_result("%d"%(port_value-1), "", queue_id, 0,
> "%s-%s"%(ip_type,l4_port_type))
> +            else:
> +                self.sendpkt_check_result("", "%d"%port_value, queue_id, 1, "%s-
> %s"%(ip_type,l4_port_type))
> +                self.sendpkt_check_result("", "%d"%(port_value-1),
> + queue_id, 0, "%s-%s"%(ip_type,l4_port_type))
> +
> +            # flush
> +            self.dut.send_expect("flow flush 0", "testpmd> ")
> +
> +            if src_dst is 'src':
> +                self.sendpkt_check_result("%d"%(port_value-1), "", queue_id, 0,
> "%s-%s"%(ip_type,l4_port_type))
> +            else:
> +                self.sendpkt_check_result("", "%d"%(port_value-1),
> + queue_id, 0, "%s-%s"%(ip_type,l4_port_type))
> +
> +            self.compare_memory_rules(0)
> +
> +    def test_ipv4_udp_sport_only(self):
> +        # ipv4-udp
> +        # only src port
> +        self.cloudfilter_test(
> +            ip_type='ipv4', l4_port_type='udp', src_dst='src',
> + port_value=156, queue_id=1)
> +
> +    def test_ipv4_udp_dport_only(self):
> +        # ipv4-udp
> +        # only dst port
> +        self.cloudfilter_test(
> +            ip_type='ipv4', l4_port_type='udp', src_dst='dst',
> + port_value=156, queue_id=1)
> +
> +    def test_ipv4_tcp_sport_only(self):
> +        # ipv4-tcp
> +        # only src port
> +        self.cloudfilter_test(
> +            ip_type='ipv4', l4_port_type='tcp', src_dst='src',
> + port_value=156, queue_id=1)
> +
> +    def test_ipv4_tcp_dport_only(self):
> +        #ipv4-tcp
> +        # only dst port
> +        self.cloudfilter_test(
> +            ip_type='ipv4', l4_port_type='tcp', src_dst='dst',
> + port_value=156, queue_id=1)
> +
> +    def test_ipv4_sctp_sport_only(self):
> +        # ipv4-sctp
> +        # only src port
> +        self.cloudfilter_test(
> +            ip_type='ipv4', l4_port_type='sctp', src_dst='src',
> + port_value=156, queue_id=1)
> +
> +    def test_ipv4_sctp_dport_only(self):
> +        #ipv4-sctp
> +        # only dst port
> +        self.cloudfilter_test(
> +            ip_type='ipv4', l4_port_type='sctp', src_dst='dst',
> + port_value=156, queue_id=1)
> +
> +    def test_ipv6_udp_sport_only(self):
> +        # ipv6-udp
> +        # only src port
> +        self.cloudfilter_test(
> +            ip_type='ipv6', l4_port_type='udp', src_dst='src',
> + port_value=156, queue_id=1)
> +
> +    def test_ipv6_udp_dport_only(self):
> +        # ipv6-udp
> +        # only dst port
> +        self.cloudfilter_test(
> +            ip_type='ipv6', l4_port_type='udp', src_dst='dst',
> + port_value=156, queue_id=1)
> +
> +    def test_ipv6_tcp_sport_only(self):
> +        # ipv6-tcp
> +        # only src port
> +        self.cloudfilter_test(
> +            ip_type='ipv6', l4_port_type='tcp', src_dst='src',
> + port_value=156, queue_id=1)
> +
> +    def test_ipv6_tcp_dport_only(self):
> +        #ipv6-tcp
> +        # only dst port
> +        self.cloudfilter_test(
> +            ip_type='ipv6', l4_port_type='tcp', src_dst='dst',
> + port_value=156, queue_id=1)
> +
> +    def test_ipv6_sctp_sport_only(self):
> +        # ipv6-sctp
> +        # only src port
> +        self.cloudfilter_test(
> +            ip_type='ipv6', l4_port_type='sctp', src_dst='src',
> + port_value=156, queue_id=1)
> +
> +    def test_ipv6_sctp_dport_only(self):
> +        #ipv6-sctp
> +        # only dst port
> +        self.cloudfilter_test(
> +            ip_type='ipv6', l4_port_type='sctp', src_dst='dst',
> + port_value=156, queue_id=1)
> +
> +    def test_multi_rule(self):
> +        self.dut.send_expect(
> +            "flow create 0 ingress pattern eth / ipv4 / udp src is 11 / end actions pf
> / queue index 1 / end",
> +            "created")
> +        self.dut.send_expect(
> +            "flow create 0 ingress pattern eth / ipv4 / tcp src is 22 / end actions pf
> / queue index 2 / end",
> +            "created")
> +        self.dut.send_expect(
> +            "flow create 0 ingress pattern eth / ipv4 / sctp src is 33 / end actions pf
> / queue index 3 / end",
> +            "created")
> +        self.dut.send_expect(
> +            "flow create 0 ingress pattern eth / ipv4 / udp dst is 44 / end actions pf
> / queue index 4 / end",
> +            "created")
> +        self.dut.send_expect(
> +            "flow create 0 ingress pattern eth / ipv4 / tcp dst is 55 / end actions pf
> / queue index 5 / end",
> +            "created")
> +        self.dut.send_expect(
> +            "flow create 0 ingress pattern eth / ipv4 / sctp dst is 66 / end actions pf
> / queue index 6 / end",
> +            "created")
> +
> +        self.sendpkt_check_result("11", "", 1, 1, "ipv4-udp")
> +        self.sendpkt_check_result("22", "", 2, 1, "ipv4-tcp")
> +        self.sendpkt_check_result("33", "", 3, 1, "ipv4-sctp")
> +        self.sendpkt_check_result("", "44", 4, 1, "ipv4-udp")
> +        self.sendpkt_check_result("", "55", 5, 1, "ipv4-tcp")
> +        self.sendpkt_check_result("", "66", 6, 1, "ipv4-sctp")
> +
> +        # destroy
> +        self.dut.send_expect("flow destroy 0 rule 0", "testpmd> ")
> +
> +        self.sendpkt_check_result("11", "", 1, 0, "ipv4-udp")
> +
> +        self.compare_memory_rules(5)
> +
> +        # flush
> +        self.dut.send_expect("flow flush 0", "testpmd> ")
> +
> +        self.sendpkt_check_result("22", "", 2, 0, "ipv4-tcp")
> +
> +        self.compare_memory_rules(0)
> +
> +    def test_negative(self):
> +        # unsupported rules
> +        self.dut.send_expect(
> +            "flow create 0 ingress pattern eth / ipv4 / udp src is 156 dst is 156 /
> end actions pf / queue index 1 / end",
> +            "error")
> +
> +        self.dut.send_expect(
> +            "flow create 0 ingress pattern eth / ipv4 / udp src is 156 / end actions
> pf / queue index 1 / end",
> +            "create")
> +
> +        # conflicted rules
> +        self.dut.send_expect(
> +            "flow create 0 ingress pattern eth / ipv4 / udp src is 156 / end actions
> pf / queue index 2 / end",
> +            "error")
> +        self.dut.send_expect(
> +            "flow create 0 ingress pattern eth / ipv6 / udp src is 156 / end actions
> pf / queue index 2 / end",
> +            "error")
> +
> +    def tear_down(self):
> +        """
> +        Run after each test case.
> +        """
> +        self.destroy_env()
> +        self.dut.kill_all()
> +
> +    def tear_down_all(self):
> +        """
> +        Run after each test suite.
> +        """
> +        self.dut.kill_all()
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [dts] [PATCH v3 2/2] tests/TestSuite_cloud_filter_with_l4_port.py add test cases
  2020-08-18  3:07   ` [dts] [PATCH v3 2/2] tests/TestSuite_cloud_filter_with_l4_port.py add test cases Guinan Sun
  2020-08-18  5:11     ` Lin, Xueqin
@ 2020-08-18  8:38     ` Chen, LingliX
  2020-08-21  3:31     ` Tu, Lijuan
  2 siblings, 0 replies; 14+ messages in thread
From: Chen, LingliX @ 2020-08-18  8:38 UTC (permalink / raw)
  To: dts; +Cc: Sun, GuinanX, Sun, QinX

[-- Attachment #1: Type: text/plain, Size: 16241 bytes --]

Tested-by:  Chen, LingliX <linglix.chen@intel.com>

Regards,
Chen, Lingli

-----Original Message-----
From: dts [mailto: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 2/2] tests/TestSuite_cloud_filter_with_l4_port.py add test cases

add test cases for the new cloud filter.

Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
---
 tests/TestSuite_cloud_filter_with_l4_port.py | 358 +++++++++++++++++++
 1 file changed, 358 insertions(+)
 create mode 100644 tests/TestSuite_cloud_filter_with_l4_port.py

diff --git a/tests/TestSuite_cloud_filter_with_l4_port.py b/tests/TestSuite_cloud_filter_with_l4_port.py
new file mode 100644
index 0000000..005983d
--- /dev/null
+++ b/tests/TestSuite_cloud_filter_with_l4_port.py
@@ -0,0 +1,358 @@
+# BSD LICENSE
+#
+# Copyright(c) 2020 Intel Corporation. All rights reserved.
+# 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.
+
+"""
+DPDK Test suite.
+
+Test the support of generic flow API by Poll Mode Drivers.
+
+"""
+
+import utils
+import time
+import re
+
+from test_case import TestCase
+from pmd_output import PmdOutput
+from settings import DRIVERS
+from crb import Crb
+from dut import Dut
+import packet
+from exception import VerifyFailure
+import scapy.layers.inet
+from scapy.utils import rdpcap
+
+MAX_QUEUE = 16
+
+class TestCloudFilterWithL4Port(TestCase):
+
+    def set_up_all(self):
+        """
+        Run at the start of each test suite.
+        Generic filter Prerequistites
+        """
+        # Based on h/w type, choose how many ports to use
+        self.dut_ports = self.dut.get_ports(self.nic)
+        # Verify that enough ports are available
+        self.verify(len(self.dut_ports) >= 1, "Insufficient ports")
+        self.cores = "1S/8C/1T"
+        self.pf_cores = "1S/8C/1T"
+        self.pmdout = PmdOutput(self.dut)
+
+        localPort = self.tester.get_local_port(self.dut_ports[0])
+        self.tester_itf = self.tester.get_interface(localPort)
+        self.pf_interface = self.dut.ports_info[self.dut_ports[0]]['intf']
+        self.pf_mac = self.dut.get_mac_address(0)
+        self.pf_pci = self.dut.ports_info[self.dut_ports[0]]['pci']
+        self.pkt_obj = packet.Packet()
+
+        self.verify(self.nic in ["fortville_eagle", "fortville_spirit", "carlsville",
+                    "fortville_spirit_single", "fortpark_TLV",
+                    "fortpark_BASE-T","fortville_25g"], "%s nic not 
+ support cloud filter" % self.nic)
+
+    def set_up(self):
+        """
+        Run before each test case.
+        """
+        self.dut.kill_all()
+
+        self.pmdout.start_testpmd("%s" % self.cores, "--rxq=%d --txq=%d --disable-rss" % (MAX_QUEUE, MAX_QUEUE), "-w %s --file-prefix=test1" % self.pf_pci)
+        self.dut.send_expect("set fwd rxonly", "testpmd> ", 120)
+        self.dut.send_expect("set promisc all off", "testpmd> ", 120)
+        self.dut.send_expect("set verbose 1", "testpmd> ", 120)
+        self.dut.send_expect("start", "testpmd> ", 120)
+        time.sleep(2)
+
+    def destroy_env(self):
+        """
+        This is to stop testpmd.
+        """
+        self.dut.send_expect("quit", "# ")
+        time.sleep(2)
+
+    def compare_memory_rules(self, expectedRules):
+        """
+        dump all flow rules that have been created in memory and compare that total rules number with the given expected number
+        to see if they are equal, as to get your conclusion after you have deleted any flow rule entry.
+        """
+        outstring = self.dut.send_expect("flow list 0", "testpmd> ", 20)
+        result_scanner = r'\d*.*?\d*.*?\d*.*?=>*'
+        scanner = re.compile(result_scanner, re.DOTALL)
+        m = scanner.findall(outstring)
+        print("All flow entries are: ")
+        for i in range(len(m)):
+            print(m[i])
+        print('Expected rules are: %d - actual are: %d' % (expectedRules, len(m)))
+        self.verify(expectedRules == len(m), 'Total rules number 
+ mismatched')
+
+    def verify_rulenum(self, rule_num):
+        """
+        Verify all the rules created.
+        """
+        # check if there are expected flow rules have been created
+        self.compare_memory_rules(rule_num)
+        # check if one rule destroyed with success
+        self.dut.send_expect("flow destroy 0 rule 0", "testpmd> ")
+        self.compare_memory_rules(rule_num - 1)
+        # check if all flow rules have been removed with success
+        self.dut.send_expect("flow flush 0", "testpmd> ")
+        self.compare_memory_rules(0)
+
+    def sendpkt(self, pktstr, count=1):
+        import sys
+        py_version = sys.version
+        if py_version.startswith('3.'):
+            self.pkt_obj.pktgen.pkts.clear()
+        else:
+            del self.pkt_obj.pktgen.pkts[:]
+        self.pkt_obj.append_pkt(pktstr)
+        self.pkt_obj.send_pkt(self.tester, tx_port=self.tester_itf, 
+ count=count)
+
+    def sendpkt_check_result(self, src_port, dst_port, queue, match, pctype=""):
+        match_info = "/queue %d: " % queue
+        # source port
+        if src_port != "" and dst_port == "":
+            if pctype == "ipv4-udp":
+                self.sendpkt(pktstr='Ether()/IP()/UDP(sport=%s)' % src_port)
+            elif pctype == "ipv4-tcp":
+                self.sendpkt(pktstr='Ether()/IP()/TCP(sport=%s)' % src_port)
+            elif pctype == "ipv4-sctp":
+                self.sendpkt(pktstr='Ether()/IP()/SCTP(sport=%s)' % src_port)
+            elif pctype == "ipv6-udp":
+                self.sendpkt(pktstr='Ether()/IPv6()/UDP(sport=%s)' % src_port)
+            elif pctype == "ipv6-tcp":
+                self.sendpkt(pktstr='Ether()/IPv6()/TCP(sport=%s)' % src_port)
+            elif pctype == "ipv6-sctp":
+                self.sendpkt(pktstr='Ether()/IPv6()/SCTP(sport=%s)' % src_port)
+        elif src_port == "" and dst_port != "":
+            if pctype == "ipv4-udp":
+                self.sendpkt(pktstr='Ether()/IP()/UDP(dport=%s)' % dst_port)
+            elif pctype == "ipv4-tcp":
+                self.sendpkt(pktstr='Ether()/IP()/TCP(dport=%s)' % dst_port)
+            elif pctype == "ipv4-sctp":
+                self.sendpkt(pktstr='Ether()/IP()/SCTP(dport=%s)' % dst_port)
+            elif pctype == "ipv6-udp":
+                self.sendpkt(pktstr='Ether()/IPv6()/UDP(dport=%s)' % dst_port)
+            elif pctype == "ipv6-tcp":
+                self.sendpkt(pktstr='Ether()/IPv6()/TCP(dport=%s)' % dst_port)
+            elif pctype == "ipv6-sctp":
+                self.sendpkt(pktstr='Ether()/IPv6()/SCTP(dport=%s)' % dst_port)
+        elif src_port != "" and dst_port != "":
+            if pctype == "ipv4-udp":
+                self.sendpkt(pktstr='Ether()/IP()/UDP(sport=%s, 
+ dport=%s)' % (src_port, dst_port))
+
+        out_pf = self.dut.get_session_output(timeout=2)
+        print("out_pf is %s" % out_pf)
+
+        if match == 1:
+            self.verify(match_info in out_pf, "the packet not match the expect queue %d." % queue)
+        else:
+            if match_info in out_pf:
+                raise Exception("the packet should not match the queue 
+ %d." % queue)
+
+    def cloudfilter_test(
+            self, ip_type='ipv4', l4_port_type='udp', src_dst='src', port_value=156, queue_id=0):
+
+            # validate
+            self.dut.send_expect(
+                "flow validate 0 ingress pattern eth / %s / %s %s is %d / end actions pf / queue index %d / end"
+                    % (ip_type, l4_port_type, src_dst, port_value, queue_id),
+                "validated")
+
+            # create
+            self.dut.send_expect(
+                "flow create 0 ingress pattern eth / %s / %s %s is %d / end actions pf / queue index %d / end"
+                    % (ip_type, l4_port_type, src_dst, port_value, queue_id),
+                "created")
+
+            # list
+            self.compare_memory_rules(1)
+
+            if src_dst is 'src':
+                self.sendpkt_check_result("%d"%port_value, "", queue_id, 1, "%s-%s"%(ip_type,l4_port_type))
+                self.sendpkt_check_result("%d"%(port_value-1), "", queue_id, 0, "%s-%s"%(ip_type,l4_port_type))
+            else:
+                self.sendpkt_check_result("", "%d"%port_value, queue_id, 1, "%s-%s"%(ip_type,l4_port_type))
+                self.sendpkt_check_result("", "%d"%(port_value-1), 
+ queue_id, 0, "%s-%s"%(ip_type,l4_port_type))
+
+            # flush
+            self.dut.send_expect("flow flush 0", "testpmd> ")
+
+            if src_dst is 'src':
+                self.sendpkt_check_result("%d"%(port_value-1), "", queue_id, 0, "%s-%s"%(ip_type,l4_port_type))
+            else:
+                self.sendpkt_check_result("", "%d"%(port_value-1), 
+ queue_id, 0, "%s-%s"%(ip_type,l4_port_type))
+
+            self.compare_memory_rules(0)
+
+    def test_ipv4_udp_sport_only(self):
+        # ipv4-udp
+        # only src port
+        self.cloudfilter_test(
+            ip_type='ipv4', l4_port_type='udp', src_dst='src', 
+ port_value=156, queue_id=1)
+
+    def test_ipv4_udp_dport_only(self):
+        # ipv4-udp
+        # only dst port
+        self.cloudfilter_test(
+            ip_type='ipv4', l4_port_type='udp', src_dst='dst', 
+ port_value=156, queue_id=1)
+
+    def test_ipv4_tcp_sport_only(self):
+        # ipv4-tcp
+        # only src port
+        self.cloudfilter_test(
+            ip_type='ipv4', l4_port_type='tcp', src_dst='src', 
+ port_value=156, queue_id=1)
+
+    def test_ipv4_tcp_dport_only(self):
+        #ipv4-tcp
+        # only dst port
+        self.cloudfilter_test(
+            ip_type='ipv4', l4_port_type='tcp', src_dst='dst', 
+ port_value=156, queue_id=1)
+
+    def test_ipv4_sctp_sport_only(self):
+        # ipv4-sctp
+        # only src port
+        self.cloudfilter_test(
+            ip_type='ipv4', l4_port_type='sctp', src_dst='src', 
+ port_value=156, queue_id=1)
+
+    def test_ipv4_sctp_dport_only(self):
+        #ipv4-sctp
+        # only dst port
+        self.cloudfilter_test(
+            ip_type='ipv4', l4_port_type='sctp', src_dst='dst', 
+ port_value=156, queue_id=1)
+
+    def test_ipv6_udp_sport_only(self):
+        # ipv6-udp
+        # only src port
+        self.cloudfilter_test(
+            ip_type='ipv6', l4_port_type='udp', src_dst='src', 
+ port_value=156, queue_id=1)
+
+    def test_ipv6_udp_dport_only(self):
+        # ipv6-udp
+        # only dst port
+        self.cloudfilter_test(
+            ip_type='ipv6', l4_port_type='udp', src_dst='dst', 
+ port_value=156, queue_id=1)
+
+    def test_ipv6_tcp_sport_only(self):
+        # ipv6-tcp
+        # only src port
+        self.cloudfilter_test(
+            ip_type='ipv6', l4_port_type='tcp', src_dst='src', 
+ port_value=156, queue_id=1)
+
+    def test_ipv6_tcp_dport_only(self):
+        #ipv6-tcp
+        # only dst port
+        self.cloudfilter_test(
+            ip_type='ipv6', l4_port_type='tcp', src_dst='dst', 
+ port_value=156, queue_id=1)
+
+    def test_ipv6_sctp_sport_only(self):
+        # ipv6-sctp
+        # only src port
+        self.cloudfilter_test(
+            ip_type='ipv6', l4_port_type='sctp', src_dst='src', 
+ port_value=156, queue_id=1)
+
+    def test_ipv6_sctp_dport_only(self):
+        #ipv6-sctp
+        # only dst port
+        self.cloudfilter_test(
+            ip_type='ipv6', l4_port_type='sctp', src_dst='dst', 
+ port_value=156, queue_id=1)
+
+    def test_multi_rule(self):
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth / ipv4 / udp src is 11 / end actions pf / queue index 1 / end",
+            "created")
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth / ipv4 / tcp src is 22 / end actions pf / queue index 2 / end",
+            "created")
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth / ipv4 / sctp src is 33 / end actions pf / queue index 3 / end",
+            "created")
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth / ipv4 / udp dst is 44 / end actions pf / queue index 4 / end",
+            "created")
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth / ipv4 / tcp dst is 55 / end actions pf / queue index 5 / end",
+            "created")
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth / ipv4 / sctp dst is 66 / end actions pf / queue index 6 / end",
+            "created")
+
+        self.sendpkt_check_result("11", "", 1, 1, "ipv4-udp")
+        self.sendpkt_check_result("22", "", 2, 1, "ipv4-tcp")
+        self.sendpkt_check_result("33", "", 3, 1, "ipv4-sctp")
+        self.sendpkt_check_result("", "44", 4, 1, "ipv4-udp")
+        self.sendpkt_check_result("", "55", 5, 1, "ipv4-tcp")
+        self.sendpkt_check_result("", "66", 6, 1, "ipv4-sctp")
+
+        # destroy
+        self.dut.send_expect("flow destroy 0 rule 0", "testpmd> ")
+
+        self.sendpkt_check_result("11", "", 1, 0, "ipv4-udp")
+
+        self.compare_memory_rules(5)
+
+        # flush
+        self.dut.send_expect("flow flush 0", "testpmd> ")
+
+        self.sendpkt_check_result("22", "", 2, 0, "ipv4-tcp")
+
+        self.compare_memory_rules(0)
+
+    def test_negative(self):
+        # unsupported rules
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth / ipv4 / udp src is 156 dst is 156 / end actions pf / queue index 1 / end",
+            "error")
+
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth / ipv4 / udp src is 156 / end actions pf / queue index 1 / end",
+            "create")
+
+        # conflicted rules
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth / ipv4 / udp src is 156 / end actions pf / queue index 2 / end",
+            "error")
+        self.dut.send_expect(
+            "flow create 0 ingress pattern eth / ipv6 / udp src is 156 / end actions pf / queue index 2 / end",
+            "error")
+
+    def tear_down(self):
+        """
+        Run after each test case.
+        """
+        self.destroy_env()
+        self.dut.kill_all()
+
+    def tear_down_all(self):
+        """
+        Run after each test suite.
+        """
+        self.dut.kill_all()
--
2.17.1


[-- Attachment #2: TestCloudFilterWithL4Port.log --]
[-- Type: application/octet-stream, Size: 470659 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [dts] [PATCH v3 1/2] test_plans: add cloud_filter_with_l4_port_test_plan.rst
  2020-08-18  3:07 ` [dts] [PATCH v3 " Guinan Sun
  2020-08-18  3:07   ` [dts] [PATCH v3 2/2] tests/TestSuite_cloud_filter_with_l4_port.py add test cases Guinan Sun
  2020-08-18  5:07   ` [dts] [PATCH v3 1/2] test_plans: add cloud_filter_with_l4_port_test_plan.rst Lin, Xueqin
@ 2020-08-21  3:28   ` Tu, Lijuan
  2 siblings, 0 replies; 14+ messages in thread
From: Tu, Lijuan @ 2020-08-21  3:28 UTC (permalink / raw)
  To: Sun, GuinanX, dts; +Cc: Sun, GuinanX

> > 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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [dts] [PATCH v3 2/2] tests/TestSuite_cloud_filter_with_l4_port.py add test cases
  2020-08-18  3:07   ` [dts] [PATCH v3 2/2] tests/TestSuite_cloud_filter_with_l4_port.py add test cases Guinan Sun
  2020-08-18  5:11     ` Lin, Xueqin
  2020-08-18  8:38     ` Chen, LingliX
@ 2020-08-21  3:31     ` Tu, Lijuan
  2 siblings, 0 replies; 14+ messages in thread
From: Tu, Lijuan @ 2020-08-21  3:31 UTC (permalink / raw)
  To: Sun, GuinanX, dts; +Cc: Sun, GuinanX

> > add test cases for the new cloud filter.
> >
> > Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
> > ---
> >  tests/TestSuite_cloud_filter_with_l4_port.py | 358 +++++++++++++++++++

> Acked-by: Xueqin Lin <Xueqin.lin@intel.com>

Applied

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2020-08-21  3:31 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-17  5:54 [dts] [PATCH v1 1/2] test_plans: add cloud_filter_with_l4_port_test_plan.rst Guinan Sun
2020-08-17  5:54 ` [dts] [PATCH v1 2/2] tests/TestSuite_cloud_filter_with_l4_port.py add test cases Guinan Sun
2020-08-17  6:11 ` [dts] [PATCH v1 1/2] test_plans: add cloud_filter_with_l4_port_test_plan.rst Lin, Xueqin
2020-08-17  8:34 ` [dts] [PATCH v2 " Guinan Sun
2020-08-17  8:34   ` [dts] [PATCH v2 2/2] tests/TestSuite_cloud_filter_with_l4_port.py add test cases Guinan Sun
2020-08-18  1:59     ` Lin, Xueqin
2020-08-18  2:08   ` [dts] [PATCH v2 1/2] test_plans: add cloud_filter_with_l4_port_test_plan.rst Lin, Xueqin
2020-08-18  3:07 ` [dts] [PATCH v3 " Guinan Sun
2020-08-18  3:07   ` [dts] [PATCH v3 2/2] tests/TestSuite_cloud_filter_with_l4_port.py add test cases Guinan Sun
2020-08-18  5:11     ` Lin, Xueqin
2020-08-18  8:38     ` Chen, LingliX
2020-08-21  3:31     ` Tu, Lijuan
2020-08-18  5:07   ` [dts] [PATCH v3 1/2] test_plans: add cloud_filter_with_l4_port_test_plan.rst Lin, Xueqin
2020-08-21  3:28   ` Tu, Lijuan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).