Skip to content

Commit

Permalink
Adding support for handling mac address
Browse files Browse the repository at this point in the history
supporting  mac address which is being provided as interface parameter value in yaml files

Also added the check for interface in teardown function

Signed-off-by: Pavaman Subramaniyam <[email protected]>
  • Loading branch information
PavamanSubramaniyam committed May 7, 2024
1 parent ad6b5a2 commit 49d5efd
Show file tree
Hide file tree
Showing 7 changed files with 125 additions and 50 deletions.
26 changes: 18 additions & 8 deletions io/net/infiniband/ib_pingpong.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,24 @@ def setUp(self):
'''
To check and install dependencies for the test
'''
local = LocalHost()
interfaces = netifaces.interfaces()
device = self.params.get("interface", default=None)
if device in interfaces:
self.iface = device
elif local.validate_mac_addr(device) and device in local.get_all_hwaddr():
self.iface = local.get_interface_by_hwaddr(device).name
else:
self.iface = None
self.cancel("%s interface is not available" % device)

self.flag = self.params.get("ext_flag", default="0")
self.iface = self.params.get("interface", default="")
self.peer_ip = self.params.get("peer_ip", default="")
self.peer_user = self.params.get("peer_user", default="root")
self.peer_password = self.params.get("peer_password", '*',
default="None")
self.ipaddr = self.params.get("host_ip", default="")
self.netmask = self.params.get("netmask", default="")
local = LocalHost()
if self.iface[0:2] == 'ib':
self.networkinterface = NetworkInterface(self.iface, local,
if_type='Infiniband')
Expand Down Expand Up @@ -86,7 +94,8 @@ def setUp(self):
self.mtu = self.params.get("mtu", default=1500)
self.remotehost = RemoteHost(self.peer_ip, self.peer_user,
password=self.peer_password)
self.peer_interface = self.remotehost.get_interface_by_ipaddr(self.peer_ip).name
self.peer_interface = self.remotehost.get_interface_by_ipaddr(
self.peer_ip).name
self.peer_networkinterface = NetworkInterface(self.peer_interface,
self.remotehost)
smm = SoftwareManager()
Expand Down Expand Up @@ -194,8 +203,9 @@ def test_ib_pingpong(self):
self.log.info("Extended test option skipped")

def tearDown(self):
if self.networkinterface.set_mtu('1500') is not None:
self.fail("Failed to set mtu in host")
if self.peer_networkinterface.set_mtu('1500') is not None:
self.fail("Failed to set mtu in peer")
self.remotehost.remote_session.quit()
if self.iface:
if self.networkinterface.set_mtu('1500') is not None:
self.fail("Failed to set mtu in host")
if self.peer_networkinterface.set_mtu('1500') is not None:
self.fail("Failed to set mtu in peer")
self.remotehost.remote_session.quit()
27 changes: 19 additions & 8 deletions io/net/infiniband/mckey.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,24 @@ def setUp(self):
for pkg in pkgs:
if not smm.check_installed(pkg) and not smm.install(pkg):
self.cancel("Not able to install %s" % pkg)

local = LocalHost()
interfaces = netifaces.interfaces()
self.iface = self.params.get("interface", default="")
device = self.params.get("interface", default=None)
if device in interfaces:
self.iface = device
elif local.validate_mac_addr(device) and device in local.get_all_hwaddr():
self.iface = local.get_interface_by_hwaddr(device).name
else:
self.iface = None
self.cancel("%s interface is not available" % device)

