Adding eth masking in match

Change-Id: I95e0ee66b1c6c139de7672f9bc04871fd0ead6d7
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/EthCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/EthCriterion.java
index f4664c9..f7c6f48 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/EthCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/EthCriterion.java
@@ -24,18 +24,32 @@
  */
 public final class EthCriterion implements Criterion {
     private final MacAddress mac;
+    private final MacAddress mask;
     private final Type type;
 
     /**
      * Constructor.
      *
      * @param mac the source or destination MAC address to match
+     * @param mask the mask for the address
+     * @param type the match type. Should be either Type.ETH_DST_MASKED or
+     *             Type.ETH_SRC_MASKED
+     */
+    EthCriterion(MacAddress mac, MacAddress mask, Type type) {
+        this.mac = mac;
+        this.mask = mask;
+        this.type = type;
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param mac the source or destination MAC address to match
      * @param type the match type. Should be either Type.ETH_DST or
-     * Type.ETH_SRC
+     *             Type.ETH_SRC
      */
     EthCriterion(MacAddress mac, Type type) {
-        this.mac = mac;
-        this.type = type;
+        this(mac, null, type);
     }
 
     @Override
@@ -52,14 +66,23 @@
         return this.mac;
     }
 
+    /**
+     * Gets the mask for the MAC address to match.
+     *
+     * @return the MAC address to match
+     */
+    public MacAddress mask() {
+        return this.mask;
+    }
+
     @Override
     public String toString() {
-        return type().toString() + SEPARATOR + mac;
+        return type().toString() + SEPARATOR + mac + "/" + mask;
     }
 
     @Override
     public int hashCode() {
-        return Objects.hash(type.ordinal(), mac);
+        return Objects.hash(type.ordinal(), mac, mask);
     }
 
     @Override
@@ -70,6 +93,7 @@
         if (obj instanceof EthCriterion) {
             EthCriterion that = (EthCriterion) obj;
             return Objects.equals(mac, that.mac) &&
+                    Objects.equals(mask, that.mask) &&
                     Objects.equals(type, that.type);
         }
         return false;