Neutron constant COMMON_PREFIXES does not exist anymore

The Neutron fix [1] removed the service provider constant
COMMON_PREFIXES and that must be defined as a property.
That patch also intorduce a constants file to group all BGPVPN
constants.
[1] https://review.openstack.org/#/c/198113/
Change-Id: Iae5d66bb8ffe6c7eb7825bf35b6f5fbc1d7dfd4a
Closes-bug: #1472619 
This commit is contained in:
Édouard Thuleau
2015年07月08日 13:35:31 +00:00
parent c63d5c79fa
commit 6d3b64c60b

View File

@@ -21,15 +21,13 @@ from networking_bgpvpn.neutron import extensions as bgpvpn_ext
from neutron.api import extensions
from neutron.api.v2 import attributes as attr
from neutron.api.v2 import resource_helper
from neutron.plugins.common import constants
from neutron.plugins.common import constants as n_const
from neutron.services.service_base import ServicePluginBase
from oslo_log import log
LOG = log.getLogger(__name__)
from networking_bgpvpn.neutron.services.common import constants
BGPVPN_L3 = 'l3'
BGPVPN_L2 = 'l2'
BGPVPN_TYPES = [BGPVPN_L3, BGPVPN_L2]
LOG = log.getLogger(__name__)
# Regular expression to validate Route Target list format
@@ -39,9 +37,7 @@ RT_REGEX = ('^((?:0|[1-9]\d{0,3}|[1-5]\d{4}|6[0-4]\d{3}|65[0-4]\d{2}|655[0-2]'
'{2}|655[0-2]\d|6553[0-5]))$')
extensions.append_api_extensions_path(bgpvpn_ext.__path__)
constants.BGPVPN = "BGPVPN"
constants.EXT_TO_SERVICE_MAPPING['bgpvpn'] = constants.BGPVPN
constants.COMMON_PREFIXES["BGPVPN"] = "/bgpvpn"
n_const.EXT_TO_SERVICE_MAPPING['bgpvpn'] = constants.BGPVPN
def _validate_rt_list(data, valid_values=None):
@@ -71,7 +67,7 @@ validators = {'type:route_target_list': _validate_rt_list,
attr.validators.update(validators)
RESOURCE_ATTRIBUTE_MAP = {
'bgpvpn_connections': {
constants.BGPVPN_CONNECTIONS: {
'id': {'allow_post': False, 'allow_put': False,
'validate': {'type:uuid': None},
'is_visible': True,
@@ -89,8 +85,8 @@ RESOURCE_ATTRIBUTE_MAP = {
'validate': {'type:string': None},
'is_visible': True},
'type': {'allow_post': True, 'allow_put': False,
'default': BGPVPN_L3,
'validate': {'type:values': BGPVPN_TYPES},
'default': constants.BGPVPN_L3,
'validate': {'type:values': constants.BGPVPN_TYPES},
'is_visible': True},
'route_targets': {'allow_post': True, 'allow_put': True,
'default': [],

View File

@@ -0,0 +1,21 @@
# Copyright 2015 OpenStack Foundation
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
#
# 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.
BGPVPN = "BGPVPN"
BGPVPN_CONNECTIONS = "bgpvpn_connections"
BGPVPN_L3 = 'l3'
BGPVPN_L2 = 'l2'
BGPVPN_TYPES = [BGPVPN_L3, BGPVPN_L2]

View File

@@ -15,15 +15,17 @@
from networking_bgpvpn.neutron.db import bgpvpn_db
from neutron.i18n import _LI
from neutron.plugins.common import constants
from neutron.services import service_base
from oslo_log import log
from networking_bgpvpn.neutron.services.common import constants
LOG = log.getLogger(__name__)
class BGPVPNPlugin(bgpvpn_db.BGPVPNPluginDb):
supported_extension_aliases = ["bgpvpn"]
path_prefix = "/bgpvpn"
def __init__(self):
super(BGPVPNPlugin, self).__init__()

View File

@@ -18,12 +18,12 @@ import mock
from oslo_utils import uuidutils
from neutron.plugins.common import constants
from neutron.tests.unit.api.v2 import test_base
from neutron.tests.unit.extensions import base as test_extensions_base
from webob import exc
from networking_bgpvpn.neutron.extensions import bgpvpn
from networking_bgpvpn.neutron.services.common import constants
_uuid = uuidutils.generate_uuid
_get_path = test_base._get_path
Reference in New Issue
openstack/networking-bgpvpn
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.

The note is not visible to the blocked user.