test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH V1]tests/mac_filter: fix FVL stats issue
@ 2018-03-20  4:40 han,yingya
  2018-03-27  8:55 ` Liu, Yong
  0 siblings, 1 reply; 5+ messages in thread
From: han,yingya @ 2018-03-20  4:40 UTC (permalink / raw)
  To: dts; +Cc: han,yingya

In testpmd show port stats command is to read FVL register, and it's all packets of FVL.
Contrast to FLV , Niantic's stats, tx/rx packets , don't include packets filtered.
It's a difference between Niantic and FLV.
Signed-off-by: han,yingya <yingyax.han@intel.com>
---
 tests/TestSuite_mac_filter.py | 35 ++++++++++++++++-------------------
 1 file changed, 16 insertions(+), 19 deletions(-)

diff --git a/tests/TestSuite_mac_filter.py b/tests/TestSuite_mac_filter.py
index 1c58b87..a0c890d 100644
--- a/tests/TestSuite_mac_filter.py
+++ b/tests/TestSuite_mac_filter.py
@@ -107,48 +107,45 @@ class TestWhitelist(TestCase):
 
         # send one packet with the portid MAC address
         self.whitelist_send_packet(portid, self.dest)
-        out = self.dut.send_expect("show port stats %d" % portid, "testpmd> ")
-        cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)")
+        out = self.dut.get_session_output()
+        cur_rxpkt = utils.regexp(out, "received ([0-9]+) packets")
         # 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)
-
+        out = self.dut.get_session_output()
         pre_rxpkt = cur_rxpkt
-        out = self.dut.send_expect("show port stats %d" % portid, "testpmd> ")
-        cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)")
-
-        # check the packet DO NOT increase
-        self.verify(int(cur_rxpkt) == int(pre_rxpkt),
+        if not out:
+            cur_rxpkt = 0
+            # check the packet DO NOT increase
+            self.verify(int(cur_rxpkt) == int(pre_rxpkt) - self.frames_to_send,
                     "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>")
+        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)
-
+        out = self.dut.get_session_output()
         pre_rxpkt = cur_rxpkt
-        out = self.dut.send_expect("show port stats %d" % portid, "testpmd> ")
-        cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)")
+        cur_rxpkt = utils.regexp(out, "received ([0-9]+) packets")
 
         # 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>")
+        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)
-
+        out = self.dut.get_session_output()
         pre_rxpkt = cur_rxpkt
-        out = self.dut.send_expect("show port stats %d" % portid, "testpmd> ")
-        cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)")
-
-        # check the packet increase
-        self.verify(int(cur_rxpkt) == int(pre_rxpkt),
+        if not out:
+            cur_rxpkt = 0
+            # check the packet increase
+            self.verify(int(cur_rxpkt) == int(pre_rxpkt) - self.frames_to_send,
                     "Packet has been received on a new MAC address that has been removed from the port")
         self.dut.send_expect("stop", "testpmd> ")
 
-- 
1.9.3

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

* Re: [dts] [PATCH V1]tests/mac_filter: fix FVL stats issue
  2018-03-20  4:40 [dts] [PATCH V1]tests/mac_filter: fix FVL stats issue han,yingya
@ 2018-03-27  8:55 ` Liu, Yong
  2018-03-28  6:38   ` Han, YingyaX
  0 siblings, 1 reply; 5+ messages in thread
From: Liu, Yong @ 2018-03-27  8:55 UTC (permalink / raw)
  To: Han, YingyaX, dts; +Cc: Han, YingyaX

Yingya,
Some comments are inline.

Thanks,
Marvin

> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of han,yingya
> Sent: Tuesday, March 20, 2018 12:41 PM
> To: dts@dpdk.org
> Cc: Han, YingyaX <yingyax.han@intel.com>
> Subject: [dts] [PATCH V1]tests/mac_filter: fix FVL stats issue
> 
> In testpmd show port stats command is to read FVL register, and it's all
> packets of FVL.
> Contrast to FLV , Niantic's stats, tx/rx packets , don't include packets
> filtered.
> It's a difference between Niantic and FLV.
> Signed-off-by: han,yingya <yingyax.han@intel.com>
> ---
>  tests/TestSuite_mac_filter.py | 35 ++++++++++++++++-------------------
>  1 file changed, 16 insertions(+), 19 deletions(-)
> 
> diff --git a/tests/TestSuite_mac_filter.py b/tests/TestSuite_mac_filter.py
> index 1c58b87..a0c890d 100644
> --- a/tests/TestSuite_mac_filter.py
> +++ b/tests/TestSuite_mac_filter.py
> @@ -107,48 +107,45 @@ class TestWhitelist(TestCase):
> 
>          # send one packet with the portid MAC address
>          self.whitelist_send_packet(portid, self.dest)
> -        out = self.dut.send_expect("show port stats %d" % portid,
> "testpmd> ")
> -        cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)")
> +        out = self.dut.get_session_output()
> +        cur_rxpkt = utils.regexp(out, "received ([0-9]+) packets")

Checking packet number by Rx only verbose output is one alternative way to get receive number of packets.
You'd better add some comments about why here not use "port stats".

>          # 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)
> -
> +        out = self.dut.get_session_output()
>          pre_rxpkt = cur_rxpkt
> -        out = self.dut.send_expect("show port stats %d" % portid,
> "testpmd> ")
> -        cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)")
> -
> -        # check the packet DO NOT increase
> -        self.verify(int(cur_rxpkt) == int(pre_rxpkt),
> +        if not out:
> +            cur_rxpkt = 0
> +            # check the packet DO NOT increase
> +            self.verify(int(cur_rxpkt) == int(pre_rxpkt) -
> self.frames_to_send,
>                      "Packet has been received on a new MAC address that
> has not been added yet")


I think here just need to check no packet is arrived. Only need to check no "received" message in output is enough. 

>          # add the different MAC address
> -        out = self.dut.send_expect("mac_addr add %d" % portid + " %s" %
> fake_mac_addr, "testpmd>")
> +        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)
> -
> +        out = self.dut.get_session_output()
>          pre_rxpkt = cur_rxpkt
> -        out = self.dut.send_expect("show port stats %d" % portid,
> "testpmd> ")
> -        cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)")
> +        cur_rxpkt = utils.regexp(out, "received ([0-9]+) packets")
> 
>          # 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>")
> +        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)
> -
> +        out = self.dut.get_session_output()
>          pre_rxpkt = cur_rxpkt
> -        out = self.dut.send_expect("show port stats %d" % portid,
> "testpmd> ")
> -        cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)")
> -
> -        # check the packet increase
> -        self.verify(int(cur_rxpkt) == int(pre_rxpkt),
> +        if not out:
> +            cur_rxpkt = 0
> +            # check the packet increase
> +            self.verify(int(cur_rxpkt) == int(pre_rxpkt) -
> self.frames_to_send,

Same comment as previous one.

>                      "Packet has been received on a new MAC address that
> has been removed from the port")
>          self.dut.send_expect("stop", "testpmd> ")
> 
> --
> 1.9.3

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

* Re: [dts] [PATCH V1]tests/mac_filter: fix FVL stats issue
  2018-03-27  8:55 ` Liu, Yong
