'''
+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.
+ '''
+
+
# exceptions
RPCException = rpc_common.RPCException
RemoteError = rpc_common.RemoteError
import sqlalchemy as sa
from sqlalchemy.orm import exc
+from neutron.common import rpc_compat
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(object):
+class AgentExtRpcCallback(rpc_compat.RpcCallback):
"""Processes the rpc report in plugin implementations."""
RPC_API_VERSION = '1.0'
START_TIME = timeutils.utcnow()
def __init__(self, plugin=None):
+ super(AgentExtRpcCallback, self).__init__()
self.plugin = plugin
def report_state(self, context, **kwargs):
from oslo.config import cfg
+from neutron.common import rpc_compat
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(periodic_task.PeriodicTasks):
+class Manager(rpc_compat.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 topics
from neutron import context as q_context
from neutron.extensions import securitygroup as ext_sg
self.init_firewall()
-class RestProxyAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin):
+class RestProxyAgent(rpc_compat.RpcCallback,
+ sg_rpc.SecurityGroupAgentRpcCallbackMixin):
RPC_API_VERSION = '1.1'
topic=self.topic_port_update)
-class RestProxyCallbacks(sg_rpc_base.SecurityGroupServerRpcCallbackMixin,
+class RestProxyCallbacks(rpc_compat.RpcCallback,
+ sg_rpc_base.SecurityGroupServerRpcCallbackMixin,
dhcp_rpc_base.DhcpRpcCallbackMixin):
RPC_API_VERSION = '1.1'
cfg.CONF.register_opts(PHYSICAL_INTERFACE_OPTS, "PHYSICAL_INTERFACE")
-class BridgeRpcCallbacks(dhcp_rpc_base.DhcpRpcCallbackMixin,
+class BridgeRpcCallbacks(rpc_compat.RpcCallback,
+ dhcp_rpc_base.DhcpRpcCallbackMixin,
l3_rpc_base.L3RpcCallbackMixin,
sg_db_rpc.SecurityGroupServerRpcCallbackMixin):
"""Agent callback."""
from neutron.common import constants
from neutron.common import exceptions as n_exc
from neutron.common import rpc as q_rpc
+from neutron.common import rpc_compat
from neutron.common import topics
from neutron.common import utils
from neutron.db import agents_db
LOG = logging.getLogger(__name__)
-class N1kvRpcCallbacks(dhcp_rpc_base.DhcpRpcCallbackMixin,
+class N1kvRpcCallbacks(rpc_compat.RpcCallback,
+ dhcp_rpc_base.DhcpRpcCallbackMixin,
l3_rpc_base.L3RpcCallbackMixin):
"""Class to handle agent RPC calls."""
from neutron.agent import securitygroups_rpc as sg_rpc
from neutron.common import config as logging_config
from neutron.common import constants as n_const
+from neutron.common import rpc_compat
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(sg_rpc.SecurityGroupAgentRpcMixin):
+class HyperVSecurityAgent(rpc_compat.RpcCallback,
+ sg_rpc.SecurityGroupAgentRpcMixin):
# Set RPC API version to 1.1 by default.
RPC_API_VERSION = '1.1'
def __init__(self, context, plugin_rpc):
+ super(HyperVSecurityAgent, self).__init__()
self.context = context
self.plugin_rpc = plugin_rpc
return dispatcher.RpcDispatcher([rpc_callback])
-class HyperVSecurityCallbackMixin(sg_rpc.SecurityGroupAgentRpcCallbackMixin):
+class HyperVSecurityCallbackMixin(rpc_compat.RpcCallback,
+ sg_rpc.SecurityGroupAgentRpcCallbackMixin):
# Set RPC API version to 1.1 by default.
RPC_API_VERSION = '1.1'
def __init__(self, sg_agent):
+ super(HyperVSecurityCallbackMixin, self).__init__()
self.sg_agent = sg_agent
pass
-class HyperVNeutronAgent(object):
+class HyperVNeutronAgent(rpc_compat.RpcCallback):
# Set RPC API version to 1.0 by default.
RPC_API_VERSION = '1.0'
def __init__(self):
+ super(HyperVNeutronAgent, self).__init__()
self._utils = utilsfactory.get_hypervutils()
self._polling_interval = CONF.AGENT.polling_interval
self._load_physical_network_mappings()
from neutron.common import constants as q_const
from neutron.common import rpc as q_rpc
+from neutron.common import rpc_compat
from neutron.db import agents_db
from neutron.db import dhcp_rpc_base
from neutron.db import l3_rpc_base
class HyperVRpcCallbacks(
+ rpc_compat.RpcCallback,
dhcp_rpc_base.DhcpRpcCallbackMixin,
l3_rpc_base.L3RpcCallbackMixin):
RPC_API_VERSION = '1.1'
def __init__(self, notifier):
+ super(HyperVRpcCallbacks, self).__init__()
self.notifier = notifier
self._db = hyperv_db.HyperVPluginDB()
from neutron.agent import rpc as agent_rpc
from neutron.common import config as logging_config
from neutron.common import constants as n_const
+from neutron.common import rpc_compat
from neutron.common import topics
from neutron.common import utils as n_utils
from neutron import context
topic=self.topic)
-class SdnveNeutronAgent():
+class SdnveNeutronAgent(rpc_compat.RpcCallback):
RPC_API_VERSION = '1.1'
:param controller_ip: Ip address of SDN-VE controller.
'''
+ super(SdnveNeutronAgent, self).__init__()
self.root_helper = root_helper
self.int_bridge_name = integ_br
self.controller_ip = controller_ip
self.remove_fdb_bridge_entry(mac, agent_ip, interface)
-class LinuxBridgeRpcCallbacks(sg_rpc.SecurityGroupAgentRpcCallbackMixin,
+class LinuxBridgeRpcCallbacks(rpc_compat.RpcCallback,
+ sg_rpc.SecurityGroupAgentRpcCallbackMixin,
l2pop_rpc.L2populationRpcCallBackMixin):
# Set RPC API version to 1.0 by default.
RPC_API_VERSION = '1.1'
def __init__(self, context, agent):
+ super(LinuxBridgeRpcCallbacks, self).__init__()
self.context = context
self.agent = agent
self.sg_agent = agent
LOG = logging.getLogger(__name__)
-class LinuxBridgeRpcCallbacks(dhcp_rpc_base.DhcpRpcCallbackMixin,
+class LinuxBridgeRpcCallbacks(rpc_compat.RpcCallback,
+ dhcp_rpc_base.DhcpRpcCallbackMixin,
l3_rpc_base.L3RpcCallbackMixin,
sg_db_rpc.SecurityGroupServerRpcCallbackMixin
):
from neutron.common import constants
from neutron.common import exceptions as n_exc
from neutron.common import rpc as n_rpc
+from neutron.common import rpc_compat
from neutron.common import topics
from neutron.db import agents_db
from neutron.db import agentschedulers_db
raise MidonetPluginException(msg=exc)
-class MidoRpcCallbacks(dhcp_rpc_base.DhcpRpcCallbackMixin):
+class MidoRpcCallbacks(rpc_compat.RpcCallback,
+ dhcp_rpc_base.DhcpRpcCallbackMixin):
RPC_API_VERSION = '1.1'
def create_rpc_dispatcher(self):
# not having their own __init__ functions. If an __init__() is added
# to one, this could break. Fix this and add a unit test to cover this
# test in H3.
+ # FIXME(ihrachys): we can't use rpc_compat.RpcCallback here due
+ # to inheritance problems
super(RpcCallbacks, self).__init__(notifier, type_manager)
def create_rpc_dispatcher(self):
self.network_map[network_id] = data
-class MlnxEswitchRpcCallbacks(sg_rpc.SecurityGroupAgentRpcCallbackMixin):
+class MlnxEswitchRpcCallbacks(rpc_compat.RpcCallback,
+ sg_rpc.SecurityGroupAgentRpcCallbackMixin):
# Set RPC API version to 1.0 by default.
# history
RPC_API_VERSION = '1.1'
def __init__(self, context, agent):
+ super(MlnxEswitchRpcCallbacks, self).__init__()
self.context = context
self.agent = agent
self.eswitch = agent.eswitch
from neutron.common import constants as q_const
from neutron.common import rpc as q_rpc
+from neutron.common import rpc_compat
from neutron.db import agents_db
from neutron.db import api as db_api
from neutron.db import dhcp_rpc_base
LOG = logging.getLogger(__name__)
-class MlnxRpcCallbacks(dhcp_rpc_base.DhcpRpcCallbackMixin,
+class MlnxRpcCallbacks(rpc_compat.RpcCallback,
+ dhcp_rpc_base.DhcpRpcCallbackMixin,
l3_rpc_base.L3RpcCallbackMixin,
sg_db_rpc.SecurityGroupServerRpcCallbackMixin):
# History
#to be compatible with Linux Bridge Agent on Network Node
TAP_PREFIX_LEN = 3
- def __init__(self):
- pass
-
def create_rpc_dispatcher(self):
"""Get the rpc dispatcher for this manager.
port_removed=port_removed))
-class NECAgentRpcCallback(object):
+class NECAgentRpcCallback(rpc_compat.RpcCallback):
RPC_API_VERSION = '1.0'
def __init__(self, context, agent, sg_agent):
+ super(NECAgentRpcCallback, self).__init__()
self.context = context
self.agent = agent
self.sg_agent = sg_agent
class SecurityGroupAgentRpcCallback(
+ rpc_compat.RpcCallback,
sg_rpc.SecurityGroupAgentRpcCallbackMixin):
RPC_API_VERSION = sg_rpc.SG_RPC_VERSION
def __init__(self, context, sg_agent):
+ super(SecurityGroupAgentRpcCallback, self).__init__()
self.context = context
self.sg_agent = sg_agent
topic=self.topic_port_update)
-class DhcpRpcCallback(dhcp_rpc_base.DhcpRpcCallbackMixin):
+class DhcpRpcCallback(rpc_compat.RpcCallback,
+ dhcp_rpc_base.DhcpRpcCallbackMixin):
# DhcpPluginApi BASE_RPC_API_VERSION
RPC_API_VERSION = '1.1'
-class L3RpcCallback(l3_rpc_base.L3RpcCallbackMixin):
+class L3RpcCallback(rpc_compat.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,
sg_db_rpc.SecurityGroupServerRpcCallbackMixin):
RPC_API_VERSION = sg_rpc.SG_RPC_VERSION
return port
-class NECPluginV2RPCCallbacks(object):
+class NECPluginV2RPCCallbacks(rpc_compat.RpcCallback):
RPC_API_VERSION = '1.0'
def __init__(self, plugin):
+ super(NECPluginV2RPCCallbacks, self).__init__()
self.plugin = plugin
def create_rpc_dispatcher(self):
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 topics
from neutron.common import utils as n_utils
from neutron import context
agent.daemon_loop()
-class OFANeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin):
+class OFANeutronAgent(rpc_compat.RpcCallback,
+ sg_rpc.SecurityGroupAgentRpcCallbackMixin):
"""A agent for OpenFlow Agent ML2 mechanism driver.
OFANeutronAgent is a OpenFlow Agent agent for a ML2 plugin.
minimization, the number of seconds to wait before respawning
the ovsdb monitor.
"""
+ super(OFANeutronAgent, self).__init__()
self.ryuapp = ryuapp
self.veth_mtu = veth_mtu
self.root_helper = root_helper
LOG = logging.getLogger(__name__)
-class NVSDAgentRpcCallback(object):
+class NVSDAgentRpcCallback(rpc_compat.RpcCallback):
RPC_API_VERSION = '1.0'
def __init__(self, context, agent, sg_agent):
+ super(NVSDAgentRpcCallback, self).__init__()
self.context = context
self.agent = agent
self.sg_agent = sg_agent
class SecurityGroupAgentRpcCallback(
+ rpc_compat.RpcCallback,
sg_rpc.SecurityGroupAgentRpcCallbackMixin):
RPC_API_VERSION = sg_rpc.SG_RPC_VERSION
def __init__(self, context, sg_agent):
+ super(SecurityGroupAgentRpcCallback, self).__init__()
self.context = context
self.sg_agent = sg_agent
self.init_firewall()
-class NVSDNeutronAgent(object):
+class NVSDNeutronAgent(rpc_compat.RpcCallback):
# history
# 1.0 Initial version
# 1.1 Support Security Group RPC
RPC_API_VERSION = '1.1'
def __init__(self, integ_br, root_helper, polling_interval):
-
+ super(NVSDNeutronAgent, self).__init__()
self.int_br = ovs_lib.OVSBridge(integ_br, root_helper)
self.polling_interval = polling_interval
self.root_helper = root_helper
IPv6 = 6
-class NVSDPluginRpcCallbacks(dhcp_rpc_base.DhcpRpcCallbackMixin,
+class NVSDPluginRpcCallbacks(rpc_compat.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 logging_config
from neutron.common import constants as q_const
+from neutron.common import rpc_compat
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(sg_rpc.SecurityGroupAgentRpcCallbackMixin,
+class OVSNeutronAgent(rpc_compat.RpcCallback,
+ sg_rpc.SecurityGroupAgentRpcCallbackMixin,
l2population_rpc.L2populationRpcCallBackMixin):
'''Implements OVS-based tunneling, VLANs and flat networks.
:param arp_responder: Optional, enable local ARP responder if it is
supported.
'''
+ super(OVSNeutronAgent, self).__init__()
self.veth_mtu = veth_mtu
self.root_helper = root_helper
self.available_local_vlans = set(moves.xrange(q_const.MIN_VLAN_TAG,
LOG = logging.getLogger(__name__)
-class OVSRpcCallbacks(dhcp_rpc_base.DhcpRpcCallbackMixin,
+class OVSRpcCallbacks(rpc_compat.RpcCallback,
+ dhcp_rpc_base.DhcpRpcCallbackMixin,
l3_rpc_base.L3RpcCallbackMixin,
sg_db_rpc.SecurityGroupServerRpcCallbackMixin):
RPC_API_VERSION = '1.1'
def __init__(self, notifier, tunnel_type):
+ super(OVSRpcCallbacks, self).__init__()
self.notifier = notifier
self.tunnel_type = tunnel_type
from neutron.agent import securitygroups_rpc as sg_rpc
from neutron.common import config as logging_config
from neutron.common import exceptions as n_exc
+from neutron.common import rpc_compat
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(sg_rpc.SecurityGroupAgentRpcCallbackMixin):
+class OVSNeutronOFPRyuAgent(rpc_compat.RpcCallback,
+ sg_rpc.SecurityGroupAgentRpcCallbackMixin):
RPC_API_VERSION = '1.1'
LOG = logging.getLogger(__name__)
-class RyuRpcCallbacks(dhcp_rpc_base.DhcpRpcCallbackMixin,
+class RyuRpcCallbacks(rpc_compat.RpcCallback,
+ dhcp_rpc_base.DhcpRpcCallbackMixin,
l3_rpc_base.L3RpcCallbackMixin,
sg_db_rpc.SecurityGroupServerRpcCallbackMixin):
RPC_API_VERSION = '1.1'
def __init__(self, ofp_rest_api_addr):
+ super(RyuRpcCallbacks, self).__init__()
self.ofp_rest_api_addr = ofp_rest_api_addr
def create_rpc_dispatcher(self):
from neutron.common import constants as const
from neutron.common import exceptions as ntn_exc
from neutron.common import rpc as n_rpc
+from neutron.common import rpc_compat
from neutron.db import agents_db
from neutron.db import db_base_plugin_v2
from neutron.db import dhcp_rpc_base
METADATA_DHCP_ROUTE = '169.254.169.254/32'
-class NSXRpcCallbacks(dhcp_rpc_base.DhcpRpcCallbackMixin):
+class NSXRpcCallbacks(rpc_compat.RpcCallback,
+ dhcp_rpc_base.DhcpRpcCallbackMixin):
RPC_API_VERSION = '1.1'
LOG = logging.getLogger(__name__)
-class FirewallCallbacks(object):
+class FirewallCallbacks(rpc_compat.RpcCallback):
RPC_API_VERSION = '1.0'
def __init__(self, plugin):
+ super(FirewallCallbacks, self).__init__()
self.plugin = plugin
def create_rpc_dispatcher(self):
from neutron.api.rpc.agentnotifiers import l3_rpc_agent_api
from neutron.common import constants as q_const
from neutron.common import rpc as q_rpc
+from neutron.common import rpc_compat
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(l3_rpc_base.L3RpcCallbackMixin):
+class L3RouterPluginRpcCallbacks(rpc_compat.RpcCallback,
+ l3_rpc_base.L3RpcCallbackMixin):
RPC_API_VERSION = '1.1'
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 topics
from neutron import context
from neutron.openstack.common import importutils
msg = _('Unknown device with pool_id %(pool_id)s')
-class LbaasAgentManager(periodic_task.PeriodicTasks):
+class LbaasAgentManager(rpc_compat.RpcCallback, periodic_task.PeriodicTasks):
RPC_API_VERSION = '2.0'
# history
"in plugin driver.")
-class LoadBalancerCallbacks(object):
+class LoadBalancerCallbacks(rpc_compat.RpcCallback):
RPC_API_VERSION = '2.0'
# history
# - pool_deployed() and update_status() methods added;
def __init__(self, plugin):
+ super(LoadBalancerCallbacks, self).__init__()
self.plugin = plugin
def create_rpc_dispatcher(self):
RPC_API_VERSION = '1.0'
def __init__(self, agent, host):
+ # TODO(ihrachys): we can't use RpcCallback here due to
+ # inheritance issues
self.host = host
self.conn = rpc.create_connection(new=True)
context = ctx.get_admin_context_without_session()
RPC_API_VERSION = '1.0'
def __init__(self, agent, host):
+ # TODO(ihrachys): we can't use RpcCallback here due to
+ # inheritance issues
self.agent = agent
self.conf = self.agent.conf
self.root_helper = self.agent.root_helper
from neutron.common import exceptions
from neutron.common import rpc as n_rpc
+from neutron.common import rpc_compat
from neutron.openstack.common import excutils
from neutron.openstack.common import log as logging
from neutron.openstack.common import rpc
"with value '%(value)s'")
-class CiscoCsrIPsecVpnDriverCallBack(object):
+class CiscoCsrIPsecVpnDriverCallBack(rpc_compat.RpcCallback):
"""Handler for agent to plugin RPC messaging."""
RPC_API_VERSION = BASE_IPSEC_VERSION
def __init__(self, driver):
+ super(CiscoCsrIPsecVpnDriverCallBack, self).__init__()
self.driver = driver
def create_rpc_dispatcher(self):
plugin.update_status_by_agent(context, status)
-class CiscoCsrIPsecVpnAgentApi(service_drivers.BaseIPsecVpnAgentApi):
+class CiscoCsrIPsecVpnAgentApi(service_drivers.BaseIPsecVpnAgentApi,
+ rpc_compat.RpcCallback):
"""API and handler for Cisco IPSec plugin to agent RPC messaging."""
import netaddr
from neutron.common import rpc as n_rpc
+from neutron.common import rpc_compat
from neutron.openstack.common import log as logging
from neutron.openstack.common import rpc
from neutron.services.vpn.common import topics
BASE_IPSEC_VERSION = '1.0'
-class IPsecVpnDriverCallBack(object):
+class IPsecVpnDriverCallBack(rpc_compat.RpcCallback):
"""Callback for IPSecVpnDriver rpc."""
# history
RPC_API_VERSION = BASE_IPSEC_VERSION
def __init__(self, driver):
+ super(IPsecVpnDriverCallBack, self).__init__()
self.driver = driver
def create_rpc_dispatcher(self):
plugin.update_status_by_agent(context, status)
-class IPsecVpnAgentApi(service_drivers.BaseIPsecVpnAgentApi):
+class IPsecVpnAgentApi(service_drivers.BaseIPsecVpnAgentApi,
+ rpc_compat.RpcCallback):
"""Agent RPC API for IPsecVPNAgent."""
RPC_API_VERSION = BASE_IPSEC_VERSION