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 A0CDBA051B; Fri, 17 Jan 2020 07:47:23 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6DA1C1C433; Fri, 17 Jan 2020 07:47:23 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id F0D161C2FB for ; Fri, 17 Jan 2020 07:47:21 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Jan 2020 22:47:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,329,1574150400"; d="scan'208";a="219947021" Received: from dpdk-lihong-ub1604.sh.intel.com ([10.67.118.203]) by fmsmga007.fm.intel.com with ESMTP; 16 Jan 2020 22:47:19 -0800 From: lihong To: dts@dpdk.org Cc: lihong Date: Fri, 17 Jan 2020 07:20:11 +0800 Message-Id: <1579216811-12343-1-git-send-email-lihongx.ma@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dts] [PATCH V1] framework: update code about ixia to support py3 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" Signed-off-by: lihong --- framework/etgen.py | 16 ++++++++-------- framework/pktgen_ixia.py | 14 +++++++------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/framework/etgen.py b/framework/etgen.py index 5fa1a66..0ffe7b4 100644 --- a/framework/etgen.py +++ b/framework/etgen.py @@ -427,12 +427,12 @@ class IxiaPacketGenerator(SSHConnection): out = self.send_expect("set chasId [ixGetChassisID %s]" % self.tclServerIP, "% ") self.chasId = int(out.strip()) - out = self.send_expect("ixClearOwnership [list %s]" % string.join( - ['[list %d %d %d]' % (self.chasId, item['card'], item['port']) for item in self.ports], ' '), "% ", 10) + out = self.send_expect("ixClearOwnership [list %s]" % ' '.join( + ['[list %d %d %d]' % (self.chasId, item['card'], item['port']) for item in self.ports]), "% ", 10) if out.strip()[-1] != '0': return False - out = self.send_expect("ixTakeOwnership [list %s] force" % string.join( - ['[list %d %d %d]' % (self.chasId, item['card'], item['port']) for item in self.ports], ' '), "% ", 10) + out = self.send_expect("ixTakeOwnership [list %s] force" % ' '.join( + ['[list %d %d %d]' % (self.chasId, item['card'], item['port']) for item in self.ports]), "% ", 10) if out.strip()[-1] != '0': return False @@ -464,7 +464,7 @@ class IxiaPacketGenerator(SSHConnection): pl.append('[list %d %d %d]' % (self.chasId, item['card'], item['port'])) - self.add_tcl_cmd("set portList [list %s]" % string.join(pl, ' ')) + self.add_tcl_cmd("set portList [list %s]" % ' '.join(pl)) self.add_tcl_cmd("ixClearTimeStamp portList") self.add_tcl_cmd("ixWritePortsToHardware portList") @@ -475,8 +475,8 @@ class IxiaPacketGenerator(SSHConnection): Implement ports/streams configuration on specified ports. """ self.add_tcl_cmd("set portList [list %s]" % - string.join(['[list %d %d %d]' % - (self.chasId, item['card'], item['port']) for item in pList], ' ')) + ' '.join(['[list %d %d %d]' % + (self.chasId, item['card'], item['port']) for item in pList])) def send_ping6(self, pci, mac, ipv6): """ @@ -726,7 +726,7 @@ class IxiaPacketGenerator(SSHConnection): Configure Ixia for DCB. """ self.send_expect("source ./ixTcl1.0/ixiaDCB.tcl", "% ") - self.send_expect("configIxia %d %s" % (self.chasId, string.join(["%s" % ( + self.send_expect("configIxia %d %s" % (self.chasId, ' '.join(["%s" % ( repr(self.conRelation[port][n])) for port in [rxPort, txPort] for n in range(3)])), "% ", 100) def config_port_dcb(self, direction, tc): diff --git a/framework/pktgen_ixia.py b/framework/pktgen_ixia.py index f245d6d..937e219 100644 --- a/framework/pktgen_ixia.py +++ b/framework/pktgen_ixia.py @@ -600,15 +600,15 @@ class Ixia(SSHConnection): "set chasId [ixGetChassisID %s]" % self.tclServerIP, "% ") self.chasId = int(out.strip()) - out = self.send_expect("ixClearOwnership [list %s]" % string.join( + out = self.send_expect("ixClearOwnership [list %s]" % ' '.join( ['[list %d %d %d]' % (self.chasId, item['card'], item['port']) - for item in self.ports], ' '), + for item in self.ports]), "% ", 10) if out.strip()[-1] != '0': return False - out = self.send_expect("ixTakeOwnership [list %s] force" % string.join( + out = self.send_expect("ixTakeOwnership [list %s] force" % ' '.join( ['[list %d %d %d]' % (self.chasId, item['card'], item['port']) - for item in self.ports], ' '), + for item in self.ports]), "% ", 10) if out.strip()[-1] != '0': return False @@ -644,7 +644,7 @@ class Ixia(SSHConnection): pl.append('[list %d %d %d]' % ( self.chasId, item['card'], item['port'])) - self.add_tcl_cmd("set portList [list %s]" % string.join(pl, ' ')) + self.add_tcl_cmd("set portList [list %s]" % ' '.join(pl)) self.add_tcl_cmd("ixClearTimeStamp portList") self.add_tcl_cmd("ixWritePortsToHardware portList") @@ -655,7 +655,7 @@ class Ixia(SSHConnection): Implement ports/streams configuration on specified ports. """ self.add_tcl_cmd("set portList [list %s]" % - string.join(['[list %s]' % ixia_port for ixia_port in pList], ' ')) + ' '.join(['[list %s]' % ixia_port for ixia_port in pList])) def send_ping6(self, pci, mac, ipv6): """ @@ -961,7 +961,7 @@ class Ixia(SSHConnection): self.send_expect("source ./ixTcl1.0/ixiaDCB.tcl", "% ") self.send_expect("configIxia %d %s" % ( self.chasId, - string.join(["%s" % ( + ' '.join(["%s" % ( repr(self.conRelation[port][n])) for port in [rxPort, txPort] for n in range(3)])), -- 2.7.4