ed8ab32d768fbe2c401f7b971640339bab6f7707
[transportpce.git] /
1 /*
2  * Copyright © 2018 Orange, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.transportpce.servicehandler.service;
9
10 import com.google.common.util.concurrent.ListenableFuture;
11 import java.util.concurrent.ExecutionException;
12 import org.opendaylight.mdsal.binding.api.DataBroker;
13 import org.opendaylight.mdsal.binding.api.NotificationPublishService;
14 import org.opendaylight.transportpce.pce.service.PathComputationService;
15 import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations;
16 import org.opendaylight.transportpce.servicehandler.impl.ServicehandlerImpl;
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.openroadm.service.rev190531.ServiceCreateInput;
21 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceCreateOutput;
22 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceDeleteInput;
23 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceDeleteOutput;
24 import org.opendaylight.yangtools.yang.common.RpcResult;
25 import org.slf4j.Logger;
26 import org.slf4j.LoggerFactory;
27
28 public class ServiceHandlerOperationsImpl implements ServiceHandlerOperations {
29
30     private static final Logger LOG = LoggerFactory.getLogger(ServiceHandlerOperationsImpl.class);
31
32     private ServicehandlerImpl serviceHandler;
33
34     public ServiceHandlerOperationsImpl(DataBroker databroker, PathComputationService pathComputationService,
35         RendererServiceOperations rendererServiceOperations, NotificationPublishService notificationPublishService,
36         PceListenerImpl pceListenerImpl, RendererListenerImpl rendererListenerImpl,
37         NetworkModelListenerImpl networkModelListenerImpl, ServiceDataStoreOperations serviceDataStoreOperations) {
38         this.serviceHandler = new ServicehandlerImpl(databroker, pathComputationService, rendererServiceOperations,
39             notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
40             serviceDataStoreOperations);
41     }
42
43     @Override
44     public ServiceCreateOutput serviceCreate(ServiceCreateInput input) {
45         ListenableFuture<RpcResult<ServiceCreateOutput>> output = this.serviceHandler.serviceCreate(input);
46         ServiceCreateOutput outputresult = null;
47         try {
48             outputresult = output.get().getResult();
49         } catch (InterruptedException | ExecutionException e) {
50             LOG.error("Rpc service create failed", e);
51         }
52         return outputresult;
53     }
54
55     @Override
56     public ServiceDeleteOutput serviceDelete(ServiceDeleteInput input) {
57         return null;
58     }
59
60     public void init() {
61         LOG.info("init ServiceHandlerOperationsImpl...");
62     }
63
64     public void close() {
65         LOG.info("close ServiceHandlerOperationsImpl...");
66     }
67
68 }