summaryrefslogtreecommitdiffstats
path: root/a1-policy-management/src/main/java
diff options
context:
space:
mode:
authorecaiyanlinux <martin.c.yan@est.tech>2020-10-27 20:40:57 +0100
committerecaiyanlinux <martin.c.yan@est.tech>2020-10-28 12:32:16 +0100
commit988f2af648a069ae86a4d9fc9499b80716ca8443 (patch)
treedc956a54fc74969362b3b76e8c411a55b91d932d /a1-policy-management/src/main/java
parentc655306c67fd9ed6b95d6b111f7bedab79c02f44 (diff)
Remove code for sdnc onap controller
sdnc onap controller is dismissed rename SdncOscA1Client to CcsdkA1AdapterClient rename SdncJsonHelper to A1AdapterJsonHelper update comments accordingly Signed-off-by: ecaiyanlinux <martin.c.yan@est.tech> Issue-ID: CCSDK-2502 Change-Id: If525dab599f9fd28203e85dcd57c010c67e20a8b
Diffstat (limited to 'a1-policy-management/src/main/java')
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1AdapterJsonHelper.java (renamed from a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/SdncJsonHelper.java)6
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1Client.java7
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientFactory.java11
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/CcsdkA1AdapterClient.java (renamed from a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/SdncOscA1Client.java)64
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/OscA1Client.java4
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/SdncOnapA1Client.java194
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientVersion1.java2
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/StdA1ClientVersion2.java4
8 files changed, 47 insertions, 245 deletions
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/SdncJsonHelper.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1AdapterJsonHelper.java
index ada35fd6..c72f196a 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/SdncJsonHelper.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1AdapterJsonHelper.java
@@ -40,17 +40,17 @@ import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
/**
- * Common json functionality used by the SDNC clients
+ * Common json functionality used by the CCSDK A1 Adapter clients
*/
@SuppressWarnings("java:S1192") // Same text in several traces
-class SdncJsonHelper {
+class A1AdapterJsonHelper {
private static Gson gson = new GsonBuilder() //
.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_DASHES) //
.create();
private static final String OUTPUT = "output";
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
- private SdncJsonHelper() {}
+ private A1AdapterJsonHelper() {}
public static Flux<String> parseJsonArrayOfString(String inputString) {
try {
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 4321ed48..5e498e4b 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
@@ -38,10 +38,9 @@ public interface A1Client {
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
+ CCSDK_A1_ADAPTER_STD_V1_1, // CCSDK_A1_ADAPTER with STD A1 version 1.1 southbound
+ CCSDK_A1_ADAPTER_STD_V2_0_0, // CCSDK_A1_ADAPTER with STD A1 version 2.0.0 southbound
+ CCSDK_A1_ADAPTER_OSC_V1 // CCSDK_A1_ADAPTER with OSC 'A1' southbound
}
public Mono<A1ProtocolType> getProtocolVersion();
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 66ba60c0..0ca3a45d 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
@@ -79,11 +79,9 @@ public class A1ClientFactory {
} 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
- || 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);
+ } else if (version == A1ProtocolType.CCSDK_A1_ADAPTER_STD_V1_1 || version == A1ProtocolType.CCSDK_A1_ADAPTER_OSC_V1
+ || version == A1ProtocolType.CCSDK_A1_ADAPTER_STD_V2_0_0) {
+ return new CcsdkA1AdapterClient(version, ric.getConfig(), getControllerConfig(ric), this.restClientFactory);
} else {
logger.error("Unhandled protocol: {}", version);
throw new ServiceException("Unhandled protocol");
@@ -125,8 +123,7 @@ public class A1ClientFactory {
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)) //
+ .onErrorResume(notUsed -> fetchVersion(ric, A1ProtocolType.CCSDK_A1_ADAPTER_STD_V1_1)) //
.doOnNext(ric::setProtocolVersion)
.doOnNext(version -> logger.debug("Established protocol version:{} for Near-RT RIC: {}", version,
ric.id())) //
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/CcsdkA1AdapterClient.java
index 88859d37..3b581b63 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/CcsdkA1AdapterClient.java
@@ -43,10 +43,10 @@ import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
/**
- * Client for accessing the A1 adapter in the SDNC controller in OSC.
+ * Client for accessing the A1 adapter in the CCSDK in ONAP.
*/
@SuppressWarnings("squid:S2629") // Invoke method(s) only conditionally
-public class SdncOscA1Client implements A1Client {
+public class CcsdkA1AdapterClient implements A1Client {
static final int CONCURRENCY_RIC = 1; // How many paralell requests that is sent to one NearRT RIC
@@ -81,15 +81,15 @@ 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, SDNC_OSC_OSC_V1 and
- * SDNC_OSC_STD_V2_0_0 with
+ * protocols are CCSDK_A1_ADAPTER_STD_V1_1, CCSDK_A1_ADAPTER_OSC_V1 and
+ * CCSDK_A1_ADAPTER_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 controllerConfig the configuration of the CCSDK A1 Adapter to use
*
* @throws IllegalArgumentException when the protocolType is wrong.
*/
- public SdncOscA1Client(A1ProtocolType protocolType, RicConfig ricConfig, ControllerConfig controllerConfig,
+ public CcsdkA1AdapterClient(A1ProtocolType protocolType, RicConfig ricConfig, ControllerConfig controllerConfig,
AsyncRestClientFactory restClientFactory) {
this(protocolType, ricConfig, controllerConfig,
restClientFactory.createRestClient(controllerConfig.baseUrl() + "/restconf/operations"));
@@ -99,25 +99,25 @@ public class SdncOscA1Client implements A1Client {
* 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, SDNC_OSC_OSC_V1 and
- * SDNC_OSC_STD_V2_0_0 with
+ * protocols are CCSDK_A1_ADAPTER_STD_V1_1, CCSDK_A1_ADAPTER_OSC_V1 and
+ * CCSDK_A1_ADAPTER_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 controllerConfig the configuration of the CCSDK A1 Adapter to use
* @param restClient the REST client to use
*
* @throws IllegalArgumentException when the protocolType is illegal.
*/
- public SdncOscA1Client(A1ProtocolType protocolType, RicConfig ricConfig, ControllerConfig controllerConfig,
+ public CcsdkA1AdapterClient(A1ProtocolType protocolType, RicConfig ricConfig, ControllerConfig controllerConfig,
AsyncRestClient restClient) {
- 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)) {
+ if (A1ProtocolType.CCSDK_A1_ADAPTER_STD_V1_1.equals(protocolType) //
+ || A1ProtocolType.CCSDK_A1_ADAPTER_OSC_V1.equals(protocolType) //
+ || A1ProtocolType.CCSDK_A1_ADAPTER_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);
+ logger.debug("CcsdkA1AdapterClient for ric: {}, a1Controller: {}", ricConfig.ricId(), controllerConfig);
} else {
throw new IllegalArgumentException("Not handeled protocolversion: " + protocolType);
}
@@ -126,11 +126,11 @@ public class SdncOscA1Client implements A1Client {
@Override
public Mono<List<String>> getPolicyTypeIdentities() {
- if (this.protocolType == A1ProtocolType.SDNC_OSC_STD_V1_1) {
+ if (this.protocolType == A1ProtocolType.CCSDK_A1_ADAPTER_STD_V1_1) {
return Mono.just(Arrays.asList(""));
} else {
return post(GET_POLICY_RPC, getUriBuilder().createPolicyTypesUri(), Optional.empty()) //
- .flatMapMany(SdncJsonHelper::parseJsonArrayOfString) //
+ .flatMapMany(A1AdapterJsonHelper::parseJsonArrayOfString) //
.collectList();
}
@@ -144,7 +144,7 @@ public class SdncOscA1Client implements A1Client {
@Override
public Mono<String> getPolicyTypeSchema(String policyTypeId) {
- if (this.protocolType == A1ProtocolType.SDNC_OSC_STD_V1_1) {
+ if (this.protocolType == A1ProtocolType.CCSDK_A1_ADAPTER_STD_V1_1) {
return Mono.just("{}");
} else {
A1UriBuilder uri = this.getUriBuilder();
@@ -155,9 +155,9 @@ public class SdncOscA1Client implements A1Client {
}
private Mono<String> extractCreateSchema(String controllerResponse, String policyTypeId) {
- if (this.protocolType == A1ProtocolType.SDNC_OSC_OSC_V1) {
+ if (this.protocolType == A1ProtocolType.CCSDK_A1_ADAPTER_OSC_V1) {
return OscA1Client.extractCreateSchema(controllerResponse, policyTypeId);
- } else if (this.protocolType == A1ProtocolType.SDNC_OSC_STD_V2_0_0) {
+ } else if (this.protocolType == A1ProtocolType.CCSDK_A1_ADAPTER_STD_V2_0_0) {
return StdA1ClientVersion2.extractPolicySchema(controllerResponse, policyTypeId);
} else {
throw new NullPointerException("Not supported");
@@ -178,7 +178,7 @@ public class SdncOscA1Client implements A1Client {
@Override
public Flux<String> deleteAllPolicies() {
- if (this.protocolType == A1ProtocolType.SDNC_OSC_STD_V1_1) {
+ if (this.protocolType == A1ProtocolType.CCSDK_A1_ADAPTER_STD_V1_1) {
return getPolicyIds() //
.flatMap(policyId -> deletePolicyById("", policyId), CONCURRENCY_RIC); //
} else {
@@ -191,7 +191,7 @@ public class SdncOscA1Client implements A1Client {
private Flux<String> getInstancesForType(A1UriBuilder uriBuilder, String type) {
return post(GET_POLICY_RPC, uriBuilder.createGetPolicyIdsUri(type), Optional.empty()) //
- .flatMapMany(SdncJsonHelper::parseJsonArrayOfString);
+ .flatMapMany(A1AdapterJsonHelper::parseJsonArrayOfString);
}
private Flux<String> deleteAllInstancesForType(A1UriBuilder uriBuilder, String type) {
@@ -214,11 +214,11 @@ public class SdncOscA1Client implements A1Client {
}
private A1UriBuilder getUriBuilder() {
- if (protocolType == A1ProtocolType.SDNC_OSC_STD_V1_1) {
+ if (protocolType == A1ProtocolType.CCSDK_A1_ADAPTER_STD_V1_1) {
return new StdA1ClientVersion1.UriBuilder(ricConfig);
- } else if (protocolType == A1ProtocolType.SDNC_OSC_STD_V2_0_0) {
+ } else if (protocolType == A1ProtocolType.CCSDK_A1_ADAPTER_STD_V2_0_0) {
return new StdA1ClientVersion2.OranV2UriBuilder(ricConfig);
- } else if (protocolType == A1ProtocolType.SDNC_OSC_OSC_V1) {
+ } else if (protocolType == A1ProtocolType.CCSDK_A1_ADAPTER_OSC_V1) {
return new OscA1Client.UriBuilder(ricConfig);
}
throw new NullPointerException();
@@ -227,33 +227,33 @@ public class SdncOscA1Client implements A1Client {
private Mono<A1ProtocolType> tryOscProtocolVersion() {
OscA1Client.UriBuilder oscApiuriBuilder = new OscA1Client.UriBuilder(ricConfig);
return post(GET_POLICY_RPC, oscApiuriBuilder.createHealtcheckUri(), Optional.empty()) //
- .flatMap(x -> Mono.just(A1ProtocolType.SDNC_OSC_OSC_V1));
+ .flatMap(x -> Mono.just(A1ProtocolType.CCSDK_A1_ADAPTER_OSC_V1));
}
private Mono<A1ProtocolType> tryStdProtocolVersion1() {
StdA1ClientVersion1.UriBuilder uriBuilder = new StdA1ClientVersion1.UriBuilder(ricConfig);
return post(GET_POLICY_RPC, uriBuilder.createGetPolicyIdsUri(""), Optional.empty()) //
- .flatMap(x -> Mono.just(A1ProtocolType.SDNC_OSC_STD_V1_1));
+ .flatMap(x -> Mono.just(A1ProtocolType.CCSDK_A1_ADAPTER_STD_V1_1));
}
private Mono<A1ProtocolType> tryStdProtocolVersion2() {
StdA1ClientVersion2.OranV2UriBuilder uriBuilder = new StdA1ClientVersion2.OranV2UriBuilder(ricConfig);
return post(GET_POLICY_RPC, uriBuilder.createPolicyTypesUri(), Optional.empty()) //
- .flatMap(x -> Mono.just(A1ProtocolType.SDNC_OSC_STD_V2_0_0));
+ .flatMap(x -> Mono.just(A1ProtocolType.CCSDK_A1_ADAPTER_STD_V2_0_0));
}
private Flux<String> getPolicyIds() {
- if (this.protocolType == A1ProtocolType.SDNC_OSC_STD_V1_1) {
+ if (this.protocolType == A1ProtocolType.CCSDK_A1_ADAPTER_STD_V1_1) {
StdA1ClientVersion1.UriBuilder uri = new StdA1ClientVersion1.UriBuilder(ricConfig);
final String ricUrl = uri.createGetPolicyIdsUri("");
return post(GET_POLICY_RPC, ricUrl, Optional.empty()) //
- .flatMapMany(SdncJsonHelper::parseJsonArrayOfString);
+ .flatMapMany(A1AdapterJsonHelper::parseJsonArrayOfString);
} else {
A1UriBuilder uri = this.getUriBuilder();
return getPolicyTypeIdentities() //
.flatMapMany(Flux::fromIterable)
.flatMap(type -> post(GET_POLICY_RPC, uri.createGetPolicyIdsUri(type), Optional.empty())) //
- .flatMap(SdncJsonHelper::parseJsonArrayOfString);
+ .flatMap(A1AdapterJsonHelper::parseJsonArrayOfString);
}
}
@@ -267,7 +267,7 @@ public class SdncOscA1Client implements A1Client {
.nearRtRicUrl(ricUrl) //
.body(body) //
.build();
- final String inputJsonString = SdncJsonHelper.createInputJsonString(inputParams);
+ final String inputJsonString = A1AdapterJsonHelper.createInputJsonString(inputParams);
logger.debug("POST inputJsonString = {}", inputJsonString);
return restClient
@@ -294,7 +294,7 @@ public class SdncOscA1Client implements A1Client {
}
private Mono<String> extractResponseBody(String responseStr) {
- return SdncJsonHelper.getOutput(responseStr) //
+ return A1AdapterJsonHelper.getOutput(responseStr) //
.flatMap(this::extractResponse);
}
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 f54dc2e0..402a73b4 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
@@ -195,12 +195,12 @@ public class OscA1Client implements A1Client {
private Flux<String> getPolicyTypeIds() {
return restClient.get(uri.createPolicyTypesUri()) //
- .flatMapMany(SdncJsonHelper::parseJsonArrayOfString);
+ .flatMapMany(A1AdapterJsonHelper::parseJsonArrayOfString);
}
private Flux<String> getPolicyIdentitiesByType(String typeId) {
return restClient.get(uri.createGetPolicyIdsUri(typeId)) //
- .flatMapMany(SdncJsonHelper::parseJsonArrayOfString);
+ .flatMapMany(A1AdapterJsonHelper::parseJsonArrayOfString);
}
private Mono<String> deletePolicyById(String typeId, String policyId) {
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/SdncOnapA1Client.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/SdncOnapA1Client.java
deleted file mode 100644
index 68b0ab18..00000000
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/SdncOnapA1Client.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*-
- * ========================LICENSE_START=================================
- * ONAP : ccsdk oran
- * ======================================================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
- * ======================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ========================LICENSE_END===================================
- */
-
-package org.onap.ccsdk.oran.a1policymanagementservice.clients;
-
-import java.lang.invoke.MethodHandles;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Optional;
-
-import org.immutables.gson.Gson;
-import org.immutables.value.Value;
-import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ControllerConfig;
-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 the A1 adapter in the SDNC controller in ONAP
- */
-@SuppressWarnings("squid:S2629") // Invoke method(s) only conditionally
-public class SdncOnapA1Client implements A1Client {
- @Value.Immutable
- @Gson.TypeAdapters
- interface SdncOnapAdapterInput {
- public String nearRtRicId();
-
- public Optional<String> policyTypeId();
-
- public Optional<String> policyInstanceId();
-
- public Optional<String> policyInstance();
-
- public Optional<List<String>> properties();
- }
-
- private static final String URL_PREFIX = "/A1-ADAPTER-API:";
-
- private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-
- private final ControllerConfig controllerConfig;
- private final RicConfig ricConfig;
- private final AsyncRestClient restClient;
-
- public SdncOnapA1Client(RicConfig ricConfig, ControllerConfig controllerConfig,
- AsyncRestClientFactory restClientFactory) {
- this(ricConfig, controllerConfig,
- restClientFactory.createRestClient(controllerConfig.baseUrl() + "/restconf/operations"));
- logger.debug("SdncOnapA1Client for ric: {}, a1ControllerBaseUrl: {}", ricConfig.ricId(),
- controllerConfig.baseUrl());
- }
-
- public SdncOnapA1Client(RicConfig ricConfig, ControllerConfig controllerConfig, AsyncRestClient restClient) {
- this.ricConfig = ricConfig;
- this.controllerConfig = controllerConfig;
- this.restClient = restClient;
- }
-
- @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) {
- SdncOnapAdapterInput inputParams = ImmutableSdncOnapAdapterInput.builder() //
- .nearRtRicId(ricConfig.baseUrl()) //
- .policyTypeId(policyTypeId) //
- .build();
- String inputJsonString = SdncJsonHelper.createInputJsonString(inputParams);
- logger.debug("POST getPolicyType inputJsonString = {}", inputJsonString);
-
- return restClient
- .postWithAuthHeader(URL_PREFIX + "getPolicyType", inputJsonString, controllerConfig.userName(),
- controllerConfig.password()) //
- .flatMap(response -> SdncJsonHelper.getValueFromResponse(response, "policy-type")) //
- .flatMap(SdncJsonHelper::extractPolicySchema);
- }
-
- @Override
- public Mono<String> putPolicy(Policy policy) {
- SdncOnapAdapterInput inputParams = ImmutableSdncOnapAdapterInput.builder() //
- .nearRtRicId(ricConfig.baseUrl()) //
- .policyTypeId(policy.type().id()) //
- .policyInstanceId(policy.id()) //
- .policyInstance(policy.json()) //
- .properties(new ArrayList<>()) //
- .build();
-
- String inputJsonString = SdncJsonHelper.createInputJsonString(inputParams);
- logger.debug("POST putPolicy inputJsonString = {}", inputJsonString);
-
- return restClient.postWithAuthHeader(URL_PREFIX + "createPolicyInstance", inputJsonString,
- controllerConfig.userName(), controllerConfig.password());
- }
-
- @Override
- public Mono<String> deletePolicy(Policy policy) {
- return deletePolicyByTypeId(policy.type().id(), policy.id());
- }
-
- @Override
- public Flux<String> deleteAllPolicies() {
- return getPolicyTypeIds() //
- .flatMap(this::deletePoliciesForType); //
- }
-
- @Override
- public Mono<A1ProtocolType> getProtocolVersion() {
- return getPolicyTypeIdentities() //
- .flatMap(notUsed -> Mono.just(A1ProtocolType.SDNC_ONAP));
- }
-
- @Override
- public Mono<String> getPolicyStatus(Policy policy) {
- return Mono.error(new Exception("Status not implemented in the controller"));
- }
-
- private Flux<String> getPolicyTypeIds() {
- SdncOnapAdapterInput inputParams = ImmutableSdncOnapAdapterInput.builder() //
- .nearRtRicId(ricConfig.baseUrl()) //
- .build();
- String inputJsonString = SdncJsonHelper.createInputJsonString(inputParams);
- logger.debug("POST getPolicyTypeIdentities inputJsonString = {}", inputJsonString);
-
- return restClient
- .postWithAuthHeader(URL_PREFIX + "getPolicyTypes", inputJsonString, controllerConfig.userName(),
- controllerConfig.password()) //
- .flatMap(response -> SdncJsonHelper.getValueFromResponse(response, "policy-type-id-list")) //
- .flatMapMany(SdncJsonHelper::parseJsonArrayOfString);
- }
-
- private Flux<String> getPolicyIdentitiesByType(String policyTypeId) {
- SdncOnapAdapterInput inputParams = ImmutableSdncOnapAdapterInput.builder() //
- .nearRtRicId(ricConfig.baseUrl()) //
- .policyTypeId(policyTypeId) //
- .build();
- String inputJsonString = SdncJsonHelper.createInputJsonString(inputParams);
- logger.debug("POST getPolicyIdentities inputJsonString = {}", inputJsonString);
-
- return restClient
- .postWithAuthHeader(URL_PREFIX + "getPolicyInstances", inputJsonString, controllerConfig.userName(),
- controllerConfig.password()) //
- .flatMap(response -> SdncJsonHelper.getValueFromResponse(response, "policy-instance-id-list")) //
- .flatMapMany(SdncJsonHelper::parseJsonArrayOfString);
- }
-
- private Flux<String> deletePoliciesForType(String typeId) {
- return getPolicyIdentitiesByType(typeId) //
- .flatMap(policyId -> deletePolicyByTypeId(typeId, policyId)); //
- }
-
- private Mono<String> deletePolicyByTypeId(String policyTypeId, String policyId) {
- SdncOnapAdapterInput inputParams = ImmutableSdncOnapAdapterInput.builder() //
- .nearRtRicId(ricConfig.baseUrl()) //
- .policyTypeId(policyTypeId) //
- .policyInstanceId(policyId) //
- .build();
- String inputJsonString = SdncJsonHelper.createInputJsonString(inputParams);
- logger.debug("POST deletePolicy inputJsonString = {}", inputJsonString);
-
- return restClient.postWithAuthHeader(URL_PREFIX + "deletePolicyInstance", inputJsonString,
- controllerConfig.userName(), controllerConfig.password());
- }
-}
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 a1c5ac7a..ba18afea 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
@@ -151,7 +151,7 @@ public class StdA1ClientVersion1 implements A1Client {
private Flux<String> getPolicyIds() {
return restClient.get(uri.createGetPolicyIdsUri("")) //
- .flatMapMany(SdncJsonHelper::parseJsonArrayOfString);
+ .flatMapMany(A1AdapterJsonHelper::parseJsonArrayOfString);
}
private Mono<String> deletePolicyById(String policyId) {
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
index cdf35954..471b3c4d 100644
--- 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
@@ -200,12 +200,12 @@ public class StdA1ClientVersion2 implements A1Client {
private Flux<String> getPolicyTypeIds() {
return restClient.get(uriBuiler.createPolicyTypesUri()) //
- .flatMapMany(SdncJsonHelper::parseJsonArrayOfString);
+ .flatMapMany(A1AdapterJsonHelper::parseJsonArrayOfString);
}
private Flux<String> getPolicyIdentitiesByType(String typeId) {
return restClient.get(uriBuiler.createGetPolicyIdsUri(typeId)) //
- .flatMapMany(SdncJsonHelper::parseJsonArrayOfString);
+ .flatMapMany(A1AdapterJsonHelper::parseJsonArrayOfString);
}
private Mono<String> deletePolicyById(String typeId, String policyId) {