summaryrefslogtreecommitdiffstats
path: root/os_net_config/tests/test_impl_ifcfg.py
diff options
context:
space:
mode:
Diffstat (limited to 'os_net_config/tests/test_impl_ifcfg.py')
-rw-r--r--os_net_config/tests/test_impl_ifcfg.py23
1 files changed, 14 insertions, 9 deletions
diff --git a/os_net_config/tests/test_impl_ifcfg.py b/os_net_config/tests/test_impl_ifcfg.py
index 3500e4c..fa85de7 100644
--- a/os_net_config/tests/test_impl_ifcfg.py
+++ b/os_net_config/tests/test_impl_ifcfg.py
@@ -179,11 +179,11 @@ BOOTPROTO=none
"""
_VLAN_LINUX_BRIDGE = _BASE_VLAN_OVS + """VLAN=yes
+PHYSDEV=em1
BRIDGE=br-ctlplane
BOOTPROTO=none
"""
-
_OVS_BOND_DHCP = """# This file is autogenerated by os-net-config
DEVICE=bond0
ONBOOT=yes
@@ -246,6 +246,12 @@ class TestIfcfgNetConfig(base.TestCase):
def get_interface_config(self, name='em1'):
return self.provider.interface_data[name]
+ def get_vlan_config(self, name='vlan1'):
+ return self.provider.vlan_data[name]
+
+ def get_linux_bond_config(self, name='bond0'):
+ return self.provider.linuxbond_data[name]
+
def get_route_config(self, name='em1'):
return self.provider.route_data.get(name, '')
@@ -430,19 +436,19 @@ class TestIfcfgNetConfig(base.TestCase):
def test_add_vlan(self):
vlan = objects.Vlan('em1', 5)
self.provider.add_vlan(vlan)
- self.assertEqual(_VLAN_NO_IP, self.get_interface_config('vlan5'))
+ self.assertEqual(_VLAN_NO_IP, self.get_vlan_config('vlan5'))
def test_add_vlan_ovs(self):
vlan = objects.Vlan('em1', 5)
vlan.ovs_port = True
self.provider.add_vlan(vlan)
- self.assertEqual(_VLAN_OVS, self.get_interface_config('vlan5'))
+ self.assertEqual(_VLAN_OVS, self.get_vlan_config('vlan5'))
def test_add_vlan_mtu_1500(self):
vlan = objects.Vlan('em1', 5, mtu=1500)
self.provider.add_vlan(vlan)
expected = _VLAN_NO_IP + 'MTU=1500\n'
- self.assertEqual(expected, self.get_interface_config('vlan5'))
+ self.assertEqual(expected, self.get_vlan_config('vlan5'))
def test_add_ovs_bridge_with_vlan(self):
vlan = objects.Vlan('em1', 5)
@@ -450,16 +456,15 @@ class TestIfcfgNetConfig(base.TestCase):
members=[vlan])
self.provider.add_vlan(vlan)
self.provider.add_bridge(bridge)
- self.assertEqual(_VLAN_OVS_BRIDGE, self.get_interface_config('vlan5'))
+ self.assertEqual(_VLAN_OVS_BRIDGE, self.get_vlan_config('vlan5'))
def test_add_linux_bridge_with_vlan(self):
- vlan = objects.Vlan(None, 5)
+ vlan = objects.Vlan('em1', 5)
bridge = objects.LinuxBridge('br-ctlplane', use_dhcp=True,
members=[vlan])
self.provider.add_vlan(vlan)
self.provider.add_bridge(bridge)
- self.assertEqual(_VLAN_LINUX_BRIDGE,
- self.get_interface_config('vlan5'))
+ self.assertEqual(_VLAN_LINUX_BRIDGE, self.get_vlan_config('vlan5'))
def test_ovs_bond(self):
interface1 = objects.Interface('em1')
@@ -489,7 +494,7 @@ BOOTPROTO=none
members=[interface1, interface2])
self.provider.add_linux_bond(bond)
self.assertEqual(_LINUX_BOND_DHCP,
- self.get_interface_config('bond0'))
+ self.get_linux_bond_config('bond0'))
def test_interface_defroute(self):
interface1 = objects.Interface('em1')