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 0D255A0613 for ; Mon, 23 Sep 2019 08:49:12 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B13051BEB2; Mon, 23 Sep 2019 08:49:11 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 194754CE4 for ; Mon, 23 Sep 2019 08:49:06 +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 orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Sep 2019 23:49:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,539,1559545200"; d="scan'208";a="388384337" Received: from dpdk-moyufen06.sh.intel.com ([10.67.116.222]) by fmsmga005.fm.intel.com with ESMTP; 22 Sep 2019 23:49:04 -0700 From: yufengmx To: dts@dpdk.org, wenjiex.a.li@intel.com, zhaoyan.chen@intel.com, lijuan.tu@intel.com Cc: yufengmx Date: Mon, 23 Sep 2019 14:50:34 +0800 Message-Id: <20190923065040.8251-2-yufengx.mo@intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190923065040.8251-1-yufengx.mo@intel.com> References: <20190923065040.8251-1-yufengx.mo@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dts] [PATCH V2 1/7] framework/logger: add pktgen logger and remove duplicate 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" code *. remove duplicate ixia logger setting. *. add pktgen logger setting. *. fix typo. Signed-off-by: yufengmx --- 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