2 * Copyright © 2018 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
8 package org.opendaylight.transportpce.servicehandler.stub;
10 import com.google.common.util.concurrent.ListenableFuture;
12 import java.util.concurrent.ExecutionException;
14 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
15 import org.opendaylight.transportpce.renderer.NetworkModelWavelengthService;
16 import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations;
17 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.ServiceDeleteInput;
18 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.ServiceDeleteOutput;
19 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.ServiceImplementationRequestInput;
20 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.ServiceImplementationRequestOutput;
21 import org.opendaylight.yangtools.yang.common.RpcResult;
22 import org.slf4j.Logger;
23 import org.slf4j.LoggerFactory;
25 public class StubRendererServiceOperations implements RendererServiceOperations {
26 private static final Logger LOG = LoggerFactory.getLogger(StubRendererServiceOperations.class);
27 private StubrendererImpl stubrendererImpl;
29 public StubRendererServiceOperations(NetworkModelWavelengthService networkModelWavelengthService,
30 DataBroker dataBroker) {
31 this.stubrendererImpl = new StubrendererImpl(networkModelWavelengthService, dataBroker);
35 public ServiceImplementationRequestOutput serviceImplementation(ServiceImplementationRequestInput input) {
36 ListenableFuture<RpcResult<ServiceImplementationRequestOutput>> rpcResultFuture =
37 this.stubrendererImpl.serviceImplementation(input);
39 return rpcResultFuture.get().getResult();
40 } catch (InterruptedException e) {
41 LOG.error("RPC serviceImplementation failed !",e);
42 } catch (ExecutionException e) {
43 LOG.error("RPC serviceImplementation failed !",e);
49 public ServiceDeleteOutput serviceDelete(ServiceDeleteInput input) {
50 ListenableFuture<RpcResult<ServiceDeleteOutput>> rpcResultFuture = this.stubrendererImpl.serviceDelete(input);
52 return rpcResultFuture.get().getResult();
53 } catch (InterruptedException e) {
54 LOG.error("RPC serviceDelete failed !",e);
55 } catch (ExecutionException e) {
56 LOG.error("RPC serviceDelete failed !",e);