diff mbox series

[v1] framework/pktgen_*: fix pylama errors

Message ID 1637835881-7535-1-git-send-email-juraj.linkes@pantheon.tech (mailing list archive)
State New
Headers show
Series [v1] framework/pktgen_*: fix pylama errors | expand

Checks

Context Check Description
ci/Intel-dts-suite-test fail Testing issues

Commit Message

Juraj Linkeš Nov. 25, 2021, 10:24 a.m. UTC
Pylama found the following errors:
framework/pktgen_base.py:108: [E] E1101 Instance of 'PacketGenerator' has no '_get_gen_port' member [pylint]
framework/pktgen_base.py:148: [E] E1101 Instance of 'PacketGenerator' has no '_clear_streams' member; maybe 'clear_streams'? [pylint]
framework/pktgen_base.py:173: [E] E1101 Instance of 'PacketGenerator' has no 'pktgen_type' member [pylint]
framework/pktgen_base.py:279: [E] E1101 Instance of 'PacketGenerator' has no 'pktgen_type' member [pylint]
framework/pktgen_base.py:479: [E] E1101 Instance of 'PacketGenerator' has no '_clear_streams' member; maybe 'clear_streams'? [pylint]
framework/pktgen_base.py:528: [E] E0602 Undefined variable 'last_no_lost_mult' [pylint]
framework/pktgen_base.py:558: [E] E1101 Instance of 'PacketGenerator' has no 'pktgen_type' member [pylint]
framework/pktgen_base.py:573: [E] E1101 Instance of 'PacketGenerator' has no '_clear_streams' member; maybe 'clear_streams'? [pylint]
framework/pktgen_base.py:607: [E] E1101 Instance of 'PacketGenerator' has no '_clear_streams' member; maybe 'clear_streams'? [pylint]
framework/pktgen_base.py:673: [E] E1101 Instance of 'PacketGenerator' has no 'pktgen_type' member [pylint]
framework/pktgen_base.py:677: [E] E1101 Instance of 'PacketGenerator' has no 'pktgen_type' member [pylint]
framework/pktgen_base.py:69: [E] E1101 Instance of 'PacketGenerator' has no '_prepare_generator' member; maybe 'prepare_generator'? [pylint]
framework/pktgen_base.py:77: [E] E1101 Instance of 'PacketGenerator' has no '_get_port_pci' member [pylint]
framework/pktgen_ixia.py:1085: [E] E1306 Not enough arguments for format string [pylint]
framework/pktgen_trex.py:194: [E] E0602 Undefined variable 'Ether' [pylint]
framework/pktgen_trex.py:195: [E] E0602 Undefined variable 'IP' [pylint]

Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
---
Lijuan, please add additional people to review if needed.
---
 framework/pktgen_base.py | 15 ++++++++++++++-
 framework/pktgen_ixia.py |  2 +-
 framework/pktgen_trex.py |  3 +++
 3 files changed, 18 insertions(+), 2 deletions(-)

Comments

Tu, Lijuan Nov. 25, 2021, 10:27 a.m. UTC | #1
> -----Original Message-----
> From: Juraj Linkeš <juraj.linkes@pantheon.tech>
> Sent: 2021年11月25日 18:25
> To: Tu, Lijuan <lijuan.tu@intel.com>; ohilyard@iol.unh.edu
> Cc: dts@dpdk.org; Juraj Linkeš <juraj.linkes@pantheon.tech>
> Subject: [PATCH v1] framework/pktgen_*: fix pylama errors
> 
> Pylama found the following errors:
> framework/pktgen_base.py:108: [E] E1101 Instance of 'PacketGenerator' has no
> '_get_gen_port' member [pylint]
> framework/pktgen_base.py:148: [E] E1101 Instance of 'PacketGenerator' has no
> '_clear_streams' member; maybe 'clear_streams'? [pylint]
> framework/pktgen_base.py:173: [E] E1101 Instance of 'PacketGenerator' has no
> 'pktgen_type' member [pylint]
> framework/pktgen_base.py:279: [E] E1101 Instance of 'PacketGenerator' has no
> 'pktgen_type' member [pylint]
> framework/pktgen_base.py:479: [E] E1101 Instance of 'PacketGenerator' has no
> '_clear_streams' member; maybe 'clear_streams'? [pylint]
> framework/pktgen_base.py:528: [E] E0602 Undefined variable
> 'last_no_lost_mult' [pylint]
> framework/pktgen_base.py:558: [E] E1101 Instance of 'PacketGenerator' has no
> 'pktgen_type' member [pylint]
> framework/pktgen_base.py:573: [E] E1101 Instance of 'PacketGenerator' has no
> '_clear_streams' member; maybe 'clear_streams'? [pylint]
> framework/pktgen_base.py:607: [E] E1101 Instance of 'PacketGenerator' has no
> '_clear_streams' member; maybe 'clear_streams'? [pylint]
> framework/pktgen_base.py:673: [E] E1101 Instance of 'PacketGenerator' has no
> 'pktgen_type' member [pylint]
> framework/pktgen_base.py:677: [E] E1101 Instance of 'PacketGenerator' has no
> 'pktgen_type' member [pylint]
> framework/pktgen_base.py:69: [E] E1101 Instance of 'PacketGenerator' has no
> '_prepare_generator' member; maybe 'prepare_generator'? [pylint]
> framework/pktgen_base.py:77: [E] E1101 Instance of 'PacketGenerator' has no
> '_get_port_pci' member [pylint]
> framework/pktgen_ixia.py:1085: [E] E1306 Not enough arguments for format
> string [pylint]
> framework/pktgen_trex.py:194: [E] E0602 Undefined variable 'Ether' [pylint]
> framework/pktgen_trex.py:195: [E] E0602 Undefined variable 'IP' [pylint]
> 
> Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
> ---
> Lijuan, please add additional people to review if needed.

Hi Juraj,

Can I know your plan for fixing pylama errors.
Juraj Linkeš Nov. 25, 2021, 10:33 a.m. UTC | #2
> -----Original Message-----
> From: Tu, Lijuan <lijuan.tu@intel.com>
> Sent: Thursday, November 25, 2021 11:28 AM
> To: Juraj Linkeš <juraj.linkes@pantheon.tech>; ohilyard@iol.unh.edu
> Cc: dts@dpdk.org
> Subject: RE: [PATCH v1] framework/pktgen_*: fix pylama errors
> 
> 
> 
> > -----Original Message-----
> > From: Juraj Linkeš <juraj.linkes@pantheon.tech>
> > Sent: 2021年11月25日 18:25
> > To: Tu, Lijuan <lijuan.tu@intel.com>; ohilyard@iol.unh.edu
> > Cc: dts@dpdk.org; Juraj Linkeš <juraj.linkes@pantheon.tech>
> > Subject: [PATCH v1] framework/pktgen_*: fix pylama errors
> >
> > Pylama found the following errors:
> > framework/pktgen_base.py:108: [E] E1101 Instance of 'PacketGenerator'
> > has no '_get_gen_port' member [pylint]
> > framework/pktgen_base.py:148: [E] E1101 Instance of 'PacketGenerator'
> > has no '_clear_streams' member; maybe 'clear_streams'? [pylint]
> > framework/pktgen_base.py:173: [E] E1101 Instance of 'PacketGenerator'
> > has no 'pktgen_type' member [pylint]
> > framework/pktgen_base.py:279: [E] E1101 Instance of 'PacketGenerator'
> > has no 'pktgen_type' member [pylint]
> > framework/pktgen_base.py:479: [E] E1101 Instance of 'PacketGenerator'
> > has no '_clear_streams' member; maybe 'clear_streams'? [pylint]
> > framework/pktgen_base.py:528: [E] E0602 Undefined variable
> > 'last_no_lost_mult' [pylint]
> > framework/pktgen_base.py:558: [E] E1101 Instance of 'PacketGenerator'
> > has no 'pktgen_type' member [pylint]
> > framework/pktgen_base.py:573: [E] E1101 Instance of 'PacketGenerator'
> > has no '_clear_streams' member; maybe 'clear_streams'? [pylint]
> > framework/pktgen_base.py:607: [E] E1101 Instance of 'PacketGenerator'
> > has no '_clear_streams' member; maybe 'clear_streams'? [pylint]
> > framework/pktgen_base.py:673: [E] E1101 Instance of 'PacketGenerator'
> > has no 'pktgen_type' member [pylint]
> > framework/pktgen_base.py:677: [E] E1101 Instance of 'PacketGenerator'
> > has no 'pktgen_type' member [pylint]
> > framework/pktgen_base.py:69: [E] E1101 Instance of 'PacketGenerator'
> > has no '_prepare_generator' member; maybe 'prepare_generator'?
> > [pylint]
> > framework/pktgen_base.py:77: [E] E1101 Instance of 'PacketGenerator'
> > has no '_get_port_pci' member [pylint]
> > framework/pktgen_ixia.py:1085: [E] E1306 Not enough arguments for
> > format string [pylint]
> > framework/pktgen_trex.py:194: [E] E0602 Undefined variable 'Ether'
> > [pylint]
> > framework/pktgen_trex.py:195: [E] E0602 Undefined variable 'IP'
> > [pylint]
> >
> > Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
> > ---
> > Lijuan, please add additional people to review if needed.
> 
> Hi Juraj,
> 
> Can I know your plan for fixing pylama errors.

