+++ /dev/null
-/*
- * Copyright © 2017 Orange, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.transportpce.servicehandler.stub;
-
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.ListeningExecutorService;
-import com.google.common.util.concurrent.MoreExecutors;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-import java.util.concurrent.Callable;
-import java.util.concurrent.Executors;
-import org.opendaylight.mdsal.binding.api.NotificationPublishService;
-import org.opendaylight.transportpce.common.ResponseCodes;
-import org.opendaylight.transportpce.pce.service.PathComputationService;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.CancelResourceReserveInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.CancelResourceReserveOutput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.CancelResourceReserveOutputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.PathComputationRequestInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.PathComputationRequestOutput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.PathComputationRequestOutputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.ServicePathRpcResult;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.ServicePathRpcResultBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.service.path.rpc.result.PathDescription;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.service.path.rpc.result.PathDescriptionBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.configuration.response.common.ConfigurationResponseCommon;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.configuration.response.common.ConfigurationResponseCommonBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev171017.path.description.AToZDirection;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev171017.path.description.AToZDirectionBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev171017.path.description.ZToADirection;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev171017.path.description.ZToADirectionBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev200128.RpcStatusEx;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev200128.ServicePathNotificationTypes;
-import org.opendaylight.yangtools.yang.binding.Notification;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class StubPceServiceOperations implements PathComputationService {
-
- private static final Logger LOG = LoggerFactory.getLogger(StubPceServiceOperations.class);
- private final NotificationPublishService notificationPublishService;
- private Boolean pceFailed;
- private final ListeningExecutorService executor;
-
- public StubPceServiceOperations(NotificationPublishService notificationPublishService) {
- this.notificationPublishService = notificationPublishService;
- executor = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(2));
- this.pceFailed = false;
- }
-
- @SuppressFBWarnings(
- value = "UPM_UNCALLED_PRIVATE_METHOD",
- justification = "false positive, this method is used by public method cancelResourceReserve")
- private void sendNotifications(Notification notif) {
- try {
- LOG.info("putting notification : {}", notif);
- notificationPublishService.putNotification(notif);
- } catch (InterruptedException e) {
- LOG.info("notification offer rejected: ", e);
- }
- }
-
- @Override
- public ListenableFuture<CancelResourceReserveOutput> cancelResourceReserve(CancelResourceReserveInput input) {
- return executor.submit(new Callable<CancelResourceReserveOutput>() {
- @Override
- public CancelResourceReserveOutput call() throws Exception {
- String serviceName = input.getServiceName();
- RpcStatusEx rpcStatusEx = RpcStatusEx.Pending;
- ServicePathRpcResult notification = new ServicePathRpcResultBuilder()
- .setNotificationType(ServicePathNotificationTypes.CancelResourceReserve)
- .setServiceName(serviceName).setStatus(rpcStatusEx)
- .setStatusMessage("Service compliant, submitting cancel resource Request ...").build();
- sendNotifications(notification);
- String message = "";
- String responseCode = null;
- ConfigurationResponseCommon configurationResponseCommon = null;
- CancelResourceReserveOutput output = null;
- try {
- LOG.info("Wait for 5s til beginning the PCE cancel resource request");
- Thread.sleep(5000);
- } catch (InterruptedException e) {
- message = "path computation service failed !";
- LOG.error("path computation service failed !", e);
- responseCode = ResponseCodes.RESPONSE_FAILED;
- rpcStatusEx = RpcStatusEx.Failed;
- notification = new ServicePathRpcResultBuilder()
- .setNotificationType(ServicePathNotificationTypes.CancelResourceReserve)
- .setStatus(rpcStatusEx).setStatusMessage(message).setServiceName(serviceName).build();
- sendNotifications(notification);
- configurationResponseCommon =
- new ConfigurationResponseCommonBuilder().setAckFinalIndicator(ResponseCodes.FINAL_ACK_YES)
- .setRequestId(input.getServiceHandlerHeader().getRequestId())
- .setResponseCode(responseCode).setResponseMessage(message).build();
- output = new CancelResourceReserveOutputBuilder()
- .setConfigurationResponseCommon(configurationResponseCommon).build();
- }
- if (pceFailed) {
- LOG.info("forcing pce to fail");
- message = "pce failed !";
- rpcStatusEx = RpcStatusEx.Failed;
- LOG.error(message);
- responseCode = ResponseCodes.RESPONSE_FAILED;
- } else {
- message = "path computated !";
- rpcStatusEx = RpcStatusEx.Successful;
- LOG.error(message);
- responseCode = ResponseCodes.RESPONSE_OK;
- }
- notification = new ServicePathRpcResultBuilder()
- .setNotificationType(ServicePathNotificationTypes.CancelResourceReserve)
- .setStatus(RpcStatusEx.Successful).setStatusMessage(message)
- .setServiceName(serviceName).build();
- sendNotifications(notification);
- configurationResponseCommon =
- new ConfigurationResponseCommonBuilder().setAckFinalIndicator(ResponseCodes.FINAL_ACK_YES)
- .setRequestId(input.getServiceHandlerHeader().getRequestId())
- .setResponseCode(responseCode).setResponseMessage(message).build();
- output = new CancelResourceReserveOutputBuilder()
- .setConfigurationResponseCommon(configurationResponseCommon).build();
- return output;
- }
- });
-
- }
-
- @Override
- public ListenableFuture<PathComputationRequestOutput> pathComputationRequest(PathComputationRequestInput input) {
- return executor.submit(new Callable<PathComputationRequestOutput>() {
- @Override
- public PathComputationRequestOutput call() throws Exception {
- String serviceName = input.getServiceName();
- RpcStatusEx rpcStatusEx = RpcStatusEx.Pending;
- ServicePathRpcResult notification = new ServicePathRpcResultBuilder()
- .setNotificationType(ServicePathNotificationTypes.PathComputationRequest)
- .setServiceName(serviceName).setStatus(rpcStatusEx)
- .setStatusMessage("Service compliant, submitting pathComputation Request ...").build();
- sendNotifications(notification);
- String message = "";
- String responseCode = null;
- ConfigurationResponseCommon configurationResponseCommon = null;
- PathComputationRequestOutput output = null;
- try {
- LOG.info("Wait for 5s til beginning the PCE pathComputation request");
- Thread.sleep(5000);
- } catch (InterruptedException e) {
- message = "path computation service failed !";
- LOG.error("path computation service failed !", e);
- responseCode = ResponseCodes.RESPONSE_FAILED;
- rpcStatusEx = RpcStatusEx.Failed;
- notification = new ServicePathRpcResultBuilder()
- .setNotificationType(ServicePathNotificationTypes.PathComputationRequest)
- .setStatus(rpcStatusEx).setStatusMessage(message).setServiceName(serviceName).build();
- sendNotifications(notification);
- configurationResponseCommon =
- new ConfigurationResponseCommonBuilder().setAckFinalIndicator(ResponseCodes.FINAL_ACK_YES)
- .setRequestId(input.getServiceHandlerHeader().getRequestId())
- .setResponseCode(responseCode).setResponseMessage(message).build();
- output = new PathComputationRequestOutputBuilder()
- .setConfigurationResponseCommon(configurationResponseCommon).build();
- }
- PathDescription value;
- if (pceFailed) {
- value = null;
- LOG.info("forcing pce to fail");
- message = "pce failed !";
- rpcStatusEx = RpcStatusEx.Failed;
- LOG.error(message);
- responseCode = ResponseCodes.RESPONSE_FAILED;
- } else {
- value = createPathDescription(0L, 5L, 0L, 5L);
- message = "path computated !";
- rpcStatusEx = RpcStatusEx.Successful;
- LOG.error(message);
- responseCode = ResponseCodes.RESPONSE_OK;
- }
- notification = new ServicePathRpcResultBuilder()
- .setNotificationType(ServicePathNotificationTypes.PathComputationRequest)
- .setPathDescription(value)
- .setStatus(rpcStatusEx).setStatusMessage(message)
- .setServiceName(serviceName).build();
- sendNotifications(notification);
- configurationResponseCommon =
- new ConfigurationResponseCommonBuilder().setAckFinalIndicator(ResponseCodes.FINAL_ACK_YES)
- .setRequestId(input.getServiceHandlerHeader().getRequestId())
- .setResponseCode(responseCode)
- .setResponseMessage(message).build();
- output = new PathComputationRequestOutputBuilder()
- .setConfigurationResponseCommon(configurationResponseCommon).build();
- return output;
- }
- });
- }
-
- @SuppressFBWarnings(
- value = "UPM_UNCALLED_PRIVATE_METHOD",
- justification = "false positive, this method is used by public method pathComputationRequest")
- private static PathDescription createPathDescription(long azRate, long azWaveLength, long zaRate,
- long zaWaveLength) {
- AToZDirection atozDirection =
- new AToZDirectionBuilder().setRate(azRate).setAToZWavelengthNumber(azWaveLength).setAToZ(null).build();
- ZToADirection ztoaDirection =
- new ZToADirectionBuilder().setRate(zaRate).setZToAWavelengthNumber(zaWaveLength).setZToA(null).build();
- PathDescription pathDescription =
- new PathDescriptionBuilder().setAToZDirection(atozDirection).setZToADirection(ztoaDirection).build();
- return pathDescription;
- }
-
- public void setPceFailed(Boolean pceFailed) {
- this.pceFailed = pceFailed;
- }
-}
+++ /dev/null
-/*
- * Copyright © 2018 Orange, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.transportpce.servicehandler.stub;
-
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.ListeningExecutorService;
-import com.google.common.util.concurrent.MoreExecutors;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-import java.util.Optional;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.api.NotificationPublishService;
-import org.opendaylight.mdsal.binding.api.ReadTransaction;
-import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
-import org.opendaylight.transportpce.common.OperationResult;
-import org.opendaylight.transportpce.common.ResponseCodes;
-import org.opendaylight.transportpce.common.Timeouts;
-import org.opendaylight.transportpce.renderer.NetworkModelWavelengthService;
-import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.ServiceDeleteInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.ServiceDeleteOutput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.ServiceDeleteOutputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.ServiceImplementationRequestInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.ServiceImplementationRequestOutput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.ServiceImplementationRequestOutputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.ServiceRpcResultSp;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.ServiceRpcResultSpBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.service.rpc.result.sp.PathTopology;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.service.rpc.result.sp.PathTopologyBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.configuration.response.common.ConfigurationResponseCommonBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev200128.RpcStatusEx;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev200128.ServicePathNotificationTypes;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev200128.service.path.PathDescription;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev171017.ServicePathList;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev171017.service.path.list.ServicePaths;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev171017.service.path.list.ServicePathsKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.Notification;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class StubRendererServiceOperations implements RendererServiceOperations {
- private static final Logger LOG = LoggerFactory.getLogger(StubRendererServiceOperations.class);
- private final ListeningExecutorService executor;
- private final NotificationPublishService notificationPublishService;
- private final NetworkModelWavelengthService networkModelWavelengthService;
- private final DataBroker dataBroker;
- private Boolean rendererFailed;
- private Boolean isnetworkModelWlService;
-
- public StubRendererServiceOperations(NetworkModelWavelengthService networkModelWavelengthService,
- DataBroker dataBroker, NotificationPublishService notificationPublishService) {
- this.notificationPublishService = notificationPublishService;
- this.networkModelWavelengthService = networkModelWavelengthService;
- this.dataBroker = dataBroker;
- this.rendererFailed = false;
- this.isnetworkModelWlService = true;
- executor = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(2));
- }
-
- @SuppressFBWarnings(
- value = "UPM_UNCALLED_PRIVATE_METHOD",
- justification = "false positive, this method is used by public method serviceImplementation")
- private void sendNotifications(Notification notif) {
- try {
- LOG.info("putting notification : {}", notif);
- notificationPublishService.putNotification(notif);
- } catch (InterruptedException e) {
- LOG.info("notification offer rejected: ", e);
- }
- }
-
- @Override
- public ListenableFuture<ServiceImplementationRequestOutput>
- serviceImplementation(ServiceImplementationRequestInput input) {
- return executor.submit(new Callable<ServiceImplementationRequestOutput>() {
- @Override
- public ServiceImplementationRequestOutput call() {
- LOG.info("serviceImplementation request ...");
- String serviceName = input.getServiceName();
- RpcStatusEx rpcStatusEx = RpcStatusEx.Pending;
- ServiceRpcResultSp notification = new ServiceRpcResultSpBuilder()
- .setNotificationType(ServicePathNotificationTypes.ServiceImplementationRequest)
- .setServiceName(serviceName).setStatus(rpcStatusEx)
- .setStatusMessage("Service compliant, submitting serviceImplementation Request ...").build();
- sendNotifications(notification);
- String message = "";
- String responseCode = null;
- ConfigurationResponseCommonBuilder configurationResponseCommon = null;
- ServiceImplementationRequestOutput output = null;
- try {
- LOG.info("Wait for 5s til beginning the Renderer serviceImplementation request");
- Thread.sleep(5000);
- } catch (InterruptedException e) {
- message = "renderer failed !";
- rpcStatusEx = RpcStatusEx.Failed;
- responseCode = ResponseCodes.RESPONSE_FAILED;
- LOG.error(message);
- notification = new ServiceRpcResultSpBuilder()
- .setNotificationType(ServicePathNotificationTypes.ServiceImplementationRequest)
- .setServiceName(serviceName).setStatus(rpcStatusEx).setStatusMessage(message).build();
- sendNotifications(notification);
- configurationResponseCommon =
- new ConfigurationResponseCommonBuilder().setAckFinalIndicator(ResponseCodes.FINAL_ACK_YES)
- .setRequestId(input.getServiceHandlerHeader().getRequestId())
- .setResponseCode(responseCode).setResponseMessage(message);
- output = new ServiceImplementationRequestOutputBuilder()
- .setConfigurationResponseCommon(configurationResponseCommon.build()).build();
- return output;
- }
- if (rendererFailed) {
- LOG.info("forcing renderer to fail");
- message = "renderer failed !";
- rpcStatusEx = RpcStatusEx.Failed;
- LOG.error(message);
- responseCode = ResponseCodes.RESPONSE_FAILED;
- } else {
- if (isnetworkModelWlService) {
- networkModelWavelengthService.useWavelengths(input.getPathDescription());
- } else {
- LOG.warn("No need to execute networkModelWavelengthService...");
- }
- message = "service implemented !";
- rpcStatusEx = RpcStatusEx.Successful;
- LOG.info(message);
- responseCode = ResponseCodes.RESPONSE_OK;
- }
- PathTopology pathTopology = new PathTopologyBuilder().build();
- notification = new ServiceRpcResultSpBuilder()
- .setNotificationType(ServicePathNotificationTypes.ServiceImplementationRequest)
- .setServiceName(serviceName).setStatus(rpcStatusEx)
- .setStatusMessage(message).setPathTopology(pathTopology).build();
- sendNotifications(notification);
- responseCode = ResponseCodes.RESPONSE_OK;
- configurationResponseCommon = new ConfigurationResponseCommonBuilder()
- .setAckFinalIndicator(ResponseCodes.FINAL_ACK_YES)
- .setRequestId(input.getServiceHandlerHeader().getRequestId())
- .setResponseCode(responseCode)
- .setResponseMessage(message);
- output = new ServiceImplementationRequestOutputBuilder()
- .setConfigurationResponseCommon(configurationResponseCommon.build())
- .build();
- return output;
- }
- });
- }
-
- @Override
- public ListenableFuture<ServiceDeleteOutput> serviceDelete(ServiceDeleteInput input) {
- return executor.submit(new Callable<ServiceDeleteOutput>() {
- @Override
- public ServiceDeleteOutput call() {
- LOG.info("ServiceDelete request ...");
- String serviceName = input.getServiceName();
- RpcStatusEx rpcStatusEx = RpcStatusEx.Pending;
- ServiceRpcResultSp notification =
- new ServiceRpcResultSpBuilder().setNotificationType(ServicePathNotificationTypes.ServiceDelete)
- .setServiceName(serviceName).setStatus(rpcStatusEx)
- .setStatusMessage("Service compliant, submitting serviceDelete Request ...").build();
- sendNotifications(notification);
- String message = "";
- String responseCode = null;
- ConfigurationResponseCommonBuilder configurationResponseCommon = null;
- ServiceDeleteOutput output = null;
- try {
- LOG.info("Wait for 5s til beginning the Renderer serviceDelete request");
- Thread.sleep(5000);
- } catch (InterruptedException e) {
- message = "deleting service failed !";
- LOG.error("deleting service failed !", e);
- responseCode = ResponseCodes.RESPONSE_FAILED;
- rpcStatusEx = RpcStatusEx.Failed;
- notification = new ServiceRpcResultSpBuilder()
- .setNotificationType(ServicePathNotificationTypes.ServiceDelete).setServiceName(serviceName)
- .setStatus(rpcStatusEx).setStatusMessage(message).build();
- sendNotifications(notification);
- configurationResponseCommon =
- new ConfigurationResponseCommonBuilder().setAckFinalIndicator(ResponseCodes.FINAL_ACK_YES)
- .setRequestId(input.getServiceHandlerHeader().getRequestId())
- .setResponseCode(responseCode).setResponseMessage(message);
- output = new ServiceDeleteOutputBuilder()
- .setConfigurationResponseCommon(configurationResponseCommon.build()).build();
- }
- if (rendererFailed) {
- LOG.info("forcing renderer to fail");
- message = "renderer failed !";
- rpcStatusEx = RpcStatusEx.Failed;
- LOG.error(message);
- responseCode = ResponseCodes.RESPONSE_FAILED;
- } else {
- if (isnetworkModelWlService) {
- // Obtain path description
- Optional<PathDescription> pathDescriptionOpt = getPathDescriptionFromDatastore(serviceName);
- PathDescription pathDescription;
- if (pathDescriptionOpt.isPresent()) {
- pathDescription = pathDescriptionOpt.get();
- networkModelWavelengthService.freeWavelengths(pathDescription);
- } else {
- LOG.warn("failed to get pathDescription for service : {}", serviceName);
- }
- } else {
- LOG.warn("No need to execute networkModelWavelengthService...");
- }
- message = "service deleted !";
- rpcStatusEx = RpcStatusEx.Successful;
- LOG.info(message);
- responseCode = ResponseCodes.RESPONSE_OK;
- }
- notification = new ServiceRpcResultSpBuilder()
- .setNotificationType(ServicePathNotificationTypes.ServiceDelete)
- .setServiceName(serviceName).setStatus(rpcStatusEx)
- .setStatusMessage(message).build();
- sendNotifications(notification);
- responseCode = ResponseCodes.RESPONSE_OK;
- configurationResponseCommon = new ConfigurationResponseCommonBuilder()
- .setAckFinalIndicator(ResponseCodes.FINAL_ACK_YES)
- .setRequestId(input.getServiceHandlerHeader().getRequestId())
- .setResponseCode(responseCode)
- .setResponseMessage(message);
- output = new ServiceDeleteOutputBuilder()
- .setConfigurationResponseCommon(configurationResponseCommon.build())
- .build();
- return output;
- }
- });
- }
-
- @SuppressFBWarnings(
- value = "UPM_UNCALLED_PRIVATE_METHOD",
- justification = "false positive, this method is used by public method serviceDelete")
- private Optional<PathDescription> getPathDescriptionFromDatastore(String serviceName) {
- InstanceIdentifier<PathDescription> pathDescriptionIID = InstanceIdentifier.create(ServicePathList.class)
- .child(ServicePaths.class, new ServicePathsKey(serviceName)).child(PathDescription.class);
- ReadTransaction pathDescReadTx = this.dataBroker.newReadOnlyTransaction();
- try {
- LOG.debug("Getting path description for service {}", serviceName);
- return pathDescReadTx.read(LogicalDatastoreType.OPERATIONAL, pathDescriptionIID)
- .get(Timeouts.DATASTORE_READ, TimeUnit.MILLISECONDS);
- } catch (InterruptedException | ExecutionException | TimeoutException e) {
- LOG.warn("Exception while getting path description from datastore {} for service {}!", pathDescriptionIID,
- serviceName, e);
- return Optional.empty();
- }
- }
-
- public void setRendererFailed(Boolean rendererFailed) {
- this.rendererFailed = rendererFailed;
- }
-
- public void setIsnetworkModelWlService(Boolean isnetworkModelWlService) {
- this.isnetworkModelWlService = isnetworkModelWlService;
- }
-
- @Override
- public OperationResult reserveResource(PathDescription pathDescription) {
- return null;
- }
-
- @Override
- public OperationResult freeResource(PathDescription pathDescription) {
- return null;
- }
-}
+++ /dev/null
-/*
- * Copyright © 2017 Orange, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.transportpce.servicehandler.stub;
-
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev200128.service.handler.header.ServiceHandlerHeader;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Class for checking service sdnc-request-header compliancy.
- *
- * @author <a href="mailto:martial.coulibaly@gfi.com">Martial Coulibaly</a> on behalf of Orange
- *
- */
-public class StubrendererCompliancyCheck {
- /** Logging. */
- private static final Logger LOG = LoggerFactory.getLogger(StubrendererCompliancyCheck.class);
- /** SdncRequestHeader. */
- private ServiceHandlerHeader serviceHandlerHeader;
- /** Service Name. */
- private String serviceName;
- /** Response message from procedure. */
- private String message;
-
-
- public StubrendererCompliancyCheck(String serviceName,ServiceHandlerHeader serviceHandlerHeader) {
- this.serviceName = serviceName;
- this.serviceHandlerHeader = serviceHandlerHeader;
- this.setMessage("");
- }
-
- /**
- * Check if a String is not null and not equal to void.
- *
- * @param value
- * String value
- * @return true if String ok false if not
- */
- public Boolean checkString(String value) {
- Boolean result = false;
- if ((value != null) && (value.compareTo("") != 0)) {
- result = true;
- }
- return result;
-
- }
-
- /**
- * Check Compliancy of Service request.
- *
- * @param contype
- * Boolean to check connection Type
- * @param servicehandler
- * Boolean to check sndcRequestHeader
- *
- * @return true if String ok false if not
- */
- public Boolean check(Boolean contype, Boolean servicehandler) {
- Boolean result = true;
- if (!checkString(serviceName)) {
- result = false;
- message = "Service Name is not set";
- LOG.info(message);
- }
- if (servicehandler) {
- if (serviceHandlerHeader != null) {
- String requestId = serviceHandlerHeader.getRequestId();
- if (!checkString(requestId)) {
- result = false;
- message = "Service serviceHandlerHeader 'request-id' is not set";
- LOG.info(message);
- }
- } else {
- result = false;
- message = "Service serviceHandlerHeader is not set ";
- LOG.info(message);
- }
- }
- return result;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-}