summaryrefslogtreecommitdiffstats
path: root/nova/tests/network/test_quantumv2.py
diff options
context:
space:
mode:
Diffstat (limited to 'nova/tests/network/test_quantumv2.py')
-rw-r--r--nova/tests/network/test_quantumv2.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/nova/tests/network/test_quantumv2.py b/nova/tests/network/test_quantumv2.py
index d97dcae57..a2e7efcc0 100644
--- a/nova/tests/network/test_quantumv2.py
+++ b/nova/tests/network/test_quantumv2.py
@@ -594,6 +594,19 @@ class TestQuantumv2(test.TestCase):
self._allocate_for_instance(net_idx=1,
requested_networks=requested_networks)
+ def test_allocate_for_instance_no_networks(self):
+ """verify the exception thrown when there are no networks defined."""
+ api = quantumapi.API()
+ self.moxed_client.list_networks(
+ tenant_id=self.instance['project_id'],
+ shared=False).AndReturn(
+ {'networks': []})
+ self.moxed_client.list_networks(shared=True).AndReturn(
+ {'networks': []})
+ self.mox.ReplayAll()
+ nwinfo = api.allocate_for_instance(self.context, self.instance)
+ self.assertEqual(len(nwinfo), 0)
+
def test_allocate_for_instance_ex1(self):
"""verify we will delete created ports
if we fail to allocate all net resources.
@@ -714,7 +727,6 @@ class TestQuantumv2(test.TestCase):
port_data = number == 1 and self.port_data1 or self.port_data2
self.moxed_client.delete_port(port_data[0]['id'])
- nets = [port_data[0]['network_id']]
quantumv2.get_client(mox.IgnoreArg(), admin=True).AndReturn(
self.moxed_client)
self.moxed_client.list_ports(
@@ -1056,7 +1068,6 @@ class TestQuantumv2(test.TestCase):
def test_allocate_floating_ip_with_pool_id(self):
api = quantumapi.API()
- pool_name = self.fip_pool['name']
pool_id = self.fip_pool['id']
search_opts = {'router:external': True,
'fields': 'id',
@@ -1100,7 +1111,6 @@ class TestQuantumv2(test.TestCase):
def test_release_floating_ip_associated(self):
api = quantumapi.API()
address = self.fip_associated['floating_ip_address']
- fip_id = self.fip_associated['id']
self.moxed_client.list_floatingips(floating_ip_address=address).\
AndReturn({'floatingips': [self.fip_associated]})
@@ -1144,7 +1154,6 @@ class TestQuantumv2(test.TestCase):
api = quantumapi.API()
address = self.fip_associated['floating_ip_address']
fixed_address = self.fip_associated['fixed_ip_address']
- fip_id = self.fip_associated['id']
search_opts = {'device_owner': 'compute:nova',
'device_id': self.instance['uuid']}
@@ -1178,7 +1187,6 @@ class TestQuantumv2(test.TestCase):
self.moxed_client.list_subnets(
**search_opts).AndReturn({'subnets': self.subnet_data_n})
- zone = 'compute:%s' % self.instance['availability_zone']
search_opts = {'device_id': self.instance['uuid'],
'device_owner': 'compute:nova',
'network_id': network_id}