From 3c7a3242e3746ea3850703e421e485229171b730 Mon Sep 17 00:00:00 2001 From: nitincg Date: Fri, 16 Jun 2023 23:38:08 +0530 Subject: Support of the status_notification_uri in A1Policy creation Issue-ID: CCSDK-3911 Change-Id: I3ada7a16db879a06f3b446025cf1fd794d67ac22 Signed-off-by: nitincg --- .../clients/OscA1Client.java | 27 ++++++++++++++++------ 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'a1-policy-management/src/main/java') 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 62115b5a..f2a79cd8 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 @@ -32,7 +32,7 @@ import org.slf4j.LoggerFactory; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; - +import org.apache.http.client.utils.URIBuilder; /** * Client for accessing OSC A1 REST API */ @@ -49,7 +49,7 @@ public class OscA1Client implements A1Client { @Override public String createPutPolicyUri(String type, String policyId, String notificationDestinationUri) { - return createPolicyUri(type, policyId); + return createPolicyUri(type, policyId, notificationDestinationUri); } /** @@ -62,7 +62,7 @@ public class OscA1Client implements A1Client { @Override public String createDeleteUri(String type, String policyId) { - return createPolicyUri(type, policyId); + return createPolicyUri(type, policyId, null); } /** @@ -70,7 +70,7 @@ public class OscA1Client implements A1Client { */ @Override public String createGetPolicyStatusUri(String type, String policyId) { - return createPolicyUri(type, policyId) + "/status"; + return createPolicyUri(type, policyId, null) + "/status"; } /** @@ -99,9 +99,22 @@ public class OscA1Client implements A1Client { /** * ​/a1-p​/policytypes​/{policy_type_id}​/policies​/{policy_instance_id} */ - private String createPolicyUri(String type, String id) { - return createPolicyTypeUri(type) + "/policies/" + id; - } + private String createPolicyUri(String type, String id, String notificationDestination) { + String url = ""; + URIBuilder ub = null; + try { + ub = new URIBuilder(createPolicyTypeUri(type) + "/policies/" + id); + if(notificationDestination != null) { + ub.addParameter("notificationDestination", notificationDestination); + } + url = ub.toString(); + } + catch(Exception e) { + String exceptionString = e.toString(); + logger.error("Unexpected error in policy URI creation for policy type: {}, exception: {}", type, exceptionString); + } + return url; + } /** * /a1-p/policytypes/{policy_type_id} -- cgit 1.2.3-korg