Address Scope added to OVO

This patch ports Address Scope to Oslo Versioned Objects.

Change-Id: Icb0a8dce704834dcd9c3497e4d36745098285d29
Partially-Implements: blueprint adopt-oslo-versioned-objects-for-db
This commit is contained in:
Victor Morales 2016-03-25 14:06:14 -05:00
parent 8f33cbeb42
commit 351ee35c5e
3 changed files with 65 additions and 0 deletions

View File

@ -0,0 +1,36 @@
# Copyright (c) 2016 Intel Corporation.
#
# 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 oslo_versionedobjects import base as obj_base
from oslo_versionedobjects import fields as obj_fields
from neutron.db import address_scope_db as models
from neutron.objects import base
from neutron.objects import common_types
@obj_base.VersionedObjectRegistry.register
class AddressScope(base.NeutronDbObject):
# Version 1.0: Initial version
VERSION = '1.0'
db_model = models.AddressScope
fields = {
'id': obj_fields.UUIDField(),
'tenant_id': obj_fields.UUIDField(nullable=True),
'name': obj_fields.StringField(),
'shared': obj_fields.BooleanField(),
'ip_version': common_types.IPVersionEnumField(),
}

View File

@ -0,0 +1,28 @@
# Copyright (c) 2016 Intel Corporation.
#
# 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.objects import address_scope
from neutron.tests.unit.objects import test_base as obj_test_base
from neutron.tests.unit import testlib_api
class AddressScopeIfaceObjectTestCase(obj_test_base.BaseObjectIfaceTestCase):
_test_class = address_scope.AddressScope
class AddressScopeDbObjectTestCase(obj_test_base._BaseObjectTestCase,
testlib_api.SqlTestCase):
_test_class = address_scope.AddressScope

View File

@ -26,6 +26,7 @@ from neutron.tests import tools
# NOTE: The hashes in this list should only be changed if they come with a
# corresponding version bump in the affected objects.
object_data = {
'AddressScope': '1.0-681cb915f973c92350fe2c797dec2ea4',
'ExtraDhcpOpt': '1.0-632f689cbeb36328995a7aed1d0a78d3',
'PortSecurity': '1.0-cf5b382a0112080ec4e0f23f697c7ab2',
'AllowedAddressPair': '1.0-0d7380d7d4a32f72e6ae509af1476297',