d649785c9e
The following changes have been made to coordinate with the changes made in Neutron for Pike: * Partial use of Neutron context has been completely moved to neutron_lib's context. * The patching of neutron.db.api.get_session() has been replaced with patching of sqlalchemy.orm.session to add the notification_queue attribute. This significantly reduces the earlier complexity of patching. * Use of top-level start of transaction in GBP plugins: with context.session.begin(subtransactions=True): has been migrated to use of: with db_api.context_manager.writer.using(context): or with db_api.context_manager.reader.using(context) as relevant. * Calls to _make_resource_xxx_dict() in GBP plugins have been moved to inside the transaction. * The use of: neutron.callbacks.events neutron.callbacks.exceptions neutron.callbacks.registry to neutron_lib.callbacks.events neutron_lib.callbacks.exceptions neutron_lib.callbacks.registry * The use of: neutron.api.v2.attributes.resource_xxx neutron.extensions.extension_xxx to: from neutron_lib.api.definitions.resource_xxx from neutron_lib.api.definitions.extension_xxx resp. * The use of: neutron.db.db_base_plugin_v2.NeutronDbPluginV2.register_dict_extend_funcs to: neutron.db._resource_extend.resource_extend (the latter is a decorator) * The use of: neutron.db.db_base_plugin_v2.NeutronDbPluginV2.register_model_query_hook() to: from neutron.db import _model_query as model_query.register_hook() * The use of: neutron.db.segments_db.NetworkSegment to: neutron.db.models.segment.NetworkSegment * In the case of Neutron ml2plus plugin (used by APIC/AIM solution), the use of get_admin_context() has been patched to return elevated version of the current context in use. This helps to preserve the session and transaction semantics. Ideally, context.elevated() would have been directly used in all these places, however the current context is not available in these places, and hence getting the current context and elevating it is wrapped in the get_admin_context() patched method. * In the case of the components used by the APIC/AIM solution (including the ml2plus and l3_plugin) the use of: with context.session.begin(subtransactions=True): to with db_api.context_manager.writer.using(context): or with db_api.context_manager.reader.using(context): as relevant. * Patching of methods from Neutron which is no longer relevant have been removed from gbpservice.neutron.extensions.patch module. * Setting up of UTs has been fixed to load and reset configurations appropriately. This helps to eleminate some failures when tests are run in non-deterministic orders. * In tree devstack plugin has been updated (aim repo commit pin needs to be reverted). * Gate jobs have been updated as relevant (including fixes to the exercise scripts and job configurations). The associated repos, namely, client, UI and automation have also been updated (the reference to the client's gerrit patch needs to be updated once the patch has been merged). Change-Id: I11dd089effbf40cf104afd720dc40a9911dcf28d
57 lines
1.8 KiB
Python
57 lines
1.8 KiB
Python
# 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.
|
|
|
|
from neutron_lib.api import converters as conv
|
|
from neutron_lib.api.definitions import subnetpool as subnetpool_def
|
|
from neutron_lib.api import extensions
|
|
from neutron_lib import constants
|
|
|
|
|
|
EXTENDED_ATTRIBUTES_2_0 = {
|
|
subnetpool_def.COLLECTION_NAME: {
|
|
'is_implicit': {'allow_post': True, 'allow_put': True,
|
|
'default': False,
|
|
'convert_to': conv.convert_to_boolean,
|
|
'is_visible': True, 'required_by_policy': True,
|
|
'enforce_policy': True},
|
|
},
|
|
}
|
|
|
|
|
|
class Implicit_subnetpools(extensions.ExtensionDescriptor):
|
|
"""Extension class supporting default subnetpools."""
|
|
|
|
@classmethod
|
|
def get_name(cls):
|
|
return "Implicit Subnetpools"
|
|
|
|
@classmethod
|
|
def get_alias(cls):
|
|
return "implicit-subnetpools"
|
|
|
|
@classmethod
|
|
def get_description(cls):
|
|
return "Provides ability to mark a subnetpool as implicit"
|
|
|
|
@classmethod
|
|
def get_updated(cls):
|
|
return "2017-01-11T18:00:00-00:00"
|
|
|
|
def get_required_extensions(self):
|
|
return [constants.SUBNET_ALLOCATION_EXT_ALIAS]
|
|
|
|
def get_extended_resources(self, version):
|
|
if version == "2.0":
|
|
return EXTENDED_ATTRIBUTES_2_0
|
|
else:
|
|
return {}
|