本文整理汇总了Python中nova.db.fixed_ip_associate函数的典型用法代码示例。如果您正苦于以下问题:Python fixed_ip_associate函数的具体用法?Python fixed_ip_associate怎么用?Python fixed_ip_associate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fixed_ip_associate函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_fixed_ip_associate_succeeds_and_sets_network
def test_fixed_ip_associate_succeeds_and_sets_network(self):
address = self.create_fixed_ip()
db.fixed_ip_associate(self.ctxt, address, self.instance.id,
network_id=self.network.id)
fixed_ip = db.fixed_ip_get_by_address(self.ctxt, address)
self.assertEqual(fixed_ip.instance_id, self.instance.id)
self.assertEqual(fixed_ip.network_id, self.network.id)
示例2: test_vpn_allocate_fixed_ip
def test_vpn_allocate_fixed_ip(self):
self.mox.StubOutWithMock(db, "fixed_ip_associate")
self.mox.StubOutWithMock(db, "fixed_ip_update")
self.mox.StubOutWithMock(db, "virtual_interface_get_by_instance_and_network")
db.fixed_ip_associate(mox.IgnoreArg(), mox.IgnoreArg(), mox.IgnoreArg(), reserved=True).AndReturn("192.168.0.1")
db.fixed_ip_update(mox.IgnoreArg(), mox.IgnoreArg(), mox.IgnoreArg())
db.virtual_interface_get_by_instance_and_network(mox.IgnoreArg(), mox.IgnoreArg(), mox.IgnoreArg()).AndReturn(
{"id": 0}
)
self.mox.ReplayAll()
network = dict(networks[0])
network["vpn_private_address"] = "192.168.0.2"
self.network.allocate_fixed_ip(None, 0, network, vpn=True)
示例3: associate
def associate(cls, context, address, instance_uuid, network_id=None,
reserved=False, vif_id=None):
db_fixedip = db.fixed_ip_associate(context, address, instance_uuid,
network_id=network_id,
reserved=reserved,
virtual_interface_id=vif_id)
return cls._from_db_object(context, cls(context), db_fixedip)
示例4: test_vpn_allocate_fixed_ip
def test_vpn_allocate_fixed_ip(self):
self.mox.StubOutWithMock(db, 'fixed_ip_associate')
self.mox.StubOutWithMock(db, 'fixed_ip_update')
self.mox.StubOutWithMock(db,
'virtual_interface_get_by_instance_and_network')
db.fixed_ip_associate(mox.IgnoreArg(),
mox.IgnoreArg(),
mox.IgnoreArg()).AndReturn('192.168.0.1')
db.fixed_ip_update(mox.IgnoreArg(),
mox.IgnoreArg(),
mox.IgnoreArg())
db.virtual_interface_get_by_instance_and_network(mox.IgnoreArg(),
mox.IgnoreArg(), mox.IgnoreArg()).AndReturn({'id': 0})
self.mox.ReplayAll()
network = dict(networks[0])
network['vpn_private_address'] = '192.168.0.2'
self.network.allocate_fixed_ip(None, 0, network, vpn=True)
示例5: associate
def associate(cls, context, address, instance_uuid, network_id=None, reserved=False):
db_fixedip = db.fixed_ip_associate(context, address, instance_uuid, network_id=network_id, reserved=reserved)
return cls._from_db_object(context, cls(), db_fixedip)