[ONOS-4167] Identify the impacted tunnels based on network events, notify to PCE app and trigger MBB flow.

Change-Id: I1766f4afbc0ee2f4c05c75cf788c91f9df8aaa9a
diff --git a/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/protocol/ver1/PcepEroObjectVer1.java b/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/protocol/ver1/PcepEroObjectVer1.java
index 4b97d05..d680ff4 100644
--- a/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/protocol/ver1/PcepEroObjectVer1.java
+++ b/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/protocol/ver1/PcepEroObjectVer1.java
@@ -16,8 +16,10 @@
 
 package org.onosproject.pcepio.protocol.ver1;
 
+import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.ListIterator;
+import java.util.Objects;
 
 import org.jboss.netty.buffer.ChannelBuffer;
 import org.onosproject.pcepio.exceptions.PcepParseException;
@@ -399,10 +401,47 @@
     }
 
     @Override
+    public int hashCode() {
+        return Objects.hash(eroObjHeader, subObjectList);
+    }
+
+    @Override
     public String toString() {
         return MoreObjects.toStringHelper(getClass()).omitNullValues()
                 .add("EroObjHeader", eroObjHeader)
                 .add("SubObjects", subObjectList)
                 .toString();
     }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+
+        if (obj instanceof PcepEroObjectVer1) {
+            int countObjSubTlv = 0;
+            int countOtherSubTlv = 0;
+            boolean isCommonSubTlv = true;
+            PcepEroObjectVer1 other = (PcepEroObjectVer1) obj;
+            Iterator<PcepValueType> objListIterator = other.subObjectList.iterator();
+            countOtherSubTlv = other.subObjectList.size();
+            countObjSubTlv = subObjectList.size();
+            if (countObjSubTlv != countOtherSubTlv) {
+                return false;
+            } else {
+                while (objListIterator.hasNext() && isCommonSubTlv) {
+                    PcepValueType subTlv = objListIterator.next();
+                    if (subObjectList.contains(subTlv)) {
+                        isCommonSubTlv = Objects.equals(subObjectList.get(subObjectList.indexOf(subTlv)),
+                                         other.subObjectList.get(other.subObjectList.indexOf(subTlv)));
+                    } else {
+                        isCommonSubTlv = false;
+                    }
+                }
+                return isCommonSubTlv && Objects.equals(eroObjHeader, other.eroObjHeader);
+            }
+        }
+        return false;
+    }
 }