@ 2018-03-28  6:38   ` Han, YingyaX
  0 siblings, 0 replies; 5+ messages in thread
From: Han, YingyaX @ 2018-03-28  6:38 UTC (permalink / raw)
  To: Liu, Yong, dts

Thank you for your suggestion. I have revised it and submitted the patch.

Thanks ,
yingya

-----Original Message-----
From: Liu, Yong 
Sent: Tuesday, March 27, 2018 4:56 PM
To: Han, YingyaX <yingyax.han@intel.com>; dts@dpdk.org
Cc: Han, YingyaX <yingyax.han@intel.com>
Subject: RE: [dts] [PATCH V1]tests/mac_filter: fix FVL stats issue

Yingya,
Some comments are inline.

Thanks,
Marvin

> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of han,yingya
> Sent: Tuesday, March 20, 2018 12:41 PM
> To: dts@dpdk.org
> Cc: Han, YingyaX <yingyax.han@intel.com>
> Subject: [dts] [PATCH V1]tests/mac_filter: fix FVL stats issue
> 
> In testpmd show port stats command is to read FVL register, and it's 
> all packets of FVL.
> Contrast to FLV , Niantic's stats, tx/rx packets , don't include 
> packets filtered.
> It's a difference between Niantic and FLV.
> Signed-off-by: han,yingya <yingyax.han@intel.com>
> ---
>  tests/TestSuite_mac_filter.py | 35 
> ++++++++++++++++-------------------
>  1 file changed, 16 insertions(+), 19 deletions(-)
> 
> diff --git a/tests/TestSuite_mac_filter.py 
> b/tests/TestSuite_mac_filter.py index 1c58b87..a0c890d 100644
> --- a/tests/TestSuite_mac_filter.py
> +++ b/tests/TestSuite_mac_filter.py
> @@ -107,48 +107,45 @@ class TestWhitelist(TestCase):
> 
>          # send one packet with the portid MAC address
>          self.whitelist_send_packet(portid, self.dest)
> -        out = self.dut.send_expect("show port stats %d" % portid,
> "testpmd> ")
> -        cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)")
> +        out = self.dut.get_session_output()
> +        cur_rxpkt = utils.regexp(out, "received ([0-9]+) packets")

Checking packet number by Rx only verbose output is one alternative way to get receive number of packets.
You'd better add some comments about why here not use "port stats".

>          # 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)
> -
> +        out = self.dut.get_session_output()
>          pre_rxpkt = cur_rxpkt
> -        out = self.dut.send_expect("show port stats %d" % portid,
> "testpmd> ")
> -        cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)")
> -
> -        # check the packet DO NOT increase
> -        self.verify(int(cur_rxpkt) == int(pre_rxpkt),
> +        if not out:
> +            cur_rxpkt = 0
> +            # check the packet DO NOT increase
> +            self.verify(int(cur_rxpkt) == int(pre_rxpkt) -
> self.frames_to_send,
>                      "Packet has been received on a new MAC address 
> that has not been added yet")


I think here just need to check no packet is arrived. Only need to check no "received" message in output is enough. 

>          # add the different MAC address
> -        out = self.dut.send_expect("mac_addr add %d" % portid + " %s" %
> fake_mac_addr, "testpmd>")
> +        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)
> -
> +        out = self.dut.get_session_output()
>          pre_rxpkt = cur_rxpkt
> -        out = self.dut.send_expect("show port stats %d" % portid,
> "testpmd> ")
> -        cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)")
> +        cur_rxpkt = utils.regexp(out, "received ([0-9]+) packets")
> 
>          # 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>")
> +        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)
> -
> +        out = self.dut.get_session_output()
>          pre_rxpkt = cur_rxpkt
> -        out = self.dut.send_expect("show port stats %d" % portid,
> "testpmd> ")
> -        cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)")
> -
> -        # check the packet increase
> -        self.verify(int(cur_rxpkt) == int(pre_rxpkt),
> +        if not out:
> +            cur_rxpkt = 0
> +            # check the packet increase
> +            self.verify(int(cur_rxpkt) == int(pre_rxpkt) -
> self.frames_to_send,

Same comment as previous one.

>                      "Packet has been received on a new MAC address 
> that has been removed from the port")
>          self.dut.send_expect("stop", "testpmd> ")
> 
> --
> 1.9.3

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

* Re: [dts] [PATCH V1]tests/mac_filter: fix FVL stats issue
  2018-03-28  6:33 han,yingya
@ 2018-03-29 10:53 ` Liu, Yong
  0 siblings, 0 replies; 5+ messages in thread
