Update Functional tests for SP1.6
[transportpce.git] / servicehandler / src / main / java / org / opendaylight / transportpce / servicehandler / stub / StubRendererServiceOperations.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.stub;
9
10 import com.google.common.util.concurrent.ListenableFuture;
11 import java.util.concurrent.ExecutionException;
12 import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations;
13 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.ServiceDeleteInput;
14 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.ServiceDeleteOutput;
15 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.ServiceImplementationRequestInput;
16 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.ServiceImplementationRequestOutput;
17 import org.opendaylight.yangtools.yang.common.RpcResult;
18 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory;
20
21 public class StubRendererServiceOperations implements RendererServiceOperations {
22     private static final Logger LOG = LoggerFactory.getLogger(StubRendererServiceOperations.class);
23
24     @Override
25     public ServiceImplementationRequestOutput serviceImplementation(ServiceImplementationRequestInput input) {
26         ListenableFuture<RpcResult<ServiceImplementationRequestOutput>> rpcResultFuture = StubrendererImpl
27                 .serviceImplementation(input);
28         try {
29             return rpcResultFuture.get().getResult();
30         } catch (InterruptedException e) {
31             LOG.error("RPC serviceImplementation failed !",e);
32         } catch (ExecutionException e) {
33             LOG.error("RPC serviceImplementation failed !",e);
34         }
35         return null;
36     }
37
38     @Override
39     public ServiceDeleteOutput serviceDelete(ServiceDeleteInput input) {
40         ListenableFuture<RpcResult<ServiceDeleteOutput>> rpcResultFuture = StubrendererImpl.serviceDelete(input);
41         try {
42             return rpcResultFuture.get().getResult();
43         } catch (InterruptedException e) {
44             LOG.error("RPC serviceDelete failed !",e);
45         } catch (ExecutionException e) {
46             LOG.error("RPC serviceDelete failed !",e);
47         }
48         return null;
49     }
50 }