]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Use EXT_TO_SERVICE_MAPPING instead of ALLOWED_SERVICES
authorarmando-migliaccio <armamig@gmail.com>
Thu, 2 Jul 2015 01:01:10 +0000 (18:01 -0700)
committerarmando-migliaccio <armamig@gmail.com>
Thu, 2 Jul 2015 02:53:12 +0000 (19:53 -0700)
We can derive the services from EXT_TO_SERVICE_MAPPING, therefore
there is no need for duplicating the service labels into ALLOWED_SERVICES.

Change-Id: If92e0ea3dea4480588141a2819ea4036c527c9bc

neutron/plugins/common/constants.py
neutron/services/provider_configuration.py

index 5c562dc3b7b6344fd91f9320c83e855bb088e323..809a1399e85e49ae86fefd7df2fc4905a4c1167d 100644 (file)
@@ -13,7 +13,7 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-# Service type constants:
+# Neutron well-known service type constants:
 CORE = "CORE"
 DUMMY = "DUMMY"
 LOADBALANCER = "LOADBALANCER"
@@ -23,7 +23,6 @@ VPN = "VPN"
 METERING = "METERING"
 L3_ROUTER_NAT = "L3_ROUTER_NAT"
 
-
 # Maps extension alias to service type
 EXT_TO_SERVICE_MAPPING = {
     'dummy': DUMMY,
@@ -35,10 +34,6 @@ EXT_TO_SERVICE_MAPPING = {
     'router': L3_ROUTER_NAT
 }
 
-# TODO(salvatore-orlando): Move these (or derive them) from conf file
-ALLOWED_SERVICES = [CORE, DUMMY, LOADBALANCER, FIREWALL, VPN, METERING,
-                    L3_ROUTER_NAT, LOADBALANCERV2]
-
 COMMON_PREFIXES = {
     CORE: "",
     DUMMY: "/dummy_svc",
index 9a247bfc311cf0f59101ca29affae321d48deb60..cc406e74193ae2668f8725ce9134078fa120f4a4 100644 (file)
@@ -111,11 +111,12 @@ def parse_service_provider_opt():
                        prov_def)
                 LOG.error(msg)
                 raise n_exc.Invalid(msg)
-        if svc_type not in constants.ALLOWED_SERVICES:
+        ALLOWED_SERVICES = constants.EXT_TO_SERVICE_MAPPING.values()
+        if svc_type not in ALLOWED_SERVICES:
             msg = (_("Service type '%(svc_type)s' is not allowed, "
                      "allowed types: %(allowed)s") %
                    {'svc_type': svc_type,
-                    'allowed': constants.ALLOWED_SERVICES})
+                    'allowed': ALLOWED_SERVICES})
             LOG.error(msg)
             raise n_exc.Invalid(msg)
         driver = get_provider_driver_class(driver)