fixed tests, moved compute network config call, added notes, made inject option into a boolean
This commit is contained in:
		| @@ -23,7 +23,6 @@ | |||||||
|  |  | ||||||
| from nova import flags | from nova import flags | ||||||
| from nova import twistd | from nova import twistd | ||||||
| from nova import utils |  | ||||||
|  |  | ||||||
| from nova.network import service | from nova.network import service | ||||||
|  |  | ||||||
| @@ -34,8 +33,4 @@ if __name__ == '__main__': | |||||||
|     twistd.serve(__file__) |     twistd.serve(__file__) | ||||||
|  |  | ||||||
| if __name__ == '__builtin__': | if __name__ == '__builtin__': | ||||||
|     t = FLAGS.network_type |     application = service.type_to_class(FLAGS.network_type).create() | ||||||
|     if t == 'flat': |  | ||||||
|         application = service.FlatNetworkService.create() |  | ||||||
|     elif t == 'vlan': |  | ||||||
|         application = service.VlanNetworkService.create() |  | ||||||
|   | |||||||
| @@ -69,7 +69,7 @@ class NetworkTestCase(test.TrialTestCase): | |||||||
|         self.assertTrue(IPy.IP(address) in self.network.network) |         self.assertTrue(IPy.IP(address) in self.network.network) | ||||||
|  |  | ||||||
|     def test_allocate_deallocate_fixed_ip(self): |     def test_allocate_deallocate_fixed_ip(self): | ||||||
|         result  = self.service.allocate_fixed_ip( |         result  = yield self.service.allocate_fixed_ip( | ||||||
|                 self.user.id, self.projects[0].id) |                 self.user.id, self.projects[0].id) | ||||||
|         address = result['private_dns_name'] |         address = result['private_dns_name'] | ||||||
|         mac = result['mac_address'] |         mac = result['mac_address'] | ||||||
| @@ -88,11 +88,11 @@ class NetworkTestCase(test.TrialTestCase): | |||||||
|  |  | ||||||
|     def test_range_allocation(self): |     def test_range_allocation(self): | ||||||
|         hostname = "test-host" |         hostname = "test-host" | ||||||
|         result = self.service.allocate_fixed_ip( |         result = yield self.service.allocate_fixed_ip( | ||||||
|                     self.user.id, self.projects[0].id) |                     self.user.id, self.projects[0].id) | ||||||
|         mac = result['mac_address'] |         mac = result['mac_address'] | ||||||
|         address = result['private_dns_name'] |         address = result['private_dns_name'] | ||||||
|         result = self.service.allocate_fixed_ip( |         result = yield self.service.allocate_fixed_ip( | ||||||
|                 self.user, self.projects[1].id) |                 self.user, self.projects[1].id) | ||||||
|         secondmac = result['mac_address'] |         secondmac = result['mac_address'] | ||||||
|         secondaddress = result['private_dns_name'] |         secondaddress = result['private_dns_name'] | ||||||
| @@ -122,21 +122,21 @@ class NetworkTestCase(test.TrialTestCase): | |||||||
|         self.assertEqual(False, is_in_project(secondaddress, self.projects[1].id)) |         self.assertEqual(False, is_in_project(secondaddress, self.projects[1].id)) | ||||||
|  |  | ||||||
|     def test_subnet_edge(self): |     def test_subnet_edge(self): | ||||||
|         result = self.service.allocate_fixed_ip(self.user.id, |         result = yield self.service.allocate_fixed_ip(self.user.id, | ||||||
|                                                        self.projects[0].id) |                                                        self.projects[0].id) | ||||||
|         firstaddress = result['private_dns_name'] |         firstaddress = result['private_dns_name'] | ||||||
|         hostname = "toomany-hosts" |         hostname = "toomany-hosts" | ||||||
|         for i in range(1,5): |         for i in range(1,5): | ||||||
|             project_id = self.projects[i].id |             project_id = self.projects[i].id | ||||||
|             result = self.service.allocate_fixed_ip( |             result = yield self.service.allocate_fixed_ip( | ||||||
|                     self.user, project_id) |                     self.user, project_id) | ||||||
|             mac = result['mac_address'] |             mac = result['mac_address'] | ||||||
|             address = result['private_dns_name'] |             address = result['private_dns_name'] | ||||||
|             result = self.service.allocate_fixed_ip( |             result = yield self.service.allocate_fixed_ip( | ||||||
|                     self.user, project_id) |                     self.user, project_id) | ||||||
|             mac2 = result['mac_address'] |             mac2 = result['mac_address'] | ||||||
|             address2 = result['private_dns_name'] |             address2 = result['private_dns_name'] | ||||||
|             result = self.service.allocate_fixed_ip( |             result = yield self.service.allocate_fixed_ip( | ||||||
|                    self.user, project_id) |                    self.user, project_id) | ||||||
|             mac3 = result['mac_address'] |             mac3 = result['mac_address'] | ||||||
|             address3 = result['private_dns_name'] |             address3 = result['private_dns_name'] | ||||||
| @@ -193,12 +193,12 @@ class NetworkTestCase(test.TrialTestCase): | |||||||
|         macs = {} |         macs = {} | ||||||
|         addresses = {} |         addresses = {} | ||||||
|         for i in range(0, (num_available_ips - 1)): |         for i in range(0, (num_available_ips - 1)): | ||||||
|             result = self.service.allocate_fixed_ip(self.user.id, self.projects[0].id) |             result = yield self.service.allocate_fixed_ip(self.user.id, self.projects[0].id) | ||||||
|             macs[i] = result['mac_address'] |             macs[i] = result['mac_address'] | ||||||
|             addresses[i] = result['private_dns_name'] |             addresses[i] = result['private_dns_name'] | ||||||
|             self.dnsmasq.issue_ip(macs[i], addresses[i], hostname, net.bridge_name) |             self.dnsmasq.issue_ip(macs[i], addresses[i], hostname, net.bridge_name) | ||||||
|  |  | ||||||
|         self.assertRaises(NoMoreAddresses, self.service.allocate_fixed_ip, self.user.id, self.projects[0].id) |         self.assertFailure(self.service.allocate_fixed_ip(self.user.id, self.projects[0].id), NoMoreAddresses) | ||||||
|  |  | ||||||
|         for i in range(0, (num_available_ips - 1)): |         for i in range(0, (num_available_ips - 1)): | ||||||
|             rv = self.service.deallocate_fixed_ip(addresses[i]) |             rv = self.service.deallocate_fixed_ip(addresses[i]) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Vishvananda Ishaya
					Vishvananda Ishaya