MCPcopy Create free account
hub / github.com/apache/cloudstack / ipv6_link_local_addr

Function ipv6_link_local_addr

scripts/vm/network/security_group.py:127–131  ·  view source on GitHub ↗
(mac=None)

Source from the content-addressed store, hash-verified

125
126
127def ipv6_link_local_addr(mac=None):
128 eui64 = re.sub(r'[.:-]', '', mac).lower()
129 eui64 = eui64[0:6] + 'fffe' + eui64[6:]
130 eui64 = hex(int(eui64[0:2], 16) ^ 2)[2:].zfill(2) + eui64[2:]
131 return ipaddress.ip_address('fe80::' + ':'.join(re.findall(r'.{4}', eui64)))
132
133
134def split_ips_by_family(ips):

Callers 1

default_network_rulesFunction · 0.85

Calls 3

intFunction · 0.85
findallMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected