Merge "actually register the various objects we define"

This commit is contained in:
Jenkins 2016-01-22 02:36:16 +00:00 committed by Gerrit Code Review
commit 0be47b7f03
5 changed files with 14 additions and 3 deletions

View File

@ -14,6 +14,7 @@ from oslo_versionedobjects import base
from oslo_versionedobjects import fields
@base.VersionedObjectRegistry.register
class InstanceInfo(base.VersionedObject):
"""Represents important information about a Nova instance."""
# Version 1.0: Initial version

View File

@ -14,6 +14,7 @@ from oslo_versionedobjects import base
from oslo_versionedobjects import fields
@base.VersionedObjectRegistry.register
class Network(base.VersionedObject):
"""Represents a network."""
# Version 1.0: Initial version

View File

@ -16,6 +16,7 @@ from oslo_versionedobjects import base
from oslo_versionedobjects import fields
@base.VersionedObjectRegistry.register
class Subnet(base.VersionedObject):
"""Represents a subnet."""
# Version 1.0: Initial version
@ -48,7 +49,8 @@ class Subnet(base.VersionedObject):
return netaddr.IPNetwork(self.cidr)
class SubnetList(base.ObjectListBase):
@base.VersionedObjectRegistry.register
class SubnetList(base.VersionedObject, base.ObjectListBase):
# Version 1.0: Initial version
VERSION = '1.0'

View File

@ -43,6 +43,7 @@ VIF_DETAILS_VHOSTUSER_MODE = 'vhostuser_mode'
_NIC_NAME_LEN = 14
@base.VersionedObjectRegistry.register
class VIF(base.VersionedObject):
"""Represents a virtual network interface."""
# Version 1.0: Initial version

View File

@ -49,7 +49,10 @@ class TestOSVIF(base.TestCase):
return_value={'foobar': plugin}):
os_vif.initialize()
instance = mock.MagicMock()
vif = objects.vif.VIF(id='uniq', plugin='foobar')
info = objects.instance_info.InstanceInfo()
vif = objects.vif.VIF(id='uniq',
plugin='foobar',
instance_info=info)
os_vif.plug(vif, instance)
plugin.plug.assert_called_once_with(vif, instance)
@ -58,6 +61,9 @@ class TestOSVIF(base.TestCase):
with mock.patch('stevedore.extension.ExtensionManager',
return_value={'foobar': plugin}):
os_vif.initialize()
vif = objects.vif.VIF(id='uniq', plugin='foobar')
info = objects.instance_info.InstanceInfo()
vif = objects.vif.VIF(id='uniq',
plugin='foobar',
instance_info=info)
os_vif.unplug(vif)
plugin.unplug.assert_called_once_with(vif)