From: Marvin Liu <yong.liu@intel.com>
To: dts@dpdk.org
Cc: Marvin Liu <yong.liu@intel.com>
Subject: [dts] [PATCH 2/4] framework: fix cache option not work
Date: Thu, 4 Aug 2016 21:18:32 +0800 [thread overview]
Message-ID: <1470316714-14698-3-git-send-email-yong.liu@intel.com> (raw)
In-Reply-To: <1470316714-14698-1-git-send-email-yong.liu@intel.com>
When cache option enabled, port information retrieved from cache file.
Netdevice object should be initialized based on port infor.
Signed-off-by: Marvin Liu <yong.liu@intel.com>
diff --git a/framework/dut.py b/framework/dut.py
index 88c4679..f76b4f4 100644
--- a/framework/dut.py
+++ b/framework/dut.py
@@ -213,6 +213,10 @@ class Dut(Crb):
"""
Restore all ports's interfaces.
"""
+ # no need to restore for all info has been recorded
+ if self.read_cache:
+ return
+
restore_interfaces = getattr(self, 'restore_interfaces_%s' % self.get_os_type())
return restore_interfaces()
@@ -546,7 +550,7 @@ class Dut(Crb):
"""
Rescan ports information
"""
- if self.read_cache and self.load_serializer_ports():
+ if self.read_cache:
return
if self.ports_info:
@@ -565,12 +569,13 @@ class Dut(Crb):
for port_info in self.ports_info:
port = port_info['port']
- intf = port_info['intf']
+ intf = port.get_interface_name()
+ port_info['intf'] = intf
out = self.send_expect("ip link show %s" % intf, "# ")
if "DOWN" in out:
self.send_expect("ip link set %s up" % intf, "# ")
time.sleep(5)
- macaddr = port_info['mac']
+ port_info['mac'] = port.get_mac_addr()
out = self.send_expect("ip -family inet6 address show dev %s | awk '/inet6/ { print $2 }'"
% intf, "# ")
ipv6 = out.split('/')[0]
@@ -644,14 +649,17 @@ class Dut(Crb):
return
for port_info in self.ports_info:
- port = GetNicObj(self, port_info['pci'], port_info['type'])
- intf = port.get_interface_name()
-
- self.logger.info("DUT cached: [%s %s] %s" % (port_info['pci'],
- port_info['type'], intf))
+ addr_array = port_info['pci'].split(':')
+ domain_id = addr_array[0]
+ bus_id = addr_array[1]
+ devfun_id = addr_array[2]
+ port = GetNicObj(self, domain_id, bus_id, devfun_id)
port_info['port'] = port
+ self.logger.info("DUT cached: [%s %s] %s" % (port_info['pci'],
+ port_info['type'], port_info['intf']))
+
def scan_ports_uncached(self):
"""
Scan ports and collect port's pci id, mac adress, ipv6 address.
diff --git a/framework/tester.py b/framework/tester.py
index cadc3ad..962aaf8 100644
--- a/framework/tester.py
+++ b/framework/tester.py
@@ -293,7 +293,12 @@ class Tester(Crb):
if port_info['type'] == 'ixia':
continue
- port = GetNicObj(self, port_info['pci'], port_info['type'])
+ addr_array = port_info['pci'].split(':')
+ domain_id = addr_array[0]
+ bus_id = addr_array[1]
+ devfun_id = addr_array[2]
+
+ port = GetNicObj(self, domain_id, bus_id, devfun_id)
intf = port.get_interface_name()
self.logger.info("Tester cached: [000:%s %s] %s" % (
--
1.9.3
next prev parent reply other threads:[~2016-08-04 13:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-04 13:18 [dts] [PATCH 0/4] enhance framework and fix some issues Marvin Liu
2016-08-04 13:18 ` [dts] [PATCH 1/4] framework dts: fix program exit when exception raised Marvin Liu
2016-08-04 13:18 ` Marvin Liu [this message]
2016-08-04 13:18 ` [dts] [PATCH 3/4] framework: add session check function Marvin Liu
2016-08-04 13:18 ` [dts] [PATCH 4/4] tests: fix tope issue in suites Marvin Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1470316714-14698-3-git-send-email-yong.liu@intel.com \
--to=yong.liu@intel.com \
--cc=dts@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).