Ejemplo n.º 1
0
    def _setup_rpc(self):

        self.endpoints = [l3_rpc.L3RpcCallback(),
                          agents_db.AgentExtRpcCallback(),
                          metadata_rpc.MetadataRpcCallback()]
        if cfg.CONF.df.use_centralized_ipv6_DHCP:
            self.endpoints.append(dhcp_rpc.DhcpRpcCallback())
Ejemplo n.º 2
0
 def _setup_rpc(self):
     # RPC support
     self.service_topics = {
         svc_constants.CORE: topics.PLUGIN,
         svc_constants.L3_ROUTER_NAT: topics.L3PLUGIN
     }
     self.rpc_context = oslo_context.RequestContext('neutron',
                                                    'neutron',
                                                    is_admin=False)
     self.conn = n_rpc.create_connection(new=True)
     self.endpoints = [
         BridgeRpcCallbacks(),
         securitygroups_rpc.SecurityGroupServerRpcCallback(),
         dhcp_rpc.DhcpRpcCallback(),
         l3_rpc.L3RpcCallback(),
         agents_db.AgentExtRpcCallback(),
         metadata_rpc.MetadataRpcCallback()
     ]
     for svc_topic in self.service_topics.values():
         self.conn.create_consumer(svc_topic, self.endpoints, fanout=False)
     # Consume from all consumers in threads
     self.conn.consume_in_threads()
     self.notifier = AgentNotifierApi(topics.AGENT)
     self.agent_notifiers[q_const.AGENT_TYPE_DHCP] = (
         dhcp_rpc_agent_api.DhcpAgentNotifyAPI())
     self.agent_notifiers[q_const.AGENT_TYPE_L3] = (
         l3_rpc_agent_api.L3AgentNotifyAPI())
Ejemplo n.º 3
0
    def setup_rpc(self):
        self.service_topics = {
            svc_constants.CORE: topics.PLUGIN,
            svc_constants.L3_ROUTER_NAT: topics.L3PLUGIN
        }
        self.conn = n_rpc.create_connection(new=True)
        self.notifier = NECPluginV2AgentNotifierApi(topics.AGENT)
        self.agent_notifiers[const.AGENT_TYPE_DHCP] = (
            dhcp_rpc_agent_api.DhcpAgentNotifyAPI())
        self.agent_notifiers[const.AGENT_TYPE_L3] = (
            nec_router.L3AgentNotifyAPI())

        # NOTE: callback_sg is referred to from the sg unit test.
        self.callback_sg = securitygroups_rpc.SecurityGroupServerRpcCallback()
        self.endpoints = [
            NECPluginV2RPCCallbacks(self.safe_reference),
            dhcp_rpc.DhcpRpcCallback(),
            l3_rpc.L3RpcCallback(), self.callback_sg,
            agents_db.AgentExtRpcCallback(),
            metadata_rpc.MetadataRpcCallback()
        ]
        for svc_topic in self.service_topics.values():
            self.conn.create_consumer(svc_topic, self.endpoints, fanout=False)
        # Consume from all consumers in threads
        self.conn.consume_in_threads()
Ejemplo n.º 4
0
 def setUp(self):
     super(TestDhcpRpcCallback, self).setUp()
     self.plugin_p = mock.patch('neutron.manager.NeutronManager.get_plugin')
     get_plugin = self.plugin_p.start()
     self.plugin = mock.MagicMock()
     get_plugin.return_value = self.plugin
     self.callbacks = dhcp_rpc.DhcpRpcCallback()
     self.log_p = mock.patch('neutron.api.rpc.handlers.dhcp_rpc.LOG')
     self.log = self.log_p.start()
Ejemplo n.º 5
0
 def setup_rpc(self):
     # RPC support
     self.topic = topics.PLUGIN
     self.conn = n_rpc.create_connection(new=True)
     self.endpoints = [
         dhcp_rpc.DhcpRpcCallback(),
         agents_db.AgentExtRpcCallback()
     ]
     self.conn.create_consumer(self.topic, self.endpoints, fanout=False)
     # Consume from all consumers in a thread
     self.conn.consume_in_threads()
Ejemplo n.º 6
0
 def start_rpc_listeners(self):
     self.endpoints = [rpc.RpcCallbacks(),
                       securitygroups_rpc.SecurityGroupServerRpcCallback(),
                       dvr_rpc.DVRServerRpcCallback(),
                       dhcp_rpc.DhcpRpcCallback(),
                       agents_db.AgentExtRpcCallback()]
     self.topic = topics.PLUGIN
     self.conn = n_rpc.create_connection(new=True)
     self.conn.create_consumer(self.topic, self.endpoints,
                               fanout=False)
     return self.conn.consume_in_threads()
