* [dts] [PATCH V2 0/7] dts/pktgen: fix internal bugs
@ 2019-09-23 6:50 yufengmx
2019-09-23 6:50 ` [dts] [PATCH V2 1/7] framework/logger: add pktgen logger and remove duplicate yufengmx
` (8 more replies)
0 siblings, 9 replies; 17+ messages in thread
From: yufengmx @ 2019-09-23 6:50 UTC (permalink / raw)
To: dts, wenjiex.a.li, zhaoyan.chen, lijuan.tu; +Cc: yufengmx
These commits are internal bugs fixed, which are reported by li,wenjie.
*. move tester/dut logger close after session close for logger used by session.
*. remove duplicate ixia logger setting.
*. add pktgen logger setting in logger module.
*. set pktgen modules part of information logger display to debug level.
*. set PacketGenerator class logger as Ixia class logger.
*. remove logger format setting after import libs to fix dts redundant logs.
*. use tester alt session to close trex.
*. remove un-used libs.
*. fix typo.
V2:
- rebase source code.
- remove pep8 fix for easy code review.
yufengmx (7):
framework/logger: add pktgen logger and remove duplicate code
framework/dut: fix logger quit issue
framework/tester: fix logger quit issue
framework/pktgen_base: fix internal bug
framework/pktgen_ixia: fix internal bug
framework/pktgen_trex: fix internal bug
framework/pktgen: fix internal bug
framework/dut.py | 8 ++++----
framework/logger.py | 25 +++++++++++++++++++++----
framework/pktgen.py | 9 +--------
framework/pktgen_base.py | 12 ++----------
framework/pktgen_ixia.py | 39 +++++++++++++++++++--------------------
framework/pktgen_trex.py | 38 ++++++++++++++++----------------------
framework/tester.py | 2 +-
7 files changed, 64 insertions(+), 69 deletions(-)
--
2.21.0
^ permalink raw reply [flat|nested] 17+ messages in thread
* [dts] [PATCH V2 1/7] framework/logger: add pktgen logger and remove duplicate
2019-09-23 6:50 [dts] [PATCH V2 0/7] dts/pktgen: fix internal bugs yufengmx
@ 2019-09-23 6:50 ` yufengmx
2019-09-23 6:58 ` Mo, YufengX
2019-09-23 6:50 ` [dts] [PATCH V2 2/7] framework/dut: fix logger quit issue yufengmx
` (7 subsequent siblings)
8 siblings, 1 reply; 17+ messages in thread
From: yufengmx @ 2019-09-23 6:50 UTC (permalink / raw)
To: dts, wenjiex.a.li, zhaoyan.chen, lijuan.tu; +Cc: yufengmx
code
*. remove duplicate ixia logger setting.
*. add pktgen logger setting.
*. fix typo.
Signed-off-by: yufengmx <yufengx.mo@intel.com>
---
framework/logger.py | 25 +++++++++++++++++++++----
1 file changed, 21 insertions(+), 4 deletions(-)
diff --git a/framework/logger.py b/framework/logger.py
index 603d3aa..32dd954 100644
--- a/framework/logger.py
+++ b/framework/logger.py
@@ -64,6 +64,9 @@ logging.DTS_IXIA_OUTPUT = logging.DEBUG + 5
logging.DTS_VIRTDUT_CMD = logging.INFO + 6
logging.DTS_VIRTDUT_OUTPUT = logging.DEBUG + 6
+logging.DTS_PKTGEN_CMD = logging.INFO + 7
+logging.DTS_PKTGEN_OUTPUT = logging.DEBUG + 7
+
logging.addLevelName(logging.DTS_DUT_CMD, 'DTS_DUT_CMD')
logging.addLevelName(logging.DTS_DUT_OUTPUT, 'DTS_DUT_OUTPUT')
logging.addLevelName(logging.DTS_DUT_RESULT, 'DTS_DUT_RESULT')
@@ -84,8 +87,8 @@ logging.addLevelName(logging.SUITE_DUT_OUTPUT, 'SUITE_DUT_OUTPUT')
logging.addLevelName(logging.SUITE_TESTER_CMD, 'SUITE_TESTER_CMD')
logging.addLevelName(logging.SUITE_TESTER_OUTPUT, 'SUITE_TESTER_OUTPUT')
-logging.addLevelName(logging.DTS_IXIA_CMD, 'DTS_IXIA_CMD')
-logging.addLevelName(logging.DTS_IXIA_OUTPUT, 'DTS_IXIA_OUTPUT')
+logging.addLevelName(logging.DTS_PKTGEN_CMD, 'DTS_PKTGEN_CMD')
+logging.addLevelName(logging.DTS_PKTGEN_OUTPUT, 'DTS_PKTGEN_OUTPUT')
date_fmt = '%d/%m/%Y %H:%M:%S'
RESET_COLOR = '\033[0m'
@@ -149,6 +152,12 @@ class BaseLoggerAdapter(logging.LoggerAdapter):
def dts_virtdut_output(self, msg, *args, **kwargs):
self.log(logging.DTS_VIRTDUT_OUTPUT, msg, *args, **kwargs)
+ def dts_pktgen_cmd(self, msg, *args, **kwargs):
+ self.log(logging.DTS_PKTGEN_CMD, msg, *args, **kwargs)
+
+ def dts_pktgen_output(self, msg, *args, **kwargs):
+ self.log(logging.DTS_PKTGEN_OUTPUT, msg, *args, **kwargs)
+
class ColorHandler(logging.StreamHandler):
"""
@@ -167,6 +176,8 @@ class ColorHandler(logging.StreamHandler):
logging.SUITE_TESTER_CMD: '', # SYSTEM
logging.DTS_IXIA_CMD: '', # SYSTEM
logging.DTS_IXIA_OUTPUT: '', # SYSTEM
+ logging.DTS_PKTGEN_CMD: '', # SYSTEM
+ logging.DTS_PKTGEN_OUTPUT: '', # SYSTEM
logging.DTS_VIRTDUT_CMD: '', # SYSTEM
logging.DTS_VIRTDUT_OUTPUT: '', # SYSTEM
logging.WARN: '\033[01;33m', # BOLD YELLOW
@@ -228,7 +239,7 @@ class DTSLOG(BaseLoggerAdapter):
fh.setFormatter(logging.Formatter(message_fmt, date_fmt))
ch.setFormatter(logging.Formatter(stream_fmt, date_fmt))
- fh.setLevel(logging.DEBUG) # file hander default level
+ fh.setLevel(logging.DEBUG) # file handler default level
global verbose
if verbose is True:
ch.setLevel(logging.DEBUG)
@@ -310,6 +321,9 @@ class DTSLOG(BaseLoggerAdapter):
elif crb.startswith('ixia'):
self.info_lvl = logging.DTS_IXIA_CMD
self.debug_lvl = logging.DTS_IXIA_OUTPUT
+ elif crb.startswith('pktgen'):
+ self.info_lvl = logging.DTS_PKTGEN_CMD
+ self.debug_lvl = logging.DTS_PKTGEN_OUTPUT
elif crb.startswith('virtdut'):
self.info_lvl = logging.DTS_VIRTDUT_CMD
self.debug_lvl = logging.DTS_VIRTDUT_OUTPUT
@@ -342,6 +356,9 @@ class DTSLOG(BaseLoggerAdapter):
elif crb == 'ixia':
self.info_lvl = logging.DTS_IXIA_CMD
self.debug_lvl = logging.DTS_IXIA_OUTPUT
+ elif crb == 'pktgen':
+ self.info_lvl = logging.DTS_PKTGEN_CMD
+ self.debug_lvl = logging.DTS_PKTGEN_OUTPUT
elif crb == 'virtdut':
self.info_lvl = logging.DTS_VIRTDUT_CMD
self.debug_lvl = logging.DTS_VIRTDUT_OUTPUT
@@ -428,7 +445,7 @@ class LogParser(object):
# only handle case log
m = self.case_pattern.match(line.values()[0])
if m:
- # not determine case will start from begining
+ # not determine case will start from beginning
if case_name is None:
begin = self.loglist.index(line)
# start from the determined case
--
2.21.0
^ permalink raw reply [flat|nested] 17+ messages in thread
* [dts] [PATCH V2 2/7] framework/dut: fix logger quit issue
2019-09-23 6:50 [dts] [PATCH V2 0/7] dts/pktgen: fix internal bugs yufengmx
2019-09-23 6:50 ` [dts] [PATCH V2 1/7] framework/logger: add pktgen logger and remove duplicate yufengmx
@ 2019-09-23 6:50 ` yufengmx
2019-09-23 6:58 ` Mo, YufengX
2019-09-23 6:50 ` [dts] [PATCH V2 3/7] framework/tester: " yufengmx
` (6 subsequent siblings)
8 siblings, 1 reply; 17+ messages in thread
From: yufengmx @ 2019-09-23 6:50 UTC (permalink / raw)
To: dts, wenjiex.a.li, zhaoyan.chen, lijuan.tu; +Cc: yufengmx
*. move dut logger close after session close for logger used by session.
*. fix typo.
Signed-off-by: yufengmx <yufengx.mo@intel.com>
---
framework/dut.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/framework/dut.py b/framework/dut.py
index 1779d3a..a394b34 100644
--- a/framework/dut.py
+++ b/framework/dut.py
@@ -208,7 +208,7 @@ class Dut(Crb):
self.restore_interfaces()
# rescan ports after interface up
self.rescan_ports()
- # load port infor from config file
+ # load port information from config file
self.load_portconf()
self.mount_procfs()
# auto detect network topology
@@ -933,8 +933,8 @@ class Dut(Crb):
def load_portconf(self):
"""
- Load port configurations for ports_info. If manually configured infor
- not same as auto scanned, still use infor in configuration file.
+ Load port configurations for ports_info. If manually configured info
+ not same as auto scanned, still use information in configuration file.
"""
for port in self.ports_info:
pci_bus = port['pci']
@@ -1097,6 +1097,6 @@ class Dut(Crb):
"""
Recover all resource before crb exit
"""
- self.logger.logger_exit()
self.enable_tester_ipv6()
self.close()
+ self.logger.logger_exit()
--
2.21.0
^ permalink raw reply [flat|nested] 17+ messages in thread
* [dts] [PATCH V2 3/7] framework/tester: fix logger quit issue
2019-09-23 6:50 [dts] [PATCH V2 0/7] dts/pktgen: fix internal bugs yufengmx
2019-09-23 6:50 ` [dts] [PATCH V2 1/7] framework/logger: add pktgen logger and remove duplicate yufengmx
2019-09-23 6:50 ` [dts] [PATCH V2 2/7] framework/dut: fix logger quit issue yufengmx
@ 2019-09-23 6:50 ` yufengmx
2019-09-23 6:58 ` Mo, YufengX
2019-09-23 6:50 ` [dts] [PATCH V2 4/7] framework/pktgen_base: fix internal bug yufengmx
` (5 subsequent siblings)
8 siblings, 1 reply; 17+ messages in thread
From: yufengmx @ 2019-09-23 6:50 UTC (permalink / raw)
To: dts, wenjiex.a.li, zhaoyan.chen, lijuan.tu; +Cc: yufengmx
move tester logger close after session close for logger used by session.
Signed-off-by: yufengmx <yufengx.mo@intel.com>
---
framework/tester.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/framework/tester.py b/framework/tester.py
index 68ef2f9..174d0b6 100644
--- a/framework/tester.py
+++ b/framework/tester.py
@@ -874,5 +874,5 @@ class Tester(Crb):
"""
Close all resource before crb exit
"""
- self.logger.logger_exit()
self.close()
+ self.logger.logger_exit()
--
2.21.0
^ permalink raw reply [flat|nested] 17+ messages in thread
* [dts] [PATCH V2 4/7] framework/pktgen_base: fix internal bug
2019-09-23 6:50 [dts] [PATCH V2 0/7] dts/pktgen: fix internal bugs yufengmx
` (2 preceding siblings ...)
2019-09-23 6:50 ` [dts] [PATCH V2 3/7] framework/tester: " yufengmx
@ 2019-09-23 6:50 ` yufengmx
2019-09-23 6:58 ` Mo, YufengX
2019-09-23 6:50 ` [dts] [PATCH V2 5/7] framework/pktgen_ixia: " yufengmx
` (4 subsequent siblings)
8 siblings, 1 reply; 17+ messages in thread
From: yufengmx @ 2019-09-23 6:50 UTC (permalink / raw)
To: dts, wenjiex.a.li, zhaoyan.chen, lijuan.tu; +Cc: yufengmx
*. remove logger format setting after import libs to eliminate dts redundant logs.
*. set part of information logger display to debug level.
*. remove un-used libs import.
Signed-off-by: yufengmx <yufengx.mo@intel.com>
---
framework/pktgen_base.py | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/framework/pktgen_base.py b/framework/pktgen_base.py
index 4cb5447..cd541b0 100644
--- a/framework/pktgen_base.py
+++ b/framework/pktgen_base.py
@@ -29,7 +29,6 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-import os
import time
import logging
from abc import abstractmethod
@@ -45,11 +44,6 @@ from settings import PKTGEN_DPDK, PKTGEN_TREX, PKTGEN_IXIA, PKTGEN
TRANSMIT_CONT = 'continuous'
TRANSMIT_M_BURST = 'multi_burst'
TRANSMIT_S_BURST = 'single_burst'
-# set logger
-FORMAT = '%(message)s'
-logging.basicConfig(format=FORMAT)
-logger = logging.getLogger(os.path.basename(__file__)[:-3].upper())
-logger.setLevel(logging.INFO)
class PacketGenerator(object):
@@ -83,7 +77,7 @@ class PacketGenerator(object):
if tester_pci == gen_pci:
msg = "gen port {0} map test port {1}".format(
port_id, port_idx)
- self.logger.info(msg)
+ self.logger.debug(msg)
return port_idx
else:
port = -1
@@ -105,7 +99,7 @@ class PacketGenerator(object):
tester_pci = info['pci']
port = self._get_gen_port(tester_pci)
msg = "test port {0} map gen port {1}".format(port_id, port)
- self.logger.info(msg)
+ self.logger.debug(msg)
except:
port = -1
@@ -349,8 +343,6 @@ class PacketGenerator(object):
else:
result = None
- self.logger.info(result)
-
return result
def _summary_statistic(self, array=[]):
--
2.21.0
^ permalink raw reply [flat|nested] 17+ messages in thread
* [dts] [PATCH V2 5/7] framework/pktgen_ixia: fix internal bug
2019-09-23 6:50 [dts] [PATCH V2 0/7] dts/pktgen: fix internal bugs yufengmx
` (3 preceding siblings ...)
2019-09-23 6:50 ` [dts] [PATCH V2 4/7] framework/pktgen_base: fix internal bug yufengmx
@ 2019-09-23 6:50 ` yufengmx
2019-09-23 6:57 ` Mo, YufengX
2019-09-23 6:50 ` [dts] [PATCH V2 6/7] framework/pktgen_trex: " yufengmx
` (3 subsequent siblings)
8 siblings, 1 reply; 17+ messages in thread
From: yufengmx @ 2019-09-23 6:50 UTC (permalink / raw)
To: dts, wenjiex.a.li, zhaoyan.chen, lijuan.tu; +Cc: yufengmx
*. set part of information logger display to debug level.
*. set PacketGenerator class logger as Ixia class logger.
*. remove un-used libs import.
Signed-off-by: yufengmx <yufengx.mo@intel.com>
---
framework/pktgen_ixia.py | 39 +++++++++++++++++++--------------------
1 file changed, 19 insertions(+), 20 deletions(-)
diff --git a/framework/pktgen_ixia.py b/framework/pktgen_ixia.py
index d324263..69f858e 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.logger = logger
super(Ixia, self).init_log(self.logger)
self.tcl_cmds = []
@@ -79,8 +78,8 @@ class Ixia(SSHConnection):
else:
self.enable100g = 'disable'
- self.logger.info(self.ixiaVersion)
- self.logger.info(self.ports)
+ self.logger.debug(self.ixiaVersion)
+ self.logger.debug(self.ports)
self.tclServerIP = ixiaPorts[ixiaRef]["IP"]
@@ -758,7 +757,7 @@ class Ixia(SSHConnection):
sendNumber += self.get_frames_sent()
time.sleep(0.5)
- self.logger.info("send :%f" % sendNumber)
+ self.logger.debug("send :%f" % sendNumber)
assert sendNumber != 0
@@ -766,7 +765,7 @@ class Ixia(SSHConnection):
for port in rxPortlist:
self.stat_get_stat_all_stats(port)
revNumber += self.get_frames_received()
- self.logger.info("rev :%f" % revNumber)
+ self.logger.debug("rev :%f" % revNumber)
return float(sendNumber - revNumber) / sendNumber, sendNumber, revNumber
@@ -943,8 +942,8 @@ class Ixia(SSHConnection):
out = self.send_expect("stat cget -oversize", '%', 10)
oversize += int(out.strip())
- self.logger.info("Rate: %f Mpps" % (rate * 1.0 / 1000000))
- self.logger.info("Mbps rate: %f Mbps" % (bpsRate * 1.0 / 1000000))
+ self.logger.debug("Rate: %f Mpps" % (rate * 1.0 / 1000000))
+ self.logger.debug("Mbps rate: %f Mbps" % (bpsRate * 1.0 / 1000000))
self.hook_transmission_func()
@@ -1233,7 +1232,7 @@ class Ixia(SSHConnection):
self.stat_get_stat_all_stats(port)
txPackets = self.get_frames_sent()
rxPackets += self.get_frames_received()
- self.logger.info("Received packets :%s" % rxPackets)
+ self.logger.debug("Received packets :%s" % rxPackets)
return rxPackets
@@ -1399,7 +1398,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)
@@ -1445,7 +1444,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:
@@ -1535,8 +1534,8 @@ class IxiaPacketGenerator(PacketGenerator):
"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))
- self.logger.info(os.linesep.join(msg))
+ self.logger.debug(pformat(port_stats))
+ self.logger.debug(os.linesep.join(msg))
# rx bps/pps
rx_port_id = stream["rx_port"]
port_stats = stats.get(rx_port_id)
@@ -1550,8 +1549,8 @@ class IxiaPacketGenerator(PacketGenerator):
"rx_port: %d, rx_bps: %f, rx_pps: %f" % (
rx_port_id, rx_bps, rx_pps)]
- self.logger.info(pformat(port_stats))
- self.logger.info(os.linesep.join(msg))
+ self.logger.debug(pformat(port_stats))
+ self.logger.debug(os.linesep.join(msg))
return rx_bps, rx_pps
@@ -1566,13 +1565,13 @@ class IxiaPacketGenerator(PacketGenerator):
self.logger.error(msg)
return None
msg = "Tx Port %d stats: " % (port_id)
- self.logger.info(msg)
+ self.logger.debug(msg)
opackets = port_stats["opackets"]
# rx packet
port_id = stream.get("rx_port")
port_stats = stats[port_id]
msg = "Rx Port %d stats: " % (port_id)
- self.logger.info(msg)
+ self.logger.debug(msg)
ipackets = port_stats["ipackets"]
return opackets, ipackets
@@ -1699,8 +1698,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':
--
2.21.0
^ permalink raw reply [flat|nested] 17+ messages in thread
* [dts] [PATCH V2 6/7] framework/pktgen_trex: fix internal bug
2019-09-23 6:50 [dts] [PATCH V2 0/7] dts/pktgen: fix internal bugs yufengmx
` (4 preceding siblings ...)
2019-09-23 6:50 ` [dts] [PATCH V2 5/7] framework/pktgen_ixia: " yufengmx
@ 2019-09-23 6:50 ` yufengmx
2019-09-23 6:57 ` Mo, YufengX
2019-09-23 6:50 ` [dts] [PATCH V2 7/7] framework/pktgen: " yufengmx
` (2 subsequent siblings)
8 siblings, 1 reply; 17+ messages in thread
From: yufengmx @ 2019-09-23 6:50 UTC (permalink / raw)
To: dts, wenjiex.a.li, zhaoyan.chen, lijuan.tu; +Cc: yufengmx
*. use tester alt session to close trex.
*. set part of information logger display to debug level.
*. remove logger format setting after import libs to eliminate dts redundant logs.
Signed-off-by: yufengmx <yufengx.mo@intel.com>
---
framework/pktgen_trex.py | 38 ++++++++++++++++----------------------
1 file changed, 16 insertions(+), 22 deletions(-)
diff --git a/framework/pktgen_trex.py b/framework/pktgen_trex.py
index c6c904b..690d070 100644
--- a/framework/pktgen_trex.py
+++ b/framework/pktgen_trex.py
@@ -35,14 +35,9 @@ import time
import logging
from pprint import pformat
-from pktgen_base import (PacketGenerator, PKTGEN_TREX,
+from pktgen_base import (PacketGenerator, PKTGEN_TREX, PKTGEN,
TRANSMIT_CONT, TRANSMIT_M_BURST, TRANSMIT_S_BURST)
-FORMAT = '%(message)s'
-logging.basicConfig(format=FORMAT)
-logger = logging.getLogger(os.path.basename(__file__)[:-3].upper())
-logger.setLevel(logging.INFO)
-
class TrexConfigVm(object):
'''
@@ -492,7 +487,7 @@ class TrexPacketGenerator(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:
@@ -585,9 +580,7 @@ class TrexPacketGenerator(PacketGenerator):
app_param_temp = app_param_temp + " --cfg " + self.conf[key]
elif key == 'core_num':
app_param_temp = app_param_temp + " -c " + self.conf[key]
- self.control_session = \
- self.tester.create_session('trex_control_session')
-
+ self.control_session = self.tester.create_session(PKTGEN)
self.control_session.send_expect(
';'.join(['cd ' + self.conf['trex_root_path'],
'./' + self.trex_app + " " + app_param_temp]),
@@ -628,7 +621,7 @@ class TrexPacketGenerator(PacketGenerator):
if port_id not in ports:
return None
features = self._conn.ports[port_id].get_formatted_info()
- self.logger.info(pformat(features))
+ self.logger.debug(pformat(features))
return features
@@ -637,7 +630,7 @@ class TrexPacketGenerator(PacketGenerator):
features = self._get_port_features(port_id)
if not features or features.get('fc_supported') == 'no':
msg = "trex port <{0}> not support flow control".format(port_id)
- self.logger.warning(msg)
+ self.logger.debug(msg)
return False
else:
return True
@@ -669,8 +662,8 @@ class TrexPacketGenerator(PacketGenerator):
"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))
- self.logger.info(os.linesep.join(msg))
+ self.logger.debug(pformat(port_stats))
+ self.logger.debug(os.linesep.join(msg))
# rx bps/pps
rx_port_id = stream["rx_port"]
port_stats = self.runtime_stats.get(rx_port_id)
@@ -684,8 +677,8 @@ class TrexPacketGenerator(PacketGenerator):
"rx_port: %d, rx_bps: %f, rx_pps: %f" % (
rx_port_id, rx_bps, rx_pps)]
- self.logger.info(pformat(port_stats))
- self.logger.info(os.linesep.join(msg))
+ self.logger.debug(pformat(port_stats))
+ self.logger.debug(os.linesep.join(msg))
return rx_bps, rx_pps
@@ -699,13 +692,13 @@ class TrexPacketGenerator(PacketGenerator):
self.logger.error(msg)
return None
msg = "Tx Port %d stats: " % (port_id)
- self.logger.info(msg)
+ self.logger.debug(msg)
opackets = port_stats["opackets"]
# rx packet
port_id = stream.get("rx_port")
port_stats = stats[port_id]
msg = "Rx Port %d stats: " % (port_id)
- self.logger.info(msg)
+ self.logger.debug(msg)
ipackets = port_stats["ipackets"]
return opackets, ipackets
@@ -813,13 +806,14 @@ class TrexPacketGenerator(PacketGenerator):
'core_mask':core_mask,
'force': True,}
self.logger.info("begin traffic ......")
+ self.logger.debug(run_opt)
self._conn.start(**run_opt)
###########################################
if sample_delay:
time.sleep(sample_delay) # wait
# get ports runtime statistics
self.runtime_stats = self._conn.get_stats()
- self.logger.info(pformat(self.runtime_stats))
+ self.logger.debug(pformat(self.runtime_stats))
###########################################
# Block until traffic on specified port(s) has ended
wait_opt = {'ports': self._traffic_ports}
@@ -840,8 +834,8 @@ class TrexPacketGenerator(PacketGenerator):
'''
stats = self._conn.get_stats()
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':
@@ -855,7 +849,7 @@ class TrexPacketGenerator(PacketGenerator):
if self._conn is not None:
self._disconnect()
if self.control_session is not None:
- self.tester.send_expect('pkill -f _t-rex-64', '# ')
+ self.tester.alt_session.send_expect('pkill -f _t-rex-64', '# ')
time.sleep(5)
self.tester.destroy_session(self.control_session)
self.control_session = None
--
2.21.0
^ permalink raw reply [flat|nested] 17+ messages in thread
* [dts] [PATCH V2 7/7] framework/pktgen: fix internal bug
2019-09-23 6:50 [dts] [PATCH V2 0/7] dts/pktgen: fix internal bugs yufengmx
` (5 preceding siblings ...)
2019-09-23 6:50 ` [dts] [PATCH V2 6/7] framework/pktgen_trex: " yufengmx
@ 2019-09-23 6:50 ` yufengmx
2019-09-23 6:57 ` Mo, YufengX
2019-09-23 6:58 ` [dts] [PATCH V2 0/7] dts/pktgen: fix internal bugs Mo, YufengX
2019-09-24 9:14 ` Tu, Lijuan
8 siblings, 1 reply; 17+ messages in thread
From: yufengmx @ 2019-09-23 6:50 UTC (permalink / raw)
To: dts, wenjiex.a.li, zhaoyan.chen, lijuan.tu; +Cc: yufengmx
*. remove un-used libs import.
*. remove set dts libs directory in system path.
Signed-off-by: yufengmx <yufengx.mo@intel.com>
---
framework/pktgen.py | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/framework/pktgen.py b/framework/pktgen.py
index 2c6cf7f..7f8223f 100644
--- a/framework/pktgen.py
+++ b/framework/pktgen.py
@@ -29,7 +29,7 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-import os, sys
+import os
from copy import deepcopy
from scapy.all import conf
@@ -38,13 +38,6 @@ from scapy.packet import Packet as scapyPacket
from scapy.fields import ConditionalField
from scapy.utils import rdpcap
-# import dts libs
-cwd = os.getcwd()
-sys.path.append(cwd + '/nics')
-sys.path.append(cwd + '/framework')
-sys.path.append(cwd + '/tests')
-sys.path.append(cwd + '/dep')
-
# dts libs
from utils import (convert_int2ip, convert_ip2int,
convert_mac2long, convert_mac2str)
--
2.21.0
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [dts] [PATCH V2 6/7] framework/pktgen_trex: fix internal bug
2019-09-23 6:50 ` [dts] [PATCH V2 6/7] framework/pktgen_trex: " yufengmx
@ 2019-09-23 6:57 ` Mo, YufengX
0 siblings, 0 replies; 17+ messages in thread
From: Mo, YufengX @ 2019-09-23 6:57 UTC (permalink / raw)
To: dts, Li, WenjieX A, Chen, Zhaoyan, Tu, Lijuan
Tested by Mo, YufengX <yufengx.mo@intel.com>
> -----Original Message-----
> From: Mo, YufengX
> Sent: Monday, September 23, 2019 2:51 PM
> To: dts@dpdk.org; Li, WenjieX A <wenjiex.a.li@intel.com>; Chen, Zhaoyan <zhaoyan.chen@intel.com>; Tu, Lijuan <lijuan.tu@intel.com>
> Cc: Mo, YufengX <yufengx.mo@intel.com>
> Subject: [dts][PATCH V2 6/7] framework/pktgen_trex: fix internal bug
>
>
> *. use tester alt session to close trex.
> *. set part of information logger display to debug level.
> *. remove logger format setting after import libs to eliminate dts redundant logs.
>
> Signed-off-by: yufengmx <yufengx.mo@intel.com>
> ---
> framework/pktgen_trex.py | 38 ++++++++++++++++----------------------
> 1 file changed, 16 insertions(+), 22 deletions(-)
>
> diff --git a/framework/pktgen_trex.py b/framework/pktgen_trex.py
> index c6c904b..690d070 100644
> --- a/framework/pktgen_trex.py
> +++ b/framework/pktgen_trex.py
> @@ -35,14 +35,9 @@ import time
> import logging
> from pprint import pformat
>
> -from pktgen_base import (PacketGenerator, PKTGEN_TREX,
> +from pktgen_base import (PacketGenerator, PKTGEN_TREX, PKTGEN,
> TRANSMIT_CONT, TRANSMIT_M_BURST, TRANSMIT_S_BURST)
>
> -FORMAT = '%(message)s'
> -logging.basicConfig(format=FORMAT)
> -logger = logging.getLogger(os.path.basename(__file__)[:-3].upper())
> -logger.setLevel(logging.INFO)
> -
>
> class TrexConfigVm(object):
> '''
> @@ -492,7 +487,7 @@ class TrexPacketGenerator(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:
> @@ -585,9 +580,7 @@ class TrexPacketGenerator(PacketGenerator):
> app_param_temp = app_param_temp + " --cfg " + self.conf[key]
> elif key == 'core_num':
> app_param_temp = app_param_temp + " -c " + self.conf[key]
> - self.control_session = \
> - self.tester.create_session('trex_control_session')
> -
> + self.control_session = self.tester.create_session(PKTGEN)
> self.control_session.send_expect(
> ';'.join(['cd ' + self.conf['trex_root_path'],
> './' + self.trex_app + " " + app_param_temp]),
> @@ -628,7 +621,7 @@ class TrexPacketGenerator(PacketGenerator):
> if port_id not in ports:
> return None
> features = self._conn.ports[port_id].get_formatted_info()
> - self.logger.info(pformat(features))
> + self.logger.debug(pformat(features))
>
> return features
>
> @@ -637,7 +630,7 @@ class TrexPacketGenerator(PacketGenerator):
> features = self._get_port_features(port_id)
> if not features or features.get('fc_supported') == 'no':
> msg = "trex port <{0}> not support flow control".format(port_id)
> - self.logger.warning(msg)
> + self.logger.debug(msg)
> return False
> else:
> return True
> @@ -669,8 +662,8 @@ class TrexPacketGenerator(PacketGenerator):
> "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))
> - self.logger.info(os.linesep.join(msg))
> + self.logger.debug(pformat(port_stats))
> + self.logger.debug(os.linesep.join(msg))
> # rx bps/pps
> rx_port_id = stream["rx_port"]
> port_stats = self.runtime_stats.get(rx_port_id)
> @@ -684,8 +677,8 @@ class TrexPacketGenerator(PacketGenerator):
> "rx_port: %d, rx_bps: %f, rx_pps: %f" % (
> rx_port_id, rx_bps, rx_pps)]
>
> - self.logger.info(pformat(port_stats))
> - self.logger.info(os.linesep.join(msg))
> + self.logger.debug(pformat(port_stats))
> + self.logger.debug(os.linesep.join(msg))
>
> return rx_bps, rx_pps
>
> @@ -699,13 +692,13 @@ class TrexPacketGenerator(PacketGenerator):
> self.logger.error(msg)
> return None
> msg = "Tx Port %d stats: " % (port_id)
> - self.logger.info(msg)
> + self.logger.debug(msg)
> opackets = port_stats["opackets"]
> # rx packet
> port_id = stream.get("rx_port")
> port_stats = stats[port_id]
> msg = "Rx Port %d stats: " % (port_id)
> - self.logger.info(msg)
> + self.logger.debug(msg)
> ipackets = port_stats["ipackets"]
>
> return opackets, ipackets
> @@ -813,13 +806,14 @@ class TrexPacketGenerator(PacketGenerator):
> 'core_mask':core_mask,
> 'force': True,}
> self.logger.info("begin traffic ......")
> + self.logger.debug(run_opt)
> self._conn.start(**run_opt)
> ###########################################
> if sample_delay:
> time.sleep(sample_delay) # wait
> # get ports runtime statistics
> self.runtime_stats = self._conn.get_stats()
> - self.logger.info(pformat(self.runtime_stats))
> + self.logger.debug(pformat(self.runtime_stats))
> ###########################################
> # Block until traffic on specified port(s) has ended
> wait_opt = {'ports': self._traffic_ports}
> @@ -840,8 +834,8 @@ class TrexPacketGenerator(PacketGenerator):
> '''
> stats = self._conn.get_stats()
> 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':
> @@ -855,7 +849,7 @@ class TrexPacketGenerator(PacketGenerator):
> if self._conn is not None:
> self._disconnect()
> if self.control_session is not None:
> - self.tester.send_expect('pkill -f _t-rex-64', '# ')
> + self.tester.alt_session.send_expect('pkill -f _t-rex-64', '# ')
> time.sleep(5)
> self.tester.destroy_session(self.control_session)
> self.control_session = None
> --
> 2.21.0
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [dts] [PATCH V2 7/7] framework/pktgen: fix internal bug
2019-09-23 6:50 ` [dts] [PATCH V2 7/7] framework/pktgen: " yufengmx
@ 2019-09-23 6:57 ` Mo, YufengX
0 siblings, 0 replies; 17+ messages in thread
From: Mo, YufengX @ 2019-09-23 6:57 UTC (permalink / raw)
To: dts, Li, WenjieX A, Chen, Zhaoyan, Tu, Lijuan
Tested by Mo, YufengX <yufengx.mo@intel.com>
> -----Original Message-----
> From: Mo, YufengX
> Sent: Monday, September 23, 2019 2:51 PM
> To: dts@dpdk.org; Li, WenjieX A <wenjiex.a.li@intel.com>; Chen, Zhaoyan <zhaoyan.chen@intel.com>; Tu, Lijuan <lijuan.tu@intel.com>
> Cc: Mo, YufengX <yufengx.mo@intel.com>
> Subject: [dts][PATCH V2 7/7] framework/pktgen: fix internal bug
>
>
> *. remove un-used libs import.
> *. remove set dts libs directory in system path.
>
> Signed-off-by: yufengmx <yufengx.mo@intel.com>
> ---
> framework/pktgen.py | 9 +--------
> 1 file changed, 1 insertion(+), 8 deletions(-)
>
> diff --git a/framework/pktgen.py b/framework/pktgen.py
> index 2c6cf7f..7f8223f 100644
> --- a/framework/pktgen.py
> +++ b/framework/pktgen.py
> @@ -29,7 +29,7 @@
> # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
>
> -import os, sys
> +import os
> from copy import deepcopy
>
> from scapy.all import conf
> @@ -38,13 +38,6 @@ from scapy.packet import Packet as scapyPacket
> from scapy.fields import ConditionalField
> from scapy.utils import rdpcap
>
> -# import dts libs
> -cwd = os.getcwd()
> -sys.path.append(cwd + '/nics')
> -sys.path.append(cwd + '/framework')
> -sys.path.append(cwd + '/tests')
> -sys.path.append(cwd + '/dep')
> -
> # dts libs
> from utils import (convert_int2ip, convert_ip2int,
> convert_mac2long, convert_mac2str)
> --
> 2.21.0
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [dts] [PATCH V2 5/7] framework/pktgen_ixia: fix internal bug
2019-09-23 6:50 ` [dts] [PATCH V2 5/7] framework/pktgen_ixia: " yufengmx
@ 2019-09-23 6:57 ` Mo, YufengX
0 siblings, 0 replies; 17+ messages in thread
From: Mo, YufengX @ 2019-09-23 6:57 UTC (permalink / raw)
To: dts, Li, WenjieX A, Chen, Zhaoyan, Tu, Lijuan
Tested by Mo, YufengX <yufengx.mo@intel.com>
> -----Original Message-----
> From: Mo, YufengX
> Sent: Monday, September 23, 2019 2:51 PM
> To: dts@dpdk.org; Li, WenjieX A <wenjiex.a.li@intel.com>; Chen, Zhaoyan <zhaoyan.chen@intel.com>; Tu, Lijuan <lijuan.tu@intel.com>
> Cc: Mo, YufengX <yufengx.mo@intel.com>
> Subject: [dts][PATCH V2 5/7] framework/pktgen_ixia: fix internal bug
>
>
> *. set part of information logger display to debug level.
> *. set PacketGenerator class logger as Ixia class logger.
> *. remove un-used libs import.
>
> Signed-off-by: yufengmx <yufengx.mo@intel.com>
> ---
> framework/pktgen_ixia.py | 39 +++++++++++++++++++--------------------
> 1 file changed, 19 insertions(+), 20 deletions(-)
>
> diff --git a/framework/pktgen_ixia.py b/framework/pktgen_ixia.py
> index d324263..69f858e 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.logger = logger
> super(Ixia, self).init_log(self.logger)
>
> self.tcl_cmds = []
> @@ -79,8 +78,8 @@ class Ixia(SSHConnection):
> else:
> self.enable100g = 'disable'
>
> - self.logger.info(self.ixiaVersion)
> - self.logger.info(self.ports)
> + self.logger.debug(self.ixiaVersion)
> + self.logger.debug(self.ports)
>
> self.tclServerIP = ixiaPorts[ixiaRef]["IP"]
>
> @@ -758,7 +757,7 @@ class Ixia(SSHConnection):
> sendNumber += self.get_frames_sent()
> time.sleep(0.5)
>
> - self.logger.info("send :%f" % sendNumber)
> + self.logger.debug("send :%f" % sendNumber)
>
> assert sendNumber != 0
>
> @@ -766,7 +765,7 @@ class Ixia(SSHConnection):
> for port in rxPortlist:
> self.stat_get_stat_all_stats(port)
> revNumber += self.get_frames_received()
> - self.logger.info("rev :%f" % revNumber)
> + self.logger.debug("rev :%f" % revNumber)
>
> return float(sendNumber - revNumber) / sendNumber, sendNumber, revNumber
>
> @@ -943,8 +942,8 @@ class Ixia(SSHConnection):
> out = self.send_expect("stat cget -oversize", '%', 10)
> oversize += int(out.strip())
>
> - self.logger.info("Rate: %f Mpps" % (rate * 1.0 / 1000000))
> - self.logger.info("Mbps rate: %f Mbps" % (bpsRate * 1.0 / 1000000))
> + self.logger.debug("Rate: %f Mpps" % (rate * 1.0 / 1000000))
> + self.logger.debug("Mbps rate: %f Mbps" % (bpsRate * 1.0 / 1000000))
>
> self.hook_transmission_func()
>
> @@ -1233,7 +1232,7 @@ class Ixia(SSHConnection):
> self.stat_get_stat_all_stats(port)
> txPackets = self.get_frames_sent()
> rxPackets += self.get_frames_received()
> - self.logger.info("Received packets :%s" % rxPackets)
> + self.logger.debug("Received packets :%s" % rxPackets)
>
> return rxPackets
>
> @@ -1399,7 +1398,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)
>
> @@ -1445,7 +1444,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:
> @@ -1535,8 +1534,8 @@ class IxiaPacketGenerator(PacketGenerator):
> "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))
> - self.logger.info(os.linesep.join(msg))
> + self.logger.debug(pformat(port_stats))
> + self.logger.debug(os.linesep.join(msg))
> # rx bps/pps
> rx_port_id = stream["rx_port"]
> port_stats = stats.get(rx_port_id)
> @@ -1550,8 +1549,8 @@ class IxiaPacketGenerator(PacketGenerator):
> "rx_port: %d, rx_bps: %f, rx_pps: %f" % (
> rx_port_id, rx_bps, rx_pps)]
>
> - self.logger.info(pformat(port_stats))
> - self.logger.info(os.linesep.join(msg))
> + self.logger.debug(pformat(port_stats))
> + self.logger.debug(os.linesep.join(msg))
>
> return rx_bps, rx_pps
>
> @@ -1566,13 +1565,13 @@ class IxiaPacketGenerator(PacketGenerator):
> self.logger.error(msg)
> return None
> msg = "Tx Port %d stats: " % (port_id)
> - self.logger.info(msg)
> + self.logger.debug(msg)
> opackets = port_stats["opackets"]
> # rx packet
> port_id = stream.get("rx_port")
> port_stats = stats[port_id]
> msg = "Rx Port %d stats: " % (port_id)
> - self.logger.info(msg)
> + self.logger.debug(msg)
> ipackets = port_stats["ipackets"]
>
> return opackets, ipackets
> @@ -1699,8 +1698,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':
> --
> 2.21.0
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [dts] [PATCH V2 4/7] framework/pktgen_base: fix internal bug
2019-09-23 6:50 ` [dts] [PATCH V2 4/7] framework/pktgen_base: fix internal bug yufengmx
@ 2019-09-23 6:58 ` Mo, YufengX
0 siblings, 0 replies; 17+ messages in thread
From: Mo, YufengX @ 2019-09-23 6:58 UTC (permalink / raw)
To: dts, Li, WenjieX A, Chen, Zhaoyan, Tu, Lijuan
Tested by Mo, YufengX <yufengx.mo@intel.com>
> -----Original Message-----
> From: Mo, YufengX
> Sent: Monday, September 23, 2019 2:51 PM
> To: dts@dpdk.org; Li, WenjieX A <wenjiex.a.li@intel.com>; Chen, Zhaoyan <zhaoyan.chen@intel.com>; Tu, Lijuan <lijuan.tu@intel.com>
> Cc: Mo, YufengX <yufengx.mo@intel.com>
> Subject: [dts][PATCH V2 4/7] framework/pktgen_base: fix internal bug
>
>
> *. remove logger format setting after import libs to eliminate dts redundant logs.
> *. set part of information logger display to debug level.
> *. remove un-used libs import.
>
> Signed-off-by: yufengmx <yufengx.mo@intel.com>
> ---
> framework/pktgen_base.py | 12 ++----------
> 1 file changed, 2 insertions(+), 10 deletions(-)
>
> diff --git a/framework/pktgen_base.py b/framework/pktgen_base.py
> index 4cb5447..cd541b0 100644
> --- a/framework/pktgen_base.py
> +++ b/framework/pktgen_base.py
> @@ -29,7 +29,6 @@
> # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
>
> -import os
> import time
> import logging
> from abc import abstractmethod
> @@ -45,11 +44,6 @@ from settings import PKTGEN_DPDK, PKTGEN_TREX, PKTGEN_IXIA, PKTGEN
> TRANSMIT_CONT = 'continuous'
> TRANSMIT_M_BURST = 'multi_burst'
> TRANSMIT_S_BURST = 'single_burst'
> -# set logger
> -FORMAT = '%(message)s'
> -logging.basicConfig(format=FORMAT)
> -logger = logging.getLogger(os.path.basename(__file__)[:-3].upper())
> -logger.setLevel(logging.INFO)
>
>
> class PacketGenerator(object):
> @@ -83,7 +77,7 @@ class PacketGenerator(object):
> if tester_pci == gen_pci:
> msg = "gen port {0} map test port {1}".format(
> port_id, port_idx)
> - self.logger.info(msg)
> + self.logger.debug(msg)
> return port_idx
> else:
> port = -1
> @@ -105,7 +99,7 @@ class PacketGenerator(object):
> tester_pci = info['pci']
> port = self._get_gen_port(tester_pci)
> msg = "test port {0} map gen port {1}".format(port_id, port)
> - self.logger.info(msg)
> + self.logger.debug(msg)
> except:
> port = -1
>
> @@ -349,8 +343,6 @@ class PacketGenerator(object):
> else:
> result = None
>
> - self.logger.info(result)
> -
> return result
>
> def _summary_statistic(self, array=[]):
> --
> 2.21.0
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [dts] [PATCH V2 3/7] framework/tester: fix logger quit issue
2019-09-23 6:50 ` [dts] [PATCH V2 3/7] framework/tester: " yufengmx
@ 2019-09-23 6:58 ` Mo, YufengX
0 siblings, 0 replies; 17+ messages in thread
From: Mo, YufengX @ 2019-09-23 6:58 UTC (permalink / raw)
To: dts, Li, WenjieX A, Chen, Zhaoyan, Tu, Lijuan
Tested by Mo, YufengX <yufengx.mo@intel.com>
> -----Original Message-----
> From: Mo, YufengX
> Sent: Monday, September 23, 2019 2:51 PM
> To: dts@dpdk.org; Li, WenjieX A <wenjiex.a.li@intel.com>; Chen, Zhaoyan <zhaoyan.chen@intel.com>; Tu, Lijuan <lijuan.tu@intel.com>
> Cc: Mo, YufengX <yufengx.mo@intel.com>
> Subject: [dts][PATCH V2 3/7] framework/tester: fix logger quit issue
>
>
> move tester logger close after session close for logger used by session.
>
> Signed-off-by: yufengmx <yufengx.mo@intel.com>
> ---
> framework/tester.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/framework/tester.py b/framework/tester.py
> index 68ef2f9..174d0b6 100644
> --- a/framework/tester.py
> +++ b/framework/tester.py
> @@ -874,5 +874,5 @@ class Tester(Crb):
> """
> Close all resource before crb exit
> """
> - self.logger.logger_exit()
> self.close()
> + self.logger.logger_exit()
> --
> 2.21.0
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [dts] [PATCH V2 2/7] framework/dut: fix logger quit issue
2019-09-23 6:50 ` [dts] [PATCH V2 2/7] framework/dut: fix logger quit issue yufengmx
@ 2019-09-23 6:58 ` Mo, YufengX
0 siblings, 0 replies; 17+ messages in thread
From: Mo, YufengX @ 2019-09-23 6:58 UTC (permalink / raw)
To: dts, Li, WenjieX A, Chen, Zhaoyan, Tu, Lijuan
Tested by Mo, YufengX <yufengx.mo@intel.com>
> -----Original Message-----
> From: Mo, YufengX
> Sent: Monday, September 23, 2019 2:51 PM
> To: dts@dpdk.org; Li, WenjieX A <wenjiex.a.li@intel.com>; Chen, Zhaoyan <zhaoyan.chen@intel.com>; Tu, Lijuan <lijuan.tu@intel.com>
> Cc: Mo, YufengX <yufengx.mo@intel.com>
> Subject: [dts][PATCH V2 2/7] framework/dut: fix logger quit issue
>
>
> *. move dut logger close after session close for logger used by session.
> *. fix typo.
>
> Signed-off-by: yufengmx <yufengx.mo@intel.com>
> ---
> framework/dut.py | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/framework/dut.py b/framework/dut.py
> index 1779d3a..a394b34 100644
> --- a/framework/dut.py
> +++ b/framework/dut.py
> @@ -208,7 +208,7 @@ class Dut(Crb):
> self.restore_interfaces()
> # rescan ports after interface up
> self.rescan_ports()
> - # load port infor from config file
> + # load port information from config file
> self.load_portconf()
> self.mount_procfs()
> # auto detect network topology
> @@ -933,8 +933,8 @@ class Dut(Crb):
>
> def load_portconf(self):
> """
> - Load port configurations for ports_info. If manually configured infor
> - not same as auto scanned, still use infor in configuration file.
> + Load port configurations for ports_info. If manually configured info
> + not same as auto scanned, still use information in configuration file.
> """
> for port in self.ports_info:
> pci_bus = port['pci']
> @@ -1097,6 +1097,6 @@ class Dut(Crb):
> """
> Recover all resource before crb exit
> """
> - self.logger.logger_exit()
> self.enable_tester_ipv6()
> self.close()
> + self.logger.logger_exit()
> --
> 2.21.0
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [dts] [PATCH V2 1/7] framework/logger: add pktgen logger and remove duplicate
2019-09-23 6:50 ` [dts] [PATCH V2 1/7] framework/logger: add pktgen logger and remove duplicate yufengmx
@ 2019-09-23 6:58 ` Mo, YufengX
0 siblings, 0 replies; 17+ messages in thread
From: Mo, YufengX @ 2019-09-23 6:58 UTC (permalink / raw)
To: dts, Li, WenjieX A, Chen, Zhaoyan, Tu, Lijuan
Tested by Mo, YufengX <yufengx.mo@intel.com>
> -----Original Message-----
> From: Mo, YufengX
> Sent: Monday, September 23, 2019 2:51 PM
> To: dts@dpdk.org; Li, WenjieX A <wenjiex.a.li@intel.com>; Chen, Zhaoyan <zhaoyan.chen@intel.com>; Tu, Lijuan <lijuan.tu@intel.com>
> Cc: Mo, YufengX <yufengx.mo@intel.com>
> Subject: [dts][PATCH V2 1/7] framework/logger: add pktgen logger and remove duplicate
>
> code
>
> *. remove duplicate ixia logger setting.
> *. add pktgen logger setting.
> *. fix typo.
>
> Signed-off-by: yufengmx <yufengx.mo@intel.com>
> ---
> framework/logger.py | 25 +++++++++++++++++++++----
> 1 file changed, 21 insertions(+), 4 deletions(-)
>
> diff --git a/framework/logger.py b/framework/logger.py
> index 603d3aa..32dd954 100644
> --- a/framework/logger.py
> +++ b/framework/logger.py
> @@ -64,6 +64,9 @@ logging.DTS_IXIA_OUTPUT = logging.DEBUG + 5
> logging.DTS_VIRTDUT_CMD = logging.INFO + 6
> logging.DTS_VIRTDUT_OUTPUT = logging.DEBUG + 6
>
> +logging.DTS_PKTGEN_CMD = logging.INFO + 7
> +logging.DTS_PKTGEN_OUTPUT = logging.DEBUG + 7
> +
> logging.addLevelName(logging.DTS_DUT_CMD, 'DTS_DUT_CMD')
> logging.addLevelName(logging.DTS_DUT_OUTPUT, 'DTS_DUT_OUTPUT')
> logging.addLevelName(logging.DTS_DUT_RESULT, 'DTS_DUT_RESULT')
> @@ -84,8 +87,8 @@ logging.addLevelName(logging.SUITE_DUT_OUTPUT, 'SUITE_DUT_OUTPUT')
> logging.addLevelName(logging.SUITE_TESTER_CMD, 'SUITE_TESTER_CMD')
> logging.addLevelName(logging.SUITE_TESTER_OUTPUT, 'SUITE_TESTER_OUTPUT')
>
> -logging.addLevelName(logging.DTS_IXIA_CMD, 'DTS_IXIA_CMD')
> -logging.addLevelName(logging.DTS_IXIA_OUTPUT, 'DTS_IXIA_OUTPUT')
> +logging.addLevelName(logging.DTS_PKTGEN_CMD, 'DTS_PKTGEN_CMD')
> +logging.addLevelName(logging.DTS_PKTGEN_OUTPUT, 'DTS_PKTGEN_OUTPUT')
>
> date_fmt = '%d/%m/%Y %H:%M:%S'
> RESET_COLOR = '\033[0m'
> @@ -149,6 +152,12 @@ class BaseLoggerAdapter(logging.LoggerAdapter):
> def dts_virtdut_output(self, msg, *args, **kwargs):
> self.log(logging.DTS_VIRTDUT_OUTPUT, msg, *args, **kwargs)
>
> + def dts_pktgen_cmd(self, msg, *args, **kwargs):
> + self.log(logging.DTS_PKTGEN_CMD, msg, *args, **kwargs)
> +
> + def dts_pktgen_output(self, msg, *args, **kwargs):
> + self.log(logging.DTS_PKTGEN_OUTPUT, msg, *args, **kwargs)
> +
>
> class ColorHandler(logging.StreamHandler):
> """
> @@ -167,6 +176,8 @@ class ColorHandler(logging.StreamHandler):
> logging.SUITE_TESTER_CMD: '', # SYSTEM
> logging.DTS_IXIA_CMD: '', # SYSTEM
> logging.DTS_IXIA_OUTPUT: '', # SYSTEM
> + logging.DTS_PKTGEN_CMD: '', # SYSTEM
> + logging.DTS_PKTGEN_OUTPUT: '', # SYSTEM
> logging.DTS_VIRTDUT_CMD: '', # SYSTEM
> logging.DTS_VIRTDUT_OUTPUT: '', # SYSTEM
> logging.WARN: '\033[01;33m', # BOLD YELLOW
> @@ -228,7 +239,7 @@ class DTSLOG(BaseLoggerAdapter):
> fh.setFormatter(logging.Formatter(message_fmt, date_fmt))
> ch.setFormatter(logging.Formatter(stream_fmt, date_fmt))
>
> - fh.setLevel(logging.DEBUG) # file hander default level
> + fh.setLevel(logging.DEBUG) # file handler default level
> global verbose
> if verbose is True:
> ch.setLevel(logging.DEBUG)
> @@ -310,6 +321,9 @@ class DTSLOG(BaseLoggerAdapter):
> elif crb.startswith('ixia'):
> self.info_lvl = logging.DTS_IXIA_CMD
> self.debug_lvl = logging.DTS_IXIA_OUTPUT
> + elif crb.startswith('pktgen'):
> + self.info_lvl = logging.DTS_PKTGEN_CMD
> + self.debug_lvl = logging.DTS_PKTGEN_OUTPUT
> elif crb.startswith('virtdut'):
> self.info_lvl = logging.DTS_VIRTDUT_CMD
> self.debug_lvl = logging.DTS_VIRTDUT_OUTPUT
> @@ -342,6 +356,9 @@ class DTSLOG(BaseLoggerAdapter):
> elif crb == 'ixia':
> self.info_lvl = logging.DTS_IXIA_CMD
> self.debug_lvl = logging.DTS_IXIA_OUTPUT
> + elif crb == 'pktgen':
> + self.info_lvl = logging.DTS_PKTGEN_CMD
> + self.debug_lvl = logging.DTS_PKTGEN_OUTPUT
> elif crb == 'virtdut':
> self.info_lvl = logging.DTS_VIRTDUT_CMD
> self.debug_lvl = logging.DTS_VIRTDUT_OUTPUT
> @@ -428,7 +445,7 @@ class LogParser(object):
> # only handle case log
> m = self.case_pattern.match(line.values()[0])
> if m:
> - # not determine case will start from begining
> + # not determine case will start from beginning
> if case_name is None:
> begin = self.loglist.index(line)
> # start from the determined case
> --
> 2.21.0
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [dts] [PATCH V2 0/7] dts/pktgen: fix internal bugs
2019-09-23 6:50 [dts] [PATCH V2 0/7] dts/pktgen: fix internal bugs yufengmx
` (6 preceding siblings ...)
2019-09-23 6:50 ` [dts] [PATCH V2 7/7] framework/pktgen: " yufengmx
@ 2019-09-23 6:58 ` Mo, YufengX
2019-09-24 9:14 ` Tu, Lijuan
8 siblings, 0 replies; 17+ messages in thread
From: Mo, YufengX @ 2019-09-23 6:58 UTC (permalink / raw)
To: dts, Li, WenjieX A, Chen, Zhaoyan, Tu, Lijuan
Tested by Mo, YufengX <yufengx.mo@intel.com>
> -----Original Message-----
> From: Mo, YufengX
> Sent: Monday, September 23, 2019 2:51 PM
> To: dts@dpdk.org; Li, WenjieX A <wenjiex.a.li@intel.com>; Chen, Zhaoyan <zhaoyan.chen@intel.com>; Tu, Lijuan <lijuan.tu@intel.com>
> Cc: Mo, YufengX <yufengx.mo@intel.com>
> Subject: [dts][PATCH V2 0/7] dts/pktgen: fix internal bugs
>
> These commits are internal bugs fixed, which are reported by li,wenjie.
>
> *. move tester/dut logger close after session close for logger used by session.
> *. remove duplicate ixia logger setting.
> *. add pktgen logger setting in logger module.
> *. set pktgen modules part of information logger display to debug level.
> *. set PacketGenerator class logger as Ixia class logger.
> *. remove logger format setting after import libs to fix dts redundant logs.
> *. use tester alt session to close trex.
> *. remove un-used libs.
> *. fix typo.
>
> V2:
> - rebase source code.
> - remove pep8 fix for easy code review.
>
> yufengmx (7):
> framework/logger: add pktgen logger and remove duplicate code
> framework/dut: fix logger quit issue
> framework/tester: fix logger quit issue
> framework/pktgen_base: fix internal bug
> framework/pktgen_ixia: fix internal bug
> framework/pktgen_trex: fix internal bug
> framework/pktgen: fix internal bug
>
> framework/dut.py | 8 ++++----
> framework/logger.py | 25 +++++++++++++++++++++----
> framework/pktgen.py | 9 +--------
> framework/pktgen_base.py | 12 ++----------
> framework/pktgen_ixia.py | 39 +++++++++++++++++++--------------------
> framework/pktgen_trex.py | 38 ++++++++++++++++----------------------
> framework/tester.py | 2 +-
> 7 files changed, 64 insertions(+), 69 deletions(-)
>
> --
> 2.21.0
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [dts] [PATCH V2 0/7] dts/pktgen: fix internal bugs
2019-09-23 6:50 [dts] [PATCH V2 0/7] dts/pktgen: fix internal bugs yufengmx
` (7 preceding siblings ...)
2019-09-23 6:58 ` [dts] [PATCH V2 0/7] dts/pktgen: fix internal bugs Mo, YufengX
@ 2019-09-24 9:14 ` Tu, Lijuan
8 siblings, 0 replies; 17+ messages in thread
From: Tu, Lijuan @ 2019-09-24 9:14 UTC (permalink / raw)
To: Mo, YufengX, dts, Li, WenjieX A, Chen, Zhaoyan
Applied the series, thanks
> -----Original Message-----
> From: Mo, YufengX
> Sent: Monday, September 23, 2019 2:51 PM
> To: dts@dpdk.org; Li, WenjieX A <wenjiex.a.li@intel.com>; Chen, Zhaoyan
> <zhaoyan.chen@intel.com>; Tu, Lijuan <lijuan.tu@intel.com>
> Cc: Mo, YufengX <yufengx.mo@intel.com>
> Subject: [dts][PATCH V2 0/7] dts/pktgen: fix internal bugs
>
> These commits are internal bugs fixed, which are reported by li,wenjie.
>
> *. move tester/dut logger close after session close for logger used by session.
> *. remove duplicate ixia logger setting.
> *. add pktgen logger setting in logger module.
> *. set pktgen modules part of information logger display to debug level.
> *. set PacketGenerator class logger as Ixia class logger.
> *. remove logger format setting after import libs to fix dts redundant logs.
> *. use tester alt session to close trex.
> *. remove un-used libs.
> *. fix typo.
>
> V2:
> - rebase source code.
> - remove pep8 fix for easy code review.
>
> yufengmx (7):
> framework/logger: add pktgen logger and remove duplicate code
> framework/dut: fix logger quit issue
> framework/tester: fix logger quit issue
> framework/pktgen_base: fix internal bug
> framework/pktgen_ixia: fix internal bug
> framework/pktgen_trex: fix internal bug
> framework/pktgen: fix internal bug
>
> framework/dut.py | 8 ++++----
> framework/logger.py | 25 +++++++++++++++++++++----
> framework/pktgen.py | 9 +--------
> framework/pktgen_base.py | 12 ++---------- framework/pktgen_ixia.py | 39
> +++++++++++++++++++--------------------
> framework/pktgen_trex.py | 38 ++++++++++++++++----------------------
> framework/tester.py | 2 +-
> 7 files changed, 64 insertions(+), 69 deletions(-)
>
> --
> 2.21.0
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2019-09-24 9:14 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-23 6:50 [dts] [PATCH V2 0/7] dts/pktgen: fix internal bugs yufengmx
2019-09-23 6:50 ` [dts] [PATCH V2 1/7] framework/logger: add pktgen logger and remove duplicate yufengmx
2019-09-23 6:58 ` Mo, YufengX
2019-09-23 6:50 ` [dts] [PATCH V2 2/7] framework/dut: fix logger quit issue yufengmx
2019-09-23 6:58 ` Mo, YufengX
2019-09-23 6:50 ` [dts] [PATCH V2 3/7] framework/tester: " yufengmx
2019-09-23 6:58 ` Mo, YufengX
2019-09-23 6:50 ` [dts] [PATCH V2 4/7] framework/pktgen_base: fix internal bug yufengmx
2019-09-23 6:58 ` Mo, YufengX
2019-09-23 6:50 ` [dts] [PATCH V2 5/7] framework/pktgen_ixia: " yufengmx
2019-09-23 6:57 ` Mo, YufengX
2019-09-23 6:50 ` [dts] [PATCH V2 6/7] framework/pktgen_trex: " yufengmx
2019-09-23 6:57 ` Mo, YufengX
2019-09-23 6:50 ` [dts] [PATCH V2 7/7] framework/pktgen: " yufengmx
2019-09-23 6:57 ` Mo, YufengX
2019-09-23 6:58 ` [dts] [PATCH V2 0/7] dts/pktgen: fix internal bugs Mo, YufengX
2019-09-24 9:14 ` Tu, Lijuan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).