コード例 #1
0
  @Override
  public int hashCode() {
    final int prime = 31;
    int result = 1;

    result = prime * result + ((value == null) ? 0 : value.hashCode());
    return result;
  }
コード例 #2
0
  @Override
  public boolean equals(Object obj) {
    if (this == obj) return true;
    if (obj == null) return false;
    if (getClass() != obj.getClass()) return false;
    OFOxmIpv6FlabelVer14 other = (OFOxmIpv6FlabelVer14) obj;

    if (value == null) {
      if (other.value != null) return false;
    } else if (!value.equals(other.value)) return false;
    return true;
  }
コード例 #3
0
    @Override
    public OFOxmIpv6Flabel readFrom(ChannelBuffer bb) throws OFParseError {
      // fixed value property typeLen == 0x80003804L
      int typeLen = bb.readInt();
      if (typeLen != (int) 0x80003804)
        throw new OFParseError("Wrong typeLen: Expected=0x80003804L(0x80003804L), got=" + typeLen);
      IPv6FlowLabel value = IPv6FlowLabel.read4Bytes(bb);

      OFOxmIpv6FlabelVer14 oxmIpv6FlabelVer14 = new OFOxmIpv6FlabelVer14(value);
      if (logger.isTraceEnabled()) logger.trace("readFrom - read={}", oxmIpv6FlabelVer14);
      return oxmIpv6FlabelVer14;
    }
コード例 #4
0
  private OFAction buildL3Modification(Instruction i) {
    L3ModificationInstruction l3m = (L3ModificationInstruction) i;
    ModIPInstruction ip;
    Ip4Address ip4;
    Ip6Address ip6;
    OFOxm<?> oxm = null;
    switch (l3m.subtype()) {
      case IPV4_SRC:
        ip = (ModIPInstruction) i;
        ip4 = ip.ip().getIp4Address();
        oxm = factory().oxms().ipv4Src(IPv4Address.of(ip4.toInt()));
        break;
      case IPV4_DST:
        ip = (ModIPInstruction) i;
        ip4 = ip.ip().getIp4Address();
        oxm = factory().oxms().ipv4Dst(IPv4Address.of(ip4.toInt()));
        break;
      case IPV6_SRC:
        ip = (ModIPInstruction) i;
        ip6 = ip.ip().getIp6Address();
        oxm = factory().oxms().ipv6Src(IPv6Address.of(ip6.toOctets()));
        break;
      case IPV6_DST:
        ip = (ModIPInstruction) i;
        ip6 = ip.ip().getIp6Address();
        oxm = factory().oxms().ipv6Dst(IPv6Address.of(ip6.toOctets()));
        break;
      case IPV6_FLABEL:
        ModIPv6FlowLabelInstruction flowLabelInstruction = (ModIPv6FlowLabelInstruction) i;
        int flowLabel = flowLabelInstruction.flowLabel();
        oxm = factory().oxms().ipv6Flabel(IPv6FlowLabel.of(flowLabel));
        break;
      case DEC_TTL:
        return factory().actions().decNwTtl();
      case TTL_IN:
        return factory().actions().copyTtlIn();
      case TTL_OUT:
        return factory().actions().copyTtlOut();
      default:
        log.warn("Unimplemented action type {}.", l3m.subtype());
        break;
    }

    if (oxm != null) {
      return factory().actions().buildSetField().setField(oxm).build();
    }
    return null;
  }