@Test public void testVisitAclAclLine() { Ip permitIp = Ip.parse("1.1.1.1"); Ip denyIp = Ip.parse("2.2.2.2"); IpAccessList acl = IpAccessList.builder() .setName("acl") .setLines(ImmutableList.of(accepting(matchDst(permitIp)), rejecting(matchDst(denyIp)))) .build(); AclAclLine matchAclLine = new AclAclLine("line name", acl.getName()); Flow flowToPermitIp = Flow.builder().setDstIp(permitIp).setIngressNode("c").build(); AclLineEvaluator evaluator = new AclLineEvaluator( flowToPermitIp, "srcIface", ImmutableMap.of(acl.getName(), acl), ImmutableMap.of()); assertEquals(evaluator.visit(matchAclLine), LineAction.PERMIT); Flow flowToDenyIp = Flow.builder().setDstIp(denyIp).setIngressNode("c").build(); evaluator = new AclLineEvaluator( flowToDenyIp, "srcIface", ImmutableMap.of(acl.getName(), acl), ImmutableMap.of()); assertEquals(evaluator.visit(matchAclLine), LineAction.DENY); Flow flowToOtherIp = Flow.builder().setDstIp(Ip.parse("3.3.3.3")).setIngressNode("c").build(); evaluator = new AclLineEvaluator( flowToOtherIp, "srcIface", ImmutableMap.of(acl.getName(), acl), ImmutableMap.of()); assertNull(evaluator.visit(matchAclLine)); }
@Override public LineAction visitAclAclLine(AclAclLine aclAclLine) { IpAccessList referencedAcl = checkNotNull( _availableAcls.get(aclAclLine.getAclName()), "Reference to undefined IpAccessList %s", aclAclLine.getAclName()); FilterResult referencedAclResult = referencedAcl.filter(_flow, _srcInterface, _availableAcls, _namedIpSpaces); return referencedAclResult.getMatchLine() == null ? null : referencedAclResult.getAction(); }
AclLineEvaluator extends Evaluator implements GenericAclLineVisitor<LineAction> { @Override public LineAction visitAclAclLine(AclAclLine aclAclLine) { IpAccessList referencedAcl = checkNotNull( _availableAcls.get(aclAclLine.getAclName()), "Reference to undefined IpAccessList %s", aclAclLine.getAclName()); FilterResult referencedAclResult = referencedAcl.filter(_flow, _srcInterface, _availableAcls, _namedIpSpaces); return referencedAclResult.getMatchLine() == null ? null : referencedAclResult.getAction(); } }
AclLineEvaluator extends Evaluator implements GenericAclLineVisitor<LineAction> { @Override public LineAction visitAclAclLine(AclAclLine aclAclLine) { IpAccessList referencedAcl = checkNotNull( _availableAcls.get(aclAclLine.getAclName()), "Reference to undefined IpAccessList %s", aclAclLine.getAclName()); FilterResult referencedAclResult = referencedAcl.filter(_flow, _srcInterface, _availableAcls, _namedIpSpaces); return referencedAclResult.getMatchLine() == null ? null : referencedAclResult.getAction(); } AclLineEvaluator(
      Flow flow,
      String srcInterface,
      Map<String, IpAccessList> availableAcls,
      Map<String, IpSpace> namedIpSpaces); }
AclLineEvaluator extends Evaluator implements GenericAclLineVisitor<LineAction> { @Override public LineAction visitAclAclLine(AclAclLine aclAclLine) { IpAccessList referencedAcl = checkNotNull( _availableAcls.get(aclAclLine.getAclName()), "Reference to undefined IpAccessList %s", aclAclLine.getAclName()); FilterResult referencedAclResult = referencedAcl.filter(_flow, _srcInterface, _availableAcls, _namedIpSpaces); return referencedAclResult.getMatchLine() == null ? null : referencedAclResult.getAction(); } AclLineEvaluator(
      Flow flow,
      String srcInterface,
      Map<String, IpAccessList> availableAcls,
      Map<String, IpSpace> namedIpSpaces); @Override @Nullable LineAction visit(AclLine line); @Override LineAction visitAclAclLine(AclAclLine aclAclLine); @Override LineAction visitExprAclLine(ExprAclLine exprAclLine); }
AclLineEvaluator extends Evaluator implements GenericAclLineVisitor<LineAction> { @Override public LineAction visitAclAclLine(AclAclLine aclAclLine) { IpAccessList referencedAcl = checkNotNull( _availableAcls.get(aclAclLine.getAclName()), "Reference to undefined IpAccessList %s", aclAclLine.getAclName()); FilterResult referencedAclResult = referencedAcl.filter(_flow, _srcInterface, _availableAcls, _namedIpSpaces); return referencedAclResult.getMatchLine() == null ? null : referencedAclResult.getAction(); } AclLineEvaluator(
      Flow flow,
      String srcInterface,
      Map<String, IpAccessList> availableAcls,
      Map<String, IpSpace> namedIpSpaces); @Override @Nullable LineAction visit(AclLine line); @Override LineAction visitAclAclLine(AclAclLine aclAclLine); @Override LineAction visitExprAclLine(ExprAclLine exprAclLine);  }