2 * Copyright © 2017 Orange, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.transportpce.servicehandler.impl;
11 import org.opendaylight.mdsal.binding.api.DataBroker;
12 import org.opendaylight.mdsal.binding.api.NotificationPublishService;
13 import org.opendaylight.mdsal.binding.api.NotificationService;
14 import org.opendaylight.mdsal.binding.api.RpcProviderService;
15 import org.opendaylight.transportpce.pce.service.PathComputationService;
16 import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations;
17 import org.opendaylight.transportpce.servicehandler.listeners.NetworkModelListenerImpl;
18 import org.opendaylight.transportpce.servicehandler.listeners.PceListenerImpl;
19 import org.opendaylight.transportpce.servicehandler.listeners.RendererListenerImpl;
20 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkmodel.rev201116.TransportpceNetworkmodelListener;
21 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.TransportpcePceListener;
22 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev201125.TransportpceRendererListener;
23 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.OrgOpenroadmServiceService;
24 import org.opendaylight.yangtools.concepts.ListenerRegistration;
25 import org.opendaylight.yangtools.concepts.ObjectRegistration;
26 import org.slf4j.Logger;
27 import org.slf4j.LoggerFactory;
31 * Servicehandler Service and Notification.
32 * @author Martial Coulibaly ( martial.coulibaly@gfi.com ) on behalf of Orange
35 public class ServicehandlerProvider {
37 private static final Logger LOG = LoggerFactory.getLogger(ServicehandlerProvider.class);
39 private final DataBroker dataBroker;
40 private final RpcProviderService rpcService;
41 private final NotificationService notificationService;
42 private final NotificationPublishService notificationPublishService;
43 private ListenerRegistration<TransportpcePceListener> pcelistenerRegistration;
44 private ListenerRegistration<TransportpceRendererListener> rendererlistenerRegistration;
45 private ListenerRegistration<TransportpceNetworkmodelListener> networkmodellistenerRegistration;
46 private ObjectRegistration<OrgOpenroadmServiceService> rpcRegistration;
47 private PathComputationService pathComputationService;
48 private RendererServiceOperations rendererServiceOperations;
50 public ServicehandlerProvider(final DataBroker dataBroker, RpcProviderService rpcProviderService,
51 NotificationService notificationService, PathComputationService pathComputationService,
52 RendererServiceOperations rendererServiceOperations,
53 NotificationPublishService notificationPublishService) {
54 this.dataBroker = dataBroker;
55 this.rpcService = rpcProviderService;
56 this.notificationService = notificationService;
57 this.pathComputationService = pathComputationService;
58 this.rendererServiceOperations = rendererServiceOperations;
59 this.notificationPublishService = notificationPublishService;
63 * Method called when the blueprint container is created.
66 LOG.info("ServicehandlerProvider Session Initiated");
67 final PceListenerImpl pceListenerImpl = new PceListenerImpl(rendererServiceOperations,
68 pathComputationService, notificationPublishService, null);
69 final RendererListenerImpl rendererListenerImpl =
70 new RendererListenerImpl(pathComputationService, notificationPublishService);
71 final NetworkModelListenerImpl networkModelListenerImpl =
72 new NetworkModelListenerImpl(notificationPublishService, null);
73 pcelistenerRegistration = notificationService.registerNotificationListener(pceListenerImpl);
74 rendererlistenerRegistration = notificationService.registerNotificationListener(rendererListenerImpl);
75 networkmodellistenerRegistration = notificationService.registerNotificationListener(networkModelListenerImpl);
76 final ServicehandlerImpl servicehandler = new ServicehandlerImpl(dataBroker, pathComputationService,
77 rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
78 networkModelListenerImpl);
80 rpcService.registerRpcImplementation(OrgOpenroadmServiceService.class, servicehandler);
84 * Method called when the blueprint container is destroyed.
87 LOG.info("ServicehandlerProvider Closed");
88 pcelistenerRegistration.close();
89 rendererlistenerRegistration.close();
90 networkmodellistenerRegistration.close();
91 rpcRegistration.close();