Implement compareTo for TableId to avoid IllegalArgumentException

java.lang.IllegalArgumentException: Comparison method violates its general contract!

Change-Id: I4033e9a6743f134583eab936de2b960d76274919
diff --git a/core/api/src/main/java/org/onosproject/net/pi/model/PiTableId.java b/core/api/src/main/java/org/onosproject/net/pi/model/PiTableId.java
index 2e799a9..f817e31 100644
--- a/core/api/src/main/java/org/onosproject/net/pi/model/PiTableId.java
+++ b/core/api/src/main/java/org/onosproject/net/pi/model/PiTableId.java
@@ -49,4 +49,16 @@
     public Type type() {
         return Type.PIPELINE_INDEPENDENT;
     }
+
+    @Override
+    public int compareTo(TableId other) {
+        if (this.type() != other.type()) {
+            return this.type().compareTo(other.type());
+        } else {
+            PiTableId piTableId = (PiTableId) other;
+            checkNotNull(this.identifier, "PiTableId identifier should not be null");
+            checkNotNull(piTableId.identifier, "PiTableId identifier should not be null");
+            return this.identifier.compareTo(piTableId.identifier);
+        }
+    }
 }