From: Liu, Yong @ 2018-03-29 10:53 UTC (permalink / raw)
  To: han,yingya, dts

Thanks, yingya. Merged with some modifications in commit log.

On 03/28/2018 02:33 PM, han,yingya wrote:
> In testpmd "show port stats" command is to read FVL register.
> Niantic and FVL have different packet statistics when using this command.
> For consistency, call the get_session_output function to check the packet.
> Signed-off-by: han,yingya<yingyax.han@intel.com>

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

* [dts] [PATCH V1]tests/mac_filter: fix FVL stats issue
@ 2018-03-28  6:33 han,yingya
  2018-03-29 10:53 ` Liu, Yong
  0 siblings, 1 reply; 5+ messages in thread
From: han,yingya @ 2018-03-28  6:33 UTC (permalink / raw)
  To: dts; +Cc: han,yingya

In testpmd "show port stats" command is to read FVL register.
Niantic and FVL have different packet statistics when using this command.
For consistency, call the get_session_output function to check the packet.
Signed-off-by: han,yingya <yingyax.han@intel.com>
---
 tests/TestSuite_mac_filter.py | 46 ++++++++++++++++---------------------------
 1 file changed, 17 insertions(+), 29 deletions(-)

diff --git a/tests/TestSuite_mac_filter.py b/tests/TestSuite_mac_filter.py
index 1c58b87..70e23ec 100644
--- a/tests/TestSuite_mac_filter.py
+++ b/tests/TestSuite_mac_filter.py
@@ -99,56 +99,44 @@ class TestWhitelist(TestCase):
         fake_mac_addr = "00:01:01:00:00:00"
         portid = self.dutPorts[0]
         self.dut.send_expect("set promisc %d off" % portid, "testpmd> ")
-
         self.dut.send_expect("clear port stats all", "testpmd> ")
 
-        out = self.dut.send_expect("show port stats %d" % portid, "testpmd> ")
-        pre_rxpkt = utils.regexp(out, "RX-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" % portid, "testpmd> ")
-        cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)")
+
+        # Niantic and FVL have different packet statistics when using the
+        # "show port stats" command. For consistency, can't use this command.
+        out = self.dut.get_session_output()
+        cur_rxpkt = utils.regexp(out, "received ([0-9]+) packets")
         # check the packet increase
-        self.verify(int(cur_rxpkt) == int(pre_rxpkt) + self.frames_to_send,
+        self.verify(int(cur_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" % portid, "testpmd> ")
-        cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)")
-
+        out = self.dut.get_session_output()
         # check the packet DO NOT increase
-        self.verify(int(cur_rxpkt) == int(pre_rxpkt),
+        self.verify("received" not in out,
                     "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>")
 
+        # add the different MAC address
+        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" % portid, "testpmd> ")
-        cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)")
-
+        out = self.dut.get_session_output()
+        cur_rxpkt = utils.regexp(out, "received ([0-9]+) packets")
         # check the packet increase
-        self.verify(int(cur_rxpkt) == int(pre_rxpkt) + self.frames_to_send,
+        self.verify(int(cur_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>")
-
+        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" % portid, "testpmd> ")
-        cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)")
-
+        out = self.dut.get_session_output()
         # check the packet increase
-        self.verify(int(cur_rxpkt) == int(pre_rxpkt),
+        self.verify("received" not in out,
                     "Packet has been received on a new MAC address that has been removed from the port")
         self.dut.send_expect("stop", "testpmd> ")
 
-- 
1.9.3

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

end of thread, other threads:[~2018-03-29  3:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-20  4:40 [dts] [PATCH V1]tests/mac_filter: fix FVL stats issue han,yingya
2018-03-27  8:55 ` Liu, Yong
2018-03-28  6:38   ` Han, YingyaX
2018-03-28  6:33 han,yingya
2018-03-29 10:53 ` 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).