self.peer_ip = self.params.get("peer_ip", default="")
self.peer_user = self.params.get("peer_user", default="root")
self.peer_password = self.params.get("peer_password", '*',
default="None")
self.ipaddr = self.params.get("host_ip", default="")
self.netmask = self.params.get("netmask", default="")
local = LocalHost()
if self.iface[0:2] == 'ib':
self.networkinterface = NetworkInterface(self.iface, local,
if_type='Infiniband')
Expand Down Expand Up @@ -100,7 +109,8 @@ def setUp(self):
self.mtu = self.params.get("mtu", default=1500)
self.remotehost = RemoteHost(self.peer_ip, self.peer_user,
password=self.peer_password)
self.peer_interface = self.remotehost.get_interface_by_ipaddr(self.peer_ip).name
self.peer_interface = self.remotehost.get_interface_by_ipaddr(
self.peer_ip).name
self.peer_networkinterface = NetworkInterface(self.peer_interface,
self.remotehost)
self.option = self.option.replace("PEERIP", self.peer_ip)
Expand Down Expand Up @@ -169,8 +179,9 @@ def tearDown(self):
"""
unset ip
"""
if self.networkinterface.set_mtu('1500') is not None:
self.fail("Failed to set mtu in host")
if self.peer_networkinterface.set_mtu('1500') is not None:
self.fail("Failed to set mtu in peer")
self.remotehost.remote_session.quit()
if self.iface:
if self.networkinterface.set_mtu('1500') is not None:
self.fail("Failed to set mtu in host")
if self.peer_networkinterface.set_mtu('1500') is not None:
self.fail("Failed to set mtu in peer")
self.remotehost.remote_session.quit()
16 changes: 13 additions & 3 deletions io/net/infiniband/ping6.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,18 @@ def setUp(self):
for pkg in pkgs:
if not smm.check_installed(pkg) and not smm.install(pkg):
self.cancel("Not able to install %s" % pkg)

local = LocalHost()
interfaces = netifaces.interfaces()
self.iface = self.params.get("interface", default="")
device = self.params.get("interface", default=None)
if device in interfaces:
self.iface = device
elif local.validate_mac_addr(device) and device in local.get_all_hwaddr():
self.iface = local.get_interface_by_hwaddr(device).name
else:
self.iface = None
self.cancel("%s interface is not available" % device)

self.peer_iface = self.params.get("peer_interface", default="")
self.ipv6_peer = self.params.get("peer_ipv6", default="")
self.peer_ip = self.params.get("peer_ip", default="")
Expand All @@ -73,7 +83,6 @@ def setUp(self):
default="None")
self.ipaddr = self.params.get("host_ip", default="")
self.netmask = self.params.get("netmask", default="")
local = LocalHost()
if self.iface[0:2] == 'ib':
self.networkinterface = NetworkInterface(self.iface, local,
if_type='Infiniband')
Expand Down Expand Up @@ -113,7 +122,8 @@ def setUp(self):
self.mtu = self.params.get("mtu", default=1500)
self.remotehost = RemoteHost(self.peer_ip, self.peer_user,
password=self.peer_password)
self.peer_interface = self.remotehost.get_interface_by_ipaddr(self.peer_ip).name
self.peer_interface = self.remotehost.get_interface_by_ipaddr(
self.peer_ip).name
self.peer_networkinterface = NetworkInterface(self.peer_interface,
self.remotehost)

Expand Down
27 changes: 19 additions & 8 deletions io/net/infiniband/rdma_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,24 @@ def setUp(self):
for pkg in pkgs:
if not smm.check_installed(pkg) and not smm.install(pkg):
self.cancel("%s package is need to test" % pkg)

local = LocalHost()
interfaces = netifaces.interfaces()
self.iface = self.params.get("interface", default="")
device = self.params.get("interface", default=None)
if device in interfaces:
self.iface = device
elif local.validate_mac_addr(device) and device in local.get_all_hwaddr():
self.iface = local.get_interface_by_hwaddr(device).name
else:
self.iface = None
self.cancel("%s interface is not available" % device)

self.peer_ip = self.params.get("peer_ip", default="")
self.peer_user = self.params.get("peer_user", default="root")
self.peer_password = self.params.get("peer_password", '*',
default="None")
self.ipaddr = self.params.get("host_ip", default="")
self.netmask = self.params.get("netmask", default="")
local = LocalHost()
if self.iface[0:2] == 'ib':
self.networkinterface = NetworkInterface(self.iface, local,
if_type='Infiniband')
Expand Down Expand Up @@ -96,7 +105,8 @@ def setUp(self):
self.mtu = self.params.get("mtu", default=1500)
self.remotehost = RemoteHost(self.peer_ip, self.peer_user,
password=self.peer_password)
self.peer_interface = self.remotehost.get_interface_by_ipaddr(self.peer_ip).name
self.peer_interface = self.remotehost.get_interface_by_ipaddr(
self.peer_ip).name
self.peer_networkinterface = NetworkInterface(self.peer_interface,
self.remotehost)

