Use EXT_TO_SERVICE_MAPPING instead of ALLOWED_SERVICES
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
This commit is contained in:
parent
4fa3c0619d
commit
5e11769e49
|
@ -13,7 +13,7 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
# Service type constants:
|
# Neutron well-known service type constants:
|
||||||
CORE = "CORE"
|
CORE = "CORE"
|
||||||
DUMMY = "DUMMY"
|
DUMMY = "DUMMY"
|
||||||
LOADBALANCER = "LOADBALANCER"
|
LOADBALANCER = "LOADBALANCER"
|
||||||
|
@ -23,7 +23,6 @@ VPN = "VPN"
|
||||||
METERING = "METERING"
|
METERING = "METERING"
|
||||||
L3_ROUTER_NAT = "L3_ROUTER_NAT"
|
L3_ROUTER_NAT = "L3_ROUTER_NAT"
|
||||||
|
|
||||||
|
|
||||||
# Maps extension alias to service type
|
# Maps extension alias to service type
|
||||||
EXT_TO_SERVICE_MAPPING = {
|
EXT_TO_SERVICE_MAPPING = {
|
||||||
'dummy': DUMMY,
|
'dummy': DUMMY,
|
||||||
|
@ -35,10 +34,6 @@ EXT_TO_SERVICE_MAPPING = {
|
||||||
'router': L3_ROUTER_NAT
|
'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 = {
|
COMMON_PREFIXES = {
|
||||||
CORE: "",
|
CORE: "",
|
||||||
DUMMY: "/dummy_svc",
|
DUMMY: "/dummy_svc",
|
||||||
|
|
|
@ -111,11 +111,12 @@ def parse_service_provider_opt():
|
||||||
prov_def)
|
prov_def)
|
||||||
LOG.error(msg)
|
LOG.error(msg)
|
||||||
raise n_exc.Invalid(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, "
|
msg = (_("Service type '%(svc_type)s' is not allowed, "
|
||||||
"allowed types: %(allowed)s") %
|
"allowed types: %(allowed)s") %
|
||||||
{'svc_type': svc_type,
|
{'svc_type': svc_type,
|
||||||
'allowed': constants.ALLOWED_SERVICES})
|
'allowed': ALLOWED_SERVICES})
|
||||||
LOG.error(msg)
|
LOG.error(msg)
|
||||||
raise n_exc.Invalid(msg)
|
raise n_exc.Invalid(msg)
|
||||||
driver = get_provider_driver_class(driver)
|
driver = get_provider_driver_class(driver)
|
||||||
|
|
Loading…
Reference in New Issue