Partial revert of hosts/regions work to fix NPE with null provider.
Change-Id: I7dacad818ca9ffa2ea8085c499990c8e92644607
diff --git a/core/api/src/main/java/org/onosproject/net/region/RegionStore.java b/core/api/src/main/java/org/onosproject/net/region/RegionStore.java
index a21a1f9..49cc378 100644
--- a/core/api/src/main/java/org/onosproject/net/region/RegionStore.java
+++ b/core/api/src/main/java/org/onosproject/net/region/RegionStore.java
@@ -17,7 +17,6 @@
import org.onosproject.cluster.NodeId;
import org.onosproject.net.DeviceId;
-import org.onosproject.net.HostId;
import org.onosproject.store.Store;
import java.util.Collection;
@@ -111,12 +110,4 @@
*/
void removeDevices(RegionId regionId, Collection<DeviceId> deviceIds);
- /**
- * Returns the set of hosts that belong to the specified region.
- *
- * @param regionId region identifier
- * @return set of identifiers for hosts in the given region
- */
- Set<HostId> getRegionHosts(RegionId regionId);
-
}
diff --git a/core/net/src/main/java/org/onosproject/net/region/impl/RegionManager.java b/core/net/src/main/java/org/onosproject/net/region/impl/RegionManager.java
index 75d96ed..c7b8342 100644
--- a/core/net/src/main/java/org/onosproject/net/region/impl/RegionManager.java
+++ b/core/net/src/main/java/org/onosproject/net/region/impl/RegionManager.java
@@ -16,6 +16,7 @@
package org.onosproject.net.region.impl;
+import com.google.common.collect.ImmutableSet;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
@@ -154,7 +155,8 @@
public Set<HostId> getRegionHosts(RegionId regionId) {
checkPermission(REGION_READ);
checkNotNull(regionId, REGION_ID_NULL);
- return store.getRegionHosts(regionId);
+ // TODO: compute hosts from region devices
+ return ImmutableSet.of();
}
}
diff --git a/core/store/dist/src/main/java/org/onosproject/store/region/impl/DistributedRegionStore.java b/core/store/dist/src/main/java/org/onosproject/store/region/impl/DistributedRegionStore.java
index e101514..6d70376 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/region/impl/DistributedRegionStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/region/impl/DistributedRegionStore.java
@@ -27,7 +27,6 @@
import org.onlab.util.Identifier;
import org.onosproject.cluster.NodeId;
import org.onosproject.net.DeviceId;
-import org.onosproject.net.HostId;
import org.onosproject.net.region.DefaultRegion;
import org.onosproject.net.region.Region;
import org.onosproject.net.region.RegionEvent;
@@ -79,7 +78,6 @@
private ConsistentMap<RegionId, Set<DeviceId>> membershipRepo;
private Map<RegionId, Set<DeviceId>> regionDevices;
- private Map<RegionId, Set<HostId>> regionHosts;
private Map<DeviceId, Region> regionsByDevice = new HashMap<>();
@@ -142,12 +140,6 @@
}
@Override
- public Set<HostId> getRegionHosts(RegionId regionId) {
- Set<HostId> hostIds = regionHosts.get(regionId);
- return hostIds != null ? ImmutableSet.copyOf(hostIds) : ImmutableSet.of();
- }
-
- @Override
public Region createRegion(RegionId regionId, String name, Region.Type type,
List<Set<NodeId>> masterNodeIds) {
return regionsRepo.compute(regionId, (id, region) -> {
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/UiExtensionManager.java b/web/gui/src/main/java/org/onosproject/ui/impl/UiExtensionManager.java
index 0cbc848..17188cb 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/UiExtensionManager.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/UiExtensionManager.java
@@ -133,6 +133,7 @@
new UiView(NETWORK, "topo", "Topology", "nav_topo"),
// FIXME: leave commented out for now, while still under development
+ // (remember to also comment out inclusions in index.html)
// new UiView(NETWORK, "topo2", "New-Topo"),
// new UiView(NETWORK, "topoX", "Topo-X"),
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 684be94..69c8c8f 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
@@ -573,14 +573,13 @@
Set<HostId> hostIds = services.region().getRegionHosts(rid);
region.reconcileHosts(hostIds);
- hostIds.forEach(hId -> {
- UiHost h = uiTopology.findHost(hId);
+ hostIds.forEach(hid -> {
+ UiHost h = uiTopology.findHost(hid);
if (h != null) {
h.setRegionId(r.id());
allHosts.remove(h);
} else {
- log.warn("Region host ID {} but no UiHost in topology",
- hId);
+ log.warn("Region host ID {} but no UiHost in topology", hid);
}
});
}
diff --git a/web/gui/src/main/webapp/app/view/topo2/topo2NodePosition.js b/web/gui/src/main/webapp/app/view/topo2/topo2NodePosition.js
index 7381f6b..6dedcd9 100644
--- a/web/gui/src/main/webapp/app/view/topo2/topo2NodePosition.js
+++ b/web/gui/src/main/webapp/app/view/topo2/topo2NodePosition.js
@@ -115,7 +115,7 @@
angular.module('ovTopo2')
.factory('Topo2NodePositionService',
- ['RandomService',
+ ['RandomService', 'Topo2MapConfigService',
function (_rs_, _t2mcs_) {
rs = _rs_;