Interface D creation. NetworkModel->ServiceHandler
[transportpce.git] / servicehandler / src / main / java / org / opendaylight / transportpce / servicehandler / service / ServiceHandlerOperationsImpl.java
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) {
38         this.serviceHandler = new ServicehandlerImpl(databroker, pathComputationService, rendererServiceOperations,
39             notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
40     }
41
42     @Override
43     public ServiceCreateOutput serviceCreate(ServiceCreateInput input) {
44         ListenableFuture<RpcResult<ServiceCreateOutput>> output = this.serviceHandler.serviceCreate(input);
45         ServiceCreateOutput outputresult = null;
46         try {
47             outputresult = output.get().getResult();
48         } catch (InterruptedException | ExecutionException e) {
49             LOG.error("Rpc service create failed", e);
50         }
51         return outputresult;
52     }
53
54     @Override
55     public ServiceDeleteOutput serviceDelete(ServiceDeleteInput input) {
56         return null;
57     }
58
59     public void init() {
60         LOG.info("init ServiceHandlerOperationsImpl...");
61     }
62
63     public void close() {
64         LOG.info("close ServiceHandlerOperationsImpl...");
65     }
66
67 }