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/web/gui/src/main/java/org/onosproject/ui/impl/topo/model/ModelCache.java b/web/gui/src/main/java/org/onosproject/ui/impl/topo/model/ModelCache.java
index 6566511..8754550 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/topo/model/ModelCache.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/topo/model/ModelCache.java
@@ -41,6 +41,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.util.List;
import java.util.Set;
import static org.onosproject.net.DefaultEdgeLink.createEdgeLink;
@@ -153,6 +154,10 @@
}
}
+ List<UiClusterMember> getAllClusterMembers() {
+ return uiTopology.allClusterMembers();
+ }
+
// === MASTERSHIP CHANGES
@@ -199,7 +204,7 @@
// package private for unit test access
UiRegion accessRegion(RegionId id) {
- return uiTopology.findRegion(id);
+ return id == null ? null : uiTopology.findRegion(id);
}
// invoked from UiSharedTopologyModel region listener
@@ -484,4 +489,5 @@
public int hostCount() {
return uiTopology.hostCount();
}
+
}
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/topo/model/UiSharedTopologyModel.java b/web/gui/src/main/java/org/onosproject/ui/impl/topo/model/UiSharedTopologyModel.java
index 37ac126..54c92f6 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/topo/model/UiSharedTopologyModel.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/topo/model/UiSharedTopologyModel.java
@@ -16,9 +16,6 @@
package org.onosproject.ui.impl.topo.model;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
@@ -64,9 +61,19 @@
import org.onosproject.net.topology.TopologyService;
import org.onosproject.ui.impl.topo.UiTopoSession;
import org.onosproject.ui.model.ServiceBundle;
+import org.onosproject.ui.model.topo.UiClusterMember;
+import org.onosproject.ui.model.topo.UiElement;
+import org.onosproject.ui.model.topo.UiRegion;
+import org.onosproject.ui.model.topo.UiTopoLayout;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
/**
* Service that creates and maintains the UI-model of the network topology.
*/
@@ -190,6 +197,41 @@
removeListener(session);
}
+
+ // =======================================================================
+ // methods that the topo session will use to extract information from us
+
+ /**
+ * Returns the list of cluster members stored in our model cache.
+ *
+ * @return list of cluster members
+ */
+ public List<UiClusterMember> getClusterMembers() {
+ return cache.getAllClusterMembers();
+ }
+
+ public Set<UiElement> getElements(UiTopoLayout layout) {
+ Set<UiElement> results = new HashSet<>();
+
+ // TODO: figure out how to extract the appropriate nodes
+ // from the cache, for the given layout.
+
+ return results;
+ }
+
+ /**
+ * Returns the region for the given layout.
+ *
+ * @param layout layout filter
+ * @return the region the layout is based upon
+ */
+ public UiRegion getRegion(UiTopoLayout layout) {
+ return cache.accessRegion(layout.regionId());
+ }
+
+ // =====================================================================
+
+
/**
* Default implementation of service bundle to return references to our
* dynamically injected services.