From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8E6A0A0487 for ; Mon, 29 Jul 2019 03:47:56 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2982D1BF3C; Mon, 29 Jul 2019 03:47:56 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 976F51BEE1 for ; Mon, 29 Jul 2019 03:47:54 +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 fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Jul 2019 18:47:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,320,1559545200"; d="scan'208";a="255062978" Received: from dpdk-moyufen01.sh.intel.com ([10.67.111.77]) by orsmga001.jf.intel.com with ESMTP; 28 Jul 2019 18:47:53 -0700 From: yufengmx To: dts@dpdk.org Cc: yufengmx Date: Mon, 29 Jul 2019 09:48:40 +0800 Message-Id: <1564364921-33333-4-git-send-email-yufengx.mo@intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1564364921-33333-1-git-send-email-yufengx.mo@intel.com> References: <1564364921-33333-1-git-send-email-yufengx.mo@intel.com> Subject: [dts] [PATCH V1 3/4] [next]framework/dut: add check condition for trex port 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: , Errors-To: dts-bounces@dpdk.org Sender: "dts" mapping add check condition for trex port mapping and fix indentation issue. Signed-off-by: yufengmx --- framework/dut.py | 59 ++++++++++++++++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/framework/dut.py b/framework/dut.py index cc36f72..48a5326 100644 --- a/framework/dut.py +++ b/framework/dut.py @@ -937,7 +937,12 @@ class Dut(Crb): dutpci = self.ports_info[dutPort]['pci'] if peer is not None: for remotePort in range(len(self.tester.ports_info)): - if self.tester.ports_info[remotePort]['pci'].lower() == peer.lower(): + if self.tester.ports_info[remotePort]['type'].lower() == 'trex': + if self.tester.ports_info[remotePort]['intf'].lower() == peer.lower(): + hits[remotePort] = True + self.ports_map[dutPort] = remotePort + break + elif self.tester.ports_info[remotePort]['pci'].lower() == peer.lower(): hits[remotePort] = True self.ports_map[dutPort] = remotePort break @@ -959,34 +964,34 @@ class Dut(Crb): ipv6 = self.get_ipv6_address(dutPort) if ipv6 == "Not connected": if self.tester.ports_info[remotePort].has_key('ipv4'): - out = self.tester.send_ping( - dutPort, self.tester.ports_info[remotePort]['ipv4'], - self.get_mac_address(dutPort)) - else: - continue - else: + out = self.tester.send_ping( + dutPort, self.tester.ports_info[remotePort]['ipv4'], + self.get_mac_address(dutPort)) + else: + continue + else: if getattr(self, 'send_ping6', None): - out = self.send_ping6( - dutPort, self.tester.ports_info[remotePort]['ipv6'], - self.get_mac_address(dutPort)) + out = self.send_ping6( + dutPort, self.tester.ports_info[remotePort]['ipv6'], + self.get_mac_address(dutPort)) else: - out = self.tester.send_ping6( - remotePort, ipv6, self.get_mac_address(dutPort)) - - if ('64 bytes from' in out): - self.logger.info("PORT MAP: [dut %d: tester %d]" % (dutPort, remotePort)) - self.ports_map[dutPort] = remotePort - hits[remotePort] = True - if self.crb['IP'] == self.crb['tester IP']: - # remove dut port act as tester port - remove_port = self.get_port_info(remotepci) - if remove_port is not None: - remove.append(remove_port) - # skip ping from those port already act as dut port - testerPort = self.tester.get_local_index(dutpci) - if testerPort != -1: - hits[testerPort] = True - break + out = self.tester.send_ping6( + remotePort, ipv6, self.get_mac_address(dutPort)) + + if ('64 bytes from' in out): + self.logger.info("PORT MAP: [dut %d: tester %d]" % (dutPort, remotePort)) + self.ports_map[dutPort] = remotePort + hits[remotePort] = True + if self.crb['IP'] == self.crb['tester IP']: + # remove dut port act as tester port + remove_port = self.get_port_info(remotepci) + if remove_port is not None: + remove.append(remove_port) + # skip ping from those port already act as dut port + testerPort = self.tester.get_local_index(dutpci) + if testerPort != -1: + hits[testerPort] = True + break for port in remove: self.ports_info.remove(port) -- 1.9.3