test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH] change whitelist suite name to mac filter
@ 2015-11-05  6:53 yongjie
  2015-11-05  9:27 ` Liu, Yong
  0 siblings, 1 reply; 2+ messages in thread
From: yongjie @ 2015-11-05  6:53 UTC (permalink / raw)
  To: dts; +Cc: Gu yongjie

From: Gu yongjie <yongjiex.gu@intel.com>


Signed-off-by: Gu yongjie <yongjiex.gu@intel.com>
---
 executions/execution.cfg            |    2 +-
 executions/execution_FVL.cfg        |    2 +-
 executions/execution_smoke.cfg      |    2 +-
 test_plans/mac_filter_test_plan.rst |  173 ++++++++++++++++++++++++++++++
 test_plans/whitelist_test_plan.rst  |  173 ------------------------------
 tests/TestSuite_mac_filter.py       |  200 +++++++++++++++++++++++++++++++++++
 tests/TestSuite_whitelist.py        |  200 -----------------------------------
 7 files changed, 376 insertions(+), 376 deletions(-)
 create mode 100644 test_plans/mac_filter_test_plan.rst
 delete mode 100644 test_plans/whitelist_test_plan.rst
 create mode 100644 tests/TestSuite_mac_filter.py
 delete mode 100644 tests/TestSuite_whitelist.py

diff --git a/executions/execution.cfg b/executions/execution.cfg
index 20d9bd6..1870ec2 100644
--- a/executions/execution.cfg
+++ b/executions/execution.cfg
@@ -7,7 +7,7 @@ test_suites=
     multiprocess,
     timer,
     blacklist,
-    whitelist,
+    mac_filter,
     ieee1588,
     checksum_offload,
     jumboframes,
diff --git a/executions/execution_FVL.cfg b/executions/execution_FVL.cfg
index 7bdd2b7..b404676 100644
--- a/executions/execution_FVL.cfg
+++ b/executions/execution_FVL.cfg
@@ -20,7 +20,7 @@ test_suites=
     jumboframes,
     multiprocess,
     l2fwd,
-    whitelist,
+    mac_filter,
     blacklist,
     ipv4_reassembly,
     scatter,
diff --git a/executions/execution_smoke.cfg b/executions/execution_smoke.cfg
index 7631f5c..d090f8a 100644
--- a/executions/execution_smoke.cfg
+++ b/executions/execution_smoke.cfg
@@ -24,7 +24,7 @@ test_suites=
     l2fwd,
     pmd,
     checksum_offload,
-    whitelist,
+    mac_filter,
     blacklist
 targets=
     x86_64-native-linuxapp-gcc
diff --git a/test_plans/mac_filter_test_plan.rst b/test_plans/mac_filter_test_plan.rst
new file mode 100644
index 0000000..6ed79cc
--- /dev/null
+++ b/test_plans/mac_filter_test_plan.rst
@@ -0,0 +1,173 @@
+.. Copyright (c) <2012>, 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.
+
+==================================================
+Support of Whitelist Features by Poll Mode Drivers
+==================================================
+
+Support igb_uio and vfio driver, if used vfio, kernel need 3.6+ and enable vt-d in bios.
+When used vfio , used "modprobe vfio" and "modprobe vfio-pci" insmod vfiod driver, then used
+"./tools/dpdk_nic_bind.py --bind=vfio-pci device_bus_id" to bind vfio driver to test driver.
+
+The support of Whitelist offload features by Poll Mode Drivers consists in:
+
+
+Prerequisites
+=============
+
+Assuming that at least a port is connected to a traffic generator,
+launch the ``testpmd`` with the following arguments::
+  
+  ./x86_64-default-linuxapp-gcc/build/app/test-pmd/testpmd -c 0xc3 -n 3 -- -i \
+  --burst=1 --rxpt=0     --rxht=0 --rxwt=0 --txpt=36 --txht=0 --txwt=0 \
+  --txfreet=32 --rxfreet=64 --mbcache=250 --portmask=0x3
+ 
+The -n command is used to select the number of memory channels. It should match the number of memory channels on that setup.
+ 
+Set the verbose level to 1 to display informations for each received packet::
+
+  testpmd> set verbose 1 
+  
+Show port infos for port 0 and store the default MAC address and the maximum 
+number of MAC addresses::
+
+  testpmd> show port info 0
+
+    ********************* Infos for port 0  *********************
+    MAC address: 00:1B:21:4D:D2:24
+    Link status: up
+    Link speed: 10000 Mbps
+    Link duplex: full-duplex
+    Promiscuous mode: enabled
+    Allmulticast mode: disabled
+    Maximum number of MAC addresses: 127
+
+
+Test Case: add/remove mac addresses
+===================================
+
+Initialise first port without ``promiscuous mode``::
+
+  testpmd> set promisc 0 off
+
+Read the stats for port 0 before sending the packet::
+
+  testpmd> show port stats 8
+
+    ######################## NIC statistics for port 8  ########################
+    RX-packets: 0          RX-errors: 0         RX-bytes: 64
+    TX-packets: 0          TX-errors: 0         TX-bytes: 0
+    ############################################################################
+
+Send a packet with default destination MAC address for port 0::
+
+  testpmd> show port stats 0
+
+    ######################## NIC statistics for port 8  ########################
+    RX-packets: 1          RX-errors: 0         RX-bytes: 128
+    TX-packets: 0          TX-errors: 0         TX-bytes: 0
+    ############################################################################
+
+Verify that the packet was received (RX-packets incremented).  
+
+Send a packet with destination MAC address different than the port 0 address,
+let's call it A.::
+
+  testpmd> show port stats 0
+
+    ######################## NIC statistics for port 8  ########################
+    RX-packets: 1          RX-errors: 0         RX-bytes: 128
+    TX-packets: 0          TX-errors: 0         TX-bytes: 0
+    ############################################################################
+
+Verify that the packet was not received (RX-packets not incremented).
+
+Add the MAC address A to the port 0::
+
+  testpmd> mac_addr add 0 <A>
+  testpmd> show port stats 0
+
+
+    ######################## NIC statistics for port 8  ########################
+    RX-packets: 2          RX-errors: 0         RX-bytes: 192
+    TX-packets: 0          TX-errors: 0         TX-bytes: 0
+    ############################################################################
+
+Verify that the packet was received (RX-packets incremented).
+
+Remove the MAC address A to the port 0::
+
+  testpmd> mac_addr remove 0 <A>
+  testpmd> show port stats 0
+
+
+    ######################## NIC statistics for port 8  ########################
+    RX-packets: 2          RX-errors: 0         RX-bytes: 192
+    TX-packets: 0          TX-errors: 0         TX-bytes: 0
+    ############################################################################
+
+Verify that the packet was not received (RX-packets not incremented).
+
+
+Test Case: invalid addresses test
+=================================
+
+Add a MAC address of all zeroes to the port 0::
+
+  testpmd> mac_addr add 0 00:00:00:00:00:00
+
+Verify that the response is "Invalid argument" (-EINVAL)
+  
+Remove the default MAC address::
+
+  testpmd> mac_addr remove 0 <default MAC address>
+
+Verify that the response is "Address already in use" (-EADDRINUSE)
+  
+Add two times the same address::
+  
+  testpmd> mac_addr add 0 <A>
+  testpmd> mac_addr add 0 <A>
+  
+Verify that there is no error
+
+Add as many different addresses as maximum MAC addresses (n)::
+
+   testpmd> mac_addr add 0 <A>
+   ... n-times
+   testpmd> mac_addr add 0 <A+n>
+
+Add one more different address::
+
+   testpmd> mac_addr add 0 <A+n+1>
+   
+Verify that the response is "No space left on device" (-ENOSPC)
diff --git a/test_plans/whitelist_test_plan.rst b/test_plans/whitelist_test_plan.rst
deleted file mode 100644
index 6ed79cc..0000000
--- a/test_plans/whitelist_test_plan.rst
+++ /dev/null
@@ -1,173 +0,0 @@
-.. Copyright (c) <2012>, 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.
-
-==================================================
-Support of Whitelist Features by Poll Mode Drivers
-==================================================
-
-Support igb_uio and vfio driver, if used vfio, kernel need 3.6+ and enable vt-d in bios.
-When used vfio , used "modprobe vfio" and "modprobe vfio-pci" insmod vfiod driver, then used
-"./tools/dpdk_nic_bind.py --bind=vfio-pci device_bus_id" to bind vfio driver to test driver.
-
-The support of Whitelist offload features by Poll Mode Drivers consists in:
-
-
-Prerequisites
-=============
-
-Assuming that at least a port is connected to a traffic generator,
-launch the ``testpmd`` with the following arguments::
-  
-  ./x86_64-default-linuxapp-gcc/build/app/test-pmd/testpmd -c 0xc3 -n 3 -- -i \
-  --burst=1 --rxpt=0     --rxht=0 --rxwt=0 --txpt=36 --txht=0 --txwt=0 \
-  --txfreet=32 --rxfreet=64 --mbcache=250 --portmask=0x3
- 
-The -n command is used to select the number of memory channels. It should match the number of memory channels on that setup.
- 
-Set the verbose level to 1 to display informations for each received packet::
-
-  testpmd> set verbose 1 
-  
-Show port infos for port 0 and store the default MAC address and the maximum 
-number of MAC addresses::
-
-  testpmd> show port info 0
-
-    ********************* Infos for port 0  *********************
-    MAC address: 00:1B:21:4D:D2:24
-    Link status: up
-    Link speed: 10000 Mbps
-    Link duplex: full-duplex
-    Promiscuous mode: enabled
-    Allmulticast mode: disabled
-    Maximum number of MAC addresses: 127
-
-
-Test Case: add/remove mac addresses
-===================================
-
-Initialise first port without ``promiscuous mode``::
-
-  testpmd> set promisc 0 off
-
-Read the stats for port 0 before sending the packet::
-
-  testpmd> show port stats 8
-
-    ######################## NIC statistics for port 8  ########################
-    RX-packets: 0          RX-errors: 0         RX-bytes: 64
-    TX-packets: 0          TX-errors: 0         TX-bytes: 0
-    ############################################################################
-
-Send a packet with default destination MAC address for port 0::
-
-  testpmd> show port stats 0
-
-    ######################## NIC statistics for port 8  ########################
-    RX-packets: 1          RX-errors: 0         RX-bytes: 128
-    TX-packets: 0          TX-errors: 0         TX-bytes: 0
-    ############################################################################
-
-Verify that the packet was received (RX-packets incremented).  
-
-Send a packet with destination MAC address different than the port 0 address,
-let's call it A.::
-
-  testpmd> show port stats 0
-
-    ######################## NIC statistics for port 8  ########################
-    RX-packets: 1          RX-errors: 0         RX-bytes: 128
-    TX-packets: 0          TX-errors: 0         TX-bytes: 0
-    ############################################################################
-
-Verify that the packet was not received (RX-packets not incremented).
-
-Add the MAC address A to the port 0::
-
-  testpmd> mac_addr add 0 <A>
-  testpmd> show port stats 0
-
-
-    ######################## NIC statistics for port 8  ########################
-    RX-packets: 2          RX-errors: 0         RX-bytes: 192
-    TX-packets: 0          TX-errors: 0         TX-bytes: 0
-    ############################################################################
-
-Verify that the packet was received (RX-packets incremented).
-
-Remove the MAC address A to the port 0::
-
-  testpmd> mac_addr remove 0 <A>
-  testpmd> show port stats 0
-
-
-    ######################## NIC statistics for port 8  ########################
-    RX-packets: 2          RX-errors: 0         RX-bytes: 192
-    TX-packets: 0          TX-errors: 0         TX-bytes: 0
-    ############################################################################
-
-Verify that the packet was not received (RX-packets not incremented).
-
-
-Test Case: invalid addresses test
-=================================
-
-Add a MAC address of all zeroes to the port 0::
-
-  testpmd> mac_addr add 0 00:00:00:00:00:00
-
-Verify that the response is "Invalid argument" (-EINVAL)
-  
-Remove the default MAC address::
-
-  testpmd> mac_addr remove 0 <default MAC address>
-
-Verify that the response is "Address already in use" (-EADDRINUSE)
-  
-Add two times the same address::
-  
-  testpmd> mac_addr add 0 <A>
-  testpmd> mac_addr add 0 <A>
-  
-Verify that there is no error
-
-Add as many different addresses as maximum MAC addresses (n)::
-
-   testpmd> mac_addr add 0 <A>
-   ... n-times
-   testpmd> mac_addr add 0 <A+n>
-
-Add one more different address::
-
-   testpmd> mac_addr add 0 <A+n+1>
-   
-Verify that the response is "No space left on device" (-ENOSPC)
diff --git a/tests/TestSuite_mac_filter.py b/tests/TestSuite_mac_filter.py
new file mode 100644
index 0000000..1749c62
--- /dev/null
+++ b/tests/TestSuite_mac_filter.py
@@ -0,0 +1,200 @@
+# BSD LICENSE
+#
+# Copyright(c) 2010-2014 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 Whitelist Features by Poll Mode Drivers
+"""
+
+import dts
+import time
+from test_case import TestCase
+from pmd_output import PmdOutput
+
+class TestWhitelist(TestCase):
+
+    def set_up_all(self):
+        """
+        Run at the start of each test suite.
+        Whitelist Prerequistites:
+            Two Ports
+            testpmd can normally started
+        """
+        self.frames_to_send = 1
+        # Based on h/w type, choose how many ports to use
+        self.dutPorts = self.dut.get_ports()
+        # Verify that enough ports are available
+        self.verify(len(self.dutPorts) >= 1, "Insufficient ports")
+        portMask = dts.create_mask(self.dutPorts[:2])
+
+        self.pmdout = PmdOutput(self.dut)
+        self.pmdout.start_testpmd("Default", "--portmask=%s" % portMask)
+        self.dut.send_expect("set verbose 1", "testpmd> ")
+        self.dut.send_expect("start", "testpmd> ")
+
+        # get dest address from self.target port
+        out = self.dut.send_expect("show port info %d" % self.dutPorts[0], "testpmd> ")
+
+        self.dest = self.dut.get_mac_address(self.dutPorts[0])
+        mac_scanner = r"MAC address: (([\dA-F]{2}:){5}[\dA-F]{2})"
+
+        ret = dts.regexp(out, mac_scanner)
+        self.verify(ret is not None, "MAC address not found")
+        self.verify(cmp(ret.lower(), self.dest) == 0, "MAC address wrong")
+
+        self.max_mac_addr = dts.regexp(out, "Maximum number of MAC addresses: ([0-9]+)")
+
+    def set_up(self):
+        """
+        Run before each test case.
+        Nothing to do.
+        """
+        pass
+
+    def whitelist_send_packet(self, portid, destMac="00:11:22:33:44:55"):
+        """
+        Send 1 packet to portid.
+        """
+        itf = self.tester.get_interface(self.tester.get_local_port(portid))
+        self.tester.scapy_foreground()
+        self.tester.scapy_append('sendp([Ether(dst="%s", src="52:00:00:00:00:00")], iface="%s", count=%d)' % (destMac,
+                                                                                             itf, self.frames_to_send))
+        self.tester.scapy_execute()
+        time.sleep(5)
+
+    def test_add_remove_mac_address(self):
+        """
+        Add mac address and check packet can received
+        Remove mac address and check packet can't received
+        """
+        # initialise first port without promiscuous mode
+        fake_mac_addr = "01:01:01:00:00:00"
+        portid = self.dutPorts[0]
+        txportid = self.dutPorts[1]
+        self.dut.send_expect("set promisc %d off" % portid, "testpmd> ")
+
+        out = self.dut.send_expect("show port stats %d" % txportid, "testpmd> ")
+        pre_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)")
+
+        # send one packet with the portid MAC address
+        self.whitelist_send_packet(portid, self.dest)
+        out = self.dut.send_expect("show port stats %d" % txportid, "testpmd> ")
+        cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)")
+        # check the packet increase
+        self.verify(int(cur_rxpkt) == int(pre_rxpkt) + self.frames_to_send,
+                    "Packet has not been received on default address")
+        # send one packet to a different MAC address
+        # new_mac = self.dut.get_mac_address(portid)
+        self.whitelist_send_packet(portid, fake_mac_addr)
+
+        pre_rxpkt = cur_rxpkt
+        out = self.dut.send_expect("show port stats %d" % txportid, "testpmd> ")
+        cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)")
+
+        # check the packet DO NOT increase
+        self.verify(int(cur_rxpkt) == int(pre_rxpkt),
+                    "Packet has been received on a new MAC address that has not been added yet")
+        # add the different MAC address
+        out = self.dut.send_expect("mac_addr add %d" % portid + " %s" % fake_mac_addr, "testpmd>")
+
+        # send again one packet to a different MAC address
+        self.whitelist_send_packet(portid, fake_mac_addr)
+
+        pre_rxpkt = cur_rxpkt
+        out = self.dut.send_expect("show port stats %d" % txportid, "testpmd> ")
+        cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)")
+
+        # check the packet increase
+        self.verify(int(cur_rxpkt) == int(pre_rxpkt) + self.frames_to_send,
+                    "Packet has not been received on a new MAC address that has been added to the port")
+
+        # remove the fake MAC address
+        out = self.dut.send_expect("mac_addr remove %d" % portid + " %s" % fake_mac_addr, "testpmd>")
+
+        # send again one packet to a different MAC address
+        self.whitelist_send_packet(portid, fake_mac_addr)
+
+        pre_rxpkt = cur_rxpkt
+        out = self.dut.send_expect("show port stats %d" % txportid, "testpmd> ")
+        cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)")
+
+        # check the packet increase
+        self.verify(int(cur_rxpkt) == int(pre_rxpkt),
+                    "Packet has been received on a new MAC address that has been removed from the port")
+        self.dut.send_expect("stop", "testpmd> ")
+
+    def test_invalid_addresses(self):
+        """
+        Invalid operation:
+            Add NULL MAC should not be added
+            Remove using MAC will be failed
+            Add Same MAC twice will be failed
+            Add more than MAX number will be failed
+        """
+        portid = self.dutPorts[0]
+        fake_mac_addr = "00:00:00:00:00:00"
+
+        # add an address with all zeroes to the port (-EINVAL)
+        out = self.dut.send_expect("mac_addr add %d" % portid + " %s" % fake_mac_addr, "testpmd>")
+        self.verify("Invalid argument" in out, "Added a NULL MAC address")
+
+        # remove the default MAC address (-EADDRINUSE)
+        out = self.dut.send_expect("mac_addr remove %d" % portid + " %s" % self.dest, "testpmd>")
+        self.verify("Address already in use" in out, "default address removed")
+
+        # add same address 2 times
+        fake_mac_addr = "00:00:00:00:00:01"
+        out = self.dut.send_expect("mac_addr add %d" % portid + " %s" % fake_mac_addr, "testpmd>")
+        out = self.dut.send_expect("mac_addr add %d" % portid + " %s" % fake_mac_addr, "testpmd>")
+        self.verify("error" not in out, "added 2 times the same address with an error")
+
+        # add 1 address more that max number
+        i = 0
+        base_addr = "01:00:00:00:00:"
+        while i <= int(self.max_mac_addr):
+            new_addr = base_addr + "%0.2X" % i
+            out = self.dut.send_expect("mac_addr add %d" % portid + " %s" % new_addr, "testpmd>")
+            i = i + 1
+
+        self.verify("No space left on device" in out, "added 1 address more than max MAC addresses")
+
+    def tear_down(self):
+        """
+        Run after each test case.
+        Nothing to do.
+        """
+        pass
+
+    def tear_down_all(self):
+        """
+        Run after each test suite.
+        """
+        self.dut.send_expect("quit", "# ", 10)
diff --git a/tests/TestSuite_whitelist.py b/tests/TestSuite_whitelist.py
deleted file mode 100644
index 3e87b81..0000000
--- a/tests/TestSuite_whitelist.py
+++ /dev/null
@@ -1,200 +0,0 @@
-# BSD LICENSE
-#
-# Copyright(c) 2010-2014 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 Whitelist Features by Poll Mode Drivers
-"""
-
-import dts
-import time
-from test_case import TestCase
-from pmd_output import PmdOutput
-
-class TestWhitelist(TestCase):
-
-    def set_up_all(self):
-        """
-        Run at the start of each test suite.
-        Whitelist Prerequistites:
-            Two Ports
-            testpmd can normally started
-        """
-        self.frames_to_send = 1
-        # Based on h/w type, choose how many ports to use
-        self.dutPorts = self.dut.get_ports()
-        # Verify that enough ports are available
-        self.verify(len(self.dutPorts) >= 1, "Insufficient ports")
-        portMask = dts.create_mask(self.dutPorts[:2])
-
-        self.pmdout = PmdOutput(self.dut)
-        self.pmdout.start_testpmd("Default", "--portmask=%s" % portMask)
-        self.dut.send_expect("set verbose 1", "testpmd> ")
-        self.dut.send_expect("start", "testpmd> ")
-
-        # get dest address from self.target port
-        out = self.dut.send_expect("show port info %d" % self.dutPorts[0], "testpmd> ")
-
-        self.dest = self.dut.get_mac_address(self.dutPorts[0])
-        mac_scanner = r"MAC address: (([\dA-F]{2}:){5}[\dA-F]{2})"
-
-        ret = dts.regexp(out, mac_scanner)
-        self.verify(ret is not None, "MAC address not found")
-        self.verify(cmp(ret.lower(), self.dest) == 0, "MAC address wrong")
-
-        self.max_mac_addr = dts.regexp(out, "Maximum number of MAC addresses: ([0-9]+)")
-
-    def set_up(self):
-        """
-        Run before each test case.
-        Nothing to do.
-        """
-        pass
-
-    def whitelist_send_packet(self, portid, destMac="00:11:22:33:44:55"):
-        """
-        Send 1 packet to portid.
-        """
-        itf = self.tester.get_interface(self.tester.get_local_port(portid))
-        self.tester.scapy_foreground()
-        self.tester.scapy_append('sendp([Ether(dst="%s", src="52:00:00:00:00:00")], iface="%s", count=%d)' % (destMac,
-                                                                                             itf, self.frames_to_send))
-        self.tester.scapy_execute()
-        time.sleep(5)
-
-    def test_whitelist_add_remove_mac_address(self):
-        """
-        Add mac address and check packet can received
-        Remove mac address and check packet can't received
-        """
-        # initialise first port without promiscuous mode
-        fake_mac_addr = "01:01:01:00:00:00"
-        portid = self.dutPorts[0]
-        txportid = self.dutPorts[1]
-        self.dut.send_expect("set promisc %d off" % portid, "testpmd> ")
-
-        out = self.dut.send_expect("show port stats %d" % txportid, "testpmd> ")
-        pre_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)")
-
-        # send one packet with the portid MAC address
-        self.whitelist_send_packet(portid, self.dest)
-        out = self.dut.send_expect("show port stats %d" % txportid, "testpmd> ")
-        cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)")
-        # check the packet increase
-        self.verify(int(cur_rxpkt) == int(pre_rxpkt) + self.frames_to_send,
-                    "Packet has not been received on default address")
-        # send one packet to a different MAC address
-        # new_mac = self.dut.get_mac_address(portid)
-        self.whitelist_send_packet(portid, fake_mac_addr)
-
-        pre_rxpkt = cur_rxpkt
-        out = self.dut.send_expect("show port stats %d" % txportid, "testpmd> ")
-        cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)")
-
-        # check the packet DO NOT increase
-        self.verify(int(cur_rxpkt) == int(pre_rxpkt),
-                    "Packet has been received on a new MAC address that has not been added yet")
-        # add the different MAC address
-        out = self.dut.send_expect("mac_addr add %d" % portid + " %s" % fake_mac_addr, "testpmd>")
-
-        # send again one packet to a different MAC address
-        self.whitelist_send_packet(portid, fake_mac_addr)
-
-        pre_rxpkt = cur_rxpkt
-        out = self.dut.send_expect("show port stats %d" % txportid, "testpmd> ")
-        cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)")
-
-        # check the packet increase
-        self.verify(int(cur_rxpkt) == int(pre_rxpkt) + self.frames_to_send,
-                    "Packet has not been received on a new MAC address that has been added to the port")
-
-        # remove the fake MAC address
-        out = self.dut.send_expect("mac_addr remove %d" % portid + " %s" % fake_mac_addr, "testpmd>")
-
-        # send again one packet to a different MAC address
-        self.whitelist_send_packet(portid, fake_mac_addr)
-
-        pre_rxpkt = cur_rxpkt
-        out = self.dut.send_expect("show port stats %d" % txportid, "testpmd> ")
-        cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)")
-
-        # check the packet increase
-        self.verify(int(cur_rxpkt) == int(pre_rxpkt),
-                    "Packet has been received on a new MAC address that has been removed from the port")
-        self.dut.send_expect("stop", "testpmd> ")
-
-    def test_whitelist_invalid_addresses(self):
-        """
-        Invalid operation:
-            Add NULL MAC should not be added
-            Remove using MAC will be failed
-            Add Same MAC twice will be failed
-            Add more than MAX number will be failed
-        """
-        portid = self.dutPorts[0]
-        fake_mac_addr = "00:00:00:00:00:00"
-
-        # add an address with all zeroes to the port (-EINVAL)
-        out = self.dut.send_expect("mac_addr add %d" % portid + " %s" % fake_mac_addr, "testpmd>")
-        self.verify("Invalid argument" in out, "Added a NULL MAC address")
-
-        # remove the default MAC address (-EADDRINUSE)
-        out = self.dut.send_expect("mac_addr remove %d" % portid + " %s" % self.dest, "testpmd>")
-        self.verify("Address already in use" in out, "default address removed")
-
-        # add same address 2 times
-        fake_mac_addr = "00:00:00:00:00:01"
-        out = self.dut.send_expect("mac_addr add %d" % portid + " %s" % fake_mac_addr, "testpmd>")
-        out = self.dut.send_expect("mac_addr add %d" % portid + " %s" % fake_mac_addr, "testpmd>")
-        self.verify("error" not in out, "added 2 times the same address with an error")
-
-        # add 1 address more that max number
-        i = 0
-        base_addr = "01:00:00:00:00:"
-        while i <= int(self.max_mac_addr):
-            new_addr = base_addr + "%0.2X" % i
-            out = self.dut.send_expect("mac_addr add %d" % portid + " %s" % new_addr, "testpmd>")
-            i = i + 1
-
-        self.verify("No space left on device" in out, "added 1 address more than max MAC addresses")
-
-    def tear_down(self):
-        """
-        Run after each test case.
-        Nothing to do.
-        """
-        pass
-
-    def tear_down_all(self):
-        """
-        Run after each test suite.
-        """
-        self.dut.send_expect("quit", "# ", 10)
-- 
1.7.4.4

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

* Re: [dts] [PATCH] change whitelist suite name to mac filter
  2015-11-05  6:53 [dts] [PATCH] change whitelist suite name to mac filter yongjie
@ 2015-11-05  9:27 ` Liu, Yong
  0 siblings, 0 replies; 2+ messages in thread
