from neutron.common import config as common_config
from neutron.common import constants
from neutron.common import exceptions
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.common import utils
from neutron import context
% {'net_id': network.id, 'action': action})
except Exception as e:
self.schedule_resync(e)
- if (isinstance(e, rpc_compat.RemoteError)
+ if (isinstance(e, n_rpc.RemoteError)
and e.exc_type == 'NetworkNotFound'
or isinstance(e, exceptions.NetworkNotFound)):
LOG.warning(_("Network %s has been deleted."), network.id)
pm.disable()
-class DhcpPluginApi(rpc_compat.RpcProxy):
+class DhcpPluginApi(n_rpc.RpcProxy):
"""Agent side of the dhcp rpc API.
API version history:
from neutron.agent import rpc as agent_rpc
from neutron.common import config as common_config
from neutron.common import constants as l3_constants
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.common import utils as common_utils
from neutron import context
FLOATING_IP_CIDR_SUFFIX = '/32'
-class L3PluginApi(rpc_compat.RpcProxy):
+class L3PluginApi(n_rpc.RpcProxy):
"""Agent side of the l3 agent RPC API.
API version history:
def get_external_network_id(self, context):
"""Make a remote process call to retrieve the external network id.
- @raise rpc_compat.RemoteError: with TooManyExternalNetworks
- as exc_type if there are
- more than one external network
+ @raise n_rpc.RemoteError: with TooManyExternalNetworks as
+ exc_type if there are more than one
+ external network
"""
return self.call(context,
self.make_msg('get_external_network_id',
self.target_ex_net_id = self.plugin_rpc.get_external_network_id(
self.context)
return self.target_ex_net_id
- except rpc_compat.RemoteError as e:
+ except n_rpc.RemoteError as e:
with excutils.save_and_reraise_exception() as ctx:
if e.exc_type == 'TooManyExternalNetworks':
ctx.reraise = False
self._process_routers(routers, all_routers=True)
self.fullsync = False
LOG.debug(_("_sync_routers_task successfully completed"))
- except rpc_compat.RPCException:
+ except n_rpc.RPCException:
LOG.exception(_("Failed synchronizing routers due to RPC error"))
self.fullsync = True
return
import itertools
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.openstack.common import log as logging
:returns: A common Connection.
"""
- connection = rpc_compat.create_connection(new=True)
+ connection = n_rpc.create_connection(new=True)
for details in topic_details:
topic, operation, node_name = itertools.islice(
itertools.chain(details, [None]), 3)
return connection
-class PluginReportStateAPI(rpc_compat.RpcProxy):
+class PluginReportStateAPI(n_rpc.RpcProxy):
BASE_RPC_API_VERSION = '1.0'
def __init__(self, topic):
return self.cast(context, msg, topic=self.topic)
-class PluginApi(rpc_compat.RpcProxy):
+class PluginApi(n_rpc.RpcProxy):
'''Agent side of the rpc API.
API version history:
# limitations under the License.
from neutron.common import constants
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.common import utils
from neutron import manager
LOG = logging.getLogger(__name__)
-class DhcpAgentNotifyAPI(rpc_compat.RpcProxy):
+class DhcpAgentNotifyAPI(n_rpc.RpcProxy):
"""API for plugin to notify DHCP agent."""
BASE_RPC_API_VERSION = '1.0'
# It seems dhcp agent does not support bulk operation
# limitations under the License.
from neutron.common import constants
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.common import utils
from neutron import manager
LOG = logging.getLogger(__name__)
-class L3AgentNotifyAPI(rpc_compat.RpcProxy):
+class L3AgentNotifyAPI(n_rpc.RpcProxy):
"""API for plugin to notify L3 agent."""
BASE_RPC_API_VERSION = '1.0'
# under the License.
from neutron.common import constants
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.common import utils
from neutron import manager
LOG = logging.getLogger(__name__)
-class MeteringAgentNotifyAPI(rpc_compat.RpcProxy):
+class MeteringAgentNotifyAPI(n_rpc.RpcProxy):
"""API for plugin to notify L3 metering agent."""
BASE_RPC_API_VERSION = '1.0'
# Copyright (c) 2012 OpenStack Foundation.
+# Copyright (c) 2014 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
from neutron.common import exceptions
from neutron import context
from neutron.openstack.common import log as logging
+from neutron.openstack.common import service
LOG = logging.getLogger(__name__)
tenant_id = rpc_ctxt_dict.pop('project_id', None)
return context.Context(user_id, tenant_id,
load_admin_roles=False, **rpc_ctxt_dict)
+
+
+class RpcProxy(object):
+ '''
+ This class is created to facilitate migration from oslo-incubator
+ RPC layer implementation to oslo.messaging and is intended to
+ emulate RpcProxy class behaviour using oslo.messaging API once the
+ migration is applied.
+ '''
+ RPC_API_NAMESPACE = None
+
+ def __init__(self, topic, default_version, version_cap=None):
+ self.topic = topic
+ target = messaging.Target(topic=topic, version=default_version)
+ self._client = get_client(target, version_cap=version_cap)
+
+ def make_msg(self, method, **kwargs):
+ return {'method': method,
+ 'namespace': self.RPC_API_NAMESPACE,
+ 'args': kwargs}
+
+ def call(self, context, msg, **kwargs):
+ return self.__call_rpc_method(
+ context, msg, rpc_method='call', **kwargs)
+
+ def cast(self, context, msg, **kwargs):
+ self.__call_rpc_method(context, msg, rpc_method='cast', **kwargs)
+
+ def fanout_cast(self, context, msg, **kwargs):
+ kwargs['fanout'] = True
+ self.__call_rpc_method(context, msg, rpc_method='cast', **kwargs)
+
+ def __call_rpc_method(self, context, msg, **kwargs):
+ options = dict(
+ ((opt, kwargs[opt])
+ for opt in ('fanout', 'timeout', 'topic', 'version')
+ if kwargs.get(opt))
+ )
+ if msg['namespace']:
+ options['namespace'] = msg['namespace']
+
+ if options:
+ callee = self._client.prepare(**options)
+ else:
+ callee = self._client
+
+ func = getattr(callee, kwargs['rpc_method'])
+ return func(context, msg['method'], **msg['args'])
+
+
+class RpcCallback(object):
+ '''
+ This class is created to facilitate migration from oslo-incubator
+ RPC layer implementation to oslo.messaging and is intended to set
+ callback version using oslo.messaging API once the migration is
+ applied.
+ '''
+ RPC_API_VERSION = '1.0'
+
+ def __init__(self):
+ super(RpcCallback, self).__init__()
+ self.target = messaging.Target(version=self.RPC_API_VERSION)
+
+
+class Service(service.Service):
+ """Service object for binaries running on hosts.
+
+ A service enables rpc by listening to queues based on topic and host.
+ """
+ def __init__(self, host, topic, manager=None, serializer=None):
+ super(Service, self).__init__()
+ self.host = host
+ self.topic = topic
+ self.serializer = serializer
+ if manager is None:
+ self.manager = self
+ else:
+ self.manager = manager
+
+ def start(self):
+ super(Service, self).start()
+
+ self.conn = create_connection(new=True)
+ LOG.debug("Creating Consumer connection for Service %s" %
+ self.topic)
+
+ endpoints = [self.manager]
+
+ # Share this same connection for these Consumers
+ self.conn.create_consumer(self.topic, endpoints, fanout=False)
+
+ node_topic = '%s.%s' % (self.topic, self.host)
+ self.conn.create_consumer(node_topic, endpoints, fanout=False)
+
+ self.conn.create_consumer(self.topic, endpoints, fanout=True)
+
+ # Hook to allow the manager to do other initializations after
+ # the rpc connection is created.
+ if callable(getattr(self.manager, 'initialize_service_hook', None)):
+ self.manager.initialize_service_hook(self)
+
+ # Consume from all consumers in threads
+ self.conn.consume_in_threads()
+
+ def stop(self):
+ # Try to shut the connection down, but if we get any sort of
+ # errors, go ahead and ignore them.. as we're shutting down anyway
+ try:
+ self.conn.close()
+ except Exception:
+ pass
+ super(Service, self).stop()
+
+
+class Connection(object):
+
+ def __init__(self):
+ super(Connection, self).__init__()
+ self.servers = []
+
+ def create_consumer(self, topic, endpoints, fanout=False):
+ target = messaging.Target(
+ topic=topic, server=cfg.CONF.host, fanout=fanout)
+ server = get_server(target, endpoints)
+ self.servers.append(server)
+
+ def consume_in_threads(self):
+ for server in self.servers:
+ server.start()
+ return self.servers
+
+
+# functions
+def create_connection(new=True):
+ return Connection()
+
+
+# exceptions
+RPCException = messaging.MessagingException
+RemoteError = messaging.RemoteError
+MessagingTimeout = messaging.MessagingTimeout
+++ /dev/null
-# Copyright (c) 2014 Red Hat, Inc.
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-from oslo.config import cfg
-from oslo import messaging
-
-from neutron.common import rpc as n_rpc
-from neutron.openstack.common import log as logging
-from neutron.openstack.common import service
-
-
-LOG = logging.getLogger(__name__)
-
-
-class RpcProxy(object):
- '''
- This class is created to facilitate migration from oslo-incubator
- RPC layer implementation to oslo.messaging and is intended to
- emulate RpcProxy class behaviour using oslo.messaging API once the
- migration is applied.
- '''
- RPC_API_NAMESPACE = None
-
- def __init__(self, topic, default_version, version_cap=None):
- self.topic = topic
- target = messaging.Target(topic=topic, version=default_version)
- self._client = n_rpc.get_client(target, version_cap=version_cap)
-
- def make_msg(self, method, **kwargs):
- return {'method': method,
- 'namespace': self.RPC_API_NAMESPACE,
- 'args': kwargs}
-
- def call(self, context, msg, **kwargs):
- return self.__call_rpc_method(
- context, msg, rpc_method='call', **kwargs)
-
- def cast(self, context, msg, **kwargs):
- self.__call_rpc_method(context, msg, rpc_method='cast', **kwargs)
-
- def fanout_cast(self, context, msg, **kwargs):
- kwargs['fanout'] = True
- self.__call_rpc_method(context, msg, rpc_method='cast', **kwargs)
-
- def __call_rpc_method(self, context, msg, **kwargs):
- options = dict(
- ((opt, kwargs[opt])
- for opt in ('fanout', 'timeout', 'topic', 'version')
- if kwargs.get(opt))
- )
- if msg['namespace']:
- options['namespace'] = msg['namespace']
-
- if options:
- callee = self._client.prepare(**options)
- else:
- callee = self._client
-
- func = getattr(callee, kwargs['rpc_method'])
- return func(context, msg['method'], **msg['args'])
-
-
-class RpcCallback(object):
- '''
- This class is created to facilitate migration from oslo-incubator
- RPC layer implementation to oslo.messaging and is intended to set
- callback version using oslo.messaging API once the migration is
- applied.
- '''
- RPC_API_VERSION = '1.0'
-
- def __init__(self):
- super(RpcCallback, self).__init__()
- self.target = messaging.Target(version=self.RPC_API_VERSION)
-
-
-class Service(service.Service):
- """Service object for binaries running on hosts.
-
- A service enables rpc by listening to queues based on topic and host.
- """
- def __init__(self, host, topic, manager=None, serializer=None):
- super(Service, self).__init__()
- self.host = host
- self.topic = topic
- self.serializer = serializer
- if manager is None:
- self.manager = self
- else:
- self.manager = manager
-
- def start(self):
- super(Service, self).start()
-
- self.conn = create_connection(new=True)
- LOG.debug("Creating Consumer connection for Service %s" %
- self.topic)
-
- endpoints = [self.manager]
-
- # Share this same connection for these Consumers
- self.conn.create_consumer(self.topic, endpoints, fanout=False)
-
- node_topic = '%s.%s' % (self.topic, self.host)
- self.conn.create_consumer(node_topic, endpoints, fanout=False)
-
- self.conn.create_consumer(self.topic, endpoints, fanout=True)
-
- # Hook to allow the manager to do other initializations after
- # the rpc connection is created.
- if callable(getattr(self.manager, 'initialize_service_hook', None)):
- self.manager.initialize_service_hook(self)
-
- # Consume from all consumers in threads
- self.conn.consume_in_threads()
-
- def stop(self):
- # Try to shut the connection down, but if we get any sort of
- # errors, go ahead and ignore them.. as we're shutting down anyway
- try:
- self.conn.close()
- except Exception:
- pass
- super(Service, self).stop()
-
-
-class Connection(object):
-
- def __init__(self):
- super(Connection, self).__init__()
- self.servers = []
-
- def create_consumer(self, topic, endpoints, fanout=False):
- target = messaging.Target(
- topic=topic, server=cfg.CONF.host, fanout=fanout)
- server = n_rpc.get_server(target, endpoints)
- self.servers.append(server)
-
- def consume_in_threads(self):
- for server in self.servers:
- server.start()
- return self.servers
-
-
-# functions
-def create_connection(new=True):
- return Connection()
-
-
-# exceptions
-RPCException = messaging.MessagingException
-RemoteError = messaging.RemoteError
-MessagingTimeout = messaging.MessagingTimeout
import sqlalchemy as sa
from sqlalchemy.orm import exc
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.db import model_base
from neutron.db import models_v2
from neutron.extensions import agent as ext_agent
return self._create_or_update_agent(context, agent)
-class AgentExtRpcCallback(rpc_compat.RpcCallback):
+class AgentExtRpcCallback(n_rpc.RpcCallback):
"""Processes the rpc report in plugin implementations."""
RPC_API_VERSION = '1.0'
from oslo.config import cfg
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import utils
from neutron.openstack.common import importutils
from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
-class Manager(rpc_compat.RpcCallback, periodic_task.PeriodicTasks):
+class Manager(n_rpc.RpcCallback, periodic_task.PeriodicTasks):
# Set RPC API version to 1.0 by default.
RPC_API_VERSION = '1.0'
from neutron.agent import rpc as agent_rpc
from neutron.agent import securitygroups_rpc as sg_rpc
from neutron.common import config
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron import context as q_context
from neutron.extensions import securitygroup as ext_sg
self.init_firewall()
-class RestProxyAgent(rpc_compat.RpcCallback,
+class RestProxyAgent(n_rpc.RpcCallback,
sg_rpc.SecurityGroupAgentRpcCallbackMixin):
RPC_API_VERSION = '1.1'
from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api
from neutron.common import constants as const
from neutron.common import exceptions
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.common import utils
from neutron import context as qcontext
METADATA_SERVER_IP = '169.254.169.254'
-class AgentNotifierApi(rpc_compat.RpcProxy,
+class AgentNotifierApi(n_rpc.RpcProxy,
sg_rpc.SecurityGroupAgentRpcApiMixin):
BASE_RPC_API_VERSION = '1.1'
topic=self.topic_port_update)
-class RestProxyCallbacks(rpc_compat.RpcCallback,
+class RestProxyCallbacks(n_rpc.RpcCallback,
sg_rpc_base.SecurityGroupServerRpcCallbackMixin,
dhcp_rpc_base.DhcpRpcCallbackMixin):
LOG.debug(_("NeutronRestProxyV2: initialization done"))
def _setup_rpc(self):
- self.conn = rpc_compat.create_connection(new=True)
+ self.conn = n_rpc.create_connection(new=True)
self.topic = topics.PLUGIN
self.notifier = AgentNotifierApi(topics.AGENT)
# init dhcp agent support
from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api
from neutron.api.rpc.agentnotifiers import l3_rpc_agent_api
from neutron.common import constants as q_const
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.common import utils
from neutron.db import agents_db
cfg.CONF.register_opts(PHYSICAL_INTERFACE_OPTS, "PHYSICAL_INTERFACE")
-class BridgeRpcCallbacks(rpc_compat.RpcCallback,
+class BridgeRpcCallbacks(n_rpc.RpcCallback,
dhcp_rpc_base.DhcpRpcCallbackMixin,
l3_rpc_base.L3RpcCallbackMixin,
sg_db_rpc.SecurityGroupServerRpcCallbackMixin):
return entry
-class AgentNotifierApi(rpc_compat.RpcProxy,
+class AgentNotifierApi(n_rpc.RpcProxy,
sg_rpc.SecurityGroupAgentRpcApiMixin):
"""Agent side of the linux bridge rpc API.
svc_constants.L3_ROUTER_NAT: topics.L3PLUGIN}
self.rpc_context = context.RequestContext('neutron', 'neutron',
is_admin=False)
- self.conn = rpc_compat.create_connection(new=True)
+ self.conn = n_rpc.create_connection(new=True)
self.endpoints = [BridgeRpcCallbacks(),
agents_db.AgentExtRpcCallback()]
for svc_topic in self.service_topics.values():
from neutron.api.v2 import attributes
from neutron.common import constants
from neutron.common import exceptions as n_exc
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.common import utils
from neutron.db import agents_db
LOG = logging.getLogger(__name__)
-class N1kvRpcCallbacks(rpc_compat.RpcCallback,
+class N1kvRpcCallbacks(n_rpc.RpcCallback,
dhcp_rpc_base.DhcpRpcCallbackMixin,
l3_rpc_base.L3RpcCallbackMixin):
# RPC support
self.service_topics = {svc_constants.CORE: topics.PLUGIN,
svc_constants.L3_ROUTER_NAT: topics.L3PLUGIN}
- self.conn = rpc_compat.create_connection(new=True)
+ self.conn = n_rpc.create_connection(new=True)
self.endpoints = [N1kvRpcCallbacks(), agents_db.AgentExtRpcCallback()]
for svc_topic in self.service_topics.values():
self.conn.create_consumer(svc_topic, self.endpoints, fanout=False)
from neutron.agent import securitygroups_rpc as sg_rpc
from neutron.common import config as common_config
from neutron.common import constants as n_const
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron import context
from neutron.openstack.common import log as logging
config.register_agent_state_opts_helper(cfg.CONF)
-class HyperVSecurityAgent(rpc_compat.RpcCallback,
+class HyperVSecurityAgent(n_rpc.RpcCallback,
sg_rpc.SecurityGroupAgentRpcMixin):
# Set RPC API version to 1.1 by default.
RPC_API_VERSION = '1.1'
consumers)
-class HyperVSecurityCallbackMixin(rpc_compat.RpcCallback,
+class HyperVSecurityCallbackMixin(n_rpc.RpcCallback,
sg_rpc.SecurityGroupAgentRpcCallbackMixin):
# Set RPC API version to 1.1 by default.
RPC_API_VERSION = '1.1'
pass
-class HyperVNeutronAgent(rpc_compat.RpcCallback):
+class HyperVNeutronAgent(n_rpc.RpcCallback):
# Set RPC API version to 1.0 by default.
RPC_API_VERSION = '1.0'
# under the License.
# @author: Alessandro Pilotti, Cloudbase Solutions Srl
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.openstack.common import log as logging
from neutron.plugins.hyperv.common import constants
LOG = logging.getLogger(__name__)
-class AgentNotifierApi(rpc_compat.RpcProxy):
+class AgentNotifierApi(n_rpc.RpcProxy):
'''Agent side of the openvswitch rpc API.
API version history:
from neutron.api.v2 import attributes
from neutron.common import exceptions as n_exc
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.db import agents_db
from neutron.db import db_base_plugin_v2
# RPC support
self.service_topics = {svc_constants.CORE: topics.PLUGIN,
svc_constants.L3_ROUTER_NAT: topics.L3PLUGIN}
- self.conn = rpc_compat.create_connection(new=True)
+ self.conn = n_rpc.create_connection(new=True)
self.notifier = agent_notifier_api.AgentNotifierApi(
topics.AGENT)
self.endpoints = [rpc_callbacks.HyperVRpcCallbacks(self.notifier),
# @author: Alessandro Pilotti, Cloudbase Solutions Srl
from neutron.common import constants as q_const
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.db import dhcp_rpc_base
from neutron.db import l3_rpc_base
from neutron.openstack.common import log as logging
class HyperVRpcCallbacks(
- rpc_compat.RpcCallback,
+ n_rpc.RpcCallback,
dhcp_rpc_base.DhcpRpcCallbackMixin,
l3_rpc_base.L3RpcCallbackMixin):
from neutron.agent import rpc as agent_rpc
from neutron.common import config as common_config
from neutron.common import constants as n_const
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.common import utils as n_utils
from neutron import context
topic=self.topic)
-class SdnveNeutronAgent(rpc_compat.RpcCallback):
+class SdnveNeutronAgent(n_rpc.RpcCallback):
RPC_API_VERSION = '1.1'
from neutron.common import constants as n_const
from neutron.common import exceptions as n_exc
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.db import agents_db
from neutron.db import db_base_plugin_v2
return info
-class AgentNotifierApi(rpc_compat.RpcProxy):
+class AgentNotifierApi(n_rpc.RpcProxy):
'''Agent side of the SDN-VE rpc API.'''
BASE_RPC_API_VERSION = '1.0'
def setup_rpc(self):
# RPC support
self.topic = topics.PLUGIN
- self.conn = rpc_compat.create_connection(new=True)
+ self.conn = n_rpc.create_connection(new=True)
self.notifier = AgentNotifierApi(topics.AGENT)
self.endpoints = [SdnveRpcCallbacks(self.notifier),
agents_db.AgentExtRpcCallback()]
from neutron.common import config as common_config
from neutron.common import constants
from neutron.common import exceptions
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.common import utils as q_utils
from neutron import context
self.remove_fdb_bridge_entry(mac, agent_ip, interface)
-class LinuxBridgeRpcCallbacks(rpc_compat.RpcCallback,
+class LinuxBridgeRpcCallbacks(n_rpc.RpcCallback,
sg_rpc.SecurityGroupAgentRpcCallbackMixin,
l2pop_rpc.L2populationRpcCallBackMixin):
from neutron.api.v2 import attributes
from neutron.common import constants as q_const
from neutron.common import exceptions as n_exc
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.common import utils
from neutron.db import agents_db
LOG = logging.getLogger(__name__)
-class LinuxBridgeRpcCallbacks(rpc_compat.RpcCallback,
+class LinuxBridgeRpcCallbacks(n_rpc.RpcCallback,
dhcp_rpc_base.DhcpRpcCallbackMixin,
l3_rpc_base.L3RpcCallbackMixin,
sg_db_rpc.SecurityGroupServerRpcCallbackMixin
LOG.debug(_("%s can not be found in database"), device)
-class AgentNotifierApi(rpc_compat.RpcProxy,
+class AgentNotifierApi(n_rpc.RpcProxy,
sg_rpc.SecurityGroupAgentRpcApiMixin):
'''Agent side of the linux bridge rpc API.
# RPC support
self.service_topics = {svc_constants.CORE: topics.PLUGIN,
svc_constants.L3_ROUTER_NAT: topics.L3PLUGIN}
- self.conn = rpc_compat.create_connection(new=True)
+ self.conn = n_rpc.create_connection(new=True)
self.endpoints = [LinuxBridgeRpcCallbacks(),
agents_db.AgentExtRpcCallback()]
for svc_topic in self.service_topics.values():
from neutron.api.v2 import attributes
from neutron.common import constants
from neutron.common import exceptions as n_exc
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.db import agents_db
from neutron.db import agentschedulers_db
raise MidonetPluginException(msg=exc)
-class MidoRpcCallbacks(rpc_compat.RpcCallback,
+class MidoRpcCallbacks(n_rpc.RpcCallback,
dhcp_rpc_base.DhcpRpcCallbackMixin):
RPC_API_VERSION = '1.1'
def setup_rpc(self):
# RPC support
self.topic = topics.PLUGIN
- self.conn = rpc_compat.create_connection(new=True)
+ self.conn = n_rpc.create_connection(new=True)
self.endpoints = [MidoRpcCallbacks(),
agents_db.AgentExtRpcCallback()]
self.conn.create_consumer(self.topic, self.endpoints,
# @author: Francois Eleouet, Orange
# @author: Mathieu Rohon, Orange
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
-class L2populationAgentNotifyAPI(rpc_compat.RpcProxy):
+class L2populationAgentNotifyAPI(n_rpc.RpcProxy):
BASE_RPC_API_VERSION = '1.0'
def __init__(self, topic=topics.AGENT):
from neutron.api.v2 import attributes
from neutron.common import constants as const
from neutron.common import exceptions as exc
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.db import agents_db
from neutron.db import agentschedulers_db
self.endpoints = [rpc.RpcCallbacks(self.notifier, self.type_manager),
agents_db.AgentExtRpcCallback()]
self.topic = topics.PLUGIN
- self.conn = rpc_compat.create_connection(new=True)
+ self.conn = n_rpc.create_connection(new=True)
self.conn.create_consumer(self.topic, self.endpoints,
fanout=False)
return self.conn.consume_in_threads()
from neutron.agent import securitygroups_rpc as sg_rpc
from neutron.common import constants as q_const
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.db import api as db_api
from neutron.db import dhcp_rpc_base
# 1.0 Initial version (from openvswitch/linuxbridge)
# 1.1 Support Security Group RPC
- # FIXME(ihrachys): we can't use rpc_compat.RpcCallback here due to
+ # FIXME(ihrachys): we can't use n_rpc.RpcCallback here due to
# inheritance problems
target = messaging.Target(version=RPC_API_VERSION)
q_const.PORT_STATUS_ACTIVE)
-class AgentNotifierApi(rpc_compat.RpcProxy,
+class AgentNotifierApi(n_rpc.RpcProxy,
sg_rpc.SecurityGroupAgentRpcApiMixin,
type_tunnel.TunnelAgentRpcApiMixin):
"""Agent side of the openvswitch rpc API.
from neutron.agent import securitygroups_rpc as sg_rpc
from neutron.common import config as common_config
from neutron.common import constants as q_constants
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.common import utils as q_utils
from neutron import context
self.network_map[network_id] = data
-class MlnxEswitchRpcCallbacks(rpc_compat.RpcCallback,
+class MlnxEswitchRpcCallbacks(n_rpc.RpcCallback,
sg_rpc.SecurityGroupAgentRpcCallbackMixin):
# Set RPC API version to 1.0 by default.
port['mac_address'],
self.agent.agent_id,
cfg.CONF.host)
- except rpc_compat.MessagingTimeout:
+ except n_rpc.MessagingTimeout:
LOG.error(_("RPC timeout while updating port %s"), port['id'])
else:
LOG.debug(_("No port %s defined on agent."), port['id'])
from oslo.config import cfg
from neutron.agent import securitygroups_rpc as sg_rpc
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
-class AgentNotifierApi(rpc_compat.RpcProxy,
+class AgentNotifierApi(n_rpc.RpcProxy,
sg_rpc.SecurityGroupAgentRpcApiMixin):
"""Agent side of the Embedded Switch RPC API.
from neutron.api.v2 import attributes
from neutron.common import constants as q_const
from neutron.common import exceptions as n_exc
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.common import utils
from neutron.db import agents_db
# RPC support
self.service_topics = {svc_constants.CORE: topics.PLUGIN,
svc_constants.L3_ROUTER_NAT: topics.L3PLUGIN}
- self.conn = rpc_compat.create_connection(new=True)
+ self.conn = n_rpc.create_connection(new=True)
self.endpoints = [rpc_callbacks.MlnxRpcCallbacks(),
agents_db.AgentExtRpcCallback()]
for svc_topic in self.service_topics.values():
from oslo.config import cfg
from neutron.common import constants as q_const
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.db import api as db_api
from neutron.db import dhcp_rpc_base
from neutron.db import l3_rpc_base
LOG = logging.getLogger(__name__)
-class MlnxRpcCallbacks(rpc_compat.RpcCallback,
+class MlnxRpcCallbacks(n_rpc.RpcCallback,
dhcp_rpc_base.DhcpRpcCallbackMixin,
l3_rpc_base.L3RpcCallbackMixin,
sg_db_rpc.SecurityGroupServerRpcCallbackMixin):
from neutron.agent import securitygroups_rpc as sg_rpc
from neutron.common import config as common_config
from neutron.common import constants as q_const
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron import context as q_context
from neutron.extensions import securitygroup as ext_sg
port_removed=port_removed))
-class NECAgentRpcCallback(rpc_compat.RpcCallback):
+class NECAgentRpcCallback(n_rpc.RpcCallback):
RPC_API_VERSION = '1.0'
self.sg_agent.refresh_firewall()
-class SecurityGroupServerRpcApi(rpc_compat.RpcProxy,
+class SecurityGroupServerRpcApi(n_rpc.RpcProxy,
sg_rpc.SecurityGroupServerRpcApiMixin):
def __init__(self, topic):
class SecurityGroupAgentRpcCallback(
- rpc_compat.RpcCallback,
+ n_rpc.RpcCallback,
sg_rpc.SecurityGroupAgentRpcCallbackMixin):
RPC_API_VERSION = sg_rpc.SG_RPC_VERSION
from neutron.api.v2 import attributes as attrs
from neutron.common import constants as const
from neutron.common import exceptions as n_exc
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.db import agents_db
from neutron.db import agentschedulers_db
def setup_rpc(self):
self.service_topics = {svc_constants.CORE: topics.PLUGIN,
svc_constants.L3_ROUTER_NAT: topics.L3PLUGIN}
- self.conn = rpc_compat.create_connection(new=True)
+ 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.notify_security_groups_member_updated(context, port)
-class NECPluginV2AgentNotifierApi(rpc_compat.RpcProxy,
+class NECPluginV2AgentNotifierApi(n_rpc.RpcProxy,
sg_rpc.SecurityGroupAgentRpcApiMixin):
'''RPC API for NEC plugin agent.'''
topic=self.topic_port_update)
-class DhcpRpcCallback(rpc_compat.RpcCallback,
+class DhcpRpcCallback(n_rpc.RpcCallback,
dhcp_rpc_base.DhcpRpcCallbackMixin):
# DhcpPluginApi BASE_RPC_API_VERSION
RPC_API_VERSION = '1.1'
-class L3RpcCallback(rpc_compat.RpcCallback, l3_rpc_base.L3RpcCallbackMixin):
+class L3RpcCallback(n_rpc.RpcCallback, l3_rpc_base.L3RpcCallbackMixin):
# 1.0 L3PluginApi BASE_RPC_API_VERSION
# 1.1 Support update_floatingip_statuses
RPC_API_VERSION = '1.1'
class SecurityGroupServerRpcCallback(
- rpc_compat.RpcCallback,
+ n_rpc.RpcCallback,
sg_db_rpc.SecurityGroupServerRpcCallbackMixin):
RPC_API_VERSION = sg_rpc.SG_RPC_VERSION
return port
-class NECPluginV2RPCCallbacks(rpc_compat.RpcCallback):
+class NECPluginV2RPCCallbacks(n_rpc.RpcCallback):
RPC_API_VERSION = '1.0'
from neutron.agent import rpc as agent_rpc
from neutron.agent import securitygroups_rpc as sg_rpc
from neutron.common import constants as n_const
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.common import utils as n_utils
from neutron import context
agent.daemon_loop()
-class OFANeutronAgent(rpc_compat.RpcCallback,
+class OFANeutronAgent(n_rpc.RpcCallback,
sg_rpc.SecurityGroupAgentRpcCallbackMixin):
"""A agent for OpenFlow Agent ML2 mechanism driver.
from neutron.agent import rpc as agent_rpc
from neutron.agent import securitygroups_rpc as sg_rpc
from neutron.common import config as common_config
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron import context as n_context
from neutron.extensions import securitygroup as ext_sg
LOG = logging.getLogger(__name__)
-class NVSDAgentRpcCallback(rpc_compat.RpcCallback):
+class NVSDAgentRpcCallback(n_rpc.RpcCallback):
RPC_API_VERSION = '1.0'
self.sg_agent.refresh_firewall()
-class SecurityGroupServerRpcApi(rpc_compat.RpcProxy,
+class SecurityGroupServerRpcApi(n_rpc.RpcProxy,
sg_rpc.SecurityGroupServerRpcApiMixin):
def __init__(self, topic):
super(SecurityGroupServerRpcApi, self).__init__(
class SecurityGroupAgentRpcCallback(
- rpc_compat.RpcCallback,
+ n_rpc.RpcCallback,
sg_rpc.SecurityGroupAgentRpcCallbackMixin):
RPC_API_VERSION = sg_rpc.SG_RPC_VERSION
self.init_firewall()
-class NVSDNeutronAgent(rpc_compat.RpcCallback):
+class NVSDNeutronAgent(n_rpc.RpcCallback):
# history
# 1.0 Initial version
# 1.1 Support Security Group RPC
from neutron.api.rpc.agentnotifiers import l3_rpc_agent_api
from neutron.common import constants as q_const
from neutron.common import exceptions as nexception
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.db import agents_db
from neutron.db import agentschedulers_db
IPv6 = 6
-class NVSDPluginRpcCallbacks(rpc_compat.RpcCallback,
+class NVSDPluginRpcCallbacks(n_rpc.RpcCallback,
dhcp_rpc_base.DhcpRpcCallbackMixin,
l3_rpc_base.L3RpcCallbackMixin,
sg_db_rpc.SecurityGroupServerRpcCallbackMixin):
return port
-class NVSDPluginV2AgentNotifierApi(rpc_compat.RpcProxy,
+class NVSDPluginV2AgentNotifierApi(n_rpc.RpcProxy,
sg_rpc.SecurityGroupAgentRpcApiMixin):
BASE_RPC_API_VERSION = '1.0'
# RPC support
self.service_topics = {svc_constants.CORE: topics.PLUGIN,
svc_constants.L3_ROUTER_NAT: topics.L3PLUGIN}
- self.conn = rpc_compat.create_connection(new=True)
+ 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()
from neutron.agent import securitygroups_rpc as sg_rpc
from neutron.common import config as common_config
from neutron.common import constants as q_const
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.common import utils as q_utils
from neutron import context
self.init_firewall(defer_refresh_firewall=True)
-class OVSNeutronAgent(rpc_compat.RpcCallback,
+class OVSNeutronAgent(n_rpc.RpcCallback,
sg_rpc.SecurityGroupAgentRpcCallbackMixin,
l2population_rpc.L2populationRpcCallBackMixin):
'''Implements OVS-based tunneling, VLANs and flat networks.
from neutron.api.v2 import attributes
from neutron.common import constants as q_const
from neutron.common import exceptions as n_exc
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.common import utils
from neutron.db import agents_db
LOG = logging.getLogger(__name__)
-class OVSRpcCallbacks(rpc_compat.RpcCallback,
+class OVSRpcCallbacks(n_rpc.RpcCallback,
dhcp_rpc_base.DhcpRpcCallbackMixin,
l3_rpc_base.L3RpcCallbackMixin,
sg_db_rpc.SecurityGroupServerRpcCallbackMixin):
return entry
-class AgentNotifierApi(rpc_compat.RpcProxy,
+class AgentNotifierApi(n_rpc.RpcProxy,
sg_rpc.SecurityGroupAgentRpcApiMixin):
'''Agent side of the openvswitch rpc API.
# RPC support
self.service_topics = {svc_constants.CORE: topics.PLUGIN,
svc_constants.L3_ROUTER_NAT: topics.L3PLUGIN}
- self.conn = rpc_compat.create_connection(new=True)
+ self.conn = n_rpc.create_connection(new=True)
self.notifier = AgentNotifierApi(topics.AGENT)
self.agent_notifiers[q_const.AGENT_TYPE_DHCP] = (
dhcp_rpc_agent_api.DhcpAgentNotifyAPI()
from neutron.agent import securitygroups_rpc as sg_rpc
from neutron.common import config as common_config
from neutron.common import exceptions as n_exc
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron import context as q_context
from neutron.extensions import securitygroup as ext_sg
self.init_firewall()
-class OVSNeutronOFPRyuAgent(rpc_compat.RpcCallback,
+class OVSNeutronOFPRyuAgent(n_rpc.RpcCallback,
sg_rpc.SecurityGroupAgentRpcCallbackMixin):
RPC_API_VERSION = '1.1'
from neutron.agent import securitygroups_rpc as sg_rpc
from neutron.common import constants as q_const
from neutron.common import exceptions as n_exc
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.db import api as db
from neutron.db import db_base_plugin_v2
LOG = logging.getLogger(__name__)
-class RyuRpcCallbacks(rpc_compat.RpcCallback,
+class RyuRpcCallbacks(n_rpc.RpcCallback,
dhcp_rpc_base.DhcpRpcCallbackMixin,
l3_rpc_base.L3RpcCallbackMixin,
sg_db_rpc.SecurityGroupServerRpcCallbackMixin):
return port
-class AgentNotifierApi(rpc_compat.RpcProxy,
+class AgentNotifierApi(n_rpc.RpcProxy,
sg_rpc.SecurityGroupAgentRpcApiMixin):
BASE_RPC_API_VERSION = '1.0'
def _setup_rpc(self):
self.service_topics = {svc_constants.CORE: topics.PLUGIN,
svc_constants.L3_ROUTER_NAT: topics.L3PLUGIN}
- self.conn = rpc_compat.create_connection(new=True)
+ self.conn = n_rpc.create_connection(new=True)
self.notifier = AgentNotifierApi(topics.AGENT)
self.endpoints = [RyuRpcCallbacks(self.ofp_api_host)]
for svc_topic in self.service_topics.values():
from neutron.api.v2 import attributes
from neutron.common import constants as const
from neutron.common import exceptions as ntn_exc
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.db import db_base_plugin_v2
from neutron.db import dhcp_rpc_base
from neutron.db import l3_db
METADATA_DHCP_ROUTE = '169.254.169.254/32'
-class NSXRpcCallbacks(rpc_compat.RpcCallback,
+class NSXRpcCallbacks(n_rpc.RpcCallback,
dhcp_rpc_base.DhcpRpcCallbackMixin):
RPC_API_VERSION = '1.1'
from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api
from neutron.common import constants as const
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.db import agents_db
from neutron.openstack.common import importutils
def _setup_rpc_dhcp_metadata(self, notifier=None):
self.topic = topics.PLUGIN
- self.conn = rpc_compat.create_connection(new=True)
+ self.conn = n_rpc.create_connection(new=True)
self.endpoints = [nsx_rpc.NSXRpcCallbacks(),
agents_db.AgentExtRpcCallback()]
self.conn.create_consumer(self.topic, self.endpoints, fanout=False)
from oslo.messaging import server as rpc_server
from neutron.common import config
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron import context
from neutron.db import api as session
from neutron import manager
return server
-class Service(rpc_compat.Service):
+class Service(n_rpc.Service):
"""Service object for binaries running on hosts.
A service takes a manager and enables rpc by listening to queues based
from oslo.config import cfg
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
cfg.CONF.register_opts(FWaaSOpts, 'fwaas')
-class FWaaSPluginApiMixin(rpc_compat.RpcProxy):
+class FWaaSPluginApiMixin(n_rpc.RpcProxy):
"""Agent side of the FWaaS agent to FWaaS Plugin RPC API."""
RPC_API_VERSION = '1.0'
from oslo.config import cfg
from neutron.common import exceptions as n_exception
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron import context as neutron_context
from neutron.db import api as qdbapi
LOG = logging.getLogger(__name__)
-class FirewallCallbacks(rpc_compat.RpcCallback):
+class FirewallCallbacks(n_rpc.RpcCallback):
RPC_API_VERSION = '1.0'
def __init__(self, plugin):
return fw_tenant_list
-class FirewallAgentApi(rpc_compat.RpcProxy):
+class FirewallAgentApi(n_rpc.RpcProxy):
"""Plugin side of plugin to agent RPC API."""
API_VERSION = '1.0'
self.endpoints = [FirewallCallbacks(self)]
- self.conn = rpc_compat.create_connection(new=True)
+ self.conn = n_rpc.create_connection(new=True)
self.conn.create_consumer(
topics.FIREWALL_PLUGIN, self.endpoints, fanout=False)
self.conn.consume_in_threads()
from neutron.api.rpc.agentnotifiers import l3_rpc_agent_api
from neutron.common import constants as q_const
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.db import api as qdbapi
from neutron.db import db_base_plugin_v2
from neutron.plugins.common import constants
-class L3RouterPluginRpcCallbacks(rpc_compat.RpcCallback,
+class L3RouterPluginRpcCallbacks(n_rpc.RpcCallback,
l3_rpc_base.L3RpcCallbackMixin):
RPC_API_VERSION = '1.1'
def setup_rpc(self):
# RPC support
self.topic = topics.L3PLUGIN
- self.conn = rpc_compat.create_connection(new=True)
+ self.conn = n_rpc.create_connection(new=True)
self.agent_notifiers.update(
{q_const.AGENT_TYPE_L3: l3_rpc_agent_api.L3AgentNotifyAPI()})
self.endpoints = [L3RouterPluginRpcCallbacks()]
from neutron.agent.common import config
from neutron.agent.linux import interface
from neutron.common import config as common_config
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.openstack.common import service
from neutron.services.loadbalancer.agent import agent_manager as manager
]
-class LbaasAgentService(rpc_compat.Service):
+class LbaasAgentService(n_rpc.Service):
def start(self):
super(LbaasAgentService, self).start()
self.tg.add_timer(
#
# @author: Mark McClain, DreamHost
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
-class LbaasAgentApi(rpc_compat.RpcProxy):
+class LbaasAgentApi(n_rpc.RpcProxy):
"""Agent side of the Agent to Plugin RPC API."""
API_VERSION = '2.0'
from neutron.agent import rpc as agent_rpc
from neutron.common import constants as n_const
from neutron.common import exceptions as n_exc
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron import context
from neutron.openstack.common import importutils
msg = _('Unknown device with pool_id %(pool_id)s')
-class LbaasAgentManager(rpc_compat.RpcCallback, periodic_task.PeriodicTasks):
+class LbaasAgentManager(n_rpc.RpcCallback, periodic_task.PeriodicTasks):
RPC_API_VERSION = '2.0'
# history
from neutron.common import constants as q_const
from neutron.common import exceptions as n_exc
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.db import agents_db
from neutron.db.loadbalancer import loadbalancer_db
"in plugin driver.")
-class LoadBalancerCallbacks(rpc_compat.RpcCallback):
+class LoadBalancerCallbacks(n_rpc.RpcCallback):
RPC_API_VERSION = '2.0'
# history
self.plugin.update_pool_stats(context, pool_id, data=stats)
-class LoadBalancerAgentApi(rpc_compat.RpcProxy):
+class LoadBalancerAgentApi(n_rpc.RpcProxy):
"""Plugin side of plugin to agent RPC API."""
BASE_RPC_API_VERSION = '2.0'
LoadBalancerCallbacks(self.plugin),
agents_db.AgentExtRpcCallback(self.plugin)
]
- self.plugin.conn = rpc_compat.create_connection(new=True)
+ self.plugin.conn = n_rpc.create_connection(new=True)
self.plugin.conn.create_consumer(
topics.LOADBALANCER_PLUGIN,
self.plugin.agent_endpoints,
from neutron.common import config as common_config
from neutron.common import constants as constants
from neutron.common import rpc as n_rpc
-from neutron.common import rpc_compat
from neutron.common import topics
from neutron.common import utils
from neutron import context
LOG = logging.getLogger(__name__)
-class MeteringPluginRpc(rpc_compat.RpcProxy):
+class MeteringPluginRpc(n_rpc.RpcProxy):
BASE_RPC_API_VERSION = '1.0'
# under the License.
from neutron.api.rpc.agentnotifiers import metering_rpc_agent_api
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.db.metering import metering_db
from neutron.db.metering import metering_rpc
self.endpoints = [metering_rpc.MeteringRpcCallbacks(self)]
- self.conn = rpc_compat.create_connection(new=True)
+ self.conn = n_rpc.create_connection(new=True)
self.conn.create_consumer(
topics.METERING_PLUGIN, self.endpoints, fanout=False)
self.conn.consume_in_threads()
import six
from neutron.common import exceptions
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron import context as ctx
from neutron.openstack.common import lockutils
from neutron.openstack.common import log as logging
return csrs_found
-class CiscoCsrIPsecVpnDriverApi(rpc_compat.RpcProxy):
+class CiscoCsrIPsecVpnDriverApi(n_rpc.RpcProxy):
"""RPC API for agent to plugin messaging."""
def get_vpn_services_on_host(self, context, host):
def __init__(self, agent, host):
self.host = host
- self.conn = rpc_compat.create_connection(new=True)
+ self.conn = n_rpc.create_connection(new=True)
context = ctx.get_admin_context_without_session()
node_topic = '%s.%s' % (topics.CISCO_IPSEC_AGENT_TOPIC, self.host)
from neutron.agent.linux import ip_lib
from neutron.agent.linux import utils
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron import context
from neutron.openstack.common import lockutils
from neutron.openstack.common import log as logging
self.connection_status = {}
-class IPsecVpnDriverApi(rpc_compat.RpcProxy):
+class IPsecVpnDriverApi(n_rpc.RpcProxy):
"""IPSecVpnDriver RPC api."""
IPSEC_PLUGIN_VERSION = '1.0'
self.conf = self.agent.conf
self.root_helper = self.agent.root_helper
self.host = host
- self.conn = rpc_compat.create_connection(new=True)
+ self.conn = n_rpc.create_connection(new=True)
self.context = context.get_admin_context_without_session()
self.topic = topics.IPSEC_AGENT_TOPIC
node_topic = '%s.%s' % (self.topic, self.host)
import six
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron import manager
from neutron.openstack.common import log as logging
from neutron.plugins.common import constants
pass
-class BaseIPsecVpnAgentApi(rpc_compat.RpcProxy):
+class BaseIPsecVpnAgentApi(n_rpc.RpcProxy):
"""Base class for IPSec API to agent."""
def __init__(self, to_agent_topic, topic, default_version):
from netaddr import core as net_exc
from neutron.common import exceptions
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.openstack.common import excutils
from neutron.openstack.common import log as logging
from neutron.plugins.common import constants
"with value '%(value)s'")
-class CiscoCsrIPsecVpnDriverCallBack(rpc_compat.RpcCallback):
+class CiscoCsrIPsecVpnDriverCallBack(n_rpc.RpcCallback):
"""Handler for agent to plugin RPC messaging."""
class CiscoCsrIPsecVpnAgentApi(service_drivers.BaseIPsecVpnAgentApi,
- rpc_compat.RpcCallback):
+ n_rpc.RpcCallback):
"""API and handler for Cisco IPSec plugin to agent RPC messaging."""
def __init__(self, service_plugin):
super(CiscoCsrIPsecVPNDriver, self).__init__(service_plugin)
self.endpoints = [CiscoCsrIPsecVpnDriverCallBack(self)]
- self.conn = rpc_compat.create_connection(new=True)
+ self.conn = n_rpc.create_connection(new=True)
self.conn.create_consumer(
topics.CISCO_IPSEC_DRIVER_TOPIC, self.endpoints, fanout=False)
self.conn.consume_in_threads()
# under the License.
import netaddr
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.openstack.common import log as logging
from neutron.services.vpn.common import topics
from neutron.services.vpn import service_drivers
BASE_IPSEC_VERSION = '1.0'
-class IPsecVpnDriverCallBack(rpc_compat.RpcCallback):
+class IPsecVpnDriverCallBack(n_rpc.RpcCallback):
"""Callback for IPSecVpnDriver rpc."""
# history
class IPsecVpnAgentApi(service_drivers.BaseIPsecVpnAgentApi,
- rpc_compat.RpcCallback):
+ n_rpc.RpcCallback):
"""Agent RPC API for IPsecVPNAgent."""
RPC_API_VERSION = BASE_IPSEC_VERSION
def __init__(self, service_plugin):
super(IPsecVPNDriver, self).__init__(service_plugin)
self.endpoints = [IPsecVpnDriverCallBack(self)]
- self.conn = rpc_compat.create_connection(new=True)
+ self.conn = n_rpc.create_connection(new=True)
self.conn.create_consumer(
topics.IPSEC_DRIVER_TOPIC, self.endpoints, fanout=False)
self.conn.consume_in_threads()
# don't actually start RPC listeners when testing
self.useFixture(fixtures.MonkeyPatch(
- 'neutron.common.rpc_compat.Connection.consume_in_threads',
+ 'neutron.common.rpc.Connection.consume_in_threads',
fake_consume_in_threads))
self.useFixture(fixtures.MonkeyPatch(
import mock
from neutron.agent import rpc as agent_rpc
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.openstack.common import context
from neutron.plugins.hyperv import agent_notifier_api as ana
if rpc_method == 'cast' and method == 'run_instance':
kwargs['call'] = False
- proxy = rpc_compat.RpcProxy
+ proxy = n_rpc.RpcProxy
with mock.patch.object(proxy, rpc_method) as rpc_method_mock:
rpc_method_mock.return_value = expected_retval
retval = getattr(rpcapi, method)(ctxt, **kwargs)
return expected_retval
self.useFixture(fixtures.MonkeyPatch(
- 'neutron.common.rpc_compat.RpcProxy.' + rpc_method,
+ 'neutron.common.rpc.RpcProxy.' + rpc_method,
_fake_rpc_method))
retval = getattr(rpcapi, method)(ctxt, **kwargs)
self.fanout_topic = topics.get_topic_name(topics.AGENT,
topics.L2POPULATION,
topics.UPDATE)
- fanout = ('neutron.common.rpc_compat.RpcProxy.fanout_cast')
+ fanout = ('neutron.common.rpc.RpcProxy.fanout_cast')
fanout_patch = mock.patch(fanout)
self.mock_fanout = fanout_patch.start()
- cast = ('neutron.common.rpc_compat.RpcProxy.cast')
+ cast = ('neutron.common.rpc.RpcProxy.cast')
cast_patch = mock.patch(cast)
self.mock_cast = cast_patch.start()
import mock
from neutron.agent import rpc as agent_rpc
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.openstack.common import context
from neutron.plugins.ml2.drivers import type_tunnel
if rpc_method == 'cast' and method == 'run_instance':
kwargs['call'] = False
- rpc = rpc_compat.RpcProxy
+ rpc = n_rpc.RpcProxy
with mock.patch.object(rpc, rpc_method) as rpc_method_mock:
rpc_method_mock.return_value = expected_retval
retval = getattr(rpcapi, method)(ctxt, **kwargs)
return expected_retval
self.useFixture(fixtures.MonkeyPatch(
- 'neutron.common.rpc_compat.RpcProxy.' + rpc_method,
+ 'neutron.common.rpc.RpcProxy.' + rpc_method,
_fake_rpc_method))
retval = getattr(rpcapi, method)(ctxt, **kwargs)
return expected_retval
self.useFixture(fixtures.MonkeyPatch(
- 'neutron.common.rpc_compat.RpcProxy.' + rpc_method,
+ 'neutron.common.rpc.RpcProxy.' + rpc_method,
_fake_rpc_method))
retval = getattr(rpcapi, method)(ctxt, **kwargs)
class TestLbaasService(base.BaseTestCase):
def test_start(self):
with mock.patch.object(
- agent.rpc_compat.Service, 'start'
+ agent.n_rpc.Service, 'start'
) as mock_start:
mgr = mock.Mock()
self.uuid_patch = mock.patch(uuid, return_value=self.uuid)
self.mock_uuid = self.uuid_patch.start()
- fanout = ('neutron.common.rpc_compat.RpcProxy.fanout_cast')
+ fanout = ('neutron.common.rpc.RpcProxy.fanout_cast')
self.fanout_patch = mock.patch(fanout)
self.mock_fanout = self.fanout_patch.start()
self.uuid_patch = mock.patch(uuid, return_value=self.uuid)
self.mock_uuid = self.uuid_patch.start()
- cast = 'neutron.common.rpc_compat.RpcProxy.cast'
+ cast = 'neutron.common.rpc.RpcProxy.cast'
self.cast_patch = mock.patch(cast)
self.mock_cast = self.cast_patch.start()
def setUp(self):
super(TestCiscoCsrIPsecDeviceDriverSyncStatuses, self).setUp()
- for klass in ['neutron.common.rpc_compat.create_connection',
+ for klass in ['neutron.common.rpc.create_connection',
'neutron.context.get_admin_context_without_session',
'neutron.openstack.common.'
'loopingcall.FixedIntervalLoopingCall']:
'os.makedirs',
'os.path.isdir',
'neutron.agent.linux.utils.replace_file',
- 'neutron.common.rpc_compat.create_connection',
+ 'neutron.common.rpc.create_connection',
'neutron.services.vpn.device_drivers.ipsec.'
'OpenSwanProcess._gen_config_content',
'shutil.rmtree',
def setUp(self):
super(TestCiscoIPsecDriverValidation, self).setUp()
- mock.patch('neutron.common.rpc_compat.create_connection').start()
+ mock.patch('neutron.common.rpc.create_connection').start()
self.service_plugin = mock.Mock()
self.driver = ipsec_driver.CiscoCsrIPsecVPNDriver(self.service_plugin)
self.context = n_ctx.Context('some_user', 'some_tenant')
super(TestCiscoIPsecDriver, self).setUp()
dbapi.configure_db()
self.addCleanup(dbapi.clear_db)
- mock.patch('neutron.common.rpc_compat.create_connection').start()
+ mock.patch('neutron.common.rpc.create_connection').start()
l3_agent = mock.Mock()
l3_agent.host = FAKE_HOST
class TestIPsecDriver(base.BaseTestCase):
def setUp(self):
super(TestIPsecDriver, self).setUp()
- mock.patch('neutron.common.rpc_compat.create_connection').start()
+ mock.patch('neutron.common.rpc.create_connection').start()
l3_agent = mock.Mock()
l3_agent.host = FAKE_HOST
agent = rpc.PluginApi('fake_topic')
ctxt = context.RequestContext('fake_user', 'fake_project')
expect_val = 'foo'
- with mock.patch('neutron.common.rpc_compat.RpcProxy.call') as rpc_call:
+ with mock.patch('neutron.common.rpc.RpcProxy.call') as rpc_call:
rpc_call.return_value = expect_val
func_obj = getattr(agent, method)
if method == 'tunnel_sync':
mock.call().consume_in_threads()
]
- call_to_patch = 'neutron.common.rpc_compat.create_connection'
+ call_to_patch = 'neutron.common.rpc.create_connection'
with mock.patch(call_to_patch) as create_connection:
rpc.create_consumers(endpoints, 'foo', [('topic', 'op')])
create_connection.assert_has_calls(expected)
mock.call().consume_in_threads()
]
- call_to_patch = 'neutron.common.rpc_compat.create_connection'
+ call_to_patch = 'neutron.common.rpc.create_connection'
with mock.patch(call_to_patch) as create_connection:
rpc.create_consumers(endpoints, 'foo', [('topic', 'op', 'node1')])
create_connection.assert_has_calls(expected)
from neutron.common import config as common_config
from neutron.common import constants as const
from neutron.common import exceptions
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron.tests import base
def test_call_driver_remote_error_net_not_found(self):
self._test_call_driver_failure(
- exc=rpc_compat.RemoteError(exc_type='NetworkNotFound'),
+ exc=n_rpc.RemoteError(exc_type='NetworkNotFound'),
trace_level='warning')
def test_call_driver_network_not_found(self):
from neutron.agent import securitygroups_rpc as sg_rpc
from neutron.common import constants as const
from neutron.common import ipv6_utils as ipv6
-from neutron.common import rpc_compat
+from neutron.common import rpc as n_rpc
from neutron import context
from neutron.db import securitygroups_rpc_base as sg_db_rpc
from neutron.extensions import allowedaddresspairs as addr_pair
topic='fake_topic')])
-class FakeSGNotifierAPI(rpc_compat.RpcProxy,
+class FakeSGNotifierAPI(n_rpc.RpcProxy,
sg_rpc.SecurityGroupAgentRpcApiMixin):
pass