use of org.onap.so.serviceinstancebeans.ServiceInstancesRequest in project so by onap.
the class BpmnRequestBuilder method createServiceInstancesRequest.
protected ServiceInstancesRequest createServiceInstancesRequest(GenericVnf vnf, VolumeGroup volumeGroup) {
ServiceInstancesRequest request = new ServiceInstancesRequest();
RequestDetails requestDetails = mapRequestDetails(vnf, volumeGroup);
request.setRequestDetails(requestDetails);
return request;
}
use of org.onap.so.serviceinstancebeans.ServiceInstancesRequest in project so by onap.
the class BpmnRequestBuilder method createServiceInstancesRequest.
protected ServiceInstancesRequest createServiceInstancesRequest(GenericVnf vnf, VfModule vfModule, ModelType modelType) {
ServiceInstancesRequest request = new ServiceInstancesRequest();
RequestDetails requestDetails = mapRequestDetails(vnf, vfModule, modelType);
request.setRequestDetails(requestDetails);
return request;
}
use of org.onap.so.serviceinstancebeans.ServiceInstancesRequest in project so by onap.
the class BpmnRequestBuilder method mapCloudConfigurationNetwork.
public CloudConfiguration mapCloudConfigurationNetwork(L3Network network) {
CloudConfiguration cloudConfig = new CloudConfiguration();
String tenantId = null;
String cloudOwner = null;
String lcpRegionId = null;
Map<String, String[]> filters = createQueryRequest("networkId", network.getNetworkId());
Optional<ServiceInstancesRequest> request = findServiceInstanceRequest(filters);
if (request.isPresent()) {
if (request.get().getRequestDetails() != null && request.get().getRequestDetails().getCloudConfiguration() != null) {
if (request.get().getRequestDetails().getCloudConfiguration().getTenantId() != null) {
tenantId = request.get().getRequestDetails().getCloudConfiguration().getTenantId();
}
if (request.get().getRequestDetails().getCloudConfiguration().getCloudOwner() != null) {
cloudOwner = request.get().getRequestDetails().getCloudConfiguration().getCloudOwner();
}
if (request.get().getRequestDetails().getCloudConfiguration().getLcpCloudRegionId() != null) {
lcpRegionId = request.get().getRequestDetails().getCloudConfiguration().getLcpCloudRegionId();
}
}
} else {
throw new CloudConfigurationNotFoundException(CLOUD_CONFIGURATION_COULD_NOT_BE_FOUND);
}
cloudConfig.setTenantId(tenantId);
cloudConfig.setCloudOwner(cloudOwner);
cloudConfig.setLcpCloudRegionId(lcpRegionId);
return cloudConfig;
}
use of org.onap.so.serviceinstancebeans.ServiceInstancesRequest in project so by onap.
the class ServiceInstance method deleteServiceInstance.
@DELETE
@ResponseUpdater
@Path("/{version:[vV][8]}/serviceInstances/{serviceInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@Operation(description = "Delete a Service instance", responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = ServiceInstancesResponse.class)))))
@Transactional
public Response deleteServiceInstance(@PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext) throws AAIEntityNotFound, NoRecipeException, JsonProcessingException, WorkflowEngineConnectionException, ValidateException {
String requestId = requestHandler.getRequestId(requestContext);
String requestorId = MDC.get(HttpHeadersConstants.REQUESTOR_ID);
String source = MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME);
String requestURI = requestContext.getUriInfo().getAbsolutePath().toString();
InfraActiveRequests currentRequest = requestHandler.createInfraActiveRequestForDelete(requestId, serviceInstanceId, requestorId, source, requestURI);
ServiceInstancesRequest request = requestBuilder.buildServiceDeleteRequest(serviceInstanceId);
requestHandler.saveInstanceName(request, currentRequest);
requestHandler.checkDuplicateRequest(serviceInstanceId, request.getRequestDetails().getRequestInfo().getInstanceName(), currentRequest.getRequestId());
Recipe recipe = requestHandler.findServiceRecipe(request.getRequestDetails().getModelInfo().getModelUuid(), Action.deleteInstance.toString());
requestHandler.callWorkflowEngine(requestHandler.buildRequestParams(request, requestHandler.getRequestUri(requestContext), requestId, serviceInstanceId), recipe.getOrchestrationUri());
ServiceInstancesResponse response = requestHandler.createResponse(serviceInstanceId, requestId, requestContext);
return Response.status(HttpStatus.ACCEPTED.value()).entity(response).build();
}
use of org.onap.so.serviceinstancebeans.ServiceInstancesRequest in project so by onap.
the class Network method deleteNetworkInstance.
@DELETE
@ResponseUpdater
@Path("/{version:[vV][8]}/serviceInstances/{serviceInstanceId}/networks/{networkInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@Operation(description = "Delete provided Network instance", responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response deleteNetworkInstance(@PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("networkInstanceId") String networkInstanceId, @Context ContainerRequestContext requestContext) throws AAIEntityNotFound, NoRecipeException, JsonProcessingException, WorkflowEngineConnectionException, ValidateException {
String requestId = networkRestHandler.getRequestId(requestContext);
String requestorId = MDC.get(HttpHeadersConstants.REQUESTOR_ID);
String source = MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME);
String requestURI = requestContext.getUriInfo().getAbsolutePath().toString();
InfraActiveRequests currentRequest = networkRestHandler.createInfraActiveRequestForDelete(requestId, serviceInstanceId, networkInstanceId, requestorId, source, requestURI);
ServiceInstancesRequest request = requestBuilder.buildNetworkDeleteRequest(networkInstanceId);
networkRestHandler.saveInstanceName(request, currentRequest);
networkRestHandler.checkDuplicateRequest(serviceInstanceId, networkInstanceId, request.getRequestDetails().getRequestInfo().getInstanceName(), currentRequest.getRequestId());
Recipe recipe = networkRestHandler.findNetworkRecipe(Action.deleteInstance.toString());
networkRestHandler.callWorkflowEngine(networkRestHandler.buildRequestParams(request, networkRestHandler.getRequestUri(requestContext), requestId, serviceInstanceId, networkInstanceId), recipe.getOrchestrationUri());
ServiceInstancesResponse response = networkRestHandler.createResponse(networkInstanceId, requestId, requestContext);
return Response.status(HttpStatus.ACCEPTED.value()).entity(response).build();
}
Aggregations