2 * Copyright © 2019 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.impl;
10 import static org.mockito.ArgumentMatchers.any;
11 import static org.opendaylight.transportpce.servicehandler.impl.ServicehandlerImpl.LogMessages;
13 import com.google.common.util.concurrent.Futures;
14 import com.google.common.util.concurrent.ListenableFuture;
15 import com.google.common.util.concurrent.ListeningExecutorService;
16 import com.google.common.util.concurrent.MoreExecutors;
17 import java.util.concurrent.CountDownLatch;
18 import java.util.concurrent.ExecutionException;
19 import java.util.concurrent.Executors;
20 import org.junit.Assert;
21 import org.junit.Before;
22 import org.junit.Test;
23 import org.mockito.Mock;
24 import org.mockito.Mockito;
25 import org.mockito.MockitoAnnotations;
26 import org.opendaylight.mdsal.binding.api.DataBroker;
27 import org.opendaylight.mdsal.binding.api.NotificationPublishService;
28 import org.opendaylight.transportpce.common.ResponseCodes;
29 import org.opendaylight.transportpce.pce.service.PathComputationService;
30 import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations;
31 import org.opendaylight.transportpce.servicehandler.listeners.NetworkModelListenerImpl;
32 import org.opendaylight.transportpce.servicehandler.listeners.PceListenerImpl;
33 import org.opendaylight.transportpce.servicehandler.listeners.RendererListenerImpl;
34 import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperationsImpl;
35 import org.opendaylight.transportpce.servicehandler.utils.ServiceDataUtils;
36 import org.opendaylight.transportpce.test.AbstractTest;
37 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev190531.RpcStatus;
38 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceCreateInput;
39 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceCreateInputBuilder;
40 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceCreateOutput;
41 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceDeleteInput;
42 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceDeleteInputBuilder;
43 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceDeleteOutput;
44 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceFeasibilityCheckInput;
45 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceFeasibilityCheckInputBuilder;
46 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceFeasibilityCheckOutput;
47 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceReconfigureInput;
48 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceReconfigureInputBuilder;
49 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceReconfigureOutput;
50 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceRerouteInput;
51 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceRerouteInputBuilder;
52 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceRerouteOutput;
53 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceRestorationInput;
54 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceRestorationInputBuilder;
55 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceRestorationOutput;
56 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.TempServiceCreateInput;
57 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.TempServiceCreateInputBuilder;
58 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.TempServiceCreateOutput;
59 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.TempServiceDeleteInput;
60 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.TempServiceDeleteInputBuilder;
61 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.TempServiceDeleteOutput;
62 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.delete.input.ServiceDeleteReqInfoBuilder;
63 import org.opendaylight.yangtools.yang.common.RpcResult;
65 public class ServicehandlerImplTest extends AbstractTest {
68 private PathComputationService pathComputationService;
71 private RendererServiceOperations rendererServiceOperations;
74 private NotificationPublishService notificationPublishService;
77 private PceListenerImpl pceListenerImpl;
80 private RendererListenerImpl rendererListenerImpl;
83 private NetworkModelListenerImpl networkModelListenerImpl;
85 private ListeningExecutorService executorService;
86 private CountDownLatch endSignal;
87 private static final int NUM_THREADS = 5;
88 private boolean callbackRan;
92 executorService = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(NUM_THREADS));
93 endSignal = new CountDownLatch(1);
95 MockitoAnnotations.initMocks(this);
99 public void createServiceShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
100 ServicehandlerImpl servicehandlerImpl =
101 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
102 notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
103 ListenableFuture<RpcResult<ServiceCreateOutput>> result =
104 servicehandlerImpl.serviceCreate(new ServiceCreateInputBuilder().build());
105 result.addListener(new Runnable() {
109 endSignal.countDown();
115 RpcResult<ServiceCreateOutput> rpcResult = result.get();
117 ResponseCodes.RESPONSE_FAILED, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
121 public void createServiceShouldBeSuccessfulWhenPreformPCESuccessful()
122 throws ExecutionException, InterruptedException {
123 ServiceCreateInput input = ServiceDataUtils.buildServiceCreateInput();
124 Mockito.when(pathComputationService.pathComputationRequest(any())).thenReturn(Futures.immediateFuture(any()));
125 ServicehandlerImpl servicehandlerImpl =
126 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
127 notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
128 ListenableFuture<RpcResult<ServiceCreateOutput>> result = servicehandlerImpl.serviceCreate(input);
129 result.addListener(new Runnable() {
133 endSignal.countDown();
139 RpcResult<ServiceCreateOutput> rpcResult = result.get();
141 ResponseCodes.RESPONSE_OK, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
145 public void deleteServiceShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
146 ServicehandlerImpl servicehandlerImpl =
147 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
148 notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
149 ListenableFuture<RpcResult<ServiceDeleteOutput>> result =
150 servicehandlerImpl.serviceDelete(new ServiceDeleteInputBuilder()
151 .setServiceDeleteReqInfo(new ServiceDeleteReqInfoBuilder().setServiceName("").build()).build());
152 result.addListener(new Runnable() {
156 endSignal.countDown();
162 RpcResult<ServiceDeleteOutput> rpcResult = result.get();
164 ResponseCodes.RESPONSE_FAILED, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
168 public void deleteServiceShouldBeFailedWithNonExistService() throws ExecutionException, InterruptedException {
169 ServiceDeleteInput input = ServiceDataUtils.buildServiceDeleteInput();
170 ServicehandlerImpl servicehandlerImpl =
171 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
172 notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
173 ListenableFuture<RpcResult<ServiceDeleteOutput>> result = servicehandlerImpl.serviceDelete(input);
174 result.addListener(new Runnable() {
178 endSignal.countDown();
184 RpcResult<ServiceDeleteOutput> rpcResult = result.get();
186 ResponseCodes.RESPONSE_FAILED, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
190 public void deleteServiceShouldBeSuccessForExistingService() throws ExecutionException, InterruptedException {
191 DataBroker dataBroker = getNewDataBroker();
192 Mockito.when(rendererServiceOperations.serviceDelete(any(), any())).thenReturn(Futures.immediateFuture(any()));
193 ServicehandlerImpl servicehandlerImpl =
194 new ServicehandlerImpl(dataBroker, pathComputationService, rendererServiceOperations,
195 notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
196 ServiceDataStoreOperationsImpl serviceDataStoreOperations = new ServiceDataStoreOperationsImpl(dataBroker);
197 ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
198 serviceDataStoreOperations.createService(createInput);
199 ServiceDeleteInput input = ServiceDataUtils.buildServiceDeleteInput();
200 ListenableFuture<RpcResult<ServiceDeleteOutput>> result = servicehandlerImpl.serviceDelete(input);
201 result.addListener(new Runnable() {
205 endSignal.countDown();
211 RpcResult<ServiceDeleteOutput> rpcResult = result.get();
213 ResponseCodes.RESPONSE_OK, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
218 public void serviceFeasibilityCheckShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
219 ServicehandlerImpl servicehandlerImpl =
220 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
221 notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
222 ListenableFuture<RpcResult<ServiceFeasibilityCheckOutput>> result =
223 servicehandlerImpl.serviceFeasibilityCheck(new ServiceFeasibilityCheckInputBuilder().build());
224 result.addListener(new Runnable() {
228 endSignal.countDown();
234 RpcResult<ServiceFeasibilityCheckOutput> rpcResult = result.get();
236 ResponseCodes.RESPONSE_FAILED, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
240 public void serviceFeasibilityCheckShouldBeSuccessfulWhenPreformPCESuccessful()
241 throws ExecutionException, InterruptedException {
242 ServiceFeasibilityCheckInput input = ServiceDataUtils.buildServiceFeasibilityCheckInput();
243 Mockito.when(pathComputationService.pathComputationRequest(any())).thenReturn(Futures.immediateFuture(any()));
244 ServicehandlerImpl servicehandlerImpl =
245 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
246 notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
247 ListenableFuture<RpcResult<ServiceFeasibilityCheckOutput>> result =
248 servicehandlerImpl.serviceFeasibilityCheck(input);
249 result.addListener(new Runnable() {
253 endSignal.countDown();
259 RpcResult<ServiceFeasibilityCheckOutput> rpcResult = result.get();
261 ResponseCodes.RESPONSE_OK, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
265 public void serviceReconfigureShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
266 ServicehandlerImpl servicehandlerImpl =
267 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
268 notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
269 ListenableFuture<RpcResult<ServiceReconfigureOutput>> result =
270 servicehandlerImpl.serviceReconfigure(new ServiceReconfigureInputBuilder().setServiceName("").build());
271 result.addListener(new Runnable() {
275 endSignal.countDown();
281 RpcResult<ServiceReconfigureOutput> rpcResult = result.get();
283 RpcStatus.Failed, rpcResult.getResult().getStatus());
288 public void serviceReconfigureShouldBeFailedWithNonExistService() throws ExecutionException, InterruptedException {
289 ServiceReconfigureInput input = ServiceDataUtils.buildServiceReconfigureInput();
291 //action -> service reconfigure
292 ServicehandlerImpl servicehandlerImpl =
293 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
294 notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
295 ListenableFuture<RpcResult<ServiceReconfigureOutput>> result = servicehandlerImpl.serviceReconfigure(input);
297 result.addListener(new Runnable() {
301 endSignal.countDown();
307 RpcResult<ServiceReconfigureOutput> rpcResult = result.get();
308 //ServiceReconfigureOutput doesn't have ConfigurationResponseCommon but have RpcStatus directly
310 RpcStatus.Failed, rpcResult.getResult().getStatus());
314 public void serviceReconfigureShouldBeSuccessForExistingService() throws ExecutionException, InterruptedException {
315 DataBroker dataBroker = getNewDataBroker();
318 // serviceReconfigure is calling service delete method in renderer
319 Mockito.when(rendererServiceOperations.serviceDelete(any(), any())).thenReturn(Futures.immediateFuture(any()));
320 //create service to reconfigure
321 ServicehandlerImpl servicehandlerImpl =
322 new ServicehandlerImpl(dataBroker, pathComputationService, rendererServiceOperations,
323 notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
324 ServiceDataStoreOperationsImpl serviceDataStoreOperations = new ServiceDataStoreOperationsImpl(dataBroker);
325 ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
326 serviceDataStoreOperations.createService(createInput);
328 //service reconfigure test action
329 ServiceReconfigureInput input = ServiceDataUtils.buildServiceReconfigureInput();
330 //ServiceReconfigureInput is created with the same service information that is created before
331 ListenableFuture<RpcResult<ServiceReconfigureOutput>> result = servicehandlerImpl.serviceReconfigure(input);
332 result.addListener(new Runnable() {
336 endSignal.countDown();
342 RpcResult<ServiceReconfigureOutput> rpcResult = result.get();
344 RpcStatus.Successful, rpcResult.getResult().getStatus());
348 public void serviceReRestorationShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
349 ServicehandlerImpl servicehandlerImpl =
350 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
351 notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
352 ListenableFuture<RpcResult<ServiceRestorationOutput>> result =
353 servicehandlerImpl.serviceRestoration(new ServiceRestorationInputBuilder().setServiceName("").build());
354 result.addListener(new Runnable() {
358 endSignal.countDown();
364 RpcResult<ServiceRestorationOutput> rpcResult = result.get();
366 RpcStatus.Failed, rpcResult.getResult().getStatus());
371 public void serviceRestorationShouldBeFailedWithNonExistService() throws ExecutionException, InterruptedException {
372 ServiceRestorationInput input = ServiceDataUtils.buildServiceRestorationInput();
374 //action -> service restore
375 ServicehandlerImpl servicehandlerImpl =
376 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
377 notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
378 ListenableFuture<RpcResult<ServiceRestorationOutput>> result = servicehandlerImpl.serviceRestoration(input);
380 result.addListener(new Runnable() {
384 endSignal.countDown();
390 RpcResult<ServiceRestorationOutput> rpcResult = result.get();
391 //ServiceRestorationOutput doesn't have ConfigurationResponseCommon but have RpcStatus directly
393 RpcStatus.Failed, rpcResult.getResult().getStatus());
397 public void serviceRestorationShouldBeSuccessForExistingService() throws ExecutionException, InterruptedException {
398 DataBroker dataBroker = getNewDataBroker();
401 // serviceRestoration is calling service delete method in renderer
402 Mockito.when(rendererServiceOperations.serviceDelete(any(), any())).thenReturn(Futures.immediateFuture(any()));
403 //create service to restore
404 ServicehandlerImpl servicehandlerImpl =
405 new ServicehandlerImpl(dataBroker, pathComputationService, rendererServiceOperations,
406 notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
407 ServiceDataStoreOperationsImpl serviceDataStoreOperations = new ServiceDataStoreOperationsImpl(dataBroker);
408 ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
409 serviceDataStoreOperations.createService(createInput);
411 //service Restoration test action
412 ServiceRestorationInput input = ServiceDataUtils.buildServiceRestorationInput();
413 //ServiceRestorationInput is created with the same service information that is created before
414 ListenableFuture<RpcResult<ServiceRestorationOutput>> result = servicehandlerImpl.serviceRestoration(input);
415 result.addListener(new Runnable() {
419 endSignal.countDown();
425 RpcResult<ServiceRestorationOutput> rpcResult = result.get();
427 RpcStatus.Successful, rpcResult.getResult().getStatus());
431 public void serviceRerouteShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
432 ServicehandlerImpl servicehandlerImpl =
433 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
434 notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
435 ListenableFuture<RpcResult<ServiceRerouteOutput>> result =
436 servicehandlerImpl.serviceReroute(new ServiceRerouteInputBuilder().setServiceName("").build());
437 result.addListener(new Runnable() {
441 endSignal.countDown();
447 RpcResult<ServiceRerouteOutput> rpcResult = result.get();
449 RpcStatus.Failed, rpcResult.getResult().getStatus());
453 public void serviceRerouteShouldBeFailedWithNonExistService() throws ExecutionException, InterruptedException {
454 ServiceRerouteInput input = ServiceDataUtils.buildServiceRerouteInput();
456 //action -> service reconfigure
457 ServicehandlerImpl servicehandlerImpl =
458 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
459 notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
460 ListenableFuture<RpcResult<ServiceRerouteOutput>> result = servicehandlerImpl.serviceReroute(input);
462 result.addListener(new Runnable() {
466 endSignal.countDown();
472 RpcResult<ServiceRerouteOutput> rpcResult = result.get();
473 //ServiceRerouteOutput doesn't have ConfigurationResponseCommon but have RpcStatus directly
475 RpcStatus.Failed, rpcResult.getResult().getStatus());
479 public void serviceRerouteShouldBeSuccessForExistingService() throws ExecutionException, InterruptedException {
480 DataBroker dataBroker = getNewDataBroker();
483 // serviceReroute is calling service delete method in renderer
484 Mockito.when(rendererServiceOperations.serviceDelete(any(), any())).thenReturn(Futures.immediateFuture(any()));
485 //create service to be rerouted later
486 ServicehandlerImpl servicehandlerImpl =
487 new ServicehandlerImpl(dataBroker, pathComputationService, rendererServiceOperations,
488 notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
489 ServiceDataStoreOperationsImpl serviceDataStoreOperations = new ServiceDataStoreOperationsImpl(dataBroker);
490 ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
491 serviceDataStoreOperations.createService(createInput);
493 //service reroute test action
494 ServiceRerouteInput input = ServiceDataUtils.buildServiceRerouteInput();
495 //ServiceRerouteInput is created with the same service information that is created before
496 ListenableFuture<RpcResult<ServiceRerouteOutput>> result = servicehandlerImpl.serviceReroute(input);
497 result.addListener(new Runnable() {
501 endSignal.countDown();
507 RpcResult<ServiceRerouteOutput> rpcResult = result.get();
509 RpcStatus.Successful, rpcResult.getResult().getStatus());
513 public void tempServiceDeleteShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
514 ServicehandlerImpl servicehandlerImpl =
515 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
516 notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
517 ListenableFuture<RpcResult<TempServiceDeleteOutput>> result =
518 servicehandlerImpl.tempServiceDelete(new TempServiceDeleteInputBuilder()
519 .setCommonId("").build());
520 result.addListener(new Runnable() {
524 endSignal.countDown();
530 RpcResult<TempServiceDeleteOutput> rpcResult = result.get();
532 ResponseCodes.RESPONSE_FAILED, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
534 LogMessages.SERVICE_NON_COMPLIANT,
535 rpcResult.getResult().getConfigurationResponseCommon().getResponseMessage());
539 public void tempServiceDeleteShouldBeFailedWithNonExistService() throws ExecutionException, InterruptedException {
540 TempServiceDeleteInput input = ServiceDataUtils.buildTempServiceDeleteInput();
541 ServicehandlerImpl servicehandlerImpl =
542 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
543 notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
544 ListenableFuture<RpcResult<TempServiceDeleteOutput>> result = servicehandlerImpl.tempServiceDelete(input);
545 result.addListener(new Runnable() {
549 endSignal.countDown();
555 RpcResult<TempServiceDeleteOutput> rpcResult = result.get();
557 ResponseCodes.RESPONSE_FAILED, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
561 public void tempServiceDeleteShouldBeSuccessForExistingService() throws ExecutionException, InterruptedException {
562 DataBroker dataBroker = getNewDataBroker();
563 Mockito.when(rendererServiceOperations.serviceDelete(any(), any())).thenReturn(Futures.immediateFuture(any()));
565 //create temp service to delete in the temp delete action
566 ServicehandlerImpl servicehandlerImpl =
567 new ServicehandlerImpl(dataBroker, pathComputationService, rendererServiceOperations,
568 notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
569 ServiceDataStoreOperationsImpl serviceDataStoreOperations = new ServiceDataStoreOperationsImpl(dataBroker);
570 TempServiceCreateInput createInput = ServiceDataUtils.buildTempServiceCreateInput();
571 serviceDataStoreOperations.createTempService(createInput);
574 TempServiceDeleteInput input = ServiceDataUtils.buildTempServiceDeleteInput(createInput.getCommonId());
575 ListenableFuture<RpcResult<TempServiceDeleteOutput>> result = servicehandlerImpl.tempServiceDelete(input);
576 result.addListener(new Runnable() {
580 endSignal.countDown();
586 RpcResult<TempServiceDeleteOutput> rpcResult = result.get();
588 ResponseCodes.RESPONSE_OK, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
592 public void tempServiceCreateShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
593 ServicehandlerImpl servicehandlerImpl =
594 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
595 notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
596 ListenableFuture<RpcResult<TempServiceCreateOutput>> result =
597 servicehandlerImpl.tempServiceCreate(new TempServiceCreateInputBuilder().build());
598 result.addListener(new Runnable() {
602 endSignal.countDown();
608 RpcResult<TempServiceCreateOutput> rpcResult = result.get();
610 ResponseCodes.RESPONSE_FAILED, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
615 public void tempServiceCreateShouldBeSuccessfulWhenPreformPCESuccessful()
616 throws ExecutionException, InterruptedException {
617 TempServiceCreateInput input = ServiceDataUtils.buildTempServiceCreateInput();
618 Mockito.when(pathComputationService.pathComputationRequest(any())).thenReturn(Futures.immediateFuture(any()));
620 ServicehandlerImpl servicehandlerImpl =
621 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
622 notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
624 ListenableFuture<RpcResult<TempServiceCreateOutput>> result = servicehandlerImpl.tempServiceCreate(input);
625 result.addListener(new Runnable() {
629 endSignal.countDown();
635 RpcResult<TempServiceCreateOutput> rpcResult = result.get();
638 ResponseCodes.RESPONSE_OK, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());