Added RIC state to RicInfo in the agent NBI
[nonrtric.git] / policy-agent / src / main / java / org / oransc / policyagent / tasks / RicSynchronizationTask.java
index 00ca0ed..ae91d4b 100644 (file)
@@ -89,7 +89,7 @@ public class RicSynchronizationTask {
                 @Override
                 protected void hookOnError(Throwable throwable) {
                     logger.warn("Synchronization failure for ric: {}, reason: {}", ric.name(), throwable.getMessage());
-                    ric.setState(RicState.UNDEFINED);
+                    ric.setState(RicState.UNAVAILABLE);
                 }
 
                 @Override
@@ -126,7 +126,7 @@ public class RicSynchronizationTask {
 
     private void onSynchronizationComplete(Ric ric) {
         logger.debug("Synchronization completed for: {}", ric.name());
-        ric.setState(RicState.IDLE);
+        ric.setState(RicState.AVAILABLE);
         notifyAllServices("Synchronization completed for:" + ric.name());
     }
 
@@ -137,15 +137,16 @@ public class RicSynchronizationTask {
                 createNotificationClient(url) //
                     .put("", body) //
                     .subscribe( //
-                        notUsed -> logger.debug("Service {} notified", service.getName()), throwable -> logger
-                            .warn("Service notification failed for service: {}", service.getName(), throwable),
+                        notUsed -> logger.debug("Service {} notified", service.getName()),
+                        throwable -> logger.warn("Service notification failed for service: {}. Cause: {}",
+                            service.getName(), throwable.getMessage()),
                         () -> logger.debug("All services notified"));
             }
         }
     }
 
     private Flux<Object> deleteAllPolicyInstances(Ric ric, Throwable t) {
-        logger.warn("Recreation of policies failed for ric: {}, reason: {}", ric.name(), t.getMessage());
+        logger.debug("Recreation of policies failed for ric: {}, reason: {}", ric.name(), t.getMessage());
         deleteAllPoliciesInRepository(ric);
 
         Flux<PolicyType> synchronizedTypes = this.a1ClientFactory.createA1Client(ric) //