@Deprecated @Override public Map<String, BiFunction<Question, IBatfish, Answerer>> getAnswererCreators() { return toImmutableMap(_answererCreators, Entry::getKey, entry -> entry.getValue()::create); }
private static Map<String, Map<String, BDD>> computeVrfNotAcceptBDDs( Map<String, Map<String, BDD>> vrfAcceptBDDs) { return toImmutableMap( vrfAcceptBDDs, Entry::getKey, nodeEntry -> toImmutableMap( nodeEntry.getValue(), Entry::getKey, vrfEntry -> vrfEntry.getValue().not())); }
private static Map<String, Map<String, Supplier<BDD>>> computeAclDenyBDDs( Map<String, Map<String, Supplier<BDD>>> aclBDDs) { return toImmutableMap( aclBDDs, Entry::getKey, nodeEntry -> toImmutableMap( nodeEntry.getValue(), Entry::getKey, aclEntry -> Suppliers.memoize(() -> aclEntry.getValue().get().not()))); }
private static Map<StateExpr, Map<StateExpr, Edge>> computeReverseEdges( Map<StateExpr, Map<StateExpr, Edge>> edges) { Map<StateExpr, Map<StateExpr, Edge>> reverseEdges = new HashMap<>(); edges.forEach( (preState, preStateOutEdges) -> preStateOutEdges.forEach( (postState, edge) -> reverseEdges .computeIfAbsent(postState, k -> new HashMap<>()) .put(preState, edge))); // freeze return toImmutableMap( reverseEdges, Entry::getKey, entry -> ImmutableMap.copyOf(entry.getValue())); }
private Map<String, Map<String, Fib>> computeFibs() { return toImmutableMap( _nodes, Entry::getKey, nodeEntry -> toImmutableMap( nodeEntry.getValue().getVirtualRouters(), Entry::getKey, vrfEntry -> vrfEntry.getValue().getFib())); }
private static Map<String, Map<String, BDD>> computeRoutableBDDs( ForwardingAnalysis forwardingAnalysis, IpSpaceToBDD ipSpaceToBDD) { return toImmutableMap( forwardingAnalysis.getRoutableIps(), Entry::getKey, nodeEntry -> toImmutableMap( nodeEntry.getValue(), Entry::getKey, vrfEntry -> vrfEntry.getValue().accept(ipSpaceToBDD))); }
/** * Filter and sort {@code rawAnswers} according to options specified in {@code * analysisAnswersOptions} */ public Map<String, Answer> processAnalysisAnswers( Map<String, String> rawAnswers, Map<String, AnswerRowsOptions> answersRowsOptions) { return CommonUtil.toImmutableMap( rawAnswers, Entry::getKey, rawAnswersEntry -> processAnswerRows( rawAnswersEntry.getValue(), answersRowsOptions.get(rawAnswersEntry.getKey()))); }
private Map<String, Set<String>> computeEnabledInterfaces() { return toImmutableMap( _enabledInterfacesByNodeVrf, Entry::getKey, enabledInterfacesByNodeVrfEntry -> enabledInterfacesByNodeVrfEntry.getValue().entrySet().stream() .flatMap( enabledInterfacesByVrfEntry -> enabledInterfacesByVrfEntry.getValue().stream()) .collect(ImmutableSet.toImmutableSet())); }
private Map<String, Map<String, List<LineAction>>> computeAclActions() { return toImmutableMap( _enabledAcls, Entry::getKey, enabledAclsByHostnameEntry -> toImmutableMap( enabledAclsByHostnameEntry.getValue(), Entry::getKey, enabledAclsByAclNameEntry -> enabledAclsByAclNameEntry.getValue().getLines().stream() .map(IpAccessListLine::getAction) .collect(ImmutableList.toImmutableList()))); }
private Map<String, Set<String>> computeTopologyInterfaces() { Map<String, Set<String>> topologyEdges = new HashMap<>(); _enabledEdges.forEach( enabledEdge -> topologyEdges .computeIfAbsent(enabledEdge.getNode1(), n -> new HashSet<>()) .add(enabledEdge.getInt1())); // freeze return toImmutableMap(topologyEdges, Entry::getKey, e -> ImmutableSet.copyOf(e.getValue())); }
private Map<String, Set<String>> computeEnabledVrfs() { return toImmutableMap( _enabledNodes, Function.identity(), hostname -> { Set<String> disabledVrfs = _disabledVrfs.get(hostname); return _configurations.get(hostname).getVrfs().keySet().stream() .filter(vrfName -> disabledVrfs == null || !disabledVrfs.contains(vrfName)) .collect(ImmutableSet.toImmutableSet()); }); }
private static Map<IngressLocation, BooleanExpr> computeSrcIpConstraints( Map<IngressLocation, IpSpace> ipSpaceAssignment) { // Named IP spaces are not allowed here. TODO do we need them? IpSpaceBooleanExprTransformer toBooleanExpr = new IpSpaceBooleanExprTransformer(ImmutableMap.of(), Field.ORIG_SRC_IP); return toImmutableMap( ipSpaceAssignment, Entry::getKey, entry -> entry.getValue().accept(toBooleanExpr)); }
private static Map<org.batfish.datamodel.Edge, BDD> computeArpTrueEdgeBDDs( ForwardingAnalysis forwardingAnalysis, IpSpaceToBDD ipSpaceToBDD) { return toImmutableMap( forwardingAnalysis.getArpTrueEdge(), Entry::getKey, entry -> entry.getValue().accept(ipSpaceToBDD)); }
public Map<String, Map<String, Transformation>> computeOutgoingTransformations() { return toImmutableMap( _configurations, Entry::getKey, nodeEntry -> nodeEntry.getValue().getAllInterfaces().entrySet().stream() .filter(ifaceEntry -> ifaceEntry.getValue().getOutgoingTransformation() != null) .collect( ImmutableMap.toImmutableMap( Entry::getKey, ifaceEntry -> ifaceEntry.getValue().getOutgoingTransformation()))); }
private static Map<String, IpSpaceSpecializer> computeIpSpaceSpecializers( BDDPacket pkt, BDD headerSpaceBdd, Map<String, Configuration> configs) { return toImmutableMap( configs, Entry::getKey, configEntry -> BDDIpSpaceSpecializer.specializeByDstIp( pkt, headerSpaceBdd, configEntry.getValue().getIpSpaces(), true)); }
private Map<String, AclLineMatchExprToBooleanExpr> computeAclLineMatchExprToBooleanExprs() { return toImmutableMap( _configurations, Entry::getKey, e -> { Configuration config = e.getValue(); return new AclLineMatchExprToBooleanExpr( config.getIpAccessLists(), config.getIpSpaces(), _sourceInterfaceField, _sourceInterfaceFieldValues.getOrDefault(e.getKey(), ImmutableMap.of())); }); }
private Map<StateExpr, BDD> reachableInNRounds(int numRounds) { BDD one = _bddPacket.getFactory().one(); // All ingress locations are reachable in 0 rounds. Map<StateExpr, BDD> reachableInNRounds = toImmutableMap(_ingressLocationStates, Function.identity(), k -> one); for (int round = 0; !reachableInNRounds.isEmpty() && round < numRounds; round++) { reachableInNRounds = propagate(reachableInNRounds); } return reachableInNRounds; }
private static Map<String, IpAccessListSpecializer> computeIpAccessListSpecializers( BDDPacket pkt, BDD headerSpaceBdd, Map<String, Configuration> configs) { return toImmutableMap( configs, Entry::getKey, configEntry -> new BDDIpAccessListSpecializer( pkt, headerSpaceBdd, configEntry.getValue().getIpSpaces(), BDDSourceManager.forInterfaces(pkt, configEntry.getValue().activeInterfaces()))); }
public IpSpaceToBDD(BDDInteger var, Map<String, IpSpace> namedIpSpaces) { _bddInteger = var; _factory = var.getFactory(); _bddOps = new BDDOps(_factory); _namedIpSpaceBDDs = toImmutableMap( namedIpSpaces, Entry::getKey, entry -> Suppliers.memoize(new NonRecursiveSupplier<>(() -> this.visit(entry.getValue())))); }
private static BDDSourceManager forNoReferencedSources( BDDPacket pkt, Set<String> activeButNotReferenced) { return new BDDSourceManager( pkt.getFactory().one(), toImmutableMap(activeButNotReferenced, Function.identity(), src -> pkt.getFactory().one()), pkt.getFactory().zero()); }