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 49F7CA00E6 for ; Mon, 5 Aug 2019 07:49:59 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2A4251BE70; Mon, 5 Aug 2019 07:49:59 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 846CF1BE6B for ; Mon, 5 Aug 2019 07:49:57 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Aug 2019 22:49:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,348,1559545200"; d="scan'208";a="372969522" Received: from dpdk-moyufen01.sh.intel.com ([10.67.111.77]) by fmsmga005.fm.intel.com with ESMTP; 04 Aug 2019 22:49:55 -0700 From: yufengmx To: dts@dpdk.org Cc: yufengmx Date: Mon, 5 Aug 2019 13:50:41 +0800 Message-Id: <1564984244-151448-8-git-send-email-yufengx.mo@intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1564984244-151448-1-git-send-email-yufengx.mo@intel.com> References: <1564984244-151448-1-git-send-email-yufengx.mo@intel.com> Subject: [dts] [PATCH V1 7/10] [next]framework/pktgen_ixia: add new feature and fix 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" internal bug *. remove duration option used in ixia module, move duration option in testing scenario methods(latency/loss/throughput) in pktgen_base module. *. remove un-used parameters in _start_transmission method. *. set part of information logger display to debug level. *. set PacketGenerator class logger as Ixia class logger. *. remove un-used libs import. *. fix pep8 issue. Signed-off-by: yufengmx --- framework/pktgen_ixia.py | 219 ++++++++++++++++++++++------------------------- 1 file changed, 100 insertions(+), 119 deletions(-) diff --git a/framework/pktgen_ixia.py b/framework/pktgen_ixia.py index 80481fe..22d1f2c 100644 --- a/framework/pktgen_ixia.py +++ b/framework/pktgen_ixia.py @@ -36,7 +36,6 @@ from pprint import pformat from ssh_connection import SSHConnection from settings import SCAPY2IXIA -from logger import getLogger from utils import (convert_int2ip, convert_ip2int, convert_mac2long, convert_mac2str) @@ -52,15 +51,15 @@ class Ixia(SSHConnection): IXIA performance measurement class. """ - def __init__(self, tester, ixiaPorts): + def __init__(self, tester, ixiaPorts, logger): self.tester = tester self.NAME = PKTGEN_IXIA - self.logger = getLogger(self.NAME) super(Ixia, self).__init__( - self.get_ip_address(), - self.NAME, - self.tester.get_username(), - self.get_password()) + self.get_ip_address(), + self.NAME, + self.tester.get_username(), + self.get_password()) + self.logger = logger super(Ixia, self).init_log(self.logger) self.tcl_cmds = [] @@ -177,8 +176,8 @@ class Ixia(SSHConnection): """ macAddr = macAddr.upper() return "%s %s %s %s %s %s" % ( - macAddr[:2], macAddr[3:5], macAddr[6:8], - macAddr[9:11], macAddr[12:14], macAddr[15:17]) + macAddr[:2], macAddr[3:5], macAddr[6:8], + macAddr[9:11], macAddr[12:14], macAddr[15:17]) def set_ether_fields(self, fields, default_fields): """ @@ -204,15 +203,15 @@ class Ixia(SSHConnection): prefix = 'sa' if name == 'src' else 'da' if action == 'dec' and mac_end: cmds.append('stream config -{0} "{1}"'.format( - prefix, mac_end)) + prefix, mac_end)) else: cmds.append('stream config -{0} "{1}"'.format( - prefix, mac_start)) + prefix, mac_start)) if step: cmds.append('stream config -{0}Step {1}'.format(prefix, step)) if action: cmds.append('stream config -{0}RepeatCounter {1}'.format( - prefix, addr_mode.get(action))) + prefix, addr_mode.get(action))) if mac_end: mac_start_int = convert_mac2long(mac_start) mac_end_int = convert_mac2long(mac_end) @@ -225,7 +224,7 @@ class Ixia(SSHConnection): if flow_num: cmds.append('stream config -num{0} {1}'.format( - prefix.upper(), flow_num)) + prefix.upper(), flow_num)) # clear default field after it has been set default_fields.pop(name) # if some filed not set, set it here @@ -233,7 +232,8 @@ class Ixia(SSHConnection): for name, config in default_fields.iteritems(): ip_start = config.get('start') prefix = 'sa' if name == 'src' else 'da' - cmds.append('stream config -{0} "{1}"'.format(prefix, ip_start)) + cmds.append( + 'stream config -{0} "{1}"'.format(prefix, ip_start)) return cmds @@ -250,8 +250,8 @@ class Ixia(SSHConnection): # if vm has been set, pick pcap fields' as default value if fields: default_fields = { - 'src': { 'action': 'default', 'start': src,}, - 'dst': { 'action': 'default', 'start': dst,},} + 'src': {'action': 'default', 'start': src, }, + 'dst': {'action': 'default', 'start': dst, }, } # set custom setting for field actions cmds = self.set_ether_fields(fields, default_fields) # set them in tcl commands group @@ -273,7 +273,7 @@ class Ixia(SSHConnection): # no change to IP address regardless of IpAddrRepeatCount 'idle': 'ipIdle', # set default - 'default': 'ipIdle',} + 'default': 'ipIdle', } cmds = [] for name, config in fields.iteritems(): default_config = default_fields.get(name) @@ -290,9 +290,10 @@ class Ixia(SSHConnection): else: flow_num = None - mask = config.get('mask') + mask = config.get('mask') _step = config.get('step') - step = int(_step) if _step and isinstance(_step, (str, unicode)) else \ + step = int(_step) \ + if _step and isinstance(_step, (str, unicode)) else \ _step or 1 action = config.get('action') # get ixia command prefix @@ -300,16 +301,16 @@ class Ixia(SSHConnection): # set command if action == 'dec' and ip_end: cmds.append('ip config -{0}IpAddr "{1}"'.format( - prefix, ip_end)) + prefix, ip_end)) else: cmds.append('ip config -{0}IpAddr "{1}"'.format( - prefix, ip_start)) + prefix, ip_start)) if flow_num: cmds.append('ip config -{0}IpAddrRepeatCount {1}'.format( - prefix, flow_num)) + prefix, flow_num)) cmds.append('ip config -{0}IpAddrMode {1}'.format( - prefix, addr_mode.get(action or 'default'))) + prefix, addr_mode.get(action or 'default'))) if mask: cmds.append("ip config -{0}IpMask '{1}'".format(prefix, mask)) @@ -324,7 +325,7 @@ class Ixia(SSHConnection): prefix = 'source' if name == 'src' else 'dest' cmds.append('ip config -{0}IpAddr "{1}"'.format(prefix, ip_start)) cmds.append('ip config -{0}IpAddrMode {1}'.format( - prefix, addr_mode.get('default'))) + prefix, addr_mode.get('default'))) return cmds @@ -340,8 +341,8 @@ class Ixia(SSHConnection): if fields: # pick pcap fields' as default value default_fields = { - 'src': { 'action': 'default', 'start': src,}, - 'dst': { 'action': 'default', 'start': dst,},} + 'src': {'action': 'default', 'start': src, }, + 'dst': {'action': 'default', 'start': dst, }, } # set custom setting for field actions cmds = self.set_ip_fields(fields, default_fields) # append custom setting @@ -366,9 +367,9 @@ class Ixia(SSHConnection): self.add_tcl_cmd("protocol config -name ipV6") self.add_tcl_cmd('ipV6 setDefault') self.add_tcl_cmd('ipV6 config -destAddr "%s"' % - self.ipv6_to_tcl_format(dst)) + self.ipv6_to_tcl_format(dst)) self.add_tcl_cmd('ipV6 config -sourceAddr "%s"' % - self.ipv6_to_tcl_format(src)) + self.ipv6_to_tcl_format(src)) self.add_tcl_cmd('ipV6 config -flowLabel %d' % fl) self.add_tcl_cmd('ipV6 config -nextHeader %d' % nh) self.add_tcl_cmd('ipV6 config -hopLimit %d' % hlim) @@ -425,7 +426,7 @@ class Ixia(SSHConnection): # Generate random VlanID tag for each frame 'random': 'vCtrRandom', # No change to VlanID tag regardless of repeat - 'idle': 'vIdle',} + 'idle': 'vIdle', } cmds = [] for name, config in fields.iteritems(): fv_name = '8021Q.{0}'.format(name) @@ -440,7 +441,6 @@ class Ixia(SSHConnection): flow_num = None step = config.get('step') or 1 action = config.get('action') - #------------------------------------------------ # set command if step: cmds.append('vlan config -step {0}'.format(step)) @@ -448,7 +448,7 @@ class Ixia(SSHConnection): cmds.append('vlan config -repeat {0}'.format(flow_num)) if action: cmds.append('vlan config -mode {0}'.format( - addr_mode.get(action))) + addr_mode.get(action))) return cmds def dot1q(self, port, vm, prio, id, vlan, type): @@ -490,7 +490,7 @@ class Ixia(SSHConnection): transmit_mode = stream_config.get('transmit_mode') or TRANSMIT_CONT if transmit_mode == TRANSMIT_S_BURST: cmds = self.config_single_burst_stream( - stream_config.get('txmode'), rate_percent) + stream_config.get('txmode'), rate_percent) self.add_tcl_cmds(cmds) else: self.config_ixia_stream( @@ -521,20 +521,21 @@ class Ixia(SSHConnection): def config_single_burst_stream(self, txmode, rate_percent): """ configure burst stream. """ gapUnits = { - # (default) Sets units of time for gap to nanoseconds - 'ns': 'gapNanoSeconds', - # Sets units of time for gap to microseconds - 'us': 'gapMicroSeconds', - # Sets units of time for gap to milliseconds - 'm': 'gapMilliSeconds', - # Sets units of time for gap to seconds - 's': 'gapSeconds',} + # (default) Sets units of time for gap to nanoseconds + 'ns': 'gapNanoSeconds', + # Sets units of time for gap to microseconds + 'us': 'gapMicroSeconds', + # Sets units of time for gap to milliseconds + 'm': 'gapMilliSeconds', + # Sets units of time for gap to seconds + 's': 'gapSeconds', } pkt_count = 1 burst_count = txmode.get('total_pkts', 32) frameType = txmode.get('frameType') or {} time_unit = frameType.get('type', 'ns') gapUnit = gapUnits.get(time_unit) \ - if time_unit in gapUnits.keys() else gapUnits.get('ns') + if time_unit in gapUnits.keys() else \ + gapUnits.get('ns') # The inter-stream gap is the delay in clock ticks between stream. # This delay comes after the receive trigger is enabled. Setting this # option to 0 means no delay. (default = 960.0) @@ -556,11 +557,11 @@ class Ixia(SSHConnection): "stream config -numBursts {0}".format(burst_count), "stream config -ifg {0}".format(ifg), "stream config -ifgType gapFixed", -# "stream config -enableIbg true", # reserve -# "stream config -ibg {0}".format(ibg), # reserve -# "stream config -enableIsg true", # reserve -# "stream config -isg {0}".format(isg), # reserve - "stream config -frameSizeType sizeFixed",] + #"stream config -enableIbg true", # reserve + #"stream config -ibg {0}".format(ibg), # reserve + #"stream config -enableIsg true", # reserve + #"stream config -isg {0}".format(isg), # reserve + "stream config -frameSizeType sizeFixed", ] return frame_cmds @@ -598,7 +599,7 @@ class Ixia(SSHConnection): return False out = self.send_expect( - "set chasId [ixGetChassisID %s]" % self.tclServerIP, "% ") + "set chasId [ixGetChassisID %s]" % self.tclServerIP, "% ") self.chasId = int(out.strip()) self.send_expect("ixClearOwnership [list %s]" % string.join( @@ -636,10 +637,10 @@ class Ixia(SSHConnection): self.add_tcl_cmd("port config -autonegotiate false") self.add_tcl_cmd("port config -enableRsFec true") self.add_tcl_cmd("port set %d %d %d" % ( - self.chasId,item['card'], item['port'])) + self.chasId, item['card'], item['port'])) pl.append('[list %d %d %d]' % ( - self.chasId, item['card'], item['port'])) + self.chasId, item['card'], item['port'])) self.add_tcl_cmd("set portList [list %s]" % string.join(pl, ' ')) @@ -727,7 +728,7 @@ class Ixia(SSHConnection): return port_info def get_ixia_port(self, port): - port_info= self.get_ixia_port_info(port) + port_info = self.get_ixia_port_info(port) ixia_port = "%d %d %d" % (self.chasId, port_info['card'], port_info['port']) return ixia_port @@ -771,7 +772,7 @@ class Ixia(SSHConnection): Run latency performance test and return latency statistics. """ rxPortlist, txPortlist = self._configure_everything( - portList, ratePercent, True) + portList, ratePercent, True) return self.get_packet_latency(rxPortlist) def get_packet_latency(self, rxPortlist): @@ -795,7 +796,7 @@ class Ixia(SSHConnection): Run throughput performance test and return throughput statistics. """ rxPortlist, txPortlist = self._configure_everything( - port_list, rate_percent) + port_list, rate_percent) return self.get_transmission_results(rxPortlist, txPortlist, delay) def is_packet_ordered(self, port_list, delay): @@ -831,7 +832,7 @@ class Ixia(SSHConnection): Prepare and configure IXIA ports for performance test. """ rxPortlist, txPortlist = self.prepare_port_list( - port_list, rate_percent, latency) + port_list, rate_percent, latency) self.prepare_ixia_for_transmission(txPortlist, rxPortlist) self.configure_transmission() self.start_transmission() @@ -872,7 +873,7 @@ class Ixia(SSHConnection): # port init self.config_port([self.get_ixia_port_info(port) - for port in txPortlist.union(rxPortlist)]) + for port in txPortlist.union(rxPortlist)]) # calculate total streams of ports for (txPort, rxPort, pcapFile, option) in portList: @@ -908,7 +909,7 @@ class Ixia(SSHConnection): """ self.add_tcl_cmd("ixClearStats portList") self.set_ixia_port_list([self.get_ixia_port(port) - for port in txPortlist]) + for port in txPortlist]) self.add_tcl_cmd("ixWriteConfigToHardware portList") # Wait for changes to take affect and make sure links are up self.add_tcl_cmd("after 1000") @@ -957,12 +958,12 @@ class Ixia(SSHConnection): """ self.send_expect("source ./ixTcl1.0/ixiaDCB.tcl", "% ") self.send_expect("configIxia %d %s" % ( - self.chasId, - string.join(["%s" % ( - repr(self.conRelation[port][n])) - for port in [rxPort, txPort] - for n in range(3)])), - "% ", 100) + self.chasId, + string.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): """ @@ -993,24 +994,26 @@ class Ixia(SSHConnection): "pauseControl config -pauseControlType ieee8023x", 'pauseControl config -da "{0}"'.format(dst_mac), "pauseControl config -pauseTime {0}".format(pause_time), - "pauseControl set {0}".format(ixia_port),] + "pauseControl set {0}".format(ixia_port), ] self.add_tcl_cmds(flow_ctrl_cmds) def cfgStreamDcb(self, stream, rate, prio, types): """ Configure Stream for DCB. """ - self.send_expect("configStream %s %s %s %s" % (stream, rate, prio, types), "% ", 100) + self.send_expect("configStream %s %s %s %s" % + (stream, rate, prio, types), "% ", 100) def get_connection_relation(self, dutPorts): """ Get the connect relations between DUT and Ixia. """ for port in dutPorts: - info = self.tester.get_pci(self.tester.get_local_port(port)).split('.') + info = self.tester.get_pci( + self.tester.get_local_port(port)).split('.') self.conRelation[port] = [ - int(info[0]), int(info[1]), - repr(self.tester.dut.get_mac_address(port).replace(':', ' ').upper())] + int(info[0]), int(info[1]), + repr(self.tester.dut.get_mac_address(port).replace(':', ' ').upper())] return self.conRelation def config_pktGroup_rx(self, ixia_port): @@ -1018,7 +1021,8 @@ class Ixia(SSHConnection): Sets the transmit Packet Group configuration of the stream Default streamID is 1 """ - self.add_tcl_cmd("port config -receiveMode $::portRxModeWidePacketGroup") + self.add_tcl_cmd( + "port config -receiveMode $::portRxModeWidePacketGroup") self.add_tcl_cmd("port set %s" % ixia_port) self.add_tcl_cmd("packetGroup setDefault") self.add_tcl_cmd("packetGroup config -latencyControl cutThrough") @@ -1046,7 +1050,8 @@ class Ixia(SSHConnection): """ ixia_port = self.get_ixia_port(port_number) self.send_expect("ixStopPortPacketGroups %s" % ixia_port, "%", 100) - self.send_expect("packetGroupStats get %s 0 16384" % ixia_port, "%", 100) + self.send_expect( + "packetGroupStats get %s 0 16384" % ixia_port, "%", 100) self.send_expect("packetGroupStats getGroup 0", "%", 100) def close(self): @@ -1089,7 +1094,7 @@ class Ixia(SSHConnection): """ ixia_port = self.get_ixia_port(port_number) command = 'captureBuffer get {0} {1} {2}'.format( - ixia_port, first_frame, last_frame) + ixia_port, first_frame, last_frame) self.send_expect(command, '%', 60) def ixia_export_buffer_to_file(self, frames_filename): @@ -1194,7 +1199,7 @@ class Ixia(SSHConnection): nic_single_core_perf test case use """ rxPortlist, txPortlist = self.prepare_port_list( - port_list, rate_percent, latency) + port_list, rate_percent, latency) self.prepare_ixia_for_transmission(txPortlist, rxPortlist) self.start_transmission() self.clear_tcl_commands() @@ -1233,9 +1238,9 @@ class Ixia(SSHConnection): return rxPackets - #--------------------------------------------------------- + # # extend methods for pktgen subclass `IxiaPacketGenerator - #--------------------------------------------------------- + # def disconnect(self): ''' quit from ixia server ''' pass @@ -1244,7 +1249,6 @@ class Ixia(SSHConnection): ''' start ixia ports ''' self.configure_transmission(run_opt) self.start_transmission() - time.sleep(run_opt.get('duration') or 5) def remove_all_streams(self): ''' delete all streams on all ixia ports ''' @@ -1252,7 +1256,7 @@ class Ixia(SSHConnection): return for item in self.ports: cmd = 'port reset {0} {1} {2}'.format( - self.chasId, item['card'], item['port']) + self.chasId, item['card'], item['port']) self.send_expect(cmd, "%", 10) def reset(self, ports=None): @@ -1303,7 +1307,7 @@ class Ixia(SSHConnection): 'rx_bps': 0, 'rx_pps': 0, 'tx_bps': 0, - 'tx_pps': 0,} + 'tx_pps': 0, } time.sleep(0.5) return stats @@ -1332,7 +1336,7 @@ class Ixia(SSHConnection): 'rx_bps': bpsRate, 'rx_pps': rate, 'tx_bps': 0, - 'tx_pps': 0,} + 'tx_pps': 0, } return stats @@ -1343,7 +1347,7 @@ class Ixia(SSHConnection): methods = { 'throughput': self.get_throughput_stat, 'loss': self.get_loss_stat, - 'latency': self.get_latency_stat,} + 'latency': self.get_latency_stat, } if mode not in methods.keys(): msg = "not support mode <{0}>".format(mode) raise Exception(msg) @@ -1358,6 +1362,7 @@ class IxiaPacketGenerator(PacketGenerator): """ Ixia packet generator """ + def __init__(self, tester): # ixia management self.pktgen_type = PKTGEN_IXIA @@ -1375,8 +1380,8 @@ class IxiaPacketGenerator(PacketGenerator): # check configuration options self.options_keys = [ 'txmode', 'ip', 'vlan', 'transmit_mode', 'rate'] - self.ip_keys = ['start', 'end','action', 'step', 'mask',] - self.vlan_keys = ['start', 'end', 'action', 'step', 'count',] + self.ip_keys = ['start', 'end', 'action', 'step', 'mask', ] + self.vlan_keys = ['start', 'end', 'action', 'step', 'count', ] super(IxiaPacketGenerator, self).__init__(tester) self.tester = tester @@ -1395,7 +1400,7 @@ class IxiaPacketGenerator(PacketGenerator): def _connect(self, tester, conf): # initialize ixia class - self._conn = Ixia(tester, conf) + self._conn = Ixia(tester, conf, self.logger) for p in self._conn.get_ports(): self._ports.append(p) @@ -1441,7 +1446,7 @@ class IxiaPacketGenerator(PacketGenerator): ''' for name, _port_obj in self._conn.ports.iteritems(): _pci = _port_obj.info['pci_addr'] - self.logger.info((_pci, pci)) + self.logger.debug((_pci, pci)) if _pci == pci: return True else: @@ -1461,7 +1466,7 @@ class IxiaPacketGenerator(PacketGenerator): # close it and wait for more discussion about pktgen framework return None conf = {} - #get the subnet range of src and dst ip + # get the subnet range of src and dst ip if self.conf.has_key("ip_src"): conf['src'] = {} ip_src = self.conf['ip_src'] @@ -1530,8 +1535,8 @@ class IxiaPacketGenerator(PacketGenerator): msg = [ "Tx Port %d stats: " % (tx_port_id), "tx_port: %d, tx_bps: %f, tx_pps: %f " % ( - tx_port_id, tx_bps, tx_pps)] - self.logger.info(pformat(port_stats)) + tx_port_id, tx_bps, tx_pps)] + self.logger.debug(pformat(port_stats)) self.logger.info(os.linesep.join(msg)) # rx bps/pps rx_port_id = stream["rx_port"] @@ -1544,9 +1549,9 @@ class IxiaPacketGenerator(PacketGenerator): msg = [ "Rx Port %d stats: " % (rx_port_id), "rx_port: %d, rx_bps: %f, rx_pps: %f" % ( - rx_port_id, rx_bps, rx_pps)] + rx_port_id, rx_bps, rx_pps)] - self.logger.info(pformat(port_stats)) + self.logger.debug(pformat(port_stats)) self.logger.info(os.linesep.join(msg)) return rx_bps, rx_pps @@ -1586,7 +1591,7 @@ class IxiaPacketGenerator(PacketGenerator): latency_stats = { 'min': port_stats.get('total_min'), 'max': port_stats.get('total_max'), - 'average':port_stats.get('average'),} + 'average': port_stats.get('average'), } return latency_stats @@ -1626,7 +1631,7 @@ class IxiaPacketGenerator(PacketGenerator): self._traffic_opt['flow_control'] = options.get('flow_control') or {} # if vm config by pktgen config file, set it here to take the place # of setting on suite - if self._vm_conf: # TBD, remove this process later + if self._vm_conf: # TBD, remove this process later config['fields_config'] = self._vm_conf # get stream rate percent stream_config = options.get('stream_config') @@ -1637,51 +1642,27 @@ class IxiaPacketGenerator(PacketGenerator): if not port_config: msg = 'no stream options for ixia packet generator' raise Exception(msg) - #------------------------------------------------------------------- port_lists = [] for port_id, option in port_config.iteritems(): port_lists += option self._conn.clear_tcl_buffer() rxPortlist, txPortlist = self._conn.prepare_port_list( - port_lists, rate_percent or 100, latency) + port_lists, rate_percent or 100, latency) self._conn.prepare_ixia_for_transmission(txPortlist, rxPortlist) # preset port status before running traffic self._preset_ixia_port() def _start_transmission(self, stream_ids, options={}): - ''' - :param sample_delay: - After traffic start ``sample_delay`` seconds, start get runtime statistics - ''' # get rate percentage rate_percent = options.get('rate') or '100' - # get duration - duration = options.get("duration") or 5 - duration = int(duration) if isinstance(duration, (str, unicode)) \ - else duration - # get sample interval - _sample_delay = options.get("sample_delay") or duration/2 - sample_delay = int(_sample_delay) \ - if isinstance(_sample_delay, (str, unicode)) \ - else _sample_delay - # get configuration from pktgen config file - warmup = int(self.conf["warmup"]) if self.conf.has_key("warmup") \ - else 25 - wait_interval, core_mask = (warmup+30, self.conf["core_mask"]) \ - if self.conf.has_key("core_mask") \ - else (warmup+5, None) - #------------------------------------------------------------------- # run ixia server try: - ########################################### # Start traffic on port(s) self.logger.info("begin traffic ......") run_opt = { - 'ports': self._traffic_ports, - 'mult': rate_percent, - 'duration': duration, - 'core_mask':core_mask, - 'force': True,} + 'ports': self._traffic_ports, + 'mult': rate_percent, + 'force': True, } self._conn.start(**run_opt) except Exception as e: self.logger.error(e) @@ -1695,8 +1676,8 @@ class IxiaPacketGenerator(PacketGenerator): ''' ixia traffic statistics ''' stats = self._conn.get_stats(self._traffic_ports, mode) stream = self._get_stream(stream_id) - self.logger.info(pformat(stream)) - self.logger.info(pformat(stats)) + self.logger.debug(pformat(stream)) + self.logger.debug(pformat(stats)) if mode == 'throughput': return self._throughput_stats(stream, stats) elif mode == 'loss': @@ -1747,4 +1728,4 @@ class IxiaPacketGenerator(PacketGenerator): ''' close ixia session ''' if self._conn is not None: self._disconnect() - return \ No newline at end of file + return -- 1.9.3