Ejemplo n.º 1
0
 def test_bond_active_ordering(self):
     # setup and apply a bond
     interface1 = objects.Interface('em1')
     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)
Ejemplo n.º 2
0
    def test_restart_children_on_change(self):
        # setup and apply a bridge
        interface = objects.Interface('em1')
        bridge = objects.OvsBridge('br-ctlplane',
                                   use_dhcp=True,
                                   members=[interface])
        self.provider.add_interface(interface)
        self.provider.add_bridge(bridge)
        self.provider.apply()
        self.assertIn('em1', self.ifup_interface_names)
        self.assertIn('br-ctlplane', self.ifup_interface_names)

        # changing the bridge should restart the interface too
        self.ifup_interface_names = []
        bridge = objects.OvsBridge('br-ctlplane',
                                   use_dhcp=False,
                                   members=[interface])
        self.provider.add_interface(interface)
        self.provider.add_bridge(bridge)
        self.provider.apply()

        # setup and apply a bond on a bridge
        self.ifup_interface_names = []
        interface1 = objects.Interface('em1')
        interface2 = objects.Interface('em2')
        bond = objects.OvsBond('bond0', members=[interface1, interface2])
        bridge = objects.OvsBridge('br-ctlplane',
                                   use_dhcp=True,
                                   members=[bond])
        self.provider.add_interface(interface1)
        self.provider.add_interface(interface2)
        self.provider.add_bond(bond)
        self.provider.add_bridge(bridge)
        self.provider.apply()

        # changing the bridge should restart everything
        self.ifup_interface_names = []
        bridge = objects.OvsBridge('br-ctlplane',
                                   use_dhcp=False,
                                   members=[bond])
        self.provider.add_interface(interface1)
        self.provider.add_interface(interface2)
        self.provider.add_bond(bond)
        self.provider.add_bridge(bridge)
        self.provider.apply()
        self.assertIn('br-ctlplane', self.ifup_interface_names)
        self.assertIn('bond0', self.ifup_interface_names)
        self.assertIn('em1', self.ifup_interface_names)
        self.assertIn('em2', self.ifup_interface_names)
Ejemplo n.º 3
0
    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'))
Ejemplo n.º 4
0
    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.add_interface(interface1)
        self.provider.add_interface(interface2)
        self.provider.add_bond(bond)
        self.assertEqual(_NO_IP, self.get_interface_config('em1'))

        em2_config = """# This file is autogenerated by os-net-config
DEVICE=em2
ONBOOT=yes
HOTPLUG=no
NM_CONTROLLED=no
PEERDNS=no
BOOTPROTO=none
"""
        self.assertEqual(em2_config, self.get_interface_config('em2'))
        self.assertEqual(_OVS_BOND_DHCP, self.get_interface_config('bond0'))