Fix for flow equality bug which can cause:

 * multiple flows with the same match to be simultaneously present in the flow
   store, and
 * similar but different rule in switch and store, resulting in flows stuck in
   PENDING_ADD state.

Fixes ONOS-2426.

Ported from onos-1.2 branch.

Change-Id: I4b4e444c3a6dba7e4d3278e9469069e2dbdb9b67
diff --git a/core/api/src/main/java/org/onosproject/net/flow/DefaultFlowRule.java b/core/api/src/main/java/org/onosproject/net/flow/DefaultFlowRule.java
index 293f12f..44a4d36 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/DefaultFlowRule.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/DefaultFlowRule.java
@@ -249,6 +249,13 @@
     }
 
     @Override
+    public boolean exactMatch(FlowRule rule) {
+        return this.equals(rule) &&
+                Objects.equals(this.id, rule.id()) &&
+                Objects.equals(this.treatment, rule.treatment());
+    }
+
+    @Override
     public String toString() {
         return toStringHelper(this)
                 .add("id", Long.toHexString(id.value()))
@@ -370,7 +377,7 @@
         }
 
         private int hash() {
-            return Objects.hash(deviceId, selector, treatment, tableId);
+            return Objects.hash(deviceId, priority, selector, tableId);
         }
 
     }