misc networking fixes
o fixed dns bug where dns was gotten from the wrong subnet o project_id passed to get_instance_nw_info for when context.project_id is null o removed line breaks around quantum client request to improve readability o project_id passed into vif creation instead of using context o exception handling around get_attached_ports in quantum connection o updated object id generation to start with 1 in network_fake o updated the fake subnets returned in the network_fake o added proper v6 address generation to network_fake o improved get_instance_nw_info test o update api.openstack.compute.test_servers around improved network fake Change-Id: I74d0a9dbfcbd38e2fbc7d7fefc2587e578980b6e
This commit is contained in:
		| @@ -146,45 +146,46 @@ class FlatNetworkTestCase(test.TestCase): | |||||||
|         nw_info = fake_get_instance_nw_info(self.stubs, 1, 2) |         nw_info = fake_get_instance_nw_info(self.stubs, 1, 2) | ||||||
|  |  | ||||||
|         for i, (nw, info) in enumerate(nw_info): |         for i, (nw, info) in enumerate(nw_info): | ||||||
|             check = {'bridge': 'fake_br%d' % i, |             nid = i + 1 | ||||||
|                      'cidr': '192.168.%s.0/24' % i, |             check = {'bridge': 'fake_br%d' % nid, | ||||||
|                      'cidr_v6': 'DONTCARE', |                      'cidr': '192.168.%s.0/24' % nid, | ||||||
|                      'id': 'DONTCARE', |                      'cidr_v6': '2001:db8:0:%x::/64' % nid, | ||||||
|  |                      'id': '00000000-0000-0000-0000-00000000000000%02d' % nid, | ||||||
|                      'multi_host': False, |                      'multi_host': False, | ||||||
|                      'injected': False, |                      'injected': False, | ||||||
|                      'bridge_interface': 'DONTCARE', |                      'bridge_interface': None, | ||||||
|                      'vlan': None} |                      'vlan': None} | ||||||
|  |  | ||||||
|             self.assertDictMatch(nw, check) |             self.assertDictMatch(nw, check) | ||||||
|  |  | ||||||
|             check = {'broadcast': '192.168.%d.255' % i, |             check = {'broadcast': '192.168.%d.255' % nid, | ||||||
|                      'dhcp_server': '192.168.%d.1' % i, |                      'dhcp_server': '192.168.%d.1' % nid, | ||||||
|                      'dns': 'DONTCARE', |                      'dns': ['192.168.%d.3' % nid, '192.168.%d.4' % nid], | ||||||
|                      'gateway': '192.168.%d.1' % i, |                      'gateway': '192.168.%d.1' % nid, | ||||||
|                      'gateway_v6': 'DONTCARE', |                      'gateway_v6': 'fe80::def', | ||||||
|                      'ip6s': 'DONTCARE', |                      'ip6s': 'DONTCARE', | ||||||
|                      'ips': 'DONTCARE', |                      'ips': 'DONTCARE', | ||||||
|                      'label': 'test%d' % i, |                      'label': 'test%d' % nid, | ||||||
|                      'mac': 'DE:AD:BE:EF:00:%02x' % i, |                      'mac': 'DE:AD:BE:EF:00:%02x' % nid, | ||||||
|                      'vif_uuid': |  | ||||||
|                         '00000000-0000-0000-0000-00000000000000%02d' % i, |  | ||||||
|                      'rxtx_cap': 0, |                      'rxtx_cap': 0, | ||||||
|  |                      'vif_uuid': | ||||||
|  |                         '00000000-0000-0000-0000-00000000000000%02d' % nid, | ||||||
|                      'should_create_vlan': False, |                      'should_create_vlan': False, | ||||||
|                      'should_create_bridge': False} |                      'should_create_bridge': False} | ||||||
|             self.assertDictMatch(info, check) |             self.assertDictMatch(info, check) | ||||||
|  |  | ||||||
|             check = [{'enabled': 'DONTCARE', |             check = [{'enabled': 'DONTCARE', | ||||||
|                       'ip': 'DONTCARE', |                       'ip': '2001:db8:0:1::%x' % nid, | ||||||
|                       'gateway': 'DONTCARE', |                       'netmask': 64, | ||||||
|                       'netmask': 64}] |                       'gateway': 'fe80::def'}] | ||||||
|             self.assertDictListMatch(info['ip6s'], check) |             self.assertDictListMatch(info['ip6s'], check) | ||||||
|  |  | ||||||
|             num_fixed_ips = len(info['ips']) |             num_fixed_ips = len(info['ips']) | ||||||
|             check = [{'enabled': 'DONTCARE', |             check = [{'enabled': 'DONTCARE', | ||||||
|                       'ip': '192.168.%d.1%02d' % (i, ip_num), |                       'ip': '192.168.%d.%03d' % (nid, ip_num + 99), | ||||||
|                       'gateway': 'DONTCARE', |                       'netmask': '255.255.255.0', | ||||||
|                       'netmask': '255.255.255.0'} |                       'gateway': '192.168.%d.1' % nid} | ||||||
|                       for ip_num in xrange(num_fixed_ips)] |                       for ip_num in xrange(1, num_fixed_ips + 1)] | ||||||
|             self.assertDictListMatch(info['ips'], check) |             self.assertDictListMatch(info['ips'], check) | ||||||
|  |  | ||||||
|     def test_validate_networks(self): |     def test_validate_networks(self): | ||||||
|   | |||||||
| @@ -301,7 +301,8 @@ class QuantumManagerTestCase(QuantumNovaTestCase): | |||||||
|  |  | ||||||
|         nw_info = self.net_man.get_instance_nw_info(ctx, instance_ref['id'], |         nw_info = self.net_man.get_instance_nw_info(ctx, instance_ref['id'], | ||||||
|                                 instance_ref['uuid'], |                                 instance_ref['uuid'], | ||||||
|                                 instance_ref['instance_type_id'], "") |                                 instance_ref['instance_type_id'], "", | ||||||
|  |                                 project_id=project_id) | ||||||
|  |  | ||||||
|         self._check_vifs(len(nw_info)) |         self._check_vifs(len(nw_info)) | ||||||
|         self._validate_nw_info(nw_info, expected_labels) |         self._validate_nw_info(nw_info, expected_labels) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Trey Morris
					Trey Morris