import org.opendaylight.mdsal.binding.api.RpcProviderService;
import org.opendaylight.mdsal.binding.dom.codec.spi.BindingDOMCodecServices;
import org.opendaylight.transportpce.common.converter.JsonStringConverter;
+import org.opendaylight.transportpce.common.network.NetworkTransactionService;
import org.opendaylight.transportpce.nbinotifications.listener.NbiNotificationsListenerImpl;
import org.opendaylight.transportpce.nbinotifications.producer.Publisher;
-import org.opendaylight.transportpce.nbinotifications.serialization.NotificationAlarmServiceSerializer;
-import org.opendaylight.transportpce.nbinotifications.serialization.NotificationServiceSerializer;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NbiNotificationsListener;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NbiNotificationsService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessService;
+import org.opendaylight.transportpce.nbinotifications.utils.TopicManager;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NbiNotificationsListener;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NbiNotificationsService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationTapiService;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.TapiNotificationService;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.concepts.ObjectRegistration;
import org.slf4j.Logger;
private final NotificationService notificationService;
private final JsonStringConverter<NotificationProcessService> converterService;
private final JsonStringConverter<NotificationAlarmService> converterAlarmService;
+ private final JsonStringConverter<NotificationTapiService> converterTapiService;
private final String subscriberServer;
private ObjectRegistration<NbiNotificationsService> rpcRegistration;
private ListenerRegistration<NbiNotificationsListener> listenerRegistration;
+ private TopicManager topicManager = TopicManager.getInstance();
+ private final NetworkTransactionService networkTransactionService;
public NbiNotificationsProvider(List<String> publishersService, List<String> publishersAlarm,
- String subscriberServer, String publisherServer,
- RpcProviderService rpcProviderService, NotificationService notificationService,
- BindingDOMCodecServices bindingDOMCodecServices) {
+ String subscriberServer, String publisherServer,
+ RpcProviderService rpcProviderService, NotificationService notificationService,
+ BindingDOMCodecServices bindingDOMCodecServices,
+ NetworkTransactionService networkTransactionService) {
this.rpcService = rpcProviderService;
this.notificationService = notificationService;
+ this.topicManager.setPublisherServer(publisherServer);
converterService = new JsonStringConverter<>(bindingDOMCodecServices);
+ this.topicManager.setProcessConverter(converterService);
for (String publisherService: publishersService) {
LOG.info("Creating publisher for the following class {}", publisherService);
- publishersServiceMap.put(publisherService, new Publisher<>(publisherService, publisherServer,
- converterService, NotificationServiceSerializer.class));
+ this.topicManager.addProcessTopic(publisherService);
}
converterAlarmService = new JsonStringConverter<>(bindingDOMCodecServices);
+ this.topicManager.setAlarmConverter(converterAlarmService);
for (String publisherAlarm: publishersAlarm) {
LOG.info("Creating publisher for the following class {}", publisherAlarm);
- publishersAlarmMap.put(publisherAlarm, new Publisher<>(publisherAlarm, publisherServer,
- converterAlarmService, NotificationAlarmServiceSerializer.class));
+ this.topicManager.addAlarmTopic(publisherAlarm);
}
this.subscriberServer = subscriberServer;
+ converterTapiService = new JsonStringConverter<>(bindingDOMCodecServices);
+ LOG.info("baozhi tapi converter: {}", converterTapiService);
+ this.topicManager.setTapiConverter(converterTapiService);
+ this.networkTransactionService = networkTransactionService;
}
/**
*/
public void init() {
LOG.info("NbiNotificationsProvider Session Initiated");
- rpcRegistration = rpcService.registerRpcImplementation(NbiNotificationsService.class,
- new NbiNotificationsImpl(converterService, converterAlarmService, subscriberServer));
- listenerRegistration = notificationService.registerNotificationListener(
- new NbiNotificationsListenerImpl(publishersServiceMap, publishersAlarmMap));
+ NbiNotificationsImpl nbiImpl = new NbiNotificationsImpl(converterService, converterAlarmService,
+ subscriberServer, this.networkTransactionService, this.topicManager);
+ rpcRegistration = rpcService.registerRpcImplementation(NbiNotificationsService.class, nbiImpl);
+ rpcService.registerRpcImplementation(TapiNotificationService.class, nbiImpl);
+ NbiNotificationsListenerImpl nbiNotificationsListener =
+ new NbiNotificationsListenerImpl(this.topicManager.getProcessTopicMap(),
+ this.topicManager.getAlarmTopicMap(), this.topicManager.getTapiTopicMap());
+ listenerRegistration = notificationService.registerNotificationListener(nbiNotificationsListener);
+ this.topicManager.setNbiNotificationsListener(nbiNotificationsListener);
}
/**