import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.ServiceNotificationTypes;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
import org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev191129.AdminStates;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceRpcResult;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceRpcResultBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.list.Services;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.rpc.result.PathComputationResultBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.rpc.result.path.computation.result.AToZBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.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;
}
updateOtnTopology(notification, false);
-
PublishNotificationProcessServiceBuilder nbiNotificationBuilder = new PublishNotificationProcessServiceBuilder()
.setServiceName(input.getServiceName())
.setServiceAEnd(new ServiceAEndBuilder(input.getServiceAEnd()).build())
operationResult = this.serviceDataStoreOperations.modifyTempService(
serviceRpcResultSp.getServiceName(), State.InService, AdminStates.InService);
serviceTemp = "Temp ";
+ LOG.info("Sending notification to the service-RPC-result");
} else {
operationResult = this.serviceDataStoreOperations.modifyService(
serviceRpcResultSp.getServiceName(), State.InService, AdminStates.InService);
.build());
if (!tempService) {
sendServiceHandlerNotification(notification, ServiceNotificationTypes.ServiceCreateResult);
+ } else {
+ LOG.info("For the Temp service, sending notification on service-result-rpc");
+ sendServiceRpcResultNotification(notification, ServiceNotificationTypes.ServiceCreateResult);
}
} else {
LOG.warn("{}Service status not updated in datastore !", serviceTemp);
}
}
+ private void sendServiceRpcResultNotification(RendererRpcResultSp notification, ServiceNotificationTypes type) {
+ try {
+ ServiceRpcResult serviceRpcResult = new ServiceRpcResultBuilder()
+ .setServiceName(notification.getServiceName())
+ .setNotificationType(type)
+ .setStatusMessage(notification.getStatusMessage())
+ .setCommonId(notification.getCommonId())
+ .setPathComputationResult(new PathComputationResultBuilder()
+ .setAToZ(new AToZBuilder()
+ .setFrequency(notification
+ .getAToZDirection()
+ .getCentralFrequency())
+ .setWidth(notification
+ .getAToZDirection()
+ .getWidth())
+ // TODO: here the optical operational mode should be set
+ // TODO: also set the GNSR, OSNR, power values
+ .setOpticalOperationalMode("test")
+ .build())
+ .setZToA(new ZToABuilder()
+ .setFrequency(notification
+ .getZToADirection()
+ .getCentralFrequency())
+ .setWidth(notification
+ .getZToADirection()
+ .getWidth())
+ // TODO: here the optical operational mode should be set
+ // 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);
+ } catch (InterruptedException e) {
+ LOG.warn("Something went wrong while sending notification for service {}",
+ serviceRpcResultSp.getServiceName(), e);
+ Thread.currentThread().interrupt();
+ }
+ }
+
+
+
/**
* Process failed service implementation for serviceName.
* @param serviceName String