@Test public void testGenerateRules_PostInVrf_NodeDropNoRoute() { Map<String, Map<String, Map<String, BDD>>> ifaceAcceptBdds = ImmutableMap.of( NODE1, ImmutableMap.of(VRF1, ImmutableMap.of(IFACE1, DSTIP1)), NODE2, ImmutableMap.of(VRF1, ImmutableMap.of(IFACE2, DSTIP1))); Map<String, Map<String, BDD>> routableBDDs = ImmutableMap.of(NODE1, ImmutableMap.of(VRF1, DSTIP2), NODE2, ImmutableMap.of(VRF1, DSTIP2)); BDDFibGenerator generator = new BDDFibGenerator( ImmutableMap.of(), ImmutableMap.of(), ImmutableMap.of(), ImmutableMap.of(), ImmutableMap.of(), ifaceAcceptBdds, toVrfAcceptBdds(ifaceAcceptBdds), routableBDDs, ImmutableMap.of(), ImmutableMap.of()); Edge expectedEdge = new Edge(new TestPostInVrf(NODE1, VRF1), new NodeDropNoRoute(NODE1), DSTIP1.nor(DSTIP2)); assertThat( generator .generateRules_PostInVrf_NodeDropNoRoute(NODE1::equals, TestPostInVrf::new) .collect(ImmutableList.toImmutableList()), contains(expectedEdge)); assertThat( generator .generateForwardingEdges( NODE1::equals, TestPostInVrf::new, TestPreOutEdge::new, TestPreOutVrf::new, TestPreOutInterfaceDeliveredToSubnet::new, TestPreOutInterfaceExitsNetwork::new, TestPreOutInterfaceInsufficientInfo::new, TestPreOutInterfaceNeighborUnreachable::new) .collect(ImmutableList.toImmutableList()), hasItem(expectedEdge)); }
@Nonnull @VisibleForTesting Stream<Edge> generateRules_PostInVrf_NodeDropNoRoute( Predicate<String> includedNode, StateExprConstructor2 postInVrf) { return _vrfAcceptBDDs.entrySet().stream() .filter(byNodeEntry -> includedNode.test(byNodeEntry.getKey())) .flatMap( nodeEntry -> nodeEntry.getValue().entrySet().stream() .map( vrfEntry -> { String node = nodeEntry.getKey(); String vrf = vrfEntry.getKey(); BDD acceptBDD = vrfEntry.getValue(); BDD routableBDD = _routableBDDs.get(node).get(vrf); return new Edge( postInVrf.apply(node, vrf), new NodeDropNoRoute(node), acceptBDD.nor(routableBDD)); })); }
BDDFibGenerator { @Nonnull @VisibleForTesting Stream<Edge> generateRules_PostInVrf_NodeDropNoRoute( Predicate<String> includedNode, StateExprConstructor2 postInVrf) { return _vrfAcceptBDDs.entrySet().stream() .filter(byNodeEntry -> includedNode.test(byNodeEntry.getKey())) .flatMap( nodeEntry -> nodeEntry.getValue().entrySet().stream() .map( vrfEntry -> { String node = nodeEntry.getKey(); String vrf = vrfEntry.getKey(); BDD acceptBDD = vrfEntry.getValue(); BDD routableBDD = _routableBDDs.get(node).get(vrf); return new Edge( postInVrf.apply(node, vrf), new NodeDropNoRoute(node), acceptBDD.nor(routableBDD)); })); } }
BDDFibGenerator { @Nonnull @VisibleForTesting Stream<Edge> generateRules_PostInVrf_NodeDropNoRoute( Predicate<String> includedNode, StateExprConstructor2 postInVrf) { return _vrfAcceptBDDs.entrySet().stream() .filter(byNodeEntry -> includedNode.test(byNodeEntry.getKey())) .flatMap( nodeEntry -> nodeEntry.getValue().entrySet().stream() .map( vrfEntry -> { String node = nodeEntry.getKey(); String vrf = vrfEntry.getKey(); BDD acceptBDD = vrfEntry.getValue(); BDD routableBDD = _routableBDDs.get(node).get(vrf); return new Edge( postInVrf.apply(node, vrf), new NodeDropNoRoute(node), acceptBDD.nor(routableBDD)); })); } BDDFibGenerator(
      Map<String, Map<String, Map<org.batfish.datamodel.Edge, BDD>>> arpTrueEdgeBDDs,
      Map<String, Map<String, Map<String, BDD>>> neighborUnreachableBDDs,
      Map<String, Map<String, Map<String, BDD>>> deliveredToSubnetBDDs,
      Map<String, Map<String, Map<String, BDD>>> exitsNetworkBDDs,
      Map<String, Map<String, Map<String, BDD>>> insufficientInfoBDDs,
      Map<String, Map<String, Map<String, BDD>>> ifaceAcceptBDDs,
      Map<String, Map<String, BDD>> vrfAcceptBDDs,
      Map<String, Map<String, BDD>> routableBDDs,
      Map<String, Map<String, Map<String, BDD>>> nextVrfBDDs,
      Map<String, Map<String, BDD>> nullRoutedBDDs); }
