ea142d72254043b20a24765bf6f768914552e001
[transportpce.git] / servicehandler / src / test / java / org / opendaylight / transportpce / servicehandler / ModelMappingUtilsTest.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;
9
10 import com.google.common.util.concurrent.ListenableFuture;
11 import com.google.common.util.concurrent.ListeningExecutorService;
12 import com.google.common.util.concurrent.MoreExecutors;
13 import java.time.OffsetDateTime;
14 import java.time.ZoneOffset;
15 import java.time.format.DateTimeFormatter;
16 import java.util.Arrays;
17 import java.util.concurrent.CountDownLatch;
18 import java.util.concurrent.ExecutionException;
19 import java.util.concurrent.Executors;
20 import org.junit.After;
21 import org.junit.Assert;
22 import org.junit.Before;
23 import org.junit.Test;
24 import org.opendaylight.transportpce.common.ResponseCodes;
25 import org.opendaylight.transportpce.servicehandler.utils.ServiceDataUtils;
26 import org.opendaylight.transportpce.test.AbstractTest;
27 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.PathComputationRequestOutput;
28 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.PathComputationRequestOutputBuilder;
29 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.ConnectionType;
30 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.configuration.response.common.ConfigurationResponseCommon;
31 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.configuration.response.common.ConfigurationResponseCommonBuilder;
32 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.sdnc.request.header.SdncRequestHeaderBuilder;
33 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev190531.RpcStatus;
34 import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.constraints.co.routing.or.general.CoRoutingBuilder;
35 import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.routing.constraints.HardConstraintsBuilder;
36 import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.routing.constraints.SoftConstraintsBuilder;
37 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceCreateInput;
38 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceCreateInputBuilder;
39 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceCreateOutput;
40 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceDeleteInput;
41 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceDeleteInputBuilder;
42 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceDeleteOutput;
43 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceFeasibilityCheckInput;
44 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceFeasibilityCheckInputBuilder;
45 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceFeasibilityCheckOutput;
46 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceReconfigureInput;
47 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceReconfigureInputBuilder;
48 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceRerouteInput;
49 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceRerouteInputBuilder;
50 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceRestorationInput;
51 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceRestorationInputBuilder;
52 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceRestorationOutput;
53 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.TempServiceCreateInput;
54 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.TempServiceCreateInputBuilder;
55 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.TempServiceCreateOutput;
56 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.list.Services;
57 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.list.ServicesBuilder;
58 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.list.ServicesKey;
59 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev201210.path.description.AToZDirectionBuilder;
60 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev201210.path.description.ZToADirectionBuilder;
61 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev200128.response.parameters.sp.ResponseParameters;
62 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev200128.response.parameters.sp.ResponseParametersBuilder;
63 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev200128.response.parameters.sp.response.parameters.PathDescriptionBuilder;
64 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev171017.service.path.list.ServicePaths;
65 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev171017.service.path.list.ServicePathsBuilder;
66 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev171017.service.path.list.ServicePathsKey;
67 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
68 import org.opendaylight.yangtools.yang.common.RpcResult;
69 import org.opendaylight.yangtools.yang.common.Uint32;
70
71 public class ModelMappingUtilsTest extends AbstractTest {
72
73     private ListeningExecutorService executorService;
74     private CountDownLatch endSignal;
75     private static final int NUM_THREADS = 5;
76     private boolean callbackRan;
77
78     @Before
79     public void setUp() {
80         executorService = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(NUM_THREADS));
81         endSignal = new CountDownLatch(1);
82         callbackRan = false;
83     }
84
85     @After
86     public void tearDown() {
87         executorService.shutdownNow();
88     }
89
90     private ServiceReconfigureInput buildServiceConfigurationInput() {
91         DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssxxx");
92         OffsetDateTime offsetDateTime = OffsetDateTime.now(ZoneOffset.UTC);
93         OffsetDateTime offsetDateTime2 = offsetDateTime.plusDays(10);
94         return new ServiceReconfigureInputBuilder().setNewServiceName("service 1")
95             .setServiceName("service 1").setCommonId("common id").setConnectionType(ConnectionType.Service)
96             .setCustomer("customer").setCustomerContact("customer contact").setDueDate(new DateAndTime(
97                     dtf.format(offsetDateTime)))
98             .setEndDate(new DateAndTime(dtf.format(offsetDateTime2)))
99             .setNcCode("nc node").setNciCode("nci node").setSecondaryNciCode("secondry").setOperatorContact("operator")
100             .setServiceAEnd(ServiceDataUtils.getServiceAEndBuildReconfigure().build())
101             .setServiceZEnd(ServiceDataUtils.getServiceZEndBuildReconfigure().build())
102             .setHardConstraints(new HardConstraintsBuilder()
103                         .setCoRoutingOrGeneral(new CoRoutingBuilder()
104                                 .setCoRouting(new org.opendaylight.yang.gen.v1.http.org.openroadm.routing
105                                         .constrains.rev190329.constraints.co.routing.or.general.co.routing
106                                         .CoRoutingBuilder().setExistingService(
107                                         Arrays.asList("Some existing-service")).build())
108                                 .build())
109                         .setCustomerCode(Arrays.asList("Some customer-code"))
110                         .build())
111                 .setSoftConstraints(new SoftConstraintsBuilder()
112                         .setCoRoutingOrGeneral(new CoRoutingBuilder()
113                                 .setCoRouting(new org.opendaylight.yang.gen.v1.http.org.openroadm.routing
114                                         .constrains.rev190329.constraints.co.routing.or.general.co.routing
115                                         .CoRoutingBuilder().setExistingService(
116                                         Arrays.asList("Some existing-service")).build())
117                                 .build())
118                         .setCustomerCode(Arrays.asList("Some customer-code"))
119                         .build())
120                 .build();
121     }
122
123     private PathComputationRequestOutput buildPathComputationOutput() {
124         ConfigurationResponseCommon configurationResponseCommon = new ConfigurationResponseCommonBuilder()
125                 .setRequestId("request 1").setAckFinalIndicator(ResponseCodes.FINAL_ACK_NO)
126                 .setResponseCode(ResponseCodes.RESPONSE_OK).setResponseMessage("PCE calculation in progress").build();
127         ResponseParameters responseParameters = new ResponseParametersBuilder()
128             .setPathDescription(new PathDescriptionBuilder()
129                 .setAToZDirection(new AToZDirectionBuilder().setAToZWavelengthNumber(Uint32.valueOf(1))
130                     .setRate(Uint32.valueOf(1)).build())
131                 .setZToADirection(new ZToADirectionBuilder().setZToAWavelengthNumber(Uint32.valueOf(1))
132                     .setRate(Uint32.valueOf(1)).build()).build())
133             .build();
134         return new PathComputationRequestOutputBuilder().setConfigurationResponseCommon(configurationResponseCommon)
135             .setResponseParameters(responseParameters).build();
136     }
137
138     @Test
139     //TODO : is this unit test relevant ?
140     public void mappingServicesNullServiceCreateInput() {
141         Services services = ModelMappingUtils.mappingServices(null, null);
142         Assert.assertEquals(new ServicesBuilder().withKey(new ServicesKey("unknown")).build(), services);
143     }
144
145     @Test
146     public void mappingServiceNotNullServiceReconfigureInput() {
147         Services services = ModelMappingUtils.mappingServices(null, buildServiceConfigurationInput());
148         Assert.assertEquals("service 1", services.getServiceName());
149     }
150
151     @Test
152     public void mappingServiceValid() {
153         Services services = ModelMappingUtils.mappingServices(ServiceDataUtils.buildServiceCreateInput(),
154                 null);
155         Assert.assertEquals("service 1", services.getServiceName());
156     }
157
158     @Test
159     //TODO : is this unit test relevant ?
160     public void mappingServicesPathNullServiceCreateInput() {
161         ServicePaths services = ModelMappingUtils.mappingServicePaths(null, buildPathComputationOutput());
162         Assert.assertEquals(new ServicePathsBuilder().withKey(new ServicePathsKey("unknown")).build(), services);
163     }
164
165     @Test
166     public void mappingServicePathWithServiceInputWithHardConstraints() {
167         ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInputWithHardConstraints();
168         ServiceInput serviceInput = new ServiceInput(createInput);
169         ServicePaths services = ModelMappingUtils.mappingServicePaths(serviceInput, buildPathComputationOutput());
170         Assert.assertEquals(serviceInput.getServiceName(), services.getServicePathName());
171         Assert.assertNotNull(services.getHardConstraints());
172     }
173
174     @Test
175     public void mappingServicePathWithServiceInputWithSoftConstraints() {
176         ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInputWithSoftConstraints();
177         ServiceInput serviceInput = new ServiceInput(createInput);
178         ServicePaths services = ModelMappingUtils.mappingServicePaths(serviceInput, buildPathComputationOutput());
179         Assert.assertEquals(serviceInput.getServiceName(), services.getServicePathName());
180         Assert.assertNotNull(services.getSoftConstraints());
181     }
182
183     @Test
184     public void createServiceDeleteInputWithServiceRerouteInput() {
185         ServiceRerouteInput serviceRerouteinput = new ServiceRerouteInputBuilder().setServiceName("reroute").build();
186         Services services = new ServicesBuilder()
187                 .withKey(new ServicesKey("reroute"))
188                 .setSdncRequestHeader(new SdncRequestHeaderBuilder().setRequestId("123").build()).build();
189         org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev201125.ServiceDeleteInput
190             serviceDeleteInput =
191                     ModelMappingUtils.createServiceDeleteInput(serviceRerouteinput, services);
192         Assert.assertEquals("reroute", serviceDeleteInput.getServiceName());
193         Assert.assertEquals("123", serviceDeleteInput.getServiceHandlerHeader().getRequestId());
194     }
195
196     @Test
197     public void  createServiceDeleteInputWithServiceReconfigureInput() {
198         ServiceReconfigureInput serviceReconfigureInput = new  ServiceReconfigureInputBuilder()
199                 .setServiceName("reconf").build();
200         org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev201125.ServiceDeleteInput
201             serviceDeleteInput =
202                     ModelMappingUtils.createServiceDeleteInput(serviceReconfigureInput);
203         Assert.assertEquals("reconf", serviceDeleteInput.getServiceName());
204         Assert.assertEquals("reconf-reconfigure", serviceDeleteInput.getServiceHandlerHeader().getRequestId());
205     }
206
207     @Test
208     public void createServiceDeleteInputWithServiceRestorationInput() {
209         Services services = new ServicesBuilder()
210                 .withKey(new ServicesKey("rest"))
211                 .setSdncRequestHeader(new SdncRequestHeaderBuilder().setRequestId("123").build()).build();
212         ServiceRestorationInput serviceRestorationInput =
213             new ServiceRestorationInputBuilder().setServiceName("rest").build();
214         org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev201125.ServiceDeleteInput
215             serviceDeleteInput =
216                     ModelMappingUtils.createServiceDeleteInput(serviceRestorationInput, services);
217         Assert.assertEquals("rest", serviceDeleteInput.getServiceName());
218         Assert.assertEquals("123", serviceDeleteInput.getServiceHandlerHeader().getRequestId());
219     }
220
221     @Test
222     public void createDeleteServiceReplyWithServiceDeleteInputWithSdncHeader()
223         throws ExecutionException, InterruptedException  {
224         ServiceDeleteInput input = new ServiceDeleteInputBuilder()
225                 .setSdncRequestHeader(new SdncRequestHeaderBuilder().setRequestId("12").build()).build();
226         ListenableFuture<RpcResult<ServiceDeleteOutput>> serviceDeleteOutputF =
227             ModelMappingUtils.createDeleteServiceReply(input, "ack", "message", "200");
228         serviceDeleteOutputF.addListener(new Runnable() {
229             @Override
230             public void run() {
231                 callbackRan = true;
232                 endSignal.countDown();
233             }
234         }, executorService);
235
236         endSignal.await();
237         RpcResult<ServiceDeleteOutput> serviceDeleteOutput = serviceDeleteOutputF.get();
238         Assert.assertEquals("200", serviceDeleteOutput.getResult().getConfigurationResponseCommon().getResponseCode());
239         Assert.assertEquals(
240             "ack", serviceDeleteOutput.getResult().getConfigurationResponseCommon().getAckFinalIndicator());
241         Assert.assertEquals(
242             "message", serviceDeleteOutput.getResult().getConfigurationResponseCommon().getResponseMessage());
243         Assert.assertEquals("12", serviceDeleteOutput.getResult().getConfigurationResponseCommon().getRequestId());
244     }
245
246     @Test
247     public void createDeleteServiceReplyWithServiceDeleteInputWithoutSdncHeader()
248             throws ExecutionException, InterruptedException  {
249         ServiceDeleteInput input = new ServiceDeleteInputBuilder().build();
250         ListenableFuture<RpcResult<ServiceDeleteOutput>> serviceDeleteOutputF =
251             ModelMappingUtils.createDeleteServiceReply(input, "ack", "message", "200");
252         serviceDeleteOutputF.addListener(new Runnable() {
253             @Override
254             public void run() {
255                 callbackRan = true;
256                 endSignal.countDown();
257             }
258         }, executorService);
259
260         endSignal.await();
261         RpcResult<ServiceDeleteOutput> serviceDeleteOutput = serviceDeleteOutputF.get();
262         Assert.assertEquals("200", serviceDeleteOutput.getResult().getConfigurationResponseCommon().getResponseCode());
263         Assert.assertEquals(
264             "ack", serviceDeleteOutput.getResult().getConfigurationResponseCommon().getAckFinalIndicator());
265         Assert.assertEquals(
266             "message", serviceDeleteOutput.getResult().getConfigurationResponseCommon().getResponseMessage());
267         Assert.assertNull(serviceDeleteOutput.getResult().getConfigurationResponseCommon().getRequestId());
268     }
269
270     @Test
271     public void createCreateServiceReplyWithServiceCreatInputWithSdncRequestHeader()
272             throws ExecutionException, InterruptedException {
273         ServiceCreateInput input =
274             new ServiceCreateInputBuilder()
275                 .setSdncRequestHeader(new SdncRequestHeaderBuilder().setRequestId("12").build()).build();
276         ListenableFuture<RpcResult<ServiceCreateOutput>> serviceCreatOutputF =
277             ModelMappingUtils.createCreateServiceReply(input, "ack", "message", "200");
278         serviceCreatOutputF.addListener(new Runnable() {
279             @Override
280             public void run() {
281                 callbackRan = true;
282                 endSignal.countDown();
283             }
284         }, executorService);
285
286         endSignal.await();
287         RpcResult<ServiceCreateOutput> serviceCreatOutput = serviceCreatOutputF.get();
288         Assert.assertEquals("200", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseCode());
289         Assert.assertEquals(
290             "ack", serviceCreatOutput.getResult().getConfigurationResponseCommon().getAckFinalIndicator());
291         Assert.assertEquals(
292             "message", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseMessage());
293         Assert.assertEquals("12", serviceCreatOutput.getResult().getConfigurationResponseCommon().getRequestId());
294     }
295
296     @Test
297     public void createCreateServiceReplyWithServiceCreatInputWithoutSdncRequestHeader()
298         throws ExecutionException, InterruptedException {
299         ServiceCreateInput input = new ServiceCreateInputBuilder().build();
300         ListenableFuture<RpcResult<ServiceCreateOutput>> serviceCreatOutputF =
301             ModelMappingUtils.createCreateServiceReply(input, "ack", "message", "200");
302         serviceCreatOutputF.addListener(new Runnable() {
303             @Override
304             public void run() {
305                 callbackRan = true;
306                 endSignal.countDown();
307             }
308         }, executorService);
309
310         endSignal.await();
311         RpcResult<ServiceCreateOutput> serviceCreatOutput = serviceCreatOutputF.get();
312         Assert.assertEquals("200", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseCode());
313         Assert.assertEquals(
314             "ack", serviceCreatOutput.getResult().getConfigurationResponseCommon().getAckFinalIndicator());
315         Assert.assertEquals(
316             "message", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseMessage());
317         Assert.assertNull(serviceCreatOutput.getResult().getConfigurationResponseCommon().getRequestId());
318     }
319
320     @Test
321     public void createCreateServiceReplyWithTempServiceCreatInputWithSdncRequestHeader()
322         throws ExecutionException, InterruptedException {
323         TempServiceCreateInput input =
324             new TempServiceCreateInputBuilder()
325                 .setSdncRequestHeader(new SdncRequestHeaderBuilder().setRequestId("12").build()).build();
326         ListenableFuture<RpcResult<TempServiceCreateOutput>> serviceCreatOutputF =
327             ModelMappingUtils.createCreateServiceReply(input, "ack", "message", "200");
328         serviceCreatOutputF.addListener(new Runnable() {
329             @Override
330             public void run() {
331                 callbackRan = true;
332                 endSignal.countDown();
333             }
334         }, executorService);
335
336         endSignal.await();
337         RpcResult<TempServiceCreateOutput> serviceCreatOutput = serviceCreatOutputF.get();
338         Assert.assertEquals("200", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseCode());
339         Assert.assertEquals(
340             "ack", serviceCreatOutput.getResult().getConfigurationResponseCommon().getAckFinalIndicator());
341         Assert.assertEquals(
342             "message", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseMessage());
343         Assert.assertEquals("12", serviceCreatOutput.getResult().getConfigurationResponseCommon().getRequestId());
344     }
345
346     @Test
347     public void createCreateServiceReplyWithTempServiceCreatInputWithoutSdncRequestHeader()
348         throws ExecutionException, InterruptedException {
349         TempServiceCreateInput input = new TempServiceCreateInputBuilder().build();
350         ListenableFuture<RpcResult<TempServiceCreateOutput>> serviceCreatOutputF =
351             ModelMappingUtils.createCreateServiceReply(input, "ack", "message", "200");
352         serviceCreatOutputF.addListener(new Runnable() {
353             @Override
354             public void run() {
355                 callbackRan = true;
356                 endSignal.countDown();
357             }
358         }, executorService);
359
360         endSignal.await();
361         RpcResult<TempServiceCreateOutput> serviceCreatOutput = serviceCreatOutputF.get();
362         Assert.assertEquals("200", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseCode());
363         Assert.assertEquals(
364             "ack", serviceCreatOutput.getResult().getConfigurationResponseCommon().getAckFinalIndicator());
365         Assert.assertEquals(
366             "message", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseMessage());
367         Assert.assertNull(serviceCreatOutput.getResult().getConfigurationResponseCommon().getRequestId());
368     }
369
370     @Test
371     public void createCreateServiceReplyWithServiceFeasibilityCheckInputWithSdncRequestHeader()
372         throws ExecutionException, InterruptedException {
373         ServiceFeasibilityCheckInput input =
374             new ServiceFeasibilityCheckInputBuilder()
375                 .setSdncRequestHeader(new SdncRequestHeaderBuilder().setRequestId("12").build()).build();
376         ListenableFuture<RpcResult<ServiceFeasibilityCheckOutput>> serviceCreatOutputF =
377             ModelMappingUtils.createCreateServiceReply(input, "ack", "message", "200");
378         serviceCreatOutputF.addListener(new Runnable() {
379             @Override
380             public void run() {
381                 callbackRan = true;
382                 endSignal.countDown();
383             }
384         }, executorService);
385
386         endSignal.await();
387         RpcResult<ServiceFeasibilityCheckOutput> serviceCreatOutput = serviceCreatOutputF.get();
388         Assert.assertEquals("200", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseCode());
389         Assert.assertEquals(
390             "ack", serviceCreatOutput.getResult().getConfigurationResponseCommon().getAckFinalIndicator());
391         Assert.assertEquals(
392             "message", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseMessage());
393         Assert.assertEquals("12", serviceCreatOutput.getResult().getConfigurationResponseCommon().getRequestId());
394     }
395
396     @Test
397     public void createCreateServiceReplyWithServiceFeasibilityCheckInputWithoutSdncRequestHeader()
398         throws ExecutionException, InterruptedException {
399         ServiceFeasibilityCheckInput input = new ServiceFeasibilityCheckInputBuilder().build();
400         ListenableFuture<RpcResult<ServiceFeasibilityCheckOutput>> serviceCreatOutputF =
401             ModelMappingUtils.createCreateServiceReply(input, "ack", "message", "200");
402         serviceCreatOutputF.addListener(new Runnable() {
403             @Override
404             public void run() {
405                 callbackRan = true;
406                 endSignal.countDown();
407             }
408         }, executorService);
409
410         endSignal.await();
411         RpcResult<ServiceFeasibilityCheckOutput> serviceCreatOutput = serviceCreatOutputF.get();
412         Assert.assertEquals("200", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseCode());
413         Assert.assertEquals(
414             "ack", serviceCreatOutput.getResult().getConfigurationResponseCommon().getAckFinalIndicator());
415         Assert.assertEquals(
416             "message", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseMessage());
417         Assert.assertNull(serviceCreatOutput.getResult().getConfigurationResponseCommon().getRequestId());
418     }
419
420     @Test
421     public void testCreateRestoreServiceReply() throws ExecutionException, InterruptedException {
422         ListenableFuture<RpcResult<ServiceRestorationOutput>> serviceRestorationOutputF =
423             ModelMappingUtils.createRestoreServiceReply("message", RpcStatus.Failed);
424         serviceRestorationOutputF.addListener(new Runnable() {
425             @Override
426             public void run() {
427                 callbackRan = true;
428                 endSignal.countDown();
429             }
430         }, executorService);
431
432         endSignal.await();
433         RpcResult<ServiceRestorationOutput> serviceRestorationOutput = serviceRestorationOutputF.get();
434         Assert.assertEquals("message", serviceRestorationOutput.getResult().getStatusMessage());
435     }
436 }