Ejemplo n.º 1
0
    def test_dhcp_update_port(self):
        self.app._uninstall_dhcp_port_responders = mock.Mock()
        self.app._install_dhcp_port_responders = mock.Mock()

        fake_port1 = test_app_base.make_fake_port(id='1', ips=('1.1.1.1', ))
        fake_port2 = test_app_base.make_fake_port(id='2', ips=('1.1.1.1', ))
        fake_port3 = test_app_base.make_fake_port(id='2', ips=('1.1.1.2', ))

        self.app._lport_updated(fake_port1, fake_port2)
        self.app._uninstall_dhcp_port_responders.assert_not_called()

        self.app._lport_updated(fake_port1, fake_port3)
        self.app._uninstall_dhcp_port_responders._assert_called_once(
            fake_port1, fake_port3)
Ejemplo n.º 2
0
 def test_update_bind_local(self):
     old_port = test_app_base.make_fake_port(id='id1')
     new_port = test_app_base.make_fake_local_port(id='id1')
     old_port.emit_created()
     new_port.emit_updated(old_port)
     _M[l2.EVENT_BIND_LOCAL].assert_called_once_with(new_port)
     _M[l2.EVENT_LOCAL_UPDATED].assert_not_called()
Ejemplo n.º 3
0
 def test_update_unbind_remote(self):
     old_port = test_app_base.make_fake_remote_port(id='id1')
     new_port = test_app_base.make_fake_port(id='id1')
     old_port.emit_created()
     new_port.emit_updated(old_port)
     _M[l2.EVENT_UNBIND_REMOTE].assert_called_once_with(old_port)
     _M[l2.EVENT_REMOTE_UPDATED].assert_not_called()