Expand Down Expand Up @@ -164,8 +174,9 @@ def tearDown(self):
"""
unset ip
"""
if self.networkinterface.set_mtu('1500') is not None:
self.fail("Failed to set mtu in host")
if self.peer_networkinterface.set_mtu('1500') is not None:
self.fail("Failed to set mtu in peer")
self.remotehost.remote_session.quit()
if self.iface:
if self.networkinterface.set_mtu('1500') is not None:
self.fail("Failed to set mtu in host")
if self.peer_networkinterface.set_mtu('1500') is not None:
self.fail("Failed to set mtu in peer")
self.remotehost.remote_session.quit()
27 changes: 19 additions & 8 deletions io/net/infiniband/rping.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,18 @@ def setUp(self):
for pkg in pkgs:
if not smm.check_installed(pkg) and not smm.install(pkg):
self.cancel("Not able to install %s" % pkg)

local = LocalHost()
interfaces = netifaces.interfaces()
self.iface = self.params.get("interface", default="")
device = self.params.get("interface", default=None)
if device in interfaces:
self.iface = device
elif local.validate_mac_addr(device) and device in local.get_all_hwaddr():
self.iface = local.get_interface_by_hwaddr(device).name
else:
self.iface = None
self.cancel("%s interface is not available" % device)

self.peer_ip = self.params.get("peer_ip", default="")
self.ipv6_peer = self.params.get("peer_ipv6", default="")
if self.iface not in interfaces:
Expand All @@ -73,7 +83,6 @@ def setUp(self):
self.cancel("%s peer machine is not available" % self.peer_ip)
self.ipaddr = self.params.get("host_ip", default="")
self.netmask = self.params.get("netmask", default="")
local = LocalHost()
if self.iface[0:2] == 'ib':
self.networkinterface = NetworkInterface(self.iface, local,
if_type='Infiniband')
Expand Down Expand Up @@ -105,7 +114,8 @@ def setUp(self):
self.mtu = self.params.get("mtu", default=1500)
self.remotehost = RemoteHost(self.peer_ip, self.peer_user,
password=self.peer_password)
self.peer_interface = self.remotehost.get_interface_by_ipaddr(self.peer_ip).name
self.peer_interface = self.remotehost.get_interface_by_ipaddr(
self.peer_ip).name
self.peer_networkinterface = NetworkInterface(self.peer_interface,
self.remotehost)

Expand Down Expand Up @@ -166,8 +176,9 @@ def tearDown(self):
"""
unset ip
"""
if self.networkinterface.set_mtu('1500') is not None:
self.fail("Failed to set mtu in host")
if self.peer_networkinterface.set_mtu('1500') is not None:
self.fail("Failed to set mtu in peer")
self.remotehost.remote_session.quit()
if self.iface:
if self.networkinterface.set_mtu('1500') is not None:
self.fail("Failed to set mtu in host")
if self.peer_networkinterface.set_mtu('1500') is not None:
self.fail("Failed to set mtu in peer")
self.remotehost.remote_session.quit()
27 changes: 19 additions & 8 deletions io/net/infiniband/ucmatose.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,25 @@ def setUp(self):
for pkg in pkgs:
if not smm.check_installed(pkg) and not smm.install(pkg):
self.cancel("Not able to install %s" % pkg)

local = LocalHost()
interfaces = netifaces.interfaces()
device = self.params.get("interface", default=None)
if device in interfaces:
self.iface = device
elif local.validate_mac_addr(device) and device in local.get_all_hwaddr():
self.iface = local.get_interface_by_hwaddr(device).name
else:
self.iface = None
self.cancel("%s interface is not available" % device)

self.flag = self.params.get("ext_flag", default="0")
self.iface = self.params.get("interface", default="")
self.peer_ip = self.params.get("peer_ip", default="")
self.peer_user = self.params.get("peer_user", default="root")
self.peer_password = self.params.get("peer_password", '*',
default="None")
self.ipaddr = self.params.get("host_ip", default="")
self.netmask = self.params.get("netmask", default="")
local = LocalHost()
if self.iface[0:2] == 'ib':
self.networkinterface = NetworkInterface(self.iface, local,
if_type='Infiniband')
Expand Down Expand Up @@ -100,7 +109,8 @@ def setUp(self):
self.mtu = self.params.get("mtu", default=1500)
self.remotehost = RemoteHost(self.peer_ip, self.peer_user,
password=self.peer_password)
self.peer_interface = self.remotehost.get_interface_by_ipaddr(self.peer_ip).name
self.peer_interface = self.remotehost.get_interface_by_ipaddr(
self.peer_ip).name
self.peer_networkinterface = NetworkInterface(self.peer_interface,
self.remotehost)

Expand Down Expand Up @@ -160,8 +170,9 @@ def tearDown(self):
"""
unset ip
"""
if self.networkinterface.set_mtu('1500') is not None:
self.fail("Failed to set mtu in host")
if self.peer_networkinterface.set_mtu('1500') is not None:
self.fail("Failed to set mtu in peer")
self.remotehost.remote_session.quit()
if self.iface:
if self.networkinterface.set_mtu('1500') is not None:
self.fail("Failed to set mtu in host")
if self.peer_networkinterface.set_mtu('1500') is not None:
self.fail("Failed to set mtu in peer")
self.remotehost.remote_session.quit()
25 changes: 18 additions & 7 deletions io/net/infiniband/udaddy.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,24 @@ def setUp(self):
for pkg in pkgs:
if not smm.check_installed(pkg) and not smm.install(pkg):
self.cancel("Not able to install %s" % pkg)

local = LocalHost()
interfaces = netifaces.interfaces()
self.iface = self.params.get("interface", default="")
device = self.params.get("interface", default=None)
if device in interfaces:
self.iface = device
elif local.validate_mac_addr(device) and device in local.get_all_hwaddr():
self.iface = local.get_interface_by_hwaddr(device).name
else:
self.iface = None
self.cancel("%s interface is not available" % device)

self.peer_ip = self.params.get("peer_ip", default="")
self.peer_user = self.params.get("peer_user", default="root")
self.peer_password = self.params.get("peer_password", '*',
default="None")
self.ipaddr = self.params.get("host_ip", default="")
self.netmask = self.params.get("netmask", default="")
local = LocalHost()
if self.iface[0:2] == 'ib':
self.networkinterface = NetworkInterface(self.iface, local,
if_type='Infiniband')
Expand Down Expand Up @@ -99,7 +108,8 @@ def setUp(self):
self.mtu = self.params.get("mtu", default=1500)
self.remotehost = RemoteHost(self.peer_ip, self.peer_user,
password=self.peer_password)
self.peer_interface = self.remotehost.get_interface_by_ipaddr(self.peer_ip).name
self.peer_interface = self.remotehost.get_interface_by_ipaddr(
self.peer_ip).name
self.peer_networkinterface = NetworkInterface(self.peer_interface,
self.remotehost)

Expand Down Expand Up @@ -159,7 +169,8 @@ def tearDown(self):
"""
unset ip
"""
if self.networkinterface.set_mtu('1500') is not None:
self.fail("Failed to set mtu in host")
if self.peer_networkinterface.set_mtu('1500') is not None:
self.fail("Failed to set mtu in peer")
if self.iface:
if self.networkinterface.set_mtu('1500') is not None:
self.fail("Failed to set mtu in host")
if self.peer_networkinterface.set_mtu('1500') is not None:
self.fail("Failed to set mtu in peer")

0 comments on commit 49d5efd

Please sign in to comment.