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.
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() {
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
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();
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) {