@Test public void testNotifyChangedDeviceCreate() { List<ChangeNotification> notifs = new ArrayList<>(); ModelNodeId nodeId = new ModelNodeId("/container=network-manager/container=" + MANAGED_DEVICES, NS); EditContainmentNode editContainmentNode = new EditContainmentNode(QName.create(NS, DEVICE), EditConfigOperations.CREATE); editContainmentNode.addMatchNode(QName.create(NS, DEVICE), new GenericConfigAttribute("device", NS, DEVICE_A)); ModelNodeChange change = new ModelNodeChange(ModelNodeChangeType.create, editContainmentNode); notifs.add(new EditConfigChangeNotification(nodeId, change, StandardDataStores.RUNNING, mock(ModelNode.class))); m_deviceManagementSubsystem.notifyChanged(notifs); verify(m_deviceManager).deviceAdded(DEVICE_A); verify(m_deviceManager, never()).deviceRemoved(DEVICE_A); verify(m_deviceManager, never()).devicePropertyChanged(DEVICE_A); }
@Override public void notifyChanged(List<ChangeNotification> changeNotificationList) { LOGGER.debug("notification received : {}", changeNotificationList); for (ChangeNotification notification : changeNotificationList) { EditConfigChangeNotification editNotif = (EditConfigChangeNotification) notification; LOGGER.debug("notification received : {}", editNotif); ModelNodeId nodeId = editNotif.getModelNodeId(); EditContainmentNode changeData = editNotif.getChange().getChangeData(); if (nodeId.equals(MANAGED_DEVICES_ID_TEMPLATE) && "device".equals(editNotif.getChange().getChangeData().getName())) { LOGGER.debug("ModelNodeId[{}] matched device holder template", nodeId); handleDeviceCreateOrDelete(nodeId, editNotif); } else if (nodeId.matchesTemplate(AUTH_ID_TEMPLATE)) { handleAuthChanged(nodeId.getRdnValue("name"), changeData); } else if (nodeId.matchesTemplate(SNMP_AUTH_ID_TEMPLATE)) { handleAuthChanged(nodeId.getRdnValue("name"), changeData); } } }
DeviceManagementSubsystem extends AbstractSubSystem { @Override public void notifyChanged(List<ChangeNotification> changeNotificationList) { LOGGER.debug("notification received : {}", changeNotificationList); for (ChangeNotification notification : changeNotificationList) { EditConfigChangeNotification editNotif = (EditConfigChangeNotification) notification; LOGGER.debug("notification received : {}", editNotif); ModelNodeId nodeId = editNotif.getModelNodeId(); EditContainmentNode changeData = editNotif.getChange().getChangeData(); if (nodeId.equals(MANAGED_DEVICES_ID_TEMPLATE) && "device".equals(editNotif.getChange().getChangeData().getName())) { LOGGER.debug("ModelNodeId[{}] matched device holder template", nodeId); handleDeviceCreateOrDelete(nodeId, editNotif); } else if (nodeId.matchesTemplate(AUTH_ID_TEMPLATE)) { handleAuthChanged(nodeId.getRdnValue("name"), changeData); } else if (nodeId.matchesTemplate(SNMP_AUTH_ID_TEMPLATE)) { handleAuthChanged(nodeId.getRdnValue("name"), changeData); } } } }
DeviceManagementSubsystem extends AbstractSubSystem { @Override public void notifyChanged(List<ChangeNotification> changeNotificationList) { LOGGER.debug("notification received : {}", changeNotificationList); for (ChangeNotification notification : changeNotificationList) { EditConfigChangeNotification editNotif = (EditConfigChangeNotification) notification; LOGGER.debug("notification received : {}", editNotif); ModelNodeId nodeId = editNotif.getModelNodeId(); EditContainmentNode changeData = editNotif.getChange().getChangeData(); if (nodeId.equals(MANAGED_DEVICES_ID_TEMPLATE) && "device".equals(editNotif.getChange().getChangeData().getName())) { LOGGER.debug("ModelNodeId[{}] matched device holder template", nodeId); handleDeviceCreateOrDelete(nodeId, editNotif); } else if (nodeId.matchesTemplate(AUTH_ID_TEMPLATE)) { handleAuthChanged(nodeId.getRdnValue("name"), changeData); } else if (nodeId.matchesTemplate(SNMP_AUTH_ID_TEMPLATE)) { handleAuthChanged(nodeId.getRdnValue("name"), changeData); } } } DeviceManagementSubsystem(SchemaRegistry schemaRegistry, AdapterManager adapterManager); }
DeviceManagementSubsystem extends AbstractSubSystem { @Override public void notifyChanged(List<ChangeNotification> changeNotificationList) { LOGGER.debug("notification received : {}", changeNotificationList); for (ChangeNotification notification : changeNotificationList) { EditConfigChangeNotification editNotif = (EditConfigChangeNotification) notification; LOGGER.debug("notification received : {}", editNotif); ModelNodeId nodeId = editNotif.getModelNodeId(); EditContainmentNode changeData = editNotif.getChange().getChangeData(); if (nodeId.equals(MANAGED_DEVICES_ID_TEMPLATE) && "device".equals(editNotif.getChange().getChangeData().getName())) { LOGGER.debug("ModelNodeId[{}] matched device holder template", nodeId); handleDeviceCreateOrDelete(nodeId, editNotif); } else if (nodeId.matchesTemplate(AUTH_ID_TEMPLATE)) { handleAuthChanged(nodeId.getRdnValue("name"), changeData); } else if (nodeId.matchesTemplate(SNMP_AUTH_ID_TEMPLATE)) { handleAuthChanged(nodeId.getRdnValue("name"), changeData); } } } DeviceManagementSubsystem(SchemaRegistry schemaRegistry, AdapterManager adapterManager); DeviceManager getDeviceManager(); void setDeviceManager(DeviceManager deviceManager); NetconfConnectionManager getConnectionManager(); void setConnectionManager(NetconfConnectionManager connectionManager); @Override void notifyChanged(List<ChangeNotification> changeNotificationList); }
DeviceManagementSubsystem extends AbstractSubSystem { @Override public void notifyChanged(List<ChangeNotification> changeNotificationList) { LOGGER.debug("notification received : {}", changeNotificationList); for (ChangeNotification notification : changeNotificationList) { EditConfigChangeNotification editNotif = (EditConfigChangeNotification) notification; LOGGER.debug("notification received : {}", editNotif); ModelNodeId nodeId = editNotif.getModelNodeId(); EditContainmentNode changeData = editNotif.getChange().getChangeData(); if (nodeId.equals(MANAGED_DEVICES_ID_TEMPLATE) && "device".equals(editNotif.getChange().getChangeData().getName())) { LOGGER.debug("ModelNodeId[{}] matched device holder template", nodeId); handleDeviceCreateOrDelete(nodeId, editNotif); } else if (nodeId.matchesTemplate(AUTH_ID_TEMPLATE)) { handleAuthChanged(nodeId.getRdnValue("name"), changeData); } else if (nodeId.matchesTemplate(SNMP_AUTH_ID_TEMPLATE)) { handleAuthChanged(nodeId.getRdnValue("name"), changeData); } } } DeviceManagementSubsystem(SchemaRegistry schemaRegistry, AdapterManager adapterManager); DeviceManager getDeviceManager(); void setDeviceManager(DeviceManager deviceManager); NetconfConnectionManager getConnectionManager(); void setConnectionManager(NetconfConnectionManager connectionManager); @Override void notifyChanged(List<ChangeNotification> changeNotificationList);  }