From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 126A5377E for ; Fri, 8 Sep 2017 11:34:26 +0200 (CEST) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Sep 2017 02:34:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,360,1500966000"; d="scan'208";a="126778803" Received: from dpdk-test47.sh.intel.com ([10.67.118.152]) by orsmga004.jf.intel.com with ESMTP; 08 Sep 2017 02:34:24 -0700 From: wang fei To: dts@dpdk.org Cc: wang fei Date: Fri, 8 Sep 2017 20:07:10 +0800 Message-Id: <1504872430-39616-1-git-send-email-feix.y.wang@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dts] [[patch v1]] framework/etgen.py: add in a function for ixia to send fixed number of packets 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: Fri, 08 Sep 2017 09:34:28 -0000 Signed-off-by: wang fei --- framework/etgen.py | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/framework/etgen.py b/framework/etgen.py index f45a96e..7ee24ac 100644 --- a/framework/etgen.py +++ b/framework/etgen.py @@ -141,7 +141,6 @@ class IxiaPacketGenerator(SSHConnection): self.logger = getLogger(self.NAME) super(IxiaPacketGenerator, self).__init__(self.get_ip_address(), self.NAME, - self.get_username(), self.get_password()) super(IxiaPacketGenerator, self).init_log(self.logger) @@ -869,3 +868,35 @@ class IxiaPacketGenerator(SSHConnection): retrieved capture buffer. Call packetGroupStats get before. """ return self._packetgroup_cget_value('averageLatency') + + def send_packets(self,portList,ratePercent,packetNum,delay=5,runTime=60): + """ + configure ixia to send fixed number of packets for each tx port + and returns the throughput for rx ports + """ + rxPortlist, txPortlist = self._configure_everything(portList, ratePercent) + time.sleep(delay) + self.send_expect("ixStopTransmit portList","%",5) + + self.send_expect("stream config -numFrames %s" % packetNum,"%",5) + self.send_expect("stream config -dma stopStream","%",5) + for txPort in txPortlist: + port = self.pci_to_port(self.tester.get_pci(txPort)) + self.send_expect("stream set %d %d %d 1" % (self.chasId, port['card'], port['port']),"%",5) + + self.send_expect("ixWritePortsToHardware portList","%",5) + self.send_expect("ixClearStats portList","%",5) + self.send_expect("ixStartTransmit portList","%",5) + time.sleep(runTime) + time.sleep(3) + + txPackets = 0 + rxPackets = 0 + for port in txPortlist: + self.stat_get_stat_all_stats(port) + txPackets += self.get_frames_sent() + rxPackets += self.get_frames_received() + self.logger.info("Transmitted packets :%s" % txPackets) + self.logger.info("Received packets :%s" % rxPackets) + + return txPackets,rxPackets -- 2.7.4