aboutsummaryrefslogtreecommitdiffstats
path: root/os_net_config/tests/test_impl_eni.py
diff options
context:
space:
mode:
authorDan Prince <dprince@redhat.com>2014-08-12 11:06:46 -0400
committerDan Prince <dprince@redhat.com>2014-08-12 11:51:31 -0400
commitf0ae3282450c2bb1bb35f22414858768f08d2653 (patch)
treeedcf2d322f4b222bd0b11034ce4e09689caf10ef /os_net_config/tests/test_impl_eni.py
parentf57b67880d5c70bbc287ab56395895bb88a1b011 (diff)
Set the MAC to the primary interface
Adds support for a new 'primary' interface option exposed via the object model and JSON parsers which can be used to force the MAC address on a bridge. Only one interface on a given bridge (or bond) may be set as the primary interface. Also, update the ifcfg and eni providers so that they use OVS_EXTRA (or ovs_extra) to pin the mac accordingly.
Diffstat (limited to 'os_net_config/tests/test_impl_eni.py')
-rw-r--r--os_net_config/tests/test_impl_eni.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/os_net_config/tests/test_impl_eni.py b/os_net_config/tests/test_impl_eni.py
index c05b7c6..55502b3 100644
--- a/os_net_config/tests/test_impl_eni.py
+++ b/os_net_config/tests/test_impl_eni.py
@@ -53,6 +53,9 @@ iface br0 inet dhcp
pre-up ip addr flush dev eth0
"""
+_OVS_BRIDGE_DHCP_PRIMARY_INTERFACE = _OVS_BRIDGE_DHCP + \
+ " ovs_extra set bridge br0 other-config:hwaddr=a1:b2:c3:d4:e5\n"
+
_VLAN_NO_IP = """auto vlan5
iface vlan5 inet manual
vlan-raw-device eth0
@@ -146,6 +149,21 @@ class TestENINetConfig(base.TestCase):
self.assertEqual(_OVS_PORT_IFACE, self.get_interface_config())
self.assertEqual(_OVS_BRIDGE_DHCP, self.provider.bridges['br0'])
+ def test_network_ovs_bridge_with_dhcp_and_primary_interface(self):
+
+ def test_interface_mac(name):
+ return "a1:b2:c3:d4:e5"
+ self.stubs.Set(utils, 'interface_mac', test_interface_mac)
+
+ interface = objects.Interface(self.if_name, primary=True)
+ bridge = objects.OvsBridge('br0', use_dhcp=True,
+ members=[interface])
+ self.provider.addBridge(bridge)
+ self.provider.addInterface(interface)
+ self.assertEqual(_OVS_PORT_IFACE, self.get_interface_config())
+ self.assertEqual(_OVS_BRIDGE_DHCP_PRIMARY_INTERFACE,
+ self.provider.bridges['br0'])
+
def test_vlan(self):
vlan = objects.Vlan('eth0', 5)
self.provider.addVlan(vlan)