summaryrefslogtreecommitdiffstats
path: root/a1-policy-management/src
diff options
context:
space:
mode:
authorKAPIL SINGAL <ks220y@att.com>2020-08-27 12:41:50 +0000
committerGerrit Code Review <gerrit@onap.org>2020-08-27 12:41:50 +0000
commit7e634df0672f4ed7e6a89c373dfab08439cea630 (patch)
tree11ef1a4b26bec5692860ec5a67caa536453838bf /a1-policy-management/src
parent65b21c2bfdc80ba934657d73b5c8631d6f72f7c1 (diff)
parent4b4404a2ab0b239a1cc17510196195ec599d66ae (diff)
Merge "Some improvements if NBI V2.0"
Diffstat (limited to 'a1-policy-management/src')
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/SwaggerConfig.java36
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientFactory.java10
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/SdncOscA1Client.java4
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/PolicyController.java41
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/PolicyInfo.java2
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/RicInfo.java2
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/RicRepositoryController.java6
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/JsonObject.java4
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/JsonSchema.java30
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyController.java46
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyInfo.java2
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicySchemaList.java3
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicInfo.java14
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicInfoList.java4
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicRepositoryController.java46
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceController.java22
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/repository/Ric.java8
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSupervision.java2
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSynchronizationTask.java4
-rw-r--r--a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/ApplicationTestV2.java2
-rw-r--r--a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RefreshConfigTaskTest.java35
21 files changed, 162 insertions, 161 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 4b684288..a5636592 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
@@ -22,6 +22,9 @@ package org.onap.ccsdk.oran.a1policymanagementservice;
import com.google.common.base.Predicates;
+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;
@@ -32,6 +35,8 @@ 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;
@@ -48,16 +53,16 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
public class SwaggerConfig extends WebMvcConfigurationSupport {
static final String API_TITLE = "A1 Policy management service";
- static final String DESCRIPTION =
- "The O-RAN NonRT-RIC PolicyAgent provides a REST API for management of policices. \n"
- + "It provides support for: \n"
- + "-Supervision of clients (R-APPs) to eliminate stray policies in case of failure \n"
- + "-Consistency monitoring of the SMO view of policies and the actual situation in the NearRT-RICs \n"
- + "-Consistency monitoring of NearRT-RIC capabilities (policy types)" + "-Policy configuration. \n"
- + "This includes:" + "-One REST API towards all NearRT-RICs in the network \n"
- + "-Query functions that can find all policies in a NearRT-RIC, all policies owned by a service (R-APP), \n"
- + "all policies of a type etc. \n"
- + "-Maps O1 resources (ManagedElement) as defined in O1 to the controlling NearRT-RIC of A1 policices.\n";
+ 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/";
@@ -90,9 +95,20 @@ public class SwaggerConfig extends WebMvcConfigurationSupport {
.description(DESCRIPTION) //
.version(VERSION) //
.contact(contact()) //
+ .extensions(vendorExtentions()) //
.build();
}
+ @SuppressWarnings("rawtypes") // 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;
+ }
+
private static Contact contact() {
return new Contact("Ericsson Software Technology", "", "nonrtric@est.tech");
}
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientFactory.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientFactory.java
index 2b493575..31a706b4 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientFactory.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientFactory.java
@@ -60,9 +60,9 @@ public class A1ClientFactory {
* means that after the first successful creation it won't have to try which
* protocol to use, but can create the client directly.
*
- * @param ric The NearRT-RIC to get a client for.
+ * @param ric The Near-RT RIC to get a client for.
* @return a client with the correct protocol, or a ServiceException if none of
- * the protocols are supported by the NearRT-RIC.
+ * the protocols are supported by the Near-RT RIC.
*/
public Mono<A1Client> createA1Client(Ric ric) {
return getProtocolVersion(ric) //
@@ -91,7 +91,7 @@ public class A1ClientFactory {
String controllerName = ric.getConfig().controllerName();
if (controllerName.isEmpty()) {
ric.setProtocolVersion(A1ProtocolType.UNKNOWN);
- throw new ServiceException("No controller configured for NearRT-RIC: " + ric.id());
+ throw new ServiceException("No controller configured for Near-RT RIC: " + ric.id());
}
try {
return this.appConfig.getControllerConfig(controllerName);
@@ -125,8 +125,8 @@ public class A1ClientFactory {
.onErrorResume(notUsed -> fetchVersion(ric, A1ProtocolType.SDNC_ONAP)) //
.doOnNext(ric::setProtocolVersion)
.doOnNext(
- version -> logger.debug("Established protocol version:{} for NearRT-RIC: {}", version, ric.id())) //
- .doOnError(notUsed -> logger.warn("Could not get protocol version from NearRT-RIC: {}", ric.id())) //
+ version -> logger.debug("Established protocol version:{} for Near-RT RIC: {}", version, ric.id())) //
+ .doOnError(notUsed -> logger.warn("Could not get protocol version from Near-RT RIC: {}", ric.id())) //
.onErrorResume(
notUsed -> Mono.error(new ServiceException("Protocol negotiation failed for " + ric.id())));
} else {
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/SdncOscA1Client.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/SdncOscA1Client.java
index dffb9dd8..4ad08ce2 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/SdncOscA1Client.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/SdncOscA1Client.java
@@ -83,7 +83,7 @@ public class SdncOscA1Client implements A1Client {
*
* @param protocolType the southbound protocol of the controller. Supported
* protocols are SDNC_OSC_STD_V1_1 and SDNC_OSC_OSC_V1
- * @param ricConfig the configuration of the NearRT-RIC to communicate
+ * @param ricConfig the configuration of the Near-RT RIC to communicate
* with
* @param controllerConfig the configuration of the SDNC controller to use
*
@@ -101,7 +101,7 @@ public class SdncOscA1Client implements A1Client {
*
* @param protocolType the southbound protocol of the controller. Supported
* protocols are SDNC_OSC_STD_V1_1 and SDNC_OSC_OSC_V1
- * @param ricConfig the configuration of the NearRT-RIC to communicate
+ * @param ricConfig the configuration of the Near-RT RIC to communicate
* with
* @param controllerConfig the configuration of the SDNC controller to use
* @param restClient the REST client to use
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 2c8ad7f2..90666e7a 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
@@ -100,9 +100,9 @@ public class PolicyController {
@ApiResponses(
value = {
@ApiResponse(code = 200, message = "Policy schemas", response = Object.class, responseContainer = "List"), //
- @ApiResponse(code = 404, message = "NearRT-RIC is not found", response = String.class)})
+ @ApiResponse(code = 404, message = "Near-RT RIC is not found", response = String.class)})
public ResponseEntity<String> getPolicySchemas( //
- @ApiParam(name = "ric", required = false, value = "The name of the NearRT-RIC to get the definitions for.") //
+ @ApiParam(name = "ric", required = false, value = "The name of the Near-RT RIC to get the definitions for.") //
@RequestParam(name = "ric", required = false) String ricName) {
if (ricName == null) {
Collection<PolicyType> types = this.policyTypes.getAll();
@@ -143,9 +143,9 @@ public class PolicyController {
message = "Policy type names",
response = String.class,
responseContainer = "List"),
- @ApiResponse(code = 404, message = "NearRT-RIC is not found", response = String.class)})
+ @ApiResponse(code = 404, message = "Near-RT RIC is not found", response = String.class)})
public ResponseEntity<String> getPolicyTypes( //
- @ApiParam(name = "ric", required = false, value = "The name of the NearRT-RIC to get types for.") //
+ @ApiParam(name = "ric", required = false, value = "The name of the Near-RT RIC to get types for.") //
@RequestParam(name = "ric", required = false) String ricName) {
if (ricName == null) {
Collection<PolicyType> types = this.policyTypes.getAll();
@@ -185,7 +185,7 @@ public class PolicyController {
@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 = "NearRT-RIC is not operational", response = String.class)})
+ @ApiResponse(code = 423, message = "Near-RT RIC is not operational", response = String.class)})
public Mono<ResponseEntity<Object>> deletePolicy( //
@ApiParam(name = "id", required = true, value = "The identity of the policy instance.") //
@RequestParam(name = "id", required = true) String id) {
@@ -208,27 +208,27 @@ public class PolicyController {
}
@PutMapping(path = "/policy")
- @ApiOperation(value = "Put a policy", response = String.class)
+ @ApiOperation(value = "Put a policy", response = VoidResponse.class)
@ApiResponses(
value = { //
@ApiResponse(code = 201, message = "Policy created", response = VoidResponse.class), //
@ApiResponse(code = 200, message = "Policy updated", response = VoidResponse.class), //
- @ApiResponse(code = 423, message = "NearRT-RIC is not operational", response = String.class), //
- @ApiResponse(code = 404, message = "NearRT-RIC or policy type is not found", response = String.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) //
})
public Mono<ResponseEntity<Object>> putPolicy( //
@ApiParam(name = "type", required = false, value = "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.") //
@RequestParam(name = "id", required = true) String instanceId, //
- @ApiParam(name = "ric", required = true, value = "The name of the NearRT-RIC where the policy will be " + //
+ @ApiParam(name = "ric", required = true, value = "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.") //
@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 NearRT-RIC.") //
+ "reconnect to the Near-RT RIC.") //
@RequestParam(name = "transient", required = false, defaultValue = "false") boolean isTransient, //
@RequestBody Object jsonBody) {
@@ -321,11 +321,11 @@ public class PolicyController {
@ApiResponses(
value = {
@ApiResponse(code = 200, message = "Policies", response = PolicyInfo.class, responseContainer = "List"),
- @ApiResponse(code = 404, message = "NearRT-RIC or type not found", response = String.class)})
+ @ApiResponse(code = 404, message = "Near-RT RIC or type not found", response = String.class)})
public ResponseEntity<String> getPolicies( //
@ApiParam(name = "type", required = false, value = "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 NearRT-RIC to get policies for.") //
+ @ApiParam(name = "ric", required = false, value = "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.") //
@RequestParam(name = "service", required = false) String service) //
@@ -334,7 +334,7 @@ public class PolicyController {
return new ResponseEntity<>("Policy type not found", HttpStatus.NOT_FOUND);
}
if ((ric != null && this.rics.get(ric) == null)) {
- return new ResponseEntity<>("NearRT-RIC not found", HttpStatus.NOT_FOUND);
+ return new ResponseEntity<>("Near-RT RIC not found", HttpStatus.NOT_FOUND);
}
String filteredPolicies = policiesToJson(filter(type, ric, service));
@@ -342,14 +342,19 @@ public class PolicyController {
}
@GetMapping("/policy_ids")
- @ApiOperation(value = "Query policies, only IDs returned")
+ @ApiOperation(value = "Query policies, only policy identities returned")
@ApiResponses(
- value = {@ApiResponse(code = 200, message = "Policy ids", response = String.class, responseContainer = "List"),
- @ApiResponse(code = 404, message = "NearRT-RIC or type not found", response = String.class)})
+ 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)})
public ResponseEntity<String> getPolicyIds( //
@ApiParam(name = "type", required = false, value = "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 NearRT-RIC to get policies for.") //
+ @ApiParam(name = "ric", required = false, value = "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.") //
@RequestParam(name = "service", required = false) String service) //
@@ -358,7 +363,7 @@ public class PolicyController {
return new ResponseEntity<>("Policy type not found", HttpStatus.NOT_FOUND);
}
if ((ric != null && this.rics.get(ric) == null)) {
- return new ResponseEntity<>("NearRT-RIC not found", HttpStatus.NOT_FOUND);
+ return new ResponseEntity<>("Near-RT RIC not found", HttpStatus.NOT_FOUND);
}
String policyIdsJson = toPolicyIdsJson(filter(type, ric, service));
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 4cb91c0d..c4862016 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
@@ -35,7 +35,7 @@ public class PolicyInfo {
@ApiModelProperty(value = "name of the policy type")
public String type;
- @ApiModelProperty(value = "identity of the target NearRT-RIC")
+ @ApiModelProperty(value = "identity of the target Near-RT RIC")
public String ric;
@ApiModelProperty(value = "the configuration of the policy")
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 4257a263..467afdb9 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
@@ -30,7 +30,7 @@ import org.immutables.gson.Gson;
@Gson.TypeAdapters
@ApiModel(value = "ric_info_v1")
class RicInfo {
- @ApiModelProperty(value = "identity of the NearRT-RIC")
+ @ApiModelProperty(value = "identity of the Near-RT RIC")
public final String ricName;
@ApiModelProperty(value = "O1 identities for managed entities")
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 5036356e..cd56abda 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
@@ -64,8 +64,8 @@ public class RicRepositoryController {
@ApiOperation(value = "Returns the name of a RIC managing one Mananged Element")
@ApiResponses(
value = { //
- @ApiResponse(code = 200, message = "NearRT-RIC is found", response = String.class), //
- @ApiResponse(code = 404, message = "NearRT-RIC is not found", response = String.class) //
+ @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) //
})
public ResponseEntity<String> getRic( //
@ApiParam(name = "managedElementId", required = true, value = "The identity of the Managed Element") //
@@ -83,7 +83,7 @@ public class RicRepositoryController {
* @return a Json array of all RIC data Example: http://localhost:8081/ric
*/
@GetMapping("/rics")
- @ApiOperation(value = "Query NearRT-RIC information")
+ @ApiOperation(value = "Query Near-RT RIC information")
@ApiResponses(
value = { //
@ApiResponse(code = 200, message = "OK", response = RicInfo.class, responseContainer = "List"), //
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/JsonObject.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/JsonObject.java
index 9290ca07..22227656 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/JsonObject.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/JsonObject.java
@@ -25,6 +25,8 @@ import io.swagger.annotations.ApiModel;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "json_object", description = "A JSON object. The schema is defined by the Policy Type")
+@ApiModel(
+ value = "json_object",
+ description = "A JSON object defining the configuration of the policy. The schema is defined by the Policy Type.")
class JsonObject {
}
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/JsonSchema.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/JsonSchema.java
deleted file mode 100644
index ff1b8edc..00000000
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/JsonSchema.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*-
- * ========================LICENSE_START=================================
- * ONAP : ccsdk oran
- * ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
- * ======================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ========================LICENSE_END===================================
- */
-
-package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2;
-
-import io.swagger.annotations.ApiModel;
-
-import org.immutables.gson.Gson;
-
-@Gson.TypeAdapters
-@ApiModel(value = "json_schema", description = "A JSON schema following http://json-schema.org/draft-07/schema")
-class JsonSchema {
-}
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 9bf6c4b5..9d9aff45 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
@@ -66,7 +66,7 @@ import org.springframework.web.reactive.function.client.WebClientResponseExcepti
import reactor.core.publisher.Mono;
@RestController("PolicyControllerV2")
-@Api(tags = Consts.V2_API_NAME)
+@Api(tags = {Consts.V2_API_NAME}, description = "Policy management")
public class PolicyController {
public static class RejectionException extends Exception {
@@ -102,12 +102,12 @@ public class PolicyController {
@ApiResponses(
value = { //
@ApiResponse(code = 200, message = "Policy schemas", response = PolicySchemaList.class), //
- @ApiResponse(code = 404, message = "NearRT-RIC is not found", response = ErrorResponse.ErrorInfo.class)})
+ @ApiResponse(code = 404, message = "Near-RT RIC is not found", response = ErrorResponse.ErrorInfo.class)})
public ResponseEntity<Object> getPolicySchemas( //
@ApiParam(
name = Consts.RIC_ID_PARAM,
required = false,
- value = "The identity of the NearRT-RIC to get the definitions for.") //
+ value = "The identity of the Near-RT RIC to get the definitions for.") //
@RequestParam(name = Consts.RIC_ID_PARAM, required = false) String ricId,
@ApiParam(
name = Consts.POLICY_TYPE_ID_PARAM,
@@ -141,12 +141,12 @@ public class PolicyController {
@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 = "NearRT-RIC is not found", response = ErrorResponse.ErrorInfo.class)})
+ @ApiResponse(code = 404, message = "Near-RT RIC is not found", response = ErrorResponse.ErrorInfo.class)})
public ResponseEntity<Object> getPolicyTypes( //
@ApiParam(
name = Consts.RIC_ID_PARAM,
required = false,
- value = "The identity of the NearRT-RIC to get types for.") //
+ value = "The identity of the Near-RT RIC to get types for.") //
@RequestParam(name = Consts.RIC_ID_PARAM, required = false) String ricId) {
if (ricId == null) {
Collection<PolicyType> types = this.policyTypes.getAll();
@@ -188,7 +188,7 @@ public class PolicyController {
@ApiResponse(code = 404, message = "Policy is not found", response = ErrorResponse.ErrorInfo.class),
@ApiResponse(
code = 423,
- message = "NearRT-RIC is not operational",
+ message = "Near-RT RIC is not operational",
response = ErrorResponse.ErrorInfo.class)})
public Mono<ResponseEntity<Object>> deletePolicy( //
@ApiParam(name = Consts.POLICY_ID_PARAM, required = true, value = "The identity of the policy instance.") //
@@ -219,11 +219,11 @@ public class PolicyController {
@ApiResponse(code = 200, message = "Policy updated", response = VoidResponse.class), //
@ApiResponse(
code = 423,
- message = "NearRT-RIC is not operational",
+ message = "Near-RT RIC is not operational",
response = ErrorResponse.ErrorInfo.class), //
@ApiResponse(
code = 404,
- message = "NearRT-RIC or policy type is not found",
+ message = "Near-RT RIC or policy type is not found",
response = ErrorResponse.ErrorInfo.class) //
})
public Mono<ResponseEntity<Object>> putPolicy( //
@@ -234,7 +234,7 @@ public class PolicyController {
@ApiParam(
name = Consts.RIC_ID_PARAM,
required = true,
- value = "The identity of the NearRT-RIC where the policy will be " + //
+ value = "The identity of the Near-RT RIC where the policy will be " + //
"created.") //
@RequestParam(name = Consts.RIC_ID_PARAM, required = true) String ricId, //
@ApiParam(
@@ -246,7 +246,7 @@ public class PolicyController {
name = Consts.TRANSIENT_PARAM,
required = false,
value = "If the policy is transient or not (boolean " + //
- "defaulted to false). A policy is transient if it will not be recreated in the NearRT-RIC " + //
+ "defaulted to false). A policy is transient if it will not be recreated in the Near-RT RIC " + //
"when it has been lost (for instance due to a restart)") //
@RequestParam(name = Consts.TRANSIENT_PARAM, required = false, defaultValue = "false") boolean isTransient, //
@RequestBody Object jsonBody) {
@@ -256,7 +256,7 @@ public class PolicyController {
PolicyType type = policyTypes.get(policyTypeId);
keepServiceAlive(serviceId);
if (ric == null || type == null) {
- return ErrorResponse.createMono("NearRT-RIC or policy type not found", HttpStatus.NOT_FOUND);
+ return ErrorResponse.createMono("Near-RT RIC or policy type not found", HttpStatus.NOT_FOUND);
}
Policy policy = ImmutablePolicy.builder() //
.id(instanceId) //
@@ -329,16 +329,18 @@ public class PolicyController {
}
}
+ static final String GET_POLICIES_QUERY_DETAILS =
+ "Returns a list of A1 policies matching given search criteria. <br>" //
+ + "If several query parameters are defined, the policies matching all conditions are returned.";
+
@GetMapping(path = Consts.V2_API_ROOT + "/policies", produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(
- value = "Query policies",
- notes = "If several query parameters are defined, the policies matching all conditions are returned")
+ @ApiOperation(value = "Query for existing A1 policies", notes = GET_POLICIES_QUERY_DETAILS)
@ApiResponses(
value = { //
@ApiResponse(code = 200, message = "Policies", response = PolicyInfoList.class),
@ApiResponse(
code = 404,
- message = "NearRT-RIC, policy type or service not found",
+ message = "Near-RT RIC, policy type or service not found",
response = ErrorResponse.ErrorInfo.class)})
public ResponseEntity<Object> getPolicies( //
@ApiParam(
@@ -349,7 +351,7 @@ public class PolicyController {
@ApiParam(
name = Consts.RIC_ID_PARAM,
required = false,
- value = "The identity of the NearRT-RIC to get policies for.") //
+ value = "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,
@@ -361,7 +363,7 @@ public class PolicyController {
return ErrorResponse.create("Policy type not found", HttpStatus.NOT_FOUND);
}
if ((ric != null && this.rics.get(ric) == null)) {
- return ErrorResponse.create("NearRT-RIC not found", HttpStatus.NOT_FOUND);
+ return ErrorResponse.create("Near-RT RIC not found", HttpStatus.NOT_FOUND);
}
String filteredPolicies = policiesToJson(filter(type, ric, service));
@@ -369,13 +371,13 @@ public class PolicyController {
}
@GetMapping(path = Consts.V2_API_ROOT + "/policy-ids", produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Query policies, only IDs returned")
+ @ApiOperation(value = "Query policies, only policy identities are returned", notes = GET_POLICIES_QUERY_DETAILS)
@ApiResponses(
value = { //
- @ApiResponse(code = 200, message = "Policy ids", response = PolicyIdList.class),
+ @ApiResponse(code = 200, message = "Policy identities", response = PolicyIdList.class),
@ApiResponse(
code = 404,
- message = "NearRT-RIC or type not found",
+ message = "Near-RT RIC or type not found",
response = ErrorResponse.ErrorInfo.class)})
public ResponseEntity<Object> getPolicyIds( //
@ApiParam(
@@ -386,7 +388,7 @@ public class PolicyController {
@ApiParam(
name = Consts.RIC_ID_PARAM,
required = false,
- value = "The identity of the NearRT-RIC to get policies for.") //
+ value = "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,
@@ -398,7 +400,7 @@ public class PolicyController {
return ErrorResponse.create("Policy type not found", HttpStatus.NOT_FOUND);
}
if ((ricId != null && this.rics.get(ricId) == null)) {
- return ErrorResponse.create("NearRT-RIC not found", HttpStatus.NOT_FOUND);
+ return ErrorResponse.create("Near-RT RIC not found", HttpStatus.NOT_FOUND);
}
String policyIdsJson = toPolicyIdsJson(filter(policyTypeId, ricId, serviceId));
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 4ba3dc79..673c9455 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
@@ -42,7 +42,7 @@ public class PolicyInfo {
@JsonProperty("policy_type_id")
public String policyTypeId;
- @ApiModelProperty(value = "identity of the target NearRT-RIC")
+ @ApiModelProperty(value = "identity of the target Near-RT RIC")
@SerializedName("ric_id")
@JsonProperty("ric_id")
public String ricId;
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicySchemaList.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicySchemaList.java
index 66296f50..6768b76a 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicySchemaList.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicySchemaList.java
@@ -37,7 +37,8 @@ import org.immutables.gson.Gson;
@ApiModel(value = "policy_schema_list_v2", description = "Policy type json schemas")
public class PolicySchemaList {
- @ApiModelProperty(value = "Policy type json schemas")
+ @ApiModelProperty(
+ value = "Policy type json schemas. The schema is a json object following http://json-schema.org/draft-07/schema")
@SerializedName("policy_schemas")
@JsonProperty("policy_schemas")
public final Collection<Object> schemas;
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 63b4bd60..750f0dfb 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
@@ -31,22 +31,22 @@ import java.util.Collection;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "ric_info_v2", description = "Information for a NearRT-RIC")
+@ApiModel(value = "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 NearRT-RIC")
+ @ApiModel(value = "ric_state_v2", description = "Represents the states for a Near-RT RIC")
public enum RicState {
UNAVAILABLE, AVAILABLE, SYNCHRONIZING, CONSISTENCY_CHECK
}
- private static final String STATE_DESCRIPTION = "State for the NearRT-RIC, values: \n"
- + "UNAVAILABLE: The NearRT-RIC is not avialable, information may be inconsistent \n"
+ private static final String STATE_DESCRIPTION = "State for the Near-RT RIC, values: \n"
+ + "UNAVAILABLE: The Near-RT RIC is not avialable, information may be inconsistent \n"
+ "AVAILABLE: The normal state. Policies can be configured. +\n"
- + "SYNCHRONIZING: The Policy Management Service is synchronizing the view of the NearRT-RIC. Policies cannot be configured. \n"
- + "CONSISTENCY_CHECK: A consistency check between the Policy Management Service and the NearRT-RIC. Policies cannot be configured.";
+ + "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 NearRT-RIC")
+ @ApiModelProperty(value = "identity of the Near-RT RIC")
@SerializedName("ric_id")
@JsonProperty("ric_id")
public final String ricId;
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 7ca49be7..7932dc54 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
@@ -31,10 +31,10 @@ import java.util.Collection;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "ric_info_list_v2", description = "List of NearRT-RIC information")
+@ApiModel(value = "ric_info_list_v2", description = "List of Near-RT RIC information")
public class RicInfoList {
- @ApiModelProperty(value = "List of NearRT-RIC information")
+ @ApiModelProperty(value = "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 a0987ada..cc8a8e92 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
@@ -46,7 +46,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController("RicRepositoryControllerV2")
-@Api(tags = Consts.V2_API_NAME)
+@Api(tags = {Consts.V2_API_NAME})
public class RicRepositoryController {
@Autowired
@@ -59,26 +59,31 @@ public class RicRepositoryController {
.serializeNulls() //
.create(); //
+ private static final String GET_RIC_BRIEF = "Returns info for a Near-RT RIC";
+ private static final String GET_RIC_DETAILS =
+ "Either a Near-RT RIC identity or a Mananged Element identity can be specified.<br>" //
+ + "The intention with Mananged Element identity is the ID used in O1 for accessing the traffical element (such as the ID of CU).";
+
/**
* Example: http://localhost:8081/v2/ric?managed_element_id=kista_1
*/
@GetMapping(path = Consts.V2_API_ROOT + "/ric", produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Returns info for the NearRT-RIC with the given identity or managing one Mananged Element")
+ @ApiOperation(value = GET_RIC_BRIEF, notes = GET_RIC_DETAILS)
@ApiResponses(
value = { //
- @ApiResponse(code = 200, message = "NearRT-RIC is found", response = RicInfo.class), //
- @ApiResponse(code = 404, message = "NearRT-RIC is not found", response = ErrorResponse.ErrorInfo.class) //
+ @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) //
})
public ResponseEntity<Object> getRic( //
@ApiParam(
name = Consts.MANAGED_ELEMENT_ID_PARAM,
required = false,
- value = "The identity of a Managed Element. If given, the NearRT-RIC managing the ME is returned.") //
+ value = "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 NearRT-RIC to get information for.") //
+ value = "The identity of a Near-RT RIC to get information for.") //
@RequestParam(name = Consts.RIC_ID_PARAM, required = false) String ricId) {
try {
if (managedElementId != null && ricId != null) {
@@ -88,7 +93,7 @@ public class RicRepositoryController {
if (ric.isPresent()) {
return new ResponseEntity<>(gson.toJson(toRicInfo(ric.get())), HttpStatus.OK);
} else {
- return ErrorResponse.create("No NearRT-RIC managing the ME is found", HttpStatus.NOT_FOUND);
+ return ErrorResponse.create("No Near-RT RIC managing the ME is found", HttpStatus.NOT_FOUND);
}
} else if (ricId != null) {
RicInfo info = toRicInfo(this.rics.getRic(ricId));
@@ -101,11 +106,14 @@ public class RicRepositoryController {
}
}
+ static final String QUERY_RIC_INFO_DETAILS =
+ "The call returns all Near-RT RICs that supports a given policy type identity";
+
/**
* @return a Json array of all RIC data Example: http://localhost:8081/v2/ric
*/
@GetMapping(path = Consts.V2_API_ROOT + "/rics", produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Query NearRT-RIC information")
+ @ApiOperation(value = "Query Near-RT RIC information", notes = QUERY_RIC_INFO_DETAILS)
@ApiResponses(
value = { //
@ApiResponse(code = 200, message = "OK", response = RicInfoList.class), //
@@ -114,7 +122,7 @@ public class RicRepositoryController {
@ApiParam(
name = Consts.POLICY_TYPE_ID_PARAM,
required = false,
- value = "The identity of a policy type. If given, all NearRT-RICs supporteing the policy type are returned") //
+ value = "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) {
if ((supportingPolicyType != null) && (this.types.get(supportingPolicyType) == null)) {
return ErrorResponse.create("Policy type not found", HttpStatus.NOT_FOUND);
@@ -131,16 +139,18 @@ public class RicRepositoryController {
}
private RicInfo.RicState toRicState(Ric.RicState state) {
- if (state == Ric.RicState.AVAILABLE) {
- return RicInfo.RicState.AVAILABLE;
- } else if (state == Ric.RicState.CONSISTENCY_CHECK) {
- return RicInfo.RicState.CONSISTENCY_CHECK;
- } else if (state == Ric.RicState.SYNCHRONIZING) {
- return RicInfo.RicState.SYNCHRONIZING;
- } else if (state == Ric.RicState.UNAVAILABLE) {
- return RicInfo.RicState.UNAVAILABLE;
+ switch (state) {
+ case AVAILABLE:
+ return RicInfo.RicState.AVAILABLE;
+ case CONSISTENCY_CHECK:
+ return RicInfo.RicState.CONSISTENCY_CHECK;
+ case SYNCHRONIZING:
+ return RicInfo.RicState.SYNCHRONIZING;
+ case UNAVAILABLE:
+ return RicInfo.RicState.UNAVAILABLE;
+ default:
+ return RicInfo.RicState.UNAVAILABLE;
}
- return RicInfo.RicState.UNAVAILABLE;
}
private RicInfo toRicInfo(Ric ric) {
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 19d68161..383e4f7f 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
@@ -68,8 +68,11 @@ public class ServiceController {
this.policies = policies;
}
+ 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")
+ @ApiOperation(value = "Returns service information", notes = GET_SERVICE_DETAILS)
@ApiResponses(
value = { //
@ApiResponse(code = 200, message = "OK", response = ServiceStatusList.class), //
@@ -78,7 +81,7 @@ public class ServiceController {
@ApiParam(name = Consts.SERVICE_ID_PARAM, required = false, value = "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 type not found", HttpStatus.NOT_FOUND);
+ return ErrorResponse.create("Service not found", HttpStatus.NOT_FOUND);
}
Collection<ServiceStatus> servicesStatus = new ArrayList<>();
@@ -110,7 +113,14 @@ public class ServiceController {
}
}
- @ApiOperation(value = "Register a service")
+ private static final String REGISTER_SERVICE_DETAILS = "Registering a service is needed to:" //
+ + "<ul>" //
+ + "<li>Get callbacks.</li>" //
+ + "<li>Activate supervision of the service. If a service is inactive, its policies will be deleted.</li>"//
+ + "</ul>" //
+ ;
+
+ @ApiOperation(value = "Register a service", notes = REGISTER_SERVICE_DETAILS)
@ApiResponses(
value = { //
@ApiResponse(code = 200, message = "Service updated"),
@@ -132,15 +142,15 @@ public class ServiceController {
}
}
- @ApiOperation(value = "Delete a service")
+ @ApiOperation(value = "Unregister a service")
@ApiResponses(
value = { //
- @ApiResponse(code = 204, message = "Service deleted"),
+ @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)})
@DeleteMapping(Consts.V2_API_ROOT + "/services")
public ResponseEntity<Object> deleteService(//
- @ApiParam(name = Consts.SERVICE_ID_PARAM, required = true, value = "The name of the service") //
+ @ApiParam(name = Consts.SERVICE_ID_PARAM, required = true, value = "The idenitity of the service") //
@RequestParam(name = Consts.SERVICE_ID_PARAM, required = true) String serviceName) {
try {
Service service = removeService(serviceName);
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/repository/Ric.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/repository/Ric.java
index 154809de..05ba41da 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/repository/Ric.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/repository/Ric.java
@@ -32,7 +32,7 @@ import org.onap.ccsdk.oran.a1policymanagementservice.clients.A1Client.A1Protocol
import org.onap.ccsdk.oran.a1policymanagementservice.configuration.RicConfig;
/**
- * Holds information about a NearRT-RIC.
+ * Holds information about a Near-RT RIC.
*/
public class Ric {
@@ -142,7 +142,7 @@ public class Ric {
*/
public enum RicState {
/**
- * The Policy Management Service's view of the NearRT-RIC may be inconsistent.
+ * The Policy Management Service's view of the Near-RT RIC may be inconsistent.
*/
UNAVAILABLE,
/**
@@ -150,12 +150,12 @@ public class Ric {
*/
AVAILABLE,
/**
- * The Policy Management Service is synchronizing the view of the NearRT-RIC.
+ * The Policy Management Service is synchronizing the view of the Near-RT RIC.
*/
SYNCHRONIZING,
/**
- * A consistency check between the Policy Management Service and the NearRT-RIC
+ * A consistency check between the Policy Management Service and the Near-RT RIC
* is done
*/
CONSISTENCY_CHECK
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSupervision.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSupervision.java
index 9bad36cc..332af8bc 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSupervision.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSupervision.java
@@ -44,7 +44,7 @@ import reactor.core.publisher.Mono;
/**
* Regularly checks the existing rics towards the local repository to keep it
- * consistent. When the policy types or instances in the NearRT-RIC is not
+ * consistent. When the policy types or instances in the Near-RT RIC is not
* consistent, a synchronization is performed.
*/
@Component
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSynchronizationTask.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSynchronizationTask.java
index d8cd04e2..f810c659 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSynchronizationTask.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSynchronizationTask.java
@@ -43,12 +43,12 @@ import reactor.core.publisher.Mono;
import reactor.core.publisher.SignalType;
/**
- * Synchronizes the content of a NearRT-RIC with the content in the repository.
+ * Synchronizes the content of a Near-RT RIC with the content in the repository.
* This means:
* <p>
* load all policy types
* <p>
- * send all policy instances to the NearRT-RIC
+ * send all policy instances to the Near-RT RIC
* <p>
* if that fails remove all policy instances
* <p>
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/ApplicationTestV2.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/ApplicationTestV2.java
index 3a7068d6..591b29c9 100644
--- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/ApplicationTestV2.java
+++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/ApplicationTestV2.java
@@ -255,7 +255,7 @@ class ApplicationTestV2 {
Policy policy2 = addPolicy("policyId2", "typeName", "service", ric1Name);
Ric ric2 = addRic("ric2");
- getA1Client(ric1Name).putPolicy(policy2); // put it in the RIC (NearRT-RIC)
+ getA1Client(ric1Name).putPolicy(policy2); // put it in the RIC (Near-RT RIC)
policies.remove(policy2); // Remove it from the repo -> should be deleted in the RIC
String policyId = "policyId";
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RefreshConfigTaskTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RefreshConfigTaskTest.java
index 72b20600..572ba0b5 100644
--- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RefreshConfigTaskTest.java
+++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RefreshConfigTaskTest.java
@@ -144,21 +144,6 @@ class RefreshConfigTaskTest {
}
@Test
- void startWithStubbedRefreshReturnError_thenErrorAndTerminationLogged() {
- refreshTaskUnderTest = this.createTestObject(CONFIG_FILE_DOES_NOT_EXIST, null, null, false);
- String errorMessage = "Error";
- doReturn(Flux.error(new Exception(errorMessage))).when(refreshTaskUnderTest).createRefreshTask();
-
- final ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(RefreshConfigTask.class, ERROR);
-
- refreshTaskUnderTest.start();
-
- ILoggingEvent event = logAppender.list.get(0);
- assertThat(event.getFormattedMessage())
- .isEqualTo("Configuration refresh terminated due to exception java.lang.Exception: " + errorMessage);
- }
-
- @Test
void stop_thenTaskIsDisposed() throws Exception {
refreshTaskUnderTest = this.createTestObject(CONFIG_FILE_DOES_NOT_EXIST, null, null, false);
refreshTaskUnderTest.systemEnvironment = new Properties();
@@ -202,7 +187,8 @@ class RefreshConfigTaskTest {
refreshTaskUnderTest.systemEnvironment = new Properties();
// When
- doReturn(getIncorrectJson()).when(refreshTaskUnderTest).createInputStream(any());
+ final String JUNK_JSON = "{\"junk }";
+ doReturn(getJsonSteam(JUNK_JSON)).when(refreshTaskUnderTest).createInputStream(any());
doReturn("fileName").when(appConfig).getLocalConfigurationFilePath();
final ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(RefreshConfigTask.class, ERROR);
@@ -269,7 +255,7 @@ class RefreshConfigTaskTest {
doReturn(Mono.just(props)).when(refreshTaskUnderTest).getEnvironment(any());
doReturn(Mono.just(cbsClient)).when(refreshTaskUnderTest).createCbsClient(props);
- JsonObject configAsJson = getJsonRootObject(true);
+ JsonObject configAsJson = getJsonRootObject(getCorrectJson());
String newBaseUrl = "newBaseUrl";
modifyTheRicConfiguration(configAsJson, newBaseUrl);
when(cbsClient.get(any())).thenReturn(Mono.just(configAsJson));
@@ -309,8 +295,8 @@ class RefreshConfigTaskTest {
doReturn(Mono.just(props)).when(refreshTaskUnderTest).getEnvironment(any());
doReturn(Mono.just(cbsClient)).when(refreshTaskUnderTest).createCbsClient(props);
- JsonObject configAsJson = getJsonRootObject(false);
- when(cbsClient.get(any())).thenReturn(Mono.just(configAsJson));
+ JsonObject emptyJsonObject = new JsonObject();
+ when(cbsClient.get(any())).thenReturn(Mono.just(emptyJsonObject));
final ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(RefreshConfigTask.class, ERROR);
@@ -368,9 +354,9 @@ class RefreshConfigTaskTest {
.addProperty("baseUrl", newBaseUrl);
}
- private JsonObject getJsonRootObject(boolean valid) throws JsonIOException, JsonSyntaxException, IOException {
- JsonObject rootObject = JsonParser
- .parseReader(new InputStreamReader(valid ? getCorrectJson() : getIncorrectJson())).getAsJsonObject();
+ private JsonObject getJsonRootObject(InputStream inStream)
+ throws JsonIOException, JsonSyntaxException, IOException {
+ JsonObject rootObject = JsonParser.parseReader(new InputStreamReader(inStream)).getAsJsonObject();
return rootObject;
}
@@ -380,8 +366,7 @@ class RefreshConfigTaskTest {
return new ByteArrayInputStream((string.getBytes(StandardCharsets.UTF_8)));
}
- private static InputStream getIncorrectJson() {
- String string = "{}"; //
- return new ByteArrayInputStream((string.getBytes(StandardCharsets.UTF_8)));
+ private static InputStream getJsonSteam(String json) {
+ return new ByteArrayInputStream((json.getBytes(StandardCharsets.UTF_8)));
}
}