diff options
23 files changed, 344 insertions, 168 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java index 14d83b3b06..35008b6120 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java @@ -84,7 +84,7 @@ public class AuditVServer extends AbstractAudit { try { logger.debug("Vserver to Audit: {}", objectMapper.getMapper().writeValueAsString(vserver)); } catch (JsonProcessingException e) { - logger.error("Json parse exception: {}", e.getMessage()); + logger.error("Json parse exception: ", e); } }); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java index afc227faf0..013c7f8a84 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java @@ -91,6 +91,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { private static final String CREATE_NETWORK_CONTEXT = "CreateNetwork"; private static final String NEUTRON_MODE = "NEUTRON"; private static final String CLOUD_OWNER = "CloudOwner"; + private static final String LOG_DEBUG_MSG = "Got Network definition from Catalog: {}"; private static final Logger logger = LoggerFactory.getLogger(MsoNetworkAdapterImpl.class); @@ -292,7 +293,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { throw new NetworkException(error, MsoExceptionCategory.INTERNAL); } - logger.debug("Got HEAT Template from DB: {}", heatTemplate.toString()); + logger.debug("Got HEAT Template from DB: {}", heatTemplate); // "Fix" the template if it has CR/LF (getting this from Oracle) String template = heatTemplate.getHeatTemplate(); @@ -656,7 +657,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { throw new NetworkException(error, MsoExceptionCategory.INTERNAL); } - logger.debug("Got HEAT Template from DB: {}", heatTemplate.toString()); + logger.debug("Got HEAT Template from DB: {}", heatTemplate); // "Fix" the template if it has CR/LF (getting this from Oracle) String template = heatTemplate.getHeatTemplate(); @@ -798,12 +799,11 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } } if (networkCust != null) { - logger.debug("Got Network Customization definition from Catalog: {}", networkCust.toString()); + logger.debug("Got Network Customization definition from Catalog: {}", networkCust); networkResource = networkCust.getNetworkResource(); } else if (collectionNetworkCust != null) { - logger.debug("Retrieved Collection Network Resource Customization from Catalog: {}", - collectionNetworkCust.toString()); + logger.debug("Retrieved Collection Network Resource Customization from Catalog: {}", collectionNetworkCust); networkResource = collectionNetworkCust.getNetworkResource(); } if (networkResource == null) { @@ -814,7 +814,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { throw new NetworkException(error, MsoExceptionCategory.USERDATA); } - logger.debug("Got Network definition from Catalog: {}", networkResource.toString()); + logger.debug(LOG_DEBUG_MSG, networkResource); String mode = networkResource.getOrchestrationMode(); NetworkType neutronNetworkType = NetworkType.valueOf(networkResource.getNeutronNetworkType()); @@ -1045,7 +1045,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } String mode = ""; if (networkResource != null) { - logger.debug("Got Network definition from Catalog: {}", networkResource.toString()); + logger.debug(LOG_DEBUG_MSG, networkResource); mode = networkResource.getOrchestrationMode(); } @@ -1132,7 +1132,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { String mode = ""; if (networkResource != null) { - logger.debug("Got Network definition from Catalog: {}", networkResource.toString()); + logger.debug(LOG_DEBUG_MSG, networkResource); mode = networkResource.getOrchestrationMode(); } @@ -1388,9 +1388,9 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { // Resource Property List<ContrailSubnet> cslist = new ArrayList<>(); for (Subnet subnet : subnets) { - logger.debug("Input Subnet:{}", subnet.toString()); + logger.debug("Input Subnet:{}", subnet); ContrailSubnet cs = new ContrailSubnetMapper(subnet).map(); - logger.debug("Contrail Subnet:{}", cs.toString()); + logger.debug("Contrail Subnet:{}", cs); cslist.add(cs); } @@ -1523,18 +1523,17 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { JsonNode rootNode = mapper.readTree(jStr); if (rootNode != null) { for (JsonNode sNode : rootNode.path("ipam_subnets")) { - logger.debug("Output Subnet Node {}", sNode.toString()); + logger.debug("Output Subnet Node {}", sNode); String name = sNode.path("subnet_name").textValue(); String uuid = sNode.path("subnet_uuid").textValue(); String aaiId = name; // default // try to find aaiId for name in input subnetList if (subnets != null) { for (Subnet subnet : subnets) { - if (subnet != null && !commonUtils.isNullOrEmpty(subnet.getSubnetName())) { - if (subnet.getSubnetName().equals(name)) { - aaiId = subnet.getSubnetId(); - break; - } + if (subnet != null && !commonUtils.isNullOrEmpty(subnet.getSubnetName()) + && subnet.getSubnetName().equals(name)) { + aaiId = subnet.getSubnetId(); + break; } } } @@ -1549,7 +1548,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { ErrorCode.DataError.getValue(), e); } - logger.debug("Return sMap {}", sMap.toString()); + logger.debug("Return sMap {}", sMap); return sMap; } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java index 10fd55abbb..e8e068a71a 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java @@ -26,6 +26,7 @@ package org.onap.so.asdc.installer.heat; import java.sql.Timestamp; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.Date; import java.util.HashMap; @@ -580,7 +581,8 @@ public class ToscaResourceInstaller { String outInput; String defaultValue = null; if (value instanceof Map) { - outInput = ((LinkedHashMap) value).values().toArray()[0].toString(); + Collection values = ((LinkedHashMap) value).values(); + outInput = (values.size() > 0) ? values.toArray()[0].toString() : ""; } else if (value instanceof GetInput) { String inputName = ((GetInput) value).getInputName(); Optional<Input> inputOptional = diff --git a/mso-api-handlers/mso-api-handler-infra/pom.xml b/mso-api-handlers/mso-api-handler-infra/pom.xml index a3b9827d9f..bb726e68aa 100644 --- a/mso-api-handlers/mso-api-handler-infra/pom.xml +++ b/mso-api-handlers/mso-api-handler-infra/pom.xml @@ -18,7 +18,7 @@ <camunda.bpm.assert.version>1.2</camunda.bpm.assert.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> - <swagger-version>1.3.0</swagger-version> + <swagger.version>2.0.8</swagger.version> <jax-rs-version>1.1.1</jax-rs-version> <json4s-jackson-version>3.6.0</json4s-jackson-version> <json4s-core-version>3.6.0</json4s-core-version> @@ -56,10 +56,16 @@ <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> + + <dependency> + <groupId>io.swagger.core.v3</groupId> + <artifactId>swagger-annotations</artifactId> + <version>${swagger.version}</version> + </dependency> <dependency> - <groupId>io.swagger</groupId> - <artifactId>swagger-jersey2-jaxrs</artifactId> - <version>1.5.16</version> + <groupId>io.swagger.core.v3</groupId> + <artifactId>swagger-jaxrs2</artifactId> + <version>2.0.6</version> </dependency> <dependency> <groupId>com.h2database</groupId> diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java index d3a279fd8e..650922094d 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java @@ -76,13 +76,19 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.fasterxml.jackson.databind.ObjectMapper; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; - +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.info.Info; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; @Component @Path("/onap/so/infra/e2eServiceInstances") -@Api(value = "/onap/so/infra/e2eServiceInstances", description = "API Requests for E2E Service Instances") +@OpenAPIDefinition(info = @Info(title = "/onap/so/infra/e2eServiceInstances", + description = "API Requests for E2E Service Instances")) + public class E2EServiceInstances { private HashMap<String, String> instanceIdMap = new HashMap<>(); @@ -119,7 +125,8 @@ public class E2EServiceInstances { @Path("/{version:[vV][3-5]}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Create an E2E Service Instance on a version provided", response = Response.class) + @Operation(description = "Create an E2E Service Instance on a version provided", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) public Response createE2EServiceInstance(String request, @PathParam("version") String version) throws ApiException { return processE2EserviceInstances(request, Action.createInstance, null, version); @@ -135,8 +142,9 @@ public class E2EServiceInstances { @Path("/{version:[vV][3-5]}/{serviceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Update an E2E Service Instance on a version provided and serviceId", - response = Response.class) + @Operation(description = "Update an E2E Service Instance on a version provided and serviceId", + responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) public Response updateE2EServiceInstance(String request, @PathParam("version") String version, @PathParam("serviceId") String serviceId) throws ApiException { @@ -155,7 +163,9 @@ public class E2EServiceInstances { @Path("/{version:[vV][3-5]}/{serviceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Delete E2E Service Instance on a specified version and serviceId", response = Response.class) + @Operation(description = "Delete E2E Service Instance on a specified version and serviceId", + responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) public Response deleteE2EServiceInstance(String request, @PathParam("version") String version, @PathParam(SERVICE_ID) String serviceId) throws ApiException { @@ -166,8 +176,9 @@ public class E2EServiceInstances { @GET @Path("/{version:[vV][3-5]}/{serviceId}/operations/{operationId}") - @ApiOperation(value = "Find e2eServiceInstances Requests for a given serviceId and operationId", - response = Response.class) + @Operation(description = "Find e2eServiceInstances Requests for a given serviceId and operationId", + responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Produces(MediaType.APPLICATION_JSON) public Response getE2EServiceInstances(@PathParam(SERVICE_ID) String serviceId, @PathParam("version") String version, @PathParam("operationId") String operationId) { @@ -184,7 +195,8 @@ public class E2EServiceInstances { @Path("/{version:[vV][3-5]}/{serviceId}/scale") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Scale E2E Service Instance on a specified version", response = Response.class) + @Operation(description = "Scale E2E Service Instance on a specified version", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) public Response scaleE2EServiceInstance(String request, @PathParam("version") String version, @PathParam(SERVICE_ID) String serviceId) throws ApiException { @@ -203,9 +215,10 @@ public class E2EServiceInstances { @Path("/{version:[vV][3-5]}/{serviceId}/modeldifferences") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - value = "Find added and deleted resources of target model for the e2eserviceInstance on a given serviceId ", - response = Response.class) + @Operation( + description = "Find added and deleted resources of target model for the e2eserviceInstance on a given serviceId ", + responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) public Response compareModelwithTargetVersion(String request, @PathParam("serviceId") String serviceId, @PathParam("version") String version) throws ApiException { diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java index 0379ae3578..5327211280 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java @@ -53,13 +53,18 @@ import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Component; import org.springframework.web.client.RestTemplate; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.info.Info; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; @Component @Path("/globalhealthcheck") -@Api(value = "/globalhealthcheck", description = "APIH Infra Global Health Check") +@OpenAPIDefinition(info = @Info(title = "/globalhealthcheck", description = "APIH Infra Global Health Check")) public class GlobalHealthcheckHandler { private static Logger logger = LoggerFactory.getLogger(GlobalHealthcheckHandler.class); protected static final String CONTEXTPATH_PROPERTY = "management.endpoints.web.base-path"; @@ -98,7 +103,8 @@ public class GlobalHealthcheckHandler { @GET @Produces("application/json") - @ApiOperation(value = "Performing global health check", response = Response.class) + @Operation(description = "Performing global health check", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response globalHealthcheck(@DefaultValue("true") @QueryParam("enableBpmn") boolean enableBpmn, @Context ContainerRequestContext requestContext) { diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java index 15572f2b39..d3bd769386 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java @@ -23,8 +23,6 @@ package org.onap.so.apihandlerinfra; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; import org.apache.http.HttpStatus; import org.onap.so.apihandler.common.ErrorNumbers; import org.onap.so.apihandler.common.RequestClientParameter; @@ -61,10 +59,18 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.io.IOException; import java.util.HashMap; +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.info.Info; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; @Component @Path("/onap/so/infra/instanceManagement") -@Api(value = "/onap/so/infra/instanceManagement", description = "Infrastructure API Requests for Instance Management") +@OpenAPIDefinition(info = @Info(title = "/onap/so/infra/instanceManagement", + description = "Infrastructure API Requests for Instance Management")) public class InstanceManagement { private static Logger logger = LoggerFactory.getLogger(InstanceManagement.class); @@ -87,7 +93,8 @@ public class InstanceManagement { @Path("/{version:[vV][1]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/workflows/{workflowUuid}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Execute custom workflow", response = Response.class) + @Operation(description = "Execute custom workflow", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response executeCustomWorkflow(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java index e162a67680..2703e1edd3 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java @@ -20,8 +20,12 @@ package org.onap.so.apihandlerinfra; +import java.util.stream.Collectors; +import java.util.stream.Stream; import javax.annotation.PostConstruct; +import javax.servlet.ServletConfig; import javax.ws.rs.ApplicationPath; +import javax.ws.rs.core.Context; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.servlet.ServletProperties; import org.onap.so.apihandler.filters.RequestIdFilter; @@ -42,9 +46,13 @@ import org.onap.so.apihandlerinfra.tenantisolation.ModelDistributionRequest; import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging; import org.onap.so.web.exceptions.RuntimeExceptionMapper; import org.springframework.context.annotation.Configuration; -import io.swagger.jaxrs.config.BeanConfig; -import io.swagger.jaxrs.listing.ApiListingResource; -import io.swagger.jaxrs.listing.SwaggerSerializers; +import io.swagger.v3.jaxrs2.integration.JaxrsOpenApiContextBuilder; +import io.swagger.v3.jaxrs2.integration.resources.AcceptHeaderOpenApiResource; +import io.swagger.v3.jaxrs2.integration.resources.OpenApiResource; +import io.swagger.v3.oas.integration.OpenApiConfigurationException; +import io.swagger.v3.oas.integration.SwaggerConfiguration; +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.info.Info; @Configuration @ApplicationPath("/") @@ -67,8 +75,8 @@ public class JerseyConfiguration extends ResourceConfig { register(JaxRsFilterLogging.class); register(ManualTasks.class); register(TasksHandler.class); - register(ApiListingResource.class); - register(SwaggerSerializers.class); + register(OpenApiResource.class); + register(AcceptHeaderOpenApiResource.class); register(ApiExceptionMapper.class); register(RuntimeExceptionMapper.class); register(RequestIdFilter.class); @@ -86,12 +94,21 @@ public class JerseyConfiguration extends ResourceConfig { register(com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider.class); register(ModelDistributionRequest.class); property(ServletProperties.FILTER_FORWARD_ON_404, true); - BeanConfig beanConfig = new BeanConfig(); - beanConfig.setVersion("1.0.2"); - beanConfig.setSchemes(new String[] {"https"}); - beanConfig.setResourcePackage("org.onap.so.apihandlerinfra"); - beanConfig.setPrettyPrint(true); - beanConfig.setScan(true); + + OpenAPI oas = new OpenAPI(); + Info info = new Info(); + info.title("Swagger apihandlerinfra bootstrap code"); + info.setVersion("1.0.2"); + + SwaggerConfiguration oasConfig = new SwaggerConfiguration().openAPI(oas).prettyPrint(true) + .resourcePackages(Stream.of("org.onap.so.apihandlerinfra").collect(Collectors.toSet())); + + try { + new JaxrsOpenApiContextBuilder().application(this).openApiConfiguration(oasConfig).buildContext(true); + } catch (OpenApiConfigurationException e) { + throw new RuntimeException(e.getMessage(), e); + } + } } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java index b9b7fcc0d4..4bafb40b32 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java @@ -34,7 +34,6 @@ import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import org.onap.so.logger.LoggingAnchor; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.onap.so.apihandler.common.ErrorNumbers; @@ -52,6 +51,7 @@ import org.onap.so.apihandlerinfra.tasksbeans.Value; import org.onap.so.apihandlerinfra.tasksbeans.Variables; import org.onap.so.exceptions.ValidationException; import org.onap.so.logger.ErrorCode; +import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -60,8 +60,11 @@ import org.springframework.stereotype.Component; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; -import io.swagger.annotations.ApiOperation; - +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; @Path("/tasks") @Component @@ -85,7 +88,8 @@ public class ManualTasks { @Path("/{version:[vV]1}/{taskId}/complete") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Complete specified task", response = Response.class) + @Operation(description = "Complete specified task", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response completeTask(String request, @PathParam("version") String version, @PathParam("taskId") String taskId, @Context ContainerRequestContext requestContext) throws ApiException { diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/NodeHealthcheckHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/NodeHealthcheckHandler.java index 3337c62afd..e56ee24baf 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/NodeHealthcheckHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/NodeHealthcheckHandler.java @@ -22,7 +22,19 @@ package org.onap.so.apihandlerinfra; -import java.net.UnknownHostException; +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.info.Info; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import org.apache.http.HttpStatus; +import org.onap.so.logger.LoggingAnchor; +import org.onap.so.logger.MessageEnum; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; import javax.transaction.Transactional; import javax.ws.rs.GET; import javax.ws.rs.Path; @@ -30,17 +42,10 @@ import javax.ws.rs.Produces; import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; -import org.onap.so.logger.LoggingAnchor; -import org.apache.http.HttpStatus; -import org.onap.so.logger.MessageEnum; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; +import java.net.UnknownHostException; @Path("/nodehealthcheck") -@Api(value = "/nodehealthcheck", description = "API Handler Infra Node Health Check") +@OpenAPIDefinition(info = @Info(title = "/nodehealthcheck", description = "API Handler Infra Node Health Check")) @Component public class NodeHealthcheckHandler { @@ -53,7 +58,8 @@ public class NodeHealthcheckHandler { @GET @Produces("text/html") - @ApiOperation(value = "Performing node health check", response = Response.class) + @Operation(description = "Performing node health check", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response nodeHealthcheck(@Context ContainerRequestContext requestContext) throws UnknownHostException { // Generated RequestId diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java index 8896e93175..b49f9b5a8d 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java @@ -73,12 +73,19 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.fasterxml.jackson.databind.ObjectMapper; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.info.Info; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; @Path("onap/so/infra/orchestrationRequests") -@Api(value = "onap/so/infra/orchestrationRequests", description = "API Requests for Orchestration requests") +@OpenAPIDefinition(info = @Info(title = "onap/so/infra/orchestrationRequests", + description = "API Requests for Orchestration requests")) + @Component public class OrchestrationRequests { @@ -99,7 +106,8 @@ public class OrchestrationRequests { @GET @Path("/{version:[vV][4-7]}/{requestId}") - @ApiOperation(value = "Find Orchestrated Requests for a given requestId", response = Response.class) + @Operation(description = "Find Orchestrated Requests for a given requestId", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Produces(MediaType.APPLICATION_JSON) @Transactional public Response getOrchestrationRequest(@PathParam("requestId") String requestId, @@ -164,7 +172,8 @@ public class OrchestrationRequests { @GET @Path("/{version:[vV][4-7]}") - @ApiOperation(value = "Find Orchestrated Requests for a URI Information", response = Response.class) + @Operation(description = "Find Orchestrated Requests for a URI Information", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Produces(MediaType.APPLICATION_JSON) @Transactional public Response getOrchestrationRequest(@Context UriInfo ui, @PathParam("version") String version, @@ -221,7 +230,8 @@ public class OrchestrationRequests { @Path("/{version: [vV][4-7]}/{requestId}/unlock") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Unlock Orchestrated Requests for a given requestId", response = Response.class) + @Operation(description = "Unlock Orchestrated Requests for a given requestId", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response unlockOrchestrationRequest(String requestJSON, @PathParam("requestId") String requestId, @PathParam("version") String version) throws ApiException { diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java index ed300d95c2..b462415a43 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java @@ -57,11 +57,17 @@ import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.web.client.HttpClientErrorException; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.info.Info; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; @Path("onap/so/infra/orchestrationRequests") -@Api(value = "onap/so/infra/orchestrationRequests") +@OpenAPIDefinition(info = @Info(title = "onap/so/infra/orchestrationRequests")) + @Component public class ResumeOrchestrationRequest { private static Logger logger = LoggerFactory.getLogger(ResumeOrchestrationRequest.class); @@ -84,7 +90,8 @@ public class ResumeOrchestrationRequest { @Path("/{version:[vV][7]}/{requestId}/resume") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Resume request for a given requestId", response = Response.class) + @Operation(description = "Resume request for a given requestId", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response resumeOrchestrationRequest(@PathParam("requestId") String requestId, @PathParam("version") String version, @Context ContainerRequestContext requestContext) throws ApiException { diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java index 9b72bdc608..da101a2e6d 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java @@ -89,16 +89,19 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; import org.springframework.web.client.RestTemplate; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.info.Info; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; @Component @Path("/onap/so/infra/serviceInstantiation") -@Api(value = "/onap/so/infra/serviceInstantiation", description = "Infrastructure API Requests for Service Instances") +@OpenAPIDefinition(info = @Info(title = "/onap/so/infra/serviceInstantiation", + description = "Infrastructure API Requests for Service Instances")) public class ServiceInstances extends AbstractRestHandler { private static Logger logger = LoggerFactory.getLogger(MsoRequest.class); @@ -132,7 +135,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Create a Service Instance on a version provided", response = Response.class) + @Operation(description = "Create a Service Instance on a version provided", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response createServiceInstance(String request, @PathParam("version") String version, @Context ContainerRequestContext requestContext) throws ApiException { @@ -145,7 +149,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/activate") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Activate provided Service Instance", response = Response.class) + @Operation(description = "Activate provided Service Instance", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response activateServiceInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext) @@ -161,7 +166,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/deactivate") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Deactivate provided Service Instance", response = Response.class) + @Operation(description = "Deactivate provided Service Instance", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response deactivateServiceInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext) @@ -177,7 +183,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Delete provided Service Instance", response = Response.class) + @Operation(description = "Delete provided Service Instance", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response deleteServiceInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext) @@ -193,7 +200,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][7]}/serviceInstances/assign") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Assign Service Instance", response = Response.class) + @Operation(description = "Assign Service Instance", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response assignServiceInstance(String request, @PathParam("version") String version, @Context ContainerRequestContext requestContext) throws ApiException { @@ -206,7 +214,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][7]}/serviceInstances/{serviceInstanceId}/unassign") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Unassign Service Instance", response = Response.class) + @Operation(description = "Unassign Service Instance", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response unassignServiceInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext) @@ -222,7 +231,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/configurations") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Create Port Mirroring Configuration", response = Response.class) + @Operation(description = "Create Port Mirroring Configuration", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response createPortConfiguration(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext) @@ -238,7 +248,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/configurations/{configurationInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Delete provided Port", response = Response.class) + @Operation(description = "Delete provided Port", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response deletePortConfiguration(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @@ -256,7 +267,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/configurations/{configurationInstanceId}/enablePort") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Enable Port Mirroring", response = Response.class) + @Operation(description = "Enable Port Mirroring", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response enablePort(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @@ -274,7 +286,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/configurations/{configurationInstanceId}/disablePort") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Disable Port Mirroring", response = Response.class) + @Operation(description = "Disable Port Mirroring", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response disablePort(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @@ -292,7 +305,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/configurations/{configurationInstanceId}/activate") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Activate Port Mirroring", response = Response.class) + @Operation(description = "Activate Port Mirroring", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response activatePort(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @@ -310,7 +324,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/configurations/{configurationInstanceId}/deactivate") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Deactivate Port Mirroring", response = Response.class) + @Operation(description = "Deactivate Port Mirroring", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response deactivatePort(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @@ -328,7 +343,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][6-7]}/serviceInstances/{serviceInstanceId}/addRelationships") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Add Relationships to a Service Instance", response = Response.class) + @Operation(description = "Add Relationships to a Service Instance", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response addRelationships(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext) @@ -344,7 +360,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][6-7]}/serviceInstances/{serviceInstanceId}/removeRelationships") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Remove Relationships from Service Instance", response = Response.class) + @Operation(description = "Remove Relationships from Service Instance", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response removeRelationships(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext) @@ -360,7 +377,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Create VNF on a specified version and serviceInstance", response = Response.class) + @Operation(description = "Create VNF on a specified version and serviceInstance", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response createVnfInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext) @@ -381,7 +399,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/replace") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Replace provided VNF instance", response = Response.class) + @Operation(description = "Replace provided VNF instance", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response replaceVnfInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, @@ -398,8 +417,9 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Update VNF on a specified version, serviceInstance and vnfInstance", - response = Response.class) + @Operation(description = "Update VNF on a specified version, serviceInstance and vnfInstance", + responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response updateVnfInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, @@ -416,7 +436,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][6-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/applyUpdatedConfig") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Apply updated configuration", response = Response.class) + @Operation(description = "Apply updated configuration", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) public Response applyUpdatedConfig(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, @Context ContainerRequestContext requestContext) throws ApiException { @@ -432,7 +453,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/recreate") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Recreate VNF Instance", response = Response.class) + @Operation(description = "Recreate VNF Instance", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) public Response recreateVnfInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, @Context ContainerRequestContext requestContext) throws ApiException { @@ -448,7 +470,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Delete provided VNF instance", response = Response.class) + @Operation(description = "Delete provided VNF instance", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response deleteVnfInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, @@ -465,8 +488,9 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Create VfModule on a specified version, serviceInstance and vnfInstance", - response = Response.class) + @Operation(description = "Create VfModule on a specified version, serviceInstance and vnfInstance", + responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response createVfModuleInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, @@ -483,8 +507,9 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}/replace") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Create VfModule on a specified version, serviceInstance and vnfInstance", - response = Response.class) + @Operation(description = "Create VfModule on a specified version, serviceInstance and vnfInstance", + responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response replaceVfModuleInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, @@ -503,8 +528,9 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Update VfModule on a specified version, serviceInstance, vnfInstance and vfModule", - response = Response.class) + @Operation(description = "Update VfModule on a specified version, serviceInstance, vnfInstance and vfModule", + responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response updateVfModuleInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, @@ -523,7 +549,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][6-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/inPlaceSoftwareUpdate") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Perform VNF software update", response = Response.class) + @Operation(description = "Perform VNF software update", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response inPlaceSoftwareUpdate(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, @@ -540,7 +567,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Delete provided VfModule instance", response = Response.class) + @Operation(description = "Delete provided VfModule instance", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response deleteVfModuleInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, @@ -559,7 +587,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}/deactivateAndCloudDelete") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Deactivate and Cloud Delete VfModule instance", response = Response.class) + @Operation(description = "Deactivate and Cloud Delete VfModule instance", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response deactivateAndCloudDeleteVfModuleInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, @@ -579,7 +608,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/scaleOut") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "VF Auto Scale Out", response = Response.class) + @Operation(description = "VF Auto Scale Out", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response scaleOutVfModule(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, @@ -596,8 +626,9 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Create VolumeGroup on a specified version, serviceInstance, vnfInstance", - response = Response.class) + @Operation(description = "Create VolumeGroup on a specified version, serviceInstance, vnfInstance", + responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response createVolumeGroupInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, @@ -614,8 +645,9 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Update VolumeGroup on a specified version, serviceInstance, vnfInstance and volumeGroup", - response = Response.class) + @Operation(description = "Update VolumeGroup on a specified version, serviceInstance, vnfInstance and volumeGroup", + responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response updateVolumeGroupInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, @@ -634,7 +666,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Delete provided VolumeGroup instance", response = Response.class) + @Operation(description = "Delete provided VolumeGroup instance", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response deleteVolumeGroupInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, @@ -653,8 +686,9 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/networks") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Create NetworkInstance on a specified version and serviceInstance ", - response = Response.class) + @Operation(description = "Create NetworkInstance on a specified version and serviceInstance ", + responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response createNetworkInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext) @@ -670,8 +704,9 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/networks/{networkInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Update VolumeGroup on a specified version, serviceInstance, networkInstance", - response = Response.class) + @Operation(description = "Update VolumeGroup on a specified version, serviceInstance, networkInstance", + responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response updateNetworkInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @@ -689,7 +724,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/networks/{networkInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Delete provided Network instance", response = Response.class) + @Operation(description = "Delete provided Network instance", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response deleteNetworkInstance(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @@ -707,7 +743,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][7]}/instanceGroups") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Create instanceGroups", response = Response.class) + @Operation(description = "Create instanceGroups", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response createInstanceGroups(String request, @PathParam("version") String version, @Context ContainerRequestContext requestContext) throws ApiException { @@ -720,7 +757,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][7]}/instanceGroups/{instanceGroupId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Delete instanceGroup", response = Response.class) + @Operation(description = "Delete instanceGroup", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response deleteInstanceGroups(@PathParam("version") String version, @PathParam("instanceGroupId") String instanceGroupId, @Context ContainerRequestContext requestContext) @@ -736,7 +774,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][7]}/instanceGroups/{instanceGroupId}/addMembers") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Add instanceGroup members", response = Response.class) + @Operation(description = "Add instanceGroup members", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response addInstanceGroupMembers(String request, @PathParam("version") String version, @PathParam("instanceGroupId") String instanceGroupId, @Context ContainerRequestContext requestContext) @@ -752,7 +791,8 @@ public class ServiceInstances extends AbstractRestHandler { @Path("/{version:[vV][7]}/instanceGroups/{instanceGroupId}/removeMembers") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Remove instanceGroup members", response = Response.class) + @Operation(description = "Remove instanceGroup members", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response removeInstanceGroupMembers(String request, @PathParam("version") String version, @PathParam("instanceGroupId") String instanceGroupId, @Context ContainerRequestContext requestContext) diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java index 3c4c90cc37..09a1d9e5a6 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java @@ -36,7 +36,6 @@ import javax.ws.rs.core.UriBuilder; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.json.JSONArray; -import org.json.JSONException; import org.json.JSONObject; import org.onap.so.apihandler.common.ErrorNumbers; import org.onap.so.apihandler.common.RequestClient; @@ -60,11 +59,16 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.info.Info; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; @Path("onap/so/infra/tasks") -@Api(value = "onap/so/infra/tasks", description = "Queries of Manual Tasks") +@OpenAPIDefinition(info = @Info(title = "onap/so/infra/tasks", description = "Queries of Manual Tasks")) @Component public class TasksHandler { @@ -82,7 +86,8 @@ public class TasksHandler { @Path("/{version:[vV]1}") @GET - @ApiOperation(value = "Finds Manual Tasks", response = Response.class) + @Operation(description = "Finds Manual Tasks", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response queryFilters(@QueryParam("taskId") String taskId, @QueryParam("originalRequestId") String originalRequestId, diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java index b57bb5d1d8..925d10179f 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java @@ -59,11 +59,17 @@ import org.springframework.stereotype.Component; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.info.Info; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; @Path("onap/so/infra/workflowSpecifications") -@Api(value = "onap/so/infra/workflowSpecifications", description = "Queries of Workflow Specifications") +@OpenAPIDefinition(info = @Info(title = "onap/so/infra/workflowSpecifications", + description = "Queries of Workflow Specifications")) @Component public class WorkflowSpecificationsHandler { @@ -79,7 +85,8 @@ public class WorkflowSpecificationsHandler { @Path("/{version:[vV]1}/workflows") @GET - @ApiOperation(value = "Finds Workflow Specifications", response = Response.class) + @Operation(description = "Finds Workflow Specifications", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response queryWorkflowSpecifications(@QueryParam("vnfModelVersionId") String vnfModelVersionId, diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Network.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Network.java index ec3df21fdb..483ac47235 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Network.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Network.java @@ -44,7 +44,11 @@ import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Component; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; @Component @Path("/onap/so/infra/serviceInstantiation") @@ -61,7 +65,8 @@ public class Network { @Path("/{version:[vV][8]}/serviceInstances/{serviceInstanceId}/networks/{networkInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Delete provided Network instance", response = Response.class) + @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, diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/ServiceInstance.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/ServiceInstance.java index 07e8092449..135667d3e4 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/ServiceInstance.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/ServiceInstance.java @@ -44,7 +44,11 @@ import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Component; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; @Component @Path("/onap/so/infra/serviceInstantiation") @@ -61,7 +65,8 @@ public class ServiceInstance { @Path("/{version:[vV][8]}/serviceInstances/{serviceInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Delete a Service instance", response = ServiceInstancesResponse.class) + @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) diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/VfModules.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/VfModules.java index 1b9eb1f802..4a86d944cf 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/VfModules.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/VfModules.java @@ -45,7 +45,11 @@ import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Component; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; @Component @Path("/onap/so/infra/serviceInstantiation") @@ -62,7 +66,8 @@ public class VfModules { @Path("/{version:[vV][8]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Delete a VfModule instance", response = ServiceInstancesResponse.class) + @Operation(description = "Delete a VfModule instance", responses = @ApiResponse(content = @Content( + array = @ArraySchema(schema = @Schema(implementation = ServiceInstancesResponse.class))))) @Transactional public Response deleteVfModuleInstance(@PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Vnf.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Vnf.java index a8ccdeecac..edb09083d4 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Vnf.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Vnf.java @@ -43,7 +43,11 @@ import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Component; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; @Component @Path("/onap/so/infra/serviceInstantiation") @@ -60,7 +64,8 @@ public class Vnf { @Path("/{version:[vV][8]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Delete a Vnf instance", response = ServiceInstancesResponse.class) + @Operation(description = "Delete a Vnf instance", responses = @ApiResponse(content = @Content( + array = @ArraySchema(schema = @Schema(implementation = ServiceInstancesResponse.class))))) @Transactional public Response deleteVnfInstance(@PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Volumes.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Volumes.java index d3e394d6d8..3154c86046 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Volumes.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Volumes.java @@ -46,7 +46,11 @@ import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Component; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; @Component("VolumesV8") @Path("/onap/so/infra/serviceInstantiation") @@ -66,7 +70,8 @@ public class Volumes { @Path("/{version:[vV][8]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Delete a VfModule instance", response = ServiceInstancesResponse.class) + @Operation(description = "Delete a VfModule instance", responses = @ApiResponse(content = @Content( + array = @ArraySchema(schema = @Schema(implementation = ServiceInstancesResponse.class))))) @Transactional public Response deleteVfModuleInstance(@PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java index d3fb7986ce..877376cc79 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java @@ -61,12 +61,18 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.fasterxml.jackson.databind.ObjectMapper; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.info.Info; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; @Component @Path("/onap/so/infra/cloudResources") -@Api(value = "/onap/so/infra/cloudResources", description = "API Requests for cloud resources - Tenant Isolation") +@OpenAPIDefinition(info = @Info(title = "/onap/so/infra/cloudResources", + description = "API Requests for cloud resources - Tenant Isolation")) public class CloudOrchestration { private static Logger logger = LoggerFactory.getLogger(CloudOrchestration.class); @@ -85,7 +91,8 @@ public class CloudOrchestration { @Path("/{version:[vV][1]}/operationalEnvironments") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Create an Operational Environment", response = Response.class) + @Operation(description = "Create an Operational Environment", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response createOperationEnvironment(String request, @PathParam("version") String version, @Context ContainerRequestContext requestContext) throws ApiException { @@ -97,7 +104,8 @@ public class CloudOrchestration { @Path("/{version:[vV][1]}/operationalEnvironments/{operationalEnvironmentId}/activate") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Activate an Operational Environment", response = Response.class) + @Operation(description = "Activate an Operational Environment", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response activateOperationEnvironment(String request, @PathParam("version") String version, @PathParam("operationalEnvironmentId") String operationalEnvironmentId, @@ -112,7 +120,8 @@ public class CloudOrchestration { @Path("/{version:[vV][1]}/operationalEnvironments/{operationalEnvironmentId}/deactivate") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Deactivate an Operational Environment", response = Response.class) + @Operation(description = "Deactivate an Operational Environment", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response deactivateOperationEnvironment(String request, @PathParam("version") String version, @PathParam("operationalEnvironmentId") String operationalEnvironmentId, diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java index e9cd303c0b..47d6932730 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java @@ -62,13 +62,18 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.fasterxml.jackson.databind.ObjectMapper; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.info.Info; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; @Component @Path("onap/so/infra/cloudResourcesRequests") -@Api(value = "onap/so/infra/cloudResourcesRequests", - description = "API GET Requests for cloud resources - Tenant Isolation") +@OpenAPIDefinition(info = @Info(title = "onap/so/infra/cloudResourcesRequests", + description = "API GET Requests for cloud resources - Tenant Isolation")) public class CloudResourcesOrchestration { private static Logger logger = LoggerFactory.getLogger(CloudResourcesOrchestration.class); @@ -83,7 +88,7 @@ public class CloudResourcesOrchestration { @Path("/{version: [vV][1]}/{requestId}/unlock") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Unlock CloudOrchestration requests for a specified requestId") + @Operation(description = "Unlock CloudOrchestration requests for a specified requestId") @Transactional public Response unlockOrchestrationRequest(String requestJSON, @PathParam("requestId") String requestId, @PathParam("version") String version) throws ApiException { @@ -167,8 +172,9 @@ public class CloudResourcesOrchestration { @Path("/{version:[vV][1]}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Get status of an Operational Environment based on filter criteria", - response = Response.class) + @Operation(description = "Get status of an Operational Environment based on filter criteria", + responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response getOperationEnvironmentStatusFilter(@Context UriInfo ui, @PathParam("version") String version) throws ApiException { diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java index ef5abe9f74..2f922220c9 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java @@ -55,12 +55,18 @@ import org.springframework.stereotype.Component; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.info.Info; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; @Component @Path("/onap/so/infra/modelDistributions") -@Api(value = "/onap/so/infra/modelDistributions", description = "API Requests for Model Distributions") +@OpenAPIDefinition( + info = @Info(title = "/onap/so/infra/modelDistributions", description = "API Requests for Model Distributions")) public class ModelDistributionRequest { private static Logger logger = LoggerFactory.getLogger(ModelDistributionRequest.class); @@ -71,7 +77,8 @@ public class ModelDistributionRequest { @Path("/{version:[vV][1]}/distributions/{distributionId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Update model distribution status", response = Response.class) + @Operation(description = "Update model distribution status", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response updateModelDistributionStatus(String requestJSON, @PathParam("version") String version, @PathParam("distributionId") String distributionId) throws ApiException { |