The plan is to fix them, not sure how much more there is to it. I'm just going through the errors in the various file where Pylama reports them and sending patches. Sometimes it makes sense to submit fixes in multiple related files, sometimes I'm fixing the error one file at a time.
Juraj Linkeš Nov. 25, 2021, 11:02 a.m. UTC | #3
> -----Original Message-----
> From: Juraj Linkeš <juraj.linkes@pantheon.tech>
> Sent: Thursday, November 25, 2021 11:33 AM
> To: Tu, Lijuan <lijuan.tu@intel.com>; ohilyard@iol.unh.edu
> Cc: dts@dpdk.org
> Subject: RE: [PATCH v1] framework/pktgen_*: fix pylama errors
> 
> 
> 
> > -----Original Message-----
> > From: Tu, Lijuan <lijuan.tu@intel.com>
> > Sent: Thursday, November 25, 2021 11:28 AM
> > To: Juraj Linkeš <juraj.linkes@pantheon.tech>; ohilyard@iol.unh.edu
> > Cc: dts@dpdk.org
> > Subject: RE: [PATCH v1] framework/pktgen_*: fix pylama errors
> >
> >
> >
> > > -----Original Message-----
> > > From: Juraj Linkeš <juraj.linkes@pantheon.tech>
> > > Sent: 2021年11月25日 18:25
> > > To: Tu, Lijuan <lijuan.tu@intel.com>; ohilyard@iol.unh.edu
> > > Cc: dts@dpdk.org; Juraj Linkeš <juraj.linkes@pantheon.tech>
> > > Subject: [PATCH v1] framework/pktgen_*: fix pylama errors
> > >
> > > Pylama found the following errors:
> > > framework/pktgen_base.py:108: [E] E1101 Instance of 'PacketGenerator'
> > > has no '_get_gen_port' member [pylint]
> > > framework/pktgen_base.py:148: [E] E1101 Instance of 'PacketGenerator'
> > > has no '_clear_streams' member; maybe 'clear_streams'? [pylint]
> > > framework/pktgen_base.py:173: [E] E1101 Instance of 'PacketGenerator'
> > > has no 'pktgen_type' member [pylint]
> > > framework/pktgen_base.py:279: [E] E1101 Instance of 'PacketGenerator'
> > > has no 'pktgen_type' member [pylint]
> > > framework/pktgen_base.py:479: [E] E1101 Instance of 'PacketGenerator'
> > > has no '_clear_streams' member; maybe 'clear_streams'? [pylint]
> > > framework/pktgen_base.py:528: [E] E0602 Undefined variable
> > > 'last_no_lost_mult' [pylint]
> > > framework/pktgen_base.py:558: [E] E1101 Instance of 'PacketGenerator'
> > > has no 'pktgen_type' member [pylint]
> > > framework/pktgen_base.py:573: [E] E1101 Instance of 'PacketGenerator'
> > > has no '_clear_streams' member; maybe 'clear_streams'? [pylint]
> > > framework/pktgen_base.py:607: [E] E1101 Instance of 'PacketGenerator'
> > > has no '_clear_streams' member; maybe 'clear_streams'? [pylint]
> > > framework/pktgen_base.py:673: [E] E1101 Instance of 'PacketGenerator'
> > > has no 'pktgen_type' member [pylint]
> > > framework/pktgen_base.py:677: [E] E1101 Instance of 'PacketGenerator'
> > > has no 'pktgen_type' member [pylint]
> > > framework/pktgen_base.py:69: [E] E1101 Instance of 'PacketGenerator'
> > > has no '_prepare_generator' member; maybe 'prepare_generator'?
> > > [pylint]
> > > framework/pktgen_base.py:77: [E] E1101 Instance of 'PacketGenerator'
> > > has no '_get_port_pci' member [pylint]
> > > framework/pktgen_ixia.py:1085: [E] E1306 Not enough arguments for
> > > format string [pylint]
> > > framework/pktgen_trex.py:194: [E] E0602 Undefined variable 'Ether'
> > > [pylint]
> > > framework/pktgen_trex.py:195: [E] E0602 Undefined variable 'IP'
> > > [pylint]
> > >
> > > Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
> > > ---
> > > Lijuan, please add additional people to review if needed.
> >
> > Hi Juraj,
> >
> > Can I know your plan for fixing pylama errors.
> 
> The plan is to fix them, not sure how much more there is to it. I'm just going
> through the errors in the various file where Pylama reports them and sending
> patches. Sometimes it makes sense to submit fixes in multiple related files,
> sometimes I'm fixing the error one file at a time.

