@removals.remove(message='use get_ipv6_addr_by_EUI64 from oslo_utils.netutils', version='Newton', removal_version='Ocata')
def get_ipv6_addr_by_EUI64(cidr, mac):
 is_ipv4 = netutils.is_valid_ipv4(cidr)
 if is_ipv4:
  msg = 'Unable to generate IP address by EUI64 for IPv4 prefix'
  raise TypeError(msg)
 try:
  eui64 = int(netaddr.EUI(mac).eui64())
  prefix = netaddr.IPNetwork(cidr)
  return netaddr.IPAddress(((prefix.first + eui64) ^ (1 << 57)))
 except (ValueError, netaddr.AddrFormatError):
  raise TypeError(('Bad prefix or mac format for generating IPv6 address by EUI-64: %(prefix)s, %(mac)s:' % {'prefix': cidr, 'mac': mac}))
 except TypeError:
  raise TypeError(('Bad prefix type for generate IPv6 address by EUI-64: %s' % cidr))

@ removals . remove ( message = 'use get_ipv6_addr_by_EUI64 from oslo_utils.netutils' , version = 'Newton' , removal_version = 'Ocata' ) def get_ipv6_addr_by_EUI64 ( cidr , mac ) : is_ipv4 = netutils . is_valid_ipv4 ( cidr ) if is_ipv4 : msg = 'Unable to generate IP address by EUI64 for IPv4 prefix' raise TypeError ( msg ) try : eui64 = int ( netaddr . EUI ( mac ) . eui64 ( ) ) prefix = netaddr . IPNetwork ( cidr ) return netaddr . IPAddress ( ( ( prefix . first + eui64 ) ^ ( 1 << 57 ) ) ) except ( ValueError , netaddr . AddrFormatError ) : raise TypeError ( ( 'Bad prefix or mac format for generating IPv6 address by EUI-64: %(prefix)s, %(mac)s:' % { 'prefix' : cidr , 'mac' : mac } ) ) except TypeError : raise TypeError ( ( 'Bad prefix type for generate IPv6 address by EUI-64: %s' % cidr ) )
generate a ipv6 addr by eui-64 with cidr and mac .