From fe4e5cdcfad07f9cf559fac7c40cd9d4cc4e2218 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Fri, 2 Oct 2015 02:01:15 +0900 Subject: [PATCH] Move topics definitions to our own module for now Partial-Bug: #1501793 Change-Id: I4d6bd79f52e16309e1f785c9afc78b4baff3256e --- install.sh | 8 --- neutron_taas/common/__init__.py | 0 neutron_taas/common/topics.py | 19 ++++++ neutron_taas/neutron_dependencies/topics.py | 60 ------------------- .../services/taas/agents/ovs/agent.py | 2 +- .../taas/agents/ovs/taas_ovs_agent.py | 2 +- neutron_taas/services/taas/taas_plugin.py | 2 +- 7 files changed, 22 insertions(+), 71 deletions(-) create mode 100644 neutron_taas/common/__init__.py create mode 100644 neutron_taas/common/topics.py delete mode 100644 neutron_taas/neutron_dependencies/topics.py diff --git a/install.sh b/install.sh index 21d6906e..6d9450b5 100755 --- a/install.sh +++ b/install.sh @@ -52,14 +52,6 @@ if [ "$COMMAND" = "install_plugin" ] || [ "$COMMAND" = "install_agent" ]; then exit 1 fi - cp ./neutron_taas/neutron_dependencies/topics.py $DEVSTACK_PATH/neutron/common/topics.py - if [ $? = 0 ]; then - echo "Copied the common/topics.py file...." - else - echo "Install failed while copying topics.py file" - exit 1 - fi - # patch the neutron.conf file to support TaaS plugin ./neutron_taas/neutron_dependencies/patch_conf_file.sh ./neutron_taas/neutron_dependencies/taas.conf /etc/neutron/neutron.conf if [ $? = 0 ]; then diff --git a/neutron_taas/common/__init__.py b/neutron_taas/common/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/neutron_taas/common/topics.py b/neutron_taas/common/topics.py new file mode 100644 index 00000000..ff08d87a --- /dev/null +++ b/neutron_taas/common/topics.py @@ -0,0 +1,19 @@ +# Copyright (C) 2015 Midokura SARL. +# 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. + +# TODO(yamamoto): Move these to neutron.common.topics + +TAAS_PLUGIN = 'n-taas-plugin' +TAAS_AGENT = 'n-taas_agent' diff --git a/neutron_taas/neutron_dependencies/topics.py b/neutron_taas/neutron_dependencies/topics.py deleted file mode 100644 index 4f388426..00000000 --- a/neutron_taas/neutron_dependencies/topics.py +++ /dev/null @@ -1,60 +0,0 @@ -# Copyright (c) 2012 OpenStack Foundation. -# -# 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. - -NETWORK = 'network' -SUBNET = 'subnet' -PORT = 'port' -SECURITY_GROUP = 'security_group' -L2POPULATION = 'l2population' -DVR = 'dvr' - -CREATE = 'create' -DELETE = 'delete' -UPDATE = 'update' - -AGENT = 'q-agent-notifier' -PLUGIN = 'q-plugin' -L3PLUGIN = 'q-l3-plugin' -DHCP = 'q-dhcp-notifer' -FIREWALL_PLUGIN = 'q-firewall-plugin' -METERING_PLUGIN = 'q-metering-plugin' -LOADBALANCER_PLUGIN = 'n-lbaas-plugin' -TAAS_PLUGIN = 'n-taas-plugin' - -L3_AGENT = 'l3_agent' -DHCP_AGENT = 'dhcp_agent' -METERING_AGENT = 'metering_agent' -LOADBALANCER_AGENT = 'n-lbaas_agent' -TAAS_AGENT = 'n-taas_agent' - - -def get_topic_name(prefix, table, operation, host=None): - """Create a topic name. - - The topic name needs to be synced between the agent and the - plugin. The plugin will send a fanout message to all of the - listening agents so that the agents in turn can perform their - updates accordingly. - - :param prefix: Common prefix for the plugin/agent message queues. - :param table: The table in question (NETWORK, SUBNET, PORT). - :param operation: The operation that invokes notification (CREATE, - DELETE, UPDATE) - :param host: Add host to the topic - :returns: The topic name. - """ - if host: - return '%s-%s-%s.%s' % (prefix, table, operation, host) - return '%s-%s-%s' % (prefix, table, operation) diff --git a/neutron_taas/services/taas/agents/ovs/agent.py b/neutron_taas/services/taas/agents/ovs/agent.py index fe9c9b72..3993ba16 100755 --- a/neutron_taas/services/taas/agents/ovs/agent.py +++ b/neutron_taas/services/taas/agents/ovs/agent.py @@ -24,7 +24,7 @@ from oslo_service import service from neutron.agent.common import config from neutron.common import config as common_config from neutron.common import rpc as n_rpc -from neutron.common import topics +from neutron_taas.common import topics from neutron_taas.services.taas.agents.ovs import taas_ovs_agent diff --git a/neutron_taas/services/taas/agents/ovs/taas_ovs_agent.py b/neutron_taas/services/taas/agents/ovs/taas_ovs_agent.py index 3e43380e..9b33e972 100755 --- a/neutron_taas/services/taas/agents/ovs/taas_ovs_agent.py +++ b/neutron_taas/services/taas/agents/ovs/taas_ovs_agent.py @@ -15,7 +15,7 @@ from neutron.agent.common import config -from neutron.common import topics +from neutron_taas.common import topics from neutron_taas.services.taas.agents import taas_agent_api as api from oslo_config import cfg diff --git a/neutron_taas/services/taas/taas_plugin.py b/neutron_taas/services/taas/taas_plugin.py index 1ab4590d..8d250ffb 100755 --- a/neutron_taas/services/taas/taas_plugin.py +++ b/neutron_taas/services/taas/taas_plugin.py @@ -18,7 +18,7 @@ from oslo_config import cfg import oslo_messaging as messaging from neutron.common import rpc as n_rpc -from neutron.common import topics +from neutron_taas.common import topics from neutron_taas.db import taas_db from neutron_taas.extensions import taas as taas_ex from oslo_log import log as logging