@Test public void addDevice() { assertTrue("Event should be relevant", provider.cfgLister.isRelevant(deviceAddedEvent)); provider.cfgLister.event(deviceAddedEvent); AbstractProjectableModel.setDriverService(null, new MockDriverService()); assertAfter(500, () -> assertNotNull("Device should be added to controller", controller.getDevice(deviceId))); assertTrue("Device should be reachable", provider.isReachable(deviceId)); }
@Override public boolean isReachable(DeviceId deviceId) { SnmpDevice snmpDevice = controller.getDevice(deviceId); if (snmpDevice == null) { log.warn("BAD REQUEST: the requested device id: " + deviceId.toString() + " is not associated to any SNMP Device"); return false; } return snmpDevice.isReachable(); }
SnmpDeviceProvider extends AbstractProvider implements DeviceProvider { @Override public boolean isReachable(DeviceId deviceId) { SnmpDevice snmpDevice = controller.getDevice(deviceId); if (snmpDevice == null) { log.warn("BAD REQUEST: the requested device id: " + deviceId.toString() + " is not associated to any SNMP Device"); return false; } return snmpDevice.isReachable(); } }
SnmpDeviceProvider extends AbstractProvider implements DeviceProvider { @Override public boolean isReachable(DeviceId deviceId) { SnmpDevice snmpDevice = controller.getDevice(deviceId); if (snmpDevice == null) { log.warn("BAD REQUEST: the requested device id: " + deviceId.toString() + " is not associated to any SNMP Device"); return false; } return snmpDevice.isReachable(); } SnmpDeviceProvider(); }
SnmpDeviceProvider extends AbstractProvider implements DeviceProvider { @Override public boolean isReachable(DeviceId deviceId) { SnmpDevice snmpDevice = controller.getDevice(deviceId); if (snmpDevice == null) { log.warn("BAD REQUEST: the requested device id: " + deviceId.toString() + " is not associated to any SNMP Device"); return false; } return snmpDevice.isReachable(); } SnmpDeviceProvider(); @Activate void activate(ComponentContext context); @Deactivate void deactivate(ComponentContext context); @Modified void modified(ComponentContext context); @Override void triggerProbe(DeviceId deviceId); @Override void roleChanged(DeviceId deviceId, MastershipRole newRole); @Override boolean isReachable(DeviceId deviceId); @Override void changePortState(DeviceId deviceId, PortNumber portNumber,
                                boolean enable); }
SnmpDeviceProvider extends AbstractProvider implements DeviceProvider { @Override public boolean isReachable(DeviceId deviceId) { SnmpDevice snmpDevice = controller.getDevice(deviceId); if (snmpDevice == null) { log.warn("BAD REQUEST: the requested device id: " + deviceId.toString() + " is not associated to any SNMP Device"); return false; } return snmpDevice.isReachable(); } SnmpDeviceProvider(); @Activate void activate(ComponentContext context); @Deactivate void deactivate(ComponentContext context); @Modified void modified(ComponentContext context); @Override void triggerProbe(DeviceId deviceId); @Override void roleChanged(DeviceId deviceId, MastershipRole newRole); @Override boolean isReachable(DeviceId deviceId); @Override void changePortState(DeviceId deviceId, PortNumber portNumber,
                                boolean enable);  }