GUI2 added in the layout topo overlay
Change-Id: I9960f95ae726a5af9950771ed67bcfc9d172e267
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 b0622dd..15a0519 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
@@ -45,6 +45,7 @@
checkNotNull(device, DEVICE_CANNOT_BE_NULL);
this.topology = topology;
this.deviceId = device.id();
+ this.regionId = RegionId.regionId(UiRegion.NULL_NAME);
}
/**
diff --git a/core/api/src/main/java/org/onosproject/ui/model/topo/UiHost.java b/core/api/src/main/java/org/onosproject/ui/model/topo/UiHost.java
index 5ca86e3..10dfbf1 100644
--- a/core/api/src/main/java/org/onosproject/ui/model/topo/UiHost.java
+++ b/core/api/src/main/java/org/onosproject/ui/model/topo/UiHost.java
@@ -52,6 +52,7 @@
checkNotNull(host, HOST_CANNOT_BE_NULL);
this.topology = topology;
this.hostId = host.id();
+ this.regionId = RegionId.regionId(UiRegion.NULL_NAME);
}
@Override
@@ -60,6 +61,7 @@
.add("id", id())
.add("dev", locDevice)
.add("port", locPort)
+ .add("Region", regionId)
.toString();
}
diff --git a/core/api/src/main/java/org/onosproject/ui/model/topo/UiRegion.java b/core/api/src/main/java/org/onosproject/ui/model/topo/UiRegion.java
index de4c816f..4fe24b6 100644
--- a/core/api/src/main/java/org/onosproject/ui/model/topo/UiRegion.java
+++ b/core/api/src/main/java/org/onosproject/ui/model/topo/UiRegion.java
@@ -37,7 +37,7 @@
*/
public class UiRegion extends UiNode {
- private static final String NULL_NAME = "(root)";
+ public static final String NULL_NAME = "(root)";
private static final String NO_NAME = "???";
private static final String MEMO_ADDED = "added";
@@ -338,9 +338,11 @@
return isRegionRelevant(((UiRegion) event.subject()).id());
case DEVICE_ADDED_OR_UPDATED:
+ final UiDevice uiDevice = (UiDevice) event.subject();
if (MEMO_ADDED.equalsIgnoreCase(event.memo()) &&
- regionId.toString().equalsIgnoreCase(
- ((UiDevice) event.subject()).regionId().toString())) {
+ uiDevice.regionId() != null &&
+ regionId.equals(
+ ((UiDevice) event.subject()).regionId())) {
return true;
} else {
return isDeviceRelevant(((UiDevice) event.subject()).id());
@@ -360,7 +362,7 @@
uiHost.regionId().toString())) {
return true;
} else {
- return isDeviceRelevant(((UiDevice) event.subject()).id());
+ return isHostRelevant(((UiHost) event.subject()).id());
}
case HOST_MOVED:
case HOST_REMOVED:
@@ -375,6 +377,10 @@
return deviceIds.contains(deviceId);
}
+ private boolean isHostRelevant(HostId hostId) {
+ return hostIds.contains(hostId);
+ }
+
private boolean isLinkRelevant(UiLink uiLink) {
if (uiLink instanceof UiDeviceLink) {
UiDeviceLink uiDeviceLink = (UiDeviceLink) uiLink;