'Check that a valid cidr was specified as remote_ip_prefix
No need to check that it is in fact an IP address as this is already
validated by attribute validators.
Check that rule ethertype is consistent with remote_ip_prefix ip type.
Add mask to ip_prefix if absent (192.168.1.10 -> 192.168.1.10/32).'

def _validate_ip_prefix(self, rule):

    input_prefix = rule['remote_ip_prefix']
    if input_prefix:
        addr = netaddr.IPNetwork(input_prefix)
        rule['remote_ip_prefix'] = str(addr)
        if (rule['ethertype'] != ('IPv%d' % addr.version)):
            raise ext_sg.SecurityGroupRuleParameterConflict(ethertype=rule['ethertype'], cidr=input_prefix)
