[dts] [PATCH V2 4/7] framework/pktgen_base: fix internal bug

yufengmx yufengx.mo at intel.com
Mon Sep 23 08:50:37 CEST 2019


*. 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 at 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



More information about the dts mailing list