summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-01-21 23:02:35 +0000
committerGerrit Code Review <review@openstack.org>2013-01-21 23:02:35 +0000
commit07531ad264a4fd21faa89f19ad032bf34a223d38 (patch)
tree6233cbd20063b9dce87b92c58dac77345febe0c0 /nova/tests
parentd82865ad542a426ba941adcc33ccd753c745d642 (diff)
parent5639e27d6fadf34335eebaf3a8925ffcea505882 (diff)
Merge "Clean up db network db calls for fixed and float"
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/test_db_api.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/nova/tests/test_db_api.py b/nova/tests/test_db_api.py
index c70e96cdc..e43a32c19 100644
--- a/nova/tests/test_db_api.py
+++ b/nova/tests/test_db_api.py
@@ -261,6 +261,32 @@ class DbApiTestCase(test.TestCase):
res = db.floating_ip_disassociate(ctxt, floating)
self.assertEqual(res, None)
+ def test_fixed_ip_get_by_floating_address(self):
+ ctxt = context.get_admin_context()
+ values = {'address': 'fixed'}
+ fixed = db.fixed_ip_create(ctxt, values)
+ fixed_ip_ref = db.fixed_ip_get_by_address(ctxt, fixed)
+ values = {'address': 'floating',
+ 'fixed_ip_id': fixed_ip_ref['id']}
+ floating = db.floating_ip_create(ctxt, values)
+ fixed_ip_ref = db.fixed_ip_get_by_floating_address(ctxt, floating)
+ self.assertEqual(fixed, fixed_ip_ref['address'])
+
+ def test_floating_ip_get_by_fixed_address(self):
+ ctxt = context.get_admin_context()
+ values = {'address': 'fixed'}
+ fixed = db.fixed_ip_create(ctxt, values)
+ fixed_ip_ref = db.fixed_ip_get_by_address(ctxt, fixed)
+ values = {'address': 'floating1',
+ 'fixed_ip_id': fixed_ip_ref['id']}
+ floating1 = db.floating_ip_create(ctxt, values)
+ values = {'address': 'floating2',
+ 'fixed_ip_id': fixed_ip_ref['id']}
+ floating2 = db.floating_ip_create(ctxt, values)
+ floating_ip_refs = db.floating_ip_get_by_fixed_address(ctxt, fixed)
+ self.assertEqual(floating1, floating_ip_refs[0]['address'])
+ self.assertEqual(floating2, floating_ip_refs[1]['address'])
+
def test_network_create_safe(self):
ctxt = context.get_admin_context()
values = {'host': 'localhost', 'project_id': 'project1'}