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=586ce2591859432de0d81838d80bea63530faaf6;hb=6b6a445c84c2eb1c85d4e48c2d10a89c3d598bc5;hp=bd7564419d3a0f416b60c05dbd31b3fff72a7b63;hpb=3a5c4806c7417ac3955f284c8f620f2c8946ce40;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 bd7564419..586ce2591 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 @@ -9,18 +9,24 @@ package org.opendaylight.transportpce.servicehandler.impl; import org.opendaylight.mdsal.binding.api.DataBroker; +import org.opendaylight.mdsal.binding.api.DataTreeIdentifier; import org.opendaylight.mdsal.binding.api.NotificationService; import org.opendaylight.mdsal.binding.api.RpcProviderService; +import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.transportpce.servicehandler.listeners.NetworkModelListenerImpl; import org.opendaylight.transportpce.servicehandler.listeners.PceListenerImpl; import org.opendaylight.transportpce.servicehandler.listeners.RendererListenerImpl; +import org.opendaylight.transportpce.servicehandler.listeners.ServiceListener; import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperations; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkmodel.rev201116.TransportpceNetworkmodelListener; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.TransportpcePceListener; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev201125.TransportpceRendererListener; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.OrgOpenroadmServiceService; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220118.TransportpcePceListener; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.TransportpceRendererListener; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.OrgOpenroadmServiceService; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceList; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.list.Services; import org.opendaylight.yangtools.concepts.ListenerRegistration; import org.opendaylight.yangtools.concepts.ObjectRegistration; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -33,23 +39,27 @@ import org.slf4j.LoggerFactory; public class ServicehandlerProvider { private static final Logger LOG = LoggerFactory.getLogger(ServicehandlerProvider.class); + private static final InstanceIdentifier SERVICE = InstanceIdentifier.builder(ServiceList.class) + .child(Services.class).build(); private final DataBroker dataBroker; private final RpcProviderService rpcService; private final NotificationService notificationService; private ListenerRegistration pcelistenerRegistration; + private ListenerRegistration serviceDataTreeChangeListenerRegistration; private ListenerRegistration rendererlistenerRegistration; private ListenerRegistration networkmodellistenerRegistration; private ObjectRegistration rpcRegistration; private ServiceDataStoreOperations serviceDataStoreOperations; private PceListenerImpl pceListenerImpl; + private ServiceListener serviceListener; private RendererListenerImpl rendererListenerImpl; private NetworkModelListenerImpl networkModelListenerImpl; private ServicehandlerImpl servicehandler; public ServicehandlerProvider(final DataBroker dataBroker, RpcProviderService rpcProviderService, NotificationService notificationService, ServiceDataStoreOperations serviceDataStoreOperations, - PceListenerImpl pceListenerImpl, RendererListenerImpl rendererListenerImpl, + PceListenerImpl pceListenerImpl, ServiceListener serviceListener, RendererListenerImpl rendererListenerImpl, NetworkModelListenerImpl networkModelListenerImpl, ServicehandlerImpl servicehandler) { this.dataBroker = dataBroker; this.rpcService = rpcProviderService; @@ -57,6 +67,7 @@ public class ServicehandlerProvider { this.serviceDataStoreOperations = serviceDataStoreOperations; this.serviceDataStoreOperations.initialize(); this.pceListenerImpl = pceListenerImpl; + this.serviceListener = serviceListener; this.rendererListenerImpl = rendererListenerImpl; this.networkModelListenerImpl = networkModelListenerImpl; this.servicehandler = servicehandler; @@ -68,6 +79,8 @@ public class ServicehandlerProvider { public void init() { LOG.info("ServicehandlerProvider Session Initiated"); pcelistenerRegistration = notificationService.registerNotificationListener(pceListenerImpl); + serviceDataTreeChangeListenerRegistration = dataBroker.registerDataTreeChangeListener( + DataTreeIdentifier.create(LogicalDatastoreType.OPERATIONAL, SERVICE), serviceListener); rendererlistenerRegistration = notificationService.registerNotificationListener(rendererListenerImpl); networkmodellistenerRegistration = notificationService.registerNotificationListener(networkModelListenerImpl); rpcRegistration = rpcService.registerRpcImplementation(OrgOpenroadmServiceService.class, servicehandler); @@ -79,6 +92,7 @@ public class ServicehandlerProvider { public void close() { LOG.info("ServicehandlerProvider Closed"); pcelistenerRegistration.close(); + serviceDataTreeChangeListenerRegistration.close(); rendererlistenerRegistration.close(); networkmodellistenerRegistration.close(); rpcRegistration.close();