ONOS-1746 Fixed hashCode implementation to be immune from non-deterministic enum hashCode.

Change-Id: I96d0a7850ee28d62b1152c4fee4f4ce7648c4931
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 b73e58b..6020974 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
@@ -62,7 +62,7 @@
 
     @Override
     public int hashCode() {
-        return Objects.hash(type, mac);
+        return Objects.hash(type.ordinal(), mac);
     }
 
     @Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/EthTypeCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/EthTypeCriterion.java
index 22ab445..a42d8d3 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/EthTypeCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/EthTypeCriterion.java
@@ -59,7 +59,7 @@
 
     @Override
     public int hashCode() {
-        return Objects.hash(type(), ethType);
+        return Objects.hash(type().ordinal(), ethType);
     }
 
     @Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/IPCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/IPCriterion.java
index bf67d1a..018afe8 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/IPCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/IPCriterion.java
@@ -62,7 +62,7 @@
 
     @Override
     public int hashCode() {
-        return Objects.hash(type, ip);
+        return Objects.hash(type().ordinal(), ip);
     }
 
     @Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/IPDscpCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/IPDscpCriterion.java
index 86d04c9..8634aa6 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/IPDscpCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/IPDscpCriterion.java
@@ -58,7 +58,7 @@
 
     @Override
     public int hashCode() {
-        return Objects.hash(type(), ipDscp);
+        return Objects.hash(type().ordinal(), ipDscp);
     }
 
     @Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/IPEcnCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/IPEcnCriterion.java
index d403955..48b3fbf 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/IPEcnCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/IPEcnCriterion.java
@@ -58,7 +58,7 @@
 
     @Override
     public int hashCode() {
-        return Objects.hash(type(), ipEcn);
+        return Objects.hash(type().ordinal(), ipEcn);
     }
 
     @Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/IPProtocolCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/IPProtocolCriterion.java
index 3457e0f..6879f80 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/IPProtocolCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/IPProtocolCriterion.java
@@ -59,7 +59,7 @@
 
     @Override
     public int hashCode() {
-        return Objects.hash(type(), proto);
+        return Objects.hash(type().ordinal(), proto);
     }
 
     @Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6ExthdrFlagsCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6ExthdrFlagsCriterion.java
index c9d7a3ce..2463bf6 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6ExthdrFlagsCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6ExthdrFlagsCriterion.java
@@ -60,7 +60,7 @@
 
     @Override
     public int hashCode() {
-        return Objects.hash(type(), exthdrFlags);
+        return Objects.hash(type().ordinal(), exthdrFlags);
     }
 
     @Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6FlowLabelCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6FlowLabelCriterion.java
index 4ac0194..6e1021d 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6FlowLabelCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6FlowLabelCriterion.java
@@ -58,7 +58,7 @@
 
     @Override
     public int hashCode() {
-        return Objects.hash(type(), flowLabel);
+        return Objects.hash(type().ordinal(), flowLabel);
     }
 
     @Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6NDLinkLayerAddressCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6NDLinkLayerAddressCriterion.java
index bf72d15..9f310d4 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6NDLinkLayerAddressCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6NDLinkLayerAddressCriterion.java
@@ -62,7 +62,7 @@
 
     @Override
     public int hashCode() {
-        return Objects.hash(type, mac);
+        return Objects.hash(type().ordinal(), mac);
     }
 
     @Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6NDTargetAddressCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6NDTargetAddressCriterion.java
index 4c6d92d..ffef044 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6NDTargetAddressCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6NDTargetAddressCriterion.java
@@ -58,7 +58,7 @@
 
     @Override
     public int hashCode() {
-        return Objects.hash(type(), targetAddress);
+        return Objects.hash(type().ordinal(), targetAddress);
     }
 
     @Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/IcmpCodeCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/IcmpCodeCriterion.java
index 4470eea..516f61b 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/IcmpCodeCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/IcmpCodeCriterion.java
@@ -57,7 +57,7 @@
 
     @Override
     public int hashCode() {
-        return Objects.hash(type(), icmpCode);
+        return Objects.hash(type().ordinal(), icmpCode);
     }
 
     @Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/IcmpTypeCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/IcmpTypeCriterion.java
index f67c8f5..6325142 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/IcmpTypeCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/IcmpTypeCriterion.java
@@ -57,7 +57,7 @@
 
     @Override
     public int hashCode() {
-        return Objects.hash(type(), icmpType);
+        return Objects.hash(type().ordinal(), icmpType);
     }
 
     @Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/Icmpv6CodeCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/Icmpv6CodeCriterion.java
index a510d7f..a41b6fe 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/Icmpv6CodeCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/Icmpv6CodeCriterion.java
@@ -57,7 +57,7 @@
 
     @Override
     public int hashCode() {
-        return Objects.hash(type(), icmpv6Code);
+        return Objects.hash(type().ordinal(), icmpv6Code);
     }
 
     @Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/Icmpv6TypeCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/Icmpv6TypeCriterion.java
index 7650244..7410ba1 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/Icmpv6TypeCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/Icmpv6TypeCriterion.java
@@ -57,7 +57,7 @@
 
     @Override
     public int hashCode() {
-        return Objects.hash(type(), icmpv6Type);
+        return Objects.hash(type().ordinal(), icmpv6Type);
     }
 
     @Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/IndexedLambdaCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/IndexedLambdaCriterion.java
