[V1] framework: add the check of scapy version
Commit Message
- 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(-)
@@ -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.
@@ -36,5 +36,5 @@ numpy==1.18.5
docutils
pcapy
xlrd
-scapy==2.4.3
+scapy==2.4.4
threadpool