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
6 package org.opendaylight.transportpce.servicehandler;
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);
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<>();
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()) {
55 - AToZKey key = new AToZKey(tmp.key().getId());
56 - AToZ atoz = new AToZBuilder().setId(tmp.getId()).withKey(key)
57 - // .setResource(tmp.getResource())
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())
72 - Topology topology = new TopologyBuilder().setAToZ(atozList).setZToA(ztoaList).build();
73 - service.setTopology(topology);
76 return service.build();
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;
97 //TODO: remove private request fields as they are in global scope
99 @@ -145,8 +147,9 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService {
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);
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;
127 import java.util.concurrent.ExecutionException;
128 import java.util.concurrent.Future;
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;
142 public StubRendererServiceOperations(NotificationPublishService notificationPublishService) {
143 - this.stubrenderer = new StubrendererImpl(notificationPublishService);
144 + this.stubrenderer = new StubrendererImpl();
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);
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
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);
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
181 package org.opendaylight.transportpce.stubrenderer;
183 -import com.google.common.util.concurrent.ListenableFuture;
184 -import com.google.common.util.concurrent.ListeningExecutorService;
186 import java.util.ArrayList;
187 import java.util.List;
188 -import java.util.concurrent.Callable;
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;
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;
209 - public SendingRendererRPCs(ListeningExecutorService executor) {
211 + public SendingRendererRPCs() {
212 + this.success = true;
214 - this.executor = executor;
218 private void buildAtoZ() {
219 - atoz = new ArrayList<AToZ>();
220 + this.atoz = new ArrayList<AToZ>();
223 private void buildZtoA() {
224 - ztoa = new ArrayList<ZToA>();
225 + this.ztoa = new ArrayList<ZToA>();
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 ...");
234 - return executor.submit(new Callable<Boolean>() {
236 - public Boolean call() throws Exception {
237 - Boolean output = true;
238 - LOG.info("Wait for 10s til beginning the Renderer serviceDelete request");
240 - Thread.sleep(10000); //sleep for 10s
241 - } catch (InterruptedException e) {
243 - LOG.error("Thread.sleep failed : {}", e.toString());
251 + LOG.info("Wait for 10s til beginning the Renderer serviceDelete request");
253 + Thread.sleep(1000); //sleep for 1s
254 + } catch (InterruptedException e) {
255 + message = "deleting service failed !";
256 + LOG.error(message);
257 + responseCode = "500";
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())
271 - public ListenableFuture<Boolean> serviceImplementation() {
272 + public ServiceImplementationRequestOutput serviceImplementation(ServiceImplementationRequestInput input) {
273 + String message = "Service implemented !";
274 + String responseCode = "200";
276 LOG.info("serviceImplementation request ...");
278 - return executor.submit(new Callable<Boolean>() {
280 - public Boolean call() throws Exception {
281 - Boolean output = true;
282 - LOG.info("Wait for 10s til beginning the Renderer serviceDelete request");
284 - Thread.sleep(10000); //sleep for 10s
285 - } catch (InterruptedException e) {
287 - LOG.error("Thread.sleep failed : {}", e.toString());
291 - setTopology(new TopologyBuilder()
299 + LOG.info("Wait for 10s til beginning the Renderer serviceDelete request");
301 + Thread.sleep(1000); //sleep for 1s
302 + } catch (InterruptedException e) {
303 + message = "implementing service failed !";
304 + LOG.error(message);
306 + responseCode = "500";
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())
325 public Boolean getSuccess() {
327 + return this.success;
330 public void setSuccess(Boolean success) {
331 @@ -115,7 +122,7 @@ public class SendingRendererRPCs {
334 public TopologyBuilder getTopology() {
336 + return this.topology;
339 public void setTopology(TopologyBuilder topo) {
340 @@ -123,7 +130,7 @@ public class SendingRendererRPCs {
343 public String getError() {
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
355 package org.opendaylight.transportpce.stubrenderer.impl;
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
399 -public class StubrendererImpl implements StubrendererService {
400 +public class StubrendererImpl implements TransportpceServicepathService {
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;
411 - public StubrendererImpl(NotificationPublishService notificationPublishService) {
412 - this.notificationPublishService = notificationPublishService;
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.
422 - this.notification = new ServiceRpcResultSpBuilder()
423 - .setNotificationType(ServicePathNotificationTypes.ServiceImplementationRequest)
424 - .setServiceName(input.getServiceName())
425 - .setStatus(RpcStatusEx.Pending)
426 - .setStatusMessage("Service compliant, submitting serviceImplementation Request ...")
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 !";
437 + responseCode = "200";
439 + message = "Service implementation failed : " + sendingRenderer.getError();
440 + LOG.error(message);
441 + responseCode = "500";
444 - SendingRendererRPCs sendingRenderer = new SendingRendererRPCs(this.executor);
445 - FutureCallback<Boolean> rendererCallback =
446 - new FutureCallback<Boolean>() {
447 - String message = "";
448 - ServiceRpcResultSp notification = null;
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();
459 - StubrendererImpl.this.notificationPublishService.putNotification(this.notification);
460 - } catch (InterruptedException e) {
461 - LOG.info("notification offer rejected : {}", e);
466 - public void onSuccess(Boolean response) {
467 - LOG.info("response : {}", 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())
481 - tmp.setPathTopology(value);
483 - this.notification = tmp.build();
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)
492 - LOG.info(this.notification.toString());
494 - StubrendererImpl.this.notificationPublishService.putNotification(this.notification);
495 - } catch (InterruptedException e) {
496 - LOG.info("notification offer rejected : {}", e);
498 - LOG.info(this.message);
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 ");
510 - ServiceImplementationRequestOutput output = new ServiceImplementationRequestOutputBuilder()
511 - .setConfigurationResponseCommon(configurationResponseCommon.build())
513 - return RpcResultBuilder.success(output).buildFuture();
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)
525 - this.notificationPublishService.putNotification(this.notification);
526 - } catch (InterruptedException e) {
527 - LOG.info("notification offer rejected : {}", e);
530 configurationResponseCommon = new ConfigurationResponseCommonBuilder()
531 .setAckFinalIndicator("yes")
532 @@ -201,90 +101,20 @@ public class StubrendererImpl implements StubrendererService {
533 * a path and implement a service.
536 - this.notification = new ServiceRpcResultSpBuilder()
537 - .setNotificationType(ServicePathNotificationTypes.ServiceDelete)
538 - .setServiceName(input.getServiceName())
539 - .setStatus(RpcStatusEx.Pending)
540 - .setStatusMessage("Service compliant, submitting serviceDelete Request ...")
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";
553 + message = "Service implementation failed : " + sendingRenderer.getError();
554 + LOG.error(message);
555 + responseCode = "500";
557 - SendingRendererRPCs sendingRenderer = new SendingRendererRPCs(this.executor);
558 - FutureCallback<Boolean> rendererCallback = new FutureCallback<Boolean>() {
559 - String message = "";
560 - ServiceRpcResultSp notification = null;
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();
571 - StubrendererImpl.this.notificationPublishService.putNotification(this.notification);
572 - } catch (InterruptedException e) {
573 - LOG.info("notification offer rejected : {}", e);
578 - public void onSuccess(Boolean response) {
579 - LOG.info("response : {}", 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();
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)
594 - LOG.info(this.notification.toString());
596 - StubrendererImpl.this.notificationPublishService.putNotification(this.notification);
597 - } catch (InterruptedException e) {
598 - LOG.info("notification offer rejected : {}", e);
600 - LOG.info(this.message);
603 - ListenableFuture<Boolean> renderer = sendingRenderer.serviceDelete();
604 - Futures.addCallback(renderer, rendererCallback, this.executor);
605 - message = "Service delete Request in progress ...";
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())
615 - return RpcResultBuilder.success(output).buildFuture();
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)
627 - this.notificationPublishService.putNotification(this.notification);
628 - } catch (InterruptedException e) {
629 - LOG.info("notification offer rejected : {}", e);
632 configurationResponseCommon = new ConfigurationResponseCommonBuilder()
633 .setAckFinalIndicator("yes")
634 @@ -296,4 +126,24 @@ public class StubrendererImpl implements StubrendererService {
636 return RpcResultBuilder.success(output).buildFuture();
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)
643 + public ListenableFuture<RpcResult<PathComputationRequestOutput>> pathComputationRequest(
644 + PathComputationRequestInput input) {
645 + // TODO Auto-generated method stub
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)
653 + public ListenableFuture<RpcResult<CancelResourceReserveOutput>> cancelResourceReserve(
654 + CancelResourceReserveInput input) {
655 + // TODO Auto-generated method stub
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;
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;
681 - private BindingAwareBroker.RpcRegistration<StubrendererService> rpcRegistration;
682 - private ListenerRegistration<StubrendererListener> stubRendererlistenerRegistration;
683 + private BindingAwareBroker.RpcRegistration<TransportpceServicepathService> rpcRegistration;
685 public StubrendererProvider(RpcProviderRegistry rpcProviderRegistry,
686 NotificationService notificationService,
687 NotificationPublishService notificationPublishService) {
688 this.rpcRegistry = rpcProviderRegistry;
689 - this.notificationPublishService = notificationPublishService;
693 @@ -45,8 +39,8 @@ public class StubrendererProvider {
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);