summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-05-29 16:30:49 +0000
committerGerrit Code Review <review@openstack.org>2012-05-29 16:30:49 +0000
commitdab262af0d642c48c7d2b92bf8b0520ffc65daaf (patch)
treec82ecd34ce82eefb66ad7dd863bcc978a2def241 /nova/tests
parent09b13b84493144ebc9c71e504709bd596e546a0f (diff)
parent4e65a33276895432121e2d4e8efd323956d73529 (diff)
Merge "Allow adding fixed IPs by network UUID"
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/network/test_manager.py35
1 files changed, 34 insertions, 1 deletions
diff --git a/nova/tests/network/test_manager.py b/nova/tests/network/test_manager.py
index 9e0a754b7..ff38af492 100644
--- a/nova/tests/network/test_manager.py
+++ b/nova/tests/network/test_manager.py
@@ -268,7 +268,7 @@ class FlatNetworkTestCase(test.TestCase):
self.network.validate_networks(self.context, requested_networks)
- def test_add_fixed_ip_instance_without_vpn_requested_networks(self):
+ def test_add_fixed_ip_instance_using_id_without_vpn(self):
self.mox.StubOutWithMock(db, 'network_get')
self.mox.StubOutWithMock(db, 'network_update')
self.mox.StubOutWithMock(db, 'fixed_ip_associate_pool')
@@ -301,6 +301,39 @@ class FlatNetworkTestCase(test.TestCase):
self.network.add_fixed_ip_to_instance(self.context, 1, HOST,
networks[0]['id'])
+ def test_add_fixed_ip_instance_using_uuid_without_vpn(self):
+ self.mox.StubOutWithMock(db, 'network_get_by_uuid')
+ self.mox.StubOutWithMock(db, 'network_update')
+ self.mox.StubOutWithMock(db, 'fixed_ip_associate_pool')
+ self.mox.StubOutWithMock(db, 'instance_get')
+ self.mox.StubOutWithMock(db,
+ 'virtual_interface_get_by_instance_and_network')
+ self.mox.StubOutWithMock(db, 'fixed_ip_update')
+
+ 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})
+
+ db.instance_get(mox.IgnoreArg(),
+ mox.IgnoreArg()).AndReturn({'security_groups':
+ [{'id': 0}]})
+ db.instance_get(self.context,
+ 1).AndReturn({'display_name': HOST,
+ 'uuid': 'test-00001'})
+ db.instance_get(mox.IgnoreArg(),
+ mox.IgnoreArg()).AndReturn({'availability_zone': ''})
+ db.fixed_ip_associate_pool(mox.IgnoreArg(),
+ mox.IgnoreArg(),
+ mox.IgnoreArg()).AndReturn('192.168.0.101')
+ db.network_get_by_uuid(mox.IgnoreArg(),
+ mox.IgnoreArg()).AndReturn(networks[0])
+ db.network_update(mox.IgnoreArg(), mox.IgnoreArg(), mox.IgnoreArg())
+ self.mox.ReplayAll()
+ self.network.add_fixed_ip_to_instance(self.context, 1, HOST,
+ networks[0]['uuid'])
+
def test_mini_dns_driver(self):
zone1 = "example.org"
zone2 = "example.com"