@Test public void testToAclLineMatchExpr_smb() { JunosApplication junosApp = JunosApplication.JUNOS_SMB; FwFromJunosApplication from = new FwFromJunosApplication(junosApp); assertEquals( from.toAclLineMatchExpr(jc, null), new OrMatchExpr( ImmutableList.of( new MatchHeaderSpace( HeaderSpace.builder() .setIpProtocols(ImmutableSet.of(IpProtocol.TCP)) .setDstPorts( ImmutableSet.of(SubRange.singleton(NamedPort.MICROSOFT_DS.number()))) .build()), new MatchHeaderSpace( HeaderSpace.builder() .setIpProtocols(ImmutableSet.of(IpProtocol.TCP)) .setDstPorts( ImmutableSet.of(SubRange.singleton(NamedPort.NETBIOS_SSN.number()))) .build())), ApplicationSetMember.getTraceElement( "host", JuniperStructureType.APPLICATION, "junos-smb"))); }
@Override public AclLineMatchExpr toAclLineMatchExpr(JuniperConfiguration jc, Warnings w) { if (!_junosApplication.hasDefinition()) { w.redFlag("Reference to undefined application: \"" + _junosApplication.name() + "\""); return new MatchHeaderSpace( HeaderSpace.builder().setSrcIps(EmptyIpSpace.INSTANCE).build(), ApplicationSetMember.getTraceElement( jc.getFilename(), JuniperStructureType.APPLICATION, _junosApplication.name())); } return _junosApplication.toAclLineMatchExpr(jc, w); }
FwFromJunosApplication implements FwFromApplicationSetMember { @Override public AclLineMatchExpr toAclLineMatchExpr(JuniperConfiguration jc, Warnings w) { if (!_junosApplication.hasDefinition()) { w.redFlag("Reference to undefined application: \"" + _junosApplication.name() + "\""); return new MatchHeaderSpace( HeaderSpace.builder().setSrcIps(EmptyIpSpace.INSTANCE).build(), ApplicationSetMember.getTraceElement( jc.getFilename(), JuniperStructureType.APPLICATION, _junosApplication.name())); } return _junosApplication.toAclLineMatchExpr(jc, w); } }
FwFromJunosApplication implements FwFromApplicationSetMember { @Override public AclLineMatchExpr toAclLineMatchExpr(JuniperConfiguration jc, Warnings w) { if (!_junosApplication.hasDefinition()) { w.redFlag("Reference to undefined application: \"" + _junosApplication.name() + "\""); return new MatchHeaderSpace( HeaderSpace.builder().setSrcIps(EmptyIpSpace.INSTANCE).build(), ApplicationSetMember.getTraceElement( jc.getFilename(), JuniperStructureType.APPLICATION, _junosApplication.name())); } return _junosApplication.toAclLineMatchExpr(jc, w); } FwFromJunosApplication(JunosApplication junosApplication); }
FwFromJunosApplication implements FwFromApplicationSetMember { @Override public AclLineMatchExpr toAclLineMatchExpr(JuniperConfiguration jc, Warnings w) { if (!_junosApplication.hasDefinition()) { w.redFlag("Reference to undefined application: \"" + _junosApplication.name() + "\""); return new MatchHeaderSpace( HeaderSpace.builder().setSrcIps(EmptyIpSpace.INSTANCE).build(), ApplicationSetMember.getTraceElement( jc.getFilename(), JuniperStructureType.APPLICATION, _junosApplication.name())); } return _junosApplication.toAclLineMatchExpr(jc, w); } FwFromJunosApplication(JunosApplication junosApplication); @Override void applyTo(
      JuniperConfiguration jc,
      HeaderSpace.Builder srcHeaderSpaceBuilder,
      LineAction action,
      List<? super ExprAclLine> lines,
      Warnings w); @Override AclLineMatchExpr toAclLineMatchExpr(JuniperConfiguration jc, Warnings w); }
FwFromJunosApplication implements FwFromApplicationSetMember { @Override public AclLineMatchExpr toAclLineMatchExpr(JuniperConfiguration jc, Warnings w) { if (!_junosApplication.hasDefinition()) { w.redFlag("Reference to undefined application: \"" + _junosApplication.name() + "\""); return new MatchHeaderSpace( HeaderSpace.builder().setSrcIps(EmptyIpSpace.INSTANCE).build(), ApplicationSetMember.getTraceElement( jc.getFilename(), JuniperStructureType.APPLICATION, _junosApplication.name())); } return _junosApplication.toAclLineMatchExpr(jc, w); } FwFromJunosApplication(JunosApplication junosApplication); @Override void applyTo(
      JuniperConfiguration jc,
      HeaderSpace.Builder srcHeaderSpaceBuilder,
      LineAction action,
      List<? super ExprAclLine> lines,
      Warnings w); @Override AclLineMatchExpr toAclLineMatchExpr(JuniperConfiguration jc, Warnings w);  }