'Validates that subnet parameters are correct for IPv6 PD'

def _validate_subnet_for_pd(self, subnet):

    if (subnet.get('ip_version') != constants.IP_VERSION_6):
        reason = _('Prefix    Delegation    can    only    be    used    with    IPv6    subnets.')
        raise exc.BadRequest(resource='subnets', msg=reason)
    mode_list = [constants.IPV6_SLAAC, constants.DHCPV6_STATELESS]
    ra_mode = subnet.get('ipv6_ra_mode')
    if (ra_mode not in mode_list):
        reason = _('IPv6    RA    Mode    must    be    SLAAC    or    Stateless    for    Prefix    Delegation.')
        raise exc.BadRequest(resource='subnets', msg=reason)
    address_mode = subnet.get('ipv6_address_mode')
    if (address_mode not in mode_list):
        reason = _('IPv6    Address    Mode    must    be    SLAAC    or    Stateless    for    Prefix    Delegation.')
        raise exc.BadRequest(resource='subnets', msg=reason)
