diff --git a/neutron/agent/l3_agent.py b/neutron/agent/l3_agent.py index 62c7d1155f..65300481e6 100644 --- a/neutron/agent/l3_agent.py +++ b/neutron/agent/l3_agent.py @@ -441,7 +441,7 @@ class L3NATAgent(firewall_l3_agent.FWaaSL3AgentRpcCallback, - del_arp_entry Needed by the L3 service when dealing with DVR """ - RPC_API_VERSION = '1.2' + target = messaging.Target(version='1.2') OPTS = [ cfg.StrOpt('agent_mode', default='legacy', diff --git a/neutron/db/metering/metering_rpc.py b/neutron/db/metering/metering_rpc.py index b99abe28ee..dd3b8ac10d 100644 --- a/neutron/db/metering/metering_rpc.py +++ b/neutron/db/metering/metering_rpc.py @@ -12,6 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo import messaging + from neutron.common import constants as consts from neutron.common import utils from neutron.i18n import _LE @@ -24,7 +26,7 @@ LOG = logging.getLogger(__name__) class MeteringRpcCallbacks(object): - RPC_API_VERSION = '1.0' + target = messaging.Target(version='1.0') def __init__(self, meter_plugin): self.meter_plugin = meter_plugin diff --git a/neutron/manager.py b/neutron/manager.py index ac16df86c7..6e67010319 100644 --- a/neutron/manager.py +++ b/neutron/manager.py @@ -16,9 +16,9 @@ import weakref from oslo.config import cfg +from oslo import messaging from oslo.utils import importutils -from neutron.common import rpc as n_rpc from neutron.common import utils from neutron.openstack.common import log as logging from neutron.openstack.common import periodic_task @@ -30,10 +30,10 @@ from stevedore import driver LOG = logging.getLogger(__name__) -class Manager(n_rpc.RpcCallback, periodic_task.PeriodicTasks): +class Manager(periodic_task.PeriodicTasks): # Set RPC API version to 1.0 by default. - RPC_API_VERSION = '1.0' + target = messaging.Target(version='1.0') def __init__(self, host=None): if not host: diff --git a/neutron/plugins/bigswitch/agent/restproxy_agent.py b/neutron/plugins/bigswitch/agent/restproxy_agent.py index e6b5b3bbca..ab60ec4191 100644 --- a/neutron/plugins/bigswitch/agent/restproxy_agent.py +++ b/neutron/plugins/bigswitch/agent/restproxy_agent.py @@ -23,6 +23,7 @@ import eventlet eventlet.monkey_patch() from oslo.config import cfg +from oslo import messaging from oslo.utils import excutils from neutron.agent.linux import ovs_lib @@ -30,7 +31,6 @@ from neutron.agent.linux import utils 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 as n_rpc from neutron.common import topics from neutron import context as q_context from neutron.extensions import securitygroup as ext_sg @@ -84,10 +84,9 @@ class SecurityGroupAgent(sg_rpc.SecurityGroupAgentRpcMixin): self.init_firewall() -class RestProxyAgent(n_rpc.RpcCallback, - sg_rpc.SecurityGroupAgentRpcCallbackMixin): +class RestProxyAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin): - RPC_API_VERSION = '1.1' + target = messaging.Target(version='1.1') def __init__(self, integ_br, polling_interval, root_helper, vs='ovs'): super(RestProxyAgent, self).__init__() diff --git a/neutron/plugins/cisco/cfg_agent/cfg_agent.py b/neutron/plugins/cisco/cfg_agent/cfg_agent.py index 5535e59865..dfc094aca7 100644 --- a/neutron/plugins/cisco/cfg_agent/cfg_agent.py +++ b/neutron/plugins/cisco/cfg_agent/cfg_agent.py @@ -94,7 +94,7 @@ class CiscoCfgAgent(manager.Manager): The main entry points in this class are the `process_services()` and `_backlog_task()` . """ - RPC_API_VERSION = '1.1' + target = messaging.Target(version='1.1') OPTS = [ cfg.IntOpt('rpc_loop_interval', default=10, diff --git a/neutron/plugins/cisco/service_plugins/cisco_router_plugin.py b/neutron/plugins/cisco/service_plugins/cisco_router_plugin.py index ef2fdbcaae..60f94ba83f 100644 --- a/neutron/plugins/cisco/service_plugins/cisco_router_plugin.py +++ b/neutron/plugins/cisco/service_plugins/cisco_router_plugin.py @@ -12,6 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo import messaging + from neutron.common import rpc as n_rpc from neutron.common import topics from neutron.db import agents_db @@ -25,10 +27,10 @@ from neutron.plugins.cisco.l3.rpc import devices_cfgagent_rpc_cb as devices_rpc from neutron.plugins.common import constants -class CiscoRouterPluginRpcCallbacks(n_rpc.RpcCallback, - l3_router_rpc.L3RouterCfgRpcCallbackMixin, +class CiscoRouterPluginRpcCallbacks(l3_router_rpc.L3RouterCfgRpcCallbackMixin, devices_rpc.DeviceCfgRpcCallbackMixin): - RPC_API_VERSION = '1.1' + + target = messaging.Target(version='1.1') def __init__(self, l3plugin): super(CiscoRouterPluginRpcCallbacks, self).__init__() diff --git a/neutron/plugins/hyperv/agent/hyperv_neutron_agent.py b/neutron/plugins/hyperv/agent/hyperv_neutron_agent.py index 6ab8822bdf..0f993d4673 100644 --- a/neutron/plugins/hyperv/agent/hyperv_neutron_agent.py +++ b/neutron/plugins/hyperv/agent/hyperv_neutron_agent.py @@ -30,7 +30,6 @@ 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 constants as n_const -from neutron.common import rpc as n_rpc from neutron.common import topics from neutron import context from neutron.i18n import _LE, _LI @@ -79,10 +78,9 @@ CONF.register_opts(agent_opts, "AGENT") config.register_agent_state_opts_helper(cfg.CONF) -class HyperVSecurityAgent(n_rpc.RpcCallback, - sg_rpc.SecurityGroupAgentRpcMixin): - # Set RPC API version to 1.1 by default. - RPC_API_VERSION = '1.1' +class HyperVSecurityAgent(sg_rpc.SecurityGroupAgentRpcMixin): + + target = messaging.Target(version='1.1') def __init__(self, context, plugin_rpc): super(HyperVSecurityAgent, self).__init__() @@ -103,10 +101,9 @@ class HyperVSecurityAgent(n_rpc.RpcCallback, consumers) -class HyperVSecurityCallbackMixin(n_rpc.RpcCallback, - sg_rpc.SecurityGroupAgentRpcCallbackMixin): - # Set RPC API version to 1.1 by default. - RPC_API_VERSION = '1.1' +class HyperVSecurityCallbackMixin(sg_rpc.SecurityGroupAgentRpcCallbackMixin): + + target = messaging.Target(version='1.1') def __init__(self, sg_agent): super(HyperVSecurityCallbackMixin, self).__init__() diff --git a/neutron/plugins/linuxbridge/agent/linuxbridge_neutron_agent.py b/neutron/plugins/linuxbridge/agent/linuxbridge_neutron_agent.py index 33114b93ed..f4af61a764 100755 --- a/neutron/plugins/linuxbridge/agent/linuxbridge_neutron_agent.py +++ b/neutron/plugins/linuxbridge/agent/linuxbridge_neutron_agent.py @@ -27,6 +27,7 @@ import eventlet eventlet.monkey_patch() from oslo.config import cfg +from oslo import messaging from six import moves from neutron.agent import l2population_rpc as l2pop_rpc @@ -37,7 +38,6 @@ from neutron.agent import securitygroups_rpc as sg_rpc from neutron.common import config as common_config from neutron.common import constants from neutron.common import exceptions -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 @@ -643,14 +643,13 @@ class LinuxBridgeManager: self.remove_fdb_bridge_entry(mac, agent_ip, interface) -class LinuxBridgeRpcCallbacks(n_rpc.RpcCallback, - sg_rpc.SecurityGroupAgentRpcCallbackMixin, +class LinuxBridgeRpcCallbacks(sg_rpc.SecurityGroupAgentRpcCallbackMixin, l2pop_rpc.L2populationRpcCallBackMixin): # Set RPC API version to 1.0 by default. # history # 1.1 Support Security Group RPC - RPC_API_VERSION = '1.1' + target = messaging.Target(version='1.1') def __init__(self, context, agent): super(LinuxBridgeRpcCallbacks, self).__init__() diff --git a/neutron/plugins/ml2/drivers/cisco/apic/apic_topology.py b/neutron/plugins/ml2/drivers/cisco/apic/apic_topology.py index 56978b3f2e..b747bb9a54 100644 --- a/neutron/plugins/ml2/drivers/cisco/apic/apic_topology.py +++ b/neutron/plugins/ml2/drivers/cisco/apic/apic_topology.py @@ -58,7 +58,7 @@ LOG = logging.getLogger(__name__) class ApicTopologyService(manager.Manager): - RPC_API_VERSION = '1.1' + target = messaging.Target(version='1.1') def __init__(self, host=None): if host is None: diff --git a/neutron/plugins/ml2/rpc.py b/neutron/plugins/ml2/rpc.py index d51d6d23b0..6efa6dabdd 100644 --- a/neutron/plugins/ml2/rpc.py +++ b/neutron/plugins/ml2/rpc.py @@ -35,10 +35,8 @@ from neutron.plugins.ml2.drivers import type_tunnel LOG = log.getLogger(__name__) -class RpcCallbacks(n_rpc.RpcCallback, - type_tunnel.TunnelRpcCallbackMixin): +class RpcCallbacks(type_tunnel.TunnelRpcCallbackMixin): - RPC_API_VERSION = '1.3' # history # 1.0 Initial version (from openvswitch/linuxbridge) # 1.1 Support Security Group RPC @@ -46,6 +44,7 @@ class RpcCallbacks(n_rpc.RpcCallback, # 1.3 get_device_details rpc signature upgrade to obtain 'host' and # return value to include fixed_ips and device_owner for # the device port + target = messaging.Target(version='1.3') def __init__(self, notifier, type_manager): self.setup_tunnel_callback_mixin(notifier, type_manager) diff --git a/neutron/plugins/mlnx/agent/eswitch_neutron_agent.py b/neutron/plugins/mlnx/agent/eswitch_neutron_agent.py index b54299a92f..0acaf6e1ad 100644 --- a/neutron/plugins/mlnx/agent/eswitch_neutron_agent.py +++ b/neutron/plugins/mlnx/agent/eswitch_neutron_agent.py @@ -22,12 +22,12 @@ import eventlet eventlet.monkey_patch() from oslo.config import cfg +from oslo import messaging 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 constants as q_constants -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 @@ -144,13 +144,12 @@ class EswitchManager(object): self.network_map[network_id] = data -class MlnxEswitchRpcCallbacks(n_rpc.RpcCallback, - sg_rpc.SecurityGroupAgentRpcCallbackMixin): +class MlnxEswitchRpcCallbacks(sg_rpc.SecurityGroupAgentRpcCallbackMixin): # Set RPC API version to 1.0 by default. # history # 1.1 Support Security Group RPC - RPC_API_VERSION = '1.1' + target = messaging.Target(version='1.1') def __init__(self, context, agent): super(MlnxEswitchRpcCallbacks, self).__init__() @@ -181,8 +180,6 @@ class MlnxEswitchPluginApi(agent_rpc.PluginApi, class MlnxEswitchNeutronAgent(sg_rpc.SecurityGroupAgentRpcMixin): - # Set RPC API version to 1.0 by default. - #RPC_API_VERSION = '1.0' def __init__(self, interface_mapping): self._polling_interval = cfg.CONF.AGENT.polling_interval diff --git a/neutron/plugins/mlnx/rpc_callbacks.py b/neutron/plugins/mlnx/rpc_callbacks.py index 09641cf42d..4aa40043b3 100644 --- a/neutron/plugins/mlnx/rpc_callbacks.py +++ b/neutron/plugins/mlnx/rpc_callbacks.py @@ -12,10 +12,11 @@ # 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 constants as q_const -from neutron.common import rpc as n_rpc from neutron.db import api as db_api from neutron import manager from neutron.openstack.common import log as logging @@ -24,11 +25,11 @@ from neutron.plugins.mlnx.db import mlnx_db_v2 as db LOG = logging.getLogger(__name__) -class MlnxRpcCallbacks(n_rpc.RpcCallback): +class MlnxRpcCallbacks(object): # History # 1.1 Support Security Group RPC # 1.2 Support get_devices_details_list - RPC_API_VERSION = '1.2' + target = messaging.Target(version='1.2') def get_device_details(self, rpc_context, **kwargs): """Agent requests device details.""" diff --git a/neutron/plugins/nec/agent/nec_neutron_agent.py b/neutron/plugins/nec/agent/nec_neutron_agent.py index 787a8186e1..f26e1ea0bb 100755 --- a/neutron/plugins/nec/agent/nec_neutron_agent.py +++ b/neutron/plugins/nec/agent/nec_neutron_agent.py @@ -60,9 +60,9 @@ class NECPluginApi(agent_rpc.PluginApi): port_removed=port_removed) -class NECAgentRpcCallback(n_rpc.RpcCallback): +class NECAgentRpcCallback(object): - RPC_API_VERSION = '1.0' + target = messaging.Target(version='1.0') def __init__(self, context, agent, sg_agent): super(NECAgentRpcCallback, self).__init__() @@ -90,11 +90,9 @@ class SecurityGroupServerRpcApi(sg_rpc.SecurityGroupServerRpcApiMixin): self.client = n_rpc.get_client(target) -class SecurityGroupAgentRpcCallback( - n_rpc.RpcCallback, - sg_rpc.SecurityGroupAgentRpcCallbackMixin): +class SecurityGroupAgentRpcCallback(sg_rpc.SecurityGroupAgentRpcCallbackMixin): - RPC_API_VERSION = sg_rpc.SG_RPC_VERSION + target = messaging.Target(version=sg_rpc.SG_RPC_VERSION) def __init__(self, context, sg_agent): super(SecurityGroupAgentRpcCallback, self).__init__() diff --git a/neutron/plugins/nec/nec_plugin.py b/neutron/plugins/nec/nec_plugin.py index ad171c3138..332601a9a2 100644 --- a/neutron/plugins/nec/nec_plugin.py +++ b/neutron/plugins/nec/nec_plugin.py @@ -688,9 +688,9 @@ class NECPluginV2AgentNotifierApi(sg_rpc.SecurityGroupAgentRpcApiMixin): cctxt.cast(context, 'port_update', port=port) -class NECPluginV2RPCCallbacks(n_rpc.RpcCallback): +class NECPluginV2RPCCallbacks(object): - RPC_API_VERSION = '1.0' + target = messaging.Target(version='1.0') def __init__(self, plugin): super(NECPluginV2RPCCallbacks, self).__init__() diff --git a/neutron/plugins/ofagent/agent/ofa_neutron_agent.py b/neutron/plugins/ofagent/agent/ofa_neutron_agent.py index 0a4c1980c7..63ccc27de3 100644 --- a/neutron/plugins/ofagent/agent/ofa_neutron_agent.py +++ b/neutron/plugins/ofagent/agent/ofa_neutron_agent.py @@ -24,6 +24,7 @@ import time import netaddr from oslo.config import cfg +from oslo import messaging from ryu.app.ofctl import api as ryu_api from ryu.base import app_manager from ryu.controller import handler @@ -38,7 +39,6 @@ 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 log -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 @@ -175,8 +175,7 @@ class OFANeutronAgentRyuApp(app_manager.RyuApp): self.arplib.del_arp_table_entry(network, ip) -class OFANeutronAgent(n_rpc.RpcCallback, - sg_rpc.SecurityGroupAgentRpcCallbackMixin, +class OFANeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin, l2population_rpc.L2populationRpcCallBackTunnelMixin): """A agent for OpenFlow Agent ML2 mechanism driver. @@ -191,7 +190,7 @@ class OFANeutronAgent(n_rpc.RpcCallback, # history # 1.0 Initial version # 1.1 Support Security Group RPC - RPC_API_VERSION = '1.1' + target = messaging.Target(version='1.1') def __init__(self, ryuapp, integ_br, local_ip, bridge_mappings, interface_mappings, root_helper, diff --git a/neutron/plugins/oneconvergence/agent/nvsd_neutron_agent.py b/neutron/plugins/oneconvergence/agent/nvsd_neutron_agent.py index 5bac0646ca..02baa42401 100644 --- a/neutron/plugins/oneconvergence/agent/nvsd_neutron_agent.py +++ b/neutron/plugins/oneconvergence/agent/nvsd_neutron_agent.py @@ -37,9 +37,9 @@ from neutron.plugins.oneconvergence.lib import config LOG = logging.getLogger(__name__) -class NVSDAgentRpcCallback(n_rpc.RpcCallback): +class NVSDAgentRpcCallback(object): - RPC_API_VERSION = '1.0' + target = messaging.Target(version='1.0') def __init__(self, context, agent, sg_agent): super(NVSDAgentRpcCallback, self).__init__() @@ -67,11 +67,9 @@ class SecurityGroupServerRpcApi(sg_rpc.SecurityGroupServerRpcApiMixin): self.client = n_rpc.get_client(target) -class SecurityGroupAgentRpcCallback( - n_rpc.RpcCallback, - sg_rpc.SecurityGroupAgentRpcCallbackMixin): +class SecurityGroupAgentRpcCallback(sg_rpc.SecurityGroupAgentRpcCallbackMixin): - RPC_API_VERSION = sg_rpc.SG_RPC_VERSION + target = messaging.Target(version=sg_rpc.SG_RPC_VERSION) def __init__(self, context, sg_agent): super(SecurityGroupAgentRpcCallback, self).__init__() @@ -89,11 +87,11 @@ class SecurityGroupAgentRpc(sg_rpc.SecurityGroupAgentRpcMixin): self.init_firewall() -class NVSDNeutronAgent(n_rpc.RpcCallback): +class NVSDNeutronAgent(object): # history # 1.0 Initial version # 1.1 Support Security Group RPC - RPC_API_VERSION = '1.1' + target = messaging.Target(version='1.1') def __init__(self, integ_br, root_helper, polling_interval): super(NVSDNeutronAgent, self).__init__() diff --git a/neutron/plugins/openvswitch/agent/ovs_neutron_agent.py b/neutron/plugins/openvswitch/agent/ovs_neutron_agent.py index c0efdf67e2..66227bd963 100644 --- a/neutron/plugins/openvswitch/agent/ovs_neutron_agent.py +++ b/neutron/plugins/openvswitch/agent/ovs_neutron_agent.py @@ -25,6 +25,7 @@ eventlet.monkey_patch() import netaddr from neutron.plugins.openvswitch.agent import ovs_dvr_neutron_agent from oslo.config import cfg +from oslo import messaging from six import moves from neutron.agent import l2population_rpc @@ -38,7 +39,6 @@ from neutron.api.rpc.handlers import dvr_rpc from neutron.common import config as common_config from neutron.common import constants as q_const from neutron.common import exceptions -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 @@ -96,8 +96,7 @@ class OVSSecurityGroupAgent(sg_rpc.SecurityGroupAgentRpcMixin): self.init_firewall(defer_refresh_firewall=True) -class OVSNeutronAgent(n_rpc.RpcCallback, - sg_rpc.SecurityGroupAgentRpcCallbackMixin, +class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin, l2population_rpc.L2populationRpcCallBackTunnelMixin, dvr_rpc.DVRAgentRpcCallbackMixin): '''Implements OVS-based tunneling, VLANs and flat networks. @@ -130,7 +129,7 @@ class OVSNeutronAgent(n_rpc.RpcCallback, # 1.0 Initial version # 1.1 Support Security Group RPC # 1.2 Support DVR (Distributed Virtual Router) RPC - RPC_API_VERSION = '1.2' + target = messaging.Target(version='1.2') def __init__(self, integ_br, tun_br, local_ip, bridge_mappings, root_helper, diff --git a/neutron/plugins/sriovnicagent/sriov_nic_agent.py b/neutron/plugins/sriovnicagent/sriov_nic_agent.py index 23ffc58774..33abde34d9 100644 --- a/neutron/plugins/sriovnicagent/sriov_nic_agent.py +++ b/neutron/plugins/sriovnicagent/sriov_nic_agent.py @@ -22,12 +22,12 @@ import eventlet eventlet.monkey_patch() from oslo.config import cfg +from oslo import messaging 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 constants as q_constants -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 @@ -42,13 +42,12 @@ from neutron.plugins.sriovnicagent import eswitch_manager as esm LOG = logging.getLogger(__name__) -class SriovNicSwitchRpcCallbacks(n_rpc.RpcCallback, - sg_rpc.SecurityGroupAgentRpcCallbackMixin): +class SriovNicSwitchRpcCallbacks(sg_rpc.SecurityGroupAgentRpcCallbackMixin): # Set RPC API version to 1.0 by default. # history # 1.1 Support Security Group RPC - RPC_API_VERSION = '1.1' + target = messaging.Target(version='1.1') def __init__(self, context, agent): super(SriovNicSwitchRpcCallbacks, self).__init__() diff --git a/neutron/services/loadbalancer/agent/agent_manager.py b/neutron/services/loadbalancer/agent/agent_manager.py index e65463e6e3..1f39128911 100644 --- a/neutron/services/loadbalancer/agent/agent_manager.py +++ b/neutron/services/loadbalancer/agent/agent_manager.py @@ -13,12 +13,12 @@ # under the License. from oslo.config import cfg +from oslo import messaging from oslo.utils import importutils 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 as n_rpc from neutron.common import topics from neutron import context from neutron.i18n import _LE, _LI @@ -44,9 +44,8 @@ class DeviceNotFoundOnAgent(n_exc.NotFound): msg = _('Unknown device with pool_id %(pool_id)s') -class LbaasAgentManager(n_rpc.RpcCallback, periodic_task.PeriodicTasks): +class LbaasAgentManager(periodic_task.PeriodicTasks): - RPC_API_VERSION = '2.0' # history # 1.0 Initial version # 1.1 Support agent_updated call @@ -54,6 +53,7 @@ class LbaasAgentManager(n_rpc.RpcCallback, periodic_task.PeriodicTasks): # - modify/reload/destroy_pool methods were removed; # - added methods to handle create/update/delete for every lbaas # object individually; + target = messaging.Target(version='2.0') def __init__(self, conf): super(LbaasAgentManager, self).__init__() diff --git a/neutron/services/loadbalancer/drivers/common/agent_driver_base.py b/neutron/services/loadbalancer/drivers/common/agent_driver_base.py index bdebf19c5f..9d7f5f0ca8 100644 --- a/neutron/services/loadbalancer/drivers/common/agent_driver_base.py +++ b/neutron/services/loadbalancer/drivers/common/agent_driver_base.py @@ -49,14 +49,14 @@ class DriverNotSpecified(n_exc.NeutronException): "in plugin driver.") -class LoadBalancerCallbacks(n_rpc.RpcCallback): +class LoadBalancerCallbacks(object): - RPC_API_VERSION = '2.0' # history # 1.0 Initial version # 2.0 Generic API for agent based drivers # - get_logical_device() handling changed; # - pool_deployed() and update_status() methods added; + target = messaging.Target(version='2.0') def __init__(self, plugin): super(LoadBalancerCallbacks, self).__init__() diff --git a/neutron/services/vpn/device_drivers/cisco_ipsec.py b/neutron/services/vpn/device_drivers/cisco_ipsec.py index b4b3d93c80..b55e5b5a8e 100644 --- a/neutron/services/vpn/device_drivers/cisco_ipsec.py +++ b/neutron/services/vpn/device_drivers/cisco_ipsec.py @@ -101,11 +101,7 @@ class CiscoCsrIPsecDriver(device_drivers.DeviceDriver): # history # 1.0 Initial version - RPC_API_VERSION = '1.0' - - # TODO(ihrachys): we can't use RpcCallback here due to inheritance - # issues - target = messaging.Target(version=RPC_API_VERSION) + target = messaging.Target(version='1.0') def __init__(self, agent, host): self.host = host diff --git a/neutron/services/vpn/device_drivers/ipsec.py b/neutron/services/vpn/device_drivers/ipsec.py index 3afd3b7ca8..e68833bc25 100644 --- a/neutron/services/vpn/device_drivers/ipsec.py +++ b/neutron/services/vpn/device_drivers/ipsec.py @@ -480,12 +480,7 @@ class IPsecDriver(device_drivers.DeviceDriver): # history # 1.0 Initial version - - RPC_API_VERSION = '1.0' - - # TODO(ihrachys): we can't use RpcCallback here due to inheritance - # issues - target = messaging.Target(version=RPC_API_VERSION) + target = messaging.Target(version='1.0') def __init__(self, agent, host): self.agent = agent diff --git a/neutron/services/vpn/service_drivers/__init__.py b/neutron/services/vpn/service_drivers/__init__.py index b2f0bfdcb0..0f66241937 100644 --- a/neutron/services/vpn/service_drivers/__init__.py +++ b/neutron/services/vpn/service_drivers/__init__.py @@ -90,7 +90,7 @@ class BaseIPsecVpnAgentApi(object): """ admin_context = context if context.is_admin else context.elevated() if not version: - version = self.RPC_API_VERSION + version = self.target.version l3_agents = self.driver.l3_plugin.get_l3_agents_hosting_routers( admin_context, [router_id], admin_state_up=True, diff --git a/neutron/services/vpn/service_drivers/cisco_ipsec.py b/neutron/services/vpn/service_drivers/cisco_ipsec.py index d88ccb8ec9..bab3793916 100644 --- a/neutron/services/vpn/service_drivers/cisco_ipsec.py +++ b/neutron/services/vpn/service_drivers/cisco_ipsec.py @@ -12,6 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo import messaging + from neutron.common import rpc as n_rpc from neutron.db.vpn import vpn_db from neutron.openstack.common import log as logging @@ -33,14 +35,14 @@ MAX_CSR_MTU = 9192 VRF_SUFFIX_LEN = 6 -class CiscoCsrIPsecVpnDriverCallBack(n_rpc.RpcCallback): +class CiscoCsrIPsecVpnDriverCallBack(object): """Handler for agent to plugin RPC messaging.""" # history # 1.0 Initial version - RPC_API_VERSION = BASE_IPSEC_VERSION + target = messaging.Target(version=BASE_IPSEC_VERSION) def __init__(self, driver): super(CiscoCsrIPsecVpnDriverCallBack, self).__init__() @@ -77,12 +79,11 @@ class CiscoCsrIPsecVpnDriverCallBack(n_rpc.RpcCallback): plugin.update_status_by_agent(context, status) -class CiscoCsrIPsecVpnAgentApi(service_drivers.BaseIPsecVpnAgentApi, - n_rpc.RpcCallback): +class CiscoCsrIPsecVpnAgentApi(service_drivers.BaseIPsecVpnAgentApi): """API and handler for Cisco IPSec plugin to agent RPC messaging.""" - RPC_API_VERSION = BASE_IPSEC_VERSION + target = messaging.Target(version=BASE_IPSEC_VERSION) def __init__(self, topic, default_version, driver): super(CiscoCsrIPsecVpnAgentApi, self).__init__( @@ -97,7 +98,7 @@ class CiscoCsrIPsecVpnAgentApi(service_drivers.BaseIPsecVpnAgentApi, """ admin_context = context if context.is_admin else context.elevated() if not version: - version = self.RPC_API_VERSION + version = self.target.version host = self.driver.l3_plugin.get_host_for_router(admin_context, router_id) LOG.debug('Notify agent at %(topic)s.%(host)s the message ' diff --git a/neutron/services/vpn/service_drivers/ipsec.py b/neutron/services/vpn/service_drivers/ipsec.py index 8618c08c4c..ebda1c9f2d 100644 --- a/neutron/services/vpn/service_drivers/ipsec.py +++ b/neutron/services/vpn/service_drivers/ipsec.py @@ -54,11 +54,10 @@ class IPsecVpnDriverCallBack(object): plugin.update_status_by_agent(context, status) -class IPsecVpnAgentApi(service_drivers.BaseIPsecVpnAgentApi, - n_rpc.RpcCallback): +class IPsecVpnAgentApi(service_drivers.BaseIPsecVpnAgentApi): """Agent RPC API for IPsecVPNAgent.""" - RPC_API_VERSION = BASE_IPSEC_VERSION + target = messaging.Target(version=BASE_IPSEC_VERSION) def __init__(self, topic, default_version, driver): super(IPsecVpnAgentApi, self).__init__(