summaryrefslogtreecommitdiffstats
path: root/a1-policy-management/src/main/java
diff options
context:
space:
mode:
authorPatrikBuhr <patrik.buhr@est.tech>2021-02-02 14:06:44 +0100
committerKAPIL SINGAL <ks220y@att.com>2021-02-02 22:39:57 +0000
commitfee9955e585a00155b93f6de279a36217a8857bd (patch)
treeec0b5ea7cb400b0f68d6ee4899ff31973db36ce8 /a1-policy-management/src/main/java
parentb369f78cc4c558b94d1192f8774ce5bb044f2cf0 (diff)
Improved API documentation
Using swagger3 and improving the API documatation. Change-Id: I31f7783e0a6e6fd7698c68e5df6f2d306bce6816 Issue-ID: CCSDK-3127 Signed-off-by: PatrikBuhr <patrik.buhr@est.tech>
Diffstat (limited to 'a1-policy-management/src/main/java')
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/SwaggerConfig.java170
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/ServiceCallbackInfo.java11
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/VoidResponse.java4
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/Consts.java3
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/PolicyController.java188
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/PolicyInfo.java17
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/RicInfo.java13
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/RicRepositoryController.java41
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/ServiceController.java67
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/ServiceRegistrationInfo.java9
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/ServiceStatus.java13
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/StatusController.java18
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationController.java49
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/Consts.java5
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ErrorResponse.java15
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyController.java161
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyIdList.java7
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyInfo.java21
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyInfoList.java7
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyStatusInfo.java9
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyTypeIdList.java7
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyTypeInfo.java8
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicInfo.java15
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicInfoList.java7
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicRepositoryController.java50
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceController.java70
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceRegistrationInfo.java16
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceStatus.java13
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceStatusList.java7
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/StatusController.java28
30 files changed, 610 insertions, 439 deletions
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/SwaggerConfig.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/SwaggerConfig.java
index 1197cc35..357aa7b6 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/SwaggerConfig.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/SwaggerConfig.java
@@ -20,26 +20,17 @@
package org.onap.ccsdk.oran.a1policymanagementservice;
-import com.google.common.base.Predicates;
+import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.info.Info;
+import io.swagger.v3.oas.annotations.info.License;
+import io.swagger.v3.oas.annotations.tags.Tag;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
-
-import springfox.documentation.builders.ApiInfoBuilder;
-import springfox.documentation.builders.PathSelectors;
-import springfox.documentation.builders.RequestHandlerSelectors;
-import springfox.documentation.service.ApiInfo;
-import springfox.documentation.service.Contact;
-import springfox.documentation.service.StringVendorExtension;
-import springfox.documentation.service.VendorExtension;
-import springfox.documentation.spi.DocumentationType;
-import springfox.documentation.spring.web.plugins.Docket;
-import springfox.documentation.swagger2.annotations.EnableSwagger2;
+import org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2.ConfigurationController;
+import org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2.Consts;
+import org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2.PolicyController;
+import org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2.RicRepositoryController;
+import org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2.ServiceController;
+import org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2.StatusController;
/**
* Swagger configuration class that uses swagger2 documentation type and scans
@@ -48,78 +39,81 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
* the swagger gui go to http://ip:port/swagger-ui.html
*
*/
-@Configuration
-@EnableSwagger2
-public class SwaggerConfig extends WebMvcConfigurationSupport {
-
- static final String API_TITLE = "A1 Policy management service";
- static final String DESCRIPTION = //
- "The O-RAN Non-RT RIC Policy Management Service provides a REST API for management of A1 policices. \n" //
- + "It provides support for:" //
- + "<ul>" //
- + "<li>A1 Policy creation and modification.</li>" //
- + "<li>Maintaining a view of supported Near-RT RIC policy types </li>" //
- + "<li>Supervision of using services (R-APPs). When a service is unavailble, its policies are removed. </li> " //
- + "<li>Monitoring and maintaining consistency of the SMO view of A1 policies and the Near-RT RICs </li>" //
- + "</ul>"//
- ;
- static final String VERSION = "1.1.0";
- @SuppressWarnings("squid:S1075") // Refactor your code to get this URI from a customizable parameter.
- static final String RESOURCES_PATH = "classpath:/META-INF/resources/";
- static final String WEBJARS_PATH = RESOURCES_PATH + "webjars/";
- static final String SWAGGER_UI = "swagger-ui.html";
- static final String WEBJARS = "/webjars/**";
-
- /**
- * Gets the API info.
- *
- * @return the API info.This page lists all the rest apis for the service.
- */
- @Bean
- public Docket api() {
- return new Docket(DocumentationType.SWAGGER_2) //
- .apiInfo(apiInfo()) //
- .select() //
- .apis(RequestHandlerSelectors.any()) //
- .paths(PathSelectors.any()) //
- .paths(PathSelectors.regex("/error").negate()) //
- // this endpoint is not implemented, but was visible for Swagger
- .paths(PathSelectors.regex("/actuator.*").negate()) //
- // this endpoint is implemented by spring framework, exclude for now
- .build();
- }
-
- private static ApiInfo apiInfo() {
- return new ApiInfoBuilder() //
- .title(API_TITLE) //
- .description(DESCRIPTION) //
- .version(VERSION) //
- .contact(contact()) //
- .extensions(vendorExtentions()) //
- .build();
- }
+@OpenAPIDefinition( //
+ tags = { //
+ @Tag(//
+ name = org.onap.ccsdk.oran.a1policymanagementservice.controllers.v1.Consts.V1_API_NAME, //
+ description = org.onap.ccsdk.oran.a1policymanagementservice.controllers.v1.Consts.V1_API_DESCRIPTION //
+ ), //
+ @Tag(//
+ name = ConfigurationController.API_NAME, //
+ description = ConfigurationController.API_DESCRIPTION //
+ ), //
+ @Tag(//
+ name = PolicyController.API_NAME, //
+ description = PolicyController.API_DESCRIPTION //
+ ), //
+ @Tag( //
+ name = RicRepositoryController.API_NAME, //
+ description = RicRepositoryController.API_DESCRIPTION //
+ ), //
+ @Tag( //
+ name = ServiceController.API_NAME, //
+ description = ServiceController.API_DESCRIPTION //
- @SuppressWarnings("java:S3740") // VendorExtension is a raw type. References to generic type VendorExtension<T>
- // should be parameterizedJava(16777788)
- private static List<VendorExtension> vendorExtentions() {
- final String URN = "60f9a0e7-343f-43bf-9194-d8d65688d465";
- List<VendorExtension> extentions = new ArrayList<>();
- extentions.add(new StringVendorExtension("x-api-id", URN));
- extentions.add(new StringVendorExtension("x-audience", "external-partner"));
- return extentions;
- }
+ ), //
+ @Tag( //
+ name = StatusController.API_NAME, //
+ description = StatusController.API_DESCRIPTION //
+ ), //
+ @Tag( //
+ name = Consts.V2_API_SERVICE_CALLBACKS_NAME, //
+ description = Consts.V2_API_SERVICE_CALLBACKS_DESCRIPTION //
+ ) //
+ }, //
+ info = @Info(title = SwaggerConfig.API_TITLE, //
+ version = SwaggerConfig.VERSION, //
+ description = SwaggerConfig.DESCRIPTION, //
+ license = @License(name = "Copyright (C) 2020 Nordix Foundation. Licensed under the Apache License.", //
+ url = "http://www.apache.org/licenses/LICENSE-2.0")) //
+)
+public class SwaggerConfig {
+ private SwaggerConfig() {}
- private static Contact contact() {
- return new Contact("Ericsson Software Technology", "", "nonrtric@est.tech");
- }
+ private static final String H3 = "<h3>";
+ private static final String H3_END = "</h3>";
- @Override
- protected void addResourceHandlers(ResourceHandlerRegistry registry) {
- registry.addResourceHandler(SWAGGER_UI) //
- .addResourceLocations(RESOURCES_PATH);
+ public static final String API_TITLE = "A1 Policy management service";
+ static final String DESCRIPTION = "<h2>General</h2>" + //
+ "<p>The O-RAN Non-RT RIC Policy Management Service provides a REST API for management of A1 policices. <br/>The main tasks of the service are:</p>"
+ + //
+ "<ul>" + //
+ "<li>A1 Policy creation, modification and deletion.</li>" + //
+ "<li>Monitoring and maintaining consistency of the SMO view of A1 policies and the Near-RT RICs</li>" + //
+ "<li>Maintaining a view of supported Near-RT RIC policy types</li>" + //
+ "<li>Supervision of using services (R-APPs). When a service is unavailble, its policies are removed.</li>" + //
+ "</ul>" + //
+ "<h2>APIs provided by the service</h2>" + //
+ H3 + PolicyController.API_NAME + H3_END + //
+ "<p>This is an API for management of A1 Policies.</p>" + //
+ "<ul>" + //
+ "<li>A1 Policy retrieval, creation, modification and deletion.</li>" + //
+ "<li>Retrieval of supported A1 Policy types for a Near-RT RIC</li>" + //
+ "<li>Retrieval of status for existing A1 policies</li>" + //
+ "</ul>" + //
- registry.addResourceHandler(WEBJARS) //
- .addResourceLocations(WEBJARS_PATH);
- }
+ H3 + ConfigurationController.API_NAME + H3_END + //
+ "<p>API for updating and retrieval of the component configuration. Note that there other ways to maintain the configuration.</p>"
+ + //
+ H3 + Consts.V2_API_SERVICE_CALLBACKS_NAME + H3_END + //
+ "<p>These are endpoints that are invoked by this service. The callbacks are registerred in this service at service registration.</p>"
+ + //
+ H3 + RicRepositoryController.API_NAME + H3_END + //
+ "<p>This is an API that provides support for looking up a NearRT-RIC. Each A1 policy is targeted for one Near-RT RIC.</p>"
+ + H3 + StatusController.API_NAME + H3_END + //
+ "<p>API used for supervision of the PMS component.</p>" + //
+ H3 + ServiceController.API_NAME + H3_END + //
+ "<p>API used for registerring services that uses PMS. Each A1 policy is owned by a service. PMS can supervise each registerred service and will automatically remove policies for unavailable services.</p>";
+ public static final String VERSION = "1.1.0";
}
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/ServiceCallbackInfo.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/ServiceCallbackInfo.java
index 7d5f003a..7d89206c 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/ServiceCallbackInfo.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/ServiceCallbackInfo.java
@@ -23,13 +23,12 @@ package org.onap.ccsdk.oran.a1policymanagementservice.controllers;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "service_callback_info_v2",
+@Schema(name = "service_callback_info_v2",
description = "Information transferred as in Service callbacks (callback_url)")
public class ServiceCallbackInfo {
@@ -37,17 +36,17 @@ public class ServiceCallbackInfo {
+ "AVAILABLE: the Near-RT RIC has become available for A1 Policy management";
@Gson.TypeAdapters
- @ApiModel(value = "event_type_v2", description = EVENT_TYPE_DESCRIPTION)
+ @Schema(name = "event_type_v2", description = EVENT_TYPE_DESCRIPTION)
public enum EventType {
AVAILABLE
}
- @ApiModelProperty(value = "identity of a Near-RT RIC", required = true)
+ @Schema(name = "ric_id", description = "identity of a Near-RT RIC", required = true)
@SerializedName("ric_id")
@JsonProperty(value = "ric_id", required = true)
public String ricId;
- @ApiModelProperty(value = EVENT_TYPE_DESCRIPTION, required = true)
+ @Schema(name = "event_type", description = EVENT_TYPE_DESCRIPTION, required = true)
@SerializedName("event_type")
@JsonProperty(value = "event_type", required = true)
public EventType eventType;
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/VoidResponse.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/VoidResponse.java
index a2b9af4b..754d1694 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/VoidResponse.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/VoidResponse.java
@@ -20,12 +20,12 @@
package org.onap.ccsdk.oran.a1policymanagementservice.controllers;
-import io.swagger.annotations.ApiModel;
+import io.swagger.v3.oas.annotations.media.Schema;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "void", description = "Void/empty")
+@Schema(name = "void", description = "Void/empty")
public class VoidResponse {
private VoidResponse() {}
}
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/Consts.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/Consts.java
index 69868d2d..44fc1cad 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/Consts.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/Consts.java
@@ -22,7 +22,8 @@ package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v1;
public class Consts {
- public static final String V1_API_NAME = "A1 Policy Management Version 1.0 (deprecated)";
+ public static final String V1_API_NAME = "A1 Policy Management V1.0";
+ public static final String V1_API_DESCRIPTION = "(deprecated primitves)";
private Consts() {}
}
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/PolicyController.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/PolicyController.java
index 6c5ebd90..1f5f7ca9 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/PolicyController.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/PolicyController.java
@@ -23,11 +23,14 @@ package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v1;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+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 io.swagger.v3.oas.annotations.responses.ApiResponses;
+import io.swagger.v3.oas.annotations.tags.Tag;
import java.lang.invoke.MethodHandles;
import java.time.Instant;
@@ -66,7 +69,7 @@ import org.springframework.web.reactive.function.client.WebClientResponseExcepti
import reactor.core.publisher.Mono;
@RestController
-@Api(tags = Consts.V1_API_NAME)
+@Tag(name = Consts.V1_API_NAME)
public class PolicyController {
public static class RejectionException extends Exception {
@@ -94,13 +97,19 @@ public class PolicyController {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private static Gson gson = new GsonBuilder().create();
- @GetMapping("/policy_schemas")
- @ApiOperation(value = "Returns policy type schema definitions")
- @ApiResponses(value = {
- @ApiResponse(code = 200, message = "Policy schemas", response = Object.class, responseContainer = "List"), //
- @ApiResponse(code = 404, message = "Near-RT RIC is not found", response = ErrorResponse.ErrorInfo.class)})
+ @GetMapping("/policy_schemas") //
+ @Operation(summary = "Returns policy type schema definitions") //
+ @ApiResponses(value = { //
+ @ApiResponse(responseCode = "200", //
+ description = "Policy schemas", //
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Object.class)))), //
+ @ApiResponse(responseCode = "404", //
+ description = "Near-RT RIC is not found", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))) //
+ })
public ResponseEntity<String> getPolicySchemas( //
- @ApiParam(name = "ric", required = false, value = "The name of the Near-RT RIC to get the definitions for.") //
+ @Parameter(name = "ric", required = false,
+ description = "The name of the Near-RT RIC to get the definitions for.") //
@RequestParam(name = "ric", required = false) String ricName) throws EntityNotFoundException {
if (ricName == null) {
Collection<PolicyType> types = this.policyTypes.getAll();
@@ -112,26 +121,35 @@ public class PolicyController {
}
@GetMapping("/policy_schema")
- @ApiOperation(value = "Returns one policy type schema definition")
+ @Operation(summary = "Returns one policy type schema definition")
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "Policy schema", response = Object.class), @ApiResponse(code = 404,
- message = "The policy type is not found", response = ErrorResponse.ErrorInfo.class)})
+ @ApiResponse(responseCode = "200", //
+ description = "Policy schema", //
+ content = @Content(schema = @Schema(implementation = Object.class))),
+ @ApiResponse(responseCode = "404", //
+ description = "The policy type is not found", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class)))//
+ })
public ResponseEntity<String> getPolicySchema( //
- @ApiParam(name = "id", required = true,
- value = "The identity of the policy type to get the definition for.") //
+ @Parameter(name = "id", required = true,
+ description = "The identity of the policy type to get the definition for.") //
@RequestParam(name = "id", required = true) String id) throws EntityNotFoundException {
PolicyType type = policyTypes.getType(id);
return new ResponseEntity<>(type.schema(), HttpStatus.OK);
}
@GetMapping("/policy_types")
- @ApiOperation(value = "Query policy type names")
- @ApiResponses(value = {
- @ApiResponse(code = 200, message = "Policy type names", response = String.class,
- responseContainer = "List"),
- @ApiResponse(code = 404, message = "Near-RT RIC is not found", response = ErrorResponse.ErrorInfo.class)})
+ @Operation(summary = "Query policy type names")
+ @ApiResponses(value = { //
+ @ApiResponse(responseCode = "200", //
+ description = "Policy type names", //
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = String.class)))), //
+ @ApiResponse(responseCode = "404", //
+ description = "Near-RT RIC is not found", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class)))//
+ })
public ResponseEntity<String> getPolicyTypes( //
- @ApiParam(name = "ric", required = false, value = "The name of the Near-RT RIC to get types for.") //
+ @Parameter(name = "ric", required = false, description = "The name of the Near-RT RIC to get types for.") //
@RequestParam(name = "ric", required = false) String ricName) throws EntityNotFoundException {
if (ricName == null) {
Collection<PolicyType> types = this.policyTypes.getAll();
@@ -143,27 +161,40 @@ public class PolicyController {
}
@GetMapping("/policy")
- @ApiOperation(value = "Returns a policy configuration") //
+ @Operation(summary = "Returns a policy configuration") //
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "Policy found", response = Object.class), //
- @ApiResponse(code = 404, message = "Policy is not found", response = ErrorResponse.ErrorInfo.class)} //
+ @ApiResponse(responseCode = "200", //
+ description = "Policy found", //
+ content = @Content(schema = @Schema(implementation = Object.class))), //
+ @ApiResponse(responseCode = "404", //
+ description = "Policy is not found", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))//
+ )} //
)
public ResponseEntity<String> getPolicy( //
- @ApiParam(name = "id", required = true, value = "The identity of the policy instance.") //
+ @Parameter(name = "id", required = true, description = "The identity of the policy instance.") //
@RequestParam(name = "id", required = true) String id) throws EntityNotFoundException {
Policy p = policies.getPolicy(id);
return new ResponseEntity<>(p.json(), HttpStatus.OK);
}
@DeleteMapping("/policy")
- @ApiOperation(value = "Delete a policy", response = Object.class)
+ @Operation(summary = "Delete a policy")
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "Not used", response = VoidResponse.class),
- @ApiResponse(code = 204, message = "Policy deleted", response = VoidResponse.class),
- @ApiResponse(code = 404, message = "Policy is not found", response = String.class),
- @ApiResponse(code = 423, message = "Near-RT RIC is not operational", response = String.class)})
+ @ApiResponse(responseCode = "200", //
+ description = "Not used", //
+ content = @Content(schema = @Schema(implementation = VoidResponse.class))),
+ @ApiResponse(responseCode = "204", //
+ description = "Policy deleted", //
+ content = @Content(schema = @Schema(implementation = VoidResponse.class))),
+ @ApiResponse(responseCode = "404", //
+ description = "Policy is not found", //
+ content = @Content(schema = @Schema(implementation = String.class))),
+ @ApiResponse(responseCode = "423", //
+ description = "Near-RT RIC is not operational", //
+ content = @Content(schema = @Schema(implementation = String.class)))})
public Mono<ResponseEntity<Object>> deletePolicy( //
- @ApiParam(name = "id", required = true, value = "The identity of the policy instance.") //
+ @Parameter(name = "id", required = true, description = "The identity of the policy instance.") //
@RequestParam(name = "id", required = true) String id) throws EntityNotFoundException {
Policy policy = policies.getPolicy(id);
keepServiceAlive(policy.ownerServiceId());
@@ -180,26 +211,37 @@ public class PolicyController {
}
@PutMapping(path = "/policy")
- @ApiOperation(value = "Put a policy", response = VoidResponse.class)
+ @Operation(summary = "Put a policy")
@ApiResponses(value = { //
- @ApiResponse(code = 201, message = "Policy created", response = VoidResponse.class), //
- @ApiResponse(code = 200, message = "Policy updated", response = VoidResponse.class), //
- @ApiResponse(code = 423, message = "Near-RT RIC is not operational", response = String.class), //
- @ApiResponse(code = 404, message = "Near-RT RIC or policy type is not found", response = String.class) //
+ @ApiResponse(responseCode = "201", //
+ description = "Policy created", //
+ content = @Content(schema = @Schema(implementation = VoidResponse.class))), //
+ @ApiResponse(responseCode = "200", //
+ description = "Policy updated", //
+ content = @Content(schema = @Schema(implementation = VoidResponse.class))), //
+ @ApiResponse(responseCode = "423", //
+ description = "Near-RT RIC is not operational", //
+ content = @Content(schema = @Schema(implementation = String.class))), //
+ @ApiResponse(responseCode = "404", //
+ description = "Near-RT RIC or policy type is not found", //
+ content = @Content(schema = @Schema(implementation = String.class))) //
})
public Mono<ResponseEntity<Object>> putPolicy( //
- @ApiParam(name = "type", required = false, value = "The name of the policy type.") //
+ @Parameter(name = "type", required = false, description = "The name of the policy type.") //
@RequestParam(name = "type", required = false, defaultValue = "") String typeName, //
- @ApiParam(name = "id", required = true, value = "The identity of the policy instance.") //
+ @Parameter(name = "id", required = true, description = "The identity of the policy instance.") //
@RequestParam(name = "id", required = true) String instanceId, //
- @ApiParam(name = "ric", required = true, value = "The name of the Near-RT RIC where the policy will be " + //
- "created.") //
+ @Parameter(name = "ric", required = true,
+ description = "The name of the Near-RT RIC where the policy will be " + //
+ "created.") //
@RequestParam(name = "ric", required = true) String ricName, //
- @ApiParam(name = "service", required = true, value = "The name of the service creating the policy.") //
+ @Parameter(name = "service", required = true, description = "The name of the service creating the policy.") //
@RequestParam(name = "service", required = true) String service, //
- @ApiParam(name = "transient", required = false, value = "If the policy is transient or not (boolean " + //
- "defaulted to false). A policy is transient if it will be forgotten when the service needs to " + //
- "reconnect to the Near-RT RIC.") //
+ @Parameter(name = "transient", required = false,
+ description = "If the policy is transient or not (boolean " + //
+ "defaulted to false). A policy is transient if it will be forgotten when the service needs to "
+ + //
+ "reconnect to the Near-RT RIC.") //
@RequestParam(name = "transient", required = false, defaultValue = "false") boolean isTransient, //
@RequestBody Object jsonBody) {
@@ -289,16 +331,21 @@ public class PolicyController {
}
@GetMapping("/policies")
- @ApiOperation(value = "Query policies")
- @ApiResponses(value = {
- @ApiResponse(code = 200, message = "Policies", response = PolicyInfo.class, responseContainer = "List"),
- @ApiResponse(code = 404, message = "Near-RT RIC or type not found", response = String.class)})
+ @Operation(summary = "Query policies")
+ @ApiResponses(value = { //
+ @ApiResponse(responseCode = "200", //
+ description = "Policies", //
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = PolicyInfo.class)))), //
+ @ApiResponse(responseCode = "404", //
+ description = "Near-RT RIC or type not found", //
+ content = @Content(schema = @Schema(implementation = String.class)))})
public ResponseEntity<String> getPolicies( //
- @ApiParam(name = "type", required = false, value = "The name of the policy type to get policies for.") //
+ @Parameter(name = "type", required = false,
+ description = "The name of the policy type to get policies for.") //
@RequestParam(name = "type", required = false) String type, //
- @ApiParam(name = "ric", required = false, value = "The name of the Near-RT RIC to get policies for.") //
+ @Parameter(name = "ric", required = false, description = "The name of the Near-RT RIC to get policies for.") //
@RequestParam(name = "ric", required = false) String ric, //
- @ApiParam(name = "service", required = false, value = "The name of the service to get policies for.") //
+ @Parameter(name = "service", required = false, description = "The name of the service to get policies for.") //
@RequestParam(name = "service", required = false) String service) //
{
if ((type != null && this.policyTypes.get(type) == null)) {
@@ -313,17 +360,21 @@ public class PolicyController {
}
@GetMapping("/policy_ids")
- @ApiOperation(value = "Query policies, only policy identities returned")
- @ApiResponses(value = {
- @ApiResponse(code = 200, message = "Policy identitiess", response = String.class,
- responseContainer = "List"),
- @ApiResponse(code = 404, message = "Near-RT RIC or type not found", response = String.class)})
+ @Operation(summary = "Query policies, only policy identities returned")
+ @ApiResponses(value = { //
+ @ApiResponse(responseCode = "200", //
+ description = "Policy identitiess", //
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = String.class)))),
+ @ApiResponse(responseCode = "404", //
+ description = "Near-RT RIC or type not found", //
+ content = @Content(schema = @Schema(implementation = String.class)))})
public ResponseEntity<String> getPolicyIds( //
- @ApiParam(name = "type", required = false, value = "The name of the policy type to get policies for.") //
+ @Parameter(name = "type", required = false,
+ description = "The name of the policy type to get policies for.") //
@RequestParam(name = "type", required = false) String type, //
- @ApiParam(name = "ric", required = false, value = "The name of the Near-RT RIC to get policies for.") //
+ @Parameter(name = "ric", required = false, description = "The name of the Near-RT RIC to get policies for.") //
@RequestParam(name = "ric", required = false) String ric, //
- @ApiParam(name = "service", required = false, value = "The name of the service to get policies for.") //
+ @Parameter(name = "service", required = false, description = "The name of the service to get policies for.") //
@RequestParam(name = "service", required = false) String service) //
{
if ((type != null && this.policyTypes.get(type) == null)) {
@@ -338,13 +389,18 @@ public class PolicyController {
}
@GetMapping("/policy_status")
- @ApiOperation(value = "Returns a policy status") //
+ @Operation(summary = "Returns a policy status") //
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "Policy status", response = Object.class), //
- @ApiResponse(code = 404, message = "Policy is not found", response = String.class)} //
- )
+ @ApiResponse(responseCode = "200", //
+ description = "Policy status", //
+ content = @Content(schema = @Schema(implementation = Object.class))), //
+ @ApiResponse(responseCode = "404", //
+ description = "Policy is not found", //
+ content = @Content(schema = @Schema(implementation = String.class))) //
+ })
public Mono<ResponseEntity<String>> getPolicyStatus( //
- @ApiParam(name = "id", required = true, value = "The identity of the policy.") @RequestParam(name = "id", //
+ @Parameter(name = "id", required = true, description = "The identity of the policy.") @RequestParam(
+ name = "id", //
required = true) String id)
throws EntityNotFoundException {
Policy policy = policies.getPolicy(id);
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/PolicyInfo.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/PolicyInfo.java
index 21e5b96c..0e3bf513 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/PolicyInfo.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/PolicyInfo.java
@@ -20,31 +20,30 @@
package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v1;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "policy_info_v1")
+@Schema(name = "policy_info_v1")
public class PolicyInfo {
- @ApiModelProperty(value = "identity of the policy")
+ @Schema(description = "identity of the policy")
public String id;
- @ApiModelProperty(value = "name of the policy type")
+ @Schema(description = "name of the policy type")
public String type;
- @ApiModelProperty(value = "identity of the target Near-RT RIC")
+ @Schema(description = "identity of the target Near-RT RIC")
public String ric;
- @ApiModelProperty(value = "the configuration of the policy")
+ @Schema(description = "the configuration of the policy")
public Object json;
- @ApiModelProperty(value = "the name of the service owning the policy")
+ @Schema(description = "the name of the service owning the policy")
public String service;
- @ApiModelProperty(value = "timestamp, last modification time")
+ @Schema(description = "timestamp, last modification time")
public String lastModified;
PolicyInfo() {}
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/RicInfo.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/RicInfo.java
index 467afdb9..b50277aa 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/RicInfo.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/RicInfo.java
@@ -20,26 +20,25 @@
package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v1;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Collection;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "ric_info_v1")
+@Schema(name = "ric_info_v1")
class RicInfo {
- @ApiModelProperty(value = "identity of the Near-RT RIC")
+ @Schema(description = "identity of the Near-RT RIC")
public final String ricName;
- @ApiModelProperty(value = "O1 identities for managed entities")
+ @Schema(description = "O1 identities for managed entities")
public final Collection<String> managedElementIds;
- @ApiModelProperty(value = "supported policy types")
+ @Schema(description = "supported policy types")
public final Collection<String> policyTypes;
- @ApiModelProperty(value = "state info")
+ @Schema(description = "state info")
public final String state;
RicInfo(String name, Collection<String> managedElementIds, Collection<String> policyTypes, String state) {
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/RicRepositoryController.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/RicRepositoryController.java
index 224935e3..f7fdfa90 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/RicRepositoryController.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/RicRepositoryController.java
@@ -23,11 +23,14 @@ package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v1;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+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 io.swagger.v3.oas.annotations.responses.ApiResponses;
+import io.swagger.v3.oas.annotations.tags.Tag;
import java.util.ArrayList;
import java.util.List;
@@ -44,7 +47,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
-@Api(tags = Consts.V1_API_NAME)
+@Tag(name = Consts.V1_API_NAME)
public class RicRepositoryController {
@Autowired
@@ -62,13 +65,18 @@ public class RicRepositoryController {
* @throws EntityNotFoundException
*/
@GetMapping("/ric")
- @ApiOperation(value = "Returns the name of a RIC managing one Mananged Element")
+ @Operation(summary = "Returns the name of a RIC managing one Mananged Element")
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "Near-RT RIC is found", response = String.class), //
- @ApiResponse(code = 404, message = "Near-RT RIC is not found", response = String.class) //
+ @ApiResponse(responseCode = "200", //
+ description = "Near-RT RIC is found", //
+ content = @Content(schema = @Schema(implementation = String.class))), //
+ @ApiResponse(responseCode = "404", //
+ description = "Near-RT RIC is not found", //
+ content = @Content(schema = @Schema(implementation = String.class))) //
})
+
public ResponseEntity<String> getRic( //
- @ApiParam(name = "managedElementId", required = true, value = "The identity of the Managed Element") //
+ @Parameter(name = "managedElementId", required = true, description = "The identity of the Managed Element") //
@RequestParam(name = "managedElementId", required = true) String managedElementId)
throws EntityNotFoundException {
Ric ric = this.rics.lookupRicForManagedElement(managedElementId);
@@ -79,12 +87,17 @@ public class RicRepositoryController {
* @return a Json array of all RIC data Example: http://localhost:8081/ric
*/
@GetMapping("/rics")
- @ApiOperation(value = "Query Near-RT RIC information")
+ @Operation(summary = "Query Near-RT RIC information")
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "OK", response = RicInfo.class, responseContainer = "List"), //
- @ApiResponse(code = 404, message = "Policy type is not found", response = String.class)})
+ @ApiResponse(responseCode = "200", //
+ description = "OK", //
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = RicInfo.class)))), //
+ @ApiResponse(responseCode = "404", //
+ description = "Policy type is not found", //
+ content = @Content(schema = @Schema(implementation = String.class))) //
+ })
public ResponseEntity<String> getRics( //
- @ApiParam(name = "policyType", required = false, value = "The name of the policy type") //
+ @Parameter(name = "policyType", required = false, description = "The name of the policy type") //
@RequestParam(name = "policyType", required = false) String supportingPolicyType) {
if ((supportingPolicyType != null) && (this.types.get(supportingPolicyType) == null)) {
return new ResponseEntity<>("Policy type not found", HttpStatus.NOT_FOUND);
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/ServiceController.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/ServiceController.java
index 548f4fe1..b4b7dca4 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/ServiceController.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/ServiceController.java
@@ -23,11 +23,14 @@ package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v1;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+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 io.swagger.v3.oas.annotations.responses.ApiResponses;
+import io.swagger.v3.oas.annotations.tags.Tag;
import java.net.MalformedURLException;
import java.net.URL;
@@ -52,7 +55,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
-@Api(tags = Consts.V1_API_NAME)
+@Tag(name = Consts.V1_API_NAME)
public class ServiceController {
private final Services services;
@@ -67,12 +70,18 @@ public class ServiceController {
}
@GetMapping("/services")
- @ApiOperation(value = "Returns service information")
+ @Operation(summary = "Returns service information")
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "OK", response = ServiceStatus.class, responseContainer = "List"), //
- @ApiResponse(code = 404, message = "Service is not found", response = String.class)})
+ @ApiResponse(responseCode = "200", //
+ description = "OK", //
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = ServiceStatus.class)))), //
+ @ApiResponse(responseCode = "404", //
+ description = "Service is not found", //
+ content = @Content(schema = @Schema(implementation = String.class))) //
+ })
+
public ResponseEntity<String> getServices(//
- @ApiParam(name = "name", required = false, value = "The name of the service") //
+ @Parameter(name = "name", required = false, description = "The name of the service") //
@RequestParam(name = "name", required = false) String name) {
if (name != null && this.services.get(name) == null) {
return new ResponseEntity<>("Service not found", HttpStatus.NOT_FOUND);
@@ -107,11 +116,18 @@ public class ServiceController {
}
}
- @ApiOperation(value = "Register a service")
+ @Operation(summary = "Register a service")
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "Service updated", response = String.class),
- @ApiResponse(code = 201, message = "Service created", response = String.class), //
- @ApiResponse(code = 400, message = "The ServiceRegistrationInfo is not accepted", response = String.class)})
+ @ApiResponse(responseCode = "200", //
+ description = "Service updated", //
+ content = @Content(schema = @Schema(implementation = String.class))), //
+ @ApiResponse(responseCode = "201", //
+ description = "Service created", //
+ content = @Content(schema = @Schema(implementation = String.class))), //
+ @ApiResponse(responseCode = "400", //
+ description = "The ServiceRegistrationInfo is not accepted", //
+ content = @Content(schema = @Schema(implementation = String.class))) //
+ })
@PutMapping("/service")
public ResponseEntity<String> putService(//
@RequestBody ServiceRegistrationInfo registrationInfo) {
@@ -125,14 +141,16 @@ public class ServiceController {
}
}
- @ApiOperation(value = "Delete a service")
+ @Operation(summary = "Delete a service")
@ApiResponses(value = { //
- @ApiResponse(code = 204, message = "Service deleted"),
- @ApiResponse(code = 204, message = "Not used", response = VoidResponse.class),
- @ApiResponse(code = 404, message = "Service not found", response = String.class)})
+ @ApiResponse(responseCode = "204", description = "Service deleted"),
+ @ApiResponse(responseCode = "204", description = "Not used",
+ content = @Content(schema = @Schema(implementation = VoidResponse.class))),
+ @ApiResponse(responseCode = "404", description = "Service not found",
+ content = @Content(schema = @Schema(implementation = String.class)))})
@DeleteMapping("/services")
public ResponseEntity<String> deleteService(//
- @ApiParam(name = "name", required = true, value = "The name of the service") //
+ @Parameter(name = "name", required = true, description = "The name of the service") //
@RequestParam(name = "name", required = true) String serviceName) {
try {
Service service = removeService(serviceName);
@@ -145,13 +163,16 @@ public class ServiceController {
}
}
- @ApiOperation(value = "Heartbeat from a service")
+ @Operation(summary = "Heartbeat from a service")
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "Service supervision timer refreshed, OK"),
- @ApiResponse(code = 404, message = "The service is not found, needs re-registration")})
+ @ApiResponse(responseCode = "200", description = "Service supervision timer refreshed, OK"),
+ @ApiResponse(responseCode = "404", description = "The service is not found, needs re-registration")
+
+ })
+
@PutMapping("/services/keepalive")
public ResponseEntity<String> keepAliveService(//
- @ApiParam(name = "name", required = true, value = "The name of the service") //
+ @Parameter(name = "name", required = true, description = "The name of the service") //
@RequestParam(name = "name", required = true) String serviceName) {
try {
services.getService(serviceName).keepAlive();
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/ServiceRegistrationInfo.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/ServiceRegistrationInfo.java
index 38e9b3b4..a4fd59a8 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/ServiceRegistrationInfo.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/ServiceRegistrationInfo.java
@@ -22,19 +22,18 @@ package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v1;
import com.google.gson.annotations.SerializedName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "service_registration_info_v1")
+@Schema(name = "service_registration_info_v1")
public class ServiceRegistrationInfo {
@SerializedName("serviceName")
public String serviceName = "";
- @ApiModelProperty(value = "keep alive interval for the service. This is a heartbeat supervision of the service, "
+ @Schema(description = "keep alive interval for the service. This is a heartbeat supervision of the service, "
+ "which in regular intevals must invoke a 'keepAlive' REST call. "
+ "When a service does not invoke this call within the given time, it is considered unavailble. "
+ "An unavailable service will be automatically deregistered and its policies will be deleted. "
@@ -42,7 +41,7 @@ public class ServiceRegistrationInfo {
@SerializedName("keepAliveIntervalSeconds")
public long keepAliveIntervalSeconds = 0;
- @ApiModelProperty(value = "callback for notifying of RIC synchronization", required = false, allowEmptyValue = true)
+ @Schema(description = "callback for notifying of RIC synchronization")
@SerializedName("callbackUrl")
public String callbackUrl = "";
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/ServiceStatus.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/ServiceStatus.java
index 8f6273f9..f3f57d8b 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/ServiceStatus.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/ServiceStatus.java
@@ -20,25 +20,24 @@
package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v1;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "service_status_v1")
+@Schema(name = "service_status_v1")
public class ServiceStatus {
- @ApiModelProperty(value = "identity of the service")
+ @Schema(description = "identity of the service")
public final String serviceName;
- @ApiModelProperty(value = "policy keep alive timeout")
+ @Schema(description = "policy keep alive timeout")
public final long keepAliveIntervalSeconds;
- @ApiModelProperty(value = "time since last invocation by the service")
+ @Schema(description = "time since last invocation by the service")
public final long timeSinceLastActivitySeconds;
- @ApiModelProperty(value = "callback for notifying of RIC synchronization")
+ @Schema(description = "callback for notifying of RIC synchronization")
public String callbackUrl;
ServiceStatus(String name, long keepAliveIntervalSeconds, long timeSincePingSeconds, String callbackUrl) {
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/StatusController.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/StatusController.java
index 492b1ea8..4dbe3b66 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/StatusController.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/StatusController.java
@@ -20,10 +20,12 @@
package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v1;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
+import io.swagger.v3.oas.annotations.Operation;
+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 io.swagger.v3.oas.annotations.responses.ApiResponses;
+import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@@ -32,14 +34,16 @@ import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;
@RestController
-@Api(tags = Consts.V1_API_NAME)
+@Tag(name = Consts.V1_API_NAME)
public class StatusController {
@GetMapping("/status")
- @ApiOperation(value = "Returns status and statistics of this service")
+ @Operation(summary = "Returns status and statistics of this service")
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "Service is living", response = String.class) //
+ @ApiResponse(responseCode = "200", description = "Service is living",
+ content = @Content(schema = @Schema(implementation = String.class))) //
})
+
public Mono<ResponseEntity<String>> getStatus() {
return Mono.just(new ResponseEntity<>("hunky dory", HttpStatus.OK));
}
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationController.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationController.java
index 86ae2734..e6b938a0 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationController.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationController.java
@@ -23,10 +23,12 @@ import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
+import io.swagger.v3.oas.annotations.Operation;
+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 io.swagger.v3.oas.annotations.responses.ApiResponses;
+import io.swagger.v3.oas.annotations.tags.Tag;
import java.io.IOException;
import java.util.Optional;
@@ -34,7 +36,6 @@ import java.util.Optional;
import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ApplicationConfigParser;
import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ConfigurationFile;
import org.onap.ccsdk.oran.a1policymanagementservice.controllers.VoidResponse;
-import org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2.ErrorResponse.ErrorInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -47,10 +48,13 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@RestController("ConfigurationControllerV2")
-@Api(tags = {Consts.V2_CONFIG_API_NAME})
+@Tag(name = ConfigurationController.API_NAME)
public class ConfigurationController {
private static final Logger logger = LoggerFactory.getLogger(ConfigurationController.class);
+ public static final String API_NAME = "Management of configuration";
+ public static final String API_DESCRIPTION = "";
+
@Autowired
ConfigurationFile configurationFile;
@@ -58,13 +62,18 @@ public class ConfigurationController {
.create(); //
@PutMapping(path = Consts.V2_API_ROOT + "/configuration", consumes = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Replace the current configuration file with the given configuration", //
- notes = "Note that the file is ignored if the Consul is used.")
+ @Operation(summary = "Replace the current configuration file with the given configuration", //
+ description = "Note that the file is ignored if the Consul is used.")
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "Configuration updated", response = VoidResponse.class), //
- @ApiResponse(code = 400, message = "Invalid configuration provided", response = ErrorInfo.class), //
- @ApiResponse(code = 500, message = "Something went wrong when replacing the configuration. Try again.",
- response = ErrorResponse.ErrorInfo.class) //
+ @ApiResponse(responseCode = "200", //
+ description = "Configuration updated", //
+ content = @Content(schema = @Schema(implementation = VoidResponse.class))), //
+ @ApiResponse(responseCode = "400", //
+ description = "Invalid configuration provided", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))), //
+ @ApiResponse(responseCode = "500", //
+ description = "Something went wrong when replacing the configuration. Try again.", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))) //
})
public ResponseEntity<Object> putConfiguration(@RequestBody Object configuration) {
try {
@@ -86,13 +95,17 @@ public class ConfigurationController {
}
@GetMapping(path = Consts.V2_API_ROOT + "/configuration", produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Returns the contents of the configuration file", //
- notes = "Note that the file contents is not relevant if the Consul is used.") //
+ @Operation(summary = "Returns the contents of the configuration file", //
+ description = "Note that the file contents is not relevant if the Consul is used.") //
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "Configuration", response = Object.class), //
- @ApiResponse(code = 404, message = "File is not found or readable",
- response = ErrorResponse.ErrorInfo.class)} //
- )
+ @ApiResponse(responseCode = "200", //
+ description = "Configuration", //
+ content = @Content(schema = @Schema(implementation = Object.class))), //
+ @ApiResponse(responseCode = "404", //
+ description = "File is not found or readable", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class)))
+
+ })
public ResponseEntity<Object> getConfiguration() {
try {
Optional<JsonObject> rootObject = configurationFile.readFile();
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/Consts.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/Consts.java
index d365ad9a..c3eff84a 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/Consts.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/Consts.java
@@ -29,8 +29,9 @@ public class Consts {
public static final String MANAGED_ELEMENT_ID_PARAM = "managed_element_id";
public static final String V2_API_ROOT = "a1-policy/v2";
- public static final String V2_API_NAME = "A1 Policy Management Version 2.0";
- public static final String V2_CONFIG_API_NAME = "Component Configuration";
+
+ public static final String V2_API_SERVICE_CALLBACKS_NAME = "Callbacks";
+ public static final String V2_API_SERVICE_CALLBACKS_DESCRIPTION = "";
private Consts() {}
}
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ErrorResponse.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ErrorResponse.java
index da321655..c3ee1952 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ErrorResponse.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ErrorResponse.java
@@ -24,8 +24,7 @@ import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.annotations.SerializedName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
@@ -38,7 +37,7 @@ public class ErrorResponse {
.create(); //
// Returned as body for all failed REST calls
- @ApiModel(value = "error_information", description = "Problem as defined in https://tools.ietf.org/html/rfc7807")
+ @Schema(name = "error_information", description = "Problem as defined in https://tools.ietf.org/html/rfc7807")
public static class ErrorInfo {
@SerializedName("type")
private String type = "about:blank";
@@ -60,21 +59,21 @@ public class ErrorResponse {
this.status = status;
}
- @ApiModelProperty(example = "503",
- value = "The HTTP status code generated by the origin server for this occurrence of the problem. ")
+ @Schema(example = "503",
+ description = "The HTTP status code generated by the origin server for this occurrence of the problem. ")
public Integer getStatus() {
return status;
}
- @ApiModelProperty(example = "Policy type not found",
- value = " A human-readable explanation specific to this occurrence of the problem.")
+ @Schema(example = "Policy type not found",
+ description = " A human-readable explanation specific to this occurrence of the problem.")
public String getDetail() {
return this.detail;
}
}
- @ApiModelProperty(value = "message")
+ @Schema(name = "message", description = "message")
public final String message;
ErrorResponse(String message) {
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyController.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyController.java
index 850635f6..1f0e1603 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyController.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyController.java
@@ -23,11 +23,13 @@ package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+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 io.swagger.v3.oas.annotations.responses.ApiResponses;
+import io.swagger.v3.oas.annotations.tags.Tag;
import java.lang.invoke.MethodHandles;
import java.time.Instant;
@@ -67,9 +69,12 @@ import org.springframework.web.reactive.function.client.WebClientResponseExcepti
import reactor.core.publisher.Mono;
@RestController("PolicyControllerV2")
-@Api(tags = {Consts.V2_API_NAME})
+@Tag(name = PolicyController.API_NAME)
public class PolicyController {
+ public static final String API_NAME = "A1 Policy Management";
+ public static final String API_DESCRIPTION = "";
+
public static class RejectionException extends Exception {
private static final long serialVersionUID = 1L;
@@ -97,12 +102,16 @@ public class PolicyController {
private static Gson gson = new GsonBuilder() //
.create(); //
- @GetMapping(path = Consts.V2_API_ROOT + "/policy-types/{policytype_id:.+}",
- produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Returns a policy type definition")
+ @GetMapping(path = Consts.V2_API_ROOT + "/policy-types/{policytype_id:.+}") //
+ @Operation(summary = "Returns a policy type definition") //
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "Policy type", response = PolicyTypeInfo.class), //
- @ApiResponse(code = 404, message = "Policy type is not found", response = ErrorResponse.ErrorInfo.class)})
+ @ApiResponse(responseCode = "200", //
+ description = "Policy type", //
+ content = @Content(schema = @Schema(implementation = PolicyTypeInfo.class))), //
+ @ApiResponse(responseCode = "404", //
+ description = "Policy type is not found", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class)))//
+ })
public ResponseEntity<Object> getPolicyType( //
@PathVariable("policytype_id") String policyTypeId) throws EntityNotFoundException {
PolicyType type = policyTypes.getType(policyTypeId);
@@ -111,12 +120,18 @@ public class PolicyController {
}
@GetMapping(path = Consts.V2_API_ROOT + "/policy-types", produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Query policy type identities", produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiResponses(value = {@ApiResponse(code = 200, message = "Policy type IDs", response = PolicyTypeIdList.class),
- @ApiResponse(code = 404, message = "Near-RT RIC is not found", response = ErrorResponse.ErrorInfo.class)})
+ @Operation(summary = "Query policy type identities")
+ @ApiResponses(value = { //
+ @ApiResponse(responseCode = "200", //
+ description = "Policy type IDs", //
+ content = @Content(schema = @Schema(implementation = PolicyTypeIdList.class))), //
+ @ApiResponse(responseCode = "404", //
+ description = "Near-RT RIC is not found", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))) //
+ })
public ResponseEntity<Object> getPolicyTypes( //
- @ApiParam(name = Consts.RIC_ID_PARAM, required = false,
- value = "The identity of the Near-RT RIC to get types for.") //
+ @Parameter(name = Consts.RIC_ID_PARAM, required = false,
+ description = "The identity of the Near-RT RIC to get types for.") //
@RequestParam(name = Consts.RIC_ID_PARAM, required = false) String ricId) throws EntityNotFoundException {
if (ricId == null) {
Collection<PolicyType> types = this.policyTypes.getAll();
@@ -128,11 +143,15 @@ public class PolicyController {
}
@GetMapping(path = Consts.V2_API_ROOT + "/policies/{policy_id:.+}", produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Returns a policy") //
+ @Operation(summary = "Returns a policy") //
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "Policy found", response = PolicyInfo.class), //
- @ApiResponse(code = 404, message = "Policy is not found", response = ErrorResponse.ErrorInfo.class)} //
- )
+ @ApiResponse(responseCode = "200", //
+ description = "Policy found", //
+ content = @Content(schema = @Schema(implementation = PolicyInfo.class))), //
+ @ApiResponse(responseCode = "404", //
+ description = "Policy is not found", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))) //
+ })
public ResponseEntity<Object> getPolicy( //
@PathVariable(name = Consts.POLICY_ID_PARAM, required = true) String id) throws EntityNotFoundException {
Policy p = policies.getPolicy(id);
@@ -140,18 +159,27 @@ public class PolicyController {
}
@DeleteMapping(Consts.V2_API_ROOT + "/policies/{policy_id:.+}")
- @ApiOperation(value = "Delete a policy")
+ @Operation(summary = "Delete a policy")
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "Not used", response = VoidResponse.class),
- @ApiResponse(code = 204, message = "Policy deleted", response = VoidResponse.class),
- @ApiResponse(code = 404, message = "Policy is not found", response = ErrorResponse.ErrorInfo.class),
- @ApiResponse(code = 423, message = "Near-RT RIC is not operational",
- response = ErrorResponse.ErrorInfo.class)})
+ @ApiResponse(responseCode = "200", //
+ description = "Not used", //
+ content = @Content(schema = @Schema(implementation = VoidResponse.class))), //
+ @ApiResponse(responseCode = "204", //
+ description = "Policy deleted", //
+ content = @Content(schema = @Schema(implementation = VoidResponse.class))), //
+ @ApiResponse(responseCode = "404", //
+ description = "Policy is not found", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))), //
+ @ApiResponse(responseCode = "423", //
+ description = "Near-RT RIC is not operational", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))) //
+ })
public Mono<ResponseEntity<Object>> deletePolicy( //
@PathVariable(Consts.POLICY_ID_PARAM) String policyId) throws EntityNotFoundException {
Policy policy = policies.getPolicy(policyId);
keepServiceAlive(policy.ownerServiceId());
Ric ric = policy.ric();
+
return ric.getLock().lock(LockType.SHARED) //
.flatMap(notUsed -> assertRicStateIdle(ric)) //
.flatMap(notUsed -> a1ClientFactory.createA1Client(policy.ric())) //
@@ -164,14 +192,20 @@ public class PolicyController {
}
@PutMapping(path = Consts.V2_API_ROOT + "/policies", produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Create or update a policy")
+ @Operation(summary = "Create or update a policy")
@ApiResponses(value = { //
- @ApiResponse(code = 201, message = "Policy created", response = VoidResponse.class), //
- @ApiResponse(code = 200, message = "Policy updated", response = VoidResponse.class), //
- @ApiResponse(code = 423, message = "Near-RT RIC is not operational",
- response = ErrorResponse.ErrorInfo.class), //
- @ApiResponse(code = 404, message = "Near-RT RIC or policy type is not found",
- response = ErrorResponse.ErrorInfo.class) //
+ @ApiResponse(responseCode = "201", //
+ description = "Policy created", //
+ content = @Content(schema = @Schema(implementation = VoidResponse.class))), //
+ @ApiResponse(responseCode = "200", //
+ description = "Policy updated", //
+ content = @Content(schema = @Schema(implementation = VoidResponse.class))), //
+ @ApiResponse(responseCode = "423", //
+ description = "Near-RT RIC is not operational", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))), //
+ @ApiResponse(responseCode = "404", //
+ description = "Near-RT RIC or policy type is not found", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))) //
})
public Mono<ResponseEntity<Object>> putPolicy(@RequestBody PolicyInfo policyInfo) throws EntityNotFoundException {
@@ -263,20 +297,24 @@ public class PolicyController {
+ "If several query parameters are defined, the policies matching all conditions are returned.";
@GetMapping(path = Consts.V2_API_ROOT + "/policy-instances", produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Query for A1 policy instances", notes = GET_POLICIES_QUERY_DETAILS)
+ @Operation(summary = "Query for A1 policy instances", description = GET_POLICIES_QUERY_DETAILS)
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "Policies", response = PolicyInfoList.class),
- @ApiResponse(code = 404, message = "Near-RT RIC, policy type or service not found",
- response = ErrorResponse.ErrorInfo.class)})
+ @ApiResponse(responseCode = "200", //
+ description = "Policies", //
+ content = @Content(schema = @Schema(implementation = PolicyInfoList.class))), //
+ @ApiResponse(responseCode = "404", //
+ description = "Near-RT RIC, policy type or service not found", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))) //
+ })
public ResponseEntity<Object> getPolicyInstances( //
- @ApiParam(name = Consts.POLICY_TYPE_ID_PARAM, required = false,
- value = "The identity of the policy type to get policies for.") //
+ @Parameter(name = Consts.POLICY_TYPE_ID_PARAM, required = false,
+ description = "The identity of the policy type to get policies for.") //
@RequestParam(name = Consts.POLICY_TYPE_ID_PARAM, required = false) String type, //
- @ApiParam(name = Consts.RIC_ID_PARAM, required = false,
- value = "The identity of the Near-RT RIC to get policies for.") //
+ @Parameter(name = Consts.RIC_ID_PARAM, required = false,
+ description = "The identity of the Near-RT RIC to get policies for.") //
@RequestParam(name = Consts.RIC_ID_PARAM, required = false) String ric, //
- @ApiParam(name = Consts.SERVICE_ID_PARAM, required = false,
- value = "The identity of the service to get policies for.") //
+ @Parameter(name = Consts.SERVICE_ID_PARAM, required = false,
+ description = "The identity of the service to get policies for.") //
@RequestParam(name = Consts.SERVICE_ID_PARAM, required = false) String service)
throws EntityNotFoundException //
{
@@ -291,20 +329,25 @@ public class PolicyController {
return new ResponseEntity<>(filteredPolicies, HttpStatus.OK);
}
- @GetMapping(path = Consts.V2_API_ROOT + "/policies", produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Query policy identities", notes = GET_POLICIES_QUERY_DETAILS)
+ @GetMapping(path = Consts.V2_API_ROOT + "/policies", produces = MediaType.APPLICATION_JSON_VALUE) //
+ @Operation(summary = "Query policy identities", description = GET_POLICIES_QUERY_DETAILS) //
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "Policy identities", response = PolicyIdList.class), @ApiResponse(
- code = 404, message = "Near-RT RIC or type not found", response = ErrorResponse.ErrorInfo.class)})
+ @ApiResponse(responseCode = "200", //
+ description = "Policy identities", //
+ content = @Content(schema = @Schema(implementation = PolicyIdList.class))), //
+ @ApiResponse(responseCode = "404", //
+ description = "Near-RT RIC or type not found", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))) //
+ })
public ResponseEntity<Object> getPolicyIds( //
- @ApiParam(name = Consts.POLICY_TYPE_ID_PARAM, required = false,
- value = "The identity of the policy type to get policies for.") //
+ @Parameter(name = Consts.POLICY_TYPE_ID_PARAM, required = false,
+ description = "The identity of the policy type to get policies for.") //
@RequestParam(name = Consts.POLICY_TYPE_ID_PARAM, required = false) String policyTypeId, //
- @ApiParam(name = Consts.RIC_ID_PARAM, required = false,
- value = "The identity of the Near-RT RIC to get policies for.") //
+ @Parameter(name = Consts.RIC_ID_PARAM, required = false,
+ description = "The identity of the Near-RT RIC to get policies for.") //
@RequestParam(name = Consts.RIC_ID_PARAM, required = false) String ricId, //
- @ApiParam(name = Consts.SERVICE_ID_PARAM, required = false,
- value = "The identity of the service to get policies for.") //
+ @Parameter(name = Consts.SERVICE_ID_PARAM, required = false,
+ description = "The identity of the service to get policies for.") //
@RequestParam(name = Consts.SERVICE_ID_PARAM, required = false) String serviceId)
throws EntityNotFoundException //
{
@@ -320,11 +363,15 @@ public class PolicyController {
}
@GetMapping(path = Consts.V2_API_ROOT + "/policies/{policy_id}/status", produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Returns a policy status") //
+ @Operation(summary = "Returns a policy status") //
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "Policy status", response = PolicyStatusInfo.class), //
- @ApiResponse(code = 404, message = "Policy is not found", response = ErrorResponse.ErrorInfo.class)} //
- )
+ @ApiResponse(responseCode = "200", //
+ description = "Policy status", //
+ content = @Content(schema = @Schema(implementation = PolicyStatusInfo.class))), //
+ @ApiResponse(responseCode = "404", //
+ description = "Policy is not found", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))) //
+ })
public Mono<ResponseEntity<Object>> getPolicyStatus( //
@PathVariable(Consts.POLICY_ID_PARAM) String policyId) throws EntityNotFoundException {
Policy policy = policies.getPolicy(policyId);
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyIdList.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyIdList.java
index 329ce5f0..cc9b83aa 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyIdList.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyIdList.java
@@ -23,18 +23,17 @@ package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Collection;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "policy_id_list_v2", description = "A list of policy identities")
+@Schema(name = "policy_id_list_v2", description = "A list of policy identities")
public class PolicyIdList {
- @ApiModelProperty(value = "Policy identities")
+ @Schema(description = "Policy identities")
@SerializedName("policy_ids")
@JsonProperty("policy_ids")
public final Collection<String> policyIds;
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyInfo.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyInfo.java
index 43684a33..d8b98105 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyInfo.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyInfo.java
@@ -23,48 +23,47 @@ package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "policy_info_v2", description = "Information for one A1-P Policy")
+@Schema(name = "policy_info_v2", description = "Information for one A1-P Policy")
public class PolicyInfo {
- @ApiModelProperty(value = "identity of the policy", required = true)
+ @Schema(name = "policy_id", description = "identity of the policy", required = true)
@JsonProperty(value = "policy_id", required = true)
@SerializedName("policy_id")
public String policyId;
- @ApiModelProperty(value = "identity of the policy type", required = true)
+ @Schema(name = "policytype_id", description = "identity of the policy type", required = true)
@JsonProperty(value = "policytype_id", required = true)
@SerializedName("policytype_id")
public String policyTypeId;
- @ApiModelProperty(value = "identity of the target Near-RT RIC", required = true)
+ @Schema(name = "ric_id", description = "identity of the target Near-RT RIC", required = true)
@JsonProperty(value = "ric_id", required = true)
@SerializedName("ric_id")
public String ricId;
- @ApiModelProperty(value = "the configuration of the policy", required = true)
+ @Schema(name = "policy_data", description = "the configuration of the policy", required = true)
@JsonProperty(value = "policy_data", required = true)
@SerializedName("policy_data")
public Object policyData;
- @ApiModelProperty(value = "the name of the service owning the policy", required = true)
+ @Schema(name = "service_id", description = "the name of the service owning the policy", required = true)
@JsonProperty(value = "service_id", required = true)
@SerializedName("service_id")
public String serviceId;
- @ApiModelProperty(
- value = "if true, the policy is deleted at RIC restart. If false, its value is maintained by this service until explicitly deleted. Default false.",
+ @Schema(name = "transient",
+ description = "if true, the policy is deleted at RIC restart. If false, its value is maintained by this service until explicitly deleted. Default false.",
required = false)
@JsonProperty(value = "transient", required = false, defaultValue = "false")
@SerializedName("transient")
public boolean isTransient = false;
- @ApiModelProperty(value = "Callback URI for policy status updates", required = false)
+ @Schema(name = "status_notification_uri", description = "Callback URI for policy status updates", required = false)
@JsonProperty(value = "status_notification_uri", required = false)
@SerializedName("status_notification_uri")
public String statusNotificationUri = "";
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyInfoList.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyInfoList.java
index dde00a52..08923fd9 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyInfoList.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyInfoList.java
@@ -23,18 +23,17 @@ package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Collection;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "policy_info_list_v2", description = "List of policy information")
+@Schema(name = "policy_info_list_v2", description = "List of policy information")
public class PolicyInfoList {
- @ApiModelProperty(value = "List of policy information")
+ @Schema(description = "List of policy information")
@SerializedName("policies")
@JsonProperty("policies")
public final Collection<PolicyInfo> policies;
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyStatusInfo.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyStatusInfo.java
index 6292f049..bc95e54f 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyStatusInfo.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyStatusInfo.java
@@ -23,23 +23,22 @@ package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import java.time.Instant;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "policy_status_info_v2", description = "Status for one A1-P Policy")
+@Schema(name = "policy_status_info_v2", description = "Status for one A1-P Policy")
public class PolicyStatusInfo {
- @ApiModelProperty(value = "timestamp, last modification time")
+ @Schema(description = "timestamp, last modification time")
@SerializedName("last_modified")
@JsonProperty("last_modified")
public String lastModified;
- @ApiModelProperty(value = "the Policy status")
+ @Schema(description = "the Policy status")
@SerializedName("status")
@JsonProperty("status")
public Object status;
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyTypeIdList.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyTypeIdList.java
index ede69d5d..deedf2f7 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyTypeIdList.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyTypeIdList.java
@@ -23,18 +23,17 @@ package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Collection;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "policytype_id_list_v2", description = "Information about policy types")
+@Schema(name = "policytype_id_list_v2", description = "Information about policy types")
public class PolicyTypeIdList {
- @ApiModelProperty(value = "Policy type identities")
+ @Schema(description = "Policy type identities")
@SerializedName("policytype_ids")
@JsonProperty("policytype_ids")
public final Collection<String> policyTypesIds;
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyTypeInfo.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyTypeInfo.java
index b97730e6..7449e94d 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyTypeInfo.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyTypeInfo.java
@@ -25,17 +25,15 @@ import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.annotations.SerializedName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "policytype_v2", description = "Policy type")
+@Schema(name = "policytype_v2", description = "Policy type")
public class PolicyTypeInfo {
- @ApiModelProperty(
- value = "Policy type json scema. The schema is a json object following http://json-schema.org/draft-07/schema")
+ @Schema(description = "Policy type json scema. The schema is a json object following http://json-schema.org/draft-07/schema")
@SerializedName("policy_schema")
@JsonProperty("policy_schema")
public final Object schema;
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicInfo.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicInfo.java
index 85983080..38797cae 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicInfo.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicInfo.java
@@ -23,19 +23,18 @@ package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Collection;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "ric_info_v2", description = "Information for a Near-RT RIC")
+@Schema(name = "ric_info_v2", description = "Information for a Near-RT RIC")
public class RicInfo {
@Gson.TypeAdapters
- @ApiModel(value = "ric_state_v2", description = "Represents the states for a Near-RT RIC")
+ @Schema(name = "ric_state_v2", description = "Represents the states for a Near-RT RIC")
public enum RicState {
UNAVAILABLE, AVAILABLE, SYNCHRONIZING, CONSISTENCY_CHECK
}
@@ -46,22 +45,22 @@ public class RicInfo {
+ "SYNCHRONIZING: The Policy Management Service is synchronizing the view of the Near-RT RIC. Policies cannot be configured. \n"
+ "CONSISTENCY_CHECK: A consistency check between the Policy Management Service and the Near-RT RIC. Policies cannot be configured.";
- @ApiModelProperty(value = "identity of the Near-RT RIC")
+ @Schema(description = "identity of the Near-RT RIC")
@SerializedName("ric_id")
@JsonProperty("ric_id")
public final String ricId;
- @ApiModelProperty(value = "O1 identities for managed entities")
+ @Schema(description = "O1 identities for managed entities")
@SerializedName("managed_element_ids")
@JsonProperty("managed_element_ids")
public final Collection<String> managedElementIds;
- @ApiModelProperty(value = "supported policy types")
+ @Schema(description = "supported policy types")
@SerializedName("policytype_ids")
@JsonProperty("policytype_ids")
public final Collection<String> policyTypeIds;
- @ApiModelProperty(value = STATE_DESCRIPTION, name = "state")
+ @Schema(description = STATE_DESCRIPTION, name = "state")
@SerializedName("state")
@JsonProperty("state")
public final RicState state;
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicInfoList.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicInfoList.java
index 7932dc54..05b9569e 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicInfoList.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicInfoList.java
@@ -23,18 +23,17 @@ package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Collection;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "ric_info_list_v2", description = "List of Near-RT RIC information")
+@Schema(name = "ric_info_list_v2", description = "List of Near-RT RIC information")
public class RicInfoList {
- @ApiModelProperty(value = "List of Near-RT RIC information")
+ @Schema(description = "List of Near-RT RIC information")
@SerializedName("rics")
@JsonProperty("rics")
public final Collection<RicInfo> rics;
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicRepositoryController.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicRepositoryController.java
index f07efa2c..214f62d1 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicRepositoryController.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicRepositoryController.java
@@ -23,11 +23,13 @@ package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+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 io.swagger.v3.oas.annotations.responses.ApiResponses;
+import io.swagger.v3.oas.annotations.tags.Tag;
import java.util.ArrayList;
import java.util.List;
@@ -46,9 +48,12 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController("RicRepositoryControllerV2")
-@Api(tags = {Consts.V2_API_NAME})
+@Tag(name = RicRepositoryController.API_NAME)
public class RicRepositoryController {
+ public static final String API_NAME = "NearRT-RIC Repository";
+ public static final String API_DESCRIPTION = "";
+
@Autowired
private Rics rics;
@@ -69,17 +74,21 @@ public class RicRepositoryController {
* @throws EntityNotFoundException
*/
@GetMapping(path = Consts.V2_API_ROOT + "/rics/ric", produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = GET_RIC_BRIEF, notes = GET_RIC_DETAILS)
+ @Operation(summary = GET_RIC_BRIEF, description = GET_RIC_DETAILS)
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "Near-RT RIC is found", response = RicInfo.class), //
- @ApiResponse(code = 404, message = "Near-RT RIC is not found", response = ErrorResponse.ErrorInfo.class) //
+ @ApiResponse(responseCode = "200", //
+ description = "Near-RT RIC is found", //
+ content = @Content(schema = @Schema(implementation = RicInfo.class))), //
+ @ApiResponse(responseCode = "404", //
+ description = "Near-RT RIC is not found", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))) //
})
public ResponseEntity<Object> getRic( //
- @ApiParam(name = Consts.MANAGED_ELEMENT_ID_PARAM, required = false,
- value = "The identity of a Managed Element. If given, the Near-RT RIC managing the ME is returned.") //
+ @Parameter(name = Consts.MANAGED_ELEMENT_ID_PARAM, required = false,
+ description = "The identity of a Managed Element. If given, the Near-RT RIC managing the ME is returned.") //
@RequestParam(name = Consts.MANAGED_ELEMENT_ID_PARAM, required = false) String managedElementId,
- @ApiParam(name = Consts.RIC_ID_PARAM, required = false,
- value = "The identity of a Near-RT RIC to get information for.") //
+ @Parameter(name = Consts.RIC_ID_PARAM, required = false,
+ description = "The identity of a Near-RT RIC to get information for.") //
@RequestParam(name = Consts.RIC_ID_PARAM, required = false) String ricId)
throws EntityNotFoundException, InvalidRequestException {
if (managedElementId != null && ricId != null) {
@@ -103,13 +112,18 @@ public class RicRepositoryController {
* @throws EntityNotFoundException
*/
@GetMapping(path = Consts.V2_API_ROOT + "/rics", produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Query Near-RT RIC information", notes = QUERY_RIC_INFO_DETAILS)
+ @Operation(summary = "Query Near-RT RIC information", description = QUERY_RIC_INFO_DETAILS)
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "OK", response = RicInfoList.class), //
- @ApiResponse(code = 404, message = "Policy type is not found", response = ErrorResponse.ErrorInfo.class)})
+ @ApiResponse(responseCode = "200", //
+ description = "OK", //
+ content = @Content(schema = @Schema(implementation = RicInfoList.class))), //
+ @ApiResponse(responseCode = "404", //
+ description = "Policy type is not found", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))) //
+ })
public ResponseEntity<Object> getRics( //
- @ApiParam(name = Consts.POLICY_TYPE_ID_PARAM, required = false,
- value = "The identity of a policy type. If given, all Near-RT RICs supporteing the policy type are returned") //
+ @Parameter(name = Consts.POLICY_TYPE_ID_PARAM, required = false,
+ description = "The identity of a policy type. If given, all Near-RT RICs supporteing the policy type are returned") //
@RequestParam(name = Consts.POLICY_TYPE_ID_PARAM, required = false) String supportingPolicyType)
throws EntityNotFoundException {
if ((supportingPolicyType != null) && (this.types.get(supportingPolicyType) == null)) {
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceController.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceController.java
index a8fc7e6d..d3ff999a 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceController.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceController.java
@@ -23,11 +23,13 @@ package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+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 io.swagger.v3.oas.annotations.responses.ApiResponses;
+import io.swagger.v3.oas.annotations.tags.Tag;
import java.net.MalformedURLException;
import java.net.URL;
@@ -54,9 +56,12 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController("ServiceControllerV2")
-@Api(tags = Consts.V2_API_NAME)
+@Tag(name = ServiceController.API_NAME)
public class ServiceController {
+ public static final String API_NAME = "Service Registry and Supervision";
+ public static final String API_DESCRIPTION = "";
+
private final Services services;
private final Policies policies;
@@ -71,13 +76,18 @@ public class ServiceController {
private static final String GET_SERVICE_DETAILS =
"Either information about a registered service with given identity or all registered services are returned.";
- @GetMapping(path = Consts.V2_API_ROOT + "/services", produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Returns service information", notes = GET_SERVICE_DETAILS)
+ @GetMapping(path = Consts.V2_API_ROOT + "/services", produces = MediaType.APPLICATION_JSON_VALUE) //
+ @Operation(summary = "Returns service information", description = GET_SERVICE_DETAILS) //
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "OK", response = ServiceStatusList.class), //
- @ApiResponse(code = 404, message = "Service is not found", response = ErrorResponse.ErrorInfo.class)})
+ @ApiResponse(responseCode = "200", //
+ description = "OK", //
+ content = @Content(schema = @Schema(implementation = ServiceStatusList.class))), //
+ @ApiResponse(responseCode = "404", //
+ description = "Service is not found", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class)))//
+ })
public ResponseEntity<Object> getServices(//
- @ApiParam(name = Consts.SERVICE_ID_PARAM, required = false, value = "The identity of the service") //
+ @Parameter(name = Consts.SERVICE_ID_PARAM, required = false, description = "The identity of the service") //
@RequestParam(name = Consts.SERVICE_ID_PARAM, required = false) String name) {
if (name != null && this.services.get(name) == null) {
return ErrorResponse.create("Service not found", HttpStatus.NOT_FOUND);
@@ -119,13 +129,15 @@ public class ServiceController {
+ "</ul>" //
;
- @ApiOperation(value = "Register a service", notes = REGISTER_SERVICE_DETAILS)
- @ApiResponses(value = { //
- @ApiResponse(code = 200, message = "Service updated"),
- @ApiResponse(code = 201, message = "Service created"), //
- @ApiResponse(code = 400, message = "The ServiceRegistrationInfo is not accepted",
- response = ErrorResponse.ErrorInfo.class)})
@PutMapping(Consts.V2_API_ROOT + "/services")
+ @Operation(summary = "Register a service", description = REGISTER_SERVICE_DETAILS)
+ @ApiResponses(value = { //
+ @ApiResponse(responseCode = "200", description = "Service updated"),
+ @ApiResponse(responseCode = "201", description = "Service created"), //
+ @ApiResponse(responseCode = "400", //
+ description = "The ServiceRegistrationInfo is not accepted", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class)))})
+
public ResponseEntity<Object> putService(//
@RequestBody ServiceRegistrationInfo registrationInfo) {
try {
@@ -138,11 +150,16 @@ public class ServiceController {
}
}
- @ApiOperation(value = "Unregister a service")
+ @Operation(summary = "Unregister a service")
@ApiResponses(value = { //
- @ApiResponse(code = 204, message = "Service unregistered"),
- @ApiResponse(code = 200, message = "Not used", response = VoidResponse.class),
- @ApiResponse(code = 404, message = "Service not found", response = ErrorResponse.ErrorInfo.class)})
+ @ApiResponse(responseCode = "204", description = "Service unregistered"),
+ @ApiResponse(responseCode = "200", description = "Not used",
+ content = @Content(schema = @Schema(implementation = VoidResponse.class))),
+ @ApiResponse(responseCode = "404", description = "Service not found",
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class)))
+
+ })
+
@DeleteMapping(Consts.V2_API_ROOT + "/services/{service_id:.+}")
public ResponseEntity<Object> deleteService(//
@PathVariable("service_id") String serviceId) {
@@ -157,11 +174,14 @@ public class ServiceController {
}
}
- @ApiOperation(value = "Heartbeat indicates that the service is running")
+ @Operation(summary = "Heartbeat indicates that the service is running",
+ description = "A registerred service must call this in regular intervals to indicate that it is in operation. Absence of this call will lead to that teh service will be deregisterred and all its policies are removed.")
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "Service supervision timer refreshed, OK"), //
- @ApiResponse(code = 404, message = "The service is not found, needs re-registration",
- response = ErrorResponse.ErrorInfo.class)})
+ @ApiResponse(responseCode = "200", description = "Service supervision timer refreshed, OK"), //
+ @ApiResponse(responseCode = "404", description = "The service is not found, needs re-registration",
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class)))
+
+ })
@PutMapping(Consts.V2_API_ROOT + "/services/{service_id}/keepalive")
public ResponseEntity<Object> keepAliveService(//
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceRegistrationInfo.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceRegistrationInfo.java
index 88711164..16f1f163 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceRegistrationInfo.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceRegistrationInfo.java
@@ -23,22 +23,21 @@ package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "service_registration_info_v2", description = "Information for one service")
+@Schema(name = "service_registration_info_v2", description = "Information for one service")
public class ServiceRegistrationInfo {
- @ApiModelProperty(value = "identity of the service", required = true, allowEmptyValue = false)
- @SerializedName(value = "service_id")
+ @Schema(description = "identity of the service", required = true)
+ @SerializedName("service_id")
@JsonProperty("service_id")
public String serviceId = "";
- @ApiModelProperty(value = "keep alive interval for the service. This is a heartbeat supervision of the service, "
- + "which in regular intevals must invoke a 'keepAlive' REST call. "
+ @Schema(description = "keep alive interval for the service. This is a heartbeat supervision of the service, "
+ + "which in regular intevals must invoke a 'keepalive' REST call. "
+ "When a service does not invoke this call within the given time, it is considered unavailble. "
+ "An unavailable service will be automatically deregistered and its policies will be deleted. "
+ "Value 0 means no timeout supervision.")
@@ -46,8 +45,7 @@ public class ServiceRegistrationInfo {
@JsonProperty("keep_alive_interval_seconds")
public long keepAliveIntervalSeconds = 0;
- @ApiModelProperty(value = "callback for notifying of Near-RT RIC state changes", required = false,
- allowEmptyValue = true)
+ @Schema(description = "callback for notifying of Near-RT RIC state changes", required = false)
@SerializedName("callback_url")
@JsonProperty("callback_url")
public String callbackUrl = "";
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceStatus.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceStatus.java
index 221fef8d..02869485 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceStatus.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceStatus.java
@@ -23,31 +23,30 @@ package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "service_status_v2")
+@Schema(name = "service_status_v2")
public class ServiceStatus {
- @ApiModelProperty(value = "identity of the service")
+ @Schema(description = "identity of the service")
@SerializedName("service_id")
@JsonProperty("service_id")
public final String serviceId;
- @ApiModelProperty(value = "policy keep alive timeout")
+ @Schema(description = "policy keep alive timeout")
@SerializedName("keep_alive_interval_seconds")
@JsonProperty("keep_alive_interval_seconds")
public final long keepAliveIntervalSeconds;
- @ApiModelProperty(value = "time since last invocation by the service")
+ @Schema(description = "time since last invocation by the service")
@SerializedName("time_since_last_activity_seconds")
@JsonProperty("time_since_last_activity_seconds")
public final long timeSinceLastActivitySeconds;
- @ApiModelProperty(value = "callback for notifying of RIC synchronization")
+ @Schema(description = "callback for notifying of RIC synchronization")
@SerializedName("callback_url")
@JsonProperty("callback_url")
public String callbackUrl;
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceStatusList.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceStatusList.java
index a7ffeca0..981c95b6 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceStatusList.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceStatusList.java
@@ -23,18 +23,17 @@ package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Collection;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "service_list_v2", description = "List of service information")
+@Schema(name = "service_list_v2", description = "List of service information")
public class ServiceStatusList {
- @ApiModelProperty(value = "List of service information")
+ @Schema(description = "List of service information")
@SerializedName("service_list")
@JsonProperty("service_list")
public final Collection<ServiceStatus> statusList;
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/StatusController.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/StatusController.java
index 1c5a473b..2318d55d 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/StatusController.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/StatusController.java
@@ -20,12 +20,12 @@
package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
+import io.swagger.v3.oas.annotations.Operation;
+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 io.swagger.v3.oas.annotations.responses.ApiResponses;
+import io.swagger.v3.oas.annotations.tags.Tag;
import org.immutables.gson.Gson;
import org.springframework.http.HttpStatus;
@@ -36,13 +36,16 @@ import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;
@RestController("StatusControllerV2")
-@Api(tags = Consts.V2_API_NAME)
+@Tag(name = StatusController.API_NAME)
public class StatusController {
+ public static final String API_NAME = "Health Check";
+ public static final String API_DESCRIPTION = "";
+
@Gson.TypeAdapters
- @ApiModel(value = "status_info_v2")
+ @Schema(name = "status_info_v2")
class StatusInfo {
- @ApiModelProperty(value = "status text")
+ @Schema(description = "status text")
public final String status;
StatusInfo(String status) {
@@ -51,10 +54,13 @@ public class StatusController {
}
@GetMapping(path = Consts.V2_API_ROOT + "/status", produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Returns status and statistics of this service")
+ @Operation(summary = "Returns status and statistics of this service")
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "Service is living", response = StatusInfo.class) //
+ @ApiResponse(responseCode = "200", //
+ description = "Service is living", //
+ content = @Content(schema = @Schema(implementation = StatusInfo.class))), //
})
+
public Mono<ResponseEntity<Object>> getStatus() {
StatusInfo info = new StatusInfo("hunky dory");
return Mono.just(new ResponseEntity<>(info, HttpStatus.OK));