private String ifaceVrf(String node, String iface) { return _configs.get(node).getAllInterfaces().get(iface).getVrfName(); }
public EigrpInterface(@Nonnull String hostname, @Nonnull Interface iface) { this(hostname, iface.getName(), iface.getVrfName()); }
@VisibleForTesting Map<String, IpSpace> computeArpRepliesByInterface( Map<String, Interface> interfaces, Map<String, IpSpace> routableIpsByVrf, Map<String, IpSpace> ipsRoutedOutInterfaces) { return toImmutableMap( interfaces, Entry::getKey, ifaceEntry -> computeInterfaceArpReplies( ifaceEntry.getValue(), routableIpsByVrf.get(ifaceEntry.getValue().getVrfName()), ipsRoutedOutInterfaces.get(ifaceEntry.getKey()))); }
@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); } } }); }
public boolean matches(Interface iface) { switch (_type) { case DESC: return _regex.matcher(iface.getDescription()).matches(); case NAME: return _regex.matcher(iface.getName()).matches(); case TYPE: return _regex.matcher(iface.getInterfaceType().toString()).matches(); case VRF: return _regex.matcher(iface.getVrfName()).matches(); default: throw new BatfishException("Unhandled InterfacesSpecifier type: " + _type); } }
/** * Aggregate a mapping (Ip -> host name -> interface name) to (Ip -> host name -> vrf * name) */ public static Map<Ip, Map<String, Set<String>>> computeIpVrfOwners( Map<Ip, Map<String, Set<String>>> ipInterfaceOwners, Map<String, Configuration> configs) { return CommonUtil.toImmutableMap( ipInterfaceOwners, Entry::getKey, /* ip */ ipEntry -> CommonUtil.toImmutableMap( ipEntry.getValue(), Entry::getKey, /* node */ nodeEntry -> ImmutableSet.copyOf( nodeEntry.getValue().stream() .map( iface -> configs .get(nodeEntry.getKey()) .getAllInterfaces() .get(iface) .getVrfName()) .collect(Collectors.toList())))); }
@Override public Optional<StateExpr> visitInterfaceLocation( @Nonnull InterfaceLocation interfaceLocation) { Configuration config = _configs.get(interfaceLocation.getNodeName()); if (config == null) { return Optional.empty(); } Interface iface = config.getAllInterfaces().get(interfaceLocation.getInterfaceName()); if (iface == null) { return Optional.empty(); } String vrf = iface.getVrfName(); return Optional.of(new OriginateVrf(interfaceLocation.getNodeName(), vrf)); } };
@Override public IngressLocation visitInterfaceLocation(InterfaceLocation interfaceLocation) { String node = interfaceLocation.getNodeName(); String iface = interfaceLocation.getInterfaceName(); return IngressLocation.vrf(node, _configs.get(node).getAllInterfaces().get(iface).getVrfName()); } }
private FlowDisposition computeDisposition( String hostname, String outgoingInterfaceName, Ip dstIp) { String vrfName = _configurations.get(hostname).getAllInterfaces().get(outgoingInterfaceName).getVrfName(); if (_forwardingAnalysis .getDeliveredToSubnet()
@VisibleForTesting Map<Edge, IpSpace> computeArpTrueEdgeNextHopIp( Map<String, Configuration> configurations, Map<String, Map<String, Map<Prefix, IpSpace>>> matchingIps) { try (ActiveSpan span = GlobalTracer.get() .buildSpan("ForwardingAnalysisImpl.computeArpTrueEdgeNextHopIp") .startActive()) { assert span != null; // avoid unused warning return _routesWithNextHopIpArpTrue.entrySet().stream() .collect( ImmutableMap.toImmutableMap( Entry::getKey /* edge */, routesWithNextHopIpArpTrueEntry -> { Edge edge = routesWithNextHopIpArpTrueEntry.getKey(); String hostname = edge.getNode1(); String iface = edge.getInt1(); String vrf = configurations.get(hostname).getAllInterfaces().get(iface).getVrfName(); Set<AbstractRoute> routes = routesWithNextHopIpArpTrueEntry.getValue(); return computeRouteMatchConditions(routes, matchingIps.get(hostname).get(vrf)); })); } }
private Stream<Edge> generateRules_PreInInterface_PostInVrf() { return _configs.values().stream() .map(Configuration::getVrfs) .map(Map::values) .flatMap(Collection::stream) .flatMap(vrf -> vrf.getInterfaces().values().stream()) .map( iface -> { String aclName = iface.getIncomingFilterName(); String nodeName = iface.getOwner().getHostname(); String vrfName = iface.getVrfName(); String ifaceName = iface.getName(); PreInInterface preState = new PreInInterface(nodeName, ifaceName); PostInVrf postState = new PostInVrf(nodeName, vrfName); BDD inAclBDD = ignorableAclPermitBDD(nodeName, aclName); Transition transition = compose( constraint(inAclBDD), _bddIncomingTransformations.get(nodeName).get(ifaceName)); return new Edge(preState, postState, transition); }); }
_configurations.get(hostname).getAllInterfaces().get(outInterface).getVrfName(); String recvNode = edge.getNode2(); String recvInterface = edge.getInt2();
String iface = edge.getInt1(); String vrf = configurations.get(hostname).getAllInterfaces().get(iface).getVrfName(); IpSpace dstIpMatchesSomeRoutePrefix = computeRouteMatchConditions(routes, matchingIps.get(hostname).get(vrf));
.getNeighborUnreachableOrExitsNetwork() .get(transmissionContext._currentNode.getName()) .get(outgoingInterface.getVrfName()) .get(outgoingInterfaceName) .containsIp(arpIp, c.getIpSpaces())) {
&& iface1.getVrfName().equals(iface2.getVrfName())) { continue;
.getNeighborUnreachableOrExitsNetwork() .get(transmissionContext._currentNodeName) .get(c.getAllInterfaces().get(nextHopInterfaceName).getVrfName()) .get(nextHopInterfaceName) .containsIp(arpIp, c.getIpSpaces())) {
Row.builder() .put(COL_NODE, new Node(hostname)) .put(COL_VRFNAME, iface.getVrfName()) .put(COL_INTERFACE_NAME, iface.getName()) .put(COL_IP, address.getIp())
.getAllInterfaces() .get(ospfEdge.getNode2().getInterfaceName()) .getVrfName(); VirtualRouter remoteRouter = remoteNode.getVirtualRouters().get(remoteVrf); Queue<RouteAdvertisement<OspfExternalRoute>> q =
/** * Returns the {@link Step} representing the entering of a packet on an input interface in a * {@link Hop} * * @param node Name of the {@link Hop} * @param inputIfaceName Name of the source interface * @return {@link EnterInputIfaceStep} containing {@link EnterInputIfaceStepDetail} and action for * the step; null if {@link EnterInputIfaceStep} can't be created */ @Nonnull static EnterInputIfaceStep createEnterSrcIfaceStep(Configuration node, String inputIfaceName) { Interface inputInterface = node.getAllInterfaces().get(inputIfaceName); checkArgument( inputInterface != null, "Node %s has no interface %s", node.getHostname(), inputIfaceName); EnterInputIfaceStep.Builder enterSrcIfaceStepBuilder = EnterInputIfaceStep.builder(); EnterInputIfaceStepDetail.Builder enterSrcStepDetailBuilder = EnterInputIfaceStepDetail.builder(); enterSrcStepDetailBuilder .setInputInterface(new NodeInterfacePair(node.getHostname(), inputIfaceName)) .setInputVrf(inputInterface.getVrfName()); // Send in the flow to the next steps return enterSrcIfaceStepBuilder .setDetail(enterSrcStepDetailBuilder.build()) .setAction(RECEIVED) .build(); }
String neighborVrfName = neighborInterface.getVrfName(); VirtualRouter neighborVirtualRouter = neighbor.getVirtualRouters().get(neighborVrfName); long asn = neighborInterface.getEigrp().getAsn();