示例#1
0
    def test_init(self):
        nd = rpc.NotificationDispatcher()

        expected = [
            mock.call(new=True),
            mock.call().declare_topic_consumer(topic='notifications.info',
                                               callback=nd._add_to_queue),
            mock.call().consume_in_thread()
        ]
        self.create_connection.assert_has_calls(expected)
示例#2
0
    def __init__(self, conf):
        self.conf = conf
        self.cache = NetworkCache()

        self.dhcp_driver_cls = importutils.import_class(conf.dhcp_driver)
        ctx = context.RequestContext('quantum', 'quantum', is_admin=True)
        self.plugin_rpc = DhcpPluginApi(topics.PLUGIN, ctx)

        self.device_manager = DeviceManager(self.conf, self.plugin_rpc)
        self.notifications = agent_rpc.NotificationDispatcher()
        self.lease_relay = DhcpLeaseRelay(self.update_lease)
示例#3
0
    def _test_run_dispatch_helper(self, msg, handler):
        msgs = [msg]

        def side_effect(*args):
            return msgs.pop(0)

        with mock.patch('eventlet.Queue.get') as queue_get:
            queue_get.side_effect = side_effect
            nd = rpc.NotificationDispatcher()
            # catch the assertion so that the loop runs once
            self.assertRaises(IndexError, nd.run_dispatch, handler)
示例#4
0
    def __init__(self, conf):
        self.needs_resync = False
        self.conf = conf
        self.cache = NetworkCache()

        self.dhcp_driver_cls = importutils.import_class(conf.dhcp_driver)
        ctx = context.get_admin_context_without_session()
        self.plugin_rpc = DhcpPluginApi(topics.PLUGIN, ctx)

        self.device_manager = DeviceManager(self.conf, self.plugin_rpc)
        self.notifications = agent_rpc.NotificationDispatcher()
        self.lease_relay = DhcpLeaseRelay(self.update_lease)
示例#5
0
 def test_add_to_queue(self):
     nd = rpc.NotificationDispatcher()
     nd._add_to_queue('foo')
     self.assertEqual(nd.queue.get(), 'foo')