From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id C6683AD9C for ; Wed, 4 Feb 2015 07:59:40 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP; 03 Feb 2015 22:54:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,517,1418112000"; d="scan'208";a="522270535" Received: from pgsmsx105.gar.corp.intel.com ([10.221.44.96]) by orsmga003.jf.intel.com with ESMTP; 03 Feb 2015 22:51:59 -0800 Received: from kmsmsx154.gar.corp.intel.com (172.21.73.14) by PGSMSX105.gar.corp.intel.com (10.221.44.96) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 4 Feb 2015 14:59:36 +0800 Received: from shsmsx103.ccr.corp.intel.com (10.239.110.14) by KMSMSX154.gar.corp.intel.com (172.21.73.14) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 4 Feb 2015 14:59:35 +0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.253]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.91]) with mapi id 14.03.0195.001; Wed, 4 Feb 2015 14:59:36 +0800 From: "Qiu, Michael" To: "Liu, Yong" , "dts@dpdk.org" Thread-Topic: [dts] [PATCH v2 3/4] framework: reorganize DUT and Tester port initialize sequence Thread-Index: AQHQQEYO1hyF0+3e6kWBLVz7nnhaGQ== Date: Wed, 4 Feb 2015 06:59:34 +0000 Message-ID: <533710CFB86FA344BFBF2D6802E60286CD4647@SHSMSX101.ccr.corp.intel.com> References: <1423032214-19856-1-git-send-email-yong.liu@intel.com> <1423032214-19856-4-git-send-email-yong.liu@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [PATCH v2 3/4] framework: reorganize DUT and Tester port initialize sequence 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: Wed, 04 Feb 2015 06:59:42 -0000 On 2/4/2015 2:44 PM, Yong Liu wrote:=0A= > DUT port initialization sequence: scan,restore,rescan,load config=0A= > Test port initialization sequence: modprobe, interface up=0A= > Separate restore interface function from DUT and Tester.=0A= >=0A= > Signed-off-by: Marvinliu =0A= > ---=0A= > framework/crb.py | 66 ++++-------------=0A= > framework/dut.py | 172 ++++++++++++++++++++++++++++++--------= ------=0A= > framework/project_dpdk.py | 22 +++---=0A= > framework/ssh_connection.py | 2 +-=0A= > framework/tester.py | 32 ++++++++-=0A= > 5 files changed, 175 insertions(+), 119 deletions(-)=0A= >=0A= > diff --git a/framework/crb.py b/framework/crb.py=0A= > index d41f51b..fa03757 100644=0A= > --- a/framework/crb.py=0A= > +++ b/framework/crb.py=0A= > @@ -133,56 +133,6 @@ class Crb(object):=0A= > """=0A= > self.send_expect("ip link set %s %s" % (eth, status), "# ")=0A= > =0A= > - def restore_interfaces(self):=0A= > - """=0A= > - Restore Linux interfaces.=0A= > - """=0A= > - if dts.drivername =3D=3D "vfio-pci":=0A= > - self.send_expect("rmmod vfio_iommu_type1", "# ", 10)=0A= > - self.send_expect("rmmod vfio_pci", "# ", 10)=0A= > - self.send_expect("rmmod vfio", "# ", 10)=0A= > - else:=0A= > - out =3D self.send_expect("lsmod | grep igb_uio", "#")=0A= > - if "igb_uio" in out:=0A= > - self.send_expect("rmmod -f igb_uio", "# ", 10)=0A= > - self.send_expect("modprobe igb", "# ", 20)=0A= > - self.send_expect("modprobe ixgbe", "# ", 20)=0A= > - self.send_expect("modprobe e1000e", "# ", 20)=0A= > - self.send_expect("modprobe e1000", "# ", 20)=0A= > - self.send_expect("modprobe virtio_net", "# ", 20)=0A= > -=0A= > - try:=0A= > - for (pci_bus, pci_id) in self.pci_devices_info:=0A= > - """=0A= > - Check if driver is already bound before binding it.=0A= > - """=0A= > - if pci_id in ('8086:10fb', '8086:151c', '8086:1528', '80= 86:1512', '8086:154a'):=0A= > - if not os.path.exists("/sys/bus/pci/drivers/ixgbe/"+= "0000:"+pci_bus):=0A= > - self.send_expect("echo -n 0000:%s > /sys/bus/pci= /drivers/ixgbe/bind" % pci_bus, "# ")=0A= > - elif pci_id in ('8086:10e8', '8086:150e', '8086:1521', '= 8086:10c9', '8086:1526', '8086:1533'):=0A= > - if not os.path.exists("/sys/bus/pci/drivers/igb/"+"0= 000:"+pci_bus):=0A= > - self.send_expect("echo -n 0000:%s > /sys/bus/pci= /drivers/igb/bind" % pci_bus, "# ")=0A= > - elif pci_id in('8086:10d3', '8086:10b9'):=0A= > - if not os.path.exists("/sys/bus/pci/drivers/e1000e/"= +"0000:"+pci_bus):=0A= > - self.send_expect("echo -n 0000:%s > /sys/bus/pci= /drivers/e1000e/bind" % pci_bus, "# ")=0A= > - elif pci_id in ('8086:153a', '8086:153b', '8086:155a', '= 8086:1559'):=0A= > - if not os.path.exists("/sys/bus/pci/drivers/e1000e/"= +"0000:"+pci_bus):=0A= > - self.send_expect("echo -n 0000:%s > /sys/bus/pci= /drivers/e1000e/bind" % pci_bus, "# ")=0A= > - elif pci_id in ('8086:100f', '8086:100e'):=0A= > - if not os.path.exists("/sys/bus/pci/drivers/e1000/"+= "0000:"+pci_bus):=0A= > - self.send_expect("echo -n 0000:%s > /sys/bus/pci= /drivers/e1000/bind" % pci_bus, "# ")=0A= > - elif pci_id in ('1af4:1000'):=0A= > - self.send_expect("echo 0000%s > /sys/bus/pci/drivers= /virtio-pci/bind" % pci_bus, "# ")=0A= > - else:=0A= > - continue=0A= > -=0A= > - addr_array =3D pci_bus.split(':')=0A= > - itf =3D self.get_interface_name(addr_array[0], addr_arra= y[1])=0A= > - self.send_expect("ifconfig %s up" % itf, "# ")=0A= > -=0A= > - except Exception as e:=0A= > - self.logger.error(" !!! Restore ITF: " + e.message)=0A= > -=0A= > def pci_devices_information(self):=0A= > """=0A= > Scan CRB pci device information and save it into cache file.=0A= > @@ -206,7 +156,7 @@ class Crb(object):=0A= > Look for the NIC's information (PCI Id and card type).=0A= > """=0A= > out =3D self.send_expect("lspci -nn | grep -i eth", "# ")=0A= > - rexp =3D r"([\da-f]{2}:[\da-f]{2}.\d{1}) Ethernet .* Intel Corpo= ration .*?([\da-f]{4}:[\da-f]{4})"=0A= > + rexp =3D r"([\da-f]{2}:[\da-f]{2}.\d{1}) Ethernet .*?([\da-f]{4}= :[\da-f]{4})"=0A= > pattern =3D re.compile(rexp)=0A= > match =3D pattern.findall(out)=0A= > self.pci_devices_info =3D []=0A= > @@ -276,6 +226,20 @@ class Crb(object):=0A= > match =3D pattern.findall(out)=0A= > return match[0]=0A= > =0A= > + def get_device_numa(self, bus_id, devfun_id):=0A= > + """=0A= > + Get numa id of specified pci device=0A= > + """=0A= > + numa =3D self.send_expect("cat /sys/bus/pci/devices/0000\:%s\:%s= /numa_node" %=0A= > + (bus_id, devfun_id), "# ")=0A= > +=0A= > + try:=0A= > + numa =3D int(numa)=0A= > + except ValueError:=0A= > + numa =3D -1=0A= > + self.logger.warning("NUMA not available")=0A= > + return numa=0A= > +=0A= > def get_ipv6_addr(self, intf):=0A= > """=0A= > Get ipv6 address of specified pci device.=0A= > diff --git a/framework/dut.py b/framework/dut.py=0A= > index 9879335..cddc248 100644=0A= > --- a/framework/dut.py=0A= > +++ b/framework/dut.py=0A= > @@ -33,6 +33,7 @@ import os=0A= > import re=0A= > import time=0A= > import dts=0A= > +from config import UserConf=0A= > from settings import NICS=0A= > from ssh_connection import SSHConnection=0A= > from crb import Crb=0A= > @@ -70,6 +71,7 @@ class Dut(Crb):=0A= > self.cores =3D []=0A= > self.architecture =3D None=0A= > self.ports_info =3D None=0A= > + self.conf =3D UserConf()=0A= > =0A= > def change_config_option(self, target, parameter, value):=0A= > """=0A= > @@ -78,6 +80,14 @@ class Dut(Crb):=0A= > self.send_expect("sed -i 's/%s=3D.*$/%s=3D%s/' config/defconfig= _%s" %=0A= > (parameter, parameter, value, target), "# ")=0A= > =0A= > + def set_nic_types(self, nics):=0A= > + """=0A= > + Set CRB NICS ready to validated.=0A= > + """=0A= > + self.nics =3D nics=0A= > + if 'cfg' in nics:=0A= > + self.conf.load_ports_config(self.get_ip_address())=0A= > +=0A= > def set_toolchain(self, target):=0A= > """=0A= > This looks at the current target and instantiates an attribute t= o=0A= > @@ -144,8 +154,14 @@ class Dut(Crb):=0A= > =0A= > self.init_core_list()=0A= > self.pci_devices_information()=0A= > - self.restore_interfaces()=0A= > + # scan ports before restore interface=0A= > self.scan_ports()=0A= > + # restore dut ports to kernel=0A= > + self.restore_interfaces()=0A= > + # rescan ports after interface up=0A= > + self.rescan_ports()=0A= > + # load port infor from config file=0A= > + self.load_portconf()=0A= > self.mount_procfs()=0A= > =0A= > def restore_interfaces(self):=0A= > @@ -167,11 +183,27 @@ class Dut(Crb):=0A= > """=0A= > Restore Linux interfaces.=0A= > """=0A= > - Crb.restore_interfaces(self)=0A= > -=0A= > - if self.ports_info is not None:=0A= > - for port in self.ports_info:=0A= > - self.admin_ports_linux(port['intf'], 'up')=0A= > + for port in self.ports_info:=0A= > + pci_bus =3D port['pci']=0A= > + pci_id =3D port['type']=0A= > + # get device driver=0A= > + driver =3D dts.get_nic_driver(pci_id)=0A= > + if driver is not None:=0A= > + # unbind device driver=0A= > + addr_array =3D pci_bus.split(':')=0A= > + bus_id =3D addr_array[0]=0A= > + devfun_id =3D addr_array[1]=0A= > +=0A= > + self.send_expect('echo 0000:%s > /sys/bus/pci/devices/00= 00\:%s\:%s/driver/unbind'=0A= > + % (pci_bus, bus_id, devfun_id), '# ')= =0A= > + # bind to linux kernel driver=0A= > + self.send_expect('modprobe %s' % driver, '# ')=0A= > + self.send_expect('echo 0000:%s > /sys/bus/pci/drivers/%s= /bind'=0A= > + % (pci_bus, driver), '# ')=0A= > + itf =3D self.get_interface_name(addr_array[0], addr_arra= y[1])=0A= > + self.send_expect("ifconfig %s up" % itf, "# ")=0A= > + else:=0A= > + self.logger.info("NOT FOUND DRIVER FOR PORT (%s|%s)!!!" = % (pci_bus, pci_id))=0A= > =0A= > def setup_memory(self, hugepages=3D-1):=0A= > """=0A= > @@ -259,7 +291,7 @@ class Dut(Crb):=0A= > =0A= > self.send_expect('tools/dpdk_nic_bind.py %s' % binding_list, '# = ', 30)=0A= > =0A= > - def get_ports(self, nic_type, perf=3DNone, socket=3DNone):=0A= > + def get_ports(self, nic_type=3D'any', perf=3DNone, socket=3DNone):= =0A= > """=0A= > Return DUT port list with the filter of NIC type, whether run IX= IA=0A= > performance test, whether request specified socket.=0A= > @@ -301,7 +333,7 @@ class Dut(Crb):=0A= > else:=0A= > return ports=0A= > =0A= > - def get_ports_performance(self, nic_type, perf=3DNone, socket=3DNone= ,=0A= > + def get_ports_performance(self, nic_type=3D'any', perf=3DNone, socke= t=3DNone,=0A= > force_same_socket=3DTrue,=0A= > force_different_nic=3DTrue):=0A= > """=0A= > @@ -339,6 +371,15 @@ class Dut(Crb):=0A= > =0A= > return biggest_set=0A= > =0A= > + def get_peer_pci(self, port_num):=0A= > + """=0A= > + return the peer pci address of dut port=0A= > + """=0A= > + if 'peer' not in self.ports_info[port_num]:=0A= > + return None=0A= > + else:=0A= > + return self.ports_info[port_num]['peer']=0A= > +=0A= > def get_mac_address(self, port_num):=0A= > """=0A= > return the port mac on dut=0A= > @@ -381,6 +422,55 @@ class Dut(Crb):=0A= > else:=0A= > return 1=0A= > =0A= > + def check_ports_available(self, pci_bus, pci_id):=0A= > + """=0A= > + Check that whether auto scanned ports ready to use=0A= > + """=0A= > + pci_addr =3D "%s:%s" % (pci_bus, pci_id)=0A= > + codenames =3D []=0A= > + for nic in self.nics:=0A= > + if nic =3D=3D 'any':=0A= > + return True=0A= > + elif nic =3D=3D 'cfg':=0A= > + if self.conf.check_port_available(pci_bus) is True:=0A= > + return True=0A= > + elif nic not in NICS.keys():=0A= > + self.logger.warning("NOT SUPPORTED NIC TYPE: %s" % nic)= =0A= > + else:=0A= > + codenames.append(NICS[nic])=0A= > +=0A= > + if pci_id in codenames:=0A= > + return True=0A= > +=0A= > + return False=0A= > +=0A= > + def rescan_ports(self):=0A= > + unknow_interface =3D dts.RED('Skipped: unknow_interface')=0A= > +=0A= > + for port_info in self.ports_info:=0A= > + pci_bus =3D port_info['pci']=0A= > + addr_array =3D pci_bus.split(':')=0A= > + bus_id =3D addr_array[0]=0A= > + devfun_id =3D addr_array[1]=0A= > + intf =3D self.get_interface_name(bus_id, devfun_id)=0A= > + if "No such file" in intf:=0A= > + self.logger.info("DUT: [0000:%s] %s" % (pci_bus, unknow_= interface))=0A= > + out =3D self.send_expect("ip link show %s" % intf, "# ")=0A= > + if "DOWN" in out:=0A= > + self.send_expect("ip link set %s up" % intf, "# ")=0A= > + time.sleep(5)=0A= > + macaddr =3D self.get_mac_addr(intf, bus_id, devfun_id)=0A= > + out =3D self.send_expect("ip -family inet6 address show dev = %s | awk '/inet6/ { print $2 }'"=0A= > + % intf, "# ")=0A= > + ipv6 =3D out.split('/')[0]=0A= > + # Unconnected ports don't have IPv6=0A= > + if ":" not in ipv6:=0A= > + ipv6 =3D "Not connected"=0A= > +=0A= > + port_info['mac'] =3D macaddr=0A= > + port_info['intf'] =3D intf=0A= > + port_info['ipv6'] =3D ipv6=0A= > +=0A= > def scan_ports(self):=0A= > """=0A= > Scan ports information or just read it from cache file.=0A= > @@ -411,8 +501,7 @@ class Dut(Crb):=0A= > unknow_interface =3D dts.RED('Skipped: unknow_interface')=0A= > =0A= > for (pci_bus, pci_id) in self.pci_devices_info:=0A= > -=0A= > - if not dts.accepted_nic(pci_id):=0A= > + if self.check_ports_available(pci_bus, pci_id) is False:=0A= > self.logger.info("DUT: [000:%s %s] %s" % (pci_bus, pci_i= d,=0A= > skipped))=0A= > continue=0A= > @@ -420,50 +509,10 @@ class Dut(Crb):=0A= > addr_array =3D pci_bus.split(':')=0A= > bus_id =3D addr_array[0]=0A= > devfun_id =3D addr_array[1]=0A= > - self.send_expect("echo 0000:%s > /sys/bus/pci/drivers/igb_ui= o/unbind" % pci_bus, "# ")=0A= > - if pci_id =3D=3D '8086:10fb':=0A= > - self.send_expect("echo 0000:%s > /sys/bus/pci/drivers/ix= gbe/bind" % pci_bus, "# ")=0A= > - intf =3D self.get_interface_name(bus_id, devfun_id)=0A= > -=0A= > - out =3D self.send_expect("ip link show %s" % intf, "# ")=0A= > - if "DOWN" in out:=0A= > - self.send_expect("ip link set %s up" % intf, "# ")=0A= > - """=0A= > - I217 and I218 requires more time to acquire V6 address.= =0A= > - """=0A= > - time.sleep(25)=0A= > -=0A= > - self.logger.info("DUT: [000:%s %s] %s" % (pci_bus,=0A= > - pci_id,=0A= > - intf))=0A= > -=0A= > - if "No such file" in intf:=0A= > - self.logger.info("DUT: [000:%s %s] %s" % (pci_bus, pci_i= d,=0A= > - unknow_interfa= ce))=0A= > - continue=0A= > -=0A= > - macaddr =3D self.get_mac_addr(intf, bus_id, devfun_id)=0A= > -=0A= > - out =3D self.send_expect("ip -family inet6 address show dev = %s | awk '/inet6/ { print $2 }'"=0A= > - % intf, "# ")=0A= > - ipv6 =3D out.split('/')[0]=0A= > -=0A= > - # Unconnected ports don't have IPv6=0A= > - if ":" not in ipv6:=0A= > - ipv6 =3D "Not connected"=0A= > -=0A= > - numa =3D self.send_expect("cat /sys/bus/pci/devices/0000\:%s= \:%s/numa_node" %=0A= > - (bus_id, devfun_id), "# ")=0A= > -=0A= > - try:=0A= > - numa =3D int(numa)=0A= > - except ValueError:=0A= > - numa =3D -1=0A= > - self.logger.warning("NUMA not available")=0A= > =0A= > + numa =3D self.get_device_numa(bus_id, devfun_id)=0A= > # store the port info to port mapping=0A= > - self.ports_info.append({'pci': pci_bus, 'type': pci_id, 'int= f':=0A= > - intf, 'mac': macaddr, 'ipv6': ipv6, = 'numa': numa})=0A= > + self.ports_info.append({'pci': pci_bus, 'type': pci_id, 'num= a': numa})=0A= > =0A= > def scan_ports_uncached_freebsd(self):=0A= > """=0A= > @@ -505,3 +554,22 @@ class Dut(Crb):=0A= > # store the port info to port mapping=0A= > self.ports_info.append({'pci': pci_str, 'type': pci_id, 'int= f':=0A= > intf, 'mac': macaddr, 'ipv6': ipv6, = 'numa': -1})=0A= > +=0A= > + def load_portconf(self):=0A= > + """=0A= > + Load port configurations for ports_info. If manually configured = infor=0A= > + not same as auto scanned, still use infor in configuration file.= =0A= > + """=0A= > + for port in self.ports_info:=0A= > + pci_bus =3D port['pci']=0A= > + if pci_bus in self.conf.ports_cfg:=0A= > + port_cfg =3D self.conf.ports_cfg[pci_bus]=0A= > + port_cfg['source'] =3D 'cfg'=0A= > + else:=0A= > + port_cfg =3D {}=0A= > +=0A= > + for key in ['intf', 'mac', 'numa', 'peer']:=0A= > + if key in port_cfg:=0A= > + if key in port and port_cfg[key] !=3D port[key]:=0A= > + self.logger.warning("CONGGURED %s NOT SAME AS SC= ANNED!!!" % (key.upper()))=0A= > + port[key] =3D port_cfg[key]=0A= > diff --git a/framework/project_dpdk.py b/framework/project_dpdk.py=0A= > index 3577eb7..8cb144f 100644=0A= > --- a/framework/project_dpdk.py=0A= > +++ b/framework/project_dpdk.py=0A= > @@ -236,13 +236,10 @@ class DPDKdut(Dut):=0A= > binding_list =3D '--bind=3D%s ' % driver=0A= > =0A= > current_nic =3D 0=0A= > - for (pci_bus, pci_id) in self.pci_devices_info:=0A= > - if dts.accepted_nic(pci_id):=0A= > -=0A= > - if nics_to_bind is None or current_nic in nics_to_bind:= =0A= > - binding_list +=3D '%s ' % (pci_bus)=0A= > -=0A= > - current_nic +=3D 1=0A= > + for port_info in self.ports_info:=0A= > + if nics_to_bind is None or current_nic in nics_to_bind:=0A= > + binding_list +=3D '%s ' % (port_info['pci'])=0A= > + current_nic +=3D 1=0A= > =0A= > self.send_expect('tools/dpdk_nic_bind.py %s' % binding_list, '# = ')=0A= > =0A= > @@ -254,13 +251,10 @@ class DPDKdut(Dut):=0A= > binding_list =3D '-u '=0A= > =0A= > current_nic =3D 0=0A= > - for (pci_bus, pci_id) in self.pci_devices_info:=0A= > - if dts.accepted_nic(pci_id):=0A= > -=0A= > - if nics_to_bind is None or current_nic in nics_to_bind:= =0A= > - binding_list +=3D '%s ' % (pci_bus)=0A= > -=0A= > - current_nic +=3D 1=0A= > + for port_info in self.ports_info:=0A= > + if nics_to_bind is None or current_nic in nics_to_bind:=0A= > + binding_list +=3D '%s ' % (port_info['pci'])=0A= > + current_nic +=3D 1=0A= > =0A= > self.send_expect('tools/dpdk_nic_bind.py %s' % binding_list, '# = ', 30)=0A= > =0A= > diff --git a/framework/ssh_connection.py b/framework/ssh_connection.py=0A= > index 4306162..25f249a 100644=0A= > --- a/framework/ssh_connection.py=0A= > +++ b/framework/ssh_connection.py=0A= > @@ -40,7 +40,7 @@ class SSHConnection(object):=0A= > Implement send_expect/copy function upper SSHPexpet module.=0A= > """=0A= > =0A= > - def __init__(self, host, session_name, password =3D ''):=0A= > + def __init__(self, host, session_name, password=3D''):=0A= > self.session =3D SSHPexpect(host, USERNAME, password)=0A= > self.name =3D session_name=0A= > =0A= > diff --git a/framework/tester.py b/framework/tester.py=0A= > index 0ebe29a..437d8c4 100644=0A= > --- a/framework/tester.py=0A= > +++ b/framework/tester.py=0A= > @@ -133,7 +133,7 @@ class Tester(Crb):=0A= > self.restore_interfaces()=0A= > self.scan_ports()=0A= > self.map_available_ports()=0A= > - if self.ports_map =3D=3D None or len(self.ports_map) =3D=3D 0:= =0A= > + if self.ports_map is None or len(self.ports_map) =3D=3D 0:=0A= > raise ValueError("ports_map should not be empty, please chec= k all links")=0A= > =0A= > def get_local_port(self, remotePort):=0A= > @@ -179,6 +179,24 @@ class Tester(Crb):=0A= > else:=0A= > return 'down'=0A= > =0A= > + def restore_interfaces(self):=0A= > + """=0A= > + Restore Linux interfaces.=0A= > + """=0A= > + self.send_expect("modprobe igb", "# ", 20)=0A= > + self.send_expect("modprobe ixgbe", "# ", 20)=0A= > + self.send_expect("modprobe e1000e", "# ", 20)=0A= > + self.send_expect("modprobe e1000", "# ", 20)=0A= > +=0A= > + try:=0A= > + for (pci_bus, pci_id) in self.pci_devices_info:=0A= > + addr_array =3D pci_bus.split(':')=0A= > + itf =3D self.get_interface_name(addr_array[0], addr_arra= y[1])=0A= > + self.send_expect("ifconfig %s up" % itf, "# ")=0A= > +=0A= > + except Exception as e:=0A= > + self.logger.error(" !!! Restore ITF: " + e.message)=0A= > +=0A= > def scan_ports(self):=0A= > """=0A= > Scan all ports on tester and save port's pci/mac/interface.=0A= > @@ -262,6 +280,18 @@ class Tester(Crb):=0A= > hits =3D [False] * len(self.ports_info)=0A= > =0A= > for dutPort in range(nrPorts):=0A= > + peer =3D self.dut.get_peer_pci(dutPort)=0A= > + if peer is not None:=0A= > + for localPort in range(len(self.ports_info)):=0A= > + if self.ports_info[localPort]['pci'] =3D=3D peer:=0A= > + hits[localPort] =3D True=0A= > + self.ports_map[dutPort] =3D localPort=0A= > + break=0A= > + if self.ports_map[dutPort] =3D=3D -1:=0A= > + self.logger.error("CONFIGURED TESTER PORT CANNOT FOU= ND!!!")=0A= > + else:=0A= > + continue # skip ping6 map=0A= > +=0A= > for localPort in range(len(self.ports_info)):=0A= > if hits[localPort]:=0A= > continue=0A= Acked-by: Michael Qiu =0A=