aboutsummaryrefslogtreecommitdiffstats
path: root/a1-policy-management
diff options
context:
space:
mode:
Diffstat (limited to 'a1-policy-management')
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/repository/Rics.java5
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RefreshConfigTask.java12
2 files changed, 14 insertions, 3 deletions
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/repository/Rics.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/repository/Rics.java
index 75c16da1..b6ec7491 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/repository/Rics.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/repository/Rics.java
@@ -27,6 +27,7 @@ import java.util.Optional;
import java.util.Vector;
import org.onap.ccsdk.oran.a1policymanagementservice.exceptions.ServiceException;
+import org.springframework.lang.Nullable;
/**
* Dynamic representation of all Rics in the system.
@@ -54,8 +55,8 @@ public class Rics {
return registeredRics.get(ricId);
}
- public synchronized void remove(String ricId) {
- registeredRics.remove(ricId);
+ public synchronized @Nullable Ric remove(String ricId) {
+ return registeredRics.remove(ricId);
}
public synchronized int size() {
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RefreshConfigTask.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RefreshConfigTask.java
index 0fd16334..84cfe24a 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RefreshConfigTask.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RefreshConfigTask.java
@@ -63,6 +63,7 @@ import org.springframework.stereotype.Component;
import reactor.core.Disposable;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
+import reactor.util.annotation.Nullable;
/**
* Regularly refreshes the configuration from Consul or from a local
@@ -195,6 +196,14 @@ public class RefreshConfigTask {
return (filepath != null && (new File(filepath).exists()));
}
+ private void removePoliciciesInRic(@Nullable Ric ric) {
+ if (ric != null) {
+ RicSynchronizationTask synch =
+ new RicSynchronizationTask(this.a1ClientFactory, this.policyTypes, this.policies, this.services);
+ synch.run(ric);
+ }
+ }
+
private void handleUpdatedRicConfig(RicConfigUpdate updatedInfo) {
synchronized (this.rics) {
String ricId = updatedInfo.getRicConfig().ricId();
@@ -202,8 +211,9 @@ public class RefreshConfigTask {
if (event == RicConfigUpdate.Type.ADDED) {
addRic(updatedInfo.getRicConfig());
} else if (event == RicConfigUpdate.Type.REMOVED) {
- rics.remove(ricId);
+ Ric ric = rics.remove(ricId);
this.policies.removePoliciesForRic(ricId);
+ removePoliciciesInRic(ric);
} else if (event == RicConfigUpdate.Type.CHANGED) {
Ric ric = this.rics.get(ricId);
if (ric == null) {