@Test public void testDeviceDisConnected() throws NetconfMessageBuilderException, IOException, SAXException { Device device = new Device(); device.setDeviceName("testDeviceOFF"); NetconfClientSession clientSession = mock(NetconfClientSession.class); m_listener.deviceDisConnected(device, clientSession); ArgumentCaptor<Notification> captor = ArgumentCaptor.forClass(Notification.class); verify(m_notificationService, times(1)).sendNotification(eq("STATE_CHANGE"), captor.capture()); Notification notification = captor.getValue(); String expectedNotifElem = "<network-manager xmlns=\"urn:bbf:yang:obbaa:network-manager\">\n" + "<managed-devices>\n" + "<device>\n" + "<name>testDeviceOFF</name>\n" + "<device-notification>\n" + "<device-state-change>\n" + "<event>offline</event>\n" + "</device-state-change>\n" + "</device-notification>\n" + "</device>\n" + "</managed-devices>\n" + "</network-manager>\n"; TestUtil.assertXMLEquals(DocumentUtils.stringToDocument(expectedNotifElem).getDocumentElement(), notification.getNotificationElement()); }
@Override public void deviceDisConnected(Device device, NetconfClientSession session) { try { m_notificationService.sendNotification(NetconfResources.STATE_CHANGE, buildDeviceStateChangeNotification(device, "offline")); } catch (NetconfMessageBuilderException e) { LOGGER.error("Exception while sending device-state-change notification ", e); } }
DeviceReconnectionNotificationListener implements ConnectionListener { @Override public void deviceDisConnected(Device device, NetconfClientSession session) { try { m_notificationService.sendNotification(NetconfResources.STATE_CHANGE, buildDeviceStateChangeNotification(device, "offline")); } catch (NetconfMessageBuilderException e) { LOGGER.error("Exception while sending device-state-change notification ", e); } } }
DeviceReconnectionNotificationListener implements ConnectionListener { @Override public void deviceDisConnected(Device device, NetconfClientSession session) { try { m_notificationService.sendNotification(NetconfResources.STATE_CHANGE, buildDeviceStateChangeNotification(device, "offline")); } catch (NetconfMessageBuilderException e) { LOGGER.error("Exception while sending device-state-change notification ", e); } } DeviceReconnectionNotificationListener(NotificationService notificationService,
                                                  NetconfConnectionManager netconfConnectionManager); }
DeviceReconnectionNotificationListener implements ConnectionListener { @Override public void deviceDisConnected(Device device, NetconfClientSession session) { try { m_notificationService.sendNotification(NetconfResources.STATE_CHANGE, buildDeviceStateChangeNotification(device, "offline")); } catch (NetconfMessageBuilderException e) { LOGGER.error("Exception while sending device-state-change notification ", e); } } DeviceReconnectionNotificationListener(NotificationService notificationService,
                                                  NetconfConnectionManager netconfConnectionManager); void init(); void destroy(); @Override void deviceConnected(Device device, NetconfClientSession clientSession); @Override void deviceDisConnected(Device device, NetconfClientSession session); }
DeviceReconnectionNotificationListener implements ConnectionListener { @Override public void deviceDisConnected(Device device, NetconfClientSession session) { try { m_notificationService.sendNotification(NetconfResources.STATE_CHANGE, buildDeviceStateChangeNotification(device, "offline")); } catch (NetconfMessageBuilderException e) { LOGGER.error("Exception while sending device-state-change notification ", e); } } DeviceReconnectionNotificationListener(NotificationService notificationService,
                                                  NetconfConnectionManager netconfConnectionManager); void init(); void destroy(); @Override void deviceConnected(Device device, NetconfClientSession clientSession); @Override void deviceDisConnected(Device device, NetconfClientSession session);  }