+ @edu.umd.cs.findbugs.annotations.SuppressFBWarnings(
+ value = "UPM_UNCALLED_PRIVATE_METHOD",
+ justification = "call in call() method")
+ private boolean createServicepathInput(ServiceImplementationRequestInput input) {
+ ServicePathInputData servicePathInputDataAtoZ = ModelMappingUtils
+ .rendererCreateServiceInputAToZ(input.getServiceName(), input.getPathDescription());
+ ServicePathInputData servicePathInputDataZtoA = ModelMappingUtils
+ .rendererCreateServiceInputZToA(input.getServiceName(), input.getPathDescription());
+ // Rollback should be same for all conditions, so creating a new one
+ RollbackProcessor rollbackProcessor = new RollbackProcessor();
+ List<DeviceRenderingResult> renderingResults =
+ deviceRendering(rollbackProcessor, servicePathInputDataAtoZ, servicePathInputDataZtoA);
+ if (rollbackProcessor.rollbackAllIfNecessary() > 0) {
+ sendNotifications(ServicePathNotificationTypes.ServiceImplementationRequest,
+ input.getServiceName(), RpcStatusEx.Failed, DEVICE_RENDERING_ROLL_BACK_MSG);
+ return false;
+ }
+ ServicePowerSetupInput olmPowerSetupInputAtoZ =
+ ModelMappingUtils.createServicePowerSetupInput(renderingResults.get(0).getOlmList(), input);
+ ServicePowerSetupInput olmPowerSetupInputZtoA =
+ ModelMappingUtils.createServicePowerSetupInput(renderingResults.get(1).getOlmList(), input);
+ olmPowerSetup(rollbackProcessor, olmPowerSetupInputAtoZ, olmPowerSetupInputZtoA);
+ if (rollbackProcessor.rollbackAllIfNecessary() > 0) {
+ sendNotifications(ServicePathNotificationTypes.ServiceImplementationRequest,
+ input.getServiceName(), RpcStatusEx.Failed, OLM_ROLL_BACK_MSG);
+ return false;
+ }
+ // run service activation test twice - once on source node and once on
+ // destination node
+ List<Nodes> nodes = servicePathInputDataAtoZ.getServicePathInput().getNodes();
+ if ((nodes == null) || (nodes.isEmpty())) {
+ return false;
+ }
+
+ Nodes sourceNode = nodes.get(0);
+ Nodes destNode = nodes.get(nodes.size() - 1);
+ String srcNetworkTp;
+ String dstNetowrkTp;
+ if (sourceNode.getDestTp().contains(StringConstants.NETWORK_TOKEN)) {
+ srcNetworkTp = sourceNode.getDestTp();
+ } else {
+ srcNetworkTp = sourceNode.getSrcTp();
+ }
+ if (destNode.getDestTp().contains(StringConstants.NETWORK_TOKEN)) {
+ dstNetowrkTp = destNode.getDestTp();
+ } else {
+ dstNetowrkTp = destNode.getSrcTp();
+ }
+ if (!isServiceActivated(sourceNode.getNodeId(), srcNetworkTp)
+ || !isServiceActivated(destNode.getNodeId(), dstNetowrkTp)) {
+ rollbackProcessor.rollbackAll();
+ sendNotifications(ServicePathNotificationTypes.ServiceImplementationRequest,
+ input.getServiceName(), RpcStatusEx.Failed,
+ "Service activation test failed.");
+ return false;
+ }
+ // If Service activation is success update Network ModelMappingUtils
+ networkModelWavelengthService.useWavelengths(input.getPathDescription());
+ sendNotifications(ServicePathNotificationTypes.ServiceImplementationRequest,
+ input.getServiceName(), RpcStatusEx.Successful, OPERATION_SUCCESSFUL);
+ return true;
+ }
+
+ @edu.umd.cs.findbugs.annotations.SuppressFBWarnings(
+ value = "UPM_UNCALLED_PRIVATE_METHOD",
+ justification = "call in call() method")
+ private boolean manageServicePathDeletion(String serviceName, PathDescription pathDescription) {
+ ServicePathInputData servicePathInputDataAtoZ =
+ ModelMappingUtils.rendererCreateServiceInputAToZ(serviceName, pathDescription);
+ ServicePathInputData servicePathInputDataZtoA =
+ ModelMappingUtils.rendererCreateServiceInputZToA(serviceName, pathDescription);
+ // OLM turn down power
+ try {
+ LOG.debug(TURNING_DOWN_POWER_ON_A_TO_Z_PATH_MSG);
+ sendNotifications(ServicePathNotificationTypes.ServiceDelete, serviceName,
+ RpcStatusEx.Pending, TURNING_DOWN_POWER_ON_A_TO_Z_PATH_MSG);
+ ServicePowerTurndownOutput atozPowerTurndownOutput = olmPowerTurndown(servicePathInputDataAtoZ);
+ // TODO add some flag rather than string
+ if (FAILED.equals(atozPowerTurndownOutput.getResult())) {
+ LOG.error("Service power turndown failed on A-to-Z path for service {}!", serviceName);
+ sendNotifications(ServicePathNotificationTypes.ServiceDelete, serviceName, RpcStatusEx.Failed,
+ "Service power turndown failed on A-to-Z path for service");
+ return false;
+ }
+ LOG.debug("Turning down power on Z-to-A path");
+ sendNotifications(ServicePathNotificationTypes.ServiceDelete, serviceName, RpcStatusEx.Pending,
+ "Turning down power on Z-to-A path");
+ ServicePowerTurndownOutput ztoaPowerTurndownOutput = olmPowerTurndown(servicePathInputDataZtoA);
+ // TODO add some flag rather than string
+ if (FAILED.equals(ztoaPowerTurndownOutput.getResult())) {
+ LOG.error("Service power turndown failed on Z-to-A path for service {}!", serviceName);
+ sendNotifications(ServicePathNotificationTypes.ServiceDelete, serviceName, RpcStatusEx.Failed,
+ "Service power turndown failed on Z-to-A path for service");
+ return false;
+ }
+ } catch (InterruptedException | ExecutionException | TimeoutException e) {
+ LOG.error("Error while turning down power!", e);
+ return false;
+ }
+ // delete service path with renderer
+ LOG.info("Deleting service path via renderer");
+ sendNotifications(ServicePathNotificationTypes.ServiceDelete, serviceName, RpcStatusEx.Pending,
+ "Deleting service path via renderer");
+ deviceRenderer.deleteServicePath(servicePathInputDataAtoZ.getServicePathInput());
+ deviceRenderer.deleteServicePath(servicePathInputDataZtoA.getServicePathInput());
+ networkModelWavelengthService.freeWavelengths(pathDescription);
+ sendNotifications(ServicePathNotificationTypes.ServiceDelete, serviceName, RpcStatusEx.Successful,
+ OPERATION_SUCCESSFUL);
+ return true;
+ }
+
+ @edu.umd.cs.findbugs.annotations.SuppressFBWarnings(
+ value = "UPM_UNCALLED_PRIVATE_METHOD",
+ justification = "call in call() method")
+ private boolean manageOtnServicePathDeletion(String serviceName, PathDescription pathDescription,
+ Services service) {
+ OtnServicePathInput ospi = null;
+ if (ConnectionType.Infrastructure.equals(service.getConnectionType())) {
+ ospi = ModelMappingUtils.rendererCreateOtnServiceInput(
+ serviceName, service.getServiceAEnd().getServiceFormat().getName(), "100G", pathDescription, true);
+ } else if (ConnectionType.Service.equals(service.getConnectionType())) {
+ ospi = ModelMappingUtils.rendererCreateOtnServiceInput(serviceName,
+ service.getServiceAEnd().getServiceFormat().getName(),
+ service.getServiceAEnd().getServiceRate().toString() + "G", pathDescription, true);
+ }
+ LOG.info("Deleting otn-service path {} via renderer", serviceName);
+ sendNotifications(ServicePathNotificationTypes.ServiceDelete, serviceName, RpcStatusEx.Pending,
+ "Deleting otn-service path via renderer");
+ OtnServicePathOutput result = otnDeviceRenderer.deleteOtnServicePath(ospi);
+ if (result.isSuccess()) {
+ sendNotifications(ServicePathNotificationTypes.ServiceDelete, serviceName, RpcStatusEx.Successful,
+ OPERATION_SUCCESSFUL);
+ return true;
+ } else {
+ return false;
+ }
+ }
+