aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrikBuhr <patrik.buhr@est.tech>2020-08-07 09:15:10 +0200
committerPatrikBuhr <patrik.buhr@est.tech>2020-10-21 15:34:40 +0200
commitc5f81cf8dace9637702d6934db1a9f4ed32ff131 (patch)
tree7af0d09d7e456abc26dc82063b59eab4710eabef
parent5da27f37cff6df63582179aec6b4a4099135035c (diff)
Added support for ORAN A1-P Version 2.0
Change-Id: I82a00dced95b76c97bf93c61a65a8c9d8157a00f Issue-ID: CCSDK-2502 Signed-off-by: PatrikBuhr <patrik.buhr@est.tech>
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1Client.java3
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientFactory.java9
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1UriBuilder.java6
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/OscA1Client.java5
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/SdncOscA1Client.java113
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientVersion1.java18
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientVersion2.java208
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RicSynchronizationTask.java2
-rw-r--r--a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/SdncOscA1ClientTest.java263
-rw-r--r--a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientV2Test.java180
-rw-r--r--a1-policy-management/src/test/resources/test_oran_get_schema_response.json45
-rw-r--r--docs/offeredapis/swagger/pms-api.json90
-rw-r--r--docs/offeredapis/swagger/pms-api.yaml2037
13 files changed, 1998 insertions, 981 deletions
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1Client.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1Client.java
index 6f1bf357..4321ed48 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1Client.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1Client.java
@@ -36,8 +36,10 @@ public interface A1Client {
public enum A1ProtocolType {
UNKNOWN, //
STD_V1_1, // STD A1 version 1.1
+ STD_V2_0_0, // STD A1 version 2.0.0
OSC_V1, // OSC 'A1'
SDNC_OSC_STD_V1_1, // SDNC_OSC with STD A1 version 1.1 southbound
+ SDNC_OSC_STD_V2_0_0, // SDNC_OSC with STD A1 version 2.0.0 southbound
SDNC_OSC_OSC_V1, // SDNC_OSC with OSC 'A1' southbound
SDNC_ONAP
}
@@ -57,4 +59,5 @@ public interface A1Client {
public Flux<String> deleteAllPolicies();
public Mono<String> getPolicyStatus(Policy policy);
+
}
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 f0f03cfe..66ba60c0 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
@@ -73,10 +73,14 @@ public class A1ClientFactory {
if (version == A1ProtocolType.STD_V1_1) {
assertNoControllerConfig(ric, version);
return new StdA1ClientVersion1(ric.getConfig(), this.restClientFactory);
+ } else if (version == A1ProtocolType.STD_V2_0_0) {
+ assertNoControllerConfig(ric, version);
+ return new StdA1ClientVersion2(ric.getConfig(), this.restClientFactory);
} else if (version == A1ProtocolType.OSC_V1) {
assertNoControllerConfig(ric, version);
return new OscA1Client(ric.getConfig(), this.restClientFactory);
- } else if (version == A1ProtocolType.SDNC_OSC_STD_V1_1 || version == A1ProtocolType.SDNC_OSC_OSC_V1) {
+ } else if (version == A1ProtocolType.SDNC_OSC_STD_V1_1 || version == A1ProtocolType.SDNC_OSC_OSC_V1
+ || version == A1ProtocolType.SDNC_OSC_STD_V2_0_0) {
return new SdncOscA1Client(version, ric.getConfig(), getControllerConfig(ric), this.restClientFactory);
} else if (version == A1ProtocolType.SDNC_ONAP) {
return new SdncOnapA1Client(ric.getConfig(), getControllerConfig(ric), this.restClientFactory);
@@ -118,7 +122,8 @@ public class A1ClientFactory {
private Mono<A1Client.A1ProtocolType> getProtocolVersion(Ric ric) {
if (ric.getProtocolVersion() == A1ProtocolType.UNKNOWN) {
- return fetchVersion(ric, A1ProtocolType.STD_V1_1) //
+ return fetchVersion(ric, A1ProtocolType.STD_V2_0_0) //
+ .onErrorResume(notUsed -> fetchVersion(ric, A1ProtocolType.STD_V1_1)) //
.onErrorResume(notUsed -> fetchVersion(ric, A1ProtocolType.OSC_V1)) //
.onErrorResume(notUsed -> fetchVersion(ric, A1ProtocolType.SDNC_OSC_STD_V1_1)) //
.onErrorResume(notUsed -> fetchVersion(ric, A1ProtocolType.SDNC_ONAP)) //
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1UriBuilder.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1UriBuilder.java
index d29226c8..08ea0e8c 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1UriBuilder.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1UriBuilder.java
@@ -29,4 +29,10 @@ interface A1UriBuilder {
String createDeleteUri(String type, String policyId);
String createGetPolicyStatusUri(String type, String policyId);
+
+ String createPolicyTypesUri();
+
+ String createGetPolicyIdsUri(String type);
+
+ String createGetSchemaUri(String type);
}
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/OscA1Client.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/OscA1Client.java
index 741ab1b9..3643b8d2 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/OscA1Client.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/OscA1Client.java
@@ -37,7 +37,7 @@ import reactor.core.publisher.Mono;
*/
@SuppressWarnings("squid:S2629") // Invoke method(s) only conditionally
public class OscA1Client implements A1Client {
- static final int CONCURRENCY_RIC = 1; // How may paralell requests that is sent to one NearRT RIC
+ static final int CONCURRENCY_RIC = 1; // How many paralell requests that is sent to one NearRT RIC
public static class UriBuilder implements A1UriBuilder {
private final RicConfig ricConfig;
@@ -54,6 +54,7 @@ public class OscA1Client implements A1Client {
/**
* /a1-p/policytypes/{policy_type_id}/policies
*/
+ @Override
public String createGetPolicyIdsUri(String type) {
return createPolicyTypeUri(type) + "/policies";
}
@@ -81,6 +82,7 @@ public class OscA1Client implements A1Client {
/**
* /a1-p/policytypes/{policy_type_id}
*/
+ @Override
public String createGetSchemaUri(String type) {
return this.createPolicyTypeUri(type);
}
@@ -88,6 +90,7 @@ public class OscA1Client implements A1Client {
/**
* ​/a1-p​/policytypes​/{policy_type_id}
*/
+ @Override
public String createPolicyTypesUri() {
return baseUri() + "/policytypes";
}
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 3ba2ba7b..28c27843 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
@@ -48,7 +48,7 @@ import reactor.core.publisher.Mono;
@SuppressWarnings("squid:S2629") // Invoke method(s) only conditionally
public class SdncOscA1Client implements A1Client {
- static final int CONCURRENCY_RIC = 1; // How may paralell requests that is sent to one NearRT RIC
+ static final int CONCURRENCY_RIC = 1; // How many paralell requests that is sent to one NearRT RIC
@Value.Immutable
@org.immutables.gson.Gson.TypeAdapters
@@ -81,7 +81,8 @@ public class SdncOscA1Client implements A1Client {
* Constructor that creates the REST client to use.
*
* @param protocolType the southbound protocol of the controller. Supported
- * protocols are SDNC_OSC_STD_V1_1 and SDNC_OSC_OSC_V1
+ * protocols are SDNC_OSC_STD_V1_1, SDNC_OSC_OSC_V1 and
+ * SDNC_OSC_STD_V2_0_0 with
* @param ricConfig the configuration of the Near-RT RIC to communicate
* with
* @param controllerConfig the configuration of the SDNC controller to use
@@ -92,32 +93,35 @@ public class SdncOscA1Client implements A1Client {
AsyncRestClientFactory restClientFactory) {
this(protocolType, ricConfig, controllerConfig,
restClientFactory.createRestClient(controllerConfig.baseUrl() + "/restconf/operations"));
- logger.debug("SdncOscA1Client for ric: {}, a1Controller: {}", ricConfig.ricId(), controllerConfig);
}
/**
* Constructor where the REST client to use is provided.
*
* @param protocolType the southbound protocol of the controller. Supported
- * protocols are SDNC_OSC_STD_V1_1 and SDNC_OSC_OSC_V1
+ * protocols are SDNC_OSC_STD_V1_1, SDNC_OSC_OSC_V1 and
+ * SDNC_OSC_STD_V2_0_0 with
* @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
*
- * @throws IllegalArgumentException when the protocolType is wrong.
+ * @throws IllegalArgumentException when the protocolType is illegal.
*/
public SdncOscA1Client(A1ProtocolType protocolType, RicConfig ricConfig, ControllerConfig controllerConfig,
AsyncRestClient restClient) {
- if (!(A1ProtocolType.SDNC_OSC_STD_V1_1.equals(protocolType)
- || A1ProtocolType.SDNC_OSC_OSC_V1.equals(protocolType))) {
- throw new IllegalArgumentException("Protocol type must be " + A1ProtocolType.SDNC_OSC_STD_V1_1 + " or "
- + A1ProtocolType.SDNC_OSC_OSC_V1 + ", was: " + protocolType);
+ if (A1ProtocolType.SDNC_OSC_STD_V1_1.equals(protocolType) //
+ || A1ProtocolType.SDNC_OSC_OSC_V1.equals(protocolType) //
+ || A1ProtocolType.SDNC_OSC_STD_V2_0_0.equals(protocolType)) {
+ this.restClient = restClient;
+ this.ricConfig = ricConfig;
+ this.protocolType = protocolType;
+ this.controllerConfig = controllerConfig;
+ logger.debug("SdncOscA1Client for ric: {}, a1Controller: {}", ricConfig.ricId(), controllerConfig);
+ } else {
+ throw new IllegalArgumentException("Not handeled protocolversion: " + protocolType);
}
- this.restClient = restClient;
- this.ricConfig = ricConfig;
- this.protocolType = protocolType;
- this.controllerConfig = controllerConfig;
+
}
@Override
@@ -125,9 +129,7 @@ public class SdncOscA1Client implements A1Client {
if (this.protocolType == A1ProtocolType.SDNC_OSC_STD_V1_1) {
return Mono.just(Arrays.asList(""));
} else {
- OscA1Client.UriBuilder uri = new OscA1Client.UriBuilder(ricConfig);
- final String ricUrl = uri.createPolicyTypesUri();
- return post(GET_POLICY_RPC, ricUrl, Optional.empty()) //
+ return post(GET_POLICY_RPC, getUriBuilder().createPolicyTypesUri(), Optional.empty()) //
.flatMapMany(SdncJsonHelper::parseJsonArrayOfString) //
.collectList();
}
@@ -145,20 +147,27 @@ public class SdncOscA1Client implements A1Client {
if (this.protocolType == A1ProtocolType.SDNC_OSC_STD_V1_1) {
return Mono.just("{}");
} else {
- OscA1Client.UriBuilder uri = new OscA1Client.UriBuilder(ricConfig);
+ A1UriBuilder uri = this.getUriBuilder();
final String ricUrl = uri.createGetSchemaUri(policyTypeId);
return post(GET_POLICY_RPC, ricUrl, Optional.empty()) //
- .flatMap(response -> OscA1Client.extractCreateSchema(response, policyTypeId));
+ .flatMap(response -> extractCreateSchema(response, policyTypeId));
+ }
+ }
+
+ private Mono<String> extractCreateSchema(String controllerResponse, String policyTypeId) {
+ if (this.protocolType == A1ProtocolType.SDNC_OSC_OSC_V1) {
+ return OscA1Client.extractCreateSchema(controllerResponse, policyTypeId);
+ } else if (this.protocolType == A1ProtocolType.SDNC_OSC_STD_V2_0_0) {
+ return StdA1ClientVersion2.extractPolicySchema(controllerResponse, policyTypeId);
+ } else {
+ throw new NullPointerException("Not supported");
}
}
@Override
public Mono<String> putPolicy(Policy policy) {
- return getUriBuilder() //
- .flatMap(builder -> {
- String ricUrl = builder.createPutPolicyUri(policy.type().id(), policy.id());
- return post("putA1Policy", ricUrl, Optional.of(policy.json()));
- });
+ String ricUrl = getUriBuilder().createPutPolicyUri(policy.type().id(), policy.id());
+ return post("putA1Policy", ricUrl, Optional.of(policy.json()));
}
@Override
@@ -172,44 +181,46 @@ public class SdncOscA1Client implements A1Client {
return getPolicyIds() //
.flatMap(policyId -> deletePolicyById("", policyId), CONCURRENCY_RIC); //
} else {
- OscA1Client.UriBuilder uriBuilder = new OscA1Client.UriBuilder(ricConfig);
+ A1UriBuilder uriBuilder = this.getUriBuilder();
return getPolicyTypeIdentities() //
.flatMapMany(Flux::fromIterable) //
- .flatMap(type -> oscDeleteInstancesForType(uriBuilder, type), CONCURRENCY_RIC);
+ .flatMap(type -> deleteAllInstancesForType(uriBuilder, type), CONCURRENCY_RIC);
}
}
- private Flux<String> oscGetInstancesForType(OscA1Client.UriBuilder uriBuilder, String type) {
+ private Flux<String> getInstancesForType(A1UriBuilder uriBuilder, String type) {
return post(GET_POLICY_RPC, uriBuilder.createGetPolicyIdsUri(type), Optional.empty()) //
.flatMapMany(SdncJsonHelper::parseJsonArrayOfString);
}
- private Flux<String> oscDeleteInstancesForType(OscA1Client.UriBuilder uriBuilder, String type) {
- return oscGetInstancesForType(uriBuilder, type) //
+ private Flux<String> deleteAllInstancesForType(A1UriBuilder uriBuilder, String type) {
+ return getInstancesForType(uriBuilder, type) //
.flatMap(instance -> deletePolicyById(type, instance), CONCURRENCY_RIC);
}
@Override
public Mono<A1ProtocolType> getProtocolVersion() {
- return tryStdProtocolVersion() //
+ return tryStdProtocolVersion2() //
+ .onErrorResume(t -> tryStdProtocolVersion1()) //
.onErrorResume(t -> tryOscProtocolVersion());
}
@Override
public Mono<String> getPolicyStatus(Policy policy) {
- return getUriBuilder() //
- .flatMap(builder -> {
- String ricUrl = builder.createGetPolicyStatusUri(policy.type().id(), policy.id());
- return post("getA1PolicyStatus", ricUrl, Optional.empty());
- });
+ String ricUrl = getUriBuilder().createGetPolicyStatusUri(policy.type().id(), policy.id());
+ return post("getA1PolicyStatus", ricUrl, Optional.empty());
+
}
- private Mono<A1UriBuilder> getUriBuilder() {
+ private A1UriBuilder getUriBuilder() {
if (protocolType == A1ProtocolType.SDNC_OSC_STD_V1_1) {
- return Mono.just(new StdA1ClientVersion1.UriBuilder(ricConfig));
- } else {
- return Mono.just(new OscA1Client.UriBuilder(ricConfig));
+ return new StdA1ClientVersion1.UriBuilder(ricConfig);
+ } else if (protocolType == A1ProtocolType.SDNC_OSC_STD_V2_0_0) {
+ return new StdA1ClientVersion2.UriBuilder(ricConfig);
+ } else if (protocolType == A1ProtocolType.SDNC_OSC_OSC_V1) {
+ return new OscA1Client.UriBuilder(ricConfig);
}
+ throw new NullPointerException();
}
private Mono<A1ProtocolType> tryOscProtocolVersion() {
@@ -218,20 +229,26 @@ public class SdncOscA1Client implements A1Client {
.flatMap(x -> Mono.just(A1ProtocolType.SDNC_OSC_OSC_V1));
}
- private Mono<A1ProtocolType> tryStdProtocolVersion() {
+ private Mono<A1ProtocolType> tryStdProtocolVersion1() {
StdA1ClientVersion1.UriBuilder uriBuilder = new StdA1ClientVersion1.UriBuilder(ricConfig);
- return post(GET_POLICY_RPC, uriBuilder.createGetPolicyIdsUri(), Optional.empty()) //
+ return post(GET_POLICY_RPC, uriBuilder.createGetPolicyIdsUri(""), Optional.empty()) //
.flatMap(x -> Mono.just(A1ProtocolType.SDNC_OSC_STD_V1_1));
}
+ private Mono<A1ProtocolType> tryStdProtocolVersion2() {
+ StdA1ClientVersion2.UriBuilder uriBuilder = new StdA1ClientVersion2.UriBuilder(ricConfig);
+ return post(GET_POLICY_RPC, uriBuilder.createPolicyTypesUri(), Optional.empty()) //
+ .flatMap(x -> Mono.just(A1ProtocolType.SDNC_OSC_STD_V2_0_0));
+ }
+
private Flux<String> getPolicyIds() {
if (this.protocolType == A1ProtocolType.SDNC_OSC_STD_V1_1) {
StdA1ClientVersion1.UriBuilder uri = new StdA1ClientVersion1.UriBuilder(ricConfig);
- final String ricUrl = uri.createGetPolicyIdsUri();
+ final String ricUrl = uri.createGetPolicyIdsUri("");
return post(GET_POLICY_RPC, ricUrl, Optional.empty()) //
.flatMapMany(SdncJsonHelper::parseJsonArrayOfString);
} else {
- OscA1Client.UriBuilder uri = new OscA1Client.UriBuilder(ricConfig);
+ A1UriBuilder uri = this.getUriBuilder();
return getPolicyTypeIdentities() //
.flatMapMany(Flux::fromIterable)
.flatMap(type -> post(GET_POLICY_RPC, uri.createGetPolicyIdsUri(type), Optional.empty())) //
@@ -240,11 +257,8 @@ public class SdncOscA1Client implements A1Client {
}
private Mono<String> deletePolicyById(String type, String policyId) {
- return getUriBuilder() //
- .flatMap(builder -> {
- String ricUrl = builder.createDeleteUri(type, policyId);
- return post("deleteA1Policy", ricUrl, Optional.empty());
- });
+ String ricUrl = getUriBuilder().createDeleteUri(type, policyId);
+ return post("deleteA1Policy", ricUrl, Optional.empty());
}
private Mono<String> post(String rpcName, String ricUrl, Optional<String> body) {
@@ -270,8 +284,9 @@ public class SdncOscA1Client implements A1Client {
} else {
logger.debug("Error response: {} {}", output.httpStatus(), body);
byte[] responseBodyBytes = body.getBytes(StandardCharsets.UTF_8);
- WebClientResponseException responseException = new WebClientResponseException(output.httpStatus(),
- "statusText", null, responseBodyBytes, StandardCharsets.UTF_8, null);
+ HttpStatus httpStatus = HttpStatus.valueOf(output.httpStatus());
+ WebClientResponseException responseException = new WebClientResponseException(httpStatus.value(),
+ httpStatus.getReasonPhrase(), null, responseBodyBytes, StandardCharsets.UTF_8, null);
return Mono.error(responseException);
}
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientVersion1.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientVersion1.java
index d094e7a1..94567234 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientVersion1.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientVersion1.java
@@ -53,7 +53,8 @@ public class StdA1ClientVersion1 implements A1Client {
/**
* /A1-P/v1/policies
*/
- public String createGetPolicyIdsUri() {
+ @Override
+ public String createGetPolicyIdsUri(String type) {
return baseUri() + "/policies";
}
@@ -68,6 +69,7 @@ public class StdA1ClientVersion1 implements A1Client {
/**
* /A1-P/v1/policies/{policyId}/status
*/
+ @Override
public String createGetPolicyStatusUri(String type, String policyId) {
return policiesBaseUri() + policyId + "/status";
}
@@ -77,7 +79,17 @@ public class StdA1ClientVersion1 implements A1Client {
}
private String policiesBaseUri() {
- return createGetPolicyIdsUri() + "/";
+ return createGetPolicyIdsUri("") + "/";
+ }
+
+ @Override
+ public String createPolicyTypesUri() {
+ throw new NullPointerException("Not supported URI");
+ }
+
+ @Override
+ public String createGetSchemaUri(String type) {
+ throw new NullPointerException("Not supported URI");
}
}
@@ -137,7 +149,7 @@ public class StdA1ClientVersion1 implements A1Client {
}
private Flux<String> getPolicyIds() {
- return restClient.get(uri.createGetPolicyIdsUri()) //
+ return restClient.get(uri.createGetPolicyIdsUri("")) //
.flatMapMany(SdncJsonHelper::parseJsonArrayOfString);
}
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientVersion2.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientVersion2.java
new file mode 100644
index 00000000..c475b22f
--- /dev/null
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientVersion2.java
@@ -0,0 +1,208 @@
+/*-
+ * ========================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.clients;
+
+import java.lang.invoke.MethodHandles;
+import java.util.List;
+
+import org.json.JSONObject;
+import org.onap.ccsdk.oran.a1policymanagementservice.configuration.RicConfig;
+import org.onap.ccsdk.oran.a1policymanagementservice.repository.Policy;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import reactor.core.publisher.Flux;
+import reactor.core.publisher.Mono;
+
+/**
+ * Client for accessing ORAN A1-P Vesion 2.0 REST API
+ */
+@SuppressWarnings("squid:S2629") // Invoke method(s) only conditionally
+public class StdA1ClientVersion2 implements A1Client {
+ static final int CONCURRENCY_RIC = 1; // How many paralell requests that is sent to one NearRT RIC
+
+ public static class UriBuilder implements A1UriBuilder {
+ private final RicConfig ricConfig;
+
+ public UriBuilder(RicConfig ricConfig) {
+ this.ricConfig = ricConfig;
+ }
+
+ @Override
+ public String createPutPolicyUri(String type, String policyId) {
+ return createPolicyUri(type, policyId);
+ }
+
+ /**
+ * /A1-P/v2​/policytypes/{policy_type_id}/policies
+ */
+ @Override
+ public String createGetPolicyIdsUri(String type) {
+ return createPolicyTypeUri(type) + "/policies";
+ }
+
+ @Override
+ public String createDeleteUri(String type, String policyId) {
+ return createPolicyUri(type, policyId);
+ }
+
+ /**
+ * ​/A1-P/v2​/policytypes​/{policy_type_id}​/policies​/{policy_instance_id}​/status
+ */
+ @Override
+ public String createGetPolicyStatusUri(String type, String policyId) {
+ return createPolicyUri(type, policyId) + "/status";
+ }
+
+ /**
+ * /A1-P/v2/policytypes/{policy_type_id}
+ */
+ @Override
+ public String createGetSchemaUri(String type) {
+ return this.createPolicyTypeUri(type);
+ }
+
+ /**
+ * ​/A1-P/v2​/policytypes​/{policy_type_id}
+ */
+ @Override
+ public String createPolicyTypesUri() {
+ return baseUri() + "/policytypes";
+ }
+
+ /**
+ * ​/A1-P/v2​/policytypes​/{policy_type_id}​/policies​/{policy_instance_id}
+ */
+ private String createPolicyUri(String type, String id) {
+ return createPolicyTypeUri(type) + "/policies/" + id;
+ }
+
+ /**
+ * /A1-P/v2/policytypes/{policy_type_id}
+ */
+ private String createPolicyTypeUri(String type) {
+ return createPolicyTypesUri() + "/" + type;
+ }
+
+ private String baseUri() {
+ return ricConfig.baseUrl() + "/A1-P/v2";
+ }
+ }
+
+ private static final String TITLE = "title";
+ private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+ private final AsyncRestClient restClient;
+ private final UriBuilder uriBuiler;
+
+ public StdA1ClientVersion2(RicConfig ricConfig, AsyncRestClientFactory restClientFactory) {
+ this(ricConfig, restClientFactory.createRestClient(""));
+ }
+
+ public StdA1ClientVersion2(RicConfig ricConfig, AsyncRestClient restClient) {
+ this.restClient = restClient;
+ logger.debug("OscA1Client for ric: {}", ricConfig.ricId());
+
+ uriBuiler = new UriBuilder(ricConfig);
+ }
+
+ public static Mono<String> extractPolicySchema(String policyTypeResponse, String policyTypeId) {
+ try {
+ JSONObject obj = new JSONObject(policyTypeResponse);
+ JSONObject schemaObj = obj.getJSONObject("policySchema");
+ schemaObj.put(TITLE, policyTypeId);
+ return Mono.just(schemaObj.toString());
+ } catch (Exception e) {
+ String exceptionString = e.toString();
+ logger.error("Unexpected response for policy type: {}, exception: {}", policyTypeResponse, exceptionString);
+ return Mono.error(e);
+ }
+ }
+
+ @Override
+ public Mono<List<String>> getPolicyTypeIdentities() {
+ return getPolicyTypeIds() //
+ .collectList();
+ }
+
+ @Override
+ public Mono<List<String>> getPolicyIdentities() {
+ return getPolicyTypeIds() //
+ .flatMap(this::getPolicyIdentitiesByType) //
+ .collectList();
+ }
+
+ @Override
+ public Mono<String> getPolicyTypeSchema(String policyTypeId) {
+ String schemaUri = uriBuiler.createGetSchemaUri(policyTypeId);
+ return restClient.get(schemaUri) //
+ .flatMap(response -> extractPolicySchema(response, policyTypeId));
+ }
+
+ @Override
+ public Mono<String> putPolicy(Policy policy) {
+ String policyUri = this.uriBuiler.createPutPolicyUri(policy.type().id(), policy.id());
+ return restClient.put(policyUri, policy.json());
+ }
+
+ @Override
+ public Mono<String> deletePolicy(Policy policy) {
+ return deletePolicyById(policy.type().id(), policy.id());
+ }
+
+ @Override
+ public Mono<A1ProtocolType> getProtocolVersion() {
+ return restClient.get(uriBuiler.createPolicyTypesUri()) //
+ .flatMap(notUsed -> Mono.just(A1ProtocolType.STD_V2_0_0));
+ }
+
+ @Override
+ public Flux<String> deleteAllPolicies() {
+ return getPolicyTypeIds() //
+ .flatMap(this::deletePoliciesForType, CONCURRENCY_RIC);
+ }
+
+ @Override
+ public Mono<String> getPolicyStatus(Policy policy) {
+ String statusUri = uriBuiler.createGetPolicyStatusUri(policy.type().id(), policy.id());
+ return restClient.get(statusUri);
+
+ }
+
+ private Flux<String> getPolicyTypeIds() {
+ return restClient.get(uriBuiler.createPolicyTypesUri()) //
+ .flatMapMany(SdncJsonHelper::parseJsonArrayOfString);
+ }
+
+ private Flux<String> getPolicyIdentitiesByType(String typeId) {
+ return restClient.get(uriBuiler.createGetPolicyIdsUri(typeId)) //
+ .flatMapMany(SdncJsonHelper::parseJsonArrayOfString);
+ }
+
+ private Mono<String> deletePolicyById(String typeId, String policyId) {
+ String policyUri = uriBuiler.createDeleteUri(typeId, policyId);
+ return restClient.delete(policyUri);
+ }
+
+ private Flux<String> deletePoliciesForType(String typeId) {
+ return getPolicyIdentitiesByType(typeId) //
+ .flatMap(policyId -> deletePolicyById(typeId, policyId), CONCURRENCY_RIC);
+ }
+}
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 cf7ca74e..88d99232 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
@@ -59,7 +59,7 @@ import reactor.core.publisher.SignalType;
public class RicSynchronizationTask {
private static final Logger logger = LoggerFactory.getLogger(RicSynchronizationTask.class);
- static final int CONCURRENCY_RIC = 1; // How may paralell requests that is sent to one NearRT RIC
+ static final int CONCURRENCY_RIC = 1; // How many paralell requests that is sent to one NearRT RIC
private final A1ClientFactory a1ClientFactory;
private final PolicyTypes policyTypes;
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/SdncOscA1ClientTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/SdncOscA1ClientTest.java
index bbb2b8e9..a0e95177 100644
--- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/SdncOscA1ClientTest.java
+++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/SdncOscA1ClientTest.java
@@ -37,7 +37,6 @@ import java.util.Arrays;
import java.util.List;
import java.util.Optional;
-import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
@@ -50,7 +49,6 @@ import org.onap.ccsdk.oran.a1policymanagementservice.clients.SdncOscA1Client.Ada
import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ControllerConfig;
import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ImmutableControllerConfig;
import org.onap.ccsdk.oran.a1policymanagementservice.repository.Policy;
-import org.onap.ccsdk.oran.a1policymanagementservice.repository.Ric;
import org.springframework.http.HttpStatus;
import org.springframework.web.reactive.function.client.WebClientResponseException;
@@ -68,7 +66,6 @@ class SdncOscA1ClientTest {
private static final String GET_A1_POLICY_STATUS_URL = "/A1-ADAPTER-API:getA1PolicyStatus";
private static final String POLICY_TYPE_1_ID = "type1";
private static final String POLICY_1_ID = "policy1";
- private static final String POLICY_2_ID = "policy2";
private static final String POLICY_JSON_VALID = "{\"scope\":{\"ueId\":\"ue1\"}}";
SdncOscA1Client clientUnderTest;
@@ -85,32 +82,25 @@ class SdncOscA1ClientTest {
.build();
}
- @BeforeEach
- void init() {
- Ric ric = A1ClientHelper.createRic(RIC_1_URL);
-
- clientUnderTest = new SdncOscA1Client(A1ProtocolType.SDNC_OSC_STD_V1_1, ric.getConfig(), controllerConfig(),
- asyncRestClientMock);
- }
-
@Test
void createClientWithWrongProtocol_thenErrorIsThrown() {
- AsyncRestClient asyncRestClient = new AsyncRestClient("", null);
assertThrows(IllegalArgumentException.class, () -> {
- new SdncOscA1Client(A1ProtocolType.STD_V1_1, null, null, asyncRestClient);
+ new SdncOscA1Client(A1ProtocolType.STD_V1_1, null, null, new AsyncRestClient("", null));
});
}
@Test
- void getPolicyTypeIdentities_STD() {
+ void getPolicyTypeIdentities_STD_V1() {
+ clientUnderTest = new SdncOscA1Client(A1ProtocolType.SDNC_OSC_STD_V1_1, //
+ A1ClientHelper.createRic(RIC_1_URL).getConfig(), //
+ controllerConfig(), asyncRestClientMock);
List<String> policyTypeIds = clientUnderTest.getPolicyTypeIdentities().block();
assertEquals(1, policyTypeIds.size(), "should hardcoded to one");
assertEquals("", policyTypeIds.get(0), "should hardcoded to empty");
}
- @Test
- void getPolicyTypeIdentities_OSC() {
- clientUnderTest = new SdncOscA1Client(A1ProtocolType.SDNC_OSC_OSC_V1, //
+ private void testGetPolicyTypeIdentities(A1ProtocolType protocolType, String expUrl) {
+ clientUnderTest = new SdncOscA1Client(protocolType, //
A1ClientHelper.createRic(RIC_1_URL).getConfig(), //
controllerConfig(), asyncRestClientMock);
@@ -122,7 +112,6 @@ class SdncOscA1ClientTest {
assertEquals(1, policyTypeIds.size());
assertEquals(POLICY_TYPE_1_ID, policyTypeIds.get(0));
- String expUrl = RIC_1_URL + "/a1-p/policytypes";
ImmutableAdapterRequest expectedParams = ImmutableAdapterRequest.builder() //
.nearRtRicUrl(expUrl) //
.build();
@@ -132,28 +121,64 @@ class SdncOscA1ClientTest {
}
@Test
- void getTypeSchema_STD() {
+ void getPolicyTypeIdentities_OSC() {
+ testGetPolicyTypeIdentities(A1ProtocolType.SDNC_OSC_OSC_V1, RIC_1_URL + "/a1-p/policytypes");
+ }
+
+ @Test
+ void getPolicyTypeIdentities_STD_V2() {
+ testGetPolicyTypeIdentities(A1ProtocolType.SDNC_OSC_STD_V2_0_0, RIC_1_URL + "/A1-P/v2/policytypes");
+ }
+
+ @Test
+ void getTypeSchema_STD_V1() {
+
+ clientUnderTest = new SdncOscA1Client(A1ProtocolType.SDNC_OSC_STD_V1_1, //
+ A1ClientHelper.createRic(RIC_1_URL).getConfig(), //
+ controllerConfig(), asyncRestClientMock);
+
String policyType = clientUnderTest.getPolicyTypeSchema("").block();
assertEquals("{}", policyType);
}
- @Test
- void getTypeSchema_OSC() throws IOException {
- clientUnderTest = new SdncOscA1Client(A1ProtocolType.SDNC_OSC_OSC_V1, //
+ private void testGetTypeSchema(A1ProtocolType protocolType, String expUrl, String policyTypeId,
+ String getSchemaResponseFile) throws IOException {
+ clientUnderTest = new SdncOscA1Client(protocolType, //
A1ClientHelper.createRic(RIC_1_URL).getConfig(), //
controllerConfig(), asyncRestClientMock);
- String ricResponse = loadFile("test_osc_get_schema_response.json");
+ String ricResponse = loadFile(getSchemaResponseFile);
JsonElement elem = gson().fromJson(ricResponse, JsonElement.class);
String responseFromController = createOkResponseWithBody(elem);
whenAsyncPostThenReturn(Mono.just(responseFromController));
- String response = clientUnderTest.getPolicyTypeSchema("policyTypeId").block();
+ String response = clientUnderTest.getPolicyTypeSchema(policyTypeId).block();
JsonElement respJson = gson().fromJson(response, JsonElement.class);
- assertEquals("policyTypeId", respJson.getAsJsonObject().get("title").getAsString(),
+ assertEquals(policyTypeId, respJson.getAsJsonObject().get("title").getAsString(),
"title should be updated to contain policyType ID");
+
+ ImmutableAdapterRequest expectedParams = ImmutableAdapterRequest.builder() //
+ .nearRtRicUrl(expUrl) //
+ .build();
+ String expInput = SdncJsonHelper.createInputJsonString(expectedParams);
+
+ verify(asyncRestClientMock).postWithAuthHeader(GET_A1_POLICY_URL, expInput, CONTROLLER_USERNAME,
+ CONTROLLER_PASSWORD);
+ }
+
+ @Test
+ void getTypeSchema_OSC() throws IOException {
+ String expUrl = RIC_1_URL + "/a1-p/policytypes/policyTypeId";
+ testGetTypeSchema(A1ProtocolType.SDNC_OSC_OSC_V1, expUrl, "policyTypeId", "test_osc_get_schema_response.json");
+ }
+
+ @Test
+ void getTypeSchema_STD_V2() throws IOException {
+ String expUrl = RIC_1_URL + "/A1-P/v2/policytypes/policyTypeId";
+ testGetTypeSchema(A1ProtocolType.SDNC_OSC_STD_V2_0_0, expUrl, "policyTypeId",
+ "test_oran_get_schema_response.json");
}
@Test
@@ -167,49 +192,51 @@ class SdncOscA1ClientTest {
assertEquals("1", result.get(1));
}
- @Test
- void getPolicyIdentities_STD() {
-
- String policyIdsResp = createOkResponseWithBody(Arrays.asList(POLICY_1_ID, POLICY_2_ID));
- whenAsyncPostThenReturn(Mono.just(policyIdsResp));
+ private void getPolicyIdentities(A1ProtocolType protocolType, String... expUrls) {
+ clientUnderTest = new SdncOscA1Client(protocolType, //
+ A1ClientHelper.createRic(RIC_1_URL).getConfig(), //
+ controllerConfig(), asyncRestClientMock);
+ String resp = createOkResponseWithBody(Arrays.asList("xxx"));
+ whenAsyncPostThenReturn(Mono.just(resp));
List<String> returned = clientUnderTest.getPolicyIdentities().block();
- assertEquals(2, returned.size());
+ assertEquals(1, returned.size());
+ for (String expUrl : expUrls) {
+ ImmutableAdapterRequest expectedParams = ImmutableAdapterRequest.builder() //
+ .nearRtRicUrl(expUrl) //
+ .build();
+ String expInput = SdncJsonHelper.createInputJsonString(expectedParams);
+ verify(asyncRestClientMock).postWithAuthHeader(GET_A1_POLICY_URL, expInput, CONTROLLER_USERNAME,
+ CONTROLLER_PASSWORD);
+ }
+ }
- ImmutableAdapterRequest expectedParams = ImmutableAdapterRequest.builder() //
- .nearRtRicUrl(policiesUrl()) //
- .build();
- String expInput = SdncJsonHelper.createInputJsonString(expectedParams);
- verify(asyncRestClientMock).postWithAuthHeader(GET_A1_POLICY_URL, expInput, CONTROLLER_USERNAME,
- CONTROLLER_PASSWORD);
+ @Test
+ void getPolicyIdentities_STD_V1() {
+ String expUrl = RIC_1_URL + "/A1-P/v1/policies";
+ getPolicyIdentities(A1ProtocolType.SDNC_OSC_STD_V1_1, expUrl);
+ }
+ @Test
+ void getPolicyIdentities_STD_V2() {
+ String expUrlPolicies = RIC_1_URL + "/A1-P/v2/policytypes";
+ String expUrlInstances = RIC_1_URL + "/A1-P/v2/policytypes/xxx/policies";
+ getPolicyIdentities(A1ProtocolType.SDNC_OSC_STD_V2_0_0, expUrlPolicies, expUrlInstances);
}
@Test
void getPolicyIdentities_OSC() {
- clientUnderTest = new SdncOscA1Client(A1ProtocolType.SDNC_OSC_OSC_V1, //
+ String expUrlTypes = RIC_1_URL + "/a1-p/policytypes";
+ String expUrlInstances = RIC_1_URL + "/a1-p/policytypes/xxx/policies";
+ getPolicyIdentities(A1ProtocolType.SDNC_OSC_OSC_V1, expUrlTypes, expUrlInstances);
+ }
+
+ private void putPolicy(A1ProtocolType protocolType, String expUrl) {
+ clientUnderTest = new SdncOscA1Client(protocolType, //
A1ClientHelper.createRic(RIC_1_URL).getConfig(), //
controllerConfig(), asyncRestClientMock);
- String policytypeIdsResp = createOkResponseWithBody(Arrays.asList(POLICY_TYPE_1_ID));
- String policyIdsResp = createOkResponseWithBody(Arrays.asList(POLICY_1_ID, POLICY_2_ID));
- whenAsyncPostThenReturn(Mono.just(policytypeIdsResp)).thenReturn(Mono.just(policyIdsResp));
-
- List<String> returned = clientUnderTest.getPolicyIdentities().block();
-
- assertEquals(2, returned.size());
-
- ImmutableAdapterRequest expectedParams = ImmutableAdapterRequest.builder() //
- .nearRtRicUrl(RIC_1_URL + "/a1-p/policytypes/type1/policies") //
- .build();
- String expInput = SdncJsonHelper.createInputJsonString(expectedParams);
- verify(asyncRestClientMock).postWithAuthHeader(GET_A1_POLICY_URL, expInput, CONTROLLER_USERNAME,
- CONTROLLER_PASSWORD);
- }
-
- @Test
- void putPolicyValidResponse() {
whenPostReturnOkResponse();
String returned = clientUnderTest
@@ -217,7 +244,6 @@ class SdncOscA1ClientTest {
.block();
assertEquals("OK", returned);
- final String expUrl = policiesUrl() + "/" + POLICY_1_ID;
AdapterRequest expectedInputParams = ImmutableAdapterRequest.builder() //
.nearRtRicUrl(expUrl) //
.body(POLICY_JSON_VALID) //
@@ -225,10 +251,33 @@ class SdncOscA1ClientTest {
String expInput = SdncJsonHelper.createInputJsonString(expectedInputParams);
verify(asyncRestClientMock).postWithAuthHeader(PUT_A1_URL, expInput, CONTROLLER_USERNAME, CONTROLLER_PASSWORD);
+
}
@Test
- void putPolicyRejected() {
+ void putPolicy_OSC() {
+ String expUrl = RIC_1_URL + "/a1-p/policytypes/type1/policies/policy1";
+ putPolicy(A1ProtocolType.SDNC_OSC_OSC_V1, expUrl);
+ }
+
+ @Test
+ void putPolicy_STD_V1() {
+ String expUrl = RIC_1_URL + "/A1-P/v1/policies/policy1";
+ putPolicy(A1ProtocolType.SDNC_OSC_STD_V1_1, expUrl);
+ }
+
+ @Test
+ void putPolicy_STD_V2() {
+ String expUrl = RIC_1_URL + "/A1-P/v2/policytypes/type1/policies/policy1";
+ putPolicy(A1ProtocolType.SDNC_OSC_STD_V2_0_0, expUrl);
+ }
+
+ @Test
+ void postRejected() {
+ clientUnderTest = new SdncOscA1Client(A1ProtocolType.SDNC_OSC_STD_V1_1, //
+ A1ClientHelper.createRic(RIC_1_URL).getConfig(), //
+ controllerConfig(), asyncRestClientMock);
+
final String policyJson = "{}";
AdapterOutput adapterOutput = ImmutableAdapterOutput.builder() //
.body("NOK") //
@@ -245,87 +294,79 @@ class SdncOscA1ClientTest {
.expectErrorMatches(t -> t instanceof WebClientResponseException) //
.verify();
- final String expUrl = policiesUrl() + "/" + POLICY_1_ID;
- AdapterRequest expRequestParams = ImmutableAdapterRequest.builder() //
- .nearRtRicUrl(expUrl) //
- .body(policyJson) //
- .build();
- String expRequest = SdncJsonHelper.createInputJsonString(expRequestParams);
- verify(asyncRestClientMock).postWithAuthHeader(PUT_A1_URL, expRequest, CONTROLLER_USERNAME,
- CONTROLLER_PASSWORD);
- StepVerifier.create(returnedMono)
- .expectErrorMatches(throwable -> throwable instanceof WebClientResponseException).verify();
+ StepVerifier.create(returnedMono).expectErrorMatches(throwable -> {
+ return throwable instanceof WebClientResponseException;
+ }).verify();
}
- @Test
- void deletePolicy() {
- whenPostReturnOkResponse();
+ private void deleteAllPolicies(A1ProtocolType protocolType, String expUrl) {
+ clientUnderTest = new SdncOscA1Client(protocolType, //
+ A1ClientHelper.createRic(RIC_1_URL).getConfig(), //
+ controllerConfig(), asyncRestClientMock);
+ String resp = createOkResponseWithBody(Arrays.asList("xxx"));
+ whenAsyncPostThenReturn(Mono.just(resp));
- String returned = clientUnderTest
- .deletePolicy(A1ClientHelper.createPolicy(RIC_1_URL, POLICY_1_ID, POLICY_JSON_VALID, POLICY_TYPE_1_ID))
- .block();
+ clientUnderTest.deleteAllPolicies().blockLast();
- assertEquals("OK", returned);
- final String expUrl = policiesUrl() + "/" + POLICY_1_ID;
- AdapterRequest expectedInputParams = ImmutableAdapterRequest.builder() //
+ ImmutableAdapterRequest expectedParams = ImmutableAdapterRequest.builder() //
.nearRtRicUrl(expUrl) //
.build();
- String expInput = SdncJsonHelper.createInputJsonString(expectedInputParams);
-
+ String expInput = SdncJsonHelper.createInputJsonString(expectedParams);
verify(asyncRestClientMock).postWithAuthHeader(DELETE_A1_URL, expInput, CONTROLLER_USERNAME,
CONTROLLER_PASSWORD);
}
@Test
- void getStatus() {
- whenPostReturnOkResponse();
-
- Policy policy = A1ClientHelper.createPolicy(RIC_1_URL, POLICY_1_ID, POLICY_JSON_VALID, POLICY_TYPE_1_ID);
-
- String returnedStatus = clientUnderTest.getPolicyStatus(policy).block();
-
- assertEquals("OK", returnedStatus, "unexpected status");
-
- final String expUrl = policiesUrl() + "/" + POLICY_1_ID + "/status";
- AdapterRequest expectedInputParams = ImmutableAdapterRequest.builder() //
- .nearRtRicUrl(expUrl) //
- .build();
- String expInput = SdncJsonHelper.createInputJsonString(expectedInputParams);
-
- verify(asyncRestClientMock).postWithAuthHeader(GET_A1_POLICY_STATUS_URL, expInput, CONTROLLER_USERNAME,
- CONTROLLER_PASSWORD);
+ void deleteAllPolicies_STD_V2() {
+ String expUrl1 = RIC_1_URL + "/A1-P/v2/policytypes/xxx/policies/xxx";
+ deleteAllPolicies(A1ProtocolType.SDNC_OSC_STD_V2_0_0, expUrl1);
}
@Test
- void getVersion_STD() {
- whenPostReturnOkResponse();
+ void deleteAllPolicies_STD_V1() {
+ String expUrl1 = RIC_1_URL + "/A1-P/v1/policies/xxx";
+ deleteAllPolicies(A1ProtocolType.SDNC_OSC_STD_V1_1, expUrl1);
+ }
- A1ProtocolType returnedVersion = clientUnderTest.getProtocolVersion().block();
+ @Test
+ void deleteAllPolicies_OSC() {
+ String expUrl1 = RIC_1_URL + "/a1-p/policytypes/xxx/policies/xxx";
+ deleteAllPolicies(A1ProtocolType.SDNC_OSC_OSC_V1, expUrl1);
+ }
- assertEquals(A1ProtocolType.SDNC_OSC_STD_V1_1, returnedVersion);
+ @Test
+ void getVersion_OSC() {
+ clientUnderTest = new SdncOscA1Client(A1ProtocolType.SDNC_OSC_OSC_V1, // Version irrelevant here
+ A1ClientHelper.createRic(RIC_1_URL).getConfig(), //
+ controllerConfig(), asyncRestClientMock);
- whenPostReturnOkResponseNoBody();
+ whenAsyncPostThenReturn(Mono.error(new Exception("Error"))).thenReturn(Mono.just(createOkResponseString(true)));
- returnedVersion = clientUnderTest.getProtocolVersion().block();
+ A1ProtocolType returnedVersion = clientUnderTest.getProtocolVersion().block();
assertEquals(A1ProtocolType.SDNC_OSC_STD_V1_1, returnedVersion);
}
@Test
- void getVersion_OSC() {
- clientUnderTest = new SdncOscA1Client(A1ProtocolType.SDNC_OSC_OSC_V1, //
+ void testGetStatus() {
+ clientUnderTest = new SdncOscA1Client(A1ProtocolType.SDNC_OSC_STD_V2_0_0, //
A1ClientHelper.createRic(RIC_1_URL).getConfig(), //
controllerConfig(), asyncRestClientMock);
+ whenPostReturnOkResponse();
- whenAsyncPostThenReturn(Mono.error(new Exception("Error"))).thenReturn(Mono.just(createOkResponseString(true)));
+ Policy policy = A1ClientHelper.createPolicy(RIC_1_URL, POLICY_1_ID, POLICY_JSON_VALID, POLICY_TYPE_1_ID);
- A1ProtocolType returnedVersion = clientUnderTest.getProtocolVersion().block();
+ String response = clientUnderTest.getPolicyStatus(policy).block();
+ assertEquals("OK", response);
- assertEquals(A1ProtocolType.SDNC_OSC_OSC_V1, returnedVersion);
- }
+ String expUrl = RIC_1_URL + "/A1-P/v2/policytypes/type1/policies/policy1/status";
+ ImmutableAdapterRequest expectedParams = ImmutableAdapterRequest.builder() //
+ .nearRtRicUrl(expUrl) //
+ .build();
+ String expInput = SdncJsonHelper.createInputJsonString(expectedParams);
+ verify(asyncRestClientMock).postWithAuthHeader(GET_A1_POLICY_STATUS_URL, expInput, CONTROLLER_USERNAME,
+ CONTROLLER_PASSWORD);
- private String policiesUrl() {
- return RIC_1_URL + "/A1-P/v1/policies";
}
private Gson gson() {
@@ -343,7 +384,7 @@ class SdncOscA1ClientTest {
whenAsyncPostThenReturn(Mono.just(createOkResponseString(true)));
}
- private void whenPostReturnOkResponseNoBody() {
+ void whenPostReturnOkResponseNoBody() {
whenAsyncPostThenReturn(Mono.just(createOkResponseString(false)));
}
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientV2Test.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientV2Test.java
new file mode 100644
index 00000000..d9238d64
--- /dev/null
+++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientV2Test.java
@@ -0,0 +1,180 @@
+/*-
+ * ========================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.clients;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.json.JSONException;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.junit.jupiter.MockitoExtension;
+import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ImmutableRicConfig;
+import org.onap.ccsdk.oran.a1policymanagementservice.configuration.RicConfig;
+
+import reactor.core.publisher.Flux;
+import reactor.core.publisher.Mono;
+import reactor.test.StepVerifier;
+
+@ExtendWith(MockitoExtension.class)
+class StdA1ClientV2Test {
+
+ private static final String RIC_URL = "RicUrl";
+
+ private static final String RIC_BASE_URL = "RicBaseUrl/A1-P/v2";
+
+ private static final String POLICYTYPES_IDENTITIES_URL = RIC_BASE_URL + "/policytypes";
+ private static final String POLICIES = "/policies";
+ private static final String POLICYTYPES_URL = RIC_BASE_URL + "/policytypes/";
+ private static final String POLICY_TYPE_1_ID = "type1";
+ private static final String POLICY_TYPE_2_ID = "type2";
+ private static final String POLICY_TYPE_SCHEMA_VALID = "{\"type\":\"type1\"}";
+ private static final String POLICY_TYPE_SCHEMA_INVALID = "\"type\":\"type1\"}";
+ private static final String POLICY_1_ID = "policy1";
+ private static final String POLICY_2_ID = "policy2";
+ private static final String POLICY_JSON_VALID = "{\"policyId\":\"policy1\"}";
+
+ StdA1ClientVersion2 clientUnderTest;
+
+ AsyncRestClient asyncRestClientMock;
+
+ @BeforeEach
+ void init() {
+ RicConfig ricConfig = ImmutableRicConfig.builder() //
+ .ricId("name") //
+ .baseUrl("RicBaseUrl") //
+ .managedElementIds(new ArrayList<>()) //
+ .controllerName("") //
+ .build();
+ asyncRestClientMock = mock(AsyncRestClient.class);
+ clientUnderTest = new StdA1ClientVersion2(ricConfig, asyncRestClientMock);
+ }
+
+ @Test
+ void testGetPolicyTypeIdentities() {
+ List<String> policyTypeIds = Arrays.asList(POLICY_TYPE_1_ID, POLICY_TYPE_2_ID);
+ Mono<String> policyTypeIdsResp = Mono.just(policyTypeIds.toString());
+ when(asyncRestClientMock.get(anyString())).thenReturn(policyTypeIdsResp);
+
+ Mono<List<String>> returnedMono = clientUnderTest.getPolicyTypeIdentities();
+ verify(asyncRestClientMock).get(POLICYTYPES_IDENTITIES_URL);
+ StepVerifier.create(returnedMono).expectNext(policyTypeIds).expectComplete().verify();
+ }
+
+ @Test
+ void testGetPolicyIdentities() {
+ Mono<String> policyTypeIdsResp = Mono.just(Arrays.asList(POLICY_TYPE_1_ID, POLICY_TYPE_2_ID).toString());
+ Mono<String> policyIdsType1Resp = Mono.just(Arrays.asList(POLICY_1_ID).toString());
+ Mono<String> policyIdsType2Resp = Mono.just(Arrays.asList(POLICY_2_ID).toString());
+ when(asyncRestClientMock.get(anyString())).thenReturn(policyTypeIdsResp).thenReturn(policyIdsType1Resp)
+ .thenReturn(policyIdsType2Resp);
+
+ List<String> returned = clientUnderTest.getPolicyIdentities().block();
+
+ assertEquals(2, returned.size(), "");
+ verify(asyncRestClientMock).get(POLICYTYPES_IDENTITIES_URL);
+ verify(asyncRestClientMock).get(POLICYTYPES_URL + POLICY_TYPE_1_ID + POLICIES);
+ verify(asyncRestClientMock).get(POLICYTYPES_URL + POLICY_TYPE_2_ID + POLICIES);
+ }
+
+ @Test
+ void testGetValidPolicyType() {
+ String policyType = "{\"policySchema\": " + POLICY_TYPE_SCHEMA_VALID + "}";
+ Mono<String> policyTypeResp = Mono.just(policyType);
+
+ when(asyncRestClientMock.get(anyString())).thenReturn(policyTypeResp);
+
+ String response = clientUnderTest.getPolicyTypeSchema(POLICY_TYPE_1_ID).block();
+ verify(asyncRestClientMock).get(POLICYTYPES_URL + POLICY_TYPE_1_ID);
+ assertThat(response).contains("title");
+ }
+
+ @Test
+ void testGetInValidPolicyTypeJson() {
+ String policyType = "{\"policySchema\": " + POLICY_TYPE_SCHEMA_INVALID + "}";
+ Mono<String> policyTypeResp = Mono.just(policyType);
+
+ when(asyncRestClientMock.get(anyString())).thenReturn(policyTypeResp);
+
+ Mono<String> returnedMono = clientUnderTest.getPolicyTypeSchema(POLICY_TYPE_1_ID);
+ verify(asyncRestClientMock).get(POLICYTYPES_URL + POLICY_TYPE_1_ID);
+ StepVerifier.create(returnedMono).expectErrorMatches(throwable -> throwable instanceof JSONException).verify();
+ }
+
+ @Test
+ void testGetPolicyTypeWithoutCreateSchema() {
+ Mono<String> policyTypeResp = Mono.just(POLICY_TYPE_SCHEMA_VALID);
+
+ when(asyncRestClientMock.get(anyString())).thenReturn(policyTypeResp);
+
+ Mono<String> returnedMono = clientUnderTest.getPolicyTypeSchema(POLICY_TYPE_1_ID);
+ verify(asyncRestClientMock).get(POLICYTYPES_URL + POLICY_TYPE_1_ID);
+ StepVerifier.create(returnedMono).expectErrorMatches(throwable -> throwable instanceof Exception).verify();
+ }
+
+ @Test
+ void testPutPolicy() {
+ when(asyncRestClientMock.put(anyString(), anyString())).thenReturn(Mono.empty());
+
+ clientUnderTest
+ .putPolicy(A1ClientHelper.createPolicy(RIC_URL, POLICY_1_ID, POLICY_JSON_VALID, POLICY_TYPE_1_ID))
+ .block();
+ verify(asyncRestClientMock).put(POLICYTYPES_URL + POLICY_TYPE_1_ID + POLICIES + "/" + POLICY_1_ID,
+ POLICY_JSON_VALID);
+ }
+
+ @Test
+ void testDeletePolicy() {
+ when(asyncRestClientMock.delete(anyString())).thenReturn(Mono.empty());
+
+ Mono<String> returnedMono = clientUnderTest
+ .deletePolicy(A1ClientHelper.createPolicy(RIC_URL, POLICY_1_ID, POLICY_JSON_VALID, POLICY_TYPE_1_ID));
+ verify(asyncRestClientMock).delete(POLICYTYPES_URL + POLICY_TYPE_1_ID + POLICIES + "/" + POLICY_1_ID);
+ StepVerifier.create(returnedMono).expectComplete().verify();
+ }
+
+ @Test
+ void testDeleteAllPolicies() {
+ Mono<String> policyTypeIdsResp = Mono.just(Arrays.asList(POLICY_TYPE_1_ID, POLICY_TYPE_2_ID).toString());
+ Mono<String> policyIdsType1Resp = Mono.just(Arrays.asList(POLICY_1_ID).toString());
+ Mono<String> policyIdsType2Resp = Mono.just(Arrays.asList(POLICY_2_ID).toString());
+ when(asyncRestClientMock.get(anyString())).thenReturn(policyTypeIdsResp).thenReturn(policyIdsType1Resp)
+ .thenReturn(policyIdsType2Resp);
+ when(asyncRestClientMock.delete(anyString())).thenReturn(Mono.empty());
+
+ Flux<String> returnedFlux = clientUnderTest.deleteAllPolicies();
+ StepVerifier.create(returnedFlux).expectComplete().verify();
+ verify(asyncRestClientMock).get(POLICYTYPES_IDENTITIES_URL);
+ verify(asyncRestClientMock).get(POLICYTYPES_URL + POLICY_TYPE_1_ID + POLICIES);
+ verify(asyncRestClientMock).delete(POLICYTYPES_URL + POLICY_TYPE_1_ID + POLICIES + "/" + POLICY_1_ID);
+ verify(asyncRestClientMock).get(POLICYTYPES_URL + POLICY_TYPE_2_ID + POLICIES);
+ verify(asyncRestClientMock).delete(POLICYTYPES_URL + POLICY_TYPE_2_ID + POLICIES + "/" + POLICY_2_ID);
+ }
+}
diff --git a/a1-policy-management/src/test/resources/test_oran_get_schema_response.json b/a1-policy-management/src/test/resources/test_oran_get_schema_response.json
new file mode 100644
index 00000000..d17f6163
--- /dev/null
+++ b/a1-policy-management/src/test/resources/test_oran_get_schema_response.json
@@ -0,0 +1,45 @@
+{
+ "name": "pt1",
+ "description": "pt1 policy type",
+ "policy_type_id": 1,
+ "policySchema": {
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "OSC_Type1_1.0.0",
+ "description": "Type 1 policy type",
+ "type": "object",
+ "properties": {
+ "scope": {
+ "type": "object",
+ "properties": {
+ "ueId": {
+ "type": "string"
+ },
+ "qosId": {
+ "type": "string"
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "ueId",
+ "qosId"
+ ]
+ },
+ "qosObjective": {
+ "type": "object",
+ "properties": {
+ "priorityLevel": {
+ "type": "number"
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "priorityLevel"
+ ]
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "scope", "qosObjective"
+ ]
+ }
+}
diff --git a/docs/offeredapis/swagger/pms-api.json b/docs/offeredapis/swagger/pms-api.json
index f600470e..5d3a7a67 100644
--- a/docs/offeredapis/swagger/pms-api.json
+++ b/docs/offeredapis/swagger/pms-api.json
@@ -1,33 +1,11 @@
{
- "swagger": "2.0",
"basePath": "/",
- "info": {
- "x-audience": "external-partner",
- "x-api-id": "60f9a0e7-343f-43bf-9194-d8d65688d465",
- "contact": {
- "name": "Ericsson Software Technology",
- "email": "nonrtric@est.tech"
- },
- "description": "The O-RAN Non-RT RIC Policy Management Service provides a REST API for management of A1 policices. \nIt 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>",
- "title": "A1 Policy management service",
- "version": "1.1.0"
- },
- "tags": [
- {
- "name": "A1 Policy Management Version 1.0",
- "description": "Policy Controller"
- },
- {
- "name": "A1 Policy Management Version 2.0 (in progress)",
- "description": "Policy Controller"
- }
- ],
"paths": {
"/policy_types": {"get": {
"summary": "Query policy type names",
"deprecated": false,
"produces": ["*/*"],
- "operationId": "getPolicyTypesUsingGET",
+ "operationId": "getPolicyTypesUsingGET_1",
"responses": {
"200": {
"schema": {
@@ -58,7 +36,7 @@
"summary": "Returns a policy configuration",
"deprecated": false,
"produces": ["application/json"],
- "operationId": "getPolicyUsingGET_1",
+ "operationId": "getPolicyUsingGET",
"responses": {
"200": {
"schema": {"$ref": "#/definitions/json_object"},
@@ -85,7 +63,7 @@
"summary": "Delete a policy",
"deprecated": false,
"produces": ["*/*"],
- "operationId": "deletePolicyUsingDELETE_1",
+ "operationId": "deletePolicyUsingDELETE",
"responses": {
"200": {"description": "Not used"},
"401": {"description": "Unauthorized"},
@@ -114,7 +92,7 @@
"summary": "Create or update a policy",
"deprecated": false,
"produces": ["application/json"],
- "operationId": "putPolicyUsingPUT_1",
+ "operationId": "putPolicyUsingPUT",
"responses": {
"200": {"description": "Policy updated"},
"201": {"description": "Policy created"},
@@ -204,7 +182,7 @@
"summary": "Query policies, only policy identities returned",
"deprecated": false,
"produces": ["*/*"],
- "operationId": "getPolicyIdsUsingGET",
+ "operationId": "getPolicyIdsUsingGET_1",
"responses": {
"200": {
"schema": {
@@ -252,7 +230,7 @@
"summary": "Returns policy type schema definitions",
"deprecated": false,
"produces": ["*/*"],
- "operationId": "getPolicySchemasUsingGET",
+ "operationId": "getPolicySchemasUsingGET_1",
"responses": {
"200": {
"schema": {
@@ -282,7 +260,7 @@
"summary": "Query policy type identities",
"deprecated": false,
"produces": ["application/json"],
- "operationId": "getPolicyTypesUsingGET_1",
+ "operationId": "getPolicyTypesUsingGET",
"responses": {
"200": {
"schema": {"$ref": "#/definitions/policy_type_id_list_v2"},
@@ -463,7 +441,7 @@
"summary": "Returns the name of a RIC managing one Mananged Element",
"deprecated": false,
"produces": ["*/*"],
- "operationId": "getRicUsingGET_1",
+ "operationId": "getRicUsingGET",
"responses": {
"200": {
"schema": {"type": "string"},
@@ -487,7 +465,7 @@
"tags": ["A1 Policy Management Version 1.0"]
}},
"/services/keepalive": {"put": {
- "summary": "Heartbeat from a serice",
+ "summary": "Heartbeat from a service",
"deprecated": false,
"produces": ["*/*"],
"operationId": "keepAliveServiceUsingPUT_1",
@@ -545,7 +523,7 @@
"summary": "Returns policy type schema definitions",
"deprecated": false,
"produces": ["application/json"],
- "operationId": "getPolicySchemasUsingGET_1",
+ "operationId": "getPolicySchemasUsingGET",
"responses": {
"200": {
"schema": {"$ref": "#/definitions/policy_schema_list_v2"},
@@ -583,7 +561,7 @@
"deprecated": false,
"produces": ["application/json"],
"description": "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).",
- "operationId": "getRicUsingGET",
+ "operationId": "getRicUsingGET_1",
"responses": {
"200": {
"schema": {"$ref": "#/definitions/ric_info_v2"},
@@ -621,7 +599,7 @@
"summary": "Returns a policy configuration",
"deprecated": false,
"produces": ["*/*"],
- "operationId": "getPolicyUsingGET",
+ "operationId": "getPolicyUsingGET_1",
"responses": {
"200": {
"schema": {"type": "object"},
@@ -645,7 +623,7 @@
"summary": "Delete a policy",
"deprecated": false,
"produces": ["*/*"],
- "operationId": "deletePolicyUsingDELETE",
+ "operationId": "deletePolicyUsingDELETE_1",
"responses": {
"200": {"description": "Not used"},
"401": {"description": "Unauthorized"},
@@ -674,7 +652,7 @@
"summary": "Put a policy",
"deprecated": false,
"produces": ["*/*"],
- "operationId": "putPolicyUsingPUT",
+ "operationId": "putPolicyUsingPUT_1",
"responses": {
"200": {"description": "Policy updated"},
"201": {"description": "Policy created"},
@@ -765,7 +743,7 @@
"deprecated": false,
"produces": ["application/json"],
"description": "Returns a list of A1 policies matching given search criteria. <br>If several query parameters are defined, the policies matching all conditions are returned.",
- "operationId": "getPolicyIdsUsingGET_1",
+ "operationId": "getPolicyIdsUsingGET",
"responses": {
"200": {
"schema": {"$ref": "#/definitions/policy_id_list_v2"},
@@ -810,7 +788,7 @@
"summary": "Query policies",
"deprecated": false,
"produces": ["*/*"],
- "operationId": "getPoliciesUsingGET",
+ "operationId": "getPoliciesUsingGET_1",
"responses": {
"200": {
"schema": {
@@ -858,7 +836,7 @@
"summary": "Returns a policy status",
"deprecated": false,
"produces": ["application/json"],
- "operationId": "getPolicyStatusUsingGET_1",
+ "operationId": "getPolicyStatusUsingGET",
"responses": {
"200": {
"schema": {"$ref": "#/definitions/json_object"},
@@ -912,7 +890,7 @@
"summary": "Query Near-RT RIC information",
"deprecated": false,
"produces": ["*/*"],
- "operationId": "getRicsUsingGET_1",
+ "operationId": "getRicsUsingGET",
"responses": {
"200": {
"schema": {
@@ -975,7 +953,7 @@
"deprecated": false,
"produces": ["application/json"],
"description": "Returns a list of A1 policies matching given search criteria. <br>If several query parameters are defined, the policies matching all conditions are returned.",
- "operationId": "getPoliciesUsingGET_1",
+ "operationId": "getPoliciesUsingGET",
"responses": {
"200": {
"schema": {"$ref": "#/definitions/policy_info_list_v2"},
@@ -1020,7 +998,7 @@
"summary": "Returns a policy status",
"deprecated": false,
"produces": ["*/*"],
- "operationId": "getPolicyStatusUsingGET",
+ "operationId": "getPolicyStatusUsingGET_1",
"responses": {
"200": {
"schema": {"type": "object"},
@@ -1048,7 +1026,7 @@
"deprecated": false,
"produces": ["application/json"],
"description": "The call returns all Near-RT RICs that supports a given policy type identity",
- "operationId": "getRicsUsingGET",
+ "operationId": "getRicsUsingGET_1",
"responses": {
"200": {
"schema": {"$ref": "#/definitions/ric_info_list_v2"},
@@ -1072,7 +1050,7 @@
"tags": ["A1 Policy Management Version 2.0 (in progress)"]
}}
},
- "host": "localhost:41579",
+ "host": "localhost:41437",
"definitions": {
"error_information": {
"description": "Problem as defined in https://tools.ietf.org/html/rfc7807",
@@ -1379,5 +1357,27 @@
"type": "object",
"title": "Mono«ResponseEntity«string»»"
}
- }
+ },
+ "swagger": "2.0",
+ "info": {
+ "x-audience": "external-partner",
+ "x-api-id": "60f9a0e7-343f-43bf-9194-d8d65688d465",
+ "contact": {
+ "name": "Ericsson Software Technology",
+ "email": "nonrtric@est.tech"
+ },
+ "description": "The O-RAN Non-RT RIC Policy Management Service provides a REST API for management of A1 policices. \nIt 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>",
+ "title": "A1 Policy management service",
+ "version": "1.1.0"
+ },
+ "tags": [
+ {
+ "name": "A1 Policy Management Version 1.0",
+ "description": "Policy Controller"
+ },
+ {
+ "name": "A1 Policy Management Version 2.0 (in progress)",
+ "description": "Policy Controller"
+ }
+ ]
} \ No newline at end of file
diff --git a/docs/offeredapis/swagger/pms-api.yaml b/docs/offeredapis/swagger/pms-api.yaml
index ac10f4b6..245e52c2 100644
--- a/docs/offeredapis/swagger/pms-api.yaml
+++ b/docs/offeredapis/swagger/pms-api.yaml
@@ -1,842 +1,1341 @@
-openapi: 3.0.1
-info:
- title: A1 Policy management service
- description: 'The O-RAN Non-RT RIC PolicyAgent provides a REST API for management of policices. It provides support for: -Supervision of clients (R-APPs) to eliminate stray policies in case of failure -Consistency monitoring of the SMO view of policies and the actual situation in the RICs -Consistency monitoring of RIC capabilities (policy types) -Policy configuration. This includes: -One REST API towards all RICs in the network -Query functions that can find all policies in a RIC, all policies owned by a service (R-APP), all policies of a type etc. -Maps O1 resources (ManagedElement) as defined in O1 to the controlling RIC
- of A1 policices.'
- version: "1.0"
-servers:
-- url: https://localhost:8433/
-- url: http://localhost:8081/
-tags:
-- name: A1 Policy Management
- description: Policy Controller
-- name: Health check
- description: Status Controller
-- name: RIC Repository
- description: Ric Repository Controller
-- name: Service registry and supervision
- description: Service Controller
+basePath: /
paths:
- /policies:
+ /policy_types:
get:
- tags:
- - A1 Policy Management
- summary: Query policies
- operationId: getPoliciesUsingGET
- parameters:
- - name: ric
- in: query
- description: The name of the Near-RT RIC to get policies for.
- allowEmptyValue: false
- schema:
- type: string
- example: 'ric1'
- - name: service
- in: query
- description: The name of the service to get policies for.
- allowEmptyValue: false
- schema:
- type: string
- example: 'controlpanel'
- - name: type
- in: query
- description: The name of the policy type to get policies for.
- allowEmptyValue: false
- schema:
- type: string
- example: '1'
- responses:
- 200:
- description: Policies
- content:
- text/plain;charset=ISO-8859-1:
- schema:
- type: array
- items:
- $ref: '#/components/schemas/PolicyInfo'
- examples:
- OSC:
- $ref: '#/components/examples/Policies-OSC'
- STD:
- $ref: '#/components/examples/Policies-STD'
- 404:
- description: RIC or type not found
- content:
- text/plain;charset=ISO-8859-1:
- schema:
- type: string
- example: RIC not found
+ summary: Query policy type names
deprecated: false
- /policy:
- get:
+ produces:
+ - '*/*'
+ operationId: getPolicyTypesUsingGET_1
+ responses:
+ '200':
+ schema:
+ type: array
+ items:
+ type: string
+ description: Policy type names
+ '401':
+ description: Unauthorized
+ '403':
+ description: Forbidden
+ '404':
+ schema:
+ type: string
+ description: Near-RT RIC is not found
+ parameters:
+ - in: query
+ allowEmptyValue: false
+ name: ric
+ description: The name of the Near-RT RIC to get types for.
+ type: string
+ required: false
tags:
- - A1 Policy Management
+ - A1 Policy Management Version 1.0
+ /v2/policy:
+ get:
summary: Returns a policy configuration
+ deprecated: false
+ produces:
+ - application/json
operationId: getPolicyUsingGET
- parameters:
- - name: id
- in: query
- description: The identity of the policy instance.
- required: true
- allowEmptyValue: false
- schema:
- type: string
- example: 'e26d76e1-b43f-427e-a3c2-b7c4e05a6431'
responses:
- 200:
+ '200':
+ schema:
+ $ref: '#/definitions/json_object'
description: Policy found
- content:
- text/plain;charset=ISO-8859-1:
- schema:
- type: object
- examples:
- OSC:
- $ref: '#/components/examples/Policy-OSC'
- STD:
- $ref: '#/components/examples/Policy-STD'
- 404:
+ '401':
+ description: Unauthorized
+ '403':
+ description: Forbidden
+ '404':
+ schema:
+ $ref: '#/definitions/error_information'
description: Policy is not found
- content:
- text/plain;charset=ISO-8859-1:
- schema:
- type: string
- example: 'Could not find policy: e26d76e1-b43f-427e-a3c2-b7c4e05a6431'
- deprecated: false
- put:
- tags:
- - A1 Policy Management
- summary: Put a policy
- operationId: putPolicyUsingPUT
parameters:
- - name: id
- in: query
- description: The identity of the policy instance.
- required: true
- allowEmptyValue: false
- schema:
- type: string
- example: '73428e58-1670-4972-8498-e7e8f1003631'
- - name: ric
- in: query
- description: The name of the Near-RT RIC where the policy will be created.
- required: true
- allowEmptyValue: false
- schema:
- type: string
- example: 'ric1'
- - name: service
- in: query
- description: The name of the service creating the policy.
- required: true
- allowEmptyValue: false
- schema:
- type: string
- example: 'Service1'
- - name: transient
- in: query
- 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.
- allowEmptyValue: false
- schema:
- type: boolean
- default: false
- example: false
- - name: type
- in: query
- description: The name of the policy type. The policy type is mandatory for OSC A1 version and should not be provided for STD A1 version.
- allowEmptyValue: false
- schema:
- type: string
- example: 'STD_PolicyModelUnconstrained_0.2.0'
- requestBody:
- description: jsonBody
- content:
- application/json:
- schema:
- type: object
- example:
- scope:
- qosId: "3"
- ueId: "1"
- statement:
- priorityLevel: 1
- required: true
- responses:
- 200:
- description: Policy updated
- 201:
- description: Policy created
- 404:
- description: RIC or policy type is not found
- 423:
- description: RIC is not operational
- content:
- text/plain;charset=ISO-8859-1:
- schema:
- type: string
- example: 'Ric is not operational, RIC name:ric1, state:UNAVAILABLE'
- delete:
+ - in: query
+ allowEmptyValue: false
+ name: policy_id
+ description: The identity of the policy instance.
+ type: string
+ required: true
tags:
- - A1 Policy Management
+ - A1 Policy Management Version 2.0 (in progress)
+ delete:
summary: Delete a policy
+ deprecated: false
+ produces:
+ - '*/*'
operationId: deletePolicyUsingDELETE
- parameters:
- - name: id
- in: query
- description: The identity of the policy instance.
- required: true
- allowEmptyValue: false
- schema:
- type: string
- example: '73428e58-1670-4972-8498-e7e8f1003631'
responses:
- 200:
- description: OK
- 204:
+ '200':
+ description: Not used
+ '204':
description: Policy deleted
- 404:
+ '401':
+ description: Unauthorized
+ '403':
+ description: Forbidden
+ '404':
+ schema:
+ $ref: '#/definitions/error_information'
description: Policy is not found
- 423:
- description: RIC is not operational
- content:
- text/plain;charset=ISO-8859-1:
- schema:
- type: string
- example: 'Ric is not operational, RIC name:ric1,state:UNAVAILABLE'
- deprecated: false
- /policy_ids:
- get:
- tags:
- - A1 Policy Management
- summary: Query policies, only IDs returned
- operationId: getPolicyIdsUsingGET
+ '423':
+ schema:
+ $ref: '#/definitions/error_information'
+ description: Near-RT RIC is not operational
parameters:
- - name: ric
- in: query
- description: The name of the Near-RT RIC to get policies for.
- allowEmptyValue: false
- schema:
- type: string
- example: 'ric1'
- - name: service
- in: query
- description: The name of the service to get policies for.
- allowEmptyValue: false
- schema:
- type: string
- example: 'Service1'
- - name: type
- in: query
- description: The name of the policy type to get policies for.
- allowEmptyValue: false
- schema:
- type: string
- example: '1'
- responses:
- 200:
- description: Policy ids
- content:
- text/plain;charset=ISO-8859-1:
- schema:
- type: array
- items:
- type: string
- examples:
- OSC:
- value:
- - 73428e58-1670-4972-8498-e7e8f1003631
- - 73428e58-1670-4972-8498-e7e8f100363e
- STD:
- value:
- - 73428e58-1670-4972-8498-e7e8f1003632
- - 73428e58-1670-4972-8498-e7e8f1003634
- 404:
- description: RIC or type not found
- content:
- text/plain;charset=ISO-8859-1:
- schema:
- type: string
- example: RIC not found
- deprecated: false
- /policy_schema:
- get:
+ - in: query
+ allowEmptyValue: false
+ name: policy_id
+ description: The identity of the policy instance.
+ type: string
+ required: true
tags:
- - A1 Policy Management
- summary: Returns one policy type schema definition. Applicable only for OSC Version.
- operationId: getPolicySchemaUsingGET
+ - A1 Policy Management Version 2.0 (in progress)
+ put:
+ summary: Create or update a policy
+ deprecated: false
+ produces:
+ - application/json
+ operationId: putPolicyUsingPUT
+ responses:
+ '200':
+ description: Policy updated
+ '201':
+ description: Policy created
+ '401':
+ description: Unauthorized
+ '403':
+ description: Forbidden
+ '404':
+ schema:
+ $ref: '#/definitions/error_information'
+ description: Near-RT RIC or policy type is not found
+ '423':
+ schema:
+ $ref: '#/definitions/error_information'
+ description: Near-RT RIC is not operational
parameters:
- - name: id
- in: query
- description: The identity of the policy type to get the definition for.
- required: true
- allowEmptyValue: false
- schema:
- type: string
- example: '11'
+ - schema:
+ type: object
+ in: body
+ name: jsonBody
+ description: jsonBody
+ required: true
+ - in: query
+ allowEmptyValue: false
+ name: policy_id
+ description: The identity of the policy instance.
+ type: string
+ required: true
+ - in: query
+ allowEmptyValue: false
+ name: policytype_id
+ description: The identity of the policy type.
+ type: string
+ required: false
+ - in: query
+ allowEmptyValue: false
+ name: ric_id
+ description: The identity of the Near-RT RIC where the policy will be created.
+ type: string
+ required: true
+ - in: query
+ allowEmptyValue: false
+ name: service_id
+ description: The identity of the service creating the policy.
+ type: string
+ required: true
+ - default: false
+ in: query
+ allowEmptyValue: false
+ name: transient
+ x-example: false
+ description: If the policy is transient or not (boolean 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)
+ type: boolean
+ required: false
+ tags:
+ - A1 Policy Management Version 2.0 (in progress)
+ consumes:
+ - application/json
+ /v2/status:
+ get:
+ summary: Returns status and statistics of this service
+ deprecated: false
+ produces:
+ - application/json
+ operationId: getStatusUsingGET_1
responses:
- 200:
- description: Policy schema
- content:
- text/plain;charset=ISO-8859-1:
- schema:
- type: object
- examples:
- OSC:
- value:
- $schema: http://json-schema.org/draft-07/schema#
- description: QoS policy type
- title: "1"
- type: object
- properties:
- scope:
- additionalProperties: false
- type: object
- properties:
- qosId:
- type: string
- ueId:
- type: string
- required:
- - ueId
- - qosId
- statement:
- additionalProperties: false
- type: object
- properties:
- priorityLevel:
- type: number
- required:
- - priorityLevel
- 404:
- description: Type not found
- content:
- text/plain;charset=ISO-8859-1:
- schema:
- type: string
- example: 'org.oransc.policyagent.exceptions.ServiceException: Could
- not find type: 11'
+ '200':
+ schema:
+ $ref: '#/definitions/status_info_v2'
+ description: Service is living
+ '401':
+ description: Unauthorized
+ '403':
+ description: Forbidden
+ '404':
+ description: Not Found
+ tags:
+ - A1 Policy Management Version 2.0 (in progress)
+ /policy_ids:
+ get:
+ summary: 'Query policies, only policy identities returned'
deprecated: false
+ produces:
+ - '*/*'
+ operationId: getPolicyIdsUsingGET_1
+ responses:
+ '200':
+ schema:
+ type: array
+ items:
+ type: string
+ description: Policy identitiess
+ '401':
+ description: Unauthorized
+ '403':
+ description: Forbidden
+ '404':
+ schema:
+ type: string
+ description: Near-RT RIC or type not found
+ parameters:
+ - in: query
+ allowEmptyValue: false
+ name: ric
+ description: The name of the Near-RT RIC to get policies for.
+ type: string
+ required: false
+ - in: query
+ allowEmptyValue: false
+ name: service
+ description: The name of the service to get policies for.
+ type: string
+ required: false
+ - in: query
+ allowEmptyValue: false
+ name: type
+ description: The name of the policy type to get policies for.
+ type: string
+ required: false
+ tags:
+ - A1 Policy Management Version 1.0
/policy_schemas:
get:
- tags:
- - A1 Policy Management
summary: Returns policy type schema definitions
- operationId: getPolicySchemasUsingGET
- parameters:
- - name: ric
- in: query
- description: The name of the Near-RT RIC to get the definitions for.
- allowEmptyValue: false
- schema:
- type: string
- example: ric1
+ deprecated: false
+ produces:
+ - '*/*'
+ operationId: getPolicySchemasUsingGET_1
responses:
- 200:
+ '200':
+ schema:
+ type: array
+ items:
+ type: object
description: Policy schemas
- content:
- text/plain;charset=ISO-8859-1:
- schema:
- type: array
- items:
- type: object
- properties: {}
- examples:
- OSC:
- value:
- - $schema: http://json-schema.org/draft-07/schema#
- description: QoS policy type
- title: "1"
- type: object
- properties:
- scope:
- additionalProperties: false
- type: object
- properties:
- qosId:
- type: string
- ueId:
- type: string
- required:
- - ueId
- - qosId
- statement:
- additionalProperties: false
- type: object
- properties:
- priorityLevel:
- type: number
- required:
- - priorityLevel
- 404:
- description: RIC is not found
- content:
- text/plain;charset=ISO-8859-1:
- schema:
- type: string
- example: 'org.oransc.policyagent.exceptions.ServiceException: Could
- not find ric: ric1'
- deprecated: false
- /policy_status:
- get:
- tags:
- - A1 Policy Management
- summary: Returns a policy status
- operationId: getPolicyStatusUsingGET
+ '401':
+ description: Unauthorized
+ '403':
+ description: Forbidden
+ '404':
+ schema:
+ type: string
+ description: Near-RT RIC is not found
parameters:
- - name: id
- in: query
- description: The identity of the policy.
- required: true
- allowEmptyValue: false
- schema:
- type: string
- example: 73428e58-1670-4972-8498-e7e8f100363q
- responses:
- 200:
- description: Policy status
- content:
- text/plain;charset=ISO-8859-1:
- schema:
- type: object
- examples:
- OSC:
- value:
- instance_status: NOT IN EFFECT
- has_been_deleted: "false"
- created_at: 07/20/2020, 17:15:39
- STD:
- value:
- enforceStatus: UNDEFINED
- 404:
- description: Policy is not found
- content:
- text/plain;charset=ISO-8859-1:
- schema:
- type: string
- example: 'Could not find policy: 73428e58-1670-4972-8498-e7e8f100363q'
- deprecated: false
- /policy_types:
- get:
+ - in: query
+ allowEmptyValue: false
+ name: ric
+ description: The name of the Near-RT RIC to get the definitions for.
+ type: string
+ required: false
tags:
- - A1 Policy Management
- summary: Query policy type names
+ - A1 Policy Management Version 1.0
+ /v2/policy-types:
+ get:
+ summary: Query policy type identities
+ deprecated: false
+ produces:
+ - application/json
operationId: getPolicyTypesUsingGET
+ responses:
+ '200':
+ schema:
+ $ref: '#/definitions/policy_type_id_list_v2'
+ description: Policy type IDs
+ '401':
+ description: Unauthorized
+ '403':
+ description: Forbidden
+ '404':
+ schema:
+ $ref: '#/definitions/error_information'
+ description: Near-RT RIC is not found
parameters:
- - name: ric
- in: query
- description: The name of the Near-RT RIC to get types for.
- allowEmptyValue: false
- schema:
+ - in: query
+ allowEmptyValue: false
+ name: ric_id
+ description: The identity of the Near-RT RIC to get types for.
type: string
- example: 'ric11'
- responses:
- 200:
- description: Policy type names
- content:
- text/plain;charset=ISO-8859-1:
- schema:
- type: array
- items:
- type: string
- examples:
- OSC:
- value:
- - "1"
- 404:
- description: RIC is not found
- content:
- text/plain;charset=ISO-8859-1:
- schema:
- type: string
- example: 'org.oransc.policyagent.exceptions.ServiceException: Could
- not find ric: ric11'
- deprecated: false
- /ric:
- get:
+ required: false
tags:
- - RIC Repository
- summary: Returns the name of a RIC managing one Mananged Element
- operationId: getRicUsingGET
- parameters:
- - name: managedElementId
- in: query
- description: The identity of the Managed Element
- required: true
- allowEmptyValue: false
- schema:
- type: string
- example: 'Node 1'
- responses:
- 200:
- description: RIC is found
- content:
- text/plain;charset=ISO-8859-1:
- schema:
- type: string
- example: ric1
- 404:
- description: RIC is not found
- content:
- text/plain;charset=ISO-8859-1:
- schema:
- type: string
- example: No RIC found
- deprecated: false
- /rics:
+ - A1 Policy Management Version 2.0 (in progress)
+ /v2/services:
get:
- tags:
- - RIC Repository
- summary: Query Near-RT RIC information
- operationId: getRicsUsingGET
- parameters:
- - name: policyType
- in: query
- description: The name of the policy type
- allowEmptyValue: false
- schema:
- type: string
- example: 'STD_PolicyModelUnconstrained_0.2.0'
+ summary: Returns service information
+ deprecated: false
+ produces:
+ - application/json
+ description: Either information about a registered service with given identity or all registered services are returned.
+ operationId: getServicesUsingGET
responses:
- 200:
+ '200':
+ schema:
+ $ref: '#/definitions/service_list_v2'
description: OK
- content:
- text/plain;charset=ISO-8859-1:
- schema:
- type: array
- items:
- $ref: '#/components/schemas/RicInfo'
- 404:
- description: Policy type is not found
- content:
- text/plain;charset=ISO-8859-1:
- schema:
- type: string
- example: Policy type not found
+ '401':
+ description: Unauthorized
+ '403':
+ description: Forbidden
+ '404':
+ schema:
+ $ref: '#/definitions/error_information'
+ description: Service is not found
+ parameters:
+ - in: query
+ allowEmptyValue: false
+ name: service_id
+ description: The identity of the service
+ type: string
+ required: false
+ tags:
+ - A1 Policy Management Version 2.0 (in progress)
+ delete:
+ summary: Unregister a service
deprecated: false
- /service:
- put:
+ produces:
+ - '*/*'
+ operationId: deleteServiceUsingDELETE
+ responses:
+ '200':
+ description: Not used
+ '204':
+ schema:
+ type: object
+ description: Service unregistered
+ '401':
+ description: Unauthorized
+ '403':
+ description: Forbidden
+ '404':
+ schema:
+ $ref: '#/definitions/error_information'
+ description: Service not found
+ parameters:
+ - in: query
+ allowEmptyValue: false
+ name: service_id
+ description: The idenitity of the service
+ type: string
+ required: true
tags:
- - Service registry and supervision
+ - A1 Policy Management Version 2.0 (in progress)
+ put:
summary: Register a service
+ deprecated: false
+ produces:
+ - '*/*'
+ description: '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>'
operationId: putServiceUsingPUT
- requestBody:
- description: registrationInfo
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ServiceRegistrationInfo'
- required: true
responses:
- 200:
+ '200':
+ schema:
+ type: object
description: Service updated
- content:
- text/plain;charset=ISO-8859-1:
- schema:
- type: string
- example: OK
- 201:
+ '201':
+ schema:
+ type: object
description: Service created
- content:
- text/plain;charset=ISO-8859-1:
- schema:
- type: string
- example: OK
- 400:
+ '400':
+ schema:
+ $ref: '#/definitions/error_information'
description: The ServiceRegistrationInfo is not accepted
- content:
- text/plain;charset=ISO-8859-1:
- schema:
- type: string
- example: Missing mandatory parameter 'serviceName'
- 404:
+ '401':
+ description: Unauthorized
+ '403':
+ description: Forbidden
+ '404':
description: Not Found
- deprecated: false
- x-codegen-request-body-name: registrationInfo
+ parameters:
+ - schema:
+ $ref: '#/definitions/service_registration_info_v2'
+ in: body
+ name: registrationInfo
+ description: registrationInfo
+ required: true
+ tags:
+ - A1 Policy Management Version 2.0 (in progress)
+ consumes:
+ - application/json
/services:
get:
- tags:
- - Service registry and supervision
summary: Returns service information
- operationId: getServicesUsingGET
- parameters:
- - name: name
- in: query
- description: The name of the service
- allowEmptyValue: false
- schema:
- type: string
- example: 'service1'
+ deprecated: false
+ produces:
+ - '*/*'
+ operationId: getServicesUsingGET_1
responses:
- 200:
+ '200':
+ schema:
+ type: array
+ items:
+ $ref: '#/definitions/service_status_v1'
description: OK
- content:
- text/plain;charset=ISO-8859-1:
- schema:
- type: array
- example:
- - serviceName: "service1"
- keepAliveIntervalSeconds: 1000
- timeSinceLastActivitySeconds: 7
- callbackUrl: http://localhost:8080
- items:
- $ref: '#/components/schemas/ServiceStatus'
- 404:
+ '401':
+ description: Unauthorized
+ '403':
+ description: Forbidden
+ '404':
+ schema:
+ type: string
description: Service is not found
- content:
- text/plain;charset=ISO-8859-1:
- schema:
- type: string
- example: Service not found
- deprecated: false
- delete:
+ parameters:
+ - in: query
+ allowEmptyValue: false
+ name: name
+ description: The name of the service
+ type: string
+ required: false
tags:
- - Service registry and supervision
+ - A1 Policy Management Version 1.0
+ delete:
summary: Delete a service
- operationId: deleteServiceUsingDELETE
- parameters:
- - name: name
- in: query
- description: The name of the service
- required: true
- allowEmptyValue: false
- schema:
- type: string
- example: 'service1'
+ deprecated: false
+ produces:
+ - '*/*'
+ operationId: deleteServiceUsingDELETE_1
responses:
- 200:
- description: OK
- 204:
+ '200':
+ schema:
+ type: string
description: OK
- 404:
+ '204':
+ schema:
+ type: string
+ description: Service deleted
+ '401':
+ description: Unauthorized
+ '403':
+ description: Forbidden
+ '404':
+ schema:
+ type: string
description: Service not found
- content:
- text/plain;charset=ISO-8859-1:
- schema:
- type: string
- example: 'Could not find service: service1'
+ parameters:
+ - in: query
+ allowEmptyValue: false
+ name: name
+ description: The name of the service
+ type: string
+ required: true
+ tags:
+ - A1 Policy Management Version 1.0
+ /ric:
+ get:
+ summary: Returns the name of a RIC managing one Mananged Element
deprecated: false
+ produces:
+ - '*/*'
+ operationId: getRicUsingGET
+ responses:
+ '200':
+ schema:
+ type: string
+ description: Near-RT RIC is found
+ '401':
+ description: Unauthorized
+ '403':
+ description: Forbidden
+ '404':
+ schema:
+ type: string
+ description: Near-RT RIC is not found
+ parameters:
+ - in: query
+ allowEmptyValue: false
+ name: managedElementId
+ description: The identity of the Managed Element
+ type: string
+ required: true
+ tags:
+ - A1 Policy Management Version 1.0
/services/keepalive:
put:
+ summary: Heartbeat from a service
+ deprecated: false
+ produces:
+ - '*/*'
+ operationId: keepAliveServiceUsingPUT_1
+ responses:
+ '200':
+ schema:
+ type: string
+ description: 'Service supervision timer refreshed, OK'
+ '201':
+ description: Created
+ '401':
+ description: Unauthorized
+ '403':
+ description: Forbidden
+ '404':
+ description: 'The service is not found, needs re-registration'
+ parameters:
+ - in: query
+ allowEmptyValue: false
+ name: name
+ description: The name of the service
+ type: string
+ required: true
tags:
- - Service registry and supervision
- summary: Heartbeat from a serice
+ - A1 Policy Management Version 1.0
+ consumes:
+ - application/json
+ /v2/services/keepalive:
+ put:
+ summary: Heartbeat indicates that the service is running
+ deprecated: false
+ produces:
+ - '*/*'
operationId: keepAliveServiceUsingPUT
- parameters:
- - name: name
- in: query
- description: The name of the service
- required: true
- allowEmptyValue: false
- schema:
- type: string
- example: 'service1'
responses:
- 200:
- description: Service supervision timer refreshed, OK
- content:
- text/plain;charset=ISO-8859-1:
- schema:
- type: string
- example: OK
- 201:
+ '200':
+ schema:
+ type: object
+ description: 'Service supervision timer refreshed, OK'
+ '201':
description: Created
- 404:
- description: The service is not found, needs re-registration
- content:
- text/plain;charset=ISO-8859-1:
- schema:
- type: string
- example: 'Could not find service: service1'
+ '401':
+ description: Unauthorized
+ '403':
+ description: Forbidden
+ '404':
+ schema:
+ $ref: '#/definitions/error_information'
+ description: 'The service is not found, needs re-registration'
+ parameters:
+ - in: query
+ allowEmptyValue: false
+ name: service_id
+ description: The identity of the service
+ type: string
+ required: true
+ tags:
+ - A1 Policy Management Version 2.0 (in progress)
+ consumes:
+ - application/json
+ /v2/policy-schemas:
+ get:
+ summary: Returns policy type schema definitions
deprecated: false
- /status:
+ produces:
+ - application/json
+ operationId: getPolicySchemasUsingGET
+ responses:
+ '200':
+ schema:
+ $ref: '#/definitions/policy_schema_list_v2'
+ description: Policy schemas
+ '401':
+ description: Unauthorized
+ '403':
+ description: Forbidden
+ '404':
+ schema:
+ $ref: '#/definitions/error_information'
+ description: Near-RT RIC is not found
+ parameters:
+ - in: query
+ allowEmptyValue: false
+ name: policytype_id
+ description: 'The identity of the policy type to get the definition for. When this parameter is given, max one schema will be returned'
+ type: string
+ required: true
+ - in: query
+ allowEmptyValue: false
+ name: ric_id
+ description: The identity of the Near-RT RIC to get the definitions for.
+ type: string
+ required: false
+ tags:
+ - A1 Policy Management Version 2.0 (in progress)
+ /v2/ric:
get:
+ summary: Returns info for a Near-RT RIC
+ deprecated: false
+ produces:
+ - application/json
+ description: 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).
+ operationId: getRicUsingGET_1
+ responses:
+ '200':
+ schema:
+ $ref: '#/definitions/ric_info_v2'
+ description: Near-RT RIC is found
+ '401':
+ description: Unauthorized
+ '403':
+ description: Forbidden
+ '404':
+ schema:
+ $ref: '#/definitions/error_information'
+ description: Near-RT RIC is not found
+ parameters:
+ - in: query
+ allowEmptyValue: false
+ name: managed_element_id
+ description: 'The identity of a Managed Element. If given, the Near-RT RIC managing the ME is returned.'
+ type: string
+ required: false
+ - in: query
+ allowEmptyValue: false
+ name: ric_id
+ description: The identity of a Near-RT RIC to get information for.
+ type: string
+ required: false
+ tags:
+ - A1 Policy Management Version 2.0 (in progress)
+ /policy:
+ get:
+ summary: Returns a policy configuration
+ deprecated: false
+ produces:
+ - '*/*'
+ operationId: getPolicyUsingGET_1
+ responses:
+ '200':
+ schema:
+ type: object
+ description: Policy found
+ '401':
+ description: Unauthorized
+ '403':
+ description: Forbidden
+ '404':
+ description: Policy is not found
+ parameters:
+ - in: query
+ allowEmptyValue: false
+ name: id
+ description: The identity of the policy instance.
+ type: string
+ required: true
+ tags:
+ - A1 Policy Management Version 1.0
+ delete:
+ summary: Delete a policy
+ deprecated: false
+ produces:
+ - '*/*'
+ operationId: deletePolicyUsingDELETE_1
+ responses:
+ '200':
+ description: Not used
+ '204':
+ description: Policy deleted
+ '401':
+ description: Unauthorized
+ '403':
+ description: Forbidden
+ '404':
+ schema:
+ type: string
+ description: Policy is not found
+ '423':
+ schema:
+ type: string
+ description: Near-RT RIC is not operational
+ parameters:
+ - in: query
+ allowEmptyValue: false
+ name: id
+ description: The identity of the policy instance.
+ type: string
+ required: true
+ tags:
+ - A1 Policy Management Version 1.0
+ put:
+ summary: Put a policy
+ deprecated: false
+ produces:
+ - '*/*'
+ operationId: putPolicyUsingPUT_1
+ responses:
+ '200':
+ description: Policy updated
+ '201':
+ description: Policy created
+ '401':
+ description: Unauthorized
+ '403':
+ description: Forbidden
+ '404':
+ schema:
+ type: string
+ description: Near-RT RIC or policy type is not found
+ '423':
+ schema:
+ type: string
+ description: Near-RT RIC is not operational
+ parameters:
+ - in: query
+ allowEmptyValue: false
+ name: id
+ description: The identity of the policy instance.
+ type: string
+ required: true
+ - schema:
+ type: object
+ in: body
+ name: jsonBody
+ description: jsonBody
+ required: true
+ - in: query
+ allowEmptyValue: false
+ name: ric
+ description: The name of the Near-RT RIC where the policy will be created.
+ type: string
+ required: true
+ - in: query
+ allowEmptyValue: false
+ name: service
+ description: The name of the service creating the policy.
+ type: string
+ required: true
+ - default: false
+ in: query
+ allowEmptyValue: false
+ name: transient
+ x-example: 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.
+ type: boolean
+ required: false
+ - in: query
+ allowEmptyValue: false
+ name: type
+ description: The name of the policy type.
+ type: string
+ required: false
tags:
- - Health check
+ - A1 Policy Management Version 1.0
+ consumes:
+ - application/json
+ /status:
+ get:
summary: Returns status and statistics of this service
+ deprecated: false
+ produces:
+ - '*/*'
operationId: getStatusUsingGET
responses:
- 200:
+ '200':
+ schema:
+ type: string
description: Service is living
- content:
- '*/*':
- schema:
- type: string
- example: alive
- 404:
+ '401':
+ description: Unauthorized
+ '403':
+ description: Forbidden
+ '404':
description: Not Found
+ tags:
+ - A1 Policy Management Version 1.0
+ /v2/policy-ids:
+ get:
+ summary: 'Query policies, only policy identities are returned'
deprecated: false
-components:
- schemas:
- PolicyInfo:
- title: PolicyInfo
- type: object
- properties:
- id:
- type: string
- description: identity of the policy
- json:
- type: object
- properties: {}
- description: the configuration of the policy
- lastModified:
- type: string
- description: timestamp, last modification time
- ric:
- type: string
- description: identity of the target Near-RT RIC
- service:
- type: string
- description: the name of the service owning the policy
- type:
- type: string
- description: name of the policy type
- RicInfo:
- title: RicInfo
- type: object
- properties:
- managedElementIds:
- type: array
- description: O1 identities for managed entities
- items:
+ produces:
+ - application/json
+ description: 'Returns a list of A1 policies matching given search criteria. <br>If several query parameters are defined, the policies matching all conditions are returned.'
+ operationId: getPolicyIdsUsingGET
+ responses:
+ '200':
+ schema:
+ $ref: '#/definitions/policy_id_list_v2'
+ description: Policy identities
+ '401':
+ description: Unauthorized
+ '403':
+ description: Forbidden
+ '404':
+ schema:
+ $ref: '#/definitions/error_information'
+ description: Near-RT RIC or type not found
+ parameters:
+ - in: query
+ allowEmptyValue: false
+ name: policytype_id
+ description: The identity of the policy type to get policies for.
+ type: string
+ required: false
+ - in: query
+ allowEmptyValue: false
+ name: ric_id
+ description: The identity of the Near-RT RIC to get policies for.
+ type: string
+ required: false
+ - in: query
+ allowEmptyValue: false
+ name: service_id
+ description: The identity of the service to get policies for.
+ type: string
+ required: false
+ tags:
+ - A1 Policy Management Version 2.0 (in progress)
+ /policies:
+ get:
+ summary: Query policies
+ deprecated: false
+ produces:
+ - '*/*'
+ operationId: getPoliciesUsingGET_1
+ responses:
+ '200':
+ schema:
+ type: array
+ items:
+ $ref: '#/definitions/policy_info_v1'
+ description: Policies
+ '401':
+ description: Unauthorized
+ '403':
+ description: Forbidden
+ '404':
+ schema:
type: string
- policyTypes:
- type: array
- description: supported policy types
- items:
+ description: Near-RT RIC or type not found
+ parameters:
+ - in: query
+ allowEmptyValue: false
+ name: ric
+ description: The name of the Near-RT RIC to get policies for.
+ type: string
+ required: false
+ - in: query
+ allowEmptyValue: false
+ name: service
+ description: The name of the service to get policies for.
+ type: string
+ required: false
+ - in: query
+ allowEmptyValue: false
+ name: type
+ description: The name of the policy type to get policies for.
+ type: string
+ required: false
+ tags:
+ - A1 Policy Management Version 1.0
+ /v2/policy-status:
+ get:
+ summary: Returns a policy status
+ deprecated: false
+ produces:
+ - application/json
+ operationId: getPolicyStatusUsingGET
+ responses:
+ '200':
+ schema:
+ $ref: '#/definitions/json_object'
+ description: Policy status
+ '401':
+ description: Unauthorized
+ '403':
+ description: Forbidden
+ '404':
+ schema:
+ $ref: '#/definitions/error_information'
+ description: Policy is not found
+ parameters:
+ - in: query
+ allowEmptyValue: false
+ name: policy_id
+ description: The identity of the policy.
+ type: string
+ required: true
+ tags:
+ - A1 Policy Management Version 2.0 (in progress)
+ /policy_schema:
+ get:
+ summary: Returns one policy type schema definition
+ deprecated: false
+ produces:
+ - '*/*'
+ operationId: getPolicySchemaUsingGET
+ responses:
+ '200':
+ schema:
+ type: object
+ description: Policy schema
+ '401':
+ description: Unauthorized
+ '403':
+ description: Forbidden
+ '404':
+ schema:
type: string
- ricName:
- type: string
- description: identity of the ric
- state:
- type: string
- description: state info
- example:
- - ricName: ric1
- managedElementIds:
- - ME-1
- - ME-2
- policyTypes:
- - '1'
- state: AVAILABLE
- - ricName: ric3
- managedElementIds:
- - ME-1
- - ME-2
- policyTypes:
- - ''
- state: AVAILABLE
- - ricName: ric2
- managedElementIds:
- - ME-1
- - ME-2
- policyTypes: []
- state: AVAILABLE
- - ricName: ric4
- managedElementIds:
- - ME-1
- - ME-2
- policyTypes:
- - ''
- state: AVAILABLE
- ServiceRegistrationInfo:
- title: ServiceRegistrationInfo
- required:
- - serviceName
- type: object
- properties:
- callbackUrl:
- type: string
- description: callback for notifying of RIC synchronization
- keepAliveIntervalSeconds:
- type: integer
- 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.
- format: int64
- serviceName:
- type: string
- description: identity of the service
- example:
- callbackUrl: http://localhost:9080
- keepAliveIntervalSeconds: 1000
- serviceName: service1
- ServiceStatus:
- title: ServiceStatus
- type: object
- properties:
- callbackUrl:
- type: string
- description: callback for notifying of RIC synchronization
- keepAliveIntervalSeconds:
- type: integer
- description: policy keep alive timeout
- format: int64
- serviceName:
- type: string
- description: identity of the service
- timeSinceLastActivitySeconds:
- type: integer
- description: time since last invocation by the service
- format: int64
- examples:
- Policies-STD:
- value:
- - id: a986eb38-aac3-4897-bdf5-0333ea2bf730
- type: ''
- ric: ric3
- json:
- scope:
- ueId: ue1
- groupId: group1
- sliceId: slice1
- qosId: qos1
- cellId: cell1
- statement:
- priorityLevel: 5
- service: controlpanel
- lastModified: '2020-07-22T12:21:48.157854Z'
- Policies-OSC:
- value:
- - id: 73428e58-1670-4972-8498-e7e8f1003631
- type: '1'
- ric: ric1
- json:
- scope:
- qosId: '36'
- ueId: '1'
- statement:
- priorityLevel: 1
- service: c
- lastModified: '2020-07-20T17:16:18.244383Z'
- - id: 73428e58-1670-4972-8498-e7e8f100363e
- type: '1'
- ric: ric1
- json:
- scope:
- qosId: '34'
- ueId: '1'
- statement:
- priorityLevel: 1
- service: controlpanel
- lastModified: '2020-07-20T17:15:39.320469Z'
- Policy-STD:
- value:
- scope:
- ueId: ue1
- groupId: group1
- sliceId: slice1
- qosId: qos1
- cellId: cell1
- statement:
- priorityLevel: 5
- Policy-OSC:
- value:
- scope:
- qosId: '36'
- ueId: '1'
- statement:
- priorityLevel: 1 \ No newline at end of file
+ description: The policy type is not found
+ parameters:
+ - in: query
+ allowEmptyValue: false
+ name: id
+ description: The identity of the policy type to get the definition for.
+ type: string
+ required: true
+ tags:
+ - A1 Policy Management Version 1.0
+ /rics:
+ get:
+ summary: Query Near-RT RIC information
+ deprecated: false
+ produces:
+ - '*/*'
+ operationId: getRicsUsingGET
+ responses:
+ '200':
+ schema:
+ type: array
+ items:
+ $ref: '#/definitions/ric_info_v1'
+ description: OK
+ '401':
+ description: Unauthorized
+ '403':
+ description: Forbidden
+ '404':
+ schema:
+ type: string
+ description: Policy type is not found
+ parameters:
+ - in: query
+ allowEmptyValue: false
+ name: policyType
+ description: The name of the policy type
+ type: string
+ required: false
+ tags:
+ - A1 Policy Management Version 1.0
+ /service:
+ put:
+ summary: Register a service
+ deprecated: false
+ produces:
+ - '*/*'
+ operationId: putServiceUsingPUT_1
+ responses:
+ '200':
+ schema:
+ type: string
+ description: Service updated
+ '201':
+ schema:
+ type: string
+ description: Service created
+ '400':
+ schema:
+ type: string
+ description: The ServiceRegistrationInfo is not accepted
+ '401':
+ description: Unauthorized
+ '403':
+ description: Forbidden
+ '404':
+ description: Not Found
+ parameters:
+ - schema:
+ $ref: '#/definitions/service_registration_info_v1'
+ in: body
+ name: registrationInfo
+ description: registrationInfo
+ required: true
+ tags:
+ - A1 Policy Management Version 1.0
+ consumes:
+ - application/json
+ /v2/policies:
+ get:
+ summary: Query for existing A1 policies
+ deprecated: false
+ produces:
+ - application/json
+ description: 'Returns a list of A1 policies matching given search criteria. <br>If several query parameters are defined, the policies matching all conditions are returned.'
+ operationId: getPoliciesUsingGET
+ responses:
+ '200':
+ schema:
+ $ref: '#/definitions/policy_info_list_v2'
+ description: Policies
+ '401':
+ description: Unauthorized
+ '403':
+ description: Forbidden
+ '404':
+ schema:
+ $ref: '#/definitions/error_information'
+ description: 'Near-RT RIC, policy type or service not found'
+ parameters:
+ - in: query
+ allowEmptyValue: false
+ name: policytype_id
+ description: The identity of the policy type to get policies for.
+ type: string
+ required: false
+ - in: query
+ allowEmptyValue: false
+ name: ric_id
+ description: The identity of the Near-RT RIC to get policies for.
+ type: string
+ required: false
+ - in: query
+ allowEmptyValue: false
+ name: service_id
+ description: The identity of the service to get policies for.
+ type: string
+ required: false
+ tags:
+ - A1 Policy Management Version 2.0 (in progress)
+ /policy_status:
+ get:
+ summary: Returns a policy status
+ deprecated: false
+ produces:
+ - '*/*'
+ operationId: getPolicyStatusUsingGET_1
+ responses:
+ '200':
+ schema:
+ type: object
+ description: Policy status
+ '401':
+ description: Unauthorized
+ '403':
+ description: Forbidden
+ '404':
+ schema:
+ type: string
+ description: Policy is not found
+ parameters:
+ - in: query
+ allowEmptyValue: false
+ name: id
+ description: The identity of the policy.
+ type: string
+ required: true
+ tags:
+ - A1 Policy Management Version 1.0
+ /v2/rics:
+ get:
+ summary: Query Near-RT RIC information
+ deprecated: false
+ produces:
+ - application/json
+ description: The call returns all Near-RT RICs that supports a given policy type identity
+ operationId: getRicsUsingGET_1
+ responses:
+ '200':
+ schema:
+ $ref: '#/definitions/ric_info_list_v2'
+ description: OK
+ '401':
+ description: Unauthorized
+ '403':
+ description: Forbidden
+ '404':
+ schema:
+ $ref: '#/definitions/error_information'
+ description: Policy type is not found
+ parameters:
+ - in: query
+ allowEmptyValue: false
+ name: policytype_id
+ description: 'The identity of a policy type. If given, all Near-RT RICs supporteing the policy type are returned'
+ type: string
+ required: false
+ tags:
+ - A1 Policy Management Version 2.0 (in progress)
+host: 'localhost:41437'
+definitions:
+ error_information:
+ description: 'Problem as defined in https://tools.ietf.org/html/rfc7807'
+ type: object
+ title: error_information
+ properties:
+ detail:
+ description: ' A human-readable explanation specific to this occurrence of the problem.'
+ type: string
+ example: Policy type not found
+ status:
+ format: int32
+ description: 'The HTTP status code generated by the origin server for this occurrence of the problem. '
+ type: integer
+ example: 503
+ void:
+ description: Void/empty
+ type: object
+ title: void
+ status_info_v2:
+ type: object
+ title: status_info_v2
+ properties:
+ status:
+ description: status text
+ type: string
+ policy_info_v1:
+ type: object
+ title: policy_info_v1
+ properties:
+ service:
+ description: the name of the service owning the policy
+ type: string
+ json:
+ description: the configuration of the policy
+ type: object
+ id:
+ description: identity of the policy
+ type: string
+ lastModified:
+ description: 'timestamp, last modification time'
+ type: string
+ type:
+ description: name of the policy type
+ type: string
+ ric:
+ description: identity of the target Near-RT RIC
+ type: string
+ policy_schema_list_v2:
+ description: Policy type json schemas
+ type: object
+ title: policy_schema_list_v2
+ properties:
+ policy_schemas:
+ description: 'Policy type json schemas. The schema is a json object following http://json-schema.org/draft-07/schema'
+ type: array
+ items:
+ type: object
+ Mono«ResponseEntity«object»»:
+ type: object
+ title: Mono«ResponseEntity«object»»
+ ric_info_v2:
+ description: Information for a Near-RT RIC
+ type: object
+ title: ric_info_v2
+ properties:
+ ric_id:
+ description: identity of the Near-RT RIC
+ type: string
+ managed_element_ids:
+ description: O1 identities for managed entities
+ type: array
+ items:
+ type: string
+ state:
+ description: |-
+ State for the Near-RT RIC, values:
+ UNAVAILABLE: The Near-RT RIC is not avialable, information may be inconsistent
+ AVAILABLE: The normal state. Policies can be configured. +
+ SYNCHRONIZING: The Policy Management Service is synchronizing the view of the Near-RT RIC. Policies cannot be configured.
+ CONSISTENCY_CHECK: A consistency check between the Policy Management Service and the Near-RT RIC. Policies cannot be configured.
+ type: string
+ enum:
+ - UNAVAILABLE
+ - AVAILABLE
+ - SYNCHRONIZING
+ - CONSISTENCY_CHECK
+ policy_type_ids:
+ description: supported policy types
+ type: array
+ items:
+ type: string
+ service_registration_info_v1:
+ type: object
+ title: service_registration_info_v1
+ properties:
+ keepAliveIntervalSeconds:
+ format: int64
+ 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.'
+ type: integer
+ callbackUrl:
+ description: callback for notifying of RIC synchronization
+ type: string
+ serviceName:
+ type: string
+ policy_info_list_v2:
+ description: List of policy information
+ type: object
+ title: policy_info_list_v2
+ properties:
+ policies:
+ description: List of policy information
+ type: array
+ items:
+ $ref: '#/definitions/policy_info_v2'
+ service_registration_info_v2:
+ description: Information for one service
+ type: object
+ title: service_registration_info_v2
+ required:
+ - service_id
+ properties:
+ callback_url:
+ description: callback for notifying of RIC synchronization
+ type: string
+ service_id:
+ description: identity of the service
+ type: string
+ keep_alive_interval_seconds:
+ format: int64
+ 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.'
+ type: integer
+ ric_info_v1:
+ type: object
+ title: ric_info_v1
+ properties:
+ managedElementIds:
+ description: O1 identities for managed entities
+ type: array
+ items:
+ type: string
+ policyTypes:
+ description: supported policy types
+ type: array
+ items:
+ type: string
+ state:
+ description: state info
+ type: string
+ ricName:
+ description: identity of the Near-RT RIC
+ type: string
+ policy_type_id_list_v2:
+ description: Information about policy types
+ type: object
+ title: policy_type_id_list_v2
+ properties:
+ policy_type_ids:
+ description: Policy type identities
+ type: array
+ items:
+ type: string
+ service_status_v1:
+ type: object
+ title: service_status_v1
+ properties:
+ keepAliveIntervalSeconds:
+ format: int64
+ description: policy keep alive timeout
+ type: integer
+ callbackUrl:
+ description: callback for notifying of RIC synchronization
+ type: string
+ timeSinceLastActivitySeconds:
+ format: int64
+ description: time since last invocation by the service
+ type: integer
+ serviceName:
+ description: identity of the service
+ type: string
+ service_status_v2:
+ type: object
+ title: service_status_v2
+ properties:
+ callback_url:
+ description: callback for notifying of RIC synchronization
+ type: string
+ service_id:
+ description: identity of the service
+ type: string
+ keep_alive_interval_seconds:
+ format: int64
+ description: policy keep alive timeout
+ type: integer
+ time_since_last_activity_seconds:
+ format: int64
+ description: time since last invocation by the service
+ type: integer
+ ric_info_list_v2:
+ description: List of Near-RT RIC information
+ type: object
+ title: ric_info_list_v2
+ properties:
+ rics:
+ description: List of Near-RT RIC information
+ type: array
+ items:
+ $ref: '#/definitions/ric_info_v2'
+ policy_id_list_v2:
+ description: A list of policy identities
+ type: object
+ title: policy_id_list_v2
+ properties:
+ policy_ids:
+ description: Policy identities
+ type: array
+ items:
+ type: string
+ policy_info_v2:
+ description: Information for one A1-P Policy
+ type: object
+ title: policy_info_v2
+ properties:
+ ric_id:
+ description: identity of the target Near-RT RIC
+ type: string
+ policy_id:
+ description: identity of the policy
+ type: string
+ service_id:
+ description: the name of the service owning the policy
+ type: string
+ policy_data:
+ description: the configuration of the policy
+ type: object
+ last_modified:
+ description: 'timestamp, last modification time'
+ type: string
+ policy_type_id:
+ description: name of the policy type
+ type: string
+ json_object:
+ description: A JSON object defining the configuration of the policy. The schema is defined by the Policy Type.
+ type: object
+ title: json_object
+ service_list_v2:
+ description: List of service information
+ type: object
+ title: service_list_v2
+ properties:
+ service_list:
+ description: List of service information
+ type: array
+ items:
+ $ref: '#/definitions/service_status_v2'
+ Mono«ResponseEntity«string»»:
+ type: object
+ title: Mono«ResponseEntity«string»»
+swagger: '2.0'
+info:
+ x-audience: external-partner
+ x-api-id: 60f9a0e7-343f-43bf-9194-d8d65688d465
+ contact:
+ name: Ericsson Software Technology
+ email: nonrtric@est.tech
+ description: |-
+ The O-RAN Non-RT RIC Policy Management Service provides a REST API for management of A1 policices.
+ 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>
+ title: A1 Policy management service
+ version: 1.1.0
+tags:
+ - name: A1 Policy Management Version 1.0
+ description: Policy Controller
+ - name: A1 Policy Management Version 2.0 (in progress)
+ description: Policy Controller
+