os_vif: ensure objects are in an 'os_vif' namespace
Objects extended from base.VersionedObject go into the default 'versionedobjects' namespace in the registry. To avoid clashing object names, we should be registering into an 'os_vif' namespace. Change-Id: Ia254385f9d1ecf7a5030b580808a417149532493
This commit is contained in:
parent
aeadc2ea63
commit
c09135907b
18
os_vif/objects/base.py
Normal file
18
os_vif/objects/base.py
Normal file
@ -0,0 +1,18 @@
|
||||
# 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 ovo_base
|
||||
|
||||
|
||||
class VersionedObject(ovo_base.VersionedObject):
|
||||
|
||||
OBJ_PROJECT_NAMESPACE = 'os_vif'
|
@ -13,11 +13,12 @@
|
||||
from oslo_versionedobjects import base
|
||||
from oslo_versionedobjects import fields
|
||||
|
||||
from os_vif.objects import base as osv_base
|
||||
from os_vif.objects import fields as osv_fields
|
||||
|
||||
|
||||
@base.VersionedObjectRegistry.register
|
||||
class FixedIP(base.VersionedObject):
|
||||
class FixedIP(osv_base.VersionedObject):
|
||||
"""Represents a fixed IP."""
|
||||
# Version 1.0: Initial version
|
||||
VERSION = '1.0'
|
||||
@ -29,7 +30,7 @@ class FixedIP(base.VersionedObject):
|
||||
|
||||
|
||||
@base.VersionedObjectRegistry.register
|
||||
class FixedIPList(base.VersionedObject, base.ObjectListBase):
|
||||
class FixedIPList(osv_base.VersionedObject, base.ObjectListBase):
|
||||
# Version 1.0: Initial version
|
||||
VERSION = '1.0'
|
||||
|
||||
|
@ -13,9 +13,11 @@
|
||||
from oslo_versionedobjects import base
|
||||
from oslo_versionedobjects import fields
|
||||
|
||||
from os_vif.objects import base as osv_base
|
||||
|
||||
|
||||
@base.VersionedObjectRegistry.register
|
||||
class InstanceInfo(base.VersionedObject):
|
||||
class InstanceInfo(osv_base.VersionedObject):
|
||||
"""Represents important information about a Nova instance."""
|
||||
# Version 1.0: Initial version
|
||||
VERSION = '1.0'
|
||||
|
@ -14,10 +14,11 @@ from oslo_versionedobjects import base
|
||||
from oslo_versionedobjects import fields
|
||||
|
||||
from os_vif import objects
|
||||
from os_vif.objects import base as osv_base
|
||||
|
||||
|
||||
@base.VersionedObjectRegistry.register
|
||||
class Network(base.VersionedObject):
|
||||
class Network(osv_base.VersionedObject):
|
||||
"""Represents a network."""
|
||||
# Version 1.0: Initial version
|
||||
VERSION = '1.0'
|
||||
|
@ -13,9 +13,11 @@
|
||||
from oslo_versionedobjects import base
|
||||
from oslo_versionedobjects import fields
|
||||
|
||||
from os_vif.objects import base as osv_base
|
||||
|
||||
|
||||
@base.VersionedObjectRegistry.register
|
||||
class Route(base.VersionedObject):
|
||||
class Route(osv_base.VersionedObject):
|
||||
"""Represents a route."""
|
||||
# Version 1.0: Initial version
|
||||
VERSION = '1.0'
|
||||
@ -28,7 +30,7 @@ class Route(base.VersionedObject):
|
||||
|
||||
|
||||
@base.VersionedObjectRegistry.register
|
||||
class RouteList(base.VersionedObject, base.ObjectListBase):
|
||||
class RouteList(osv_base.VersionedObject, base.ObjectListBase):
|
||||
# Version 1.0: Initial version
|
||||
VERSION = '1.0'
|
||||
|
||||
|
@ -13,11 +13,12 @@
|
||||
from oslo_versionedobjects import base
|
||||
from oslo_versionedobjects import fields
|
||||
|
||||
from os_vif.objects import base as osv_base
|
||||
from os_vif.objects import fields as osv_fields
|
||||
|
||||
|
||||
@base.VersionedObjectRegistry.register
|
||||
class Subnet(base.VersionedObject):
|
||||
class Subnet(osv_base.VersionedObject):
|
||||
"""Represents a subnet."""
|
||||
# Version 1.0: Initial version
|
||||
VERSION = '1.0'
|
||||
@ -33,7 +34,7 @@ class Subnet(base.VersionedObject):
|
||||
|
||||
|
||||
@base.VersionedObjectRegistry.register
|
||||
class SubnetList(base.VersionedObject, base.ObjectListBase):
|
||||
class SubnetList(osv_base.VersionedObject, base.ObjectListBase):
|
||||
# Version 1.0: Initial version
|
||||
VERSION = '1.0'
|
||||
|
||||
|
@ -13,11 +13,12 @@
|
||||
from oslo_versionedobjects import base
|
||||
from oslo_versionedobjects import fields
|
||||
|
||||
from os_vif.objects import base as osv_base
|
||||
from os_vif.objects import fields as osv_fields
|
||||
|
||||
|
||||
@base.VersionedObjectRegistry.register
|
||||
class VIFBase(base.VersionedObject, base.ComparableVersionedObject):
|
||||
class VIFBase(osv_base.VersionedObject, base.ComparableVersionedObject):
|
||||
"""Represents a virtual network interface."""
|
||||
# Version 1.0: Initial version
|
||||
VERSION = '1.0'
|
||||
@ -148,7 +149,8 @@ class VIFHostDevice(VIFBase):
|
||||
|
||||
|
||||
@base.VersionedObjectRegistry.register
|
||||
class VIFPortProfileBase(base.VersionedObject, base.ComparableVersionedObject):
|
||||
class VIFPortProfileBase(osv_base.VersionedObject,
|
||||
base.ComparableVersionedObject):
|
||||
# Base class for all types of port profile
|
||||
VERSION = '1.0'
|
||||
|
||||
|
@ -26,6 +26,7 @@ class TestVIFS(base.TestCase):
|
||||
vif = cls(**kwargs)
|
||||
|
||||
prim = vif.obj_to_primitive()
|
||||
self.assertEqual("os_vif", prim["versioned_object.namespace"])
|
||||
vif2 = objects.vif.VIFBase.obj_from_primitive(prim)
|
||||
|
||||
self.assertEqual(vif, vif2)
|
||||
|
Loading…
x
Reference in New Issue
Block a user