Exemple #1
0
 def create_endpoint_group(self, context, endpoint_group):
     group = endpoint_group['endpoint_group']
     validator = self._get_validator()
     with db_api.CONTEXT_WRITER.using(context):
         validator.validate_endpoint_group(context, group)
         endpoint_group_db = vpn_models.VPNEndpointGroup(
             id=uuidutils.generate_uuid(),
             tenant_id=group['tenant_id'],
             name=group['name'],
             description=group['description'],
             endpoint_type=group['type'])
         context.session.add(endpoint_group_db)
         for endpoint in group['endpoints']:
             endpoint_db = vpn_models.VPNEndpoint(
                 endpoint=endpoint, endpoint_group_id=endpoint_group_db.id)
             context.session.add(endpoint_db)
     return self._make_endpoint_group_dict(endpoint_group_db)
Exemple #2
0
 def create_endpoint_group(self, context, endpoint_group):
     group = endpoint_group['endpoint_group']
     validator = self._get_validator()
     with context.session.begin(subtransactions=True):
         validator.validate_endpoint_group(context, group)
         endpoint_group_db = vpn_models.VPNEndpointGroup(
             id=uuidutils.generate_uuid(),
             tenant_id=group['tenant_id'],
             name=group['name'],
             description=group['description'],
             endpoint_type=group['type'])
         context.session.add(endpoint_group_db)
         for endpoint in group['endpoints']:
             endpoint_db = vpn_models.VPNEndpoint(
                 endpoint=endpoint,
                 endpoint_group_id=endpoint_group_db['id'])
             context.session.add(endpoint_db)
     return self._make_endpoint_group_dict(endpoint_group_db)