From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5B267A034F; Mon, 6 Dec 2021 13:14:27 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 51EC24013F; Mon, 6 Dec 2021 13:14:27 +0100 (CET) Received: from lb.pantheon.sk (lb.pantheon.sk [46.229.239.20]) by mails.dpdk.org (Postfix) with ESMTP id 9165440040 for ; Mon, 6 Dec 2021 13:14:25 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by lb.pantheon.sk (Postfix) with ESMTP id EC977134296; Mon, 6 Dec 2021 13:14:24 +0100 (CET) X-Virus-Scanned: amavisd-new at siecit.sk Received: from lb.pantheon.sk ([127.0.0.1]) by localhost (lb.pantheon.sk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id w_UJVEZyDorv; Mon, 6 Dec 2021 13:14:23 +0100 (CET) Received: from service-node1.lab.pantheon.local (unknown [46.229.239.141]) by lb.pantheon.sk (Postfix) with ESMTP id 6D16A130F7E; Mon, 6 Dec 2021 13:14:23 +0100 (CET) From: =?UTF-8?q?Juraj=20Linke=C5=A1?= To: lijuan.tu@intel.com, ohilyard@iol.unh.edu Cc: dts@dpdk.org, =?UTF-8?q?Juraj=20Linke=C5=A1?= Subject: [PATCH v1] framework/crb: fix pylama errors Date: Mon, 6 Dec 2021 13:14:23 +0100 Message-Id: <1638792863-1811-1-git-send-email-juraj.linkes@pantheon.tech> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 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 Pylama found the following errors: framework/crb.py:68: [E] E1101 Instance of 'Crb' has no 'get_ip_address' member [pylint] framework/crb.py:69: [E] E1101 Instance of 'Crb' has no 'get_username' member [pylint] framework/crb.py:70: [E] E1101 Instance of 'Crb' has no 'get_password' member [pylint] framework/crb.py:74: [E] E1101 Instance of 'Crb' has no 'get_ip_address' member [pylint] framework/crb.py:76: [E] E1101 Instance of 'Crb' has no 'get_username' member [pylint] framework/crb.py:77: [E] E1101 Instance of 'Crb' has no 'get_password' member [pylint] framework/crb.py:109: [E] E1101 Instance of 'Crb' has no 'get_ip_address' member [pylint] framework/crb.py:111: [E] E1101 Instance of 'Crb' has no 'get_username' member [pylint] framework/crb.py:112: [E] E1101 Instance of 'Crb' has no 'get_password' member [pylint] framework/crb.py:140: [E] E1101 Instance of 'Crb' has no 'loggger' member; maybe 'logger'? [pylint] framework/crb.py:144: [E] E1101 Instance of 'Crb' has no 'get_ip_address' member [pylint] framework/crb.py:146: [E] E1101 Instance of 'Crb' has no 'get_username' member [pylint] framework/crb.py:147: [E] E1101 Instance of 'Crb' has no 'get_password' member [pylint] framework/crb.py:150: [E] E1101 Instance of 'Crb' has no 'get_ip_address' member [pylint] framework/crb.py:151: [E] E1101 Instance of 'Crb' has no 'get_username' member [pylint] framework/crb.py:151: [E] E1101 Instance of 'Crb' has no 'get_password' member [pylint] framework/crb.py:254: [E] E1136 Value 'self.ports_info' is unsubscriptable [pylint] framework/crb.py:270: [E] E1101 Instance of 'Crb' has no 'PCI_DEV_CACHE_KEY' member [pylint] framework/crb.py:274: [E] E1101 Instance of 'Crb' has no 'PCI_DEV_CACHE_KEY' member [pylint] framework/crb.py:391: [E] E1120 No value for argument 'string' in function call [pylint] framework/crb.py:478: [E] E1101 Instance of 'Crb' has no 'get_password' member [pylint] framework/crb.py:560: [E] E0203 Access to member 'prefix_list' before its definition line 564 [pylint] framework/crb.py:562: [E] E0203 Access to member 'prefix_list' before its definition line 564 [pylint] framework/crb.py:606: [E] E1101 Instance of 'Crb' has no 'NUMBER_CORES_CACHE_KEY' member [pylint] framework/crb.py:607: [E] E1101 Instance of 'Crb' has no 'CORE_LIST_CACHE_KEY' member [pylint] framework/crb.py:611: [E] E1101 Instance of 'Crb' has no 'NUMBER_CORES_CACHE_KEY' member [pylint] framework/crb.py:612: [E] E1101 Instance of 'Crb' has no 'CORE_LIST_CACHE_KEY' member [pylint] framework/crb.py:880: [E] E1133 Non-iterable value self.ports_info is used in an iterating context [pylint] framework/crb.py:888: [E] E1136 Value 'self.ports_info' is unsubscriptable [pylint] Signed-off-by: Juraj Linkeš --- Lijuan, please add additional people to review if needed. --- framework/crb.py | 29 ++++++++++++++++++++++++++--- framework/dut.py | 20 -------------------- framework/tester.py | 18 ------------------ framework/virt_dut.py | 2 -- 4 files changed, 26 insertions(+), 43 deletions(-) diff --git a/framework/crb.py b/framework/crb.py index c9909add..e4a297dd 100755 --- a/framework/crb.py +++ b/framework/crb.py @@ -51,18 +51,23 @@ class Crb(object): CPU/PCI/NIC on the board and setup running environment for DPDK. """ + PCI_DEV_CACHE_KEY = None + NUMBER_CORES_CACHE_KEY = None + CORE_LIST_CACHE_KEY = None + def __init__(self, crb, serializer, name, alt_session=True, dut_id=0): self.dut_id = dut_id self.crb = crb self.read_cache = False self.skip_setup = False self.serializer = serializer - self.ports_info = None + self.ports_info = [] self.sessions = [] self.stage = 'pre-init' self.name = name self.trex_prefix = None self.default_hugepages_cleared = False + self.prefix_list = [] self.logger = getLogger(name) self.session = SSHConnection(self.get_ip_address(), name, @@ -80,6 +85,24 @@ class Crb(object): else: self.alt_session = None + def get_ip_address(self): + """ + Get CRB's ip address. + """ + return self.crb['IP'] + + def get_password(self): + """ + Get CRB's login password. + """ + return self.crb['pass'] + + def get_username(self): + """ + Get CRB's login username. + """ + return self.crb['user'] + def send_expect(self, cmds, expected, timeout=TIMEOUT, alt_session=False, verify=False, trim_whitespace=True): """ @@ -137,7 +160,7 @@ class Crb(object): else: self.session.close(force=True) except Exception as e: - self.loggger.error("Session close failed for [%s]" % e) + self.logger.error("Session close failed for [%s]" % e) if alt_session: session = SSHConnection( @@ -388,7 +411,7 @@ class Crb(object): (domain_id, bus_id, devfun_id), "# ", alt_session=True) rexp = r"PCI_ID=(.+)" pattern = re.compile(rexp) - match = re.search(out) + match = re.search(pattern, out) if not match: return None return match.group(1) diff --git a/framework/dut.py b/framework/dut.py index dc3fc874..25d3c64b 100644 --- a/framework/dut.py +++ b/framework/dut.py @@ -71,14 +71,12 @@ class Dut(Crb): self.tester = None self.cores = [] self.architecture = None - self.ports_info = [] self.conf = PortConf() self.ports_map = [] self.virt_pool = None # hypervisor pid list, used for cleanup self.virt_pids = [] self.prefix_subfix = str(os.getpid()) + '_' + time.strftime("%Y%m%d%H%M%S", time.localtime()) - self.prefix_list = [] self.hugepage_path = None self.apps_name_conf = {} self.apps_name = {} @@ -350,24 +348,6 @@ class Dut(Crb): """ self.send_expect('mount -t procfs proc /proc', '# ') - def get_ip_address(self): - """ - Get DUT's ip address. - """ - return self.crb['IP'] - - def get_password(self): - """ - Get DUT's login password. - """ - return self.crb['pass'] - - def get_username(self): - """ - Get DUT's login username. - """ - return self.crb['user'] - def dut_prerequisites(self): """ Prerequest function should be called before execute any test case. diff --git a/framework/tester.py b/framework/tester.py index 9dba4e4d..fa8a5f69 100644 --- a/framework/tester.py +++ b/framework/tester.py @@ -151,24 +151,6 @@ class Tester(Crb): """ self.re_run_time = int(re_run_time) - def get_ip_address(self): - """ - Get ip address of tester CRB. - """ - return self.crb['tester IP'] - - def get_username(self): - """ - Get login username of tester CRB. - """ - return USERNAME - - def get_password(self): - """ - Get tester login password of tester CRB. - """ - return self.crb['tester pass'] - @property def is_pktgen(self): """ diff --git a/framework/virt_dut.py b/framework/virt_dut.py index bde65667..ca8c8c6b 100644 --- a/framework/virt_dut.py +++ b/framework/virt_dut.py @@ -78,11 +78,9 @@ class VirtDut(DPDKdut): self.tester = None self.cores = [] self.architecture = None - self.ports_info = None self.ports_map = [] self.virttype = virttype self.prefix_subfix = str(os.getpid()) + '_' + time.strftime("%Y%m%d%H%M%S", time.localtime()) - self.prefix_list = [] self.apps_name_conf = {} self.apps_name = {} -- 2.20.1