Move out element info from {Switch,Port,Link,Host}Impl
(ONOS-1719)
Change-Id: I8df50ce044173195474fd5c5168bab52f68907b3
diff --git a/src/main/java/net/onrc/onos/core/topology/LinkEvent.java b/src/main/java/net/onrc/onos/core/topology/LinkEvent.java
index 1618425..831b407 100644
--- a/src/main/java/net/onrc/onos/core/topology/LinkEvent.java
+++ b/src/main/java/net/onrc/onos/core/topology/LinkEvent.java
@@ -25,6 +25,8 @@
private final LinkTuple id;
// TODO add LastSeenTime, Capacity if appropriate
+ protected static final Double DEFAULT_CAPACITY = Double.POSITIVE_INFINITY;
+ private Double capacity = DEFAULT_CAPACITY;
/**
* Default constructor for Serializer to use.
@@ -62,8 +64,6 @@
*/
public LinkEvent(LinkEvent original) {
super(original);
- Validate.isTrue(Objects.equals(this.id, original.id));
-
this.id = original.id;
}
@@ -113,6 +113,30 @@
return getLinkTuple().getDst();
}
+ /**
+ * Gets the link capacity.
+ * TODO: What is the unit?
+ *
+ * @return capacity
+ */
+ public Double getCapacity() {
+ return capacity;
+ }
+
+ /**
+ * Sets the link capacity.
+ * TODO: What is the unit?
+ *
+ * @param capacity capacity
+ */
+ void setCapacity(Double capacity) {
+ if (isFrozen()) {
+ throw new IllegalStateException("Tried to modify frozen instance: " + this);
+ }
+
+ this.capacity = capacity;
+ }
+
@Override
public String toString() {
return "[LinkEvent " + getSrc() + "->" + getDst() + "]";