- /**
- * Build notification containing path description information.
- * @param servicePathNotificationTypes ServicePathNotificationTypes
- * @param serviceName String
- * @param rpcStatusEx RpcStatusEx
- * @param message String
- * @param pathDescription PathDescription
- * @return notification with RendererRpcResultSp type.
- */
- private RendererRpcResultSp buildNotification(ServicePathNotificationTypes servicePathNotificationTypes,
- String serviceName, RpcStatusEx rpcStatusEx, String message, PathDescription pathDescription,
- Link notifLink, String serviceType) {
- RendererRpcResultSpBuilder builder = new RendererRpcResultSpBuilder()
- .setNotificationType(servicePathNotificationTypes).setServiceName(serviceName).setStatus(rpcStatusEx)
- .setStatusMessage(message)
- .setServiceType(serviceType);
- if (pathDescription != null) {
- builder.setAToZDirection(pathDescription.getAToZDirection())
- .setZToADirection(pathDescription.getZToADirection());
- }
- if (notifLink != null) {
- builder.setLink(notifLink);
- }
- return builder.build();
- }
-
- /**
- * Send renderer notification.
- * @param notification Notification
- */
- private void send(Notification notification) {
- try {
- LOG.info("Sending notification {}", notification);
- notificationPublishService.putNotification(notification);
- } catch (InterruptedException e) {
- LOG.info("notification offer rejected: ", e);
- Thread.currentThread().interrupt();
- }
+ private Link createLinkForNotif(List<LinkTp> otnLinkTerminationPoints) {
+ return
+ otnLinkTerminationPoints == null || otnLinkTerminationPoints.size() != 2
+ ? null
+ : new LinkBuilder()
+ .setATermination(
+ new ATerminationBuilder()
+ .setNodeId(otnLinkTerminationPoints.get(0).getNodeId())
+ .setTpId(otnLinkTerminationPoints.get(0).getTpId())
+ .build())
+ .setZTermination(
+ new ZTerminationBuilder()
+ .setNodeId(otnLinkTerminationPoints.get(1).getNodeId())
+ .setTpId(otnLinkTerminationPoints.get(1).getTpId())
+ .build())
+ .build();