@Test public void testConjunction() { FibLookup fl = new FibLookup(new LiteralVrfName("vrf")); { FlowResult result = FlowEvaluator.evaluate( _flow, "Eth0", "otherVrf", singletonPolicy( new If( Conjunction.of(org.batfish.datamodel.packet_policy.TrueExpr.instance()), ImmutableList.of(new Return(fl)))), ImmutableMap.of(), ImmutableMap.of(), ImmutableMap.of()); assertThat(result.getAction(), equalTo(fl)); } { FlowResult result = FlowEvaluator.evaluate( _flow, "Eth0", "otherVrf", singletonPolicy( new If( Conjunction.of( org.batfish.datamodel.packet_policy.TrueExpr.instance(), org.batfish.datamodel.packet_policy.FalseExpr.instance()), ImmutableList.of(new Return(fl)))), ImmutableMap.of(), ImmutableMap.of(), ImmutableMap.of()); assertThat(result.getAction(), equalTo(_defaultAction.getAction())); } }
private FlowResult evaluate(PacketPolicy policy) { Action action = policy.getStatements().stream() .map(_stmtEvaluator::visit) .filter(Objects::nonNull) .findFirst() .orElse(policy.getDefaultAction().getAction()); return new FlowResult(getTransformedFlow(), action); }
FlowEvaluator { private FlowResult evaluate(PacketPolicy policy) { Action action = policy.getStatements().stream() .map(_stmtEvaluator::visit) .filter(Objects::nonNull) .findFirst() .orElse(policy.getDefaultAction().getAction()); return new FlowResult(getTransformedFlow(), action); } }
FlowEvaluator { private FlowResult evaluate(PacketPolicy policy) { Action action = policy.getStatements().stream() .map(_stmtEvaluator::visit) .filter(Objects::nonNull) .findFirst() .orElse(policy.getDefaultAction().getAction()); return new FlowResult(getTransformedFlow(), action); } private  FlowEvaluator(
      Flow originalFlow,
      String srcInterface,
      String srcInterfaceVrf,
      Map<String, IpAccessList> availableAcls,
      Map<String, IpSpace> namedIpSpaces,
      Map<String, Fib> fibs); }
FlowEvaluator { private FlowResult evaluate(PacketPolicy policy) { Action action = policy.getStatements().stream() .map(_stmtEvaluator::visit) .filter(Objects::nonNull) .findFirst() .orElse(policy.getDefaultAction().getAction()); return new FlowResult(getTransformedFlow(), action); } private  FlowEvaluator(
      Flow originalFlow,
      String srcInterface,
      String srcInterfaceVrf,
      Map<String, IpAccessList> availableAcls,
      Map<String, IpSpace> namedIpSpaces,
      Map<String, Fib> fibs); static FlowResult evaluate(
      Flow f,
      String srcInterface,
      String srcInterfaceVrf,
      PacketPolicy policy,
      Map<String, IpAccessList> availableAcls,
      Map<String, IpSpace> namedIpSpaces,
      Map<String, Fib> fibs); }
FlowEvaluator { private FlowResult evaluate(PacketPolicy policy) { Action action = policy.getStatements().stream() .map(_stmtEvaluator::visit) .filter(Objects::nonNull) .findFirst() .orElse(policy.getDefaultAction().getAction()); return new FlowResult(getTransformedFlow(), action); } private  FlowEvaluator(
      Flow originalFlow,
      String srcInterface,
      String srcInterfaceVrf,
      Map<String, IpAccessList> availableAcls,
      Map<String, IpSpace> namedIpSpaces,
      Map<String, Fib> fibs); static FlowResult evaluate(
      Flow f,
      String srcInterface,
      String srcInterfaceVrf,
      PacketPolicy policy,
      Map<String, IpAccessList> availableAcls,
      Map<String, IpSpace> namedIpSpaces,
      Map<String, Fib> fibs);  }