From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 771632BDF for ; Wed, 28 Mar 2018 08:32:01 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Mar 2018 23:31:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,370,1517904000"; d="scan'208";a="42812879" Received: from unknown (HELO dpdk-fedora20.icx.intel.com) ([10.240.176.135]) by orsmga001.jf.intel.com with ESMTP; 27 Mar 2018 23:31:58 -0700 From: "han,yingya" To: dts@dpdk.org Cc: "han,yingya" Date: Wed, 28 Mar 2018 14:33:13 +0800 Message-Id: <1522218793-101964-1-git-send-email-yingyax.han@intel.com> X-Mailer: git-send-email 1.9.3 Subject: [dts] [PATCH V1]tests/mac_filter: fix FVL stats issue X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Mar 2018 06:32:02 -0000 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 --- 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