ServiceHandler Update
[transportpce.git] / servicehandler / src / main / java / org / opendaylight / transportpce / servicehandler / MappingAndSendingSIRequest.java
1 /*
2  * Copyright © 2017 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
9 package org.opendaylight.transportpce.servicehandler;
10
11 import com.google.common.util.concurrent.ListenableFuture;
12 import com.google.common.util.concurrent.ListeningExecutorService;
13 import com.google.common.util.concurrent.MoreExecutors;
14 import java.util.concurrent.Callable;
15 import java.util.concurrent.CancellationException;
16 import java.util.concurrent.ExecutionException;
17 import java.util.concurrent.Executors;
18 import java.util.concurrent.Future;
19
20 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
21 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.PathComputationRequestOutput;
22 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.ServiceDeleteInput;
23 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.ServiceDeleteInputBuilder;
24 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.ServiceDeleteOutput;
25 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.ServiceImplementationRequestInput;
26 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.ServiceImplementationRequestInputBuilder;
27 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.ServiceImplementationRequestOutput;
28 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.StubrendererService;
29 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.service.implementation.request.input.PathDescriptionBuilder;
30 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.service.implementation.request.input.ServiceAEnd;
31 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.service.implementation.request.input.ServiceAEndBuilder;
32 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.service.implementation.request.input.ServiceZEnd;
33 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.service.implementation.request.input.ServiceZEndBuilder;
34 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.ServiceFormat;
35 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceCreateInput;
36 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceReconfigureInput;
37 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.list.Services;
38 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.service.endpoint.sp.RxDirection;
39 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.service.endpoint.sp.RxDirectionBuilder;
40 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.service.endpoint.sp.TxDirection;
41 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.service.endpoint.sp.TxDirectionBuilder;
42 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.service.handler.header.ServiceHandlerHeaderBuilder;
43 import org.opendaylight.yangtools.yang.common.RpcResult;
44 import org.slf4j.Logger;
45 import org.slf4j.LoggerFactory;
46
47
48
49 /**
50  * Class for Mapping and Sending
51  * Service Implemention requests :
52  * - service implementation
53  * - service delete.
54  * @author Martial Coulibaly ( martial.coulibaly@gfi.com ) on behalf of Orange
55  *
56  */
57 public class MappingAndSendingSIRequest {
58     /** Logging. */
59     private static final Logger LOG = LoggerFactory.getLogger(MappingAndSendingSIRequest.class);
60     /** Permit to call Renderer RPCs. */
61     private StubrendererService service;
62     /** define procedure success (or not ). */
63     private Boolean success = false;
64     /** permit to call bundle service (PCE, Renderer, Servicehandler. */
65     private RpcProviderRegistry rpcRegistry;
66     /** store all error messages. */
67     private String error;
68     ServiceImplementationRequestInput serviceImplementationRequestInput = null;
69     ServiceDeleteInput serviceDeleteInput = null;
70
71     private final ListeningExecutorService executor = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(5));
72
73
74     /**
75      * MappingAndSendingSIRequest class constructor
76      * for RPC serviceCreate.
77      *
78      * @param rpcRegistry rpcRegistry
79      * @param serviceCreateInput serviceCreateInput
80      * @param pathComputationOutput pathComputationOutput
81      */
82     public MappingAndSendingSIRequest(RpcProviderRegistry rpcRegistry,
83             ServiceCreateInput serviceCreateInput,PathComputationRequestOutput pathComputationOutput) {
84         this.setRpcRegistry(rpcRegistry);
85         if (rpcRegistry != null) {
86             service = rpcRegistry.getRpcService(StubrendererService.class);
87         }
88         setSuccess(false);
89         setError("");
90
91         /** Building ServiceImplementationRequestInput  / ServiceDeleteInput serviceDeleteInput. */
92         ServiceHandlerHeaderBuilder serviceHandlerHeader = new ServiceHandlerHeaderBuilder();
93         if (serviceCreateInput.getSdncRequestHeader() != null) {
94             serviceHandlerHeader.setRequestId(serviceCreateInput.getSdncRequestHeader().getRequestId());
95         }
96         mappingSIRequest(pathComputationOutput, serviceHandlerHeader, serviceCreateInput.getServiceAEnd(),
97                 serviceCreateInput.getServiceZEnd(), serviceCreateInput.getServiceName());
98         /*
99
100         org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev161014
101             .service.create.input.ServiceAEnd tempA = serviceCreateInput.getServiceAEnd();
102
103         org.opendaylight.yang.gen.v1.http.org.openroadm.common
104             .service.types.rev161014.service.port.Port tempAPortRx =
105             serviceCreateInput.getServiceAEnd().getRxDirection().getPort();
106
107         org.opendaylight.yang.gen.v1.http.org.openroadm.common
108             .service.types.rev161014.service.port.Port tempAPortTx =
109             serviceCreateInput.getServiceAEnd().getTxDirection().getPort();
110
111         RxDirection rxDirectionAEnd = getRxDirection(tempAPortRx);
112
113         TxDirection txDirectionAEnd = getTxDirection(tempAPortTx);
114
115         ServiceAEnd serviceAEnd = new ServiceAEndBuilder()
116             .setClli(tempA.getClli())
117             .setNodeId(tempA.getNodeId())
118             .setServiceFormat(ServiceFormat.valueOf(tempA.getServiceFormat().getName()))
119             .setServiceRate(tempA.getServiceRate())
120             .setRxDirection(rxDirectionAEnd)
121             .setTxDirection(txDirectionAEnd)
122             .build();
123
124         org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev161014
125             .service.create.input.ServiceZEnd tempZ = serviceCreateInput.getServiceZEnd();
126
127         org.opendaylight.yang.gen.v1.http.org.openroadm.common
128             .service.types.rev161014.service.port.Port tempZPortRx =
129             serviceCreateInput.getServiceZEnd().getRxDirection().getPort();
130
131         org.opendaylight.yang.gen.v1.http.org.openroadm.common
132             .service.types.rev161014.service.port.Port tempZPortTx =
133             serviceCreateInput.getServiceZEnd().getTxDirection().getPort();
134
135         RxDirection rxDirectionZEnd = getRxDirection(tempZPortRx);
136
137         TxDirection txDirectionZEnd = getTxDirection(tempZPortTx);
138
139         ServiceZEnd serviceZEnd = new ServiceZEndBuilder()
140             .setClli(tempZ.getClli())
141             .setNodeId(tempZ.getNodeId())
142             .setServiceFormat(ServiceFormat.valueOf(tempZ.getServiceFormat().getName()))
143             .setServiceRate(tempZ.getServiceRate())
144             .setRxDirection(rxDirectionZEnd)
145             .setTxDirection(txDirectionZEnd)
146             .build();
147
148         org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types
149             .rev170426.response.parameters.sp.response.parameters.PathDescription tmp = null;
150         try {
151             tmp = pathComputationOutput.getResponseParameters().getPathDescription();
152         } catch (NullPointerException e) {
153             LOG.error("PathDescription is null : " + e.toString());
154         }
155         PathDescriptionBuilder pathDescription = new PathDescriptionBuilder();
156         if (tmp != null) {
157             pathDescription = new PathDescriptionBuilder(tmp);
158         }
159         serviceImplementationRequestInput  = new ServiceImplementationRequestInputBuilder()
160         .setPathDescription(pathDescription.build())
161         .setServiceHandlerHeader(serviceHandlerHeader.build())
162         .setServiceName(serviceCreateInput.getServiceName())
163         .setServiceAEnd(serviceAEnd)
164         .setServiceZEnd(serviceZEnd)
165         .build();*/
166
167         mappingSIRequest(pathComputationOutput, serviceHandlerHeader, serviceCreateInput.getServiceAEnd(),
168                 serviceCreateInput.getServiceZEnd(), serviceCreateInput.getServiceName());
169     }
170
171     /**
172      * MappingAndSendingSIRequest class constructor
173      * for RPC serviceReconfigure.
174      *
175      * @param rpcRegistry rpcRegistry
176      * @param serviceReconfigureInput serviceReconfigureInput
177      * @param pathComputationOutput pathComputationOutput
178      */
179
180     public MappingAndSendingSIRequest(RpcProviderRegistry rpcRegistry,
181             ServiceReconfigureInput serviceReconfigureInput,PathComputationRequestOutput pathComputationOutput) {
182         this.setRpcRegistry(rpcRegistry);
183         if (rpcRegistry != null) {
184             service = rpcRegistry.getRpcService(StubrendererService.class);
185         }
186         setSuccess(false);
187         setError("");
188
189         /** Building ServiceImplementationRequestInput  / ServiceDeleteInput serviceDeleteInput .*/
190         ServiceHandlerHeaderBuilder serviceHandlerHeader = new ServiceHandlerHeaderBuilder()
191                 .setRequestId("reconfigure_" + serviceReconfigureInput.getNewServiceName());
192         mappingSIRequest(pathComputationOutput, serviceHandlerHeader, serviceReconfigureInput.getServiceAEnd(),
193                 serviceReconfigureInput.getServiceZEnd(), serviceReconfigureInput.getNewServiceName());
194
195         /*
196         org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev161014
197             .service.reconfigure.input.ServiceAEnd tempA = serviceReconfigureInput.getServiceAEnd();
198
199         org.opendaylight.yang.gen.v1.http.org.openroadm.common
200             .service.types.rev161014.service.port.Port tempAPortRx =
201             serviceReconfigureInput.getServiceAEnd().getRxDirection().getPort();
202
203         org.opendaylight.yang.gen.v1.http.org.openroadm.common
204             .service.types.rev161014.service.port.Port tempAPortTx =
205             serviceReconfigureInput.getServiceAEnd().getTxDirection().getPort();
206
207         RxDirection rxDirectionAEnd = getRxDirection(tempAPortRx);
208
209         TxDirection txDirectionAEnd = getTxDirection(tempAPortTx);
210
211         ServiceAEnd serviceAEnd = new ServiceAEndBuilder()
212             .setClli(tempA.getClli())
213             .setNodeId(tempA.getNodeId())
214             .setServiceFormat(ServiceFormat.valueOf(tempA.getServiceFormat().getName()))
215             .setServiceRate(tempA.getServiceRate())
216             .setRxDirection(rxDirectionAEnd)
217             .setTxDirection(txDirectionAEnd)
218             .build();
219
220         org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev161014
221             .service.reconfigure.input.ServiceZEnd tempZ = serviceReconfigureInput.getServiceZEnd();
222
223         org.opendaylight.yang.gen.v1.http.org.openroadm.common
224             .service.types.rev161014.service.port.Port tempZPortRx =
225             serviceReconfigureInput.getServiceZEnd().getRxDirection().getPort();
226
227         org.opendaylight.yang.gen.v1.http.org.openroadm.common
228             .service.types.rev161014.service.port.Port tempZPortTx =
229             serviceReconfigureInput.getServiceZEnd().getTxDirection().getPort();
230
231
232         RxDirection rxDirectionZEnd = getRxDirection(tempZPortRx);
233         TxDirection txDirectionZEnd = getTxDirection(tempZPortTx);
234
235         ServiceZEnd serviceZEnd = new ServiceZEndBuilder()
236             .setClli(tempZ.getClli())
237             .setNodeId(tempZ.getNodeId())
238             .setServiceFormat(ServiceFormat.valueOf(tempZ.getServiceFormat().getName()))
239             .setServiceRate(tempZ.getServiceRate())
240             .setRxDirection(rxDirectionZEnd)
241             .setTxDirection(txDirectionZEnd)
242             .build();
243
244         org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types
245             .rev170426.response.parameters.sp.response.parameters.PathDescription tmp = null;
246         try {
247             tmp = pathComputationOutput.getResponseParameters().getPathDescription();
248         } catch (NullPointerException e) {
249             LOG.error("PathDescription is null : " + e.toString());
250         }
251         PathDescriptionBuilder pathDescription = new PathDescriptionBuilder();
252         if (tmp != null) {
253             pathDescription = new PathDescriptionBuilder(tmp);
254         }
255         serviceImplementationRequestInput  = new ServiceImplementationRequestInputBuilder()
256         .setPathDescription(pathDescription.build())
257         .setServiceHandlerHeader(serviceHandlerHeader.build())
258         .setServiceName(serviceReconfigureInput.getNewServiceName())
259         .setServiceAEnd(serviceAEnd)
260         .setServiceZEnd(serviceZEnd)
261         .build();
262         LOG.info("ServiceImplementationRequestInput : " + serviceImplementationRequestInput.toString());*/
263     }
264
265
266     /**
267      * MappingAndSendingSIRequest class constructor
268      * for RPC serviceDelete.
269      *
270      * @param rpcRegistry RpcProviderRegistry
271      * @param requestId Request ID
272      * @param serviceName Service name
273      */
274     public MappingAndSendingSIRequest(RpcProviderRegistry rpcRegistry,String requestId, String serviceName) {
275         this.setRpcRegistry(rpcRegistry);
276         if (rpcRegistry != null) {
277             service = rpcRegistry.getRpcService(StubrendererService.class);
278         }
279         setSuccess(false);
280         setError("");
281
282         /** ServiceDeleteInput Build .*/
283         ServiceHandlerHeaderBuilder serviceHandlerHeader = new ServiceHandlerHeaderBuilder();
284         if (requestId != null) {
285             serviceHandlerHeader.setRequestId(requestId);
286         }
287
288         serviceDeleteInput = new ServiceDeleteInputBuilder()
289                 .setServiceHandlerHeader(serviceHandlerHeader.build())
290                 .setServiceName(serviceName)
291                 .build();
292     }
293
294     /**
295      * MappingAndSendingSIRequest Class constructor
296      * for modify Service in ODL Datastore.
297      *
298      * @param rpcRegistry RpcProviderRegistry
299      * @param services Services
300      * @param pathComputationOutput PathComputationRequestOutput
301      */
302     public MappingAndSendingSIRequest(RpcProviderRegistry rpcRegistry,Services services,
303             PathComputationRequestOutput pathComputationOutput) {
304         this.setRpcRegistry(rpcRegistry);
305         if (rpcRegistry != null) {
306             service = rpcRegistry.getRpcService(StubrendererService.class);
307         }
308         setSuccess(false);
309         setError("");
310
311         /** Building ServiceImplementationRequestInput  / ServiceDeleteInput serviceDeleteInput .*/
312         ServiceHandlerHeaderBuilder serviceHandlerHeader = new ServiceHandlerHeaderBuilder();
313         mappingSIRequest(pathComputationOutput, serviceHandlerHeader, services.getServiceAEnd(),
314                 services.getServiceZEnd(), services.getServiceName());
315         /*org.opendaylight.yang.gen.v1.http.org.openroadm.common.service
316             .types.rev161014.service.ServiceAEnd tempA = services.getServiceAEnd();
317
318         org.opendaylight.yang.gen.v1.http.org.openroadm.common
319             .service.types.rev161014.service.port.Port tempAPortRx = tempA.getRxDirection().getPort();
320
321         org.opendaylight.yang.gen.v1.http.org.openroadm.common
322             .service.types.rev161014.service.port.Port tempAPortTx = tempA.getTxDirection().getPort();
323
324
325         RxDirection rxDirectionAEnd = getRxDirection(tempAPortRx);
326
327         TxDirection txDirectionAEnd = getTxDirection(tempAPortTx);
328
329         ServiceAEnd serviceAEnd = new ServiceAEndBuilder()
330             .setClli(tempA.getClli())
331             .setNodeId(tempA.getNodeId())
332             .setServiceFormat(ServiceFormat.valueOf(tempA.getServiceFormat().getName()))
333             .setServiceRate(tempA.getServiceRate())
334             .setRxDirection(rxDirectionAEnd)
335             .setTxDirection(txDirectionAEnd)
336             .build();
337         org.opendaylight.yang.gen.v1.http.org.openroadm.common.service
338             .types.rev161014.service.ServiceZEnd tempZ = services.getServiceZEnd();
339
340         org.opendaylight.yang.gen.v1.http.org.openroadm.common
341             .service.types.rev161014.service.port.Port tempZPortRx = tempZ.getRxDirection().getPort();
342
343         org.opendaylight.yang.gen.v1.http.org.openroadm.common
344             .service.types.rev161014.service.port.Port tempZPortTx = tempZ.getTxDirection().getPort();
345
346         RxDirection rxDirectionZEnd = getRxDirection(tempZPortRx);
347         TxDirection txDirectionZEnd = getTxDirection(tempZPortTx);
348
349         ServiceZEnd serviceZEnd = new ServiceZEndBuilder()
350             .setClli(tempZ.getClli())
351             .setNodeId(tempZ.getNodeId())
352             .setServiceFormat(ServiceFormat.valueOf(tempZ.getServiceFormat().getName()))
353             .setServiceRate(tempZ.getServiceRate())
354             .setRxDirection(rxDirectionZEnd)
355             .setTxDirection(txDirectionZEnd)
356             .build();
357         org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types
358         .rev170426.response.parameters.sp.response.parameters.PathDescription tmp = null;
359         try {
360             tmp = pathComputationOutput.getResponseParameters().getPathDescription();
361         } catch (NullPointerException e) {
362             LOG.error("PathDescription is null : " + e.toString());
363         }
364         PathDescriptionBuilder pathDescription = new PathDescriptionBuilder();
365         if (tmp != null) {
366             pathDescription = new PathDescriptionBuilder(tmp);
367         }
368
369         serviceImplementationRequestInput  = new ServiceImplementationRequestInputBuilder()
370         .setPathDescription(pathDescription.build())
371         .setServiceHandlerHeader(serviceHandlerHeader.build())
372         .setServiceName(services.getServiceName())
373         .setServiceAEnd(serviceAEnd)
374         .setServiceZEnd(serviceZEnd)
375         .build();
376         LOG.info("ServiceImplementationRequestInput : " + serviceImplementationRequestInput.toString());*/
377     }
378
379     /**
380      *Build serviceImplementationRequestInput with
381      *input parameters from ServiceCreateInput or
382      *Services or serviceReconfigureInput.
383      *
384      * @param pathComputationOutput PathComputationRequestOutput
385      * @param serviceHandlerHeader ServiceHandlerHeaderBuilder
386      * @param aend Beginning ServiceEndpoint
387      * @param zend Ending ServiceEndpoint
388      * @param serviceName Service Name
389      */
390     private void mappingSIRequest(PathComputationRequestOutput pathComputationOutput,
391             ServiceHandlerHeaderBuilder serviceHandlerHeader, org.opendaylight.yang.gen .v1.http.org.openroadm.common
392             .service.types.rev161014.ServiceEndpoint aend , org.opendaylight.yang.gen.v1.http.org.openroadm.common
393             .service.types.rev161014.ServiceEndpoint zend, String serviceName) {
394         LOG.info("Mapping ServiceCreateInput or Services or serviceReconfigureInput to SIR requests");
395         /** ServiceAEnd Build. */
396         RxDirection rxDirectionAEnd = new RxDirectionBuilder()
397                 .setPort(aend.getRxDirection().getPort())
398                 .build();
399         TxDirection txDirectionAEnd = new TxDirectionBuilder()
400                 .setPort(aend.getTxDirection().getPort())
401                 .build();
402
403         ServiceAEnd serviceAEnd = new ServiceAEndBuilder()
404                 .setClli(aend.getClli())
405                 .setNodeId(aend.getNodeId())
406                 .setServiceFormat(ServiceFormat.valueOf(aend.getServiceFormat().getName()))
407                 .setServiceRate(aend.getServiceRate())
408                 .setRxDirection(rxDirectionAEnd)
409                 .setTxDirection(txDirectionAEnd)
410                 .build();
411
412         /** ServiceZEnd Build. */
413         RxDirection rxDirectionZEnd = new RxDirectionBuilder()
414                 .setPort(zend.getRxDirection().getPort())
415                 .build();
416
417         TxDirection txDirectionZEnd = new TxDirectionBuilder()
418                 .setPort(zend.getTxDirection().getPort())
419                 .build();
420
421         ServiceZEnd serviceZEnd = new ServiceZEndBuilder()
422                 .setClli(zend.getClli())
423                 .setNodeId(zend.getNodeId())
424                 .setServiceFormat(ServiceFormat.valueOf(zend.getServiceFormat().getName()))
425                 .setServiceRate(zend.getServiceRate())
426                 .setRxDirection(rxDirectionZEnd)
427                 .setTxDirection(txDirectionZEnd)
428                 .build();
429
430
431         /** ServiceImplementationRequestInput  Build. */
432         org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types
433             .rev170426.response.parameters.sp.response.parameters.PathDescription tmp = null;
434         try {
435             tmp = pathComputationOutput.getResponseParameters().getPathDescription();
436         } catch (NullPointerException e) {
437             LOG.error("PathDescription is null : " + e.toString());
438         }
439         PathDescriptionBuilder pathDescription = new PathDescriptionBuilder();
440         if (tmp != null) {
441             pathDescription = new PathDescriptionBuilder(tmp);
442         }
443         serviceImplementationRequestInput  = new ServiceImplementationRequestInputBuilder()
444                 .setPathDescription(pathDescription.build())
445                 .setServiceHandlerHeader(serviceHandlerHeader.build())
446                 .setServiceName(serviceName)
447                 .setServiceAEnd(serviceAEnd)
448                 .setServiceZEnd(serviceZEnd)
449                 .build();
450
451     }
452
453     /**
454      * Send serviceImplementation request to Render.
455      *
456      * @return ServiceImplementationRequestOutput data response from Renderer
457      */
458     public ListenableFuture<Boolean> serviceImplementation() {
459         setSuccess(false);
460         return executor.submit(new Callable<Boolean>() {
461             @Override
462             public Boolean call() throws Exception {
463                 Boolean output = null;
464                 if (serviceImplementationRequestInput != null) {
465                     RpcResult<ServiceImplementationRequestOutput> rendererOutputResult = null;
466                     Future<RpcResult<ServiceImplementationRequestOutput>> rendererOutputFuture =
467                             service.serviceImplementationRequest(serviceImplementationRequestInput);
468                     try {
469                         rendererOutputResult = rendererOutputFuture.get();//wait to get  the result
470                     } catch (InterruptedException | CancellationException | ExecutionException e) {
471                         setError("Did not receive the expected response from renderer to pathComputationRequest RPC "
472                                 + e.toString());
473                         LOG.error(error);
474                         rendererOutputFuture.cancel(true);
475                     }
476
477                     if (rendererOutputResult != null && rendererOutputResult.isSuccessful()) {
478                         LOG.info("Renderer replied to serviceImplementation Request !");
479                         setSuccess(true);
480                         output = true;
481                         setSuccess(true);
482                     }
483                 } else {
484                     LOG.info("serviceImplementationRequestInput is not valid");
485                 }
486
487                 return output;
488             }
489         });
490
491     }
492
493     /**
494      * Send serviceDelete request to Render.
495      *
496      * @return ServiceDeleteOutput data response from Renderer
497      */
498     public ListenableFuture<Boolean> serviceDelete() {
499         setSuccess(false);
500         return executor.submit(new Callable<Boolean>() {
501             @Override
502             public Boolean call() throws Exception {
503                 Boolean output = null;
504                 if (serviceDeleteInput != null) {
505                     RpcResult<ServiceDeleteOutput> rendererOutputResult = null;
506                     Future<RpcResult<ServiceDeleteOutput>> rendererOutputFuture =
507                             service.serviceDelete(serviceDeleteInput);
508                     try {
509                         rendererOutputResult = rendererOutputFuture.get();//wait to get  the result
510                     } catch (InterruptedException | CancellationException | ExecutionException e) {
511                         setError("Did not receive the expected response from renderer to pathComputationRequest RPC "
512                                 + e.toString());
513                         LOG.error(error);
514                         rendererOutputFuture.cancel(true);
515                     }
516
517                     if (rendererOutputResult != null && rendererOutputResult.isSuccessful()) {
518                         LOG.info("Renderer replied to serviceDelete Request!");
519                         setSuccess(true);
520                         output = true;
521                     }
522                 }
523                 return output;
524             }
525         });
526
527     }
528
529
530     public Boolean getSuccess() {
531         return success;
532     }
533
534     public void setSuccess(Boolean success) {
535         this.success = success;
536     }
537
538     public String getError() {
539         return error;
540     }
541
542     public void setError(String error) {
543         this.error = error;
544     }
545
546     public RpcProviderRegistry getRpcRegistry() {
547         return rpcRegistry;
548     }
549
550     public void setRpcRegistry(RpcProviderRegistry rpcRegistry) {
551         this.rpcRegistry = rpcRegistry;
552     }
553
554 }