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 78A0095D6 for ; Thu, 28 Jan 2016 08:57:07 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP; 27 Jan 2016 23:57:07 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,357,1449561600"; d="scan'208";a="899907787" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga002.jf.intel.com with ESMTP; 27 Jan 2016 23:57:04 -0800 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id u0S7v2F4019046; Thu, 28 Jan 2016 15:57:02 +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 u0S7v0uT022064; Thu, 28 Jan 2016 15:57:02 +0800 Received: (from yliu84x@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id u0S7v0Ub022060; Thu, 28 Jan 2016 15:57:00 +0800 From: Yong Liu To: dts@dpdk.org Date: Thu, 28 Jan 2016 15:56:59 +0800 Message-Id: <1453967819-22027-1-git-send-email-yong.liu@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dts] [PATCH] framework tester: fix promisc and enhance random check 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: Thu, 28 Jan 2016 07:57:07 -0000 NetDevice should not use any more, all network object should get from net_device module. Show helpful message in packet random check function, transmit/sniff pcap will saved for later compare. Signed-off-by: Marvin Liu diff --git a/framework/tester.py b/framework/tester.py index 2a18712..5184d73 100644 --- a/framework/tester.py +++ b/framework/tester.py @@ -42,6 +42,7 @@ from net_device import GetNicObj from etgen import IxiaPacketGenerator, SoftwarePacketGenerator from settings import IXIA import random +from utils import GREEN class Tester(Crb): @@ -216,7 +217,7 @@ class Tester(Crb): try: for (pci_bus, pci_id) in self.pci_devices_info: addr_array = pci_bus.split(':') - port = NetDevice(self, addr_array[0], addr_array[1]) + port = GetNicObj(self, addr_array[0], addr_array[1]) itf = port.get_interface_name() self.enable_promisc(itf) except Exception as e: @@ -483,6 +484,8 @@ class Tester(Crb): sniff_f = getattr(module, "sniff_packets") load_f = getattr(module, "load_sniff_packets") compare_f = getattr(module, "compare_pktload") + strip_f = getattr(module, "strip_pktload") + save_f = getattr(module, "save_packets") pkts = [] # packet type random between tcp/udp/ipv6 random_type = ['TCP', 'UDP', 'IPv6_TCP', 'IPv6_UDP'] @@ -492,6 +495,7 @@ class Tester(Crb): for txport, rxport in portList: txIntf = self.get_interface(txport) rxIntf = self.get_interface(rxport) + print GREEN("Preparing transmit packets, please wait few minutes...") for num in range(pktnum): # chose random packet pkt_type = random.choice(random_type) @@ -511,6 +515,7 @@ class Tester(Crb): pkts.append(pkt) # send and sniff packets + save_f(pkts=pkts, filename="/tmp/%s_tx.pcap" % txIntf) inst = sniff_f(intf=rxIntf, count=pktnum, timeout=timeout) send_f(intf=txIntf, pkts=pkts, interval=interval) recv_pkts = load_f(inst) @@ -523,11 +528,14 @@ class Tester(Crb): return False # check each received packet content + print GREEN("Comparing sniff packets, please wait few minutes...") for idx in range(len(recv_pkts)): t_idx = recv_pkts[idx].strip_element_layer4('src') if compare_f(pkts[t_idx], recv_pkts[idx], "L4") is False: print "Pkt recevied index %d not match original " \ "index %d" % (idx, t_idx) + print "Sent: %s" % strip_f(pkts[t_idx], "L4") + print "Recv: %s" % strip_f(recv_pkts[idx], "L4") return False return True -- 1.8.4.2