BDDFibGenerator { @Nonnull @VisibleForTesting Stream<Edge> generateRules_PostInVrf_NodeDropNoRoute( Predicate<String> includedNode, StateExprConstructor2 postInVrf) { return _vrfAcceptBDDs.entrySet().stream() .filter(byNodeEntry -> includedNode.test(byNodeEntry.getKey())) .flatMap( nodeEntry -> nodeEntry.getValue().entrySet().stream() .map( vrfEntry -> { String node = nodeEntry.getKey(); String vrf = vrfEntry.getKey(); BDD acceptBDD = vrfEntry.getValue(); BDD routableBDD = _routableBDDs.get(node).get(vrf); return new Edge( postInVrf.apply(node, vrf), new NodeDropNoRoute(node), acceptBDD.nor(routableBDD)); })); } BDDFibGenerator(
      Map<String, Map<String, Map<org.batfish.datamodel.Edge, BDD>>> arpTrueEdgeBDDs,
      Map<String, Map<String, Map<String, BDD>>> neighborUnreachableBDDs,
      Map<String, Map<String, Map<String, BDD>>> deliveredToSubnetBDDs,
      Map<String, Map<String, Map<String, BDD>>> exitsNetworkBDDs,
      Map<String, Map<String, Map<String, BDD>>> insufficientInfoBDDs,
      Map<String, Map<String, Map<String, BDD>>> ifaceAcceptBDDs,
      Map<String, Map<String, BDD>> vrfAcceptBDDs,
      Map<String, Map<String, BDD>> routableBDDs,
      Map<String, Map<String, Map<String, BDD>>> nextVrfBDDs,
      Map<String, Map<String, BDD>> nullRoutedBDDs); @Nonnull Stream<Edge> generateForwardingEdges(
      Predicate<String> includedNode,
      StateExprConstructor2 postInVrf,
      StateExprConstructor4 preOutEdge,
      StateExprConstructor2 preOutVrf,
      StateExprConstructor2 preOutInterfaceDeliveredToSubnet,
      StateExprConstructor2 preOutInterfaceExitsNetwork,
      StateExprConstructor2 preOutInterfaceInsufficientInfo,
      StateExprConstructor2 preOutInterfaceNeighborUnreachable); }
BDDFibGenerator { @Nonnull @VisibleForTesting Stream<Edge> generateRules_PostInVrf_NodeDropNoRoute( Predicate<String> includedNode, StateExprConstructor2 postInVrf) { return _vrfAcceptBDDs.entrySet().stream() .filter(byNodeEntry -> includedNode.test(byNodeEntry.getKey())) .flatMap( nodeEntry -> nodeEntry.getValue().entrySet().stream() .map( vrfEntry -> { String node = nodeEntry.getKey(); String vrf = vrfEntry.getKey(); BDD acceptBDD = vrfEntry.getValue(); BDD routableBDD = _routableBDDs.get(node).get(vrf); return new Edge( postInVrf.apply(node, vrf), new NodeDropNoRoute(node), acceptBDD.nor(routableBDD)); })); } BDDFibGenerator(
      Map<String, Map<String, Map<org.batfish.datamodel.Edge, BDD>>> arpTrueEdgeBDDs,
      Map<String, Map<String, Map<String, BDD>>> neighborUnreachableBDDs,
      Map<String, Map<String, Map<String, BDD>>> deliveredToSubnetBDDs,
      Map<String, Map<String, Map<String, BDD>>> exitsNetworkBDDs,
      Map<String, Map<String, Map<String, BDD>>> insufficientInfoBDDs,
      Map<String, Map<String, Map<String, BDD>>> ifaceAcceptBDDs,
      Map<String, Map<String, BDD>> vrfAcceptBDDs,
      Map<String, Map<String, BDD>> routableBDDs,
      Map<String, Map<String, Map<String, BDD>>> nextVrfBDDs,
      Map<String, Map<String, BDD>> nullRoutedBDDs); @Nonnull Stream<Edge> generateForwardingEdges(
      Predicate<String> includedNode,
      StateExprConstructor2 postInVrf,
      StateExprConstructor4 preOutEdge,
      StateExprConstructor2 preOutVrf,
      StateExprConstructor2 preOutInterfaceDeliveredToSubnet,
      StateExprConstructor2 preOutInterfaceExitsNetwork,
      StateExprConstructor2 preOutInterfaceInsufficientInfo,
      StateExprConstructor2 preOutInterfaceNeighborUnreachable);  }