X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=servicehandler%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Ftransportpce%2Fservicehandler%2Fservice%2FRendererServiceWrapper.java;h=ec2e2a7115c843b34d628f820b2b7a5b301d6d05;hb=9ab0cabbeeddeac5ab2bcfa7cb4a3f79f81a5c88;hp=0bf4936382b94d9db7b87077e4a281913c63df17;hpb=9c75bfdd06f39def37a4e2c17cca9ed13d1e9c54;p=transportpce.git diff --git a/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/service/RendererServiceWrapper.java b/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/service/RendererServiceWrapper.java index 0bf493638..ec2e2a711 100644 --- a/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/service/RendererServiceWrapper.java +++ b/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/service/RendererServiceWrapper.java @@ -16,20 +16,20 @@ import java.util.concurrent.Executors; import org.opendaylight.mdsal.binding.api.NotificationPublishService; import org.opendaylight.transportpce.common.ResponseCodes; import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev200520.ServiceDeleteInput; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev200520.ServiceDeleteInputBuilder; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev200520.ServiceDeleteOutput; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev200520.ServiceDeleteOutputBuilder; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev171017.ServiceRpcResultSh; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev171017.ServiceRpcResultShBuilder; -import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.ServiceNotificationTypes; -import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.configuration.response.common.ConfigurationResponseCommon; -import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.configuration.response.common.ConfigurationResponseCommonBuilder; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.TempServiceDeleteInput; -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.service.handler.header.ServiceHandlerHeader; -import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev200128.service.handler.header.ServiceHandlerHeaderBuilder; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteInput; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteInputBuilder; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteOutput; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteOutputBuilder; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev201125.ServiceRpcResultSh; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev201125.ServiceRpcResultShBuilder; +import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.ServiceNotificationTypes; +import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.configuration.response.common.ConfigurationResponseCommon; +import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.configuration.response.common.ConfigurationResponseCommonBuilder; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.TempServiceDeleteInput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.list.Services; +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.RpcStatusEx; +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.service.handler.header.ServiceHandlerHeader; +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.service.handler.header.ServiceHandlerHeaderBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -90,42 +90,8 @@ public class RendererServiceWrapper { .setStatus(RpcStatusEx.Pending) .setStatusMessage("Service compliant, submitting temp service delete Request ...").build(); sendNotifications(notification); - FutureCallback rendererCallback = new FutureCallback() { - - String message = ""; - ServiceRpcResultSh notification = null; - - @Override - public void onSuccess(ServiceDeleteOutput response) { - if (response != null) { - /** - * If PCE reply is received before timer expiration with a positive result, a - * service is created with admin and operational status 'down'. - */ - message = "Renderer replied to service delete Request !"; - LOG.info("Renderer replied to service delete Request : {}", response); - notification = - new ServiceRpcResultShBuilder().setNotificationType(notifType).setServiceName(serviceName) - .setStatus(RpcStatusEx.Successful).setStatusMessage(message).build(); - sendNotifications(notification); - } else { - message = "Renderer service delete failed "; - notification = new ServiceRpcResultShBuilder().setNotificationType(notifType).setServiceName("") - .setStatus(RpcStatusEx.Failed).setStatusMessage(message).build(); - sendNotifications(notification); - } - } - - @Override - public void onFailure(Throwable arg0) { - LOG.error("Renderer service delete failed !"); - notification = new ServiceRpcResultShBuilder().setNotificationType(notifType) - .setServiceName(serviceName) - .setStatus(RpcStatusEx.Failed) - .setStatusMessage("Renderer service delete request failed : " + arg0.getMessage()).build(); - sendNotifications(notification); - } - }; + FutureCallback rendererCallback = + new ServiceDeleteOutputFutureCallback(notifType, serviceName); ServiceDeleteInput serviceDeleteInput = createRendererRequestInput(serviceName, serviceHandlerHeader); ListenableFuture renderer = this.rendererServiceOperations.serviceDelete(serviceDeleteInput, service); @@ -167,5 +133,47 @@ public class RendererServiceWrapper { private static boolean checkString(String value) { return ((value != null) && (value.compareTo("") != 0)); } + + private final class ServiceDeleteOutputFutureCallback implements FutureCallback { + private final ServiceNotificationTypes notifType; + private final String serviceName; + String message = ""; + ServiceRpcResultSh notification = null; + + private ServiceDeleteOutputFutureCallback(ServiceNotificationTypes notifType, String serviceName) { + this.notifType = notifType; + this.serviceName = serviceName; + } + + @Override + public void onSuccess(ServiceDeleteOutput response) { + if (response != null) { + /** + * If PCE reply is received before timer expiration with a positive result, a + * service is created with admin and operational status 'down'. + */ + message = "Renderer replied to service delete Request !"; + LOG.info("Renderer replied to service delete Request : {}", response); + notification = new ServiceRpcResultShBuilder().setNotificationType(notifType) + .setServiceName(serviceName).setStatus(RpcStatusEx.Successful).setStatusMessage(message) + .build(); + sendNotifications(notification); + } else { + message = "Renderer service delete failed "; + notification = new ServiceRpcResultShBuilder().setNotificationType(notifType).setServiceName("") + .setStatus(RpcStatusEx.Failed).setStatusMessage(message).build(); + sendNotifications(notification); + } + } + + @Override + public void onFailure(Throwable arg0) { + LOG.error("Renderer service delete failed !"); + notification = new ServiceRpcResultShBuilder().setNotificationType(notifType).setServiceName(serviceName) + .setStatus(RpcStatusEx.Failed) + .setStatusMessage("Renderer service delete request failed : " + arg0.getMessage()).build(); + sendNotifications(notification); + } + } }