migration gateway_v6 to network_info
This commit is contained in:
		| @@ -785,7 +785,8 @@ class NWFilterTestCase(test.TestCase): | |||||||
|  |  | ||||||
|         instance_ref = db.instance_create(self.context, |         instance_ref = db.instance_create(self.context, | ||||||
|                                           {'user_id': 'fake', |                                           {'user_id': 'fake', | ||||||
|                                           'project_id': 'fake'}) |                                           'project_id': 'fake', | ||||||
|  |                                           'mac_address': '00:A0:C9:14:C8:29'}) | ||||||
|         inst_id = instance_ref['id'] |         inst_id = instance_ref['id'] | ||||||
|  |  | ||||||
|         ip = '10.11.12.13' |         ip = '10.11.12.13' | ||||||
|   | |||||||
| @@ -309,11 +309,15 @@ def  get_my_linklocal(interface): | |||||||
|  |  | ||||||
|  |  | ||||||
| def to_global_ipv6(prefix, mac): | def to_global_ipv6(prefix, mac): | ||||||
|  |     try: | ||||||
|         mac64 = netaddr.EUI(mac).eui64().words |         mac64 = netaddr.EUI(mac).eui64().words | ||||||
|         int_addr = int(''.join(['%02x' % i for i in mac64]), 16) |         int_addr = int(''.join(['%02x' % i for i in mac64]), 16) | ||||||
|         mac64_addr = netaddr.IPAddress(int_addr) |         mac64_addr = netaddr.IPAddress(int_addr) | ||||||
|         maskIP = netaddr.IPNetwork(prefix).ip |         maskIP = netaddr.IPNetwork(prefix).ip | ||||||
|     return (mac64_addr ^ netaddr.IPAddress('::0200:0:0:0') | maskIP).format() |         return (mac64_addr ^ netaddr.IPAddress('::0200:0:0:0') | maskIP).\ | ||||||
|  |         format() | ||||||
|  |     except TypeError: | ||||||
|  |         raise TypeError(_("Bad mac for to_global_ipv6: %s" % mac)) | ||||||
|  |  | ||||||
|  |  | ||||||
| def to_mac(ipv6_address): | def to_mac(ipv6_address): | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Eldar Nugaev
					Eldar Nugaev