コード例 #1
0
  @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());
  }
コード例 #2
0
 @Override
 public <F extends OFValueType<F>> Masked<F> getMasked(MatchField<F> field)
     throws UnsupportedOperationException {
   OFOxm<F> value = getOxm(field);
   if (value == null || !value.isMasked()) return null;
   // TODO: If changing OXMs to extend Masked, then use it here
   return Masked.of(value.getValue(), value.getMask());
 }
コード例 #3
0
  @Override
  public boolean isPartiallyMasked(MatchField<?> field) {
    if (!supports(field))
      throw new UnsupportedOperationException(
          "OFMatchV3Ver14 does not support matching on field " + field.getName());

    OFOxm<?> oxm = this.oxmList.get(field);

    return oxm != null && oxm.isMasked();
  }
コード例 #4
0
 @Override
 public boolean isPartiallyMasked(MatchField<?> field) {
   OFOxm<?> value = getOxm(field);
   return (value != null && value.isMasked());
 }
コード例 #5
0
 @Override
 public boolean isExact(MatchField<?> field) {
   OFOxm<?> value = getOxm(field);
   return (value != null && !value.isMasked());
 }