summaryrefslogtreecommitdiff
path: root/nics
diff options
context:
space:
mode:
authorGowrishankar <gowrishankar.m@linux.vnet.ibm.com>2016-03-08 15:36:42 +0530
committersys_stv <sys_stv@intel.com>2016-03-09 11:57:32 +0800
commit54224a0a53a2e4b87ddb28fd0b2c5fbf6c83e07a (patch)
tree1daf161707abfadcb0b21ba82c6c0184d8ca4b87 /nics
parent835efd4bc9a1e968af22b54763bc7bd75bc148c7 (diff)
framework: enable connect X3 support
Connect X3 dual port adapter shares single pci device ID. This limits dts frame- work to use both the ports for the tests. With this patch, a new attribute also to refer second interface in such single pci port lookup is introduced. Added supporting APIs to derive this second interface and its MAC addresses whereever needed. Signed-off-by: Gowrishankar <gowrishankar.m@linux.vnet.ibm.com>
Diffstat (limited to 'nics')
-rw-r--r--nics/net_device.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/nics/net_device.py b/nics/net_device.py
index a9127cb..941be99 100644
--- a/nics/net_device.py
+++ b/nics/net_device.py
@@ -150,9 +150,21 @@ class NetDevice(object):
self.intf_name = 'N/A'
else:
self.intf_name = out
+ self.intf2_name = None
+
+ # not a complete fix for CX3.
+ if len(out.split()) > 1 and self.default_driver == 'mlx4_core':
+ self.intf_name = out.split()[0]
+ self.intf2_name = out.split()[1]
return self.intf_name
+ def get_interface2_name(self):
+ """
+ Get interface name of second port of this pci device.
+ """
+ return self.intf2_name
+
def get_interface_name_linux(self, domain_id, bus_id, devfun_id, driver):
"""
Get interface name of specified pci device on linux.
@@ -242,6 +254,18 @@ class NetDevice(object):
else:
return out
+ @nic_has_driver
+ def get_intf2_mac_addr(self):
+ """
+ Get mac address of 2nd port of specified pci device.
+ """
+ get_mac_addr = getattr(self, 'get_mac_addr_%s' % self.__get_os_type())
+ out = get_mac_addr(self.get_interface2_name(), self.domain_id, self.bus_id, self.devfun_id, self.current_driver)
+ if "No such file or directory" in out:
+ return 'N/A'
+ else:
+ return out
+
def get_mac_addr_linux(self, intf, domain_id, bus_id, devfun_id, driver):
"""
Get mac address of specified pci device on linux.
@@ -733,6 +757,9 @@ class NetDevice(object):
if driver == self.default_driver:
itf = self.get_interface_name()
self.__send_expect("ifconfig %s up" % itf, "# ")
+ if self.get_interface2_name():
+ itf = self.get_interface2_name()
+ self.__send_expect("ifconfig %s up" % itf, "# ")
def bind_driver_linux_pci_stub(self, domain_id, bus_id, devfun_id):
"""