aboutsummaryrefslogtreecommitdiffstats
path: root/os_net_config/tests/test_impl_ifcfg.py
diff options
context:
space:
mode:
authorDan Prince <dprince@redhat.com>2016-04-05 12:51:37 -0400
committerDan Prince <dprince@redhat.com>2016-04-05 14:01:39 -0400
commit5f7a330f8ce82d6109a5ff17048eaf11e244ab88 (patch)
tree3926f7df5d269852d2bca146c6f66be9a0c599d3 /os_net_config/tests/test_impl_ifcfg.py
parent4da6d609bbcd25438a41de87111aed3180a10007 (diff)
Add MASTER=bond SLAVE=yes to linux bond interfaces
When configuring a linux bond with interfaces we have a bug (due to a missing unit test) where the interfaces weren't being configured with MASTER=<bond_name> SLAVE=yes. This patch adds a unit test to check for the required configuration and cleans up the logic in impl_ifcfg.py to handle it correctly by simply checking for the linux_bond_name property which is already set for us via objects.py. See also: https://bugzilla.redhat.com/show_bug.cgi?id=1323717 Change-Id: Ic632c52265dcbbe6c0ace782e633a2030ad25e6f Closes-bug: 1566428
Diffstat (limited to 'os_net_config/tests/test_impl_ifcfg.py')
-rw-r--r--os_net_config/tests/test_impl_ifcfg.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/os_net_config/tests/test_impl_ifcfg.py b/os_net_config/tests/test_impl_ifcfg.py
index fa85de7..262d0a1 100644
--- a/os_net_config/tests/test_impl_ifcfg.py
+++ b/os_net_config/tests/test_impl_ifcfg.py
@@ -195,7 +195,6 @@ OVSBOOTPROTO=dhcp
BOND_IFACES="em1 em2"
"""
-
_LINUX_BOND_DHCP = """# This file is autogenerated by os-net-config
DEVICE=bond0
ONBOOT=yes
@@ -205,6 +204,12 @@ BOOTPROTO=dhcp
"""
+_LINUX_BOND_INTERFACE = _BASE_IFCFG + """MASTER=bond0
+SLAVE=yes
+BOOTPROTO=none
+"""
+
+
_IVS_UPLINK = """# This file is autogenerated by os-net-config
DEVICE=em1
ONBOOT=yes
@@ -493,8 +498,12 @@ BOOTPROTO=none
bond = objects.LinuxBond('bond0', use_dhcp=True,
members=[interface1, interface2])
self.provider.add_linux_bond(bond)
+ self.provider.add_interface(interface1)
+ self.provider.add_interface(interface2)
self.assertEqual(_LINUX_BOND_DHCP,
self.get_linux_bond_config('bond0'))
+ self.assertEqual(_LINUX_BOND_INTERFACE,
+ self.get_interface_config('em1'))
def test_interface_defroute(self):
interface1 = objects.Interface('em1')