test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH] mac_filter: Add multicast filtering test case
@ 2020-07-16 19:42 Owen Hilyard
       [not found] ` <20200716124853.2ccfc954@hermes.lan>
  2020-07-20 14:38 ` Owen Hilyard
  0 siblings, 2 replies; 4+ messages in thread
From: Owen Hilyard @ 2020-07-16 19:42 UTC (permalink / raw)
  To: dts
  Cc: qi.z.zhang, matan, stephen, jerinj, suanmingm, ohilyard, thomas,
	lylavoie

Sorry about sending this twice, I noticed after todays meeting that this was caught in the moderator queue and I want to get it out to the mailing list at large asap.

add multicast filtering test case
add multicast test case test plan

Signed-off-by: Owen Hilyard <ohilyard@iol.unh.edu>
---
 test_plans/mac_filter_test_plan.rst | 27 ++++++++++++++++++++
 tests/TestSuite_mac_filter.py       | 39 ++++++++++++++++++++++++++---
 2 files changed, 62 insertions(+), 4 deletions(-)

diff --git a/test_plans/mac_filter_test_plan.rst b/test_plans/mac_filter_test_plan.rst
index 1335e9f..e8a4f66 100644
--- a/test_plans/mac_filter_test_plan.rst
+++ b/test_plans/mac_filter_test_plan.rst
@@ -172,3 +172,30 @@ Add one more different address::
    testpmd> mac_addr add 0 <A+n+1>
 
 Verify that the response is "No space left on device" (-ENOSPC)
+
+Test Case: Multicast Filter
+===========================
+
+Initialize first port without ``promiscuous mode``::
+
+  testpmd> set promisc 0 off
+
+
+Add the multicast MAC address to the multicast filter::
+
+   testpmd> mcast_addr add 0 01:00:5E:00:00:00
+
+Send a packet with multicast destination MAC address to port 0::
+
+   port 0/queue 0: received 1 packets
+     src=52:00:00:00:00:00 - dst=01:00:5E:00:00:00 - type=0x0800 - length=60 - nb_segs=1 - hw    ptype: L2_ETHER L3_IPV4_EXT_UNKNOWN L4_UDP  - sw ptype: L2_ETHER L3_IPV4 L4_UDP  - l2_len=14 - l3_len=20 - l4_len=8 - Receive queue=0x0
+     ol_flags: PKT_RX_L4_CKSUM_GOOD PKT_RX_IP_CKSUM_GOOD PKT_RX_OUTER_L4_CKSUM_UNKNOWN
+
+
+Remove the multicast MAC address from the multicast filter::
+
+   testpmd> mcast_addr remove 0 01:00:5E:00:00:00
+
+Send a packet with multicast destination MAC address to port 0
+
+Verify that the packet was not received (Check for "received" in the output). There will be no output if the nic responds properly.
\ No newline at end of file
diff --git a/tests/TestSuite_mac_filter.py b/tests/TestSuite_mac_filter.py
index 9912d23..b762c91 100644
--- a/tests/TestSuite_mac_filter.py
+++ b/tests/TestSuite_mac_filter.py
@@ -82,14 +82,18 @@ class TestMacFilter(TestCase):
         """
         pass
 
-    def whitelist_send_packet(self, portid, destMac="00:11:22:33:44:55"):
+    def whitelist_send_packet(self, portid, destMac="00:11:22:33:44:55", count=-1):
         """
         Send 1 packet to portid.
         """
+        # You can't have an optional parameter use a class attribute as it's default value
+        if count == -1:
+            count = self.frames_to_send
+
         itf = self.tester.get_interface(self.tester.get_local_port(portid))
         pkt = Packet(pkt_type='UDP')
         pkt.config_layer('ether', {'src': '52:00:00:00:00:00', 'dst': destMac})
-        pkt.send_pkt(self.tester, tx_port=itf, count=4)
+        pkt.send_pkt(self.tester, tx_port=itf, count=count)
 
     def test_add_remove_mac_address(self):
         """
