OVO for VLAN aware VMs
Versioned objects for VLAN aware VMs data model. Partially-implements: blueprint vlan-aware-vms Change-Id: Iea35fbe844e6ca8c376eb2148c74d5dc54ed6f15
This commit is contained in:
parent
73a06b9988
commit
deeb4b17e6
58
neutron/objects/trunk.py
Normal file
58
neutron/objects/trunk.py
Normal file
@ -0,0 +1,58 @@
|
||||
# Copyright (c) 2016 Mirantis, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# 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.objects import base
|
||||
from neutron.services.trunk import models
|
||||
|
||||
|
||||
@obj_base.VersionedObjectRegistry.register
|
||||
class SubPort(base.NeutronDbObject):
|
||||
# Version 1.0: Initial version
|
||||
VERSION = '1.0'
|
||||
|
||||
db_model = models.SubPort
|
||||
|
||||
primary_keys = ['port_id', 'trunk_id']
|
||||
|
||||
fields = {
|
||||
'port_id': obj_fields.UUIDField(),
|
||||
'trunk_id': obj_fields.UUIDField(),
|
||||
'segmentation_type': obj_fields.StringField(),
|
||||
'segmentation_id': obj_fields.IntegerField(),
|
||||
}
|
||||
|
||||
fields_no_update = ['segmentation_type', 'segmentation_id']
|
||||
|
||||
|
||||
@obj_base.VersionedObjectRegistry.register
|
||||
class Trunk(base.NeutronDbObject):
|
||||
# Version 1.0: Initial version
|
||||
VERSION = '1.0'
|
||||
|
||||
db_model = models.Trunk
|
||||
|
||||
fields = {
|
||||
'id': obj_fields.UUIDField(),
|
||||
'tenant_id': obj_fields.UUIDField(),
|
||||
'port_id': obj_fields.UUIDField(),
|
||||
'sub_ports': obj_fields.ListOfObjectsField(SubPort.__name__),
|
||||
}
|
||||
|
||||
fields_no_update = ['tenant_id', 'port_id']
|
||||
|
||||
synthetic_fields = ['sub_ports']
|
@ -36,6 +36,8 @@ object_data = {
|
||||
'QosPolicy': '1.1-721fa60ea8f0e8f15d456d6e917dfe59',
|
||||
'SubnetPool': '1.0-320598830183ee739cbc9f32ebc26bba',
|
||||
'SubnetPoolPrefix': '1.0-13c15144135eb869faa4a76dc3ee3b6c',
|
||||
'SubPort': '1.0-72c8471068db1f0491b5480fe49b52bb',
|
||||
'Trunk': '1.0-758286a52466d7a52b74331f43b07a84',
|
||||
}
|
||||
|
||||
|
||||
|
37
neutron/tests/unit/objects/test_trunk.py
Normal file
37
neutron/tests/unit/objects/test_trunk.py
Normal file
@ -0,0 +1,37 @@
|
||||
# Copyright (c) 2016 Mirantis, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# 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 trunk as t_obj
|
||||
from neutron.tests.unit.objects import test_base
|
||||
|
||||
|
||||
class SubPortObjectTestCase(test_base.BaseObjectIfaceTestCase):
|
||||
|
||||
_test_class = t_obj.SubPort
|
||||
|
||||
|
||||
class SubPortDbObjectTestCase(test_base.BaseDbObjectTestCase):
|
||||
|
||||
_test_class = t_obj.SubPort
|
||||
|
||||
|
||||
class TrunkObjectTestCase(test_base.BaseObjectIfaceTestCase):
|
||||
|
||||
_test_class = t_obj.Trunk
|
||||
|
||||
|
||||
class TrunkDbObjectTestCase(test_base.BaseDbObjectTestCase):
|
||||
|
||||
_test_class = t_obj.Trunk
|
Loading…
Reference in New Issue
Block a user