@Override public List<ReportRow> check(Modstat modstat, SystemAccess access, Location location) { List<ReportRow> result = null; if (modstat.hasAddressBinding()) { com.controlj.green.modstat.AddressBinding addressBinding = modstat.getAddressBinding(); result = new ArrayList<ReportRow>(); try { Device device = location.getAspect(Device.class); String dbAddress = device.getMacAddressString(); String fieldAddress = addressBinding.getMac(); if (fieldAddress.contains(":")) { fieldAddress = fieldAddress.substring(0, fieldAddress.indexOf(":")); } if (!dbAddress.equals(fieldAddress)) { result.add( ReportRow.error( "Address in the field device (" + fieldAddress + ") does not match the value in SiteBuilder (" + dbAddress + ").")); } } catch (NoSuchAspectException e) { result.add( ReportRow.error( "Can't determine device address from database for device at: " + location.getDisplayPath())); } } return result; }
@Override public List<ReportRow> check(Modstat modstat, SystemAccess access, Location location) { List<ReportRow> result = null; if (modstat.hasArcnetReconfigs()) { Map<String, Long> reconfigs = modstat.getArcnetReconfigs(); if (reconfigs.containsKey(Modstat.ArcnetReconfigs.THIS_NODE) && reconfigs.containsKey(Modstat.ArcnetReconfigs.TOTAL)) { long rc_this = reconfigs.get(Modstat.ArcnetReconfigs.THIS_NODE); long rc_total = reconfigs.get(Modstat.ArcnetReconfigs.TOTAL); if (countPastLimit(rc_this, rc_total)) { String msg = countFormat.format(rc_total) + " arcnet reconfigs in the last hour. " + countFormat.format(rc_this) + " were from this node."; result = new ArrayList<ReportRow>(); result.add((rc_total > errorLimit) ? ReportRow.error(msg) : ReportRow.warning(msg)); } } } if (modstat.hasSecondaryArcnetReconfigs()) { Map<String, Long> reconfigs = modstat.getSecondaryArcnetReconfigs(); if (reconfigs.containsKey(Modstat.ArcnetReconfigs.THIS_NODE) && reconfigs.containsKey(Modstat.ArcnetReconfigs.TOTAL)) { long rc_this = reconfigs.get(Modstat.ArcnetReconfigs.THIS_NODE); long rc_total = reconfigs.get(Modstat.ArcnetReconfigs.TOTAL); if (countPastLimit(rc_this, rc_total)) { if (result == null) { result = new ArrayList<ReportRow>(); } String msg = countFormat.format(rc_total) + " secondary arcnet reconfigs in the last hour. " + countFormat.format(rc_this) + " were from this node."; result.add((rc_total > errorLimit) ? ReportRow.error(msg) : ReportRow.warning(msg)); } } } return result; }