Bugfix: OpticalPortOperator should be able to overwrite port number.
- bug introduced in ONOS-3503.
- added exact equality comparison method to PortNumber
- removed null PortNumber case handling test
Change-Id: I6d1f191b5a64b79426de9d80cffadd6c9de96d56
diff --git a/core/api/src/main/java/org/onosproject/net/PortNumber.java b/core/api/src/main/java/org/onosproject/net/PortNumber.java
index 96c4eb0..e1a1554 100644
--- a/core/api/src/main/java/org/onosproject/net/PortNumber.java
+++ b/core/api/src/main/java/org/onosproject/net/PortNumber.java
@@ -15,6 +15,7 @@
*/
package org.onosproject.net;
+import com.google.common.base.Objects;
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
import com.google.common.collect.ImmutableMap;
@@ -273,4 +274,21 @@
}
return false;
}
+
+ /**
+ * Indicates whether some other PortNumber object is equal to this one
+ * including it's name.
+ *
+ * @param that other {@link PortNumber} instance to compare
+ * @return true if equal, false otherwise
+ */
+ public boolean exactlyEquals(PortNumber that) {
+ if (this == that) {
+ return true;
+ }
+
+ return this.equals(that) &&
+ this.hasName == that.hasName &&
+ Objects.equal(this.name, that.name);
+ }
}