@Test public void testTermToAclLineMatchExpr() { Term term = new Term("T"); term.setHeaderSpace( HeaderSpace.builder() .setIpProtocols(IpProtocol.TCP) .setSrcIps(IpWildcard.parse("1.1.1.0/24").toIpSpace()) .build()); assertEquals( term.toAclLineMatchExpr(), new MatchHeaderSpace( HeaderSpace.builder().setIpProtocols(IpProtocol.TCP).build(), TraceElement.of("Matched term T"))); }
@Override public AclLineMatchExpr toAclLineMatchExpr(JuniperConfiguration jc, Warnings w) { if (_terms.isEmpty()) { return new MatchHeaderSpace( _mainTerm.toHeaderSpace(), ApplicationSetMember.getTraceElement( jc.getFilename(), JuniperStructureType.APPLICATION, _name)); } return new OrMatchExpr( _terms.values().stream() .map(Term::toAclLineMatchExpr) .collect(ImmutableList.toImmutableList()), ApplicationSetMember.getTraceElement( jc.getFilename(), JuniperStructureType.APPLICATION, _name)); }
BaseApplication implements Application, Serializable { @Override public AclLineMatchExpr toAclLineMatchExpr(JuniperConfiguration jc, Warnings w) { if (_terms.isEmpty()) { return new MatchHeaderSpace( _mainTerm.toHeaderSpace(), ApplicationSetMember.getTraceElement( jc.getFilename(), JuniperStructureType.APPLICATION, _name)); } return new OrMatchExpr( _terms.values().stream() .map(Term::toAclLineMatchExpr) .collect(ImmutableList.toImmutableList()), ApplicationSetMember.getTraceElement( jc.getFilename(), JuniperStructureType.APPLICATION, _name)); } }
BaseApplication implements Application, Serializable { @Override public AclLineMatchExpr toAclLineMatchExpr(JuniperConfiguration jc, Warnings w) { if (_terms.isEmpty()) { return new MatchHeaderSpace( _mainTerm.toHeaderSpace(), ApplicationSetMember.getTraceElement( jc.getFilename(), JuniperStructureType.APPLICATION, _name)); } return new OrMatchExpr( _terms.values().stream() .map(Term::toAclLineMatchExpr) .collect(ImmutableList.toImmutableList()), ApplicationSetMember.getTraceElement( jc.getFilename(), JuniperStructureType.APPLICATION, _name)); } BaseApplication(String name); }
BaseApplication implements Application, Serializable { @Override public AclLineMatchExpr toAclLineMatchExpr(JuniperConfiguration jc, Warnings w) { if (_terms.isEmpty()) { return new MatchHeaderSpace( _mainTerm.toHeaderSpace(), ApplicationSetMember.getTraceElement( jc.getFilename(), JuniperStructureType.APPLICATION, _name)); } return new OrMatchExpr( _terms.values().stream() .map(Term::toAclLineMatchExpr) .collect(ImmutableList.toImmutableList()), ApplicationSetMember.getTraceElement( jc.getFilename(), JuniperStructureType.APPLICATION, _name)); } BaseApplication(String name); @Override void applyTo(
      JuniperConfiguration jc,
      HeaderSpace.Builder srcHeaderSpaceBuilder,
      LineAction action,
      List<? super ExprAclLine> lines,
      Warnings w); @Override boolean getIpv6(); Term getMainTerm(); Map<String, Term> getTerms(); void setIpv6(boolean ipv6); @Override AclLineMatchExpr toAclLineMatchExpr(JuniperConfiguration jc, Warnings w); }
BaseApplication implements Application, Serializable { @Override public AclLineMatchExpr toAclLineMatchExpr(JuniperConfiguration jc, Warnings w) { if (_terms.isEmpty()) { return new MatchHeaderSpace( _mainTerm.toHeaderSpace(), ApplicationSetMember.getTraceElement( jc.getFilename(), JuniperStructureType.APPLICATION, _name)); } return new OrMatchExpr( _terms.values().stream() .map(Term::toAclLineMatchExpr) .collect(ImmutableList.toImmutableList()), ApplicationSetMember.getTraceElement( jc.getFilename(), JuniperStructureType.APPLICATION, _name)); } BaseApplication(String name); @Override void applyTo(
      JuniperConfiguration jc,
      HeaderSpace.Builder srcHeaderSpaceBuilder,
      LineAction action,
      List<? super ExprAclLine> lines,
      Warnings w); @Override boolean getIpv6(); Term getMainTerm(); Map<String, Term> getTerms(); void setIpv6(boolean ipv6); @Override AclLineMatchExpr toAclLineMatchExpr(JuniperConfiguration jc, Warnings w);  }