From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 1D7601D90 for ; Wed, 29 Nov 2017 07:57:55 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Nov 2017 22:57:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,471,1505804400"; d="scan'208";a="13221780" Received: from unknown (HELO dpdk-fedora20.icx.intel.com) ([10.240.176.135]) by orsmga002.jf.intel.com with ESMTP; 28 Nov 2017 22:57:54 -0800 From: "xu,gang" To: dts@dpdk.org Cc: "xu,gang" Date: Wed, 29 Nov 2017 14:59:06 +0800 Message-Id: <1511938746-60629-1-git-send-email-gangx.xu@intel.com> X-Mailer: git-send-email 1.9.3 Subject: [dts] [PATCH V1] fix mac_filter check package 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, 29 Nov 2017 06:57:56 -0000 modify mac_filter test_add_remove_mac_address verify method Signed-off-by: xu,gang --- tests/TestSuite_mac_filter.py | 51 ++++++++++++++----------------------------- 1 file changed, 16 insertions(+), 35 deletions(-) diff --git a/tests/TestSuite_mac_filter.py b/tests/TestSuite_mac_filter.py index 1c58b87..60b2c51 100644 --- a/tests/TestSuite_mac_filter.py +++ b/tests/TestSuite_mac_filter.py @@ -100,56 +100,37 @@ class TestWhitelist(TestCase): 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]+)") - # 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(timeout=10) + self.verify(str.upper(self.dest) in out, + "Packet has not been received on default address") - pre_rxpkt = cur_rxpkt - out = self.dut.send_expect("show port stats %d" % portid, "testpmd> ") - cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)") + self.whitelist_send_packet(portid, fake_mac_addr) - # 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>") + out = self.dut.get_session_output(timeout=10) + self.verify(str.upper(fake_mac_addr) not in out, + "Packet has been received on a new MAC address that has not been added yet") + 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]+)") - - # 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") + out = self.dut.get_session_output(timeout=10) + self.verify(fake_mac_addr in out, + "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(timeout=10) + self.verify(fake_mac_addr not in out, + "Packet has been received on a new MAC address that has been removed from the port") - # 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): -- 1.9.3