@Test public void testToAclLineMatchExpr() { SessionMatchExpr matcher = new SessionMatchExpr(IpProtocol.ICMP, Ip.parse("1.1.1.2"), Ip.parse("1.1.2.2"), null, null); MatchHeaderSpace aclExpr = (MatchHeaderSpace) matcher.toAclLineMatchExpr(); HeaderSpace hs = aclExpr.getHeaderspace(); HeaderSpace.Builder expectedHeaderSpace = HeaderSpace.builder() .setSrcIps(Ip.parse("1.1.1.2").toIpSpace()) .setDstIps(Ip.parse("1.1.2.2").toIpSpace()) .setIpProtocols(ImmutableSet.of(IpProtocol.ICMP)); assertThat(hs, equalTo(expectedHeaderSpace.build())); matcher = new SessionMatchExpr(IpProtocol.ICMP, Ip.parse("1.1.1.2"), Ip.parse("1.1.2.2"), 4000, 5000); aclExpr = (MatchHeaderSpace) matcher.toAclLineMatchExpr(); hs = aclExpr.getHeaderspace(); expectedHeaderSpace = expectedHeaderSpace .setSrcPorts(SubRange.singleton(4000)) .setDstPorts(SubRange.singleton(5000)); assertThat(hs, equalTo(expectedHeaderSpace.build())); }
public AclLineMatchExpr toAclLineMatchExpr() { HeaderSpace.Builder hb = HeaderSpace.builder() .setSrcIps(_srcIp.toIpSpace()) .setDstIps(_dstIp.toIpSpace()) .setIpProtocols(ImmutableList.of(_ipProtocol)); if (_srcPort != null) { hb.setSrcPorts(ImmutableList.of(SubRange.singleton(_srcPort))) .setDstPorts(ImmutableList.of(SubRange.singleton(_dstPort))); } return new MatchHeaderSpace(hb.build()); }
SessionMatchExpr { public AclLineMatchExpr toAclLineMatchExpr() { HeaderSpace.Builder hb = HeaderSpace.builder() .setSrcIps(_srcIp.toIpSpace()) .setDstIps(_dstIp.toIpSpace()) .setIpProtocols(ImmutableList.of(_ipProtocol)); if (_srcPort != null) { hb.setSrcPorts(ImmutableList.of(SubRange.singleton(_srcPort))) .setDstPorts(ImmutableList.of(SubRange.singleton(_dstPort))); } return new MatchHeaderSpace(hb.build()); } }
SessionMatchExpr { public AclLineMatchExpr toAclLineMatchExpr() { HeaderSpace.Builder hb = HeaderSpace.builder() .setSrcIps(_srcIp.toIpSpace()) .setDstIps(_dstIp.toIpSpace()) .setIpProtocols(ImmutableList.of(_ipProtocol)); if (_srcPort != null) { hb.setSrcPorts(ImmutableList.of(SubRange.singleton(_srcPort))) .setDstPorts(ImmutableList.of(SubRange.singleton(_dstPort))); } return new MatchHeaderSpace(hb.build()); } SessionMatchExpr(
      IpProtocol ipProtocol,
      Ip srcIp,
      Ip dstIp,
      @Nullable Integer srcPort,
      @Nullable Integer dstPort); }
SessionMatchExpr { public AclLineMatchExpr toAclLineMatchExpr() { HeaderSpace.Builder hb = HeaderSpace.builder() .setSrcIps(_srcIp.toIpSpace()) .setDstIps(_dstIp.toIpSpace()) .setIpProtocols(ImmutableList.of(_ipProtocol)); if (_srcPort != null) { hb.setSrcPorts(ImmutableList.of(SubRange.singleton(_srcPort))) .setDstPorts(ImmutableList.of(SubRange.singleton(_dstPort))); } return new MatchHeaderSpace(hb.build()); } SessionMatchExpr(
      IpProtocol ipProtocol,
      Ip srcIp,
      Ip dstIp,
      @Nullable Integer srcPort,
      @Nullable Integer dstPort); @JsonProperty(PROP_IP_PROTOCOL) IpProtocol getIpProtocol(); @JsonProperty(PROP_SRC_IP) Ip getSrcIp(); @JsonProperty(PROP_DST_IP) Ip getDstIp(); @JsonProperty(PROP_SRC_PORT) @Nullable Integer getSrcPort(); @JsonProperty(PROP_DST_PORT) @Nullable Integer getDstPort(); AclLineMatchExpr toAclLineMatchExpr(); @Override boolean equals(@Nullable Object o); @Override int hashCode(); }
SessionMatchExpr { public AclLineMatchExpr toAclLineMatchExpr() { HeaderSpace.Builder hb = HeaderSpace.builder() .setSrcIps(_srcIp.toIpSpace()) .setDstIps(_dstIp.toIpSpace()) .setIpProtocols(ImmutableList.of(_ipProtocol)); if (_srcPort != null) { hb.setSrcPorts(ImmutableList.of(SubRange.singleton(_srcPort))) .setDstPorts(ImmutableList.of(SubRange.singleton(_dstPort))); } return new MatchHeaderSpace(hb.build()); } SessionMatchExpr(
      IpProtocol ipProtocol,
      Ip srcIp,
      Ip dstIp,
      @Nullable Integer srcPort,
      @Nullable Integer dstPort); @JsonProperty(PROP_IP_PROTOCOL) IpProtocol getIpProtocol(); @JsonProperty(PROP_SRC_IP) Ip getSrcIp(); @JsonProperty(PROP_DST_IP) Ip getDstIp(); @JsonProperty(PROP_SRC_PORT) @Nullable Integer getSrcPort(); @JsonProperty(PROP_DST_PORT) @Nullable Integer getDstPort(); AclLineMatchExpr toAclLineMatchExpr(); @Override boolean equals(@Nullable Object o); @Override int hashCode();  }