diff options
Diffstat (limited to 'os_net_config/tests')
-rw-r--r-- | os_net_config/tests/test_impl_ifcfg.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/os_net_config/tests/test_impl_ifcfg.py b/os_net_config/tests/test_impl_ifcfg.py index 6576cef..82ca116 100644 --- a/os_net_config/tests/test_impl_ifcfg.py +++ b/os_net_config/tests/test_impl_ifcfg.py @@ -34,6 +34,14 @@ NM_CONTROLLED=no PEERDNS=no """ +_BASE_IFCFG_NETWORKMANAGER = """# This file is autogenerated by os-net-config +DEVICE=em1 +ONBOOT=yes +HOTPLUG=no +NM_CONTROLLED=yes +PEERDNS=no +""" + _HOTPLUG = """# This file is autogenerated by os-net-config DEVICE=em1 ONBOOT=yes @@ -153,6 +161,19 @@ OVSBOOTPROTO=dhcp OVSDHCPINTERFACES="em1" """ +_NM_CONTROLLED_INTERFACE = _BASE_IFCFG_NETWORKMANAGER + """MASTER=bond1 +SLAVE=yes +BOOTPROTO=none +""" + +_NM_CONTROLLED_BOND = """# This file is autogenerated by os-net-config +DEVICE=bond1 +ONBOOT=yes +HOTPLUG=no +NM_CONTROLLED=yes +PEERDNS=no +""" + _OVS_BRIDGE_DHCP_STANDALONE = _OVS_BRIDGE_DHCP + \ "OVS_EXTRA=\"set bridge br-ctlplane fail_mode=standalone\"\n" @@ -845,6 +866,20 @@ DNS2=5.6.7.8 """ self.assertEqual(em1_config, self.get_interface_config('em1')) + def test_nm_controlled(self): + interface1 = objects.Interface('em1', nm_controlled=True) + interface2 = objects.Interface('em2', nm_controlled=True) + bond = objects.LinuxBond('bond1', nm_controlled=True, + members=[interface1, interface2]) + self.provider.add_linux_bond(bond) + self.provider.add_interface(interface1) + self.provider.add_interface(interface2) + + ifcfg_data = self.get_interface_config('em1') + self.assertEqual(_NM_CONTROLLED_INTERFACE, ifcfg_data) + bond_data = self.get_linux_bond_config('bond1') + self.assertEqual(_NM_CONTROLLED_BOND, bond_data) + def test_network_ovs_dpdk_bridge_and_port(self): nic_mapping = {'nic1': 'eth0', 'nic2': 'eth1', 'nic3': 'eth2'} self.stubbed_mapped_nics = nic_mapping @@ -924,6 +959,7 @@ class TestIfcfgNetConfigApply(base.TestCase): def setUp(self): super(TestIfcfgNetConfigApply, self).setUp() self.temp_ifcfg_file = tempfile.NamedTemporaryFile() + self.temp_bond_file = tempfile.NamedTemporaryFile() self.temp_route_file = tempfile.NamedTemporaryFile() self.temp_route6_file = tempfile.NamedTemporaryFile() self.temp_bridge_file = tempfile.NamedTemporaryFile() |