index 824e00e..88a6fe1 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/IndexedLambdaCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/IndexedLambdaCriterion.java
@@ -56,7 +56,7 @@
 
     @Override
     public int hashCode() {
-        return Objects.hash(lambda);
+        return Objects.hash(type().ordinal(), lambda);
     }
 
     @Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/LambdaCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/LambdaCriterion.java
index c5752be..656800b 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/LambdaCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/LambdaCriterion.java
@@ -62,7 +62,7 @@
 
     @Override
     public int hashCode() {
-        return Objects.hash(type, lambda);
+        return Objects.hash(type().ordinal(), lambda);
     }
 
     @Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/MetadataCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/MetadataCriterion.java
index 9957840..8177b48 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/MetadataCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/MetadataCriterion.java
@@ -57,7 +57,7 @@
 
     @Override
     public int hashCode() {
-        return Objects.hash(type(), metadata);
+        return Objects.hash(type().ordinal(), metadata);
     }
 
     @Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/MplsCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/MplsCriterion.java
index e971965..34d384f 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/MplsCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/MplsCriterion.java
@@ -49,7 +49,7 @@
 
     @Override
     public int hashCode() {
-        return Objects.hash(type(), mplsLabel);
+        return Objects.hash(type().ordinal(), mplsLabel);
     }
 
     @Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/OchSignalCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/OchSignalCriterion.java
index e0021e6..3a51a6b 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/OchSignalCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/OchSignalCriterion.java
@@ -57,7 +57,7 @@
 
     @Override
     public int hashCode() {
-        return Objects.hash(lambda);
+        return Objects.hash(type().ordinal(), lambda);
     }
 
     @Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/OchSignalTypeCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/OchSignalTypeCriterion.java
index 94d1f58..f70a504 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/OchSignalTypeCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/OchSignalTypeCriterion.java
@@ -54,7 +54,7 @@
 
     @Override
     public int hashCode() {
-        return Objects.hash(signalType);
+        return Objects.hash(type().ordinal(), signalType);
     }
 
     @Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/OpticalSignalTypeCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/OpticalSignalTypeCriterion.java
index 6c24212..d6e8ebf 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/OpticalSignalTypeCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/OpticalSignalTypeCriterion.java
@@ -62,7 +62,7 @@
 
     @Override
     public int hashCode() {
-        return Objects.hash(type, signalType);
+        return Objects.hash(type().ordinal(), signalType);
     }
 
     @Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/PortCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/PortCriterion.java
index ec07536..f07cd50 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/PortCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/PortCriterion.java
@@ -62,7 +62,7 @@
 
     @Override
     public int hashCode() {
-        return Objects.hash(type(), port);
+        return Objects.hash(type().ordinal(), port);
     }
 
     @Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/SctpPortCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/SctpPortCriterion.java
index 8e965c9..a8e8e56 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/SctpPortCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/SctpPortCriterion.java
@@ -61,7 +61,7 @@
 
     @Override
     public int hashCode() {
-        return Objects.hash(type, sctpPort);
+        return Objects.hash(type().ordinal(), sctpPort);
     }
 
     @Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/TcpPortCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/TcpPortCriterion.java
index 74d3e5c..3f15375 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/TcpPortCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/TcpPortCriterion.java
@@ -61,7 +61,7 @@
 
     @Override
     public int hashCode() {
-        return Objects.hash(type, tcpPort);
+        return Objects.hash(type().ordinal(), tcpPort);
     }
 
     @Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/UdpPortCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/UdpPortCriterion.java
index 12f31b5..9764021 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/UdpPortCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/UdpPortCriterion.java
@@ -61,7 +61,7 @@
 
     @Override
     public int hashCode() {
-        return Objects.hash(type, udpPort);
+        return Objects.hash(type().ordinal(), udpPort);
     }
 
     @Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/VlanIdCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/VlanIdCriterion.java
index 17d0bcd..c73edb1 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/VlanIdCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/VlanIdCriterion.java
@@ -58,7 +58,7 @@
 
     @Override
     public int hashCode() {
-        return Objects.hash(type(), vlanId);
+        return Objects.hash(type().ordinal(), vlanId);
     }
 
     @Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/VlanPcpCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/VlanPcpCriterion.java
index 78e73d6..0c83e14 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/VlanPcpCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/VlanPcpCriterion.java
@@ -57,7 +57,7 @@
 
     @Override
     public int hashCode() {
-        return Objects.hash(type(), vlanPcp);
+        return Objects.hash(type().ordinal(), vlanPcp);
     }
 
     @Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java b/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java
index 53d0528..500ac1c 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java
@@ -352,7 +352,7 @@
 
         @Override
         public int hashCode() {
-            return Objects.hash(type());
+            return Objects.hash(type().ordinal());
         }
 
         @Override
@@ -393,7 +393,7 @@
 
         @Override
         public int hashCode() {
-            return Objects.hash(type(), port);
+            return Objects.hash(type().ordinal(), port);
         }
 
         @Override
@@ -437,7 +437,7 @@
 
         @Override
         public int hashCode() {
-            return Objects.hash(type(), groupId);
+            return Objects.hash(type().ordinal(), groupId);
         }
 
         @Override
@@ -481,7 +481,7 @@
 
         @Override
         public int hashCode() {
-            return Objects.hash(type(), tableId);
+            return Objects.hash(type().ordinal(), tableId);
         }
 
         @Override
@@ -533,7 +533,7 @@
 
         @Override
         public int hashCode() {
-            return Objects.hash(type(), metadata, metadataMask);
+            return Objects.hash(type().ordinal(), metadata, metadataMask);
         }
 
         @Override