X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=servicehandler%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Ftransportpce%2Fservicehandler%2Flisteners%2FPceListenerImpl.java;h=eed0c383318e2a8f3e5d67a36b4df708c66aa30d;hb=c7307826e47ae07601333c022dad3902cda28a54;hp=1ecc6a246e868ef593f5faa0fe5301a7c4cd6e5c;hpb=1f09176f61e18f8aa5a295c571c94b1ecc1837df;p=transportpce.git diff --git a/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/listeners/PceListenerImpl.java b/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/listeners/PceListenerImpl.java index 1ecc6a246..eed0c3833 100644 --- a/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/listeners/PceListenerImpl.java +++ b/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/listeners/PceListenerImpl.java @@ -24,6 +24,7 @@ import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev20 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.service.path.rpc.result.PathDescriptionBuilder; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev201125.ServiceImplementationRequestInput; import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev181130.State; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.list.Services; import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev200128.RpcStatusEx; import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev200128.response.parameters.sp.ResponseParameters; import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev200128.response.parameters.sp.ResponseParametersBuilder; @@ -158,7 +159,7 @@ public class PceListenerImpl implements TransportpcePceListener { sendNbiNotification(nbiNotification); return false; case Pending: - LOG.warn("PCE path computation returned a Penging RpcStatusEx code!"); + LOG.warn("PCE path computation returned a Pending RpcStatusEx code!"); return false; case Successful: LOG.info("PCE calculation done OK !"); @@ -195,35 +196,58 @@ public class PceListenerImpl implements TransportpcePceListener { * Process cancel resource result. */ private void onCancelResourceResult() { - if (servicePathRpcResult.getStatus() == RpcStatusEx.Failed) { - LOG.info("PCE cancel resource failed !"); + if (servicePathRpcResult.getStatus() == RpcStatusEx.Pending) { + LOG.warn("PCE cancel returned a Pending RpcStatusEx code !"); return; - } else if (servicePathRpcResult.getStatus() == RpcStatusEx.Pending) { - LOG.warn("PCE cancel returned a Penging RpcStatusEx code!"); + } else if (servicePathRpcResult.getStatus() != RpcStatusEx.Successful + && servicePathRpcResult.getStatus() != RpcStatusEx.Failed) { + LOG.error("PCE cancel returned an unknown RpcStatusEx code !"); return; - } else if (servicePathRpcResult.getStatus() != RpcStatusEx.Successful) { - LOG.error("PCE cancel returned an unknown RpcStatusEx code!"); + } + 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!"); + LOG.warn("Service path was not removed from datastore !"); } - OperationResult deleteServiceOperationResult = null; + OperationResult deleteServiceOperationResult; + String serviceType = ""; if (tempService) { - deleteServiceOperationResult = - this.serviceDataStoreOperations.deleteTempService(input.getServiceName()); - if (!deleteServiceOperationResult.isSuccess()) { - LOG.warn("Temp Service was not removed from datastore!"); - } + deleteServiceOperationResult = this.serviceDataStoreOperations.deleteTempService(input.getServiceName()); + serviceType = "Temp "; } else { - deleteServiceOperationResult = - this.serviceDataStoreOperations.deleteService(input.getServiceName()); - if (!deleteServiceOperationResult.isSuccess()) { - LOG.warn("Service was not removed from datastore!"); - } + 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.