aboutsummaryrefslogtreecommitdiffstats
path: root/a1-policy-management/src/main/java
diff options
context:
space:
mode:
authorPatrikBuhr <patrik.buhr@est.tech>2021-05-05 08:38:07 +0200
committerPatrikBuhr <patrik.buhr@est.tech>2021-05-05 09:43:13 +0200
commit9a8965fa835da0639719245e44625e15f165d7d5 (patch)
tree88ae75e958ae6abe54514b50f2cef36ac93e2f43 /a1-policy-management/src/main/java
parent25d78500922291a2ade59799654c8b05a5ee7640 (diff)
PMS Persistent storage of service definitions - A1 Istanbul
Bugfix,only sending AVAILABLE notifications for RICs that has been successfully synched. Issue-ID: CCSDK-3256 Signed-off-by: PatrikBuhr <patrik.buhr@est.tech> Change-Id: Ic915c3d83a51ac23cb4652bda9ab696fc27bae3d
Diffstat (limited to 'a1-policy-management/src/main/java')
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/tasks/RefreshConfigTask.java21
1 files changed, 14 insertions, 7 deletions
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 faef863e..e84c9838 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
@@ -219,12 +219,16 @@ public class RefreshConfigTask {
private Mono<Ric> trySyncronizeSupportedTypes(Ric ric) {
logger.debug("Synchronizing policy types for new RIC: {}", ric.id());
// Synchronize the policy types
+ ric.setState(RicState.SYNCHRONIZING);
return this.a1ClientFactory.createA1Client(ric) //
.flatMapMany(client -> synchronizationTask().synchronizePolicyTypes(ric, client)) //
.collectList() //
.flatMap(list -> Mono.just(ric)) //
- .doOnError(t -> logger.warn("Failed to synchronize types in new RIC: {}, reason: {}", ric.id(),
- t.getMessage())) //
+ .doOnNext(notUsed -> ric.setState(RicState.AVAILABLE)) //
+ .doOnError(t -> {
+ logger.warn("Failed to synchronize types in new RIC: {}, reason: {}", ric.id(), t.getMessage());
+ ric.setState(RicState.UNAVAILABLE); //
+ }) //
.onErrorResume(t -> Mono.just(ric));
}
@@ -238,7 +242,6 @@ public class RefreshConfigTask {
return trySyncronizeSupportedTypes(new Ric(updatedInfo.getRicConfig())) //
.flatMap(this::addRic) //
.flatMap(this::notifyServicesRicAvailable) //
- .doOnNext(ric -> ric.setState(RicState.AVAILABLE)) //
.flatMap(notUsed -> Mono.just(event));
} else if (event == RicConfigUpdate.Type.REMOVED) {
logger.debug("RIC removed {}", ricId);
@@ -270,10 +273,14 @@ public class RefreshConfigTask {
}
private Mono<Ric> notifyServicesRicAvailable(Ric ric) {
- ServiceCallbacks callbacks = new ServiceCallbacks(this.restClientFactory);
- return callbacks.notifyServicesRicAvailable(ric, services) //
- .collectList() //
- .flatMap(list -> Mono.just(ric));
+ if (ric.getState() == RicState.AVAILABLE) {
+ ServiceCallbacks callbacks = new ServiceCallbacks(this.restClientFactory);
+ return callbacks.notifyServicesRicAvailable(ric, services) //
+ .collectList() //
+ .flatMap(list -> Mono.just(ric));
+ } else {
+ return Mono.just(ric);
+ }
}
/**