@Test public void testIsNoviSwitch() { assertTrue(isNoviSwitch(makeSwitchMock("NoviFlow Inc", "NW400.4.0", "NS21100"))); assertTrue(isNoviSwitch(makeSwitchMock("NoviFlow Inc", "NW500.2.0_dev", "NS21100"))); assertTrue(isNoviSwitch(makeSwitchMock("NoviFlow Inc", "NW500.0.1", "WB5164-E"))); assertTrue(isNoviSwitch(makeSwitchMock("NoviFlow Inc", "NW500.0.1", "SM5000-SM"))); assertTrue(isNoviSwitch(makeSwitchMock("E", "NW400.4.0", "WB5164"))); assertFalse(isNoviSwitch(makeSwitchMock("Common Inc", "Soft123", "Hard123"))); assertFalse(isNoviSwitch(makeSwitchMock("Nicira, Inc.", "Soft123", "Hard123"))); assertFalse(isNoviSwitch(makeSwitchMock("2004-2016 Centec Networks Inc", "2.8.16.21", "48T"))); assertFalse(isNoviSwitch(makeSwitchMock("Sonus Networks Inc, 4 Technology Park Dr, Westford, MA 01886, USA", "8.1.0.14", "VX3048"))); }
static boolean isNoviSwitch(IOFSwitch sw) { if (sw == null || sw.getSwitchDescription() == null) { return false; } String manufacturer = getManufacturer(sw); if (E_SWITCH_MANUFACTURER_DESCRIPTION.equalsIgnoreCase(manufacturer)) { return true; } SwitchDescription description = sw.getSwitchDescription(); if (E_SWITCH_HARDWARE_DESCRIPTION_REGEX.matcher( Optional.ofNullable(description.getHardwareDescription()).orElse("")).matches()) { return true; } return manufacturer.toLowerCase().contains(NOVIFLOW_MANUFACTURER_SUFFIX); }
NoviflowSpecificFeature extends AbstractFeature { static boolean isNoviSwitch(IOFSwitch sw) { if (sw == null || sw.getSwitchDescription() == null) { return false; } String manufacturer = getManufacturer(sw); if (E_SWITCH_MANUFACTURER_DESCRIPTION.equalsIgnoreCase(manufacturer)) { return true; } SwitchDescription description = sw.getSwitchDescription(); if (E_SWITCH_HARDWARE_DESCRIPTION_REGEX.matcher( Optional.ofNullable(description.getHardwareDescription()).orElse("")).matches()) { return true; } return manufacturer.toLowerCase().contains(NOVIFLOW_MANUFACTURER_SUFFIX); } }
NoviflowSpecificFeature extends AbstractFeature { static boolean isNoviSwitch(IOFSwitch sw) { if (sw == null || sw.getSwitchDescription() == null) { return false; } String manufacturer = getManufacturer(sw); if (E_SWITCH_MANUFACTURER_DESCRIPTION.equalsIgnoreCase(manufacturer)) { return true; } SwitchDescription description = sw.getSwitchDescription(); if (E_SWITCH_HARDWARE_DESCRIPTION_REGEX.matcher( Optional.ofNullable(description.getHardwareDescription()).orElse("")).matches()) { return true; } return manufacturer.toLowerCase().contains(NOVIFLOW_MANUFACTURER_SUFFIX); }  }
NoviflowSpecificFeature extends AbstractFeature { static boolean isNoviSwitch(IOFSwitch sw) { if (sw == null || sw.getSwitchDescription() == null) { return false; } String manufacturer = getManufacturer(sw); if (E_SWITCH_MANUFACTURER_DESCRIPTION.equalsIgnoreCase(manufacturer)) { return true; } SwitchDescription description = sw.getSwitchDescription(); if (E_SWITCH_HARDWARE_DESCRIPTION_REGEX.matcher( Optional.ofNullable(description.getHardwareDescription()).orElse("")).matches()) { return true; } return manufacturer.toLowerCase().contains(NOVIFLOW_MANUFACTURER_SUFFIX); }   }
NoviflowSpecificFeature extends AbstractFeature { static boolean isNoviSwitch(IOFSwitch sw) { if (sw == null || sw.getSwitchDescription() == null) { return false; } String manufacturer = getManufacturer(sw); if (E_SWITCH_MANUFACTURER_DESCRIPTION.equalsIgnoreCase(manufacturer)) { return true; } SwitchDescription description = sw.getSwitchDescription(); if (E_SWITCH_HARDWARE_DESCRIPTION_REGEX.matcher( Optional.ofNullable(description.getHardwareDescription()).orElse("")).matches()) { return true; } return manufacturer.toLowerCase().contains(NOVIFLOW_MANUFACTURER_SUFFIX); }   static final String NOVIFLOW_MANUFACTURER_SUFFIX; }