'Check IP field of a subnet match specified ip version.'

def _validate_ip_version(self, ip_version, addr, name):

    ip = netaddr.IPNetwork(addr)
    if (ip.version != ip_version):
        data = {'name': name, 'addr': addr, 'ip_version': ip_version}
        msg = (_("%(name)s    '%(addr)s'    does    not    match    the    ip_version    '%(ip_version)s'") % data)
        raise exc.InvalidInput(error_message=msg)
