Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bonding: Add support for mac base input interfaces #2697

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions io/net/bonding.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ def setUp(self):
'''
To check and install dependencies for the test
'''
self.localhost = LocalHost()
detected_distro = distro.detect()
smm = SoftwareManager()
self.host_interfaces = []
depends = []
# FIXME: "redhat" as the distro name for RHEL is deprecated
# on Avocado versions >= 50.0. This is a temporary compatibility
Expand All @@ -73,10 +75,15 @@ def setUp(self):
self.user = self.params.get("user_name", default="root")
self.password = self.params.get("peer_password", '*',
default="None")
self.host_interfaces = self.params.get("bond_interfaces",
default="").split(" ")
if not self.host_interfaces:
self.cancel("user should specify host interfaces")
devices = self.params.get("bond_interfaces", default=None)
if devices:
for device in devices.split(" "):
if device in interfaces:
self.host_interfaces.append(device)
elif self.localhost.validate_mac_addr(device) and device in self.localhost.get_all_hwaddr():
self.host_interfaces.append(self.localhost.get_interface_by_hwaddr(device).name)
else:
self.cancel("user should specify host interfaces")
self.peer_interfaces = self.params.get("peer_interfaces",
default="").split(" ")
for self.host_interface in self.host_interfaces:
Expand All @@ -90,7 +97,6 @@ def setUp(self):
self.netmask = self.params.get("netmask", default="")
self.peer_bond_needed = self.params.get("peer_bond_needed",
default=False)
self.localhost = LocalHost()
if 'setup' in str(self.name.name):
for ipaddr, interface in zip(self.ipaddr, self.host_interfaces):
networkinterface = NetworkInterface(interface, self.localhost)
Expand Down Expand Up @@ -579,4 +585,5 @@ def error_check(self):
self.fail("Tests failed. Details:\n%s" % "\n".join(self.err))

def tearDown(self):
self.session.quit()
if self.host_interfaces:
self.session.quit()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this change is this was bug earlier , if yes push this in another commit

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is to safely exit teardown.. if interfaces are not available.. or wrong user input

4 changes: 1 addition & 3 deletions io/net/bonding.py.data/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Note:
-----------------------------
Inputs Needed To Run Tests:
------------------------------
bond_interfaces --> Interfaces in the Host machine requird for Bonding
bond_interfaces --> Interfaces names or mac address space separated in the Host machine requird for Bonding
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you populate example string as well

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure

Note: example bond_interfaces = "ib0 ib1", Space between the interface names
peerip --> peer ip address
peer_interfaces --> This is needed only if a Bond interface is to be created in the Peer machine, space separated names if specifying multiple
Expand All @@ -31,5 +31,3 @@ Requirements:
-----------------------
1. install netifaces using pip
command: pip install netifaces
2. Generate sshkey for your test partner to run the test uninterrupted.(Have a passwordless ssh between the peers)
3. Make sure IPs are set for interfaces to be used, via configuration file. ifup / ifdown should set the IPs back.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why remove this info are we doing this in the test?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

both the requirements are already automated into script.. so they are not needed