2 * Copyright © 2017 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
9 package org.opendaylight.transportpce.stubrenderer;
11 import com.google.common.util.concurrent.ListenableFuture;
12 import com.google.common.util.concurrent.ListeningExecutorService;
14 import java.util.ArrayList;
15 import java.util.List;
16 import java.util.concurrent.Callable;
18 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.service.TopologyBuilder;
19 import org.opendaylight.yang.gen.v1.http.org.openroadm.topology.rev161014.topology.AToZ;
20 import org.opendaylight.yang.gen.v1.http.org.openroadm.topology.rev161014.topology.ZToA;
21 import org.slf4j.Logger;
22 import org.slf4j.LoggerFactory;
27 * - Service-implementation-request
28 * - Service-delete-request.
29 * @author Martial Coulibaly ( martial.coulibaly@gfi.com ) on behalf of Orange
32 public class SendingRendererRPCs {
34 private static final Logger LOG = LoggerFactory.getLogger(SendingRendererRPCs.class);
35 /** define procedure success (or not ). */
36 private Boolean success;
37 /** define type of request<br>
38 * <code>true</code> pathcomputation <br>
39 * <code>false</code> cancelresourcereserve. */
40 private TopologyBuilder topology;
41 private List<AToZ> atoz;
42 private List<ZToA> ztoa;
44 private final ListeningExecutorService executor;
46 public SendingRendererRPCs(ListeningExecutorService executor) {
49 this.executor = executor;
53 private void buildAtoZ() {
54 atoz = new ArrayList<AToZ>();
57 private void buildZtoA() {
58 ztoa = new ArrayList<ZToA>();
61 public ListenableFuture<Boolean> serviceDelete() {
62 LOG.info("ServiceDelete request ...");
64 return executor.submit(new Callable<Boolean>() {
66 public Boolean call() throws Exception {
67 Boolean output = true;
68 LOG.info("Wait for 10s til beginning the Renderer serviceDelete request");
70 Thread.sleep(10000); //sleep for 10s
71 } catch (InterruptedException e) {
73 LOG.error(e.toString());
83 public ListenableFuture<Boolean> serviceImplementation() {
84 LOG.info("serviceImplementation request ...");
86 return executor.submit(new Callable<Boolean>() {
88 public Boolean call() throws Exception {
89 Boolean output = true;
90 LOG.info("Wait for 10s til beginning the Renderer serviceDelete request");
92 Thread.sleep(10000); //sleep for 10s
93 } catch (InterruptedException e) {
95 LOG.error(e.toString());
99 setTopology(new TopologyBuilder()
109 public Boolean getSuccess() {
113 public void setSuccess(Boolean success) {
114 this.success = success;
117 public TopologyBuilder getTopology() {
121 public void setTopology(TopologyBuilder topo) {
122 this.topology = topo;
125 public String getError() {
129 public void setError(String error) {