use rpc agent topics from neutron-lib

There are a few places in neutron that are not yet using the agent
topics module from neutron-lib. This patch address them by:
- Removing neutron.agent._topics
- Switching all uses of topics over to use neutron-lib

NeutronLibImpact

Change-Id: Ic9699ca93cd6fe59ed575ab444c4a4f9456323b2
This commit is contained in:
Boden R 2019-04-10 10:21:41 -06:00
parent 05d93684fb
commit e9e76ce4b7
4 changed files with 7 additions and 32 deletions

View File

@ -1,24 +0,0 @@
# 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.
"""
TODO(mlavalle): This module should be deleted once neutron-lib containing
https://review.openstack.org/#/c/564381/ change is released.
"""
from neutron_lib.api.definitions import portbindings_extended
PORT_BINDING = portbindings_extended.RESOURCE_NAME
ACTIVATE = 'activate'
DEACTIVATE = 'deactivate'

View File

@ -34,7 +34,6 @@ from oslo_service import service
from oslo_utils import excutils
from six import moves
from neutron.agent import _topics as n_topics
from neutron.agent.linux import bridge_lib
from neutron.agent.linux import ip_lib
from neutron.api.rpc.handlers import securitygroups_rpc as sg_rpc
@ -848,8 +847,8 @@ class LinuxBridgeManager(amb.CommonAgentManagerBase):
[topics.NETWORK, topics.DELETE],
[topics.NETWORK, topics.UPDATE],
[topics.SECURITY_GROUP, topics.UPDATE],
[n_topics.PORT_BINDING, n_topics.DEACTIVATE],
[n_topics.PORT_BINDING, n_topics.ACTIVATE]]
[topics.PORT_BINDING, topics.DEACTIVATE],
[topics.PORT_BINDING, topics.ACTIVATE]]
if cfg.CONF.VXLAN.l2_population:
consumers.append([topics.L2POPULATION, topics.UPDATE])
return consumers

View File

@ -27,7 +27,6 @@ from oslo_log import log
import oslo_messaging
from sqlalchemy.orm import exc
from neutron.agent import _topics as n_topics
from neutron.api.rpc.handlers import dvr_rpc
from neutron.api.rpc.handlers import securitygroups_rpc as sg_rpc
from neutron.db import l3_hamode_db
@ -419,9 +418,9 @@ class AgentNotifierApi(dvr_rpc.DVRAgentRpcApiMixin,
topics.NETWORK,
topics.UPDATE)
self.topic_port_binding_deactivate = topics.get_topic_name(
topic, n_topics.PORT_BINDING, n_topics.DEACTIVATE)
topic, topics.PORT_BINDING, topics.DEACTIVATE)
self.topic_port_binding_activate = topics.get_topic_name(
topic, n_topics.PORT_BINDING, n_topics.ACTIVATE)
topic, topics.PORT_BINDING, topics.ACTIVATE)
target = oslo_messaging.Target(topic=topic, version='1.0')
self.client = n_rpc.get_client(target)

View File

@ -13,6 +13,7 @@
# under the License.
import mock
from neutron_lib.agent import topics
from neutron_lib.api.definitions import metering as metering_apidef
from neutron_lib import context
from neutron_lib.db import api as db_api
@ -99,7 +100,7 @@ class TestMeteringPlugin(test_db_base_plugin_v2.NeutronDbPluginV2TestCase,
return_value=self.ctx)
self.mock_context = self.context_patch.start()
self.topic = 'metering_agent'
self.topic = topics.METERING_AGENT
add = ('neutron.api.rpc.agentnotifiers.' +
'metering_rpc_agent_api.MeteringAgentNotifyAPI' +
@ -356,7 +357,7 @@ class TestMeteringPluginL3AgentScheduler(
'.get_l3_agents_hosting_routers')
self.l3routers_mock = self.l3routers_patch.start()
self.topic = 'metering_agent'
self.topic = topics.METERING_AGENT
add = ('neutron.api.rpc.agentnotifiers.' +
'metering_rpc_agent_api.MeteringAgentNotifyAPI' +