LOG.debug("serviceDelete: Service '{}' found in datastore", serviceName);
this.pceListenerImpl.setInput(new ServiceInput(input));
this.pceListenerImpl.setServiceReconfigure(false);
+ this.pceListenerImpl.setTempService(false);
this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
+ this.rendererListenerImpl.setTempService(false);
this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
//Check presence of service to be deleted
LOG.debug("service common-id '{}' is compliant", commonId);
Optional<org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.temp.service.list.Services>
- service =
+ serviceOpt =
this.serviceDataStoreOperations.getTempService(commonId);
- if (service.isEmpty()) {
+ if (serviceOpt.isEmpty()) {
LOG.error(TEMP_SERVICE_DELETE_MSG, LogMessages.serviceNotInDS(commonId));
return ModelMappingUtils.createDeleteServiceReply(
input, ResponseCodes.FINAL_ACK_YES,
LogMessages.serviceNotInDS(commonId), ResponseCodes.RESPONSE_FAILED);
}
-
LOG.info("Service '{}' present in datastore !", commonId);
this.pceListenerImpl.setInput(new ServiceInput(input));
this.pceListenerImpl.setServiceReconfigure(false);
+ this.pceListenerImpl.setTempService(true);
this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
this.rendererListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
this.rendererListenerImpl.setTempService(true);
this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
+ org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526
+ .temp.service.list.Services service = serviceOpt.orElseThrow();
org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteOutput output =
- this.rendererServiceWrapper.performRenderer(input, ServiceNotificationTypes.ServiceDeleteResult);
+ this.rendererServiceWrapper.performRenderer(input, ServiceNotificationTypes.ServiceDeleteResult,
+ service);
if (output == null) {
LOG.error(TEMP_SERVICE_DELETE_MSG, LogMessages.RENDERER_DELETE_FAILED);
return ModelMappingUtils.createDeleteServiceReply(
LOG.error("PCE cancel returned an unknown RpcStatusEx code !");
return;
}
- Services service = serviceDataStoreOperations.getService(input.getServiceName()).orElseThrow();
- PublishNotificationProcessServiceBuilder nbiNotificationBuilder =
- new PublishNotificationProcessServiceBuilder()
- .setServiceName(service.getServiceName())
- .setServiceAEnd(new ServiceAEndBuilder(service.getServiceAEnd()).build())
- .setServiceZEnd(new ServiceZEndBuilder(service.getServiceZEnd()).build())
- .setCommonId(service.getCommonId())
- .setConnectionType(service.getConnectionType())
- .setPublisherName(PUBLISHER);
+ PublishNotificationProcessServiceBuilder nbiNotificationBuilder;
+ State serviceOpState;
+ if (tempService) {
+ org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.temp.service.list.Services
+ tempServiceList = serviceDataStoreOperations.getTempService(input.getServiceName()).orElseThrow();
+ serviceOpState = tempServiceList.getOperationalState();
+ nbiNotificationBuilder =
+ new PublishNotificationProcessServiceBuilder()
+ .setServiceAEnd(new ServiceAEndBuilder(tempServiceList.getServiceAEnd()).build())
+ .setServiceZEnd(new ServiceZEndBuilder(tempServiceList.getServiceZEnd()).build())
+ .setCommonId(tempServiceList.getCommonId())
+ .setConnectionType(tempServiceList.getConnectionType())
+ .setPublisherName(PUBLISHER);
+ } else {
+ Services service = serviceDataStoreOperations.getService(input.getServiceName()).orElseThrow();
+ serviceOpState = service.getOperationalState();
+ nbiNotificationBuilder =
+ new PublishNotificationProcessServiceBuilder()
+ .setServiceName(service.getServiceName())
+ .setServiceAEnd(new ServiceAEndBuilder(service.getServiceAEnd()).build())
+ .setServiceZEnd(new ServiceZEndBuilder(service.getServiceZEnd()).build())
+ .setCommonId(service.getCommonId())
+ .setConnectionType(service.getConnectionType())
+ .setPublisherName(PUBLISHER);
+
+ }
+
if (servicePathRpcResult.getStatus() == RpcStatusEx.Failed) {
LOG.info("PCE cancel resource failed !");
sendNbiNotification(
nbiNotificationBuilder
.setResponseFailed("PCE cancel resource failed !")
.setMessage("ServiceDelete request failed ...")
- .setOperationalState(service.getOperationalState())
+ .setOperationalState(serviceOpState)
.build());
return;
}
LOG.info("PCE cancel resource done OK !");
+ // Here the input refers to the transportPCE API and the serviceName will be commonId for temp-service
OperationResult deleteServicePathOperationResult =
this.serviceDataStoreOperations.deleteServicePath(input.getServiceName());
if (!deleteServicePathOperationResult.isSuccess()) {
sendNbiNotification(
nbiNotificationBuilder
.setResponseFailed("")
- .setMessage("Service deleted !")
+ .setMessage("{} Service deleted !")
.setOperationalState(State.Degraded)
.build());
} else {
- LOG.warn("{}Service was not removed from datastore !", serviceType);
+ LOG.warn("{} Service was not removed from datastore !", serviceType);
sendNbiNotification(
nbiNotificationBuilder
.setResponseFailed(serviceType + "Service was not removed from datastore !")
.setMessage("ServiceDelete request failed ...")
- .setOperationalState(service.getOperationalState())
+ .setOperationalState(serviceOpState)
.build());
}
+ // TODO: should we re-initialize the temp-service boolean to false?
/**
* if it was an RPC serviceReconfigure, re-launch PCR.
*/
LOG.info("Temp-service exists with the common-Id {}", commonId);
// Delete the common-id from this temp-service-list here
OperationResult tempServiceListDelete = serviceDataStoreOperations.deleteTempService(commonId);
+ //TODO: Also need to delete the service-path from the transportpce-service-path list
+ this.serviceDataStoreOperations.deleteServicePath(commonId);
LOG.info("Result for temp-service-list with {} is {}", commonId, tempServiceListDelete);
}
}
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.ServiceNotificationTypes;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.configuration.response.common.ConfigurationResponseCommon;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.configuration.response.common.ConfigurationResponseCommonBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.service.ServiceAEndBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.service.ServiceZEndBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.TempServiceDeleteInput;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.service.list.Services;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.service.list.ServicesBuilder;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.RpcStatusEx;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.service.handler.header.ServiceHandlerHeader;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.service.handler.header.ServiceHandlerHeaderBuilder;
}
}
- public ServiceDeleteOutput performRenderer(TempServiceDeleteInput tempServiceDeleteInput,
- ServiceNotificationTypes notifType) {
+
+ // TODO: Here is where the we are sending null values for the service and that is causing issues
+ // We are performing renderer using null values
+ public ServiceDeleteOutput performRenderer(
+ TempServiceDeleteInput tempServiceDeleteInput,
+ ServiceNotificationTypes notifType,
+ org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526
+ .temp.service.list.Services tempService) {
String commonId = tempServiceDeleteInput.getCommonId();
- if (validateParams(commonId, null, true)) {
- ServiceHandlerHeader serviceHandler = new ServiceHandlerHeaderBuilder().setRequestId(commonId).build();
- return performRenderer(tempServiceDeleteInput.getCommonId(), serviceHandler,
- ServiceNotificationTypes.ServiceDeleteResult, null);
- } else {
- return returnRendererFailed();
- }
+ return validateParams(commonId, null, true)
+ ? performRenderer(tempServiceDeleteInput,
+ new ServiceHandlerHeaderBuilder().setRequestId(commonId).build(),
+ ServiceNotificationTypes.ServiceDeleteResult,
+ tempService)
+ : returnRendererFailed();
+ }
+
+ private ServiceDeleteOutput performRenderer(
+ TempServiceDeleteInput tempServiceDeleteInput,
+ ServiceHandlerHeader serviceHandlerHeader,
+ ServiceNotificationTypes notifType,
+ org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526
+ .temp.service.list.Services tempService) {
+ String commonId = tempServiceDeleteInput.getCommonId();
+ notification = new ServiceRpcResultShBuilder()
+ .setNotificationType(notifType)
+ .setServiceName(commonId)
+ .setStatus(RpcStatusEx.Pending)
+ .setStatusMessage("Service compliant, submitting temp service delete Request ...")
+ .build();
+ sendNotifications(notification);
+ FutureCallback<ServiceDeleteOutput> rendererCallback =
+ new ServiceDeleteOutputFutureCallback(notifType, commonId);
+ ServiceDeleteInput serviceDeleteInput = createRendererRequestInput(commonId, serviceHandlerHeader);
+ // Here build the regular service-list container from the temp-service-list
+ ListenableFuture<ServiceDeleteOutput> renderer =
+ this.rendererServiceOperations.serviceDelete(serviceDeleteInput,
+ new ServicesBuilder()
+ .setServiceName(commonId)
+ .setServiceAEnd(new ServiceAEndBuilder(tempService.getServiceAEnd()).build())
+ .setServiceZEnd(new ServiceZEndBuilder(tempService.getServiceZEnd()).build())
+ .setCommonId(commonId)
+ .build());
+ Futures.addCallback(renderer, rendererCallback, executor);
+ return new ServiceDeleteOutputBuilder()
+ .setConfigurationResponseCommon(
+ new ConfigurationResponseCommonBuilder()
+ .setAckFinalIndicator(ResponseCodes.FINAL_ACK_NO)
+ .setRequestId(serviceDeleteInput
+ .getServiceHandlerHeader()
+ .getRequestId())
+ .setResponseCode(ResponseCodes.RESPONSE_OK)
+ .setResponseMessage("Renderer temp-service delete in progress")
+ .build())
+ .build();
}
private ServiceDeleteOutput performRenderer(String serviceName, ServiceHandlerHeader serviceHandlerHeader,
TempServiceDeleteInput input = new TempServiceDeleteInputBuilder(ServiceDataUtils.buildTempServiceDeleteInput())
.setCommonId(null).build();
ServiceDeleteOutput response = this.rendererServiceWrapperMock
- .performRenderer(input, ServiceNotificationTypes.ServiceDeleteResult);
+ .performRenderer(input, ServiceNotificationTypes.ServiceDeleteResult, null);
assertEquals(ResponseCodes.FINAL_ACK_YES, response.getConfigurationResponseCommon().getAckFinalIndicator());
assertEquals(ResponseCodes.RESPONSE_FAILED, response.getConfigurationResponseCommon().getResponseCode());
verifyNoInteractions(this.rendererServiceOperationsMock);
.class), any()))
.thenReturn(response);
TempServiceDeleteInput input = ServiceDataUtils.buildTempServiceDeleteInput();
+ var tempServiceDeleteInput = ModelMappingUtils.createServiceDeleteInput(new ServiceInput(input));
ServiceDeleteOutput rendereResponse = this.rendererServiceWrapperMock
- .performRenderer(input, ServiceNotificationTypes.ServiceDeleteResult);
+ .performRenderer(tempServiceDeleteInput, ServiceNotificationTypes.ServiceDeleteResult, null);
assertEquals(
ResponseCodes.FINAL_ACK_NO,
rendereResponse.getConfigurationResponseCommon().getAckFinalIndicator());