import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.service.path.rpc.result.PathDescriptionBuilder;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceImplementationRequestInput;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.list.Services;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.service.list.Services;
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.response.parameters.sp.ResponseParametersBuilder;
import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessService;
private void onPathComputationResult(ServicePathRpcResult notification) {
LOG.info("PCE '{}' Notification received : {}", servicePathRpcResult.getNotificationType().getName(),
notification);
+
if (!checkStatus(notification)) {
return;
}
}
OperationResult operationResult = null;
if (tempService) {
- operationResult = this.serviceDataStoreOperations.createTempService(input.getTempServiceCreateInput());
+ operationResult =
+ this.serviceDataStoreOperations.createTempService(
+ input.getTempServiceCreateInput(), pathDescription);
if (!operationResult.isSuccess()) {
LOG.error("Temp Service not created in datastore !");
}
ServiceImplementationRequestInput serviceImplementationRequest =
ModelMappingUtils.createServiceImplementationRequest(input, pathDescription);
LOG.info("Sending serviceImplementation request : {}", serviceImplementationRequest);
- this.rendererServiceOperations.serviceImplementation(serviceImplementationRequest);
+ LOG.debug("Temp-service value is {}", tempService);
+ this.rendererServiceOperations.serviceImplementation(serviceImplementationRequest, tempService);
}
/**
LOG.error("PCE cancel returned an unknown RpcStatusEx code !");
return;
}
- Services service = serviceDataStoreOperations.getService(input.getServiceName()).get();
- 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.
*/