@@ -119,7 +123,7 @@ class TestMacFilter(TestCase):
         out = self.dut.get_session_output()
         # check the packet DO NOT increase
         self.verify("received" not in out,
-                    "Packet has been received on a new MAC address that has not been added yet")
+                    "Packet has been received on a new MAC address that has been removed from the port")
 
         # add the different MAC address
         self.dut.send_expect("mac_addr add %d" % portid + " %s" % fake_mac_addr, "testpmd>")
@@ -128,7 +132,7 @@ class TestMacFilter(TestCase):
         out = self.dut.get_session_output()
         cur_rxpkt = utils.regexp(out, "received ([0-9]+) packets")
         # check the packet increase
-        self.verify(int(cur_rxpkt)*self.frames_to_send == self.frames_to_send,
+        self.verify(int(cur_rxpkt) * self.frames_to_send == 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
@@ -176,6 +180,33 @@ class TestMacFilter(TestCase):
 
         self.verify("No space left on device" in out, "added 1 address more than max MAC addresses")
 
+    def test_multicast_filter(self):
+        """
+        Add mac address and check packet can received
+        Remove mac address and check packet can't received
+        """
+        # initialise first port without promiscuous mode
+        mcast_addr = "01:00:5E:00:00:00"
+        portid = self.dutPorts[0]
+        self.dut.send_expect(f"set promisc {portid:d} off", "testpmd> ")
+        self.dut.send_expect("clear port stats all", "testpmd> ")
+
+        self.dut.send_expect(f"mcast_addr add {portid:d} {mcast_addr}", "testpmd>")
+        self.whitelist_send_packet(portid, mcast_addr, count=1)
+        time.sleep(1)
+        out = self.dut.get_session_output()
+        self.verify("received" in out,
+                    "Packet has not been received when it should have on a broadcast address")
+
+        self.dut.send_expect(f"mcast_addr remove {portid:d} {mcast_addr}", "testpmd>")
+        self.whitelist_send_packet(portid, mcast_addr, count=1)
+        time.sleep(1)
+        out = self.dut.get_session_output()
+        self.verify("received" not in out,
+                    "Packet has been received when it should have ignored the broadcast")
+
+        self.dut.send_expect("stop", "testpmd> ")
+
     def tear_down(self):
         """
         Run after each test case.
-- 
2.25.1


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

* Re: [dts] [PATCH] mac_filter: Add multicast filtering test case
       [not found] ` <20200716124853.2ccfc954@hermes.lan>
@ 2020-07-17 13:37   ` Owen Hilyard
  0 siblings, 0 replies; 4+ messages in thread
From: Owen Hilyard @ 2020-07-17 13:37 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: dts, qi.z.zhang, matan, jerinj, suanmingm, Thomas Monjalon,
	Lincoln Lavoie

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

I'll add that into a patch with any other suggestions I see. I also added
that to my linter so it shouldn't happen again.

On Thu, Jul 16, 2020 at 3:49 PM Stephen Hemminger <
stephen@networkplumber.org> wrote:

> On Thu, 16 Jul 2020 15:42:36 -0400
> Owen Hilyard <ohilyard@iol.unh.edu> wrote:
>
> > Sorry about sending this twice, I noticed after todays meeting that this
> was caught in the moderator queue and I want to get it out to the mailing
> list at large asap.
> >
> > add multicast filtering test case
> > add multicast test case test plan
> >
> > Signed-off-by: Owen Hilyard <ohilyard@iol.unh.edu>
> > ---
> >  test_plans/mac_filter_test_plan.rst | 27 ++++++++++++++++++++
> >  tests/TestSuite_mac_filter.py       | 39 ++++++++++++++++++++++++++---
> >  2 files changed, 62 insertions(+), 4 deletions(-)
> >
> > diff --git a/test_plans/mac_filter_test_plan.rst
> b/test_plans/mac_filter_test_plan.rst
> > index 1335e9f..e8a4f66 100644
> > --- a/test_plans/mac_filter_test_plan.rst
> > +++ b/test_plans/mac_filter_test_plan.rst
> > @@ -172,3 +172,30 @@ Add one more different address::
> >     testpmd> mac_addr add 0 <A+n+1>
> >
> >  Verify that the response is "No space left on device" (-ENOSPC)
> > +
> > +Test Case: Multicast Filter
> > +===========================
> > +
> > +Initialize first port without ``promiscuous mode``::
> > +
> > +  testpmd> set promisc 0 off
> > +
> > +
> > +Add the multicast MAC address to the multicast filter::
> > +
> > +   testpmd> mcast_addr add 0 01:00:5E:00:00:00
> > +
> > +Send a packet with multicast destination MAC address to port 0::
> > +
> > +   port 0/queue 0: received 1 packets
> > +     src=52:00:00:00:00:00 - dst=01:00:5E:00:00:00 - type=0x0800 -
> length=60 - nb_segs=1 - hw    ptype: L2_ETHER L3_IPV4_EXT_UNKNOWN L4_UDP  -
> sw ptype: L2_ETHER L3_IPV4 L4_UDP  - l2_len=14 - l3_len=20 - l4_len=8 -
> Receive queue=0x0
> > +     ol_flags: PKT_RX_L4_CKSUM_GOOD PKT_RX_IP_CKSUM_GOOD
> PKT_RX_OUTER_L4_CKSUM_UNKNOWN
> > +
> > +
> > +Remove the multicast MAC address from the multicast filter::
> > +
> > +   testpmd> mcast_addr remove 0 01:00:5E:00:00:00
> > +
> > +Send a packet with multicast destination MAC address to port 0
> > +
> > +Verify that the packet was not received (Check for "received" in the
> output). There will be no output if the nic responds properly.
> > \ No newline at end of file
>
> Ok, but you must fix this.
>
> Please set your editor so it generates text files that always have a
> newline at the end.
> Although git supports files without ending newline, it is not something we
> want in this project.
>

[-- Attachment #2: Type: text/html, Size: 3381 bytes --]

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

* [dts] [PATCH] mac_filter: Add multicast filtering test case
  2020-07-16 19:42 [dts] [PATCH] mac_filter: Add multicast filtering test case Owen Hilyard
       [not found] ` <20200716124853.2ccfc954@hermes.lan>
@ 2020-07-20 14:38 ` Owen Hilyard
  2020-07-24  2:34   ` Tu, Lijuan
  1 sibling, 1 reply; 4+ messages in thread
From: Owen Hilyard @ 2020-07-20 14:38 UTC (permalink / raw)
  To: dts
  Cc: qi.z.zhang, matan, stephen, jerinj, suanmingm, ohilyard, thomas,
	lylavoie

Sorry about sending this twice, I noticed after todays meeting that this was caught in the moderator queue and I want to get it out to the mailing list at large asap.

add multicast filtering test case
add multicast test case test plan

Signed-off-by: Owen Hilyard <ohilyard@iol.unh.edu>
---
 test_plans/mac_filter_test_plan.rst | 27 ++++++++++++++++++++
 tests/TestSuite_mac_filter.py       | 39 ++++++++++++++++++++++++++---
 2 files changed, 62 insertions(+), 4 deletions(-)

diff --git a/test_plans/mac_filter_test_plan.rst b/test_plans/mac_filter_test_plan.rst
index 1335e9f..e8a4f66 100644
--- a/test_plans/mac_filter_test_plan.rst
+++ b/test_plans/mac_filter_test_plan.rst
@@ -172,3 +172,30 @@ Add one more different address::
    testpmd> mac_addr add 0 <A+n+1>
 
 Verify that the response is "No space left on device" (-ENOSPC)
+
+Test Case: Multicast Filter
+===========================
+
+Initialize first port without ``promiscuous mode``::
+
+  testpmd> set promisc 0 off
+
+
+Add the multicast MAC address to the multicast filter::
+
+   testpmd> mcast_addr add 0 01:00:5E:00:00:00
+
+Send a packet with multicast destination MAC address to port 0::
+
+   port 0/queue 0: received 1 packets
+     src=52:00:00:00:00:00 - dst=01:00:5E:00:00:00 - type=0x0800 - length=60 - nb_segs=1 - hw    ptype: L2_ETHER L3_IPV4_EXT_UNKNOWN L4_UDP  - sw ptype: L2_ETHER L3_IPV4 L4_UDP  - l2_len=14 - l3_len=20 - l4_len=8 - Receive queue=0x0
+     ol_flags: PKT_RX_L4_CKSUM_GOOD PKT_RX_IP_CKSUM_GOOD PKT_RX_OUTER_L4_CKSUM_UNKNOWN
+
+
+Remove the multicast MAC address from the multicast filter::
+
+   testpmd> mcast_addr remove 0 01:00:5E:00:00:00
+
+Send a packet with multicast destination MAC address to port 0
+
+Verify that the packet was not received (Check for "received" in the output). There will be no output if the nic responds properly.
\ No newline at end of file
diff --git a/tests/TestSuite_mac_filter.py b/tests/TestSuite_mac_filter.py
index 9912d23..b762c91 100644
--- a/tests/TestSuite_mac_filter.py
+++ b/tests/TestSuite_mac_filter.py
@@ -82,14 +82,18 @@ class TestMacFilter(TestCase):
         """
         pass
 
-    def whitelist_send_packet(self, portid, destMac="00:11:22:33:44:55"):
+    def whitelist_send_packet(self, portid, destMac="00:11:22:33:44:55", count=-1):
         """
         Send 1 packet to portid.
         """
+        # You can't have an optional parameter use a class attribute as it's default value
+        if count == -1:
+            count = self.frames_to_send
+
         itf = self.tester.get_interface(self.tester.get_local_port(portid))
         pkt = Packet(pkt_type='UDP')
         pkt.config_layer('ether', {'src': '52:00:00:00:00:00', 'dst': destMac})
-        pkt.send_pkt(self.tester, tx_port=itf, count=4)
+        pkt.send_pkt(self.tester, tx_port=itf, count=count)
 
     def test_add_remove_mac_address(self):
         """
@@ -119,7 +123,7 @@ class TestMacFilter(TestCase):
         out = self.dut.get_session_output()
         # check the packet DO NOT increase
         self.verify("received" not in out,
-                    "Packet has been received on a new MAC address that has not been added yet")
+                    "Packet has been received on a new MAC address that has been removed from the port")
 
         # add the different MAC address
         self.dut.send_expect("mac_addr add %d" % portid + " %s" % fake_mac_addr, "testpmd>")
@@ -128,7 +132,7 @@ class TestMacFilter(TestCase):
         out = self.dut.get_session_output()
         cur_rxpkt = utils.regexp(out, "received ([0-9]+) packets")
         # check the packet increase
-        self.verify(int(cur_rxpkt)*self.frames_to_send == self.frames_to_send,
+        self.verify(int(cur_rxpkt) * self.frames_to_send == 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
@@ -176,6 +180,33 @@ class TestMacFilter(TestCase):
 
         self.verify("No space left on device" in out, "added 1 address more than max MAC addresses")
 
+    def test_multicast_filter(self):
+        """
+        Add mac address and check packet can received
+        Remove mac address and check packet can't received
+        """
+        # initialise first port without promiscuous mode
+        mcast_addr = "01:00:5E:00:00:00"
+        portid = self.dutPorts[0]
+        self.dut.send_expect(f"set promisc {portid:d} off", "testpmd> ")
+        self.dut.send_expect("clear port stats all", "testpmd> ")
+
+        self.dut.send_expect(f"mcast_addr add {portid:d} {mcast_addr}", "testpmd>")
+        self.whitelist_send_packet(portid, mcast_addr, count=1)
+        time.sleep(1)
+        out = self.dut.get_session_output()
+        self.verify("received" in out,
+                    "Packet has not been received when it should have on a broadcast address")
+
+        self.dut.send_expect(f"mcast_addr remove {portid:d} {mcast_addr}", "testpmd>")
+        self.whitelist_send_packet(portid, mcast_addr, count=1)
+        time.sleep(1)
+        out = self.dut.get_session_output()
+        self.verify("received" not in out,
+                    "Packet has been received when it should have ignored the broadcast")
+
+        self.dut.send_expect("stop", "testpmd> ")
+
     def tear_down(self):
         """
         Run after each test case.
-- 
2.25.1


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

* Re: [dts] [PATCH] mac_filter: Add multicast filtering test case
  2020-07-20 14:38 ` Owen Hilyard
@ 2020-07-24  2:34   ` Tu, Lijuan
  0 siblings, 0 replies; 4+ messages in thread
From: Tu, Lijuan @ 2020-07-24  2:34 UTC (permalink / raw)
  To: Owen Hilyard, dts
  Cc: Zhang, Qi Z, matan, stephen, jerinj, suanmingm, thomas, lylavoie

Applied with comment changed.

> -----Original Message-----
> From: dts <dts-bounces@dpdk.org> On Behalf Of Owen Hilyard
> Sent: 2020年7月20日 22:38
> To: dts@dpdk.org
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; matan@mellanox.com;
> stephen@networkplumber.org; jerinj@marvell.com;
> suanmingm@mellanox.com; ohilyard@iol.unh.edu; thomas@monjalon.net;
> lylavoie@iol.unh.edu
> Subject: [dts] [PATCH] mac_filter: Add multicast filtering test case
> 
> Sorry about sending this twice, I noticed after todays meeting that this was
> caught in the moderator queue and I want to get it out to the mailing list at
> large asap.
> 
> add multicast filtering test case
> add multicast test case test plan
> 
> Signed-off-by: Owen Hilyard <ohilyard@iol.unh.edu>
> ---
>  test_plans/mac_filter_test_plan.rst | 27 ++++++++++++++++++++
>  tests/TestSuite_mac_filter.py       | 39 ++++++++++++++++++++++++++---
>  2 files changed, 62 insertions(+), 4 deletions(-)
> 
> diff --git a/test_plans/mac_filter_test_plan.rst
> b/test_plans/mac_filter_test_plan.rst
> index 1335e9f..e8a4f66 100644
> --- a/test_plans/mac_filter_test_plan.rst
> +++ b/test_plans/mac_filter_test_plan.rst
> @@ -172,3 +172,30 @@ Add one more different address::
>     testpmd> mac_addr add 0 <A+n+1>
> 
>  Verify that the response is "No space left on device" (-ENOSPC)
> +
> +Test Case: Multicast Filter
> +===========================
> +
> +Initialize first port without ``promiscuous mode``::
> +
> +  testpmd> set promisc 0 off
> +
> +
> +Add the multicast MAC address to the multicast filter::
> +
> +   testpmd> mcast_addr add 0 01:00:5E:00:00:00
> +
> +Send a packet with multicast destination MAC address to port 0::
> +
> +   port 0/queue 0: received 1 packets
> +     src=52:00:00:00:00:00 - dst=01:00:5E:00:00:00 - type=0x0800 - length=60 -
> nb_segs=1 - hw    ptype: L2_ETHER L3_IPV4_EXT_UNKNOWN L4_UDP  - sw
> ptype: L2_ETHER L3_IPV4 L4_UDP  - l2_len=14 - l3_len=20 - l4_len=8 - Receive
> queue=0x0
> +     ol_flags: PKT_RX_L4_CKSUM_GOOD PKT_RX_IP_CKSUM_GOOD
> + PKT_RX_OUTER_L4_CKSUM_UNKNOWN
> +
> +
> +Remove the multicast MAC address from the multicast filter::
> +
> +   testpmd> mcast_addr remove 0 01:00:5E:00:00:00
> +
> +Send a packet with multicast destination MAC address to port 0
> +
> +Verify that the packet was not received (Check for "received" in the output).
> There will be no output if the nic responds properly.
> \ No newline at end of file
> diff --git a/tests/TestSuite_mac_filter.py b/tests/TestSuite_mac_filter.py index
> 9912d23..b762c91 100644
> --- a/tests/TestSuite_mac_filter.py
> +++ b/tests/TestSuite_mac_filter.py
> @@ -82,14 +82,18 @@ class TestMacFilter(TestCase):
>          """
>          pass
> 
> -    def whitelist_send_packet(self, portid, destMac="00:11:22:33:44:55"):
> +    def whitelist_send_packet(self, portid, destMac="00:11:22:33:44:55",
> count=-1):
>          """
>          Send 1 packet to portid.
>          """
> +        # You can't have an optional parameter use a class attribute as it's default
> value
> +        if count == -1:
> +            count = self.frames_to_send
> +
>          itf = self.tester.get_interface(self.tester.get_local_port(portid))
>          pkt = Packet(pkt_type='UDP')
>          pkt.config_layer('ether', {'src': '52:00:00:00:00:00', 'dst': destMac})
> -        pkt.send_pkt(self.tester, tx_port=itf, count=4)
> +        pkt.send_pkt(self.tester, tx_port=itf, count=count)
> 
>      def test_add_remove_mac_address(self):
>          """
> @@ -119,7 +123,7 @@ class TestMacFilter(TestCase):
>          out = self.dut.get_session_output()
>          # check the packet DO NOT increase
>          self.verify("received" not in out,
> -                    "Packet has been received on a new MAC address that has not been
> added yet")
> +                    "Packet has been received on a new MAC address that
> + has been removed from the port")
> 
>          # add the different MAC address
>          self.dut.send_expect("mac_addr add %d" % portid + " %s" %
> fake_mac_addr, "testpmd>") @@ -128,7 +132,7 @@ class
> TestMacFilter(TestCase):
>          out = self.dut.get_session_output()
>          cur_rxpkt = utils.regexp(out, "received ([0-9]+) packets")
>          # check the packet increase
> -        self.verify(int(cur_rxpkt)*self.frames_to_send == self.frames_to_send,
> +        self.verify(int(cur_rxpkt) * self.frames_to_send ==
> + 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
> @@ -176,6 +180,33 @@ class TestMacFilter(TestCase):
> 
>          self.verify("No space left on device" in out, "added 1 address more than
> max MAC addresses")
> 
> +    def test_multicast_filter(self):
> +        """
> +        Add mac address and check packet can received
> +        Remove mac address and check packet can't received
> +        """
> +        # initialise first port without promiscuous mode
> +        mcast_addr = "01:00:5E:00:00:00"
> +        portid = self.dutPorts[0]
> +        self.dut.send_expect(f"set promisc {portid:d} off", "testpmd> ")
> +        self.dut.send_expect("clear port stats all", "testpmd> ")
> +
> +        self.dut.send_expect(f"mcast_addr add {portid:d} {mcast_addr}",
> "testpmd>")
> +        self.whitelist_send_packet(portid, mcast_addr, count=1)
> +        time.sleep(1)
> +        out = self.dut.get_session_output()
> +        self.verify("received" in out,
> +                    "Packet has not been received when it should have
> + on a broadcast address")
> +
> +        self.dut.send_expect(f"mcast_addr remove {portid:d} {mcast_addr}",
> "testpmd>")
> +        self.whitelist_send_packet(portid, mcast_addr, count=1)
> +        time.sleep(1)
> +        out = self.dut.get_session_output()
> +        self.verify("received" not in out,
> +                    "Packet has been received when it should have
> + ignored the broadcast")
> +
> +        self.dut.send_expect("stop", "testpmd> ")
> +
>      def tear_down(self):
>          """
>          Run after each test case.
> --
> 2.25.1


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

end of thread, other threads:[~2020-07-24  2:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-16 19:42 [dts] [PATCH] mac_filter: Add multicast filtering test case Owen Hilyard
     [not found] ` <20200716124853.2ccfc954@hermes.lan>
2020-07-17 13:37   ` Owen Hilyard
2020-07-20 14:38 ` Owen Hilyard
2020-07-24  2:34   ` 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).