diff options
Diffstat (limited to 'nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/notification/LifecycleChangeNotificationManager.java')
-rw-r--r-- | nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/notification/LifecycleChangeNotificationManager.java | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/notification/LifecycleChangeNotificationManager.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/notification/LifecycleChangeNotificationManager.java index 9b497343..c4cd4342 100644 --- a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/notification/LifecycleChangeNotificationManager.java +++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/notification/LifecycleChangeNotificationManager.java @@ -28,6 +28,7 @@ import java.util.Optional; import java.util.Set; import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.api.INotificationSender; import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.onap.core.SelfRegistrationManager; +import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.util.CbamUtils.OperationMustBeAborted; import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.util.SystemFunctions; import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm.CbamRestApiProvider; import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm.ILifecycleChangeNotificationManager; @@ -210,15 +211,20 @@ public class LifecycleChangeNotificationManager implements ILifecycleChangeNotif JsonObject operationResult = root.getAsJsonObject().get("operationResult").getAsJsonObject(); if (isAbsent(operationResult, "cbam_pre") || isAbsent(operationResult, "cbam_post")) { - return handleFailure(operationExecution, null); + return handleFailure(operationExecution); } else { return of(new Gson().fromJson(operationResult, ReportedAffectedConnectionPoints.class)); } } else { - return handleFailure(operationExecution, null); + return handleFailure(operationExecution); } - } catch (Exception e) { - return handleFailure(operationExecution, e); + } + catch(OperationMustBeAborted handledFailuire){ + throw handledFailuire; + } + catch (Exception e) { + logger.warn("Unable to build affected connection points", e); + return toleratedFailure(); } } @@ -226,15 +232,16 @@ public class LifecycleChangeNotificationManager implements ILifecycleChangeNotif return !operationResult.has(key) || !operationResult.get(key).isJsonArray(); } - private Optional<ReportedAffectedConnectionPoints> handleFailure(OperationExecution operationExecution, Exception e) { + private Optional<ReportedAffectedConnectionPoints> handleFailure(OperationExecution operationExecution) { if (operationExecution.getStatus() == OperationStatus.FAILED) { - logger.warn("The operation failed and the affected connection points were not reported"); - return empty(); + return toleratedFailure(); } else { - if (e != null) { - throw buildFatalFailure(logger, PROBLEM, e); - } throw buildFatalFailure(logger, PROBLEM); } } + + private Optional<ReportedAffectedConnectionPoints> toleratedFailure() { + logger.warn("The operation failed and the affected connection points were not reported"); + return empty(); + } } |