From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mellanox.co.il (unknown [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 968466A80 for ; Tue, 27 Oct 2015 07:08:13 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from root@r-aa-dragon7.rdmz.labs.mlnx) with ESMTPS (AES256-SHA encrypted); 27 Oct 2015 08:08:00 +0200 Received: from r-aa-dragon7.rdmz.labs.mlnx (r-aa-dragon7.rdmz.labs.mlnx [10.224.14.90]) by filer01.rdmz.labs.mlnx (8.13.8/8.13.8) with ESMTP id t9R67xEV010148; Tue, 27 Oct 2015 08:07:59 +0200 Received: from r-aa-dragon7.rdmz.labs.mlnx (localhost [127.0.0.1]) by r-aa-dragon7.rdmz.labs.mlnx (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id t9R67xcg031875; Tue, 27 Oct 2015 08:07:59 +0200 Received: (from root@localhost) by r-aa-dragon7.rdmz.labs.mlnx (8.14.4/8.14.4/Submit) id t9R67xkk031874; Tue, 27 Oct 2015 08:07:59 +0200 From: Raslan Darawsheh To: dts@dpdk.org Date: Tue, 27 Oct 2015 08:07:50 +0200 Message-Id: <1445926076-31279-1-git-send-email-rasland@mellanox.com> X-Mailer: git-send-email 1.9.1 Cc: rdarawsheh@asaltech.com Subject: [dts] [PATCH 1/6] framework: crb :add some parameters and check_Mellanox_pci function to identify mellanox device 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: , X-List-Received-Date: Tue, 27 Oct 2015 06:08:14 -0000 From: Raslsn Darawsheh Signed-off-by: Raslsn Darawsheh --- framework/crb.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/framework/crb.py b/framework/crb.py index fcbd7d9..0acec3b 100644 --- a/framework/crb.py +++ b/framework/crb.py @@ -33,7 +33,7 @@ import time import dts import re import os -from settings import TIMEOUT, IXIA +from settings import TIMEOUT, IXIA, NICS """ CRB (customer reference board) basic functions and handlers @@ -54,6 +54,9 @@ class Crb(object): self.skip_setup = False self.serializer = serializer self.ports_info = None + self.isMellanox = False + self.mellanoxPortCount = 0 + self.mellanoxCardType = None def send_expect(self, cmds, expected, timeout=TIMEOUT, alt_session=False, verify=False): @@ -79,6 +82,19 @@ class Crb(object): return self.session.send_command(cmds, timeout) + def check_Mellanox_pci(self,pci_bus,pci_id): + """ + check if the PCI is Mellanox device or not + its used to set a flag to handle Mellanox ports differently + """ + out = self.send_expect("lspci -nn | grep -i " + pci_bus, "# ") + if "Mell" in out: + self.isMellanox =True + if NICS['ConnectX_4'] in out: + self.mellanoxCardType = "cx4" + else: + self.mellanoxCardType = "cx3" + def get_session_output(self, timeout=TIMEOUT): """ Get session output message before timeout @@ -196,6 +212,11 @@ class Crb(object): rexp = r"([\da-f]{2}:[\da-f]{2}.\d{1}) .*Eth.*?ernet .*?([\da-f]{4}:[\da-f]{4})" pattern = re.compile(rexp) match = pattern.findall(out) + out = self.send_expect( + "lspci -nn ", "# ", alt_session=True) + rexp = r"([\da-f]{2}:[\da-f]{2}.\d{1}) Network .*?([\da-f]{4}:[\da-f]{4})" + pattern = re.compile(rexp) + match += pattern.findall(out) self.pci_devices_info = [] for i in range(len(match)): self.pci_devices_info.append((match[i][0], match[i][1])) -- 1.8.3.1