From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 470B89A92 for ; Wed, 27 May 2015 09:02:19 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP; 27 May 2015 00:02:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,502,1427785200"; d="scan'208";a="577405618" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga003.jf.intel.com with ESMTP; 27 May 2015 00:02:17 -0700 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id t4R72FP2023839; Wed, 27 May 2015 15:02:15 +0800 Received: from shecgisg003.sh.intel.com (localhost [127.0.0.1]) by shecgisg003.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id t4R72DxM023724; Wed, 27 May 2015 15:02:15 +0800 Received: (from huilongx@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id t4R72DC7023720; Wed, 27 May 2015 15:02:13 +0800 From: "huilong,xu" To: dts@dpdk.org Date: Wed, 27 May 2015 15:02:05 +0800 Message-Id: <1432710125-23668-4-git-send-email-huilongx.xu@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1432710125-23668-1-git-send-email-huilongx.xu@intel.com> References: <1432710125-23668-1-git-send-email-huilongx.xu@intel.com> Subject: [dts] [dts 4/4] [PATCH V1] update vlan get package function 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, 27 May 2015 07:02:20 -0000 From: huilong xu changed list: 1. used tcpdump get package replace scapy get package Signed-off-by: huilong xu --- tests/TestSuite_vlan.py | 103 ++++++++++++++++++++++++++++------------------ 1 files changed, 63 insertions(+), 40 deletions(-) diff --git a/tests/TestSuite_vlan.py b/tests/TestSuite_vlan.py index 66dc4f3..fba68e3 100644 --- a/tests/TestSuite_vlan.py +++ b/tests/TestSuite_vlan.py @@ -1,6 +1,6 @@ # BSD LICENSE # -# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# Copyright(c) 2010-2015 Intel Corporation. All rights reserved. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -29,9 +29,12 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + """ DPDK Test suite. + Test the support of VLAN Offload Features by Poll Mode Drivers. + """ import dts @@ -51,6 +54,8 @@ class TestVlan(TestCase): Vlan Prerequistites """ + global dutRxPortId + global dutTxPortId # Based on h/w type, choose how many ports to use ports = self.dut.get_ports() @@ -58,105 +63,120 @@ class TestVlan(TestCase): # Verify that enough ports are available self.verify(len(ports) >= 2, "Insufficient ports") - global valports valports = [_ for _ in ports if self.tester.get_local_port(_) != -1] - + dutRxPortId = valports[0] + dutTxPortId = valports[1] portMask = dts.create_mask(valports[:2]) self.pmdout = PmdOutput(self.dut) - self.pmdout.start_testpmd("all", "--portmask=%s" % portMask) + self.pmdout.start_testpmd("all", "--portmask=%s" % portMask ) self.dut.send_expect("set verbose 1", "testpmd> ") out = self.dut.send_expect("set fwd mac", "testpmd> ") - self.dut.send_expect("vlan set strip off %s" % valports[0], "testpmd> ") + + if self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single"]: + self.dut.send_expect("set promisc all off", "testpmd> ") + self.dut.send_expect("vlan set filter on %s"%dutRxPortId, "testpmd> ") + + self.dut.send_expect("vlan set strip off %s" % dutRxPortId, "testpmd> ") self.verify('Set mac packet forwarding mode' in out, "set fwd rxonly error") + + def start_tcpdump(self): + port = self.tester.get_local_port(dutTxPortId) + rxItf = self.tester.get_interface(port) + self.tester.send_expect("rm -rf ./vlan_test.cap","#") + self.tester.send_expect("tcpdump -i %s -w ./vlan_test.cap 2> /dev/null& "%rxItf,"#" ) + + def get_tcpdump_package(self): + self.tester.send_expect("killall tcpdump","#") + return self.tester.send_expect("tcpdump -nn -e -v -r ./vlan_test.cap","#") def vlan_send_packet(self, vid, num=1): """ Send $num of packet to portid """ - - port = self.tester.get_local_port(valports[0]) + # The package stream : testTxPort->dutRxPort->dutTxport->testRxPort + port = self.tester.get_local_port(dutRxPortId) txItf = self.tester.get_interface(port) - port = self.tester.get_local_port(valports[1]) + port = self.tester.get_local_port(dutTxPortId) rxItf = self.tester.get_interface(port) - mac = self.dut.get_mac_address(valports[0]) + # the package dect mac must is dut tx port id when the port promisc is off + mac = self.dut.get_mac_address(dutRxPortId) # FIXME send a burst with only num packet - self.tester.scapy_background() - self.tester.scapy_append('p=sniff(iface="%s",count=1,timeout=5)' % rxItf) - self.tester.scapy_append('RESULT=str(p)') - self.tester.scapy_foreground() self.tester.scapy_append('sendp([Ether(dst="%s")/Dot1Q(vlan=%s)/IP(len=46)], iface="%s")' % (mac, vid, txItf)) self.tester.scapy_execute() - def set_up(self): """ Run before each test case. """ pass - def test_vlan_enable_receipt(self): """ Enable receipt of VLAN packets """ - self.dut.send_expect("set promisc all off", "testpmd> ") - self.dut.send_expect("rx_vlan add 1 %s" % valports[0], "testpmd> ") - self.dut.send_expect("start", "testpmd> ", 120) + self.dut.send_expect("rx_vlan add 1 %s" % dutRxPortId, "testpmd> ") + self.dut.send_expect("vlan set strip off %s" % dutRxPortId, "testpmd> ") + self.dut.send_expect("start", "testpmd> ", 120) + out = self.dut.send_expect("show port info %s" % dutRxPortId, "testpmd> ", 20) + + self.start_tcpdump() self.vlan_send_packet(1) - out = self.tester.scapy_get_result() - self.verify("vlan=1L" in out, "Wrong vlan:" + out) + #out = self.tester.scapy_get_result() + out = self.get_tcpdump_package() + self.verify("vlan 1" in out, "Wrong vlan:" + out) self.dut.send_expect("stop", "testpmd> ") + def test_vlan_disable_receipt(self): """ Disable receipt of VLAN packets """ - self.dut.send_expect("rx_vlan rm 1 %s" % valports[0], "testpmd> ") - self.dut.send_expect("start", "testpmd> ", 120) + self.dut.send_expect("rx_vlan rm 1 %s" % dutRxPortId, "testpmd> ") + self.dut.send_expect("start", "testpmd> ", 120) + self.start_tcpdump() self.vlan_send_packet(1) - out = self.tester.scapy_get_result() - self.verify("vlan=1L" not in out, "Wrong vlan:" + out) + out = self.get_tcpdump_package() + self.verify("vlan 1" not in out, "Wrong vlan:" + out) out = self.dut.send_expect("stop", "testpmd> ") + def test_vlan_strip_config_on(self): - """ - Set vlan strip on - """ - self.dut.send_expect("vlan set strip on %s" % valports[0], "testpmd> ", 20) - self.dut.send_expect("set promisc all off", "testpmd> ", 20) - out = self.dut.send_expect("vlan set strip on %s" % valports[0], "testpmd> ", 20) + + self.dut.send_expect("vlan set strip on %s" % dutRxPortId, "testpmd> ", 20) + self.dut.send_expect("rx_vlan add 1 %s" % dutRxPortId, "testpmd> ", 20) + out = self.dut.send_expect("show port info %s" % dutRxPortId, "testpmd> ", 20) self.verify("strip on" in out, "Wrong strip:" + out) self.dut.send_expect("start", "testpmd> ", 120) + self.start_tcpdump() self.vlan_send_packet(1) - out = self.tester.scapy_get_result() - self.verify("vlan=1L" not in out, "Wrong vlan:" + out) + out = self.get_tcpdump_package() + self.verify("vlan 1" not in out, "Wrong vlan:" + out) out = self.dut.send_expect("quit", "#", 120) def test_vlan_strip_config_off(self): - """ - Set vlan strip off - """ - self.dut.send_expect("vlan set strip off %s" % valports[0], "testpmd> ", 20) - out = self.dut.send_expect("show port info %s" % valports[0], "testpmd> ", 20) + self.dut.send_expect("vlan set strip off %s" % dutRxPortId, "testpmd> ", 20) + self.dut.send_expect("rx_vlan add 1 %s" % dutRxPortId, "testpmd> ", 20) + out = self.dut.send_expect("show port info %s" % dutRxPortId, "testpmd> ", 20) self.verify("strip off" in out, "Wrong strip:" + out) self.dut.send_expect("set nbport 2", "testpmd> ") self.dut.send_expect("start", "testpmd> ", 120) + self.start_tcpdump() self.vlan_send_packet(1) - out = self.tester.scapy_get_result() - self.verify("vlan=1L" in out, "Wrong strip vlan:" + out) + out = self.get_tcpdump_package() + self.verify("vlan 1" in out, "Wrong strip vlan:" + out) out = self.dut.send_expect("stop", "testpmd> ", 120) def FAILING_test_vlan_enable_vlan_insertion(self): @@ -186,7 +206,10 @@ class TestVlan(TestCase): out = self.tester.scapy_get_result() self.verify("vlan=1L" in out, "Wrong vlan: " + out) - self.dut.send_expect("quit", "# ", 30) + if self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single"]: + self.dut.send_expect("stop", "testpmd> ", 30) + else: + self.dut.send_expect("quit", "# ", 30) def tear_down(self): """ -- 1.7.4.4