private void postProcessOspfCosts(Map<String, Configuration> configurations) { configurations .values() .forEach( c -> c.getVrfs() .values() .forEach( vrf -> { // Compute OSPF interface costs where they are missing OspfProcess proc = vrf.getOspfProcess(); if (proc != null) { proc.initInterfaceCosts(c); } })); }
private void postProcessConfiguration(Configuration c) { // Set device type to host iff the configuration format is HOST if (c.getConfigurationFormat() == ConfigurationFormat.HOST) { c.setDeviceType(DeviceType.HOST); } for (Vrf vrf : c.getVrfs().values()) { // If vrf has BGP, OSPF, or RIP process and device isn't a host, set device type to router if (c.getDeviceType() == null && (vrf.getBgpProcess() != null || vrf.getOspfProcess() != null || vrf.getRipProcess() != null)) { c.setDeviceType(DeviceType.ROUTER); } // Compute OSPF interface costs where they are missing OspfProcess proc = vrf.getOspfProcess(); if (proc != null) { proc.initInterfaceCosts(c); } } // If device was not a host or router, call it a switch if (c.getDeviceType() == null) { c.setDeviceType(DeviceType.SWITCH); } } }