summaryrefslogtreecommitdiffstats
path: root/os_net_config/tests/test_impl_ifcfg.py
diff options
context:
space:
mode:
authorDan Sneddon <dsneddon@redhat.com>2015-06-08 13:52:54 -0700
committerDan Prince <dprince@redhat.com>2015-06-09 12:33:32 -0400
commit7ce531d3c099e310c81f94328b9bfa20de58699b (patch)
tree403316dd351650dcbd90600e992159a71f9c012c /os_net_config/tests/test_impl_ifcfg.py
parenta4a4c43f92138b7d477c7c944849fc69e3c21ac6 (diff)
Set primary interface on OVS bonds
This change sets one of the member interfaces of a bond as the primary interface, which results in that interface being the active slave. This change adds a step to the apply method in impl_ifcfg which runs 'ovs-appctl bond/set-active-slave <bond> <iface>' after bringing up the bond interfaces. This step ensures that the bonds work correctly without LACP switch support. If a member interface on the bond is set as primary, that interface will be used. Co-Authored-By: Dan Prince <dprince@redhat.com> Change-Id: I795bb3b8ef977f9276bfec062b197c473393942e
Diffstat (limited to 'os_net_config/tests/test_impl_ifcfg.py')
-rw-r--r--os_net_config/tests/test_impl_ifcfg.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/os_net_config/tests/test_impl_ifcfg.py b/os_net_config/tests/test_impl_ifcfg.py
index a273b05..9480d47 100644
--- a/os_net_config/tests/test_impl_ifcfg.py
+++ b/os_net_config/tests/test_impl_ifcfg.py
@@ -328,6 +328,7 @@ class TestIfcfgNetConfigApply(base.TestCase):
self.temp_bridge_file = tempfile.NamedTemporaryFile()
self.temp_cleanup_file = tempfile.NamedTemporaryFile(delete=False)
self.ifup_interface_names = []
+ self.ovs_appctl_cmds = []
def test_ifcfg_path(name):
return self.temp_ifcfg_file.name
@@ -348,6 +349,8 @@ class TestIfcfgNetConfigApply(base.TestCase):
def test_execute(*args, **kwargs):
if args[0] == '/sbin/ifup':
self.ifup_interface_names.append(args[1])
+ elif args[0] == '/bin/ovs-appctl':
+ self.ovs_appctl_cmds.append(' '.join(args))
pass
self.stubs.Set(processutils, 'execute', test_execute)
@@ -400,6 +403,19 @@ class TestIfcfgNetConfigApply(base.TestCase):
self.provider.apply(activate=False)
self.assertEqual([], self.ifup_interface_names)
+ def test_bond_active_slave(self):
+ #setup and apply a bond
+ interface1 = objects.Interface('em1', primary=True)
+ interface2 = objects.Interface('em2')
+ bond = objects.OvsBond('bond1', use_dhcp=True,
+ members=[interface1, interface2])
+ self.provider.add_interface(interface1)
+ self.provider.add_interface(interface2)
+ self.provider.add_bond(bond)
+ self.provider.apply()
+ ovs_appctl_cmds = '/bin/ovs-appctl bond/set-active-slave bond1 em1'
+ self.assertIn(ovs_appctl_cmds, self.ovs_appctl_cmds)
+
def test_restart_children_on_change(self):
# setup and apply a bridge
interface = objects.Interface('em1')