X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=tests%2FSH_stubs.diff;h=9d423a20cf94f7a5223c2d5b3e53fd6f99c1e2fc;hb=03990b8d83db699a59a85b3484a9a5c1b8c87448;hp=088fdfe44448beaaae2e28d9facdb8c842400f71;hpb=217f3afb6b4a51a5dd5124ae057dd3d37a6d7fb2;p=transportpce.git diff --git a/tests/SH_stubs.diff b/tests/SH_stubs.diff index 088fdfe44..9d423a20c 100644 --- a/tests/SH_stubs.diff +++ b/tests/SH_stubs.diff @@ -1,703 +1,22 @@ -diff --git a/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/ModelMappingUtils.java b/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/ModelMappingUtils.java -index e5b44c4..a063b9e 100644 ---- a/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/ModelMappingUtils.java -+++ b/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/ModelMappingUtils.java -@@ -8,8 +8,6 @@ - package org.opendaylight.transportpce.servicehandler; - - import com.google.common.util.concurrent.ListenableFuture; --import java.util.ArrayList; --import java.util.List; - import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev170426.PathComputationRequestOutput; - import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev170426.path.computation.request.input.ServiceAEnd; - import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev170426.path.computation.request.input.ServiceAEndBuilder; -@@ -18,8 +16,6 @@ import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev17 - import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.configuration.response.common.ConfigurationResponseCommon; - import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.configuration.response.common.ConfigurationResponseCommonBuilder; - import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.response.parameters.ResponseParametersBuilder; --import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.service.Topology; --import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.service.TopologyBuilder; - import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev161014.LifecycleState; - import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev161014.State; - import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceCreateInput; -@@ -31,12 +27,6 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.Service - import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceReconfigureInput; - import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.list.Services; - import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.list.ServicesBuilder; --import org.opendaylight.yang.gen.v1.http.org.openroadm.topology.rev161014.topology.AToZ; --import org.opendaylight.yang.gen.v1.http.org.openroadm.topology.rev161014.topology.AToZBuilder; --import org.opendaylight.yang.gen.v1.http.org.openroadm.topology.rev161014.topology.AToZKey; --import org.opendaylight.yang.gen.v1.http.org.openroadm.topology.rev161014.topology.ZToA; --import org.opendaylight.yang.gen.v1.http.org.openroadm.topology.rev161014.topology.ZToABuilder; --import org.opendaylight.yang.gen.v1.http.org.openroadm.topology.rev161014.topology.ZToAKey; - import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev170426.routing.constraints.sp.HardConstraintsBuilder; - import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev170426.routing.constraints.sp.SoftConstraintsBuilder; - import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.service.endpoint.sp.RxDirection; -@@ -238,42 +228,6 @@ public final class ModelMappingUtils { - .setSoftConstraints(serviceReconfigureInput.getSoftConstraints()) - .setLifecycleState(LifecycleState.Planned).setServiceAEnd(aend).setServiceZEnd(zend); - } -- -- org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.response -- .parameters.sp.ResponseParameters responseParameters = output.getResponseParameters(); -- if (responseParameters != null) { -- // service.setPceMetric(responseParameters.getPceMetric()); -- org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426 -- .response.parameters.sp.response.parameters.PathDescription pathDescription = -- responseParameters.getPathDescription(); -- if (pathDescription != null) { -- List atozList = new ArrayList<>(); -- List ztoaList = new ArrayList<>(); -- -- for (org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426 -- .path.description.atoz.direction.AToZ tmp : pathDescription.getAToZDirection().getAToZ()) { -- -- AToZKey key = new AToZKey(tmp.key().getId()); -- AToZ atoz = new AToZBuilder().setId(tmp.getId()).withKey(key) -- // .setResource(tmp.getResource()) -- .build(); -- atozList.add(atoz); -- } -- -- for (org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426 -- .path.description.ztoa.direction.ZToA -- tmp : pathDescription.getZToADirection().getZToA()) { -- ZToAKey key = new ZToAKey(tmp.key().getId()); -- ZToA ztoa = new ZToABuilder().setId(tmp.getId()).withKey(key) -- // .setResource(tmp.getResource()) -- .build(); -- ztoaList.add(ztoa); -- } -- -- Topology topology = new TopologyBuilder().setAToZ(atozList).setZToA(ztoaList).build(); -- service.setTopology(topology); -- } -- } - return service.build(); - } - -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 -index b81e9b4..c5b5045 100644 ---- a/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/impl/ServicehandlerImpl.java -+++ b/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/impl/ServicehandlerImpl.java -@@ -27,6 +27,7 @@ import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOper - import org.opendaylight.transportpce.servicehandler.validation.ServiceCreateValidation; - import org.opendaylight.transportpce.servicehandler.validation.checks.ComplianceCheckResult; - import org.opendaylight.transportpce.servicehandler.validation.checks.ServicehandlerCompliancyCheck; -+import org.opendaylight.transportpce.stubrenderer.SendingRendererRPCs; - import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev170426.PathComputationRequestOutput; - import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.RpcActions; - import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.sdnc.request.header.SdncRequestHeaderBuilder; -@@ -89,6 +90,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService { - private ServiceDataStoreOperations serviceDataStoreOperations; - private RendererServiceOperations rendererServiceOperations; - private PCEServiceWrapper pceServiceWrapper; -+ private SendingRendererRPCs stubrendererService; - - //TODO: remove private request fields as they are in global scope - -@@ -145,8 +147,9 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService { - - ServiceImplementationRequestInput serviceImplementationRequest = - ModelMappingUtils.createServiceImplementationRequest(input, pceResponse); -+ this.stubrendererService = new SendingRendererRPCs(); - org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426 -- .ServiceImplementationRequestOutput serviceImplementationRequestOutput = this.rendererServiceOperations -+ .ServiceImplementationRequestOutput serviceImplementationRequestOutput = this.stubrendererService - .serviceImplementation(serviceImplementationRequest); - if (ResponseCodes.RESPONSE_OK - .equals(serviceImplementationRequestOutput.getConfigurationResponseCommon().getResponseCode())) { -@@ -215,8 +218,9 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService { - LOG.debug("Service '{}' present in datastore !", serviceName); - org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceDeleteInput - serviceDeleteInput = ModelMappingUtils.createServiceDeleteInput(input); -+ this.stubrendererService = new SendingRendererRPCs(); - org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426 -- .ServiceDeleteOutput output = this.rendererServiceOperations.serviceDelete(serviceDeleteInput); -+ .ServiceDeleteOutput output = this.stubrendererService.serviceDelete(serviceDeleteInput); - - if (!ResponseCodes.RESPONSE_OK - .equals(output.getConfigurationResponseCommon().getResponseCode())) { -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 -index 6db468c..76e4a26 100644 ---- a/servicehandler/src/test/java/org/opendaylight/transportpce/servicehandler/stub/StubRendererServiceOperations.java -+++ b/servicehandler/src/test/java/org/opendaylight/transportpce/servicehandler/stub/StubRendererServiceOperations.java -@@ -9,13 +9,8 @@ package org.opendaylight.transportpce.servicehandler.stub; - - import java.util.concurrent.ExecutionException; - import java.util.concurrent.Future; -- - import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService; +diff --git a/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/impl/ServicehandlerProvider.java b/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/impl/ServicehandlerProvider.java +index 1c8ddfe..b83b8cc 100644 +--- a/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/impl/ServicehandlerProvider.java ++++ b/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/impl/ServicehandlerProvider.java +@@ -18,6 +18,7 @@ import org.opendaylight.transportpce.renderer.NetworkModelWavelengthService; import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations; --import org.opendaylight.transportpce.servicehandler.mappers.ServiceDeleteInputConverter; --import org.opendaylight.transportpce.servicehandler.mappers.ServiceDeleteOutputConverter; --import org.opendaylight.transportpce.servicehandler.mappers.ServiceImplementationRequestInputConverter; --import org.opendaylight.transportpce.servicehandler.mappers.ServiceImplementationRequestOutputConverter; - import org.opendaylight.transportpce.stubrenderer.impl.StubrendererImpl; - import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceDeleteInput; - import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceDeleteOutput; -@@ -30,16 +25,15 @@ public class StubRendererServiceOperations implements RendererServiceOperations - private StubrendererImpl stubrenderer; - - public StubRendererServiceOperations(NotificationPublishService notificationPublishService) { -- this.stubrenderer = new StubrendererImpl(notificationPublishService); -+ this.stubrenderer = new StubrendererImpl(); - } - - @Override - public ServiceImplementationRequestOutput serviceImplementation(ServiceImplementationRequestInput input) { -- Future> rpcResultFuture = this.stubrenderer -- .serviceImplementationRequest(ServiceImplementationRequestInputConverter.getStub(input)); -+ Future> rpcResultFuture = this.stubrenderer -+ .serviceImplementationRequest(input); - try { -- return ServiceImplementationRequestOutputConverter.getConcrete(rpcResultFuture.get().getResult()); -+ return rpcResultFuture.get().getResult(); - } catch (InterruptedException e) { - LOG.error("RPC serviceImplementation failed !",e); - } catch (ExecutionException e) { -@@ -50,11 +44,10 @@ public class StubRendererServiceOperations implements RendererServiceOperations - - @Override - public ServiceDeleteOutput serviceDelete(ServiceDeleteInput input) { -- Future> rpcResultFuture = this.stubrenderer -- .serviceDelete(ServiceDeleteInputConverter.getStub(input)); -+ Future> rpcResultFuture = this.stubrenderer -+ .serviceDelete(input); - try { -- return ServiceDeleteOutputConverter.getConcrete(rpcResultFuture.get().getResult()); -+ return rpcResultFuture.get().getResult(); - } catch (InterruptedException e) { - LOG.error("RPC serviceDelete failed !",e); - } catch (ExecutionException e) { -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 -index cdcdc0e..b43535f 100644 ---- a/tests/stubrenderer/src/main/java/org/opendaylight/transportpce/stubrenderer/SendingRendererRPCs.java -+++ b/tests/stubrenderer/src/main/java/org/opendaylight/transportpce/stubrenderer/SendingRendererRPCs.java -@@ -8,16 +8,18 @@ - - package org.opendaylight.transportpce.stubrenderer; - --import com.google.common.util.concurrent.ListenableFuture; --import com.google.common.util.concurrent.ListeningExecutorService; -- - import java.util.ArrayList; - import java.util.List; --import java.util.concurrent.Callable; -- -+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.configuration.response.common.ConfigurationResponseCommonBuilder; - import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.service.TopologyBuilder; - import org.opendaylight.yang.gen.v1.http.org.openroadm.topology.rev161014.topology.AToZ; - import org.opendaylight.yang.gen.v1.http.org.openroadm.topology.rev161014.topology.ZToA; -+import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceDeleteInput; -+import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceDeleteOutput; -+import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceDeleteOutputBuilder; -+import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceImplementationRequestInput; -+import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceImplementationRequestOutput; -+import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceImplementationRequestOutputBuilder; - import org.slf4j.Logger; - import org.slf4j.LoggerFactory; - -@@ -41,73 +43,78 @@ public class SendingRendererRPCs { - private List atoz; - private List ztoa; - private String error; -- private final ListeningExecutorService executor; - -- public SendingRendererRPCs(ListeningExecutorService executor) { -- success = true; -+ public SendingRendererRPCs() { -+ this.success = true; - setTopology(null); -- this.executor = executor; - setError(""); - } - - private void buildAtoZ() { -- atoz = new ArrayList(); -+ this.atoz = new ArrayList(); - } - - private void buildZtoA() { -- ztoa = new ArrayList(); -+ this.ztoa = new ArrayList(); - } - -- public ListenableFuture serviceDelete() { -+ public ServiceDeleteOutput serviceDelete(ServiceDeleteInput input) { -+ String message = "Service deleted !"; -+ String responseCode = "200"; - LOG.info("ServiceDelete request ..."); -- success = false; -- return executor.submit(new Callable() { -- @Override -- public Boolean call() throws Exception { -- Boolean output = true; -- LOG.info("Wait for 10s til beginning the Renderer serviceDelete request"); -- try { -- Thread.sleep(10000); //sleep for 10s -- } catch (InterruptedException e) { -- output = false; -- LOG.error("Thread.sleep failed : {}", e.toString()); -- } -- buildAtoZ(); -- buildZtoA(); -- success = true; -- return output; -- } -- }); -+ LOG.info("Wait for 10s til beginning the Renderer serviceDelete request"); -+ try { -+ Thread.sleep(1000); //sleep for 1s -+ } catch (InterruptedException e) { -+ message = "deleting service failed !"; -+ LOG.error(message); -+ responseCode = "500"; -+ setError(message); -+ } -+ ConfigurationResponseCommonBuilder configurationResponseCommon = new ConfigurationResponseCommonBuilder() -+ .setAckFinalIndicator("yes") -+ .setRequestId(input.getServiceHandlerHeader().getRequestId()) -+ .setResponseCode(responseCode) -+ .setResponseMessage(message); -+ ServiceDeleteOutput output = new ServiceDeleteOutputBuilder() -+ .setConfigurationResponseCommon(configurationResponseCommon.build()) -+ .build(); -+ return output; - } - -- public ListenableFuture serviceImplementation() { -+ public ServiceImplementationRequestOutput serviceImplementation(ServiceImplementationRequestInput input) { -+ String message = "Service implemented !"; -+ String responseCode = "200"; -+ setSuccess(true); - LOG.info("serviceImplementation request ..."); -- success = false; -- return executor.submit(new Callable() { -- @Override -- public Boolean call() throws Exception { -- Boolean output = true; -- LOG.info("Wait for 10s til beginning the Renderer serviceDelete request"); -- try { -- Thread.sleep(10000); //sleep for 10s -- } catch (InterruptedException e) { -- output = false; -- LOG.error("Thread.sleep failed : {}", e.toString()); -- } -- buildAtoZ(); -- buildZtoA(); -- setTopology(new TopologyBuilder() -- .setAToZ(atoz) -- .setZToA(ztoa)); -- output = true; -- success = true; -- return output; -- } -- }); -+ LOG.info("Wait for 10s til beginning the Renderer serviceDelete request"); -+ try { -+ Thread.sleep(1000); //sleep for 1s -+ } catch (InterruptedException e) { -+ message = "implementing service failed !"; -+ LOG.error(message); -+ setError(message); -+ responseCode = "500"; -+ setSuccess(false); -+ } -+ buildAtoZ(); -+ buildZtoA(); -+ setTopology(new TopologyBuilder() -+ .setAToZ(SendingRendererRPCs.this.atoz) -+ .setZToA(SendingRendererRPCs.this.ztoa)); -+ ConfigurationResponseCommonBuilder configurationResponseCommon = new ConfigurationResponseCommonBuilder() -+ .setAckFinalIndicator("yes") -+ .setRequestId(input.getServiceHandlerHeader().getRequestId()) -+ .setResponseCode(responseCode) -+ .setResponseMessage(message); -+ ServiceImplementationRequestOutput output = new ServiceImplementationRequestOutputBuilder() -+ .setConfigurationResponseCommon(configurationResponseCommon.build()) -+ .build(); -+ return output; - } - - public Boolean getSuccess() { -- return success; -+ return this.success; - } - - public void setSuccess(Boolean success) { -@@ -115,7 +122,7 @@ public class SendingRendererRPCs { - } - - public TopologyBuilder getTopology() { -- return topology; -+ return this.topology; - } - - public void setTopology(TopologyBuilder topo) { -@@ -123,7 +130,7 @@ public class SendingRendererRPCs { - } - - public String getError() { -- return error; -+ return this.error; - } - - public void setError(String error) { -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 -index 6e197d5..e3e1984 100644 ---- 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 -@@ -9,30 +9,21 @@ - - package org.opendaylight.transportpce.stubrenderer.impl; - --import com.google.common.util.concurrent.FutureCallback; --import com.google.common.util.concurrent.Futures; - import com.google.common.util.concurrent.ListenableFuture; --import com.google.common.util.concurrent.ListeningExecutorService; --import com.google.common.util.concurrent.MoreExecutors; --import java.util.concurrent.Executors; --import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService; - import org.opendaylight.transportpce.stubrenderer.SendingRendererRPCs; - import org.opendaylight.transportpce.stubrenderer.StubrendererCompliancyCheck; --import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.ServiceDeleteInput; --import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.ServiceDeleteOutput; --import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.ServiceDeleteOutputBuilder; --import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.ServiceImplementationRequestInput; --import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.ServiceImplementationRequestOutput; --import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.ServiceImplementationRequestOutputBuilder; --import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.ServiceRpcResultSp; --import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.ServiceRpcResultSpBuilder; --import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.StubrendererService; --import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.service.rpc.result.sp.PathTopology; --import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.service.rpc.result.sp.PathTopologyBuilder; - import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.configuration.response.common.ConfigurationResponseCommonBuilder; --import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.service.TopologyBuilder; --import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.RpcStatusEx; --import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.ServicePathNotificationTypes; -+import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.CancelResourceReserveInput; -+import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.CancelResourceReserveOutput; -+import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.PathComputationRequestInput; -+import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.PathComputationRequestOutput; -+import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceDeleteInput; -+import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceDeleteOutput; -+import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceDeleteOutputBuilder; -+import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceImplementationRequestInput; -+import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceImplementationRequestOutput; -+import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceImplementationRequestOutputBuilder; -+import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.TransportpceServicepathService; - import org.opendaylight.yangtools.yang.common.RpcResult; - import org.opendaylight.yangtools.yang.common.RpcResultBuilder; - import org.slf4j.Logger; -@@ -45,21 +36,12 @@ import org.slf4j.LoggerFactory; - * @author Martial Coulibaly ( martial.coulibaly@gfi.com ) on behalf of Orange - * - */ --public class StubrendererImpl implements StubrendererService { -+public class StubrendererImpl implements TransportpceServicepathService { - /** Logging. */ - private static final Logger LOG = LoggerFactory.getLogger(StubrendererImpl.class); -- /** send notification. */ -- private NotificationPublishService notificationPublishService; -- private ServiceRpcResultSp notification; -- private final ListeningExecutorService executor = MoreExecutors -- .listeningDecorator(Executors.newFixedThreadPool(10)); - /** check service sdnc-request-header compliancy. */ - private StubrendererCompliancyCheck compliancyCheck; - -- public StubrendererImpl(NotificationPublishService notificationPublishService) { -- this.notificationPublishService = notificationPublishService; -- } -- - @Override - public ListenableFuture> serviceImplementationRequest( - ServiceImplementationRequestInput input) { -@@ -77,102 +59,20 @@ public class StubrendererImpl implements StubrendererService { - * a path and implement a service. - */ - -- this.notification = new ServiceRpcResultSpBuilder() -- .setNotificationType(ServicePathNotificationTypes.ServiceImplementationRequest) -- .setServiceName(input.getServiceName()) -- .setStatus(RpcStatusEx.Pending) -- .setStatusMessage("Service compliant, submitting serviceImplementation Request ...") -- .build(); -- try { -- this.notificationPublishService.putNotification(this.notification); -- } catch (InterruptedException e) { -- LOG.info("notification offer rejected : {}", e); -+ SendingRendererRPCs sendingRenderer = new SendingRendererRPCs(); -+ sendingRenderer.serviceImplementation(input); -+ if (sendingRenderer.getSuccess()) { -+ message = "Service implemented !"; -+ LOG.info(message); -+ responseCode = "200"; -+ } else { -+ message = "Service implementation failed : " + sendingRenderer.getError(); -+ LOG.error(message); -+ responseCode = "500"; - } -- -- SendingRendererRPCs sendingRenderer = new SendingRendererRPCs(this.executor); -- FutureCallback rendererCallback = -- new FutureCallback() { -- String message = ""; -- ServiceRpcResultSp notification = null; -- -- @Override -- public void onFailure(Throwable arg0) { -- LOG.error("Failure message : {}", arg0.toString()); -- LOG.error("Service implementation failed !"); -- this.notification = new ServiceRpcResultSpBuilder() -- .setNotificationType(ServicePathNotificationTypes.ServiceImplementationRequest) -- .setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Failed) -- .setStatusMessage("PCR Request failed : {}" + arg0.getMessage()).build(); -- try { -- StubrendererImpl.this.notificationPublishService.putNotification(this.notification); -- } catch (InterruptedException e) { -- LOG.info("notification offer rejected : {}", e); -- } -- } -- -- @Override -- public void onSuccess(Boolean response) { -- LOG.info("response : {}", response); -- if (response) { -- this.message = "Service implemented !"; -- TopologyBuilder topo = sendingRenderer.getTopology(); -- ServiceRpcResultSpBuilder tmp = new ServiceRpcResultSpBuilder() -- .setNotificationType(ServicePathNotificationTypes.ServiceImplementationRequest) -- .setServiceName(input.getServiceName()) -- .setStatus(RpcStatusEx.Successful) -- .setStatusMessage(this.message); -- if (topo != null) { -- PathTopology value = new PathTopologyBuilder() -- .setAToZ(topo.getAToZ()) -- .setZToA(topo.getZToA()) -- .build(); -- tmp.setPathTopology(value); -- } -- this.notification = tmp.build(); -- } else { -- this.message = "Service implementation failed : " + sendingRenderer.getError(); -- this.notification = new ServiceRpcResultSpBuilder() -- .setNotificationType(ServicePathNotificationTypes.ServiceImplementationRequest) -- .setServiceName("") -- .setStatus(RpcStatusEx.Failed).setStatusMessage(this.message) -- .build(); -- } -- LOG.info(this.notification.toString()); -- try { -- StubrendererImpl.this.notificationPublishService.putNotification(this.notification); -- } catch (InterruptedException e) { -- LOG.info("notification offer rejected : {}", e); -- } -- LOG.info(this.message); -- } -- }; -- ListenableFuture renderer = sendingRenderer.serviceImplementation(); -- Futures.addCallback(renderer, rendererCallback, this.executor); -- LOG.info("Service implmentation Request in progress "); -- configurationResponseCommon = new ConfigurationResponseCommonBuilder() -- .setAckFinalIndicator("Yes") -- .setRequestId(input.getServiceHandlerHeader().getRequestId()) -- .setResponseCode("200") -- .setResponseMessage("Service implementation Request in progress "); -- -- ServiceImplementationRequestOutput output = new ServiceImplementationRequestOutputBuilder() -- .setConfigurationResponseCommon(configurationResponseCommon.build()) -- .build(); -- return RpcResultBuilder.success(output).buildFuture(); - } else { -- message = this.compliancyCheck.getMessage(); -+ message = "Service not compliant"; - responseCode = "500"; -- LOG.info("Service not compliant caused by : {}", message); -- this.notification = new ServiceRpcResultSpBuilder() -- .setNotificationType(ServicePathNotificationTypes.ServiceDelete) -- .setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Failed) -- .setStatusMessage("Service not compliant caused by : " + message) -- .build(); -- try { -- this.notificationPublishService.putNotification(this.notification); -- } catch (InterruptedException e) { -- LOG.info("notification offer rejected : {}", e); -- } - } - configurationResponseCommon = new ConfigurationResponseCommonBuilder() - .setAckFinalIndicator("yes") -@@ -201,90 +101,20 @@ public class StubrendererImpl implements StubrendererService { - * a path and implement a service. - */ - -- this.notification = new ServiceRpcResultSpBuilder() -- .setNotificationType(ServicePathNotificationTypes.ServiceDelete) -- .setServiceName(input.getServiceName()) -- .setStatus(RpcStatusEx.Pending) -- .setStatusMessage("Service compliant, submitting serviceDelete Request ...") -- .build(); -- try { -- this.notificationPublishService.putNotification(this.notification); -- } catch (InterruptedException e) { -- LOG.info("notification offer rejected : {}", e); -+ SendingRendererRPCs sendingRenderer = new SendingRendererRPCs(); -+ sendingRenderer.serviceDelete(input); -+ if (sendingRenderer.getSuccess()) { -+ message = "Service deleted !"; -+ responseCode = "200"; -+ LOG.info(message); -+ } else { -+ message = "Service implementation failed : " + sendingRenderer.getError(); -+ LOG.error(message); -+ responseCode = "500"; - } -- SendingRendererRPCs sendingRenderer = new SendingRendererRPCs(this.executor); -- FutureCallback rendererCallback = new FutureCallback() { -- String message = ""; -- ServiceRpcResultSp notification = null; -- -- @Override -- public void onFailure(Throwable arg0) { -- LOG.error("Failure message : {}", arg0.toString()); -- LOG.error("Service delete failed !"); -- this.notification = new ServiceRpcResultSpBuilder() -- .setNotificationType(ServicePathNotificationTypes.ServiceDelete) -- .setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Failed) -- .setStatusMessage("PCR Request failed : " + arg0.getMessage()).build(); -- try { -- StubrendererImpl.this.notificationPublishService.putNotification(this.notification); -- } catch (InterruptedException e) { -- LOG.info("notification offer rejected : {}", e); -- } -- } -- -- @Override -- public void onSuccess(Boolean response) { -- LOG.info("response : {}", response); -- if (response) { -- this.message = "Service deleted !"; -- this.notification = new ServiceRpcResultSpBuilder() -- .setNotificationType(ServicePathNotificationTypes.ServiceDelete) -- .setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Successful) -- .setStatusMessage(this.message).build(); -- } else { -- this.message = "Service delete failed : " + sendingRenderer.getError(); -- this.notification = new ServiceRpcResultSpBuilder() -- .setNotificationType(ServicePathNotificationTypes.ServiceDelete) -- .setServiceName("") -- .setStatus(RpcStatusEx.Failed).setStatusMessage(this.message) -- .build(); -- } -- LOG.info(this.notification.toString()); -- try { -- StubrendererImpl.this.notificationPublishService.putNotification(this.notification); -- } catch (InterruptedException e) { -- LOG.info("notification offer rejected : {}", e); -- } -- LOG.info(this.message); -- } -- }; -- ListenableFuture renderer = sendingRenderer.serviceDelete(); -- Futures.addCallback(renderer, rendererCallback, this.executor); -- message = "Service delete Request in progress ..."; -- LOG.info(message); -- configurationResponseCommon = new ConfigurationResponseCommonBuilder() -- .setAckFinalIndicator("Yes") -- .setRequestId(input.getServiceHandlerHeader().getRequestId()) -- .setResponseCode("200") -- .setResponseMessage(message); -- ServiceDeleteOutput output = new ServiceDeleteOutputBuilder() -- .setConfigurationResponseCommon(configurationResponseCommon.build()) -- .build(); -- return RpcResultBuilder.success(output).buildFuture(); - } else { -- message = this.compliancyCheck.getMessage(); -- LOG.info("Service not compliant caused by : {}", message); -+ message = "Service not compliant"; - responseCode = "500"; -- this.notification = new ServiceRpcResultSpBuilder() -- .setNotificationType(ServicePathNotificationTypes.ServiceDelete) -- .setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Failed) -- .setStatusMessage("Service not compliant caused by : " + message) -- .build(); -- try { -- this.notificationPublishService.putNotification(this.notification); -- } catch (InterruptedException e) { -- LOG.info("notification offer rejected : {}", e); -- } - } - configurationResponseCommon = new ConfigurationResponseCommonBuilder() - .setAckFinalIndicator("yes") -@@ -296,4 +126,24 @@ public class StubrendererImpl implements StubrendererService { - .build(); - return RpcResultBuilder.success(output).buildFuture(); - } -+ -+ /* (non-Javadoc) -+ * @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) -+ */ -+ @Override -+ public ListenableFuture> pathComputationRequest( -+ PathComputationRequestInput input) { -+ // TODO Auto-generated method stub -+ return null; -+ } -+ -+ /* (non-Javadoc) -+ * @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) -+ */ -+ @Override -+ public ListenableFuture> cancelResourceReserve( -+ CancelResourceReserveInput input) { -+ // TODO Auto-generated method stub -+ return null; -+ } - } -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 -index 0beb087..92b20f5 100644 ---- 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 -@@ -13,9 +13,7 @@ import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService - import org.opendaylight.controller.md.sal.binding.api.NotificationService; - import org.opendaylight.controller.sal.binding.api.BindingAwareBroker; - import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry; --import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.StubrendererListener; --import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.StubrendererService; --import org.opendaylight.yangtools.concepts.ListenerRegistration; -+import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.TransportpceServicepathService; - import org.slf4j.Logger; - import org.slf4j.LoggerFactory; - -@@ -27,17 +25,13 @@ import org.slf4j.LoggerFactory; - public class StubrendererProvider { - private static final Logger LOG = LoggerFactory.getLogger(StubrendererProvider.class); - private final RpcProviderRegistry rpcRegistry; -- private final NotificationPublishService notificationPublishService; - -- -- private BindingAwareBroker.RpcRegistration rpcRegistration; -- private ListenerRegistration stubRendererlistenerRegistration; -+ private BindingAwareBroker.RpcRegistration rpcRegistration; - - public StubrendererProvider(RpcProviderRegistry rpcProviderRegistry, - NotificationService notificationService, - NotificationPublishService notificationPublishService) { + import org.opendaylight.transportpce.servicehandler.listeners.PceListenerImpl; + import org.opendaylight.transportpce.servicehandler.listeners.RendererListenerImpl; ++import org.opendaylight.transportpce.servicehandler.stub.StubRendererServiceOperations; + import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev171017.TransportpcePceListener; + import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.TransportpceRendererListener; + import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.OrgOpenroadmServiceService; +@@ -55,7 +56,8 @@ public class ServicehandlerProvider { this.rpcRegistry = rpcProviderRegistry; -- this.notificationPublishService = notificationPublishService; - } - - /** -@@ -45,8 +39,8 @@ public class StubrendererProvider { - */ - public void init() { - LOG.info("StubrendererProvider Session Initiated"); -- final StubrendererImpl consumer = new StubrendererImpl(this.notificationPublishService); -- this.rpcRegistration = this.rpcRegistry.addRpcImplementation(StubrendererService.class, consumer); -+ final StubrendererImpl consumer = new StubrendererImpl(); -+ this.rpcRegistration = this.rpcRegistry.addRpcImplementation(TransportpceServicepathService.class, consumer); + this.notificationService = notificationService; + this.pathComputationService = pathComputationService; +- this.rendererServiceOperations = rendererServiceOperations; ++ this.rendererServiceOperations = new StubRendererServiceOperations(networkModelWavelengthService, dataBroker, ++ notificationPublishService); + this.networkModelWavelengthService = networkModelWavelengthService; + this.notificationPublishService = notificationPublishService; } - - /**