Let me know if there's something better we can do. I want to go through everything except testsuites, at least until I know that all of the deprecated testcases have been removed.
diff mbox series

Patch

diff --git a/framework/pktgen_base.py b/framework/pktgen_base.py
index 023652cc..16eae93f 100644
--- a/framework/pktgen_base.py
+++ b/framework/pktgen_base.py
@@ -64,10 +64,17 @@  class PacketGenerator(object):
         self.tester = tester
         self.__streams = []
         self._ports_map = []
+        self.pktgen_type = None
+
+    def _prepare_generator(self):
+        raise NotImplementedError
 
     def prepare_generator(self):
         self._prepare_generator()
 
+    def _get_port_pci(self, port_id):
+        raise NotImplementedError
+
     def _convert_pktgen_port(self, port_id):
         '''
         :param port_id:
@@ -94,6 +101,9 @@  class PacketGenerator(object):
 
         return port
 
+    def _get_gen_port(self, tester_pci):
+        raise NotImplementedError
+
     def _convert_tester_port(self, port_id):
         '''
         :param port_id:
@@ -143,6 +153,9 @@  class PacketGenerator(object):
     def get_streams(self):
         return self.__streams
 
+    def _clear_streams(self):
+        raise NotImplementedError
+
     def clear_streams(self):
         ''' clear streams '''
         self._clear_streams()
@@ -525,7 +538,7 @@  class PacketGenerator(object):
                 break
             pps = (traffic_pps_max - traffic_pps_min)/2 + traffic_pps_min
 
-        self.logger.info("zero loss pps is %f" % last_no_lost_mult)
+        self.logger.info("zero loss pps is %f" % pps)
         # use last result as return data to keep the same with dts/etgen format
         # In fact, multiple link peer have multiple loss rate value,
         # here only pick one
diff --git a/framework/pktgen_ixia.py b/framework/pktgen_ixia.py
index 06667047..9a8c9d2e 100644
--- a/framework/pktgen_ixia.py
+++ b/framework/pktgen_ixia.py
@@ -1082,7 +1082,7 @@  class Ixia(SSHConnection):
         Tells IXIA to prepare the internal buffers were the frames were captured.
         """
         ixia_port = self.get_ixia_port(port_number)
-        command = 'capture get {0} {1} {2}'.format(ixia_port)
+        command = 'capture get {0}'.format(ixia_port)
         self.send_expect(command, '% ', 30)
 
     def stat_get_rate_stat_all_stats(self, port_number):
diff --git a/framework/pktgen_trex.py b/framework/pktgen_trex.py
index 2ad05fe6..7acbbc2d 100644
--- a/framework/pktgen_trex.py
+++ b/framework/pktgen_trex.py
@@ -35,6 +35,9 @@  import sys
 import time
 from pprint import pformat
 
+from scapy.layers.inet import IP
+from scapy.layers.l2 import Ether
+
 from .pktgen_base import (
     PKTGEN,
     PKTGEN_TREX,