@Override
  public ExtensionSelector mapOxm(OFOxm<?> oxm) {
    VlanId vlanId;

    if (oxm.getMatchField().equals(MatchField.VLAN_VID)) {
      if (oxm.isMasked()) {
        OFVlanVidMatch vid = ((OFOxmVlanVidMasked) oxm).getValue();
        OFVlanVidMatch mask = ((OFOxmVlanVidMasked) oxm).getMask();

        if (vid.equals(OFVlanVidMatch.ofRawVid((short) 0))) {
          vlanId = VlanId.NONE;
        } else if (vid.equals(OFVlanVidMatch.PRESENT) && mask.equals(OFVlanVidMatch.PRESENT)) {
          vlanId = VlanId.ANY;
        } else {
          vlanId = VlanId.vlanId(vid.getVlan());
        }
      } else {
        OFVlanVidMatch vid = ((OFOxmVlanVid) oxm).getValue();

        if (!vid.isPresentBitSet()) {
          vlanId = VlanId.NONE;
        } else {
          vlanId = VlanId.vlanId(vid.getVlan());
        }
      }
      return new OfdpaMatchVlanVid(vlanId);
    }
    throw new UnsupportedOperationException("Unexpected OXM: " + oxm.toString());
  }
Exemplo n.º 2
0
  @Override
  public boolean equals(Object obj) {
    if (this == obj) return true;
    if (obj == null) return false;
    if (getClass() != obj.getClass()) return false;
    OFOxmVlanVidVer14 other = (OFOxmVlanVidVer14) obj;

    if (value == null) {
      if (other.value != null) return false;
    } else if (!value.equals(other.value)) return false;
    return true;
  }