From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id CECF0A04E7; Wed, 4 Nov 2020 03:54:43 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D9BBCBE63; Wed, 4 Nov 2020 03:54:41 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 4A8F2BE5F for ; Wed, 4 Nov 2020 03:54:39 +0100 (CET) IronPort-SDR: LgfOlXcxE+uzGqKFwj9uOaLgHjaHuk06Lft+w54s3Ioi0jfft/5qO01O792yZRoJfXcK6pz7m+ qP7zsC6VNH8A== X-IronPort-AV: E=McAfee;i="6000,8403,9794"; a="253868858" X-IronPort-AV: E=Sophos;i="5.77,449,1596524400"; d="scan'208";a="253868858" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Nov 2020 18:54:37 -0800 IronPort-SDR: I/k/PRH93YFjNmtHc2Vd2v24FnYTSy3zfZl6nssSZPNldkCZ79ys1uMwMON+W0rJG8RWXd6ySS FzuymVVlRXDQ== X-IronPort-AV: E=Sophos;i="5.77,449,1596524400"; d="scan'208";a="471038226" Received: from unknown (HELO cb-dts.sh.intel.com) ([10.240.183.58]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Nov 2020 18:54:35 -0800 From: "Chen, BoX C" To: dts@dpdk.org Cc: "Chen, BoX C" , Chen@dpdk.org Date: Wed, 4 Nov 2020 10:52:09 +0800 Message-Id: <20201104025209.8423-1-box.c.chen@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dts] [PATCH V1] framework: fix Trex mode not working X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org Sender: "dts" DTS requires Trex compatible scapy, modify package loading mode and scapy version verification rules Signed-off-by: Chen, BoX C --- 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