import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.service.rpc.result.PathComputationResultBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.service.rpc.result.path.computation.result.AToZBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.service.rpc.result.path.computation.result.ZToABuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessServiceBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceAEndBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceZEndBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230728.PublishNotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230728.PublishNotificationProcessServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230728.notification.process.service.ServiceAEndBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230728.notification.process.service.ServiceZEndBuilder;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
.setServiceAEnd(new ServiceAEndBuilder(service.getServiceAEnd()).build())
.setServiceZEnd(new ServiceZEndBuilder(service.getServiceZEnd()).build())
.setCommonId(service.getCommonId())
+ .setIsTempService(false)
.setConnectionType(service.getConnectionType())
.setResponseFailed("Renderer service delete failed !")
.setMessage("ServiceDelete request failed ...")
updateOtnTopology(notification, false);
PublishNotificationProcessServiceBuilder nbiNotificationBuilder =
new PublishNotificationProcessServiceBuilder()
- .setServiceName(input.getServiceName())
.setServiceAEnd(new ServiceAEndBuilder(input.getServiceAEnd()).build())
.setServiceZEnd(new ServiceZEndBuilder(input.getServiceZEnd()).build())
- .setCommonId(input.getCommonId()).setConnectionType(input.getConnectionType())
.setPublisherName(PUBLISHER);
String serviceTemp = "";
if (tempService) {
+ nbiNotificationBuilder.setCommonId(input.getCommonId()).setConnectionType(input.getConnectionType());
+ nbiNotificationBuilder.setIsTempService(true);
+ if (input.getServiceName() != null) {
+ nbiNotificationBuilder.setServiceName(input.getServiceName());
+ }
OperationResult operationResult = this.serviceDataStoreOperations.modifyTempService(
serviceRpcResultSp.getServiceName(), State.InService, AdminStates.InService);
serviceTemp = "Temp ";
if (operationResult.isSuccess()) {
+ ServiceRpcResult serviceRpcResult =
+ sendServiceRpcResultNotification(notification, ServiceNotificationTypes.ServiceCreateResult);
sendNbiNotification(nbiNotificationBuilder
.setResponseFailed("")
- .setMessage("Temp Service implemented !")
+ .setMessage("Temp Service implemented")
+ .setAToZ(
+ new org.opendaylight.yang.gen.v1.nbi.notifications.rev230728.notification.process.service
+ .AToZBuilder()
+ .setFrequency(serviceRpcResult.getPathComputationResult().getAToZ().getFrequency())
+ .setWidth(serviceRpcResult.getPathComputationResult().getAToZ().getWidth())
+ .setOpticalOperationalMode(serviceRpcResult.getPathComputationResult()
+ .getAToZ().getOpticalOperationalMode())
+ // TODO: add GNSR, OSNR, min/max output powers
+ .build())
+ .setZToA(
+ new org.opendaylight.yang.gen.v1.nbi.notifications.rev230728.notification.process.service
+ .ZToABuilder()
+ .setFrequency(serviceRpcResult.getPathComputationResult().getZToA().getFrequency())
+ .setWidth(serviceRpcResult.getPathComputationResult().getZToA().getWidth())
+ .setOpticalOperationalMode(serviceRpcResult.getPathComputationResult()
+ .getZToA().getOpticalOperationalMode())
+ // TODO: add GNSR, OSNR, min/max output powers
+ .build())
.setOperationalState(State.InService)
.build());
LOG.debug("For the Temp service, sending notification on service-result-rpc");
- sendServiceRpcResultNotification(notification, ServiceNotificationTypes.ServiceCreateResult);
return;
}
} else {
- OperationResult operationResult = this.serviceDataStoreOperations.modifyService(
- serviceRpcResultSp.getServiceName(), State.InService, AdminStates.InService);
// Here the service is implemented and the tempService has to be deleted if present
+ nbiNotificationBuilder.setServiceName(input.getServiceName()).setConnectionType(input.getConnectionType());
+ // Make sure temp-service is false
+ nbiNotificationBuilder.setIsTempService(false);
String commonId = input.getCommonId();
if (commonId != null) {
+ nbiNotificationBuilder.setCommonId(commonId);
if (this.serviceDataStoreOperations.getTempService(commonId).isPresent()) {
LOG.info("Temp-service exists with the common-Id {}", commonId);
// Delete the common-id from this temp-service-list here
LOG.info("Result for temp-service-list with {} is {}", commonId, tempServiceListDelete);
}
}
-
+ OperationResult operationResult = this.serviceDataStoreOperations.modifyService(
+ serviceRpcResultSp.getServiceName(), State.InService, AdminStates.InService);
if (operationResult.isSuccess()) {
sendNbiNotification(nbiNotificationBuilder
.setResponseFailed("")
* @param notification RendererRpcResultSp
* @param type ServiceNotificationTypes
*/
- private void sendServiceHandlerNotification(RendererRpcResultSp notification, ServiceNotificationTypes type) {
+ private void sendServiceHandlerNotification(
+ RendererRpcResultSp notification, ServiceNotificationTypes type) {
try {
ServiceRpcResultSh serviceHandlerNotification = new ServiceRpcResultShBuilder()
.setAToZDirection(notification.getAToZDirection())
.setNotificationType(type)
.build();
LOG.debug("Service update in datastore OK, sending notification {}", serviceHandlerNotification);
- notificationPublishService.putNotification(
- serviceHandlerNotification);
+ notificationPublishService.putNotification(serviceHandlerNotification);
} catch (InterruptedException e) {
LOG.warn("Something went wrong while sending notification for service {}",
serviceRpcResultSp.getServiceName(), e);
}
}
- private void sendServiceRpcResultNotification(RendererRpcResultSp notification, ServiceNotificationTypes type) {
+ private ServiceRpcResult sendServiceRpcResultNotification(
+ RendererRpcResultSp notification, ServiceNotificationTypes type) {
try {
ServiceRpcResult serviceRpcResult = new ServiceRpcResultBuilder()
.setServiceName(notification.getServiceName())
.getAToZDirection()
.getWidth())
// TODO: here the optical operational mode should be set
+ // A default value is set here
+ .setOpticalOperationalMode("OR-W-400G-oFEC-63.1Gbd")
// TODO: also set the GNSR, OSNR, power values
- .setOpticalOperationalMode("test")
.build())
.setZToA(new ZToABuilder()
.setFrequency(notification
.getZToADirection()
.getWidth())
// TODO: here the optical operational mode should be set
+ // A default value is set here
+ .setOpticalOperationalMode("OR-W-400G-oFEC-63.1Gbd")
// TODO: also set the GNSR, OSNR, power values
- .setOpticalOperationalMode("test")
.build())
.build())
.build();
LOG.info("Sending the notification for service-rpc-result {}", serviceRpcResult);
- notificationPublishService.putNotification(
- serviceRpcResult);
+ notificationPublishService.putNotification(serviceRpcResult);
+ return serviceRpcResult;
} catch (InterruptedException e) {
LOG.warn("Something went wrong while sending notification for service {}",
serviceRpcResultSp.getServiceName(), e);
Thread.currentThread().interrupt();
}
+ return null;
}
.setServiceZEnd(new ServiceZEndBuilder(service.getServiceZEnd()).build())
.setCommonId(service.getCommonId())
.setConnectionType(service.getConnectionType())
+ .setIsTempService(false)
.setResponseFailed("Renderer implementation failed !")
.setMessage("ServiceCreate request failed ...")
.setOperationalState(service.getOperationalState())
} else {
deleteServiceOperationResult = this.serviceDataStoreOperations.deleteService(serviceName);
}
- if (deleteServiceOperationResult.isSuccess()) {
+ if (!deleteServiceOperationResult.isSuccess()) {
LOG.warn("{}Service was not removed from datastore!", serviceType);
}
}