summaryrefslogtreecommitdiffstats
path: root/os_net_config/tests
diff options
context:
space:
mode:
authorDan Prince <dprince@redhat.com>2014-06-26 12:58:04 -0400
committerDan Prince <dprince@redhat.com>2014-06-26 12:58:04 -0400
commit8e8b9b980b549e3388782fbb315c5c26e9a67e37 (patch)
tree82e3030b4e2a2d7efdb6cd9e31a4a09b6b1b1cc5 /os_net_config/tests
parent4c2e97b30ef1bac4e5e9229bce5425536466d122 (diff)
Add OvsBond object and impl for ifcfg format.
Supports the configuration of OVS bond interfaces. Also adds the ability to configure extra OVS_OPTIONS for both bonds and bridges (useful for some modes of operation)
Diffstat (limited to 'os_net_config/tests')
-rw-r--r--os_net_config/tests/test_impl_ifcfg.py32
1 files changed, 31 insertions, 1 deletions
diff --git a/os_net_config/tests/test_impl_ifcfg.py b/os_net_config/tests/test_impl_ifcfg.py
index fa1efdb..cf1f0c0 100644
--- a/os_net_config/tests/test_impl_ifcfg.py
+++ b/os_net_config/tests/test_impl_ifcfg.py
@@ -60,7 +60,7 @@ HOTPLUG=no
DEVICETYPE=ovs
TYPE=OVSBridge
OVSBOOTPROTO=dhcp
-OVSDHCPINTERFACES=em1
+OVSDHCPINTERFACES="em1"
"""
_BASE_VLAN = """DEVICE=vlan5
@@ -70,6 +70,7 @@ VLAN=yes
PHYSDEV=em1
"""
+
_VLAN_NO_IP = _BASE_VLAN + "BOOTPROTO=none\n"
@@ -86,6 +87,16 @@ BOOTPROTO=none
"""
+_OVS_BOND_DHCP = """DEVICE=bond0
+ONBOOT=yes
+HOTPLUG=no
+DEVICETYPE=ovs
+TYPE=OVSBond
+OVSBOOTPROTO=dhcp
+BOND_IFACES="em1 em2"
+"""
+
+
class TestIfcfgNetConfig(base.TestCase):
def setUp(self):
@@ -163,6 +174,25 @@ class TestIfcfgNetConfig(base.TestCase):
self.provider.addBridge(bridge)
self.assertEqual(_VLAN_OVS_BRIDGE, self.get_interface_config('vlan5'))
+ def test_ovs_bond(self):
+ interface1 = objects.Interface('em1')
+ interface2 = objects.Interface('em2')
+ bond = objects.OvsBond('bond0', use_dhcp=True,
+ members=[interface1, interface2])
+ self.provider.addInterface(interface1)
+ self.provider.addInterface(interface2)
+ self.provider.addBond(bond)
+ self.assertEqual(_NO_IP, self.get_interface_config('em1'))
+
+ em2_config = """DEVICE=em2
+ONBOOT=yes
+HOTPLUG=no
+BOOTPROTO=none
+"""
+ self.assertEqual(em2_config, self.get_interface_config('em2'))
+ self.assertEqual(_OVS_BOND_DHCP,
+ self.get_interface_config('bond0'))
+
class TestIfcfgNetConfigApply(base.TestCase):