本文整理汇总了Python中nova.db.floating_ip_get函数的典型用法代码示例。如果您正苦于以下问题:Python floating_ip_get函数的具体用法?Python floating_ip_get怎么用?Python floating_ip_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了floating_ip_get函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_translate_floating_ip_view
def test_translate_floating_ip_view(self):
floating_ip_address = self.floating_ip
floating_ip = db.floating_ip_get_by_address(self.context, floating_ip_address)
# NOTE(vish): network_get uses the id not the address
floating_ip = db.floating_ip_get(self.context, floating_ip["id"])
view = self.floating_ips._translate_floating_ip_view(floating_ip)
self.assertIn("floating_ip", view)
self.assertTrue(view["floating_ip"]["id"])
self.assertEqual(view["floating_ip"]["ip"], self.floating_ip)
self.assertIsNone(view["floating_ip"]["fixed_ip"])
self.assertIsNone(view["floating_ip"]["instance_id"])
示例2: test_translate_floating_ip_view
def test_translate_floating_ip_view(self):
floating_ip_address = self.floating_ip
floating_ip = db.floating_ip_get_by_address(self.context,
floating_ip_address)
# NOTE(vish): network_get uses the id not the address
floating_ip = db.floating_ip_get(self.context, floating_ip['id'])
self.controller._normalize_ip(floating_ip)
view = floating_ips._translate_floating_ip_view(floating_ip)
self.assertTrue('floating_ip' in view)
self.assertTrue(view['floating_ip']['id'])
self.assertEqual(view['floating_ip']['ip'], self.floating_ip)
self.assertEqual(view['floating_ip']['fixed_ip'], None)
self.assertEqual(view['floating_ip']['instance_id'], None)
示例3: get_by_id
def get_by_id(cls, context, id):
db_floatingip = db.floating_ip_get(context, id)
# XXX joins fixed.instance
return cls._from_db_object(context, cls(context), db_floatingip,
expected_attrs=['fixed_ip'])