Ejemplo n.º 7
0
 def _setup_rpc(self):
     self.service_topics = {svc_constants.CORE: topics.PLUGIN,
                            svc_constants.L3_ROUTER_NAT: topics.L3PLUGIN}
     self.conn = n_rpc.create_connection(new=True)
     self.notifier = AgentNotifierApi(topics.AGENT)
     self.endpoints = [RyuRpcCallbacks(self.ofp_api_host),
                       securitygroups_rpc.SecurityGroupServerRpcCallback(),
                       dhcp_rpc.DhcpRpcCallback(),
                       l3_rpc.L3RpcCallback()]
     for svc_topic in self.service_topics.values():
         self.conn.create_consumer(svc_topic, self.endpoints, fanout=False)
     self.conn.consume_in_threads()
Ejemplo n.º 8
0
 def setUp(self):
     super(TestDhcpRpcCallback, self).setUp()
     self.plugin_p = mock.patch('neutron.manager.NeutronManager.get_plugin')
     get_plugin = self.plugin_p.start()
     self.plugin = mock.MagicMock()
     get_plugin.return_value = self.plugin
     self.callbacks = dhcp_rpc.DhcpRpcCallback()
     self.log_p = mock.patch('neutron.api.rpc.handlers.dhcp_rpc.LOG')
     self.log = self.log_p.start()
     set_dirty_p = mock.patch('neutron.quota.resource_registry.'
                              'set_resources_dirty')
     self.mock_set_dirty = set_dirty_p.start()
Ejemplo n.º 9
0
 def setUp(self):
     super(TestDhcpRpcCallback, self).setUp()
     self.plugin = mock.MagicMock()
     directory.add_plugin(plugin_constants.CORE, self.plugin)
     self.callbacks = dhcp_rpc.DhcpRpcCallback()
     self.log_p = mock.patch('neutron.api.rpc.handlers.dhcp_rpc.LOG')
     self.log = self.log_p.start()
     set_dirty_p = mock.patch('neutron.quota.resource_registry.'
                              'set_resources_dirty')
     self.mock_set_dirty = set_dirty_p.start()
     self.utils_p = mock.patch('neutron.plugins.common.utils.create_port')
     self.utils = self.utils_p.start()
     self.segment_plugin = mock.MagicMock()
     directory.add_plugin('segments', self.segment_plugin)
Ejemplo n.º 10
0
 def _setup_rpc_dhcp_metadata(self, notifier=None):
     self.topic = topics.PLUGIN
     self.conn = n_rpc.create_connection(new=True)
     self.endpoints = [
         dhcp_rpc.DhcpRpcCallback(),
         agents_db.AgentExtRpcCallback()
     ]
     self.conn.create_consumer(self.topic, self.endpoints, fanout=False)
     self.agent_notifiers[const.AGENT_TYPE_DHCP] = (
         notifier or dhcp_rpc_agent_api.DhcpAgentNotifyAPI())
     self.conn.consume_in_threads()
     self.network_scheduler = importutils.import_object(
         cfg.CONF.network_scheduler_driver)
     self.supported_extension_aliases.extend(
         ['agent', 'dhcp_agent_scheduler'])
Ejemplo n.º 11
0
 def _setup_rpc(self):
     # RPC support
     self.service_topics = {svc_constants.CORE: topics.PLUGIN,
                            svc_constants.L3_ROUTER_NAT: topics.L3PLUGIN}
     self.conn = n_rpc.create_connection(new=True)
     self.notifier = agent_notifier_api.AgentNotifierApi(
         topics.AGENT)
     self.endpoints = [rpc_callbacks.HyperVRpcCallbacks(self.notifier),
                       dhcp_rpc.DhcpRpcCallback(),
                       l3_rpc.L3RpcCallback(),
                       agents_db.AgentExtRpcCallback()]
     for svc_topic in self.service_topics.values():
         self.conn.create_consumer(svc_topic, self.endpoints, fanout=False)
     # Consume from all consumers in threads
     self.conn.consume_in_threads()
Ejemplo n.º 12
0
 def _setup_rpc(self):
     self.conn = n_rpc.create_connection(new=True)
     self.topic = topics.PLUGIN
     self.notifier = AgentNotifierApi(topics.AGENT)
     # init dhcp agent support
     self._dhcp_agent_notifier = dhcp_rpc_agent_api.DhcpAgentNotifyAPI()
     self.agent_notifiers[const.AGENT_TYPE_DHCP] = (
         self._dhcp_agent_notifier)
     self.endpoints = [
         securitygroups_rpc.SecurityGroupServerRpcCallback(),
         dhcp_rpc.DhcpRpcCallback(),
         agents_db.AgentExtRpcCallback()
     ]
     self.conn.create_consumer(self.topic, self.endpoints, fanout=False)
     # Consume from all consumers in threads
     self.conn.consume_in_threads()
Ejemplo n.º 13
0
    def start_rpc_listeners(self):
        self.endpoints = [
            ml2_server_callback.NwaML2ServerRpcCallbacks(
                self.notifier, self.type_manager),
            nwa_l2_server_callback.NwaL2ServerRpcCallback(),
            tenant_binding_callback.TenantBindingServerRpcCallback(),
            securitygroups_rpc.SecurityGroupServerRpcCallback(),
            dhcp_rpc.DhcpRpcCallback(),
            agents_db.AgentExtRpcCallback(),
            metadata_rpc.MetadataRpcCallback()]

        self.topic = topics.PLUGIN
        self.conn = n_rpc.create_connection()
        self.conn.create_consumer(self.topic, self.endpoints,
                                  fanout=False)
        return self.conn.consume_in_threads()
Ejemplo n.º 14
0
 def setUp(self):
     super(TestDhcpRpcCallback, self).setUp()
     self.plugin = mock.MagicMock()
     directory.add_plugin(plugin_constants.CORE, self.plugin)
     self.callbacks = dhcp_rpc.DhcpRpcCallback()
     self.log_p = mock.patch('neutron.api.rpc.handlers.dhcp_rpc.LOG')
     self.log = self.log_p.start()
     set_dirty_p = mock.patch('neutron.quota.resource_registry.'
                              'set_resources_dirty')
     self.mock_set_dirty = set_dirty_p.start()
     self.utils_p = mock.patch('neutron_lib.plugins.utils.create_port')
     self.utils = self.utils_p.start()
     self.agent_hosting_network_p = mock.patch.object(
         self.callbacks, '_is_dhcp_agent_hosting_network')
     self.mock_agent_hosting_network = self.agent_hosting_network_p.start()
     self.mock_agent_hosting_network.return_value = True
     self.segment_plugin = mock.MagicMock()
     directory.add_plugin('segments', self.segment_plugin)
Ejemplo n.º 15
0
    def setup_dhcpmeta_access(self):
        # Ok, so we're going to add L3 here too with the DHCP
        self.conn = n_rpc.create_connection(new=True)
        self.conn.create_consumer(
            topics.PLUGIN,
            [dhcp_rpc.DhcpRpcCallback(),
             agents_db.AgentExtRpcCallback()],
            fanout=False)

        self.conn.create_consumer(topics.L3PLUGIN, [l3_rpc.L3RpcCallback()],
                                  fanout=False)

        # Consume from all consumers in a thread
        self.conn.consume_in_threads()

        self.handle_network_dhcp_access_delegate = noop
        self.handle_port_dhcp_access_delegate = noop
        self.handle_port_metadata_access_delegate = noop
        self.handle_metadata_access_delegate = noop
Ejemplo n.º 16
0
    def setup_rpc(self):
        # RPC support
        self.service_topics = {
            svc_constants.CORE: topics.PLUGIN,
            svc_constants.L3_ROUTER_NAT: topics.L3PLUGIN
        }
        self.conn = n_rpc.create_connection(new=True)
        self.notifier = NVSDPluginV2AgentNotifierApi(topics.AGENT)
        self.agent_notifiers[q_const.AGENT_TYPE_DHCP] = (
            dhcp_rpc_agent_api.DhcpAgentNotifyAPI())
        self.agent_notifiers[q_const.AGENT_TYPE_L3] = (
            l3_rpc_agent_api.L3AgentNotifyAPI())
        self.endpoints = [
            securitygroups_rpc.SecurityGroupServerRpcCallback(),
            dhcp_rpc.DhcpRpcCallback(),
            l3_rpc.L3RpcCallback(),
            agents_db.AgentExtRpcCallback()
        ]
        for svc_topic in self.service_topics.values():
            self.conn.create_consumer(svc_topic, self.endpoints, fanout=False)

        # Consume from all consumers in threads
        self.conn.consume_in_threads()