Esempio n. 1
0
 def _validate_cidrs(self, cidrs):
     """Ensure valid IPv4/6 CIDRs."""
     for cidr in cidrs:
         msg = attributes._validate_subnet(cidr)
         if msg:
             raise vpnaas.InvalidEndpointInEndpointGroup(
                 group_type=constants.CIDR_ENDPOINT,
                 endpoint=cidr,
                 why=_("Invalid CIDR"))
Esempio n. 2
0
 def _validate_subnets(self, context, subnet_ids):
     """Ensure UUIDs OK and subnets exist."""
     for subnet_id in subnet_ids:
         msg = attributes._validate_uuid(subnet_id)
         if msg:
             raise vpnaas.InvalidEndpointInEndpointGroup(
                 group_type=constants.SUBNET_ENDPOINT,
                 endpoint=subnet_id,
                 why=_('Invalid UUID'))
         try:
             self.core_plugin.get_subnet(context, subnet_id)
         except nexception.SubnetNotFound:
             raise vpnaas.NonExistingSubnetInEndpointGroup(subnet=subnet_id)