Functional Tests for servicehandler
[transportpce.git] / tests / SH_stubs.diff
1 diff --git a/servicehandler/pom.xml b/servicehandler/pom.xml
2 index 43085f6..8a9699a 100644
3 --- a/servicehandler/pom.xml
4 +++ b/servicehandler/pom.xml
5 @@ -67,6 +67,11 @@ Author: Martial Coulibaly <martial.coulibaly@gfi.com> on behalf of Orange
6        <artifactId>transportpce-pce</artifactId>
7        <version>${project.version}</version>
8      </dependency>
9 +    <dependency>
10 +      <groupId>${project.groupId}</groupId>
11 +      <artifactId>transportpce-stubrenderer</artifactId>
12 +      <version>${project.version}</version>
13 +    </dependency>
14  
15      <!-- Testing Dependencies -->
16      <dependency>
17 diff --git a/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/ModelMappingUtils.java b/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/ModelMappingUtils.java
18 index 2b0ee83..2899617 100644
19 --- a/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/ModelMappingUtils.java
20 +++ b/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/ModelMappingUtils.java
21 @@ -7,8 +7,6 @@
22   */
23  package org.opendaylight.transportpce.servicehandler;
24  
25 -import java.util.ArrayList;
26 -import java.util.List;
27  import java.util.concurrent.Future;
28  import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev170426.PathComputationRequestOutput;
29  import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev170426.path.computation.request.input.ServiceAEnd;
30 @@ -18,8 +16,6 @@ import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev17
31  import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.configuration.response.common.ConfigurationResponseCommon;
32  import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.configuration.response.common.ConfigurationResponseCommonBuilder;
33  import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.response.parameters.ResponseParametersBuilder;
34 -import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.service.Topology;
35 -import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.service.TopologyBuilder;
36  import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev161014.LifecycleState;
37  import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev161014.State;
38  import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceCreateInput;
39 @@ -31,12 +27,6 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.Service
40  import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceReconfigureInput;
41  import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.list.Services;
42  import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.list.ServicesBuilder;
43 -import org.opendaylight.yang.gen.v1.http.org.openroadm.topology.rev161014.topology.AToZ;
44 -import org.opendaylight.yang.gen.v1.http.org.openroadm.topology.rev161014.topology.AToZBuilder;
45 -import org.opendaylight.yang.gen.v1.http.org.openroadm.topology.rev161014.topology.AToZKey;
46 -import org.opendaylight.yang.gen.v1.http.org.openroadm.topology.rev161014.topology.ZToA;
47 -import org.opendaylight.yang.gen.v1.http.org.openroadm.topology.rev161014.topology.ZToABuilder;
48 -import org.opendaylight.yang.gen.v1.http.org.openroadm.topology.rev161014.topology.ZToAKey;
49  import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev170426.routing.constraints.sp.HardConstraintsBuilder;
50  import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev170426.routing.constraints.sp.SoftConstraintsBuilder;
51  import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.service.endpoint.sp.RxDirection;
52 @@ -237,42 +227,6 @@ public final class ModelMappingUtils {
53                  .setSoftConstraints(serviceReconfigureInput.getSoftConstraints())
54                  .setLifecycleState(LifecycleState.Planned).setServiceAEnd(aend).setServiceZEnd(zend);
55          }
56 -
57 -        org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.response
58 -                .parameters.sp.ResponseParameters responseParameters = output.getResponseParameters();
59 -        if (responseParameters != null) {
60 -            // service.setPceMetric(responseParameters.getPceMetric());
61 -            org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426
62 -                .response.parameters.sp.response.parameters.PathDescription pathDescription =
63 -                responseParameters.getPathDescription();
64 -            if (pathDescription != null) {
65 -                List<AToZ> atozList = new ArrayList<>();
66 -                List<ZToA> ztoaList = new ArrayList<>();
67 -
68 -                for (org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426
69 -                    .path.description.atoz.direction.AToZ tmp : pathDescription.getAToZDirection().getAToZ()) {
70 -
71 -                    AToZKey key = new AToZKey(tmp.getKey().getId());
72 -                    AToZ atoz = new AToZBuilder().setId(tmp.getId()).setKey(key)
73 -                            // .setResource(tmp.getResource())
74 -                            .build();
75 -                    atozList.add(atoz);
76 -                }
77 -
78 -                for (org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426
79 -                        .path.description.ztoa.direction.ZToA
80 -                        tmp : pathDescription.getZToADirection().getZToA()) {
81 -                    ZToAKey key = new ZToAKey(tmp.getKey().getId());
82 -                    ZToA ztoa = new ZToABuilder().setId(tmp.getId()).setKey(key)
83 -                            // .setResource(tmp.getResource())
84 -                            .build();
85 -                    ztoaList.add(ztoa);
86 -                }
87 -
88 -                Topology topology = new TopologyBuilder().setAToZ(atozList).setZToA(ztoaList).build();
89 -                service.setTopology(topology);
90 -            }
91 -        }
92          return service.build();
93      }
94  
95 diff --git a/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/impl/ServicehandlerImpl.java b/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/impl/ServicehandlerImpl.java
96 index 5dc24b3..714e2b3 100644
97 --- a/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/impl/ServicehandlerImpl.java
98 +++ b/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/impl/ServicehandlerImpl.java
99 @@ -12,7 +12,6 @@ import java.time.format.DateTimeFormatter;
100  import java.util.Optional;
101  import java.util.concurrent.ExecutionException;
102  import java.util.concurrent.Future;
103 -
104  import org.opendaylight.controller.md.sal.binding.api.DataBroker;
105  import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
106  import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
107 @@ -27,6 +26,7 @@ import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOper
108  import org.opendaylight.transportpce.servicehandler.validation.ServiceCreateValidation;
109  import org.opendaylight.transportpce.servicehandler.validation.checks.ComplianceCheckResult;
110  import org.opendaylight.transportpce.servicehandler.validation.checks.ServicehandlerCompliancyCheck;
111 +import org.opendaylight.transportpce.stubrenderer.SendingRendererRPCs;
112  import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev170426.PathComputationRequestOutput;
113  import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.RpcActions;
114  import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.sdnc.request.header.SdncRequestHeaderBuilder;
115 @@ -89,6 +89,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService {
116      private ServiceDataStoreOperations serviceDataStoreOperations;
117      private RendererServiceOperations rendererServiceOperations;
118      private PCEServiceWrapper pceServiceWrapper;
119 +    private SendingRendererRPCs stubrendererService;
120  
121      //TODO: remove private request fields as they are in global scope
122  
123 @@ -145,8 +146,12 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService {
124  
125          ServiceImplementationRequestInput serviceImplementationRequest =
126                  ModelMappingUtils.createServiceImplementationRequest(input, pceResponse);
127 +//        org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426
128 +//            .ServiceImplementationRequestOutput serviceImplementationRequestOutput = this.rendererServiceOperations
129 +//            .serviceImplementation(serviceImplementationRequest);
130 +        this.stubrendererService = new SendingRendererRPCs();
131          org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426
132 -            .ServiceImplementationRequestOutput serviceImplementationRequestOutput = this.rendererServiceOperations
133 +        .ServiceImplementationRequestOutput serviceImplementationRequestOutput = this.stubrendererService
134              .serviceImplementation(serviceImplementationRequest);
135          if (ResponseCodes.RESPONSE_OK
136                  .equals(serviceImplementationRequestOutput.getConfigurationResponseCommon().getResponseCode())) {
137 @@ -215,9 +220,11 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService {
138          LOG.debug("Service '{}' present in datastore !", serviceName);
139          org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceDeleteInput
140                  serviceDeleteInput = ModelMappingUtils.createServiceDeleteInput(input);
141 +//        org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426
142 +//            .ServiceDeleteOutput output = this.rendererServiceOperations.serviceDelete(serviceDeleteInput);
143 +        this.stubrendererService = new SendingRendererRPCs();
144          org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426
145 -            .ServiceDeleteOutput output = this.rendererServiceOperations.serviceDelete(serviceDeleteInput);
146 -
147 +            .ServiceDeleteOutput output = this.stubrendererService.serviceDelete(serviceDeleteInput);
148          if (!ResponseCodes.RESPONSE_OK
149                  .equals(output.getConfigurationResponseCommon().getResponseCode())) {
150              message = "Service delete failed!";
151 diff --git a/servicehandler/src/test/java/org/opendaylight/transportpce/servicehandler/stub/StubRendererServiceOperations.java b/servicehandler/src/test/java/org/opendaylight/transportpce/servicehandler/stub/StubRendererServiceOperations.java
152 index 6db468c..76e4a26 100644
153 --- a/servicehandler/src/test/java/org/opendaylight/transportpce/servicehandler/stub/StubRendererServiceOperations.java
154 +++ b/servicehandler/src/test/java/org/opendaylight/transportpce/servicehandler/stub/StubRendererServiceOperations.java
155 @@ -9,13 +9,8 @@ package org.opendaylight.transportpce.servicehandler.stub;
156  
157  import java.util.concurrent.ExecutionException;
158  import java.util.concurrent.Future;
159 -
160  import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
161  import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations;
162 -import org.opendaylight.transportpce.servicehandler.mappers.ServiceDeleteInputConverter;
163 -import org.opendaylight.transportpce.servicehandler.mappers.ServiceDeleteOutputConverter;
164 -import org.opendaylight.transportpce.servicehandler.mappers.ServiceImplementationRequestInputConverter;
165 -import org.opendaylight.transportpce.servicehandler.mappers.ServiceImplementationRequestOutputConverter;
166  import org.opendaylight.transportpce.stubrenderer.impl.StubrendererImpl;
167  import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceDeleteInput;
168  import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceDeleteOutput;
169 @@ -30,16 +25,15 @@ public class StubRendererServiceOperations implements RendererServiceOperations
170      private StubrendererImpl stubrenderer;
171  
172      public StubRendererServiceOperations(NotificationPublishService notificationPublishService) {
173 -        this.stubrenderer = new StubrendererImpl(notificationPublishService);
174 +        this.stubrenderer = new StubrendererImpl();
175      }
176  
177      @Override
178      public ServiceImplementationRequestOutput serviceImplementation(ServiceImplementationRequestInput input) {
179 -        Future<RpcResult<org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426
180 -            .ServiceImplementationRequestOutput>> rpcResultFuture = this.stubrenderer
181 -                .serviceImplementationRequest(ServiceImplementationRequestInputConverter.getStub(input));
182 +        Future<RpcResult<ServiceImplementationRequestOutput>> rpcResultFuture = this.stubrenderer
183 +                .serviceImplementationRequest(input);
184          try {
185 -            return ServiceImplementationRequestOutputConverter.getConcrete(rpcResultFuture.get().getResult());
186 +            return rpcResultFuture.get().getResult();
187          } catch (InterruptedException e) {
188              LOG.error("RPC serviceImplementation failed !",e);
189          } catch (ExecutionException e) {
190 @@ -50,11 +44,10 @@ public class StubRendererServiceOperations implements RendererServiceOperations
191  
192      @Override
193      public ServiceDeleteOutput serviceDelete(ServiceDeleteInput input) {
194 -        Future<RpcResult<org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426
195 -            .ServiceDeleteOutput>> rpcResultFuture = this.stubrenderer
196 -                .serviceDelete(ServiceDeleteInputConverter.getStub(input));
197 +        Future<RpcResult<ServiceDeleteOutput>> rpcResultFuture = this.stubrenderer
198 +                .serviceDelete(input);
199          try {
200 -            return ServiceDeleteOutputConverter.getConcrete(rpcResultFuture.get().getResult());
201 +            return rpcResultFuture.get().getResult();
202          } catch (InterruptedException e) {
203              LOG.error("RPC serviceDelete failed !",e);
204          } catch (ExecutionException e) {
205 diff --git a/tests/stubrenderer/src/main/java/org/opendaylight/transportpce/stubrenderer/SendingRendererRPCs.java b/tests/stubrenderer/src/main/java/org/opendaylight/transportpce/stubrenderer/SendingRendererRPCs.java
206 index cdcdc0e..7c7a825 100644
207 --- a/tests/stubrenderer/src/main/java/org/opendaylight/transportpce/stubrenderer/SendingRendererRPCs.java
208 +++ b/tests/stubrenderer/src/main/java/org/opendaylight/transportpce/stubrenderer/SendingRendererRPCs.java
209 @@ -8,16 +8,18 @@
210  
211  package org.opendaylight.transportpce.stubrenderer;
212  
213 -import com.google.common.util.concurrent.ListenableFuture;
214 -import com.google.common.util.concurrent.ListeningExecutorService;
215 -
216  import java.util.ArrayList;
217  import java.util.List;
218 -import java.util.concurrent.Callable;
219 -
220 +import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.configuration.response.common.ConfigurationResponseCommonBuilder;
221  import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.service.TopologyBuilder;
222  import org.opendaylight.yang.gen.v1.http.org.openroadm.topology.rev161014.topology.AToZ;
223  import org.opendaylight.yang.gen.v1.http.org.openroadm.topology.rev161014.topology.ZToA;
224 +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceDeleteInput;
225 +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceDeleteOutput;
226 +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceDeleteOutputBuilder;
227 +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceImplementationRequestInput;
228 +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceImplementationRequestOutput;
229 +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceImplementationRequestOutputBuilder;
230  import org.slf4j.Logger;
231  import org.slf4j.LoggerFactory;
232  
233 @@ -41,73 +43,78 @@ public class SendingRendererRPCs {
234      private List<AToZ> atoz;
235      private List<ZToA> ztoa;
236      private String error;
237 -    private final ListeningExecutorService executor;
238  
239 -    public SendingRendererRPCs(ListeningExecutorService executor) {
240 -        success = true;
241 +    public SendingRendererRPCs() {
242 +        this.success = true;
243          setTopology(null);
244 -        this.executor = executor;
245          setError("");
246      }
247  
248      private void buildAtoZ() {
249 -        atoz = new ArrayList<AToZ>();
250 +        this.atoz = new ArrayList<AToZ>();
251      }
252  
253      private void buildZtoA() {
254 -        ztoa = new ArrayList<ZToA>();
255 +        this.ztoa = new ArrayList<ZToA>();
256      }
257  
258 -    public ListenableFuture<Boolean> serviceDelete() {
259 +    public ServiceDeleteOutput serviceDelete(ServiceDeleteInput input) {
260 +        String message = "Service deleted !";
261 +        String responseCode = "200";
262          LOG.info("ServiceDelete request ...");
263 -        success = false;
264 -        return executor.submit(new Callable<Boolean>() {
265 -            @Override
266 -            public Boolean call() throws Exception {
267 -                Boolean output = true;
268 -                LOG.info("Wait for 10s til beginning the Renderer serviceDelete request");
269 -                try {
270 -                    Thread.sleep(10000); //sleep for 10s
271 -                } catch (InterruptedException e) {
272 -                    output = false;
273 -                    LOG.error("Thread.sleep failed : {}", e.toString());
274 -                }
275 -                buildAtoZ();
276 -                buildZtoA();
277 -                success = true;
278 -                return output;
279 -            }
280 -        });
281 +        LOG.info("Wait for 10s til beginning the Renderer serviceDelete request");
282 +        try {
283 +            Thread.sleep(1000); //sleep for 10s
284 +        } catch (InterruptedException e) {
285 +            message = "deleting service failed !";
286 +            LOG.error(message);
287 +            responseCode = "500";
288 +            setError(message);
289 +        }
290 +        ConfigurationResponseCommonBuilder configurationResponseCommon = new ConfigurationResponseCommonBuilder()
291 +                .setAckFinalIndicator("yes")
292 +                .setRequestId(input.getServiceHandlerHeader().getRequestId())
293 +                .setResponseCode(responseCode)
294 +                .setResponseMessage(message);
295 +        ServiceDeleteOutput output =  new ServiceDeleteOutputBuilder()
296 +                .setConfigurationResponseCommon(configurationResponseCommon.build())
297 +                .build();
298 +        return output;
299      }
300  
301 -    public ListenableFuture<Boolean> serviceImplementation() {
302 +    public ServiceImplementationRequestOutput serviceImplementation(ServiceImplementationRequestInput input) {
303 +        String message = "Service implemented !";
304 +        String responseCode = "200";
305 +        setSuccess(true);
306          LOG.info("serviceImplementation request ...");
307 -        success = false;
308 -        return executor.submit(new Callable<Boolean>() {
309 -            @Override
310 -            public Boolean call() throws Exception {
311 -                Boolean output = true;
312 -                LOG.info("Wait for 10s til beginning the Renderer serviceDelete request");
313 -                try {
314 -                    Thread.sleep(10000); //sleep for 10s
315 -                } catch (InterruptedException e) {
316 -                    output = false;
317 -                    LOG.error("Thread.sleep failed : {}", e.toString());
318 -                }
319 -                buildAtoZ();
320 -                buildZtoA();
321 -                setTopology(new TopologyBuilder()
322 -                        .setAToZ(atoz)
323 -                        .setZToA(ztoa));
324 -                output = true;
325 -                success = true;
326 -                return output;
327 -            }
328 -        });
329 +        LOG.info("Wait for 10s til beginning the Renderer serviceDelete request");
330 +        try {
331 +            Thread.sleep(2000); //sleep for 1s
332 +        } catch (InterruptedException e) {
333 +            message = "implementing service failed !";
334 +            LOG.error(message);
335 +            setError(message);
336 +            responseCode = "500";
337 +            setSuccess(false);
338 +        }
339 +        buildAtoZ();
340 +        buildZtoA();
341 +        setTopology(new TopologyBuilder()
342 +                .setAToZ(SendingRendererRPCs.this.atoz)
343 +                .setZToA(SendingRendererRPCs.this.ztoa));
344 +        ConfigurationResponseCommonBuilder configurationResponseCommon = new ConfigurationResponseCommonBuilder()
345 +                .setAckFinalIndicator("yes")
346 +                .setRequestId(input.getServiceHandlerHeader().getRequestId())
347 +                .setResponseCode(responseCode)
348 +                .setResponseMessage(message);
349 +        ServiceImplementationRequestOutput output =  new ServiceImplementationRequestOutputBuilder()
350 +                .setConfigurationResponseCommon(configurationResponseCommon.build())
351 +                .build();
352 +        return output;
353      }
354  
355      public Boolean getSuccess() {
356 -        return success;
357 +        return this.success;
358      }
359  
360      public void setSuccess(Boolean success) {
361 @@ -115,7 +122,7 @@ public class SendingRendererRPCs {
362      }
363  
364      public TopologyBuilder getTopology() {
365 -        return topology;
366 +        return this.topology;
367      }
368  
369      public void setTopology(TopologyBuilder topo) {
370 @@ -123,7 +130,7 @@ public class SendingRendererRPCs {
371      }
372  
373      public String getError() {
374 -        return error;
375 +        return this.error;
376      }
377  
378      public void setError(String error) {
379 diff --git a/tests/stubrenderer/src/main/java/org/opendaylight/transportpce/stubrenderer/impl/StubrendererImpl.java b/tests/stubrenderer/src/main/java/org/opendaylight/transportpce/stubrenderer/impl/StubrendererImpl.java
380 index 23ae976..4187f96 100644
381 --- a/tests/stubrenderer/src/main/java/org/opendaylight/transportpce/stubrenderer/impl/StubrendererImpl.java
382 +++ b/tests/stubrenderer/src/main/java/org/opendaylight/transportpce/stubrenderer/impl/StubrendererImpl.java
383 @@ -9,33 +9,21 @@
384  
385  package org.opendaylight.transportpce.stubrenderer.impl;
386  
387 -import com.google.common.util.concurrent.FutureCallback;
388 -import com.google.common.util.concurrent.Futures;
389 -import com.google.common.util.concurrent.ListenableFuture;
390 -import com.google.common.util.concurrent.ListeningExecutorService;
391 -import com.google.common.util.concurrent.MoreExecutors;
392 -
393 -import java.util.concurrent.Executors;
394  import java.util.concurrent.Future;
395 -
396 -import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
397  import org.opendaylight.transportpce.stubrenderer.SendingRendererRPCs;
398  import org.opendaylight.transportpce.stubrenderer.StubrendererCompliancyCheck;
399 -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.ServiceDeleteInput;
400 -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.ServiceDeleteOutput;
401 -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.ServiceDeleteOutputBuilder;
402 -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.ServiceImplementationRequestInput;
403 -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.ServiceImplementationRequestOutput;
404 -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.ServiceImplementationRequestOutputBuilder;
405 -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.ServiceRpcResultSp;
406 -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.ServiceRpcResultSpBuilder;
407 -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.StubrendererService;
408 -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.service.rpc.result.sp.PathTopology;
409 -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.service.rpc.result.sp.PathTopologyBuilder;
410  import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.configuration.response.common.ConfigurationResponseCommonBuilder;
411 -import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.service.TopologyBuilder;
412 -import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.RpcStatusEx;
413 -import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.ServicePathNotificationTypes;
414 +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.CancelResourceReserveInput;
415 +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.CancelResourceReserveOutput;
416 +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.PathComputationRequestInput;
417 +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.PathComputationRequestOutput;
418 +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceDeleteInput;
419 +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceDeleteOutput;
420 +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceDeleteOutputBuilder;
421 +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceImplementationRequestInput;
422 +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceImplementationRequestOutput;
423 +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceImplementationRequestOutputBuilder;
424 +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.TransportpceServicepathService;
425  import org.opendaylight.yangtools.yang.common.RpcResult;
426  import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
427  import org.slf4j.Logger;
428 @@ -48,21 +36,12 @@ import org.slf4j.LoggerFactory;
429   * @author Martial Coulibaly ( martial.coulibaly@gfi.com ) on behalf of Orange
430   *
431   */
432 -public class StubrendererImpl implements StubrendererService {
433 +public class StubrendererImpl implements TransportpceServicepathService {
434      /** Logging. */
435      private static final Logger LOG = LoggerFactory.getLogger(StubrendererImpl.class);
436 -    /** send notification. */
437 -    private NotificationPublishService notificationPublishService;
438 -    private ServiceRpcResultSp notification;
439 -    private final ListeningExecutorService executor = MoreExecutors
440 -            .listeningDecorator(Executors.newFixedThreadPool(10));
441      /** check service sdnc-request-header compliancy. */
442      private StubrendererCompliancyCheck compliancyCheck;
443  
444 -    public StubrendererImpl(NotificationPublishService notificationPublishService) {
445 -        this.notificationPublishService = notificationPublishService;
446 -    }
447 -
448      @Override
449      public Future<RpcResult<ServiceImplementationRequestOutput>> serviceImplementationRequest(
450              ServiceImplementationRequestInput input) {
451 @@ -71,121 +50,37 @@ public class StubrendererImpl implements StubrendererService {
452          String message = "";
453          ConfigurationResponseCommonBuilder configurationResponseCommon = null;
454  
455 -        compliancyCheck = new StubrendererCompliancyCheck(input.getServiceName(), input.getServiceHandlerHeader());
456 -        if (compliancyCheck.check(false, true)) {
457 +        this.compliancyCheck = new StubrendererCompliancyCheck(input.getServiceName(), input.getServiceHandlerHeader());
458 +        if (this.compliancyCheck.check(false, true)) {
459              LOG.info("Service compliant !");
460              /**
461               * If compliant, service-request parameters are verified in order to
462               * check if there is no missing parameter that prevents calculating
463               * a path and implement a service.
464               */
465 -
466 -            notification = new ServiceRpcResultSpBuilder()
467 -                    .setNotificationType(ServicePathNotificationTypes.ServiceImplementationRequest)
468 -                    .setServiceName(input.getServiceName())
469 -                    .setStatus(RpcStatusEx.Pending)
470 -                    .setStatusMessage("Service compliant, submitting serviceImplementation Request ...")
471 -                    .build();
472 -            try {
473 -                notificationPublishService.putNotification(notification);
474 -            } catch (InterruptedException e) {
475 -                LOG.info("notification offer rejected : {}", e);
476 +            SendingRendererRPCs sendingRenderer = new SendingRendererRPCs();
477 +            sendingRenderer.serviceImplementation(input);
478 +            if (sendingRenderer.getSuccess()) {
479 +                message = "Service implemented !";
480 +                LOG.info(message);
481 +                responseCode = "200";
482 +            } else {
483 +                message = "Service implementation failed : " + sendingRenderer.getError();
484 +                LOG.error(message);
485 +                responseCode = "500";
486              }
487 -
488 -            SendingRendererRPCs sendingRenderer = new SendingRendererRPCs(executor);
489 -            FutureCallback<Boolean> rendererCallback =
490 -                    new FutureCallback<Boolean>() {
491 -                String message = "";
492 -                ServiceRpcResultSp notification = null;
493 -
494 -                @Override
495 -                public void onFailure(Throwable arg0) {
496 -                    LOG.error("Failure message : {}", arg0.toString());
497 -                    LOG.error("Service implementation failed !");
498 -                    notification = new ServiceRpcResultSpBuilder()
499 -                            .setNotificationType(ServicePathNotificationTypes.ServiceImplementationRequest)
500 -                            .setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Failed)
501 -                            .setStatusMessage("PCR Request failed  : {}" + arg0.getMessage()).build();
502 -                    try {
503 -                        notificationPublishService.putNotification(notification);
504 -                    } catch (InterruptedException e) {
505 -                        LOG.info("notification offer rejected : {}", e);
506 -                    }
507 -                }
508 -
509 -                @Override
510 -                public void onSuccess(Boolean response) {
511 -                    LOG.info("response : {}", response);
512 -                    if (response) {
513 -                        message = "Service implemented !";
514 -                        TopologyBuilder topo = sendingRenderer.getTopology();
515 -                        ServiceRpcResultSpBuilder tmp = new ServiceRpcResultSpBuilder()
516 -                                .setNotificationType(ServicePathNotificationTypes.ServiceImplementationRequest)
517 -                                .setServiceName(input.getServiceName())
518 -                                .setStatus(RpcStatusEx.Successful)
519 -                                .setStatusMessage(message);
520 -                        if (topo != null) {
521 -                            PathTopology value = new PathTopologyBuilder()
522 -                                    .setAToZ(topo.getAToZ())
523 -                                    .setZToA(topo.getZToA())
524 -                                    .build();
525 -                            tmp.setPathTopology(value);
526 -                        }
527 -                        notification = tmp.build();
528 -                    } else {
529 -                        message = "Service implementation failed : " + sendingRenderer.getError();
530 -                        notification = new ServiceRpcResultSpBuilder()
531 -                                .setNotificationType(ServicePathNotificationTypes.ServiceImplementationRequest)
532 -                                .setServiceName("")
533 -                                .setStatus(RpcStatusEx.Failed).setStatusMessage(message)
534 -                                .build();
535 -                    }
536 -                    LOG.info(notification.toString());
537 -                    try {
538 -                        notificationPublishService.putNotification(notification);
539 -                    } catch (InterruptedException e) {
540 -                        LOG.info("notification offer rejected : {}", e);
541 -                    }
542 -                    LOG.info(message);
543 -                }
544 -            };
545 -            ListenableFuture<Boolean> renderer = sendingRenderer.serviceImplementation();
546 -            Futures.addCallback(renderer, rendererCallback, executor);
547 -            LOG.info("Service implmentation Request in progress ");
548 -            configurationResponseCommon = new ConfigurationResponseCommonBuilder()
549 -                    .setAckFinalIndicator("Yes")
550 -                    .setRequestId(input.getServiceHandlerHeader().getRequestId())
551 -                    .setResponseCode("200")
552 -                    .setResponseMessage("Service implementation Request in progress ");
553 -
554 -            ServiceImplementationRequestOutput output = new ServiceImplementationRequestOutputBuilder()
555 -                    .setConfigurationResponseCommon(configurationResponseCommon.build())
556 -                    .build();
557 -            return RpcResultBuilder.success(output).buildFuture();
558          } else {
559 -            message = compliancyCheck.getMessage();
560 +            message = "Service not compliant";
561              responseCode = "500";
562 -            LOG.info("Service not compliant caused by : {}", message);
563 -            notification = new ServiceRpcResultSpBuilder()
564 -                    .setNotificationType(ServicePathNotificationTypes.ServiceDelete)
565 -                    .setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Failed)
566 -                    .setStatusMessage("Service not compliant caused by : " + message)
567 -                    .build();
568 -            try {
569 -                notificationPublishService.putNotification(notification);
570 -            } catch (InterruptedException e) {
571 -                LOG.info("notification offer rejected : {}", e);
572 -            }
573          }
574          configurationResponseCommon = new ConfigurationResponseCommonBuilder()
575 -                .setAckFinalIndicator("yes")
576 -                .setRequestId(input.getServiceHandlerHeader().getRequestId())
577 -                .setResponseCode(responseCode)
578 -                .setResponseMessage(message);
579 +            .setAckFinalIndicator("yes")
580 +            .setRequestId(input.getServiceHandlerHeader().getRequestId())
581 +            .setResponseCode(responseCode)
582 +            .setResponseMessage(message);
583          ServiceImplementationRequestOutput output = new ServiceImplementationRequestOutputBuilder()
584 -                .setConfigurationResponseCommon(configurationResponseCommon.build())
585 -                .build();
586 -
587 +            .setConfigurationResponseCommon(configurationResponseCommon.build())
588 +            .build();
589          return RpcResultBuilder.success(output).buildFuture();
590      }
591  
592 @@ -195,108 +90,55 @@ public class StubrendererImpl implements StubrendererService {
593          LOG.info("RPC serviceDelete request received");
594          String responseCode = "";
595          ConfigurationResponseCommonBuilder configurationResponseCommon = null;
596 -        compliancyCheck = new StubrendererCompliancyCheck(input.getServiceName(), input.getServiceHandlerHeader());
597 -        if (compliancyCheck.check(false, true)) {
598 +        this.compliancyCheck = new StubrendererCompliancyCheck(input.getServiceName(), input.getServiceHandlerHeader());
599 +        if (this.compliancyCheck.check(false, true)) {
600              LOG.info("Service compliant !");
601              /**
602               * If compliant, service-request parameters are verified in order to
603               * check if there is no missing parameter that prevents calculating
604               * a path and implement a service.
605               */
606 -
607 -            notification = new ServiceRpcResultSpBuilder()
608 -                    .setNotificationType(ServicePathNotificationTypes.ServiceDelete)
609 -                    .setServiceName(input.getServiceName())
610 -                    .setStatus(RpcStatusEx.Pending)
611 -                    .setStatusMessage("Service compliant, submitting serviceDelete Request ...")
612 -                    .build();
613 -            try {
614 -                notificationPublishService.putNotification(notification);
615 -            } catch (InterruptedException e) {
616 -                LOG.info("notification offer rejected : {}", e);
617 +            SendingRendererRPCs sendingRenderer = new SendingRendererRPCs();
618 +            sendingRenderer.serviceDelete(input);
619 +            if (sendingRenderer.getSuccess()) {
620 +                message = "Service deleted !";
621 +                responseCode = "200";
622 +                LOG.info(message);
623 +            } else {
624 +                message = "Service implementation failed : " + sendingRenderer.getError();
625 +                LOG.error(message);
626 +                responseCode = "500";
627              }
628 -            SendingRendererRPCs sendingRenderer = new SendingRendererRPCs(executor);
629 -            FutureCallback<Boolean> rendererCallback = new FutureCallback<Boolean>() {
630 -                String message = "";
631 -                ServiceRpcResultSp notification = null;
632 -
633 -                @Override
634 -                public void onFailure(Throwable arg0) {
635 -                    LOG.error("Failure message : {}", arg0.toString());
636 -                    LOG.error("Service delete failed !");
637 -                    notification = new ServiceRpcResultSpBuilder()
638 -                            .setNotificationType(ServicePathNotificationTypes.ServiceDelete)
639 -                            .setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Failed)
640 -                            .setStatusMessage("PCR Request failed  : " + arg0.getMessage()).build();
641 -                    try {
642 -                        notificationPublishService.putNotification(notification);
643 -                    } catch (InterruptedException e) {
644 -                        LOG.info("notification offer rejected : {}", e);
645 -                    }
646 -                }
647 -
648 -                @Override
649 -                public void onSuccess(Boolean response) {
650 -                    LOG.info("response : {}", response);
651 -                    if (response) {
652 -                        message = "Service deleted !";
653 -                        notification = new ServiceRpcResultSpBuilder()
654 -                                .setNotificationType(ServicePathNotificationTypes.ServiceDelete)
655 -                                .setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Successful)
656 -                                .setStatusMessage(message).build();
657 -                    } else {
658 -                        message = "Service delete failed : " + sendingRenderer.getError();
659 -                        notification = new ServiceRpcResultSpBuilder()
660 -                                .setNotificationType(ServicePathNotificationTypes.ServiceDelete)
661 -                                .setServiceName("")
662 -                                .setStatus(RpcStatusEx.Failed).setStatusMessage(message)
663 -                                .build();
664 -                    }
665 -                    LOG.info(notification.toString());
666 -                    try {
667 -                        notificationPublishService.putNotification(notification);
668 -                    } catch (InterruptedException e) {
669 -                        LOG.info("notification offer rejected : {}", e);
670 -                    }
671 -                    LOG.info(message);
672 -                }
673 -            };
674 -            ListenableFuture<Boolean> renderer = sendingRenderer.serviceDelete();
675 -            Futures.addCallback(renderer, rendererCallback, executor);
676 -            message = "Service delete Request in progress ...";
677 -            LOG.info(message);
678 -            configurationResponseCommon = new ConfigurationResponseCommonBuilder()
679 -                    .setAckFinalIndicator("Yes")
680 -                    .setRequestId(input.getServiceHandlerHeader().getRequestId())
681 -                    .setResponseCode("200")
682 -                    .setResponseMessage(message);
683 -            ServiceDeleteOutput output = new ServiceDeleteOutputBuilder()
684 -                    .setConfigurationResponseCommon(configurationResponseCommon.build())
685 -                    .build();
686 -            return RpcResultBuilder.success(output).buildFuture();
687          } else {
688 -            message = compliancyCheck.getMessage();
689 -            LOG.info("Service not compliant caused by : {}", message);
690 +            message = "Service not compliant";
691              responseCode = "500";
692 -            notification = new ServiceRpcResultSpBuilder()
693 -                    .setNotificationType(ServicePathNotificationTypes.ServiceDelete)
694 -                    .setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Failed)
695 -                    .setStatusMessage("Service not compliant caused by : " + message)
696 -                    .build();
697 -            try {
698 -                notificationPublishService.putNotification(notification);
699 -            } catch (InterruptedException e) {
700 -                LOG.info("notification offer rejected : {}", e);
701 -            }
702          }
703          configurationResponseCommon = new ConfigurationResponseCommonBuilder()
704 -                .setAckFinalIndicator("yes")
705 -                .setRequestId(input.getServiceHandlerHeader().getRequestId())
706 -                .setResponseCode(responseCode)
707 -                .setResponseMessage(message);
708 +            .setAckFinalIndicator("yes")
709 +            .setRequestId(input.getServiceHandlerHeader().getRequestId())
710 +            .setResponseCode(responseCode)
711 +            .setResponseMessage(message);
712          ServiceDeleteOutput output = new ServiceDeleteOutputBuilder()
713 -                .setConfigurationResponseCommon(configurationResponseCommon.build())
714 -                .build();
715 +            .setConfigurationResponseCommon(configurationResponseCommon.build())
716 +            .build();
717          return RpcResultBuilder.success(output).buildFuture();
718      }
719 +
720 +    /* (non-Javadoc)
721 +     * @see org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.TransportpceServicepathService#cancelResourceReserve(org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.CancelResourceReserveInput)
722 +     */
723 +    @Override
724 +    public Future<RpcResult<CancelResourceReserveOutput>> cancelResourceReserve(CancelResourceReserveInput input) {
725 +        // TODO Auto-generated method stub
726 +        return null;
727 +    }
728 +
729 +    /* (non-Javadoc)
730 +     * @see org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.TransportpceServicepathService#pathComputationRequest(org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.PathComputationRequestInput)
731 +     */
732 +    @Override
733 +    public Future<RpcResult<PathComputationRequestOutput>> pathComputationRequest(PathComputationRequestInput input) {
734 +        // TODO Auto-generated method stub
735 +        return null;
736 +    }
737  }
738 diff --git a/tests/stubrenderer/src/main/java/org/opendaylight/transportpce/stubrenderer/impl/StubrendererProvider.java b/tests/stubrenderer/src/main/java/org/opendaylight/transportpce/stubrenderer/impl/StubrendererProvider.java
739 index 6dcdb8e..92b20f5 100644
740 --- a/tests/stubrenderer/src/main/java/org/opendaylight/transportpce/stubrenderer/impl/StubrendererProvider.java
741 +++ b/tests/stubrenderer/src/main/java/org/opendaylight/transportpce/stubrenderer/impl/StubrendererProvider.java
742 @@ -13,9 +13,7 @@ import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService
743  import org.opendaylight.controller.md.sal.binding.api.NotificationService;
744  import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
745  import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
746 -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.StubrendererListener;
747 -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.StubrendererService;
748 -import org.opendaylight.yangtools.concepts.ListenerRegistration;
749 +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.TransportpceServicepathService;
750  import org.slf4j.Logger;
751  import org.slf4j.LoggerFactory;
752  
753 @@ -27,17 +25,13 @@ import org.slf4j.LoggerFactory;
754  public class StubrendererProvider {
755      private static final Logger LOG = LoggerFactory.getLogger(StubrendererProvider.class);
756      private final RpcProviderRegistry rpcRegistry;
757 -    private final NotificationPublishService notificationPublishService;
758  
759 -
760 -    private BindingAwareBroker.RpcRegistration<StubrendererService> rpcRegistration;
761 -    private ListenerRegistration<StubrendererListener> stubRendererlistenerRegistration;
762 +    private BindingAwareBroker.RpcRegistration<TransportpceServicepathService> rpcRegistration;
763  
764      public StubrendererProvider(RpcProviderRegistry rpcProviderRegistry,
765              NotificationService notificationService,
766              NotificationPublishService notificationPublishService) {
767          this.rpcRegistry = rpcProviderRegistry;
768 -        this.notificationPublishService = notificationPublishService;
769      }
770  
771      /**
772 @@ -45,8 +39,8 @@ public class StubrendererProvider {
773       */
774      public void init() {
775          LOG.info("StubrendererProvider Session Initiated");
776 -        final StubrendererImpl consumer = new StubrendererImpl(notificationPublishService);
777 -        rpcRegistration = rpcRegistry.addRpcImplementation(StubrendererService.class, consumer);
778 +        final StubrendererImpl consumer = new StubrendererImpl();
779 +        this.rpcRegistration = this.rpcRegistry.addRpcImplementation(TransportpceServicepathService.class, consumer);
780      }
781  
782      /**
783 @@ -54,7 +48,6 @@ public class StubrendererProvider {
784       */
785      public void close() {
786          LOG.info("StubrendererProvider Closed");
787 -        rpcRegistration.close();
788 -        stubRendererlistenerRegistration.close();
789 +        this.rpcRegistration.close();
790      }
791  }