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