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.NetworkModelWavelengthService;
17 import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations;
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.pce.rev190624.TransportpcePceListener;
21 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.TransportpceRendererListener;
22 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.OrgOpenroadmServiceService;
23 import org.opendaylight.yangtools.concepts.ListenerRegistration;
24 import org.opendaylight.yangtools.concepts.ObjectRegistration;
25 import org.slf4j.Logger;
26 import org.slf4j.LoggerFactory;
30 * Servicehandler Service and Notification.
31 * @author Martial Coulibaly ( martial.coulibaly@gfi.com ) on behalf of Orange
34 public class ServicehandlerProvider {
36 private static final Logger LOG = LoggerFactory.getLogger(ServicehandlerProvider.class);
38 private final DataBroker dataBroker;
39 private final RpcProviderService rpcService;
40 private final NotificationService notificationService;
41 private final NetworkModelWavelengthService networkModelWavelengthService;
42 private final NotificationPublishService notificationPublishService;
43 private ListenerRegistration<TransportpcePceListener> pcelistenerRegistration;
44 private ListenerRegistration<TransportpceRendererListener> rendererlistenerRegistration;
45 private ObjectRegistration<OrgOpenroadmServiceService> rpcRegistration;
46 private PathComputationService pathComputationService;
47 private RendererServiceOperations rendererServiceOperations;
49 public ServicehandlerProvider(final DataBroker dataBroker, RpcProviderService rpcProviderService,
50 NotificationService notificationService, PathComputationService pathComputationService,
51 RendererServiceOperations rendererServiceOperations,
52 NetworkModelWavelengthService networkModelWavelengthService,
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.networkModelWavelengthService = networkModelWavelengthService;
60 this.notificationPublishService = notificationPublishService;
64 * Method called when the blueprint container is created.
67 LOG.info("ServicehandlerProvider Session Initiated");
68 final PceListenerImpl pceListenerImpl = new PceListenerImpl(rendererServiceOperations,
69 pathComputationService, notificationPublishService, null);
70 final RendererListenerImpl rendererListenerImpl =
71 new RendererListenerImpl(pathComputationService, notificationPublishService);
72 pcelistenerRegistration = notificationService.registerNotificationListener(pceListenerImpl);
73 rendererlistenerRegistration = notificationService.registerNotificationListener(rendererListenerImpl);
74 final ServicehandlerImpl servicehandler = new ServicehandlerImpl(dataBroker, pathComputationService,
75 rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
76 networkModelWavelengthService);
78 rpcService.registerRpcImplementation(OrgOpenroadmServiceService.class, servicehandler);
82 * Method called when the blueprint container is destroyed.
85 LOG.info("ServicehandlerProvider Closed");
86 pcelistenerRegistration.close();
87 rendererlistenerRegistration.close();
88 rpcRegistration.close();