]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
COMMON_PREFIXES cleanup - patch 1/5
authorarmando-migliaccio <armamig@gmail.com>
Thu, 2 Jul 2015 19:06:05 +0000 (12:06 -0700)
committerarmando-migliaccio <armamig@gmail.com>
Fri, 3 Jul 2015 00:05:27 +0000 (17:05 -0700)
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
neutron/services/metering/metering_plugin.py
neutron/tests/unit/db/metering/test_metering_db.py
neutron/tests/unit/dummy_plugin.py
neutron/tests/unit/services/metering/test_metering_plugin.py

index 809a1399e85e49ae86fefd7df2fc4905a4c1167d..401b01dd093b0395019849609d41d70bf96567c0 100644 (file)
@@ -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
index 5af103615597bf91d4438a3294190bd643d0e109..57789b784752b6a4ede62c12e1bd62f6c6f5b786 100644 (file)
@@ -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__()
index c9e185163bc71c4c909141788d259c966c21e173..f2db17f6e1baa597d4be732551ea3f19157ea3a5 100644 (file)
@@ -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()
     )
 
index ed0b739440cb2d2481854429cdc0a59b9a598c0e..41a3723193599696a6665d8ebcd156a3de6146b1 100644 (file)
@@ -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):
index 508117395c86fa237ff5608308dfc8e25b26c3a0..b2443bf3857ccd4835046488252b2a7239c36301 100644 (file)
@@ -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
     )