From: Liu, Yong @ 2015-11-05  9:27 UTC (permalink / raw)
  To: yongjie, dts

Applied. Thanks.

On 11/05/2015 02:53 PM, yongjie wrote:
> From: Gu yongjie <yongjiex.gu@intel.com>
>
>
> Signed-off-by: Gu yongjie <yongjiex.gu@intel.com>
> ---
>   executions/execution.cfg            |    2 +-
>   executions/execution_FVL.cfg        |    2 +-
>   executions/execution_smoke.cfg      |    2 +-
>   test_plans/mac_filter_test_plan.rst |  173 ++++++++++++++++++++++++++++++
>   test_plans/whitelist_test_plan.rst  |  173 ------------------------------
>   tests/TestSuite_mac_filter.py       |  200 +++++++++++++++++++++++++++++++++++
>   tests/TestSuite_whitelist.py        |  200 -----------------------------------
>   7 files changed, 376 insertions(+), 376 deletions(-)
>   create mode 100644 test_plans/mac_filter_test_plan.rst
>   delete mode 100644 test_plans/whitelist_test_plan.rst
>   create mode 100644 tests/TestSuite_mac_filter.py
>   delete mode 100644 tests/TestSuite_whitelist.py
>
> diff --git a/executions/execution.cfg b/executions/execution.cfg
> index 20d9bd6..1870ec2 100644
> --- a/executions/execution.cfg
> +++ b/executions/execution.cfg
> @@ -7,7 +7,7 @@ test_suites=
>       multiprocess,
>       timer,
>       blacklist,
> -    whitelist,
> +    mac_filter,
>       ieee1588,
>       checksum_offload,
>       jumboframes,
> diff --git a/executions/execution_FVL.cfg b/executions/execution_FVL.cfg
> index 7bdd2b7..b404676 100644
> --- a/executions/execution_FVL.cfg
> +++ b/executions/execution_FVL.cfg
> @@ -20,7 +20,7 @@ test_suites=
>       jumboframes,
>       multiprocess,
>       l2fwd,
> -    whitelist,
> +    mac_filter,
>       blacklist,
>       ipv4_reassembly,
>       scatter,
> diff --git a/executions/execution_smoke.cfg b/executions/execution_smoke.cfg
> index 7631f5c..d090f8a 100644
> --- a/executions/execution_smoke.cfg
> +++ b/executions/execution_smoke.cfg
> @@ -24,7 +24,7 @@ test_suites=
>       l2fwd,
>       pmd,
>       checksum_offload,
> -    whitelist,
> +    mac_filter,
>       blacklist
>   targets=
>       x86_64-native-linuxapp-gcc
> diff --git a/test_plans/mac_filter_test_plan.rst b/test_plans/mac_filter_test_plan.rst
> new file mode 100644
> index 0000000..6ed79cc
> --- /dev/null
> +++ b/test_plans/mac_filter_test_plan.rst
> @@ -0,0 +1,173 @@
> +.. Copyright (c) <2012>, 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.
> +
> +==================================================
> +Support of Whitelist Features by Poll Mode Drivers
> +==================================================
> +
> +Support igb_uio and vfio driver, if used vfio, kernel need 3.6+ and enable vt-d in bios.
> +When used vfio , used "modprobe vfio" and "modprobe vfio-pci" insmod vfiod driver, then used
> +"./tools/dpdk_nic_bind.py --bind=vfio-pci device_bus_id" to bind vfio driver to test driver.
> +
> +The support of Whitelist offload features by Poll Mode Drivers consists in:
> +
> +
> +Prerequisites
> +=============
> +
> +Assuming that at least a port is connected to a traffic generator,
> +launch the ``testpmd`` with the following arguments::
> +
> +  ./x86_64-default-linuxapp-gcc/build/app/test-pmd/testpmd -c 0xc3 -n 3 -- -i \
> +  --burst=1 --rxpt=0     --rxht=0 --rxwt=0 --txpt=36 --txht=0 --txwt=0 \
> +  --txfreet=32 --rxfreet=64 --mbcache=250 --portmask=0x3
> +
> +The -n command is used to select the number of memory channels. It should match the number of memory channels on that setup.
> +
> +Set the verbose level to 1 to display informations for each received packet::
> +
> +  testpmd> set verbose 1
> +
> +Show port infos for port 0 and store the default MAC address and the maximum
> +number of MAC addresses::
> +
> +  testpmd> show port info 0
> +
> +    ********************* Infos for port 0  *********************
> +    MAC address: 00:1B:21:4D:D2:24
> +    Link status: up
> +    Link speed: 10000 Mbps
> +    Link duplex: full-duplex
> +    Promiscuous mode: enabled
> +    Allmulticast mode: disabled
> +    Maximum number of MAC addresses: 127
> +
> +
> +Test Case: add/remove mac addresses
> +===================================
> +
> +Initialise first port without ``promiscuous mode``::
> +
> +  testpmd> set promisc 0 off
> +
> +Read the stats for port 0 before sending the packet::
> +
> +  testpmd> show port stats 8
> +
> +    ######################## NIC statistics for port 8  ########################
> +    RX-packets: 0          RX-errors: 0         RX-bytes: 64
> +    TX-packets: 0          TX-errors: 0         TX-bytes: 0
> +    ############################################################################
> +
> +Send a packet with default destination MAC address for port 0::
> +
> +  testpmd> show port stats 0
> +
> +    ######################## NIC statistics for port 8  ########################
> +    RX-packets: 1          RX-errors: 0         RX-bytes: 128
> +    TX-packets: 0          TX-errors: 0         TX-bytes: 0
> +    ############################################################################
> +
> +Verify that the packet was received (RX-packets incremented).
> +
> +Send a packet with destination MAC address different than the port 0 address,
> +let's call it A.::
> +
> +  testpmd> show port stats 0
> +
> +    ######################## NIC statistics for port 8  ########################
> +    RX-packets: 1          RX-errors: 0         RX-bytes: 128
> +    TX-packets: 0          TX-errors: 0         TX-bytes: 0
> +    ############################################################################
> +
> +Verify that the packet was not received (RX-packets not incremented).
> +
> +Add the MAC address A to the port 0::
> +
> +  testpmd> mac_addr add 0 <A>
> +  testpmd> show port stats 0
> +
> +
> +    ######################## NIC statistics for port 8  ########################
> +    RX-packets: 2          RX-errors: 0         RX-bytes: 192
> +    TX-packets: 0          TX-errors: 0         TX-bytes: 0
> +    ############################################################################
> +
> +Verify that the packet was received (RX-packets incremented).
> +
> +Remove the MAC address A to the port 0::
> +
> +  testpmd> mac_addr remove 0 <A>
> +  testpmd> show port stats 0
> +
> +
> +    ######################## NIC statistics for port 8  ########################
> +    RX-packets: 2          RX-errors: 0         RX-bytes: 192
> +    TX-packets: 0          TX-errors: 0         TX-bytes: 0
> +    ############################################################################
> +
> +Verify that the packet was not received (RX-packets not incremented).
> +
> +
> +Test Case: invalid addresses test
> +=================================
> +
> +Add a MAC address of all zeroes to the port 0::
> +
> +  testpmd> mac_addr add 0 00:00:00:00:00:00
> +
> +Verify that the response is "Invalid argument" (-EINVAL)
> +
> +Remove the default MAC address::
> +
> +  testpmd> mac_addr remove 0 <default MAC address>
> +
> +Verify that the response is "Address already in use" (-EADDRINUSE)
> +
> +Add two times the same address::
> +
> +  testpmd> mac_addr add 0 <A>
> +  testpmd> mac_addr add 0 <A>
> +
> +Verify that there is no error
> +
> +Add as many different addresses as maximum MAC addresses (n)::
> +
> +   testpmd> mac_addr add 0 <A>
> +   ... n-times
> +   testpmd> mac_addr add 0 <A+n>
> +
> +Add one more different address::
> +
> +   testpmd> mac_addr add 0 <A+n+1>
> +
> +Verify that the response is "No space left on device" (-ENOSPC)
> diff --git a/test_plans/whitelist_test_plan.rst b/test_plans/whitelist_test_plan.rst
> deleted file mode 100644
> index 6ed79cc..0000000
> --- a/test_plans/whitelist_test_plan.rst
> +++ /dev/null
> @@ -1,173 +0,0 @@
> -.. Copyright (c) <2012>, 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.
> -
> -==================================================
> -Support of Whitelist Features by Poll Mode Drivers
> -==================================================
> -
> -Support igb_uio and vfio driver, if used vfio, kernel need 3.6+ and enable vt-d in bios.
> -When used vfio , used "modprobe vfio" and "modprobe vfio-pci" insmod vfiod driver, then used
> -"./tools/dpdk_nic_bind.py --bind=vfio-pci device_bus_id" to bind vfio driver to test driver.
> -
> -The support of Whitelist offload features by Poll Mode Drivers consists in:
> -
> -
> -Prerequisites
> -=============
> -
> -Assuming that at least a port is connected to a traffic generator,
> -launch the ``testpmd`` with the following arguments::
> -
> -  ./x86_64-default-linuxapp-gcc/build/app/test-pmd/testpmd -c 0xc3 -n 3 -- -i \
> -  --burst=1 --rxpt=0     --rxht=0 --rxwt=0 --txpt=36 --txht=0 --txwt=0 \
> -  --txfreet=32 --rxfreet=64 --mbcache=250 --portmask=0x3
> -
> -The -n command is used to select the number of memory channels. It should match the number of memory channels on that setup.
> -
> -Set the verbose level to 1 to display informations for each received packet::
> -
> -  testpmd> set verbose 1
> -
> -Show port infos for port 0 and store the default MAC address and the maximum
> -number of MAC addresses::
> -
> -  testpmd> show port info 0
> -
> -    ********************* Infos for port 0  *********************
> -    MAC address: 00:1B:21:4D:D2:24
> -    Link status: up
> -    Link speed: 10000 Mbps
> -    Link duplex: full-duplex
> -    Promiscuous mode: enabled
> -    Allmulticast mode: disabled
> -    Maximum number of MAC addresses: 127
> -
> -
> -Test Case: add/remove mac addresses
> -===================================
> -
> -Initialise first port without ``promiscuous mode``::
> -
> -  testpmd> set promisc 0 off
> -
> -Read the stats for port 0 before sending the packet::
> -
> -  testpmd> show port stats 8
> -
> -    ######################## NIC statistics for port 8  ########################
> -    RX-packets: 0          RX-errors: 0         RX-bytes: 64
> -    TX-packets: 0          TX-errors: 0         TX-bytes: 0
> -    ############################################################################
> -
> -Send a packet with default destination MAC address for port 0::
> -
> -  testpmd> show port stats 0
> -
> -    ######################## NIC statistics for port 8  ########################
> -    RX-packets: 1          RX-errors: 0         RX-bytes: 128
> -    TX-packets: 0          TX-errors: 0         TX-bytes: 0
> -    ############################################################################
> -
> -Verify that the packet was received (RX-packets incremented).
> -
> -Send a packet with destination MAC address different than the port 0 address,
> -let's call it A.::
> -
> -  testpmd> show port stats 0
> -
> -    ######################## NIC statistics for port 8  ########################
> -    RX-packets: 1          RX-errors: 0         RX-bytes: 128
> -    TX-packets: 0          TX-errors: 0         TX-bytes: 0
> -    ############################################################################
> -
> -Verify that the packet was not received (RX-packets not incremented).
> -
> -Add the MAC address A to the port 0::
> -
> -  testpmd> mac_addr add 0 <A>
> -  testpmd> show port stats 0
> -
> -
> -    ######################## NIC statistics for port 8  ########################
> -    RX-packets: 2          RX-errors: 0         RX-bytes: 192
> -    TX-packets: 0          TX-errors: 0         TX-bytes: 0
> -    ############################################################################
> -
> -Verify that the packet was received (RX-packets incremented).
> -
> -Remove the MAC address A to the port 0::
> -
> -  testpmd> mac_addr remove 0 <A>
> -  testpmd> show port stats 0
> -
> -
> -    ######################## NIC statistics for port 8  ########################
> -    RX-packets: 2          RX-errors: 0         RX-bytes: 192
> -    TX-packets: 0          TX-errors: 0         TX-bytes: 0
> -    ############################################################################
> -
> -Verify that the packet was not received (RX-packets not incremented).
> -
> -
> -Test Case: invalid addresses test
> -=================================
> -
> -Add a MAC address of all zeroes to the port 0::
> -
> -  testpmd> mac_addr add 0 00:00:00:00:00:00
> -
> -Verify that the response is "Invalid argument" (-EINVAL)
> -
> -Remove the default MAC address::
> -
> -  testpmd> mac_addr remove 0 <default MAC address>
> -
> -Verify that the response is "Address already in use" (-EADDRINUSE)
> -
> -Add two times the same address::
> -
> -  testpmd> mac_addr add 0 <A>
> -  testpmd> mac_addr add 0 <A>
> -
> -Verify that there is no error
> -
> -Add as many different addresses as maximum MAC addresses (n)::
> -
> -   testpmd> mac_addr add 0 <A>
> -   ... n-times
> -   testpmd> mac_addr add 0 <A+n>
> -
> -Add one more different address::
> -
> -   testpmd> mac_addr add 0 <A+n+1>
> -
> -Verify that the response is "No space left on device" (-ENOSPC)
> diff --git a/tests/TestSuite_mac_filter.py b/tests/TestSuite_mac_filter.py
> new file mode 100644
> index 0000000..1749c62
> --- /dev/null
> +++ b/tests/TestSuite_mac_filter.py
> @@ -0,0 +1,200 @@
> +# BSD LICENSE
> +#
> +# Copyright(c) 2010-2014 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 Whitelist Features by Poll Mode Drivers
> +"""
> +
> +import dts
> +import time
> +from test_case import TestCase
> +from pmd_output import PmdOutput
> +
> +class TestWhitelist(TestCase):
> +
> +    def set_up_all(self):
> +        """
> +        Run at the start of each test suite.
> +        Whitelist Prerequistites:
> +            Two Ports
> +            testpmd can normally started
> +        """
> +        self.frames_to_send = 1
> +        # Based on h/w type, choose how many ports to use
> +        self.dutPorts = self.dut.get_ports()
> +        # Verify that enough ports are available
> +        self.verify(len(self.dutPorts) >= 1, "Insufficient ports")
> +        portMask = dts.create_mask(self.dutPorts[:2])
> +
> +        self.pmdout = PmdOutput(self.dut)
> +        self.pmdout.start_testpmd("Default", "--portmask=%s" % portMask)
> +        self.dut.send_expect("set verbose 1", "testpmd> ")
> +        self.dut.send_expect("start", "testpmd> ")
> +
> +        # get dest address from self.target port
> +        out = self.dut.send_expect("show port info %d" % self.dutPorts[0], "testpmd> ")
> +
> +        self.dest = self.dut.get_mac_address(self.dutPorts[0])
> +        mac_scanner = r"MAC address: (([\dA-F]{2}:){5}[\dA-F]{2})"
> +
> +        ret = dts.regexp(out, mac_scanner)
> +        self.verify(ret is not None, "MAC address not found")
> +        self.verify(cmp(ret.lower(), self.dest) == 0, "MAC address wrong")
> +
> +        self.max_mac_addr = dts.regexp(out, "Maximum number of MAC addresses: ([0-9]+)")
> +
> +    def set_up(self):
> +        """
> +        Run before each test case.
> +        Nothing to do.
> +        """
> +        pass
> +
> +    def whitelist_send_packet(self, portid, destMac="00:11:22:33:44:55"):
> +        """
> +        Send 1 packet to portid.
> +        """
> +        itf = self.tester.get_interface(self.tester.get_local_port(portid))
> +        self.tester.scapy_foreground()
> +        self.tester.scapy_append('sendp([Ether(dst="%s", src="52:00:00:00:00:00")], iface="%s", count=%d)' % (destMac,
> +                                                                                             itf, self.frames_to_send))
> +        self.tester.scapy_execute()
> +        time.sleep(5)
> +
> +    def test_add_remove_mac_address(self):
> +        """
> +        Add mac address and check packet can received
> +        Remove mac address and check packet can't received
> +        """
> +        # initialise first port without promiscuous mode
> +        fake_mac_addr = "01:01:01:00:00:00"
> +        portid = self.dutPorts[0]
> +        txportid = self.dutPorts[1]
> +        self.dut.send_expect("set promisc %d off" % portid, "testpmd> ")
> +
> +        out = self.dut.send_expect("show port stats %d" % txportid, "testpmd> ")
> +        pre_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)")
> +
> +        # send one packet with the portid MAC address
> +        self.whitelist_send_packet(portid, self.dest)
> +        out = self.dut.send_expect("show port stats %d" % txportid, "testpmd> ")
> +        cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)")
> +        # check the packet increase
> +        self.verify(int(cur_rxpkt) == int(pre_rxpkt) + self.frames_to_send,
> +                    "Packet has not been received on default address")
> +        # send one packet to a different MAC address
> +        # new_mac = self.dut.get_mac_address(portid)
> +        self.whitelist_send_packet(portid, fake_mac_addr)
> +
> +        pre_rxpkt = cur_rxpkt
> +        out = self.dut.send_expect("show port stats %d" % txportid, "testpmd> ")
> +        cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)")
> +
> +        # check the packet DO NOT increase
> +        self.verify(int(cur_rxpkt) == int(pre_rxpkt),
> +                    "Packet has been received on a new MAC address that has not been added yet")
> +        # add the different MAC address
> +        out = self.dut.send_expect("mac_addr add %d" % portid + " %s" % fake_mac_addr, "testpmd>")
> +
> +        # send again one packet to a different MAC address
> +        self.whitelist_send_packet(portid, fake_mac_addr)
> +
> +        pre_rxpkt = cur_rxpkt
> +        out = self.dut.send_expect("show port stats %d" % txportid, "testpmd> ")
> +        cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)")
> +
> +        # check the packet increase
> +        self.verify(int(cur_rxpkt) == int(pre_rxpkt) + self.frames_to_send,
> +                    "Packet has not been received on a new MAC address that has been added to the port")
> +
> +        # remove the fake MAC address
> +        out = self.dut.send_expect("mac_addr remove %d" % portid + " %s" % fake_mac_addr, "testpmd>")
> +
> +        # send again one packet to a different MAC address
> +        self.whitelist_send_packet(portid, fake_mac_addr)
> +
> +        pre_rxpkt = cur_rxpkt
> +        out = self.dut.send_expect("show port stats %d" % txportid, "testpmd> ")
> +        cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)")
> +
> +        # check the packet increase
> +        self.verify(int(cur_rxpkt) == int(pre_rxpkt),
> +                    "Packet has been received on a new MAC address that has been removed from the port")
> +        self.dut.send_expect("stop", "testpmd> ")
> +
> +    def test_invalid_addresses(self):
> +        """
> +        Invalid operation:
> +            Add NULL MAC should not be added
> +            Remove using MAC will be failed
> +            Add Same MAC twice will be failed
> +            Add more than MAX number will be failed
> +        """
> +        portid = self.dutPorts[0]
> +        fake_mac_addr = "00:00:00:00:00:00"
> +
> +        # add an address with all zeroes to the port (-EINVAL)
> +        out = self.dut.send_expect("mac_addr add %d" % portid + " %s" % fake_mac_addr, "testpmd>")
> +        self.verify("Invalid argument" in out, "Added a NULL MAC address")
> +
> +        # remove the default MAC address (-EADDRINUSE)
> +        out = self.dut.send_expect("mac_addr remove %d" % portid + " %s" % self.dest, "testpmd>")
> +        self.verify("Address already in use" in out, "default address removed")
> +
> +        # add same address 2 times
> +        fake_mac_addr = "00:00:00:00:00:01"
> +        out = self.dut.send_expect("mac_addr add %d" % portid + " %s" % fake_mac_addr, "testpmd>")
> +        out = self.dut.send_expect("mac_addr add %d" % portid + " %s" % fake_mac_addr, "testpmd>")
> +        self.verify("error" not in out, "added 2 times the same address with an error")
> +
> +        # add 1 address more that max number
> +        i = 0
> +        base_addr = "01:00:00:00:00:"
> +        while i <= int(self.max_mac_addr):
> +            new_addr = base_addr + "%0.2X" % i
> +            out = self.dut.send_expect("mac_addr add %d" % portid + " %s" % new_addr, "testpmd>")
> +            i = i + 1
> +
> +        self.verify("No space left on device" in out, "added 1 address more than max MAC addresses")
> +
> +    def tear_down(self):
> +        """
> +        Run after each test case.
> +        Nothing to do.
> +        """
> +        pass
> +
> +    def tear_down_all(self):
> +        """
> +        Run after each test suite.
> +        """
> +        self.dut.send_expect("quit", "# ", 10)
> diff --git a/tests/TestSuite_whitelist.py b/tests/TestSuite_whitelist.py
> deleted file mode 100644
> index 3e87b81..0000000
> --- a/tests/TestSuite_whitelist.py
> +++ /dev/null
> @@ -1,200 +0,0 @@
> -# BSD LICENSE
> -#
> -# Copyright(c) 2010-2014 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 Whitelist Features by Poll Mode Drivers
> -"""
> -
> -import dts
> -import time
> -from test_case import TestCase
> -from pmd_output import PmdOutput
> -
> -class TestWhitelist(TestCase):
> -
> -    def set_up_all(self):
> -        """
> -        Run at the start of each test suite.
> -        Whitelist Prerequistites:
> -            Two Ports
> -            testpmd can normally started
> -        """
> -        self.frames_to_send = 1
> -        # Based on h/w type, choose how many ports to use
> -        self.dutPorts = self.dut.get_ports()
> -        # Verify that enough ports are available
> -        self.verify(len(self.dutPorts) >= 1, "Insufficient ports")
> -        portMask = dts.create_mask(self.dutPorts[:2])
> -
> -        self.pmdout = PmdOutput(self.dut)
> -        self.pmdout.start_testpmd("Default", "--portmask=%s" % portMask)
> -        self.dut.send_expect("set verbose 1", "testpmd> ")
> -        self.dut.send_expect("start", "testpmd> ")
> -
> -        # get dest address from self.target port
> -        out = self.dut.send_expect("show port info %d" % self.dutPorts[0], "testpmd> ")
> -
> -        self.dest = self.dut.get_mac_address(self.dutPorts[0])
> -        mac_scanner = r"MAC address: (([\dA-F]{2}:){5}[\dA-F]{2})"
> -
> -        ret = dts.regexp(out, mac_scanner)
> -        self.verify(ret is not None, "MAC address not found")
> -        self.verify(cmp(ret.lower(), self.dest) == 0, "MAC address wrong")
> -
> -        self.max_mac_addr = dts.regexp(out, "Maximum number of MAC addresses: ([0-9]+)")
> -
> -    def set_up(self):
> -        """
> -        Run before each test case.
> -        Nothing to do.
> -        """
> -        pass
> -
> -    def whitelist_send_packet(self, portid, destMac="00:11:22:33:44:55"):
> -        """
> -        Send 1 packet to portid.
> -        """
> -        itf = self.tester.get_interface(self.tester.get_local_port(portid))
> -        self.tester.scapy_foreground()
> -        self.tester.scapy_append('sendp([Ether(dst="%s", src="52:00:00:00:00:00")], iface="%s", count=%d)' % (destMac,
> -                                                                                             itf, self.frames_to_send))
> -        self.tester.scapy_execute()
> -        time.sleep(5)
> -
> -    def test_whitelist_add_remove_mac_address(self):
> -        """
> -        Add mac address and check packet can received
> -        Remove mac address and check packet can't received
> -        """
> -        # initialise first port without promiscuous mode
> -        fake_mac_addr = "01:01:01:00:00:00"
> -        portid = self.dutPorts[0]
> -        txportid = self.dutPorts[1]
> -        self.dut.send_expect("set promisc %d off" % portid, "testpmd> ")
> -
> -        out = self.dut.send_expect("show port stats %d" % txportid, "testpmd> ")
> -        pre_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)")
> -
> -        # send one packet with the portid MAC address
> -        self.whitelist_send_packet(portid, self.dest)
> -        out = self.dut.send_expect("show port stats %d" % txportid, "testpmd> ")
> -        cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)")
> -        # check the packet increase
> -        self.verify(int(cur_rxpkt) == int(pre_rxpkt) + self.frames_to_send,
> -                    "Packet has not been received on default address")
> -        # send one packet to a different MAC address
> -        # new_mac = self.dut.get_mac_address(portid)
> -        self.whitelist_send_packet(portid, fake_mac_addr)
> -
> -        pre_rxpkt = cur_rxpkt
> -        out = self.dut.send_expect("show port stats %d" % txportid, "testpmd> ")
> -        cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)")
> -
> -        # check the packet DO NOT increase
> -        self.verify(int(cur_rxpkt) == int(pre_rxpkt),
> -                    "Packet has been received on a new MAC address that has not been added yet")
> -        # add the different MAC address
> -        out = self.dut.send_expect("mac_addr add %d" % portid + " %s" % fake_mac_addr, "testpmd>")
> -
> -        # send again one packet to a different MAC address
> -        self.whitelist_send_packet(portid, fake_mac_addr)
> -
> -        pre_rxpkt = cur_rxpkt
> -        out = self.dut.send_expect("show port stats %d" % txportid, "testpmd> ")
> -        cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)")
> -
> -        # check the packet increase
> -        self.verify(int(cur_rxpkt) == int(pre_rxpkt) + self.frames_to_send,
> -                    "Packet has not been received on a new MAC address that has been added to the port")
> -
> -        # remove the fake MAC address
> -        out = self.dut.send_expect("mac_addr remove %d" % portid + " %s" % fake_mac_addr, "testpmd>")
> -
> -        # send again one packet to a different MAC address
> -        self.whitelist_send_packet(portid, fake_mac_addr)
> -
> -        pre_rxpkt = cur_rxpkt
> -        out = self.dut.send_expect("show port stats %d" % txportid, "testpmd> ")
> -        cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)")
> -
> -        # check the packet increase
> -        self.verify(int(cur_rxpkt) == int(pre_rxpkt),
> -                    "Packet has been received on a new MAC address that has been removed from the port")
> -        self.dut.send_expect("stop", "testpmd> ")
> -
> -    def test_whitelist_invalid_addresses(self):
> -        """
> -        Invalid operation:
> -            Add NULL MAC should not be added
> -            Remove using MAC will be failed
> -            Add Same MAC twice will be failed
> -            Add more than MAX number will be failed
> -        """
> -        portid = self.dutPorts[0]
> -        fake_mac_addr = "00:00:00:00:00:00"
> -
> -        # add an address with all zeroes to the port (-EINVAL)
> -        out = self.dut.send_expect("mac_addr add %d" % portid + " %s" % fake_mac_addr, "testpmd>")
> -        self.verify("Invalid argument" in out, "Added a NULL MAC address")
> -
> -        # remove the default MAC address (-EADDRINUSE)
> -        out = self.dut.send_expect("mac_addr remove %d" % portid + " %s" % self.dest, "testpmd>")
> -        self.verify("Address already in use" in out, "default address removed")
> -
> -        # add same address 2 times
> -        fake_mac_addr = "00:00:00:00:00:01"
> -        out = self.dut.send_expect("mac_addr add %d" % portid + " %s" % fake_mac_addr, "testpmd>")
> -        out = self.dut.send_expect("mac_addr add %d" % portid + " %s" % fake_mac_addr, "testpmd>")
> -        self.verify("error" not in out, "added 2 times the same address with an error")
> -
> -        # add 1 address more that max number
> -        i = 0
> -        base_addr = "01:00:00:00:00:"
> -        while i <= int(self.max_mac_addr):
> -            new_addr = base_addr + "%0.2X" % i
> -            out = self.dut.send_expect("mac_addr add %d" % portid + " %s" % new_addr, "testpmd>")
> -            i = i + 1
> -
> -        self.verify("No space left on device" in out, "added 1 address more than max MAC addresses")
> -
> -    def tear_down(self):
> -        """
> -        Run after each test case.
> -        Nothing to do.
> -        """
> -        pass
> -
> -    def tear_down_all(self):
> -        """
> -        Run after each test suite.
> -        """
> -        self.dut.send_expect("quit", "# ", 10)

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

end of thread, other threads:[~2015-11-05  9:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-05  6:53 [dts] [PATCH] change whitelist suite name to mac filter yongjie
2015-11-05  9:27 ` Liu, Yong

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