From 59ae35ba8fa6f4b79a1370c32faaa1ae4fce3f37 Mon Sep 17 00:00:00 2001 From: armando-migliaccio Date: Thu, 2 Jul 2015 12:06:05 -0700 Subject: [PATCH] COMMON_PREFIXES cleanup - patch 1/5 This dictionary does not belong to the plugins directory as it captures API business, but practically speaking it does not even deserve to exist and can be removed altogether. This is patch one in a series that aims at addressing this monkey business. Change-Id: I95cd71dfc35e266f6f3cc5715ab8a0deb10058e7 --- neutron/plugins/common/constants.py | 4 ---- neutron/services/metering/metering_plugin.py | 1 + neutron/tests/unit/db/metering/test_metering_db.py | 2 +- neutron/tests/unit/dummy_plugin.py | 1 + .../tests/unit/services/metering/test_metering_plugin.py | 6 +++--- 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/neutron/plugins/common/constants.py b/neutron/plugins/common/constants.py index 809a1399e85..401b01dd093 100644 --- a/neutron/plugins/common/constants.py +++ b/neutron/plugins/common/constants.py @@ -35,14 +35,10 @@ EXT_TO_SERVICE_MAPPING = { } COMMON_PREFIXES = { - CORE: "", - DUMMY: "/dummy_svc", LOADBALANCER: "/lb", LOADBALANCERV2: "/lbaas", FIREWALL: "/fw", VPN: "/vpn", - METERING: "/metering", - L3_ROUTER_NAT: "", } # Service operation status constants diff --git a/neutron/services/metering/metering_plugin.py b/neutron/services/metering/metering_plugin.py index 5af10361559..57789b78475 100644 --- a/neutron/services/metering/metering_plugin.py +++ b/neutron/services/metering/metering_plugin.py @@ -22,6 +22,7 @@ from neutron.db.metering import metering_rpc class MeteringPlugin(metering_db.MeteringDbMixin): """Implementation of the Neutron Metering Service Plugin.""" supported_extension_aliases = ["metering"] + path_prefix = "/metering" def __init__(self): super(MeteringPlugin, self).__init__() diff --git a/neutron/tests/unit/db/metering/test_metering_db.py b/neutron/tests/unit/db/metering/test_metering_db.py index c9e185163bc..f2db17f6e1b 100644 --- a/neutron/tests/unit/db/metering/test_metering_db.py +++ b/neutron/tests/unit/db/metering/test_metering_db.py @@ -114,7 +114,7 @@ class MeteringPluginDbTestCase( fmt = 'json' resource_prefix_map = dict( - (k.replace('_', '-'), constants.COMMON_PREFIXES[constants.METERING]) + (k.replace('_', '-'), "/metering") for k in metering.RESOURCE_ATTRIBUTE_MAP.keys() ) diff --git a/neutron/tests/unit/dummy_plugin.py b/neutron/tests/unit/dummy_plugin.py index ed0b739440c..41a37231935 100644 --- a/neutron/tests/unit/dummy_plugin.py +++ b/neutron/tests/unit/dummy_plugin.py @@ -88,6 +88,7 @@ class DummyServicePlugin(service_base.ServicePluginBase): """ supported_extension_aliases = ['dummy', servicetype.EXT_ALIAS] + path_prefix = "/dummy_svc" agent_notifiers = {'dummy': 'dummy_agent_notifier'} def __init__(self): diff --git a/neutron/tests/unit/services/metering/test_metering_plugin.py b/neutron/tests/unit/services/metering/test_metering_plugin.py index 508117395c8..b2443bf3857 100644 --- a/neutron/tests/unit/services/metering/test_metering_plugin.py +++ b/neutron/tests/unit/services/metering/test_metering_plugin.py @@ -62,7 +62,7 @@ class TestMeteringPlugin(test_db_base_plugin_v2.NeutronDbPluginV2TestCase, test_metering_db.MeteringPluginDbTestCaseMixin): resource_prefix_map = dict( - (k.replace('_', '-'), constants.COMMON_PREFIXES[constants.METERING]) + (k.replace('_', '-'), "/metering") for k in ext_metering.RESOURCE_ATTRIBUTE_MAP.keys() ) @@ -281,7 +281,7 @@ class TestMeteringPluginL3AgentScheduler( test_metering_db.MeteringPluginDbTestCaseMixin): resource_prefix_map = dict( - (k.replace('_', '-'), constants.COMMON_PREFIXES[constants.METERING]) + (k.replace('_', '-'), "/metering") for k in ext_metering.RESOURCE_ATTRIBUTE_MAP.keys() ) @@ -404,7 +404,7 @@ class TestMeteringPluginRpcFromL3Agent( test_metering_db.MeteringPluginDbTestCaseMixin): resource_prefix_map = dict( - (k.replace('_', '-'), constants.COMMON_PREFIXES[constants.METERING]) + (k.replace('_', '-'), "/metering") for k in ext_metering.RESOURCE_ATTRIBUTE_MAP )