@Test public void testOutgoingTransformationRange() { Interface iface = _ib.build(); String iName = iface.getName(); Map<String, BDDSourceManager> srcManagers = BDDSourceManager.forNetwork(_bddPacket, _configs, true); BDD fwdPreOutEdge1Bdd = _headerSpaceToBDD.getDstIpSpaceToBdd().toBDD(Ip.parse("1.1.1.1")); BDD fwdPreOutEdge2Bdd = _headerSpaceToBDD.getDstIpSpaceToBdd().toBDD(Ip.parse("1.1.1.2")); BDD reach = _headerSpaceToBDD .getSrcIpSpaceToBdd() .toBDD(Ip.parse("1.1.1.1")) .or(_headerSpaceToBDD.getSrcIpSpaceToBdd().toBDD(Ip.parse("1.1.1.2"))); Map<StateExpr, BDD> forwardReach = ImmutableMap.of( new PreOutEdge(HOSTNAME, iface.getName(), "1", "1"), fwdPreOutEdge1Bdd, new PreOutEdge(HOSTNAME, iface.getName(), "2", "2"), fwdPreOutEdge2Bdd); { BDDReverseTransformationRangesImpl ranges = new BDDReverseTransformationRangesImpl( _configs, forwardReach, _bddPacket, null, srcManagers, _lastHopManager); assertThat( ranges.reverseOutgoingTransformationRange(HOSTNAME, iName, null, null), equalTo(reach)); } { String aclName = "ACL"; iface.setPreTransformationOutgoingFilter(IpAccessList.builder().setName(aclName).build()); BDD fwdAclBdd = _headerSpaceToBDD.toBDD( HeaderSpace.builder().setDstPorts(ImmutableList.of(new SubRange(100, 200))).build()); BDD bwdAclBdd = _headerSpaceToBDD.toBDD( HeaderSpace.builder().setSrcPorts(ImmutableList.of(new SubRange(100, 200))).build()); BDDReverseTransformationRangesImpl ranges = new BDDReverseTransformationRangesImpl( _configs, forwardReach, _bddPacket, ImmutableMap.of(HOSTNAME, ImmutableMap.of(aclName, () -> fwdAclBdd)), srcManagers, _lastHopManager); assertThat( ranges.reverseOutgoingTransformationRange(HOSTNAME, iName, null, null), equalTo(reach.and(bwdAclBdd))); } }
@Override public BDD reverseOutgoingTransformationRange( String node, String iface, @Nullable String inIface, @Nullable NodeInterfacePair lastHop) { return _cache.computeIfAbsent( new Key(node, iface, OUTGOING, inIface, lastHop), this::computeReverseTransformationRange); }
BDDReverseTransformationRangesImpl implements BDDReverseTransformationRanges { @Override public BDD reverseOutgoingTransformationRange( String node, String iface, @Nullable String inIface, @Nullable NodeInterfacePair lastHop) { return _cache.computeIfAbsent( new Key(node, iface, OUTGOING, inIface, lastHop), this::computeReverseTransformationRange); } }
BDDReverseTransformationRangesImpl implements BDDReverseTransformationRanges { @Override public BDD reverseOutgoingTransformationRange( String node, String iface, @Nullable String inIface, @Nullable NodeInterfacePair lastHop) { return _cache.computeIfAbsent( new Key(node, iface, OUTGOING, inIface, lastHop), this::computeReverseTransformationRange); } BDDReverseTransformationRangesImpl(
      Map<String, Configuration> configs,
      Map<StateExpr, BDD> forwardReachableSets,
      BDDPacket bddPacket,
      @Nullable Map<String, Map<String, Supplier<BDD>>> forwardFlowFilterBdds,
      Map<String, BDDSourceManager> srcManagers,
      LastHopOutgoingInterfaceManager lastHopManager); }
BDDReverseTransformationRangesImpl implements BDDReverseTransformationRanges { @Override public BDD reverseOutgoingTransformationRange( String node, String iface, @Nullable String inIface, @Nullable NodeInterfacePair lastHop) { return _cache.computeIfAbsent( new Key(node, iface, OUTGOING, inIface, lastHop), this::computeReverseTransformationRange); } BDDReverseTransformationRangesImpl(
      Map<String, Configuration> configs,
      Map<StateExpr, BDD> forwardReachableSets,
      BDDPacket bddPacket,
      @Nullable Map<String, Map<String, Supplier<BDD>>> forwardFlowFilterBdds,
      Map<String, BDDSourceManager> srcManagers,
      LastHopOutgoingInterfaceManager lastHopManager); @Override BDD reverseIncomingTransformationRange(
      String node, String iface, @Nullable String inIface, @Nullable NodeInterfacePair lastHop); @Override BDD reverseOutgoingTransformationRange(
      String node, String iface, @Nullable String inIface, @Nullable NodeInterfacePair lastHop); }
BDDReverseTransformationRangesImpl implements BDDReverseTransformationRanges { @Override public BDD reverseOutgoingTransformationRange( String node, String iface, @Nullable String inIface, @Nullable NodeInterfacePair lastHop) { return _cache.computeIfAbsent( new Key(node, iface, OUTGOING, inIface, lastHop), this::computeReverseTransformationRange); } BDDReverseTransformationRangesImpl(
      Map<String, Configuration> configs,
      Map<StateExpr, BDD> forwardReachableSets,
      BDDPacket bddPacket,
      @Nullable Map<String, Map<String, Supplier<BDD>>> forwardFlowFilterBdds,
      Map<String, BDDSourceManager> srcManagers,
      LastHopOutgoingInterfaceManager lastHopManager); @Override BDD reverseIncomingTransformationRange(
      String node, String iface, @Nullable String inIface, @Nullable NodeInterfacePair lastHop); @Override BDD reverseOutgoingTransformationRange(
      String node, String iface, @Nullable String inIface, @Nullable NodeInterfacePair lastHop);  }