+ /**
+ * Process cancel resource result.
+ */
+ private void onCancelResourceResult() {
+ if (servicePathRpcResult.getStatus() == RpcStatusEx.Pending) {
+ LOG.warn("PCE cancel returned a Pending RpcStatusEx code !");
+ return;
+ } else if (servicePathRpcResult.getStatus() != RpcStatusEx.Successful
+ && servicePathRpcResult.getStatus() != RpcStatusEx.Failed) {
+ LOG.error("PCE cancel returned an unknown RpcStatusEx code !");
+ return;
+ }
+ Services service = serviceDataStoreOperations.getService(input.getServiceName()).get();
+ PublishNotificationServiceBuilder nbiNotificationBuilder = new PublishNotificationServiceBuilder()
+ .setServiceName(service.getServiceName())
+ .setServiceAEnd(new ServiceAEndBuilder(service.getServiceAEnd()).build())
+ .setServiceZEnd(new ServiceZEndBuilder(service.getServiceZEnd()).build())
+ .setCommonId(service.getCommonId())
+ .setConnectionType(service.getConnectionType())
+ .setTopic(TOPIC);
+ if (servicePathRpcResult.getStatus() == RpcStatusEx.Failed) {
+ LOG.info("PCE cancel resource failed !");
+ sendNbiNotification(nbiNotificationBuilder
+ .setResponseFailed("PCE cancel resource failed !")
+ .setMessage("ServiceDelete request failed ...")
+ .setOperationalState(service.getOperationalState())
+ .build());
+ return;
+ }
+ LOG.info("PCE cancel resource done OK !");
+ OperationResult deleteServicePathOperationResult =
+ this.serviceDataStoreOperations.deleteServicePath(input.getServiceName());
+ if (!deleteServicePathOperationResult.isSuccess()) {
+ LOG.warn("Service path was not removed from datastore !");
+ }
+ OperationResult deleteServiceOperationResult;
+ String serviceType = "";
+ if (tempService) {
+ deleteServiceOperationResult = this.serviceDataStoreOperations.deleteTempService(input.getServiceName());
+ serviceType = "Temp ";
+ } else {
+ deleteServiceOperationResult = this.serviceDataStoreOperations.deleteService(input.getServiceName());
+ }
+ if (deleteServiceOperationResult.isSuccess()) {
+ sendNbiNotification(nbiNotificationBuilder
+ .setResponseFailed("")
+ .setMessage("Service deleted !")
+ .setOperationalState(State.Degraded)
+ .build());
+ } else {
+ LOG.warn("{}Service was not removed from datastore !", serviceType);
+ sendNbiNotification(nbiNotificationBuilder
+ .setResponseFailed(serviceType + "Service was not removed from datastore !")
+ .setMessage("ServiceDelete request failed ...")
+ .setOperationalState(service.getOperationalState())
+ .build());
+ }
+ /**
+ * if it was an RPC serviceReconfigure, re-launch PCR.
+ */
+ if (this.serviceReconfigure) {
+ LOG.info("cancel resource reserve done, relaunching PCE path computation ...");
+ this.pceServiceWrapper.performPCE(input.getServiceCreateInput(), true);
+ this.serviceReconfigure = false;
+ }
+ }
+
+ @SuppressFBWarnings(
+ value = "ES_COMPARING_STRINGS_WITH_EQ",
+ justification = "false positives, not strings but real object references comparisons")