X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=servicehandler%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Ftransportpce%2Fservicehandler%2Fimpl%2FServicehandlerProvider.java;h=62373ccedcaa940d72bf8e19c7e4753254d71e15;hb=4378fca1d31d1f75c0480c752aa711fb885e6135;hp=f2b9fbe51b3b06a9bbfacb78aaf3222ed2b8fb3d;hpb=e909d17392274b7af0e8e6d99f80fd021f4ed7a4;p=transportpce.git diff --git a/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/impl/ServicehandlerProvider.java b/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/impl/ServicehandlerProvider.java index f2b9fbe51..62373cced 100644 --- a/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/impl/ServicehandlerProvider.java +++ b/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/impl/ServicehandlerProvider.java @@ -8,23 +8,27 @@ package org.opendaylight.transportpce.servicehandler.impl; -import org.opendaylight.controller.md.sal.binding.api.DataBroker; -import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService; -import org.opendaylight.controller.md.sal.binding.api.NotificationService; -import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration; -import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.StubpceListener; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.StubrendererListener; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.OrgOpenroadmServiceService; +import org.opendaylight.mdsal.binding.api.DataBroker; +import org.opendaylight.mdsal.binding.api.NotificationPublishService; +import org.opendaylight.mdsal.binding.api.NotificationService; +import org.opendaylight.mdsal.binding.api.RpcProviderService; +import org.opendaylight.transportpce.pce.service.PathComputationService; +import org.opendaylight.transportpce.renderer.NetworkModelWavelengthService; +import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations; +import org.opendaylight.transportpce.servicehandler.listeners.PceListenerImpl; +import org.opendaylight.transportpce.servicehandler.listeners.RendererListenerImpl; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.TransportpcePceListener; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.TransportpceRendererListener; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.OrgOpenroadmServiceService; import org.opendaylight.yangtools.concepts.ListenerRegistration; +import org.opendaylight.yangtools.concepts.ObjectRegistration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Class to register * Servicehandler Service and Notification. - * - * @author Martial Coulibaly on behalf of Orange + * @author Martial Coulibaly ( martial.coulibaly@gfi.com ) on behalf of Orange * */ public class ServicehandlerProvider { @@ -32,21 +36,27 @@ public class ServicehandlerProvider { private static final Logger LOG = LoggerFactory.getLogger(ServicehandlerProvider.class); private final DataBroker dataBroker; - private final RpcProviderRegistry rpcRegistry; + private final RpcProviderService rpcService; private final NotificationService notificationService; + private final NetworkModelWavelengthService networkModelWavelengthService; private final NotificationPublishService notificationPublishService; + private ListenerRegistration pcelistenerRegistration; + private ListenerRegistration rendererlistenerRegistration; + private ObjectRegistration rpcRegistration; + private PathComputationService pathComputationService; + private RendererServiceOperations rendererServiceOperations; - /** Listener register for TransportpceService Notification. */ - private ListenerRegistration stubpcelistenerRegistration; - private ListenerRegistration stubrendererlistenerRegistration; - private RpcRegistration rpcRegistration; - - - public ServicehandlerProvider(final DataBroker dataBroker, RpcProviderRegistry rpcProviderRegistry, - NotificationService notificationService, NotificationPublishService notificationPublishService) { + public ServicehandlerProvider(final DataBroker dataBroker, RpcProviderService rpcProviderService, + NotificationService notificationService, PathComputationService pathComputationService, + RendererServiceOperations rendererServiceOperations, + NetworkModelWavelengthService networkModelWavelengthService, + NotificationPublishService notificationPublishService) { this.dataBroker = dataBroker; - this.rpcRegistry = rpcProviderRegistry; + this.rpcService = rpcProviderService; this.notificationService = notificationService; + this.pathComputationService = pathComputationService; + this.rendererServiceOperations = rendererServiceOperations; + this.networkModelWavelengthService = networkModelWavelengthService; this.notificationPublishService = notificationPublishService; } @@ -55,10 +65,17 @@ public class ServicehandlerProvider { */ public void init() { LOG.info("ServicehandlerProvider Session Initiated"); - final ServicehandlerImpl consumer = new ServicehandlerImpl(dataBroker, rpcRegistry, notificationPublishService); - stubpcelistenerRegistration = notificationService.registerNotificationListener(consumer); - stubrendererlistenerRegistration = notificationService.registerNotificationListener(consumer); - rpcRegistration = rpcRegistry.addRpcImplementation(OrgOpenroadmServiceService.class, consumer); + final PceListenerImpl pceListenerImpl = new PceListenerImpl(rendererServiceOperations, + pathComputationService, notificationPublishService, null); + final RendererListenerImpl rendererListenerImpl = + new RendererListenerImpl(pathComputationService, notificationPublishService); + pcelistenerRegistration = notificationService.registerNotificationListener(pceListenerImpl); + rendererlistenerRegistration = notificationService.registerNotificationListener(rendererListenerImpl); + final ServicehandlerImpl servicehandler = new ServicehandlerImpl(dataBroker, pathComputationService, + rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl, + networkModelWavelengthService); + rpcRegistration = + rpcService.registerRpcImplementation(OrgOpenroadmServiceService.class, servicehandler); } /** @@ -66,8 +83,9 @@ public class ServicehandlerProvider { */ public void close() { LOG.info("ServicehandlerProvider Closed"); - stubpcelistenerRegistration.close(); - stubrendererlistenerRegistration.close(); + pcelistenerRegistration.close(); + rendererlistenerRegistration.close(); rpcRegistration.close(); } + }