Topo2: Update UI on UiModelCache changes
Change-Id: Ic2d905820376bdd54fa9a72e42110a35c5f4a083
diff --git a/tools/test/topos/regions-bayarea.sh b/tools/test/topos/regions-bayarea.sh
index 6ecdcde..c73cd3e 100755
--- a/tools/test/topos/regions-bayarea.sh
+++ b/tools/test/topos/regions-bayarea.sh
@@ -283,6 +283,7 @@
log:set DEBUG org.onosproject.ui.impl.topo.Topo2ViewMessageHandler
log:set DEBUG org.onosproject.ui.impl.topo.Topo2Jsonifier
log:set DEBUG org.onosproject.ui.impl.UiWebSocket
+log:set DEBUG org.onosproject.ui.impl.UiTopoSession
log:list
EOF
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/topo/Topo2Jsonifier.java b/web/gui/src/main/java/org/onosproject/ui/impl/topo/Topo2Jsonifier.java
index 15332d4..c9e29b9 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/topo/Topo2Jsonifier.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/topo/Topo2Jsonifier.java
@@ -41,6 +41,7 @@
import org.onosproject.net.statistic.StatisticService;
import org.onosproject.net.topology.TopologyService;
import org.onosproject.ui.JsonUtils;
+import org.onosproject.ui.impl.topo.model.UiModelEvent;
import org.onosproject.ui.model.topo.UiClusterMember;
import org.onosproject.ui.model.topo.UiDevice;
import org.onosproject.ui.model.topo.UiHost;
@@ -79,6 +80,8 @@
private static final String REGION = "region";
private static final String DEVICE = "device";
private static final String HOST = "host";
+ private static final String TYPE = "type";
+ private static final String SUBJECT = "subject";
private final Logger log = LoggerFactory.getLogger(getClass());
@@ -263,6 +266,18 @@
return result;
}
+ private ObjectNode jsonEvent(UiModelEvent modelEvent) {
+ ObjectNode payload = objectNode();
+ payload.put(TYPE, enumToString(modelEvent.type()));
+ payload.put(SUBJECT, modelEvent.subject().idAsString());
+ return payload;
+ }
+
+ // TODO: Investigate why we can't do this inline
+ private String enumToString(Enum<?> e) {
+ return e.toString();
+ }
+
// Returns the name of the master node for the specified device id.
private String master(DeviceId deviceId) {
NodeId master = mastershipService.getMasterFor(deviceId);