/** Blacklist this interface, making it inactive and blacklisted */ public void blacklist() { setActive(false); setBlacklisted(true); }
@VisibleForTesting static void processManagementInterfaces(Map<String, Configuration> configurations) { configurations .values() .forEach( configuration -> { for (Interface iface : configuration.getAllInterfaces().values()) { if (MANAGEMENT_INTERFACES.matcher(iface.getName()).find() || MANAGEMENT_VRFS.matcher(iface.getVrfName()).find()) { iface.setActive(false); iface.setBlacklisted(true); } } }); }
/** Deactivate an interface if it is blacklisted or its dependencies are not active */ private static void deactivateInterfaceIfNeeded(Interface iface) { Configuration config = iface.getOwner(); Set<Dependency> dependencies = iface.getDependencies(); if (dependencies.stream() // Look at bind dependencies .filter(d -> d.getType() == DependencyType.BIND) .map(d -> config.getAllInterfaces().get(d.getInterfaceName())) // Find any missing or inactive interfaces .anyMatch(parent -> parent == null || !parent.getActive())) { iface.setActive(false); } // Look at aggregate dependencies only now Set<Dependency> aggregateDependencies = dependencies.stream() .filter(d -> d.getType() == DependencyType.AGGREGATE) .collect(ImmutableSet.toImmutableSet()); if (iface.getInterfaceType() == InterfaceType.AGGREGATED && aggregateDependencies.stream() // Extract existing and active interfaces .map(d -> config.getAllInterfaces().get(d.getInterfaceName())) .filter(Objects::nonNull) .noneMatch(Interface::getActive)) { iface.setActive(false); } }
private void addNullRouteEdges() { for (Entry<String, List<StaticRoute>> entry : _nullStaticRoutes.entrySet()) { String router = entry.getKey(); List<StaticRoute> srs = entry.getValue(); for (StaticRoute sr : srs) { String name = sr.getNextHopInterface(); // Create null route interface Interface iface = new Interface(name); iface.setActive(true); iface.setAddress( new InterfaceAddress(sr.getNetwork().getStartIp(), sr.getNextHopIp().numSubnetBits())); iface.setBandwidth(0.); // Add static route to all static routes list Map<String, List<StaticRoute>> map = _staticRoutes.get(router); List<StaticRoute> routes = map.computeIfAbsent(name, k -> new ArrayList<>()); routes.add(sr); // Create and add graph edge for null route GraphEdge ge = new GraphEdge(iface, null, router, null, false, true); _allRealEdges.add(ge); _allEdges.add(ge); List<GraphEdge> edges = _edgeMap.computeIfAbsent(router, k -> new ArrayList<>()); edges.add(ge); } } }
private Interface createIbgpInterface(BgpActivePeerConfig n, String peer) { Interface iface = new Interface("iBGP-" + peer); iface.setActive(true); // TODO is this valid. iface.setAddress(new InterfaceAddress(n.getPeerAddress(), Prefix.MAX_PREFIX_LENGTH)); iface.setBandwidth(0.); return iface; }
+ "to it: \"%s:%d\"\n", hostname, vlanNumber); iface.setActive(false); iface.setBlacklisted(true);
orphanedInterfaces.put(iface.getName(), iface); iface.setVrf(nullVrf); iface.setActive(false); _w.redFlag( String.format(
private org.batfish.datamodel.Interface toInterface(Interface iface) { String name = iface.getName(); org.batfish.datamodel.Interface newIface = new org.batfish.datamodel.Interface(name, _c); newIface.setDeclaredNames(ImmutableSortedSet.of(name)); newIface.setActive(true); // TODO: may have to change newIface.setBandwidth(iface.getBandwidth()); newIface.setDescription(iface.getDescription()); InterfaceAddress address = iface.getAddress(); if (address != null) { newIface.setAddress(iface.getAddress()); } newIface.getAllAddresses().addAll(iface.getAllAddresses()); for (InterfaceAddress p : newIface.getAllAddresses()) { _ipToInterfaceMap.put(p.getIp(), newIface); } return newIface; }
newIface.setActive(iface.getActive()); if (iface.getSwitchportMode() == SwitchportMode.ACCESS && iface.getAccessVlan() != null) { Vlan vlan = _masterLogicalSystem.getNamedVlans().get(iface.getAccessVlan());
Interface iface = new Interface(name, _owner); ImmutableSet.Builder<InterfaceAddress> allAddresses = ImmutableSet.builder(); iface.setActive(_active); if (_address != null) { iface.setAddress(_address);
iface1.setActive(false);
Vrf vrf = _vrfs.computeIfAbsent(vrfName, Vrf::new); newIface.setDescription(iface.getDescription()); newIface.setActive(iface.getActive()); newIface.setChannelGroup(iface.getChannelGroup()); newIface.setCryptoMap(iface.getCryptoMap());
newIface.setActive(iface.getActive()); newIface.setDescription(iface.getComment());