diff options
5 files changed, 44 insertions, 32 deletions
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 5f573140..87776c0f 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 @@ -108,9 +108,13 @@ public class A1ClientFactory { Class<?> clazz = Class.forName(ric.getConfig().getCustomAdapterClass()); if (A1Client.class.isAssignableFrom(clazz)) { Constructor<?> constructor = clazz.getConstructor(RicConfig.class, AsyncRestClientFactory.class); + logger.debug("A1Client (" + clazz.getTypeName() + ") being created for ric: {}", + ric.getConfig().getRicId()); return (A1Client) constructor.newInstance(ric.getConfig(), this.restClientFactory); } else if (A1Client.Factory.class.isAssignableFrom(clazz)) { A1Client.Factory factory = (A1Client.Factory) clazz.getDeclaredConstructor().newInstance(); + logger.debug("A1Client (" + clazz.getTypeName() + ") factory creating client for ric: {}", + ric.getConfig().getRicId()); return factory.create(ric.getConfig(), this.restClientFactory); } else { throw new ServiceException("The custom class must either implement A1Client.Factory or A1Client"); diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/CcsdkA1AdapterClient.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/CcsdkA1AdapterClient.java index 3b0d12a4..04ecf045 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/CcsdkA1AdapterClient.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/CcsdkA1AdapterClient.java @@ -63,7 +63,8 @@ public class CcsdkA1AdapterClient implements A1Client { this.body = body; } - public AdapterRequest() {} + public AdapterRequest() { + } } @Getter @@ -76,7 +77,8 @@ public class CcsdkA1AdapterClient implements A1Client { this.body = body; } - public AdapterOutput() {} + public AdapterOutput() { + } } static com.google.gson.Gson gson = new GsonBuilder() // @@ -92,12 +94,12 @@ public class CcsdkA1AdapterClient implements A1Client { /** * Constructor that creates the REST client to use. * - * @param protocolType the southbound protocol of the controller. Supported - * 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 protocolType the southbound protocol of the controller. Supported + * 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 CCSDK A1 Adapter to use * * @throws IllegalArgumentException when the protocolType is wrong. @@ -111,14 +113,14 @@ public class CcsdkA1AdapterClient implements A1Client { /** * Constructor where the REST client to use is provided. * - * @param protocolType the southbound protocol of the controller. Supported - * 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 protocolType the southbound protocol of the controller. Supported + * 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 CCSDK A1 Adapter to use - * @param restClient the REST client to use + * @param restClient the REST client to use * * @throws IllegalArgumentException when the protocolType is illegal. */ @@ -129,8 +131,9 @@ public class CcsdkA1AdapterClient implements A1Client { this.restClient = restClient; this.ricConfig = ricConfig; this.protocolType = protocolType; - logger.debug("CcsdkA1AdapterClient for ric: {}, a1Controller: {}", ricConfig.getRicId(), - ricConfig.getControllerConfig()); + logger.debug("A1Client (" + getClass().getTypeName() + ") created for ric: {}, a1Controller: {}", + ricConfig.getRicId(), ricConfig.getControllerConfig()); + } else { logger.error("Not supported protocoltype: {}", protocolType); throw new IllegalArgumentException("Not handeled protocolversion: " + protocolType); 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 eac79ad9..17681cb6 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 @@ -35,6 +35,7 @@ import org.slf4j.LoggerFactory; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; + /** * Client for accessing OSC A1 REST API */ @@ -51,7 +52,7 @@ public class OscA1Client implements A1Client { @Override public String createPutPolicyUri(String type, String policyId, String notificationDestinationUri) { - return createPolicyUri(type, policyId, notificationDestinationUri); + return createPolicyUri(type, policyId, notificationDestinationUri); } /** @@ -64,7 +65,7 @@ public class OscA1Client implements A1Client { @Override public String createDeleteUri(String type, String policyId) { - return createPolicyUri(type, policyId, null); + return createPolicyUri(type, policyId, null); } /** @@ -72,7 +73,7 @@ public class OscA1Client implements A1Client { */ @Override public String createGetPolicyStatusUri(String type, String policyId) { - return createPolicyUri(type, policyId, null) + "/status"; + return createPolicyUri(type, policyId, null) + "/status"; } /** @@ -107,13 +108,13 @@ public class OscA1Client implements A1Client { String url = baseUrl + "/policies/" + id; if (notificationDestination != null) { url += "?notificationDestination=" + - URLEncoder.encode(notificationDestination, StandardCharsets.UTF_8.toString()); + URLEncoder.encode(notificationDestination, StandardCharsets.UTF_8.toString()); } return new URI(url).toString(); } catch (Exception e) { String exceptionString = e.getMessage(); logger.error("Unexpected error in policy URI creation for policy type: {}, exception: {}", type, - exceptionString); + exceptionString); return ""; } } @@ -141,9 +142,8 @@ public class OscA1Client implements A1Client { public OscA1Client(RicConfig ricConfig, AsyncRestClient restClient) { this.restClient = restClient; - logger.debug("OscA1Client for ric: {}", ricConfig.getRicId()); - uri = new UriBuilder(ricConfig); + logger.debug("A1Client (" + getClass().getTypeName() + ") created for ric: {}", ricConfig.getRicId()); } public static Mono<String> extractCreateSchema(String policyTypeResponse, String policyTypeId) { 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 750008d8..2f06b6a6 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 @@ -20,6 +20,7 @@ package org.onap.ccsdk.oran.a1policymanagementservice.clients; +import java.lang.invoke.MethodHandles; import java.util.Arrays; import java.util.List; import java.util.Set; @@ -27,6 +28,9 @@ import java.util.Set; 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; @@ -96,6 +100,7 @@ public class StdA1ClientVersion1 implements A1Client { private final AsyncRestClient restClient; private final UriBuilder uri; + private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); public StdA1ClientVersion1(RicConfig ricConfig, AsyncRestClientFactory restClientFactory) { this(restClientFactory.createRestClientUseHttpProxy(""), ricConfig); @@ -104,6 +109,7 @@ public class StdA1ClientVersion1 implements A1Client { public StdA1ClientVersion1(AsyncRestClient restClient, RicConfig ricConfig) { this.restClient = restClient; this.uri = new UriBuilder(ricConfig); + logger.debug("A1Client (" + getClass().getTypeName() + ") created for ric: {}", ricConfig.getRicId()); } @Override 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 c61ecb86..6f907539 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 @@ -36,11 +36,11 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; /** - * Client for accessing ORAN A1-P Vesion 2.0 REST API + * Client for accessing ORAN A1-P Version 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 + static final int CONCURRENCY_RIC = 1; // How many parallel requests that is sent to one NearRT RIC public static class Factory implements A1Client.Factory { @Override @@ -71,7 +71,7 @@ public class StdA1ClientVersion2 implements A1Client { } /** - * /A1-P/v2/policytypes/{policy_type_id}/policies + * /A1-P/v2/policytypes/{policy_type_id}/policies */ @Override public String createGetPolicyIdsUri(String type) { @@ -84,7 +84,7 @@ public class StdA1ClientVersion2 implements A1Client { } /** - * /A1-P/v2/policytypes/{policy_type_id}/policies/{policy_instance_id}/status + * /A1-P/v2/policytypes/{policy_type_id}/policies/{policy_instance_id}/status */ @Override public String createGetPolicyStatusUri(String type, String policyId) { @@ -100,7 +100,7 @@ public class StdA1ClientVersion2 implements A1Client { } /** - * /A1-P/v2/policytypes/{policy_type_id} + * /A1-P/v2/policytypes/{policy_type_id} */ @Override public String createPolicyTypesUri() { @@ -108,7 +108,7 @@ public class StdA1ClientVersion2 implements A1Client { } /** - * /A1-P/v2/policytypes/{policy_type_id}/policies/{policy_instance_id} + * /A1-P/v2/policytypes/{policy_type_id}/policies/{policy_instance_id} */ private String createPolicyUri(String type, String id) { return createPolicyTypeUri(type) + "/policies/" + id; @@ -137,9 +137,8 @@ public class StdA1ClientVersion2 implements A1Client { public StdA1ClientVersion2(RicConfig ricConfig, AsyncRestClient restClient) { this.restClient = restClient; - logger.debug("OscA1Client for ric: {}", ricConfig.getRicId()); - uriBuiler = new OranV2UriBuilder(ricConfig); + logger.debug("A1Client (" + getClass().getTypeName() + ") created for ric: {}", ricConfig.getRicId()); } public static Mono<String> extractPolicySchema(String policyTypeResponse, String policyTypeId) { |