[dts] [PATCH V1]tests/mac_filter: fix FVL stats issue
han,yingya
yingyax.han at intel.com
Tue Mar 20 05:40:49 CET 2018
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 at 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
More information about the dts
mailing list