TopoRegions: created skeleton Topo2 UI view for development of the "region-aware" topology.
- Added initial event generation (layout/region/ etc.) -- WIP
Change-Id: I2f93eea7505ff0400085d7f67491f6b61231cb86
diff --git a/core/api/src/main/java/org/onosproject/ui/model/topo/UiDevice.java b/core/api/src/main/java/org/onosproject/ui/model/topo/UiDevice.java
index 3ed9da0..c029c2b 100644
--- a/core/api/src/main/java/org/onosproject/ui/model/topo/UiDevice.java
+++ b/core/api/src/main/java/org/onosproject/ui/model/topo/UiDevice.java
@@ -17,6 +17,7 @@
package org.onosproject.ui.model.topo;
import com.google.common.base.MoreObjects;
+import org.onosproject.cluster.NodeId;
import org.onosproject.net.Device;
import org.onosproject.net.DeviceId;
import org.onosproject.net.region.RegionId;
@@ -30,6 +31,8 @@
private final Device device;
private RegionId regionId;
+ private NodeId masterId;
+ private boolean online;
/**
* Creates a new UI device.
@@ -51,6 +54,24 @@
this.regionId = regionId;
}
+ /**
+ * Sets the ID of the controller node that holds mastership for this device.
+ *
+ * @param masterId master identifier
+ */
+ public void setMasterId(NodeId masterId) {
+ this.masterId = masterId;
+ }
+
+ /**
+ * Sets a flag indicating whether the backing device is online.
+ *
+ * @param online boolen flag
+ */
+ public void setOnline(boolean online) {
+ this.online = online;
+ }
+
@Override
public String toString() {
return MoreObjects.toStringHelper(this)
@@ -104,4 +125,32 @@
public UiRegion uiRegion() {
return topology.findRegion(regionId);
}
+
+ /**
+ * Returns a string representation of the type of the backing device.
+ *
+ * @return the device type
+ */
+ public String type() {
+ return device.type().toString().toLowerCase();
+ }
+
+ /**
+ * Returns a boolean indicating whether the backing device is online.
+ *
+ * @return true if device is online, false otherwise
+ */
+ public boolean isOnline() {
+ return online;
+ }
+
+ /**
+ * Returns the identifier for the cluster member that has
+ * mastership over this device.
+ *
+ * @return master cluster member identifier
+ */
+ public NodeId master() {
+ return masterId;
+ }
}