summaryrefslogtreecommitdiffstats
path: root/nova/utils.py
diff options
context:
space:
mode:
authorJohannes Erdfelt <johannes.erdfelt@rackspace.com>2011-05-16 20:25:28 +0000
committerTarmac <>2011-05-16 20:25:28 +0000
commit87577ceb58ff7fa96b992b504559eeb2022ffa41 (patch)
treeb480c094688bd6b5a4967b8dc3c69b04d09b0e5b /nova/utils.py
parent76b0630b77b528a37a37b44d4c456f2c9ebea160 (diff)
parent3d1cef9e56d7fac8a1b89861b7443e4ca660e4a8 (diff)
downloadnova-87577ceb58ff7fa96b992b504559eeb2022ffa41.tar.gz
nova-87577ceb58ff7fa96b992b504559eeb2022ffa41.tar.xz
nova-87577ceb58ff7fa96b992b504559eeb2022ffa41.zip
This branch splits out the IPv6 address generation into pluggable backends. A new flag named ipv6_backend specifies which backend to use.
The existing code (which is also the default) is now available as nova.ipv6.rfc2462 while a new backend available as nova.ipv6.account_identifier implements an algorithm that includes an account identifier as part of the address.
Diffstat (limited to 'nova/utils.py')
-rw-r--r--nova/utils.py20
1 files changed, 0 insertions, 20 deletions
diff --git a/nova/utils.py b/nova/utils.py
index 0c469b1de..361fc9873 100644
--- a/nova/utils.py
+++ b/nova/utils.py
@@ -306,26 +306,6 @@ def get_my_linklocal(interface):
" :%(ex)s") % locals())
-def to_global_ipv6(prefix, mac):
- try:
- mac64 = netaddr.EUI(mac).eui64().words
- int_addr = int(''.join(['%02x' % i for i in mac64]), 16)
- mac64_addr = netaddr.IPAddress(int_addr)
- maskIP = netaddr.IPNetwork(prefix).ip
- 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):
- address = netaddr.IPAddress(ipv6_address)
- mask1 = netaddr.IPAddress('::ffff:ffff:ffff:ffff')
- mask2 = netaddr.IPAddress('::0200:0:0:0')
- mac64 = netaddr.EUI(int(address & mask1 ^ mask2)).words
- return ':'.join(['%02x' % i for i in mac64[0:3] + mac64[5:8]])
-
-
def utcnow():
"""Overridable version of datetime.datetime.utcnow."""
if utcnow.override_time: