Merge "actually register the various objects we define"
This commit is contained in:
commit
0be47b7f03
@ -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
|
||||
|
@ -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
|
||||
|
@ -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'
|
||||
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user