* [dts] [PATCH V1] framework: add the check of scapy version
@ 2020-10-19 17:30 LihongX Ma
0 siblings, 0 replies; only message in thread
From: LihongX Ma @ 2020-10-19 17:30 UTC (permalink / raw)
To: dts; +Cc: LihongX Ma
- modify the requirement scapy version to 2.4.2
- add the check of the scapy version on tester
Signed-off-by: LihongX Ma <lihongx.ma@intel.com>
---
framework/tester.py | 19 +++++++++++++++++++
requirements.txt | 2 +-
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/framework/tester.py b/framework/tester.py
index ca179b2..008c10d 100644
--- a/framework/tester.py
+++ b/framework/tester.py
@@ -80,6 +80,7 @@ class Tester(Crb):
# prepare for scapy env
self.scapy_sessions_li = list()
self.scapy_session = self.prepare_scapy_env()
+ self.check_scapy_version()
self.tmp_file = '/tmp/tester/'
out = self.send_expect('ls -d %s' % self.tmp_file, '# ', verify=True)
if out == 2:
@@ -105,6 +106,24 @@ class Tester(Crb):
session.logger.warning(f'entering import error: {out}')
return session
+ def check_scapy_version(self):
+ require_version = '2.4.4'
+ self.scapy_session.get_session_before(timeout = 1)
+ self.scapy_session.send_expect('conf.version', '\'')
+ 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,' +
+ 'please update your scapy, otherwise maybe some suite will failed')
+ break
+
def init_ext_gen(self):
"""
Initialize tester packet generator object.
diff --git a/requirements.txt b/requirements.txt
index cb9f636..fae0ace 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -36,5 +36,5 @@ numpy==1.18.5
docutils
pcapy
xlrd
-scapy==2.4.3
+scapy==2.4.4
threadpool
--
2.7.4
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-10-20 1:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-19 17:30 [dts] [PATCH V1] framework: add the check of scapy version LihongX Ma
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).