TAPI topology creation for 100GE Transponder
[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
12 import java.util.concurrent.ExecutionException;
13
14 import org.opendaylight.mdsal.binding.api.DataBroker;
15 import org.opendaylight.mdsal.binding.api.NotificationPublishService;
16 import org.opendaylight.transportpce.pce.service.PathComputationService;
17 import org.opendaylight.transportpce.renderer.NetworkModelWavelengthService;
18 import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations;
19 import org.opendaylight.transportpce.servicehandler.impl.ServicehandlerImpl;
20 import org.opendaylight.transportpce.servicehandler.listeners.PceListenerImpl;
21 import org.opendaylight.transportpce.servicehandler.listeners.RendererListenerImpl;
22 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceCreateInput;
23 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceCreateOutput;
24 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceDeleteInput;
25 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceDeleteOutput;
26 import org.opendaylight.yangtools.yang.common.RpcResult;
27 import org.slf4j.Logger;
28 import org.slf4j.LoggerFactory;
29
30 public class ServiceHandlerOperationsImpl implements ServiceHandlerOperations {
31
32     private static final Logger LOG = LoggerFactory.getLogger(ServiceHandlerOperationsImpl.class);
33
34     private ServicehandlerImpl serviceHandler;
35
36     public ServiceHandlerOperationsImpl(DataBroker databroker, PathComputationService pathComputationService,
37         RendererServiceOperations rendererServiceOperations, NotificationPublishService notificationPublishService,
38         PceListenerImpl pceListenerImpl, RendererListenerImpl rendererListenerImpl,
39         NetworkModelWavelengthService networkModelWavelengthService) {
40         this.serviceHandler = new ServicehandlerImpl(databroker, pathComputationService, rendererServiceOperations,
41             notificationPublishService, pceListenerImpl, rendererListenerImpl,networkModelWavelengthService);
42     }
43
44     @Override
45     public ServiceCreateOutput serviceCreate(ServiceCreateInput input) {
46         ListenableFuture<RpcResult<ServiceCreateOutput>> output = this.serviceHandler.serviceCreate(input);
47         ServiceCreateOutput outputresult = null;
48         try {
49             outputresult = output.get().getResult();
50         } catch (InterruptedException | ExecutionException e) {
51             LOG.error("Rpc service create failed", e);
52         }
53         return outputresult;
54     }
55
56     @Override
57     public ServiceDeleteOutput serviceDelete(ServiceDeleteInput input) {
58         return null;
59     }
60
61     public void init() {
62         LOG.info("init ServiceHandlerOperationsImpl...");
63     }
64
65     public void close() {
66         LOG.info("close ServiceHandlerOperationsImpl...");
67     }
68
69 }