diff --git a/doc/source/devref/security_group_api.rst b/doc/source/devref/security_group_api.rst index 802f7dbd53d..50cbb2e26c1 100644 --- a/doc/source/devref/security_group_api.rst +++ b/doc/source/devref/security_group_api.rst @@ -55,7 +55,7 @@ running on the compute nodes, and modifying the IPTables rules on each hyperviso * `SecurityGroupServerRpcMixin `_ - defines the RPC API that the plugin uses to communicate with the agents running on the compute nodes * SecurityGroupServerRpcMixin - Defines the API methods used to fetch data from the database, in order to return responses to agents via the RPC API -* `Agent RPC classes `_ +* `Agent RPC classes `_ * The SecurityGroupServerRpcApi defines the API methods that can be called by agents, back to the plugin that runs on the Neutron controller * The SecurityGroupAgentRpcCallbackMixin defines methods that a plugin uses to call back to an agent after performing an action called by an agent. diff --git a/neutron/agent/securitygroups_rpc.py b/neutron/agent/securitygroups_rpc.py index b2f0721563e..d7b9a495e38 100644 --- a/neutron/agent/securitygroups_rpc.py +++ b/neutron/agent/securitygroups_rpc.py @@ -16,6 +16,7 @@ import functools +from debtcollector import moves from oslo_config import cfg from oslo_log import log as logging import oslo_messaging @@ -283,16 +284,24 @@ class SecurityGroupAgentRpc(object): self.refresh_firewall(updated_devices) -# TODO(armax): For bw compat with external dependencies; to be dropped in M. -SG_RPC_VERSION = ( - securitygroups_rpc.SecurityGroupAgentRpcApiMixin.SG_RPC_VERSION +# TODO(armax): For bw compat with external dependencies; to be dropped in P. +# NOTE(dasm): Should be already removed, but didn't have DeprecationWarning. +SG_RPC_VERSION = moves.moved_function( + securitygroups_rpc.SecurityGroupAgentRpcApiMixin.SG_RPC_VERSION, + 'SG_RPC_VERSION', __name__, version='Liberty', removal_version='Pike' ) -SecurityGroupServerRpcApi = ( - securitygroups_rpc.SecurityGroupServerRpcApi +SecurityGroupServerRpcApi = moves.moved_class( + securitygroups_rpc.SecurityGroupServerRpcApi, + 'SecurityGroupServerRpcApi', old_module_name=__name__, version='Liberty', + removal_version='Pike' ) -SecurityGroupAgentRpcApiMixin = ( - securitygroups_rpc.SecurityGroupAgentRpcApiMixin +SecurityGroupAgentRpcApiMixin = moves.moved_class( + securitygroups_rpc.SecurityGroupAgentRpcApiMixin, + 'SecurityGroupAgentRpcApiMixin', old_module_name=__name__, + version='Liberty', removal_version='Pike' ) -SecurityGroupAgentRpcCallbackMixin = ( - securitygroups_rpc.SecurityGroupAgentRpcCallbackMixin +SecurityGroupAgentRpcCallbackMixin = moves.moved_class( + securitygroups_rpc.SecurityGroupAgentRpcCallbackMixin, + 'SecurityGroupAgentRpcCallbackMixin', old_module_name=__name__, + version='Liberty', removal_version='Pike' ) diff --git a/neutron/plugins/ml2/drivers/agent/_common_agent.py b/neutron/plugins/ml2/drivers/agent/_common_agent.py index 340746dd3d7..f40d0e72cd4 100644 --- a/neutron/plugins/ml2/drivers/agent/_common_agent.py +++ b/neutron/plugins/ml2/drivers/agent/_common_agent.py @@ -30,8 +30,9 @@ from osprofiler import profiler from neutron._i18n import _LE, _LI from neutron.agent.l2 import l2_agent_extensions_manager as ext_manager from neutron.agent import rpc as agent_rpc -from neutron.agent import securitygroups_rpc as sg_rpc +from neutron.agent import securitygroups_rpc as agent_sg_rpc from neutron.api.rpc.callbacks import resources +from neutron.api.rpc.handlers import securitygroups_rpc as sg_rpc from neutron.callbacks import events from neutron.callbacks import registry from neutron.callbacks import resources as local_resources @@ -150,7 +151,7 @@ class CommonAgentLoop(service.Service): def setup_rpc(self): self.plugin_rpc = agent_rpc.PluginApi(topics.PLUGIN) self.sg_plugin_rpc = sg_rpc.SecurityGroupServerRpcApi(topics.PLUGIN) - self.sg_agent = sg_rpc.SecurityGroupAgentRpc( + self.sg_agent = agent_sg_rpc.SecurityGroupAgentRpc( self.context, self.sg_plugin_rpc, defer_refresh_firewall=True) self.agent_id = self.mgr.get_agent_id() diff --git a/neutron/plugins/ml2/drivers/linuxbridge/agent/linuxbridge_neutron_agent.py b/neutron/plugins/ml2/drivers/linuxbridge/agent/linuxbridge_neutron_agent.py index 712eefcb242..8209929c6d7 100644 --- a/neutron/plugins/ml2/drivers/linuxbridge/agent/linuxbridge_neutron_agent.py +++ b/neutron/plugins/ml2/drivers/linuxbridge/agent/linuxbridge_neutron_agent.py @@ -35,7 +35,7 @@ from neutron._i18n import _LE, _LI, _LW from neutron.agent.linux import bridge_lib from neutron.agent.linux import ip_lib from neutron.agent.linux import utils -from neutron.agent import securitygroups_rpc as sg_rpc +from neutron.api.rpc.handlers import securitygroups_rpc as sg_rpc from neutron.common import config as common_config from neutron.common import exceptions from neutron.common import profiler as setup_profiler diff --git a/neutron/plugins/ml2/drivers/macvtap/agent/macvtap_neutron_agent.py b/neutron/plugins/ml2/drivers/macvtap/agent/macvtap_neutron_agent.py index 9c9eaaf659d..6b1b2b57580 100644 --- a/neutron/plugins/ml2/drivers/macvtap/agent/macvtap_neutron_agent.py +++ b/neutron/plugins/ml2/drivers/macvtap/agent/macvtap_neutron_agent.py @@ -26,7 +26,7 @@ from oslo_service import service from neutron._i18n import _LE, _LI from neutron.agent.linux import ip_lib -from neutron.agent import securitygroups_rpc as sg_rpc +from neutron.api.rpc.handlers import securitygroups_rpc as sg_rpc from neutron.common import config as common_config from neutron.common import topics from neutron.plugins.common import constants as p_constants diff --git a/neutron/plugins/ml2/drivers/mech_sriov/agent/sriov_nic_agent.py b/neutron/plugins/ml2/drivers/mech_sriov/agent/sriov_nic_agent.py index f5d57e29755..7e02f755b90 100644 --- a/neutron/plugins/ml2/drivers/mech_sriov/agent/sriov_nic_agent.py +++ b/neutron/plugins/ml2/drivers/mech_sriov/agent/sriov_nic_agent.py @@ -32,8 +32,9 @@ import six from neutron._i18n import _, _LE, _LI, _LW from neutron.agent.l2 import l2_agent_extensions_manager as ext_manager from neutron.agent import rpc as agent_rpc -from neutron.agent import securitygroups_rpc as sg_rpc +from neutron.agent import securitygroups_rpc as agent_sg_rpc from neutron.api.rpc.callbacks import resources +from neutron.api.rpc.handlers import securitygroups_rpc as sg_rpc from neutron.common import config as common_config from neutron.common import profiler as setup_profiler from neutron.common import topics @@ -122,7 +123,7 @@ class SriovNicSwitchAgent(object): self.context = context.get_admin_context_without_session() self.plugin_rpc = agent_rpc.PluginApi(topics.PLUGIN) self.sg_plugin_rpc = sg_rpc.SecurityGroupServerRpcApi(topics.PLUGIN) - self.sg_agent = sg_rpc.SecurityGroupAgentRpc(self.context, + self.sg_agent = agent_sg_rpc.SecurityGroupAgentRpc(self.context, self.sg_plugin_rpc) self._setup_rpc() self.ext_manager = self._create_agent_extension_manager( diff --git a/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py b/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py index 9909287b685..ce38bbcf14a 100644 --- a/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py +++ b/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py @@ -42,9 +42,10 @@ from neutron.agent.common import polling from neutron.agent.common import utils from neutron.agent.l2 import l2_agent_extensions_manager as ext_manager from neutron.agent import rpc as agent_rpc -from neutron.agent import securitygroups_rpc as sg_rpc +from neutron.agent import securitygroups_rpc as agent_sg_rpc from neutron.api.rpc.callbacks import resources from neutron.api.rpc.handlers import dvr_rpc +from neutron.api.rpc.handlers import securitygroups_rpc as sg_rpc from neutron.callbacks import events as callback_events from neutron.callbacks import registry from neutron.common import config @@ -237,7 +238,7 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin, self._restore_local_vlan_map() # Security group agent support - self.sg_agent = sg_rpc.SecurityGroupAgentRpc( + self.sg_agent = agent_sg_rpc.SecurityGroupAgentRpc( self.context, self.sg_plugin_rpc, defer_refresh_firewall=True, integration_bridge=self.int_br) diff --git a/neutron/tests/unit/agent/test_securitygroups_rpc.py b/neutron/tests/unit/agent/test_securitygroups_rpc.py index aecde3b5f47..4a834470cdc 100644 --- a/neutron/tests/unit/agent/test_securitygroups_rpc.py +++ b/neutron/tests/unit/agent/test_securitygroups_rpc.py @@ -1638,7 +1638,7 @@ class SecurityGroupAgentRpcWithDeferredRefreshTestCase( self.assertFalse(self.firewall.security_group_updated.called) -class FakeSGNotifierAPI(sg_rpc.SecurityGroupAgentRpcApiMixin): +class FakeSGNotifierAPI(securitygroups_rpc.SecurityGroupAgentRpcApiMixin): def __init__(self): self.topic = 'fake' target = oslo_messaging.Target(topic=self.topic, version='1.0')