- if (openRoadmVersion.equals(StringConstants.OPENROADM_DEVICE_VERSION_1_2_1)) {
-
- final OrgOpenroadmAlarmListener alarmListener = new AlarmNotificationListener(this.dataBroker);
- LOG.info("Registering notification listener on OrgOpenroadmAlarmListener for node: {}", nodeId);
- final ListenerRegistration<OrgOpenroadmAlarmListener> accessAlarmNotificationListenerRegistration =
- notificationService.get().registerNotificationListener(alarmListener);
-
- final OrgOpenroadmDeOperationsListener deOperationsListener = new DeOperationsListener();
- LOG.info("Registering notification listener on OrgOpenroadmDeOperationsListener for node: {}", nodeId);
- final ListenerRegistration<OrgOpenroadmDeOperationsListener>
- accessDeOperationasNotificationListenerRegistration =
- notificationService.get().registerNotificationListener(deOperationsListener);
-
- final OrgOpenroadmDeviceListener deviceListener = new DeviceListener();
- LOG.info("Registering notification listener on OrgOpenroadmDeviceListener for node: {}", nodeId);
- final ListenerRegistration<OrgOpenroadmDeviceListener> accessDeviceNotificationListenerRegistration =
- notificationService.get().registerNotificationListener(deviceListener);
-
- TcaListener tcaListener = new TcaListener();
- LOG.info("Registering notification listener on OrgOpenroadmTcaListener for node: {}", nodeId);
- final ListenerRegistration<OrgOpenroadmTcaListener> accessTcaNotificationListenerRegistration =
- notificationService.get().registerNotificationListener(tcaListener);
-
- String streamName = "NETCONF";
-
- if (streamName == null) {
- streamName = "OPENROADM";
- }
-
- final Optional<RpcConsumerRegistry> service = mountPoint.getService(RpcConsumerRegistry.class);
- if (service.isPresent()) {
- final NotificationsService rpcService = service.get().getRpcService(NotificationsService.class);
- if (rpcService == null) {
- LOG.error("Failed to get RpcService for node {}", nodeId);
- } else {
- final CreateSubscriptionInputBuilder createSubscriptionInputBuilder =
- new CreateSubscriptionInputBuilder();
- createSubscriptionInputBuilder.setStream(new StreamNameType(streamName));
- LOG.info("Triggering notification stream {} for node {}", streamName, nodeId);
- rpcService.createSubscription(createSubscriptionInputBuilder.build());
- }
- } else {
- LOG.error("Failed to get RpcService for node {}", nodeId);
- }
- NodeRegistration nodeRegistration = new NodeRegistration(nodeId,
- accessAlarmNotificationListenerRegistration,
- accessDeOperationasNotificationListenerRegistration, accessDeviceNotificationListenerRegistration,
- null, accessTcaNotificationListenerRegistration);
- registrations.put(nodeId, nodeRegistration);
-
- } else if (openRoadmVersion.equals(StringConstants.OPENROADM_DEVICE_VERSION_2_2_1)) {
- final org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev181019.OrgOpenroadmAlarmListener
- alarmListener = new AlarmNotificationListener221(dataBroker);
- LOG.info("Registering notification listener on OrgOpenroadmAlarmListener for node: {}", nodeId);
- final ListenerRegistration<org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev181019
- .OrgOpenroadmAlarmListener> accessAlarmNotificationListenerRegistration =
- notificationService.get().registerNotificationListener(alarmListener);
-
- final org.opendaylight.yang.gen.v1.http.org.openroadm.de.operations.rev181019
- .OrgOpenroadmDeOperationsListener deOperationsListener = new DeOperationsListener221();
- LOG.info("Registering notification listener on OrgOpenroadmDeOperationsListener for node: {}", nodeId);
- final ListenerRegistration<org.opendaylight.yang.gen.v1.http.org.openroadm.de.operations.rev181019
- .OrgOpenroadmDeOperationsListener> accessDeOperationasNotificationListenerRegistration =
- notificationService.get().registerNotificationListener(deOperationsListener);
-
- final org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.OrgOpenroadmDeviceListener
- deviceListener = new DeviceListener221();
- LOG.info("Registering notification listener on OrgOpenroadmDeviceListener for node: {}", nodeId);
- final ListenerRegistration<org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019
- .OrgOpenroadmDeviceListener> accessDeviceNotificationListenerRegistration =
- notificationService.get().registerNotificationListener(deviceListener);
-
- final org.opendaylight.yang.gen.v1.http.org.openroadm.tca.rev181019.OrgOpenroadmTcaListener
- tcaListener = new TcaListener221();
- LOG.info("Registering notification listener on OrgOpenroadmTcaListener for node: {}", nodeId);
- final ListenerRegistration<org.opendaylight.yang.gen.v1.http.org.openroadm.tca.rev181019
- .OrgOpenroadmTcaListener> accessTcaNotificationListenerRegistration =
- notificationService.get().registerNotificationListener(tcaListener);
-
-
- String streamName = "NETCONF";
- if (streamName == null) {
- streamName = "OPENROADM";
- }
- final Optional<RpcConsumerRegistry> service = mountPoint.getService(RpcConsumerRegistry.class);
- if (service.isPresent()) {
- final NotificationsService rpcService = service.get().getRpcService(NotificationsService.class);
- if (rpcService == null) {
- LOG.error("Failed to get RpcService for node {}", nodeId);
- } else {
- final CreateSubscriptionInputBuilder createSubscriptionInputBuilder =
- new CreateSubscriptionInputBuilder();
- createSubscriptionInputBuilder.setStream(new StreamNameType(streamName));
- LOG.info("Triggering notification stream {} for node {}", streamName, nodeId);
- rpcService.createSubscription(createSubscriptionInputBuilder.build());
- }
- } else {
- LOG.error("Failed to get RpcService for node {}", nodeId);
- }
- NodeRegistration22 nodeRegistration22 = new NodeRegistration22(nodeId,
- accessAlarmNotificationListenerRegistration,
- accessDeOperationasNotificationListenerRegistration, accessDeviceNotificationListenerRegistration,
- null, accessTcaNotificationListenerRegistration);
- registrations22.put(nodeId, nodeRegistration22);
-
- }
-