From: "Chen, BoX C" <box.c.chen@intel.com>
To: dts@dpdk.org
Cc: "Chen, BoX C" <box.c.chen@intel.com>, Chen@dpdk.org
Subject: [dts] [PATCH V1] framework: fix Trex mode not working
Date: Wed, 4 Nov 2020 10:52:09 +0800 [thread overview]
Message-ID: <20201104025209.8423-1-box.c.chen@intel.com> (raw)
DTS requires Trex compatible scapy, modify package loading mode and scapy version verification rules
Signed-off-by: Chen, BoX C <box.c.chen@intel.com>
---
framework/packet.py | 23 +++++++++++++----------
framework/tester.py | 12 ++++--------
2 files changed, 17 insertions(+), 18 deletions(-)
diff --git a/framework/packet.py b/framework/packet.py
index dbc0058..7d974db 100644
--- a/framework/packet.py
+++ b/framework/packet.py
@@ -57,19 +57,22 @@ scapy_modules_required = {'gtp': ['GTP_U_Header', 'GTPPDUSessionContainer'],
local_modules = [m[:-3] for m in os.listdir(DEP_FOLDER + '/scapy_modules') if (m.endswith('.py') and not m.startswith('__'))]
for m in scapy_modules_required:
- if m in local_modules:
- module = import_module(m)
- for clazz in scapy_modules_required[m]:
- locals().update({clazz: getattr(module, clazz)})
- else:
- if m == 'sctp':
- module = import_module(f'scapy.layers.{m}')
+ try:
+ if m in local_modules:
+ module = import_module(m)
for clazz in scapy_modules_required[m]:
locals().update({clazz: getattr(module, clazz)})
else:
- module = import_module(f'scapy.contrib.{m}')
- for clazz in scapy_modules_required[m]:
- locals().update({clazz: getattr(module, clazz)})
+ if m == 'sctp':
+ module = import_module(f'scapy.layers.{m}')
+ for clazz in scapy_modules_required[m]:
+ locals().update({clazz: getattr(module, clazz)})
+ else:
+ module = import_module(f'scapy.contrib.{m}')
+ for clazz in scapy_modules_required[m]:
+ locals().update({clazz: getattr(module, clazz)})
+ except Exception as e:
+ print(e)
def get_scapy_module_impcmd():
cmd_li = list()
diff --git a/framework/tester.py b/framework/tester.py
index df432d5..b2cbdb0 100644
--- a/framework/tester.py
+++ b/framework/tester.py
@@ -111,21 +111,17 @@ class Tester(Crb):
def check_scapy_version(self):
require_version = '2.4.4'
- self.scapy_session.get_session_before(timeout = 1)
+ self.scapy_session.get_session_before(timeout=1)
self.scapy_session.send_expect('conf.version', '\'')
- out = self.scapy_session.get_session_before(timeout = 1)
+ out = self.scapy_session.get_session_before(timeout=1)
cur_version = out[:out.find('\'')]
out = self.session.send_expect('grep scapy requirements.txt', '# ')
value = re.search('scapy\s*==\s*(\S*)', out)
if value is not None:
require_version = value.group(1)
- cur_version = cur_version.split('.')
- require_version = require_version.split('.')
- for i in range(len(require_version)):
- if int(cur_version[i]) < int(require_version[i]):
- self.logger.warning('The scapy vesrion not meet the requirement on tester,' +
+ if cur_version != require_version:
+ self.logger.warning('The scapy vesrion not meet the requirement on tester,' +
'please update your scapy, otherwise maybe some suite will failed')
- break
def init_ext_gen(self):
"""
--
2.17.1
next reply other threads:[~2020-11-04 2:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-04 2:52 Chen, BoX C [this message]
2020-11-11 2:50 ` Tu, Lijuan
2020-11-04 3:00 [dts] [PATCH V1] framework: fix trex " Chen, BoX C
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201104025209.8423-1-box.c.chen@intel.com \
--to=box.c.chen@intel.com \
--cc=Chen@dpdk.org \
--cc=dts@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).