Europe Region Demo data script written.
- Added LayoutLocation class
- Added RegionAddPeerLocCommand class
Note: still need to plumb through peer locations to UI JSON.
Change-Id: Ic3513a3880f50b440fe318dce6896b66d7e79704
diff --git a/cli/src/main/java/org/onosproject/cli/net/RegionAddPeerLocCommand.java b/cli/src/main/java/org/onosproject/cli/net/RegionAddPeerLocCommand.java
new file mode 100644
index 0000000..27a5586
--- /dev/null
+++ b/cli/src/main/java/org/onosproject/cli/net/RegionAddPeerLocCommand.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.cli.net;
+
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.net.config.NetworkConfigService;
+import org.onosproject.net.config.basics.BasicRegionConfig;
+import org.onosproject.net.region.RegionId;
+
+/**
+ * Annotate a region with a peer location. That is, when rendering the
+ * first region, where should the second (peer) region node be
+ * located on the layout. An example:
+ * <pre>
+ * region-add-peer-loc rUK rES 50.4060 -3.3860
+ * </pre>
+ * When rendering the rUK region, the rES peer region node should be located
+ * at latitude 50.4060 and longitude -3.3860.
+ * <pre>
+ * region-add-peer-loc rUK rES 100.0 200.0 grid
+ * </pre>
+ * When rendering the rUK region, the rES peer region node should be located
+ * at grid-Y 100 and grid-X 200.
+ *
+ */
+@Command(scope = "onos", name = "region-add-peer-loc",
+ description = "Adds a peer location annotation to a region.")
+public class RegionAddPeerLocCommand extends AbstractShellCommand {
+
+ private static final String GEO = "geo";
+ private static final String GRID = "grid";
+
+ @Argument(index = 0, name = "id", description = "Region ID",
+ required = true, multiValued = false)
+ String id = null;
+
+ @Argument(index = 1, name = "peer", description = "Peer region ID",
+ required = true, multiValued = false)
+ String peerId = null;
+
+ @Argument(index = 2, name = "latOrY",
+ description = "Geo latitude / Grid y-coord",
+ required = true, multiValued = false)
+ Double latOrY = null;
+
+ @Argument(index = 3, name = "longOrX",
+ description = "Geo longitude / Grid x-coord",
+ required = true, multiValued = false)
+ Double longOrX = null;
+
+ @Argument(index = 4, name = "locType", description = "Location type {geo|grid}",
+ required = false, multiValued = false)
+ String locType = GEO;
+
+ @Override
+ protected void execute() {
+ RegionId regionId = RegionId.regionId(id);
+
+ NetworkConfigService cfgService = get(NetworkConfigService.class);
+ BasicRegionConfig cfg = cfgService.getConfig(regionId, BasicRegionConfig.class);
+
+ cfg.addPeerLocMapping(peerId, locType, latOrY, longOrX)
+ .apply();
+ }
+}
diff --git a/cli/src/main/resources/OSGI-INF/blueprint/shell-config.xml b/cli/src/main/resources/OSGI-INF/blueprint/shell-config.xml
index 1441f1b..7b990c1 100644
--- a/cli/src/main/resources/OSGI-INF/blueprint/shell-config.xml
+++ b/cli/src/main/resources/OSGI-INF/blueprint/shell-config.xml
@@ -688,6 +688,12 @@
<ref component-id="deviceIdCompleter"/>
</completers>
</command>
+ <command>
+ <action class="org.onosproject.cli.net.RegionAddPeerLocCommand"/>
+ <completers>
+ <ref component-id="regionIdCompleter"/>
+ </completers>
+ </command>
<!-- UI Layout commands -->
<command>
diff --git a/core/api/src/main/java/org/onosproject/net/config/basics/BasicRegionConfig.java b/core/api/src/main/java/org/onosproject/net/config/basics/BasicRegionConfig.java
index e27157e..7a0e8d6 100644
--- a/core/api/src/main/java/org/onosproject/net/config/basics/BasicRegionConfig.java
+++ b/core/api/src/main/java/org/onosproject/net/config/basics/BasicRegionConfig.java
@@ -16,14 +16,22 @@
package org.onosproject.net.config.basics;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.common.base.MoreObjects;
import org.onosproject.net.DeviceId;
import org.onosproject.net.region.Region;
import org.onosproject.net.region.RegionId;
+import org.onosproject.ui.topo.LayoutLocation;
+import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.Set;
+import static org.onosproject.ui.topo.LayoutLocation.layoutLocation;
+
/**
* Basic configuration for network regions.
*/
@@ -31,11 +39,17 @@
private static final String TYPE = "type";
private static final String DEVICES = "devices";
+ private static final String LOC_IN_PEERS = "locInPeers";
+
+ private static final String LOC_TYPE = "locType";
+ private static final String LAT_OR_Y = "latOrY";
+ private static final String LONG_OR_X = "LongOrX";
+
@Override
public boolean isValid() {
return hasOnlyFields(ALLOWED, NAME, LATITUDE, LONGITUDE, UI_TYPE,
- RACK_ADDRESS, OWNER, TYPE, DEVICES);
+ RACK_ADDRESS, OWNER, TYPE, DEVICES, LOC_IN_PEERS);
}
@Override
@@ -97,4 +111,65 @@
public BasicRegionConfig devices(Set<DeviceId> devices) {
return (BasicRegionConfig) setOrClear(DEVICES, devices);
}
+
+
+ // Requires some custom json-node handling for maintaining a map
+ // of peer location data...
+
+ /**
+ * Adds a peer location mapping to this region.
+ *
+ * @param peerId the region ID of the peer
+ * @param locType the type of location (geo/grid)
+ * @param latOrY geo latitude / grid y-coord
+ * @param longOrX geo longitude / grid x-coord
+ * @return self
+ */
+ public BasicRegionConfig addPeerLocMapping(String peerId, String locType,
+ Double latOrY, Double longOrX) {
+ ObjectNode map = getLocMap();
+ map.set(peerId, makeLocation(locType, latOrY, longOrX));
+ return this;
+ }
+
+ private JsonNode makeLocation(String locType, Double latOrY, Double longOrX) {
+ return mapper.createObjectNode()
+ .put(LOC_TYPE, locType)
+ .put(LAT_OR_Y, latOrY)
+ .put(LONG_OR_X, longOrX);
+ }
+
+ private ObjectNode getLocMap() {
+ ObjectNode locMap = (ObjectNode) object.get(LOC_IN_PEERS);
+ if (locMap == null) {
+ locMap = mapper.createObjectNode();
+ object.set(LOC_IN_PEERS, locMap);
+ }
+ return locMap;
+ }
+
+ /**
+ * Returns the list of layout location mappings for where peer region nodes
+ * should be placed on the layout when viewing this region.
+ *
+ * @return list of peer node locations
+ */
+ public List<LayoutLocation> getMappings() {
+ List<LayoutLocation> mappings = new ArrayList<>();
+ ObjectNode map = (ObjectNode) object.get(LOC_IN_PEERS);
+ if (map != null) {
+ for (Iterator<Map.Entry<String, JsonNode>> it = map.fields(); it.hasNext();) {
+ Map.Entry<String, JsonNode> entry = it.next();
+ String peerId = entry.getKey();
+ ObjectNode data = (ObjectNode) entry.getValue();
+
+ String lt = data.get(LOC_TYPE).asText();
+ double latY = data.get(LAT_OR_Y).asDouble();
+ double longX = data.get(LONG_OR_X).asDouble();
+
+ mappings.add(layoutLocation(peerId, lt, latY, longX));
+ }
+ }
+ return mappings;
+ }
}
diff --git a/core/api/src/main/java/org/onosproject/ui/topo/LayoutLocation.java b/core/api/src/main/java/org/onosproject/ui/topo/LayoutLocation.java
new file mode 100644
index 0000000..9e006b5
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/ui/topo/LayoutLocation.java
@@ -0,0 +1,141 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.onosproject.ui.topo;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Represents a "node location" on a UI layout.
+ */
+public final class LayoutLocation {
+ private static final double ZERO_THRESHOLD = Double.MIN_VALUE * 2.0;
+
+ /**
+ * Designates the type of location; either geographic or logical grid.
+ */
+ public enum Type {
+ GEO, GRID
+ }
+
+ private final String id;
+ private final double latOrY;
+ private final double longOrX;
+ private final Type locType;
+
+ private LayoutLocation(String id, Type locType, double latOrY, double longOrX) {
+ this.id = id;
+ this.latOrY = latOrY;
+ this.longOrX = longOrX;
+ this.locType = locType;
+ }
+
+
+ private boolean doubleIsZero(double value) {
+ return value >= -ZERO_THRESHOLD && value <= ZERO_THRESHOLD;
+ }
+
+ /**
+ * Returns true if the coordinates indicate the origin (0, 0) of the
+ * coordinate system; false otherwise.
+ *
+ * @return true if geo-coordinates are set; false otherwise
+ */
+ public boolean isOrigin() {
+ return doubleIsZero(latOrY) && doubleIsZero(longOrX);
+ }
+
+ /**
+ * Returns the identifier associated with this location.
+ *
+ * @return the identifier
+ */
+ public String id() {
+ return id;
+ }
+
+ /**
+ * Returns the latitude (geo) or y-coord (grid) data value.
+ *
+ * @return geo latitude or grid y-coord
+ */
+ public double latOrY() {
+ return latOrY;
+ }
+
+ /**
+ * Returns the longitude (geo) or x-coord (grid) data value.
+ *
+ * @return geo longitude or grid x-coord
+ */
+ public double longOrX() {
+ return longOrX;
+ }
+
+ /**
+ * Returns the location type (geo or grid), which indicates how the data
+ * is to be interpreted.
+ *
+ * @return location type
+ */
+ public Type locType() {
+ return locType;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this)
+ .add("id", id)
+ .add("lat/Y", latOrY)
+ .add("long/X", longOrX)
+ .add("loc-type", locType)
+ .toString();
+ }
+
+ /**
+ * Creates an instance of a layout location.
+ *
+ * @param id an identifier for the item at this location
+ * @param locType the location type
+ * @param latOrY geo latitude / grid y-coord
+ * @param longOrX geo longitude / grid x-coord
+ * @return layout location instance
+ */
+ public static LayoutLocation layoutLocation(String id, Type locType,
+ double latOrY, double longOrX) {
+ checkNotNull(id, "must supply an identifier");
+ checkNotNull(locType, "must declare location type");
+ return new LayoutLocation(id, locType, latOrY, longOrX);
+ }
+
+ /**
+ * Creates an instance of a layout location.
+ *
+ * @param id an identifier for the item at this location
+ * @param locType the location type ("geo" or "grid")
+ * @param latOrY geo latitude / grid y-coord
+ * @param longOrX geo longitude / grid x-coord
+ * @return layout location instance
+ * @throws IllegalArgumentException if the type is not "geo" or "grid"
+ */
+ public static LayoutLocation layoutLocation(String id, String locType,
+ double latOrY, double longOrX) {
+ Type t = Type.valueOf(locType.toUpperCase());
+ return new LayoutLocation(id, t, latOrY, longOrX);
+ }
+}
diff --git a/core/api/src/test/java/org/onosproject/ui/AbstractUiTest.java b/core/api/src/test/java/org/onosproject/ui/AbstractUiTest.java
index 077d132..9242863 100644
--- a/core/api/src/test/java/org/onosproject/ui/AbstractUiTest.java
+++ b/core/api/src/test/java/org/onosproject/ui/AbstractUiTest.java
@@ -27,6 +27,11 @@
protected static final String EOL = String.format("%n");
/**
+ * Tolerance for Double equality assertions.
+ */
+ protected static final double TOLERANCE = Double.MIN_VALUE * 2;
+
+ /**
* Prints the given string to stdout.
*
* @param s string to print
diff --git a/core/api/src/test/java/org/onosproject/ui/topo/LayoutLocationTest.java b/core/api/src/test/java/org/onosproject/ui/topo/LayoutLocationTest.java
new file mode 100644
index 0000000..64908fd
--- /dev/null
+++ b/core/api/src/test/java/org/onosproject/ui/topo/LayoutLocationTest.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.onosproject.ui.topo;
+
+import org.junit.Test;
+import org.onosproject.ui.AbstractUiTest;
+
+import static org.junit.Assert.*;
+import static org.onosproject.ui.topo.LayoutLocation.Type;
+import static org.onosproject.ui.topo.LayoutLocation.layoutLocation;
+
+/**
+ * Unit tests for {@link LayoutLocation}.
+ */
+public class LayoutLocationTest extends AbstractUiTest {
+
+ private static final String SOME_ID = "foo";
+ private static final double SQRT2 = 1.414;
+ private static final double PI = 3.142;
+ private static final double ZERO = 0.0;
+
+ private LayoutLocation ll;
+
+ @Test
+ public void basic() {
+ ll = layoutLocation(SOME_ID, Type.GRID, SQRT2, PI);
+ print(ll);
+ assertEquals("bad id", SOME_ID, ll.id());
+ assertEquals("bad type", Type.GRID, ll.locType());
+ assertEquals("bad Y", SQRT2, ll.latOrY(), TOLERANCE);
+ assertEquals("bad X", PI, ll.longOrX(), TOLERANCE);
+ assertFalse("bad origin check", ll.isOrigin());
+ }
+
+ @Test
+ public void createGeoLocFromStringType() {
+ ll = layoutLocation(SOME_ID, "geo", SQRT2, PI);
+ assertEquals("bad type - not geo", Type.GEO, ll.locType());
+ }
+
+ @Test
+ public void createGridLocFromStringType() {
+ ll = layoutLocation(SOME_ID, "grid", SQRT2, PI);
+ assertEquals("bad type - not grid", Type.GRID, ll.locType());
+ }
+
+ @Test
+ public void zeroLatitude() {
+ ll = layoutLocation(SOME_ID, Type.GEO, ZERO, PI);
+ assertFalse("shouldn't be origin for zero latitude", ll.isOrigin());
+ }
+
+ @Test
+ public void zeroLongitude() {
+ ll = layoutLocation(SOME_ID, Type.GEO, PI, ZERO);
+ assertFalse("shouldn't be origin for zero longitude", ll.isOrigin());
+ }
+
+ @Test
+ public void origin() {
+ ll = layoutLocation(SOME_ID, Type.GRID, ZERO, ZERO);
+ assertTrue("should be origin", ll.isOrigin());
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void badType() {
+ layoutLocation(SOME_ID, "foo", ZERO, PI);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void nullId() {
+ layoutLocation(null, Type.GRID, PI, PI);
+ }
+}
diff --git a/tools/test/topos/regions-europe.sh b/tools/test/topos/regions-europe.sh
index d0f6d04..a0fcfbd 100755
--- a/tools/test/topos/regions-europe.sh
+++ b/tools/test/topos/regions-europe.sh
@@ -38,6 +38,8 @@
region-add rDE "Germany" COUNTRY 50.863152 9.761971 ${host}
region-add rES "Spain" COUNTRY 40.416704 -3.7035824 ${host}
+region-add rMilan "Milan" METRO 45.4654 9.1859 ${host}
+
EOF
@@ -60,7 +62,7 @@
layout-add lES @europe rES root 21.41 -9994.5 -10135.6
# -- layouts for country sub-regions
-# TODO
+layout-add lMilan +segmentRoutingTwo rMilan lIT 0.86 68.58 54.71
# -- summary of installed layouts
layouts
@@ -109,11 +111,11 @@
null-create-link direct Leeds Warrington
# -- UK Peers
-
-# rUK_rES 50.4060 -3.3860
-# rUK_rFR 50.4060 -1.8482
-# rUK_rIT 50.4060 -0.1361
-# rUK_rDE 50.4060 1.2491
+## TODO: figure out why this data isn't getting put into runtime config?!
+region-add-peer-loc rUK rES 50.4060 -3.3860
+region-add-peer-loc rUK rFR 50.4060 -1.8482
+region-add-peer-loc rUK rIT 50.4060 -0.1361
+region-add-peer-loc rUK rDE 50.4060 1.2491
# -- France Devices
@@ -151,10 +153,152 @@
# -- France Peers
-# rFR_rES 42.6806 -2.1273
-# rFR_rUK 50.6164 -2.1013
-# rFR_rIT 45.1105 9.7450
-# rFR_rDE 49.6307 7.9326
+region-add-peer-loc rFR rES 42.6806 -2.1273
+region-add-peer-loc rFR rUK 50.6164 -2.1013
+region-add-peer-loc rFR rIT 45.1105 9.7450
+region-add-peer-loc rFR rDE 49.6307 7.9326
+
+
+# -- Italy Devices
+
+# these four in a mini fabric (data center?)
+
+null-create-device switch Milan-1 ${nports} 10.0 20.0 grid
+null-create-device switch Milan-2 ${nports} 10.0 50.0 grid
+null-create-device switch Milan-3 ${nports} 45.0 20.0 grid
+null-create-device switch Milan-4 ${nports} 45.0 50.0 grid
+
+null-create-host Milan-3 192.168.3.13 60.0 15.0 grid
+null-create-host Milan-4 192.168.3.14 60.0 45.0 grid
+
+region-add-devices rMilan \
+ null:000000000000000c \
+ null:000000000000000d \
+ null:000000000000000e \
+ null:000000000000000f \
+
+null-create-device switch Venice ${nports} 45.4408 12.3155
+null-create-device switch Rome ${nports} 41.9028 12.4964
+null-create-device switch Naples ${nports} 40.8518 14.2681
+
+region-add-devices rIT \
+ null:0000000000000010 \
+ null:0000000000000011 \
+ null:0000000000000012 \
+
+# -- Italy Connectivity
+
+null-create-link direct Milan-1 Milan-3
+null-create-link direct Milan-1 Milan-4
+null-create-link direct Milan-2 Milan-3
+null-create-link direct Milan-2 Milan-4
+
+null-create-link direct Milan-1 Venice
+null-create-link direct Milan-2 Rome
+
+null-create-link direct Venice Rome
+null-create-link direct Venice Naples
+null-create-link direct Rome Naples
+
+# -- Italy Peers
+
+#region-add-peer-loc rIT rES xx.xxxx xx.xxxx
+#region-add-peer-loc rIT rUK xx.xxxx xx.xxxx
+#region-add-peer-loc rIT rFR xx.xxxx xx.xxxx
+#region-add-peer-loc rIT rDE xx.xxxx xx.xxxx
+
+# -- Germany Devices
+
+null-create-device switch Munich ${nports} 48.1351 11.5820
+null-create-device switch Berlin ${nports} 52.5200 13.4050
+null-create-device switch Bremen ${nports} 53.0793 8.8017
+null-create-device switch Frankfurt ${nports} 50.1109 8.6821
+null-create-device switch Stuttgart ${nports} 48.7758 9.1829
+
+null-create-host Munich 192.168.4.1 47.4818 11.7441
+null-create-host Berlin 192.168.4.2 53.0537 13.5310
+
+region-add-devices rDE \
+ null:0000000000000013 \
+ null:0000000000000014 \
+ null:0000000000000015 \
+ null:0000000000000016 \
+ null:0000000000000017 \
+
+# -- Germany Connectivity
+
+null-create-link direct Munich Berlin
+null-create-link direct Munich Stuttgart
+null-create-link direct Munich Stuttgart
+null-create-link direct Frankfurt Stuttgart
+null-create-link direct Frankfurt Bremen
+null-create-link direct Berlin Bremen
+null-create-link direct Berlin Frankfurt
+
+# -- Germany Peers
+
+#region-add-peer-loc rDE rES xx.xxxx xx.xxxx
+#region-add-peer-loc rDE rUK xx.xxxx xx.xxxx
+#region-add-peer-loc rDE rFR xx.xxxx xx.xxxx
+#region-add-peer-loc rDE rIT xx.xxxx xx.xxxx
+
+# -- Spain Devices
+
+null-create-device switch Madrid ${nports} 40.4168 -3.7038
+null-create-device switch Barcelona ${nports} 41.3851 2.1734
+null-create-device switch Valencia ${nports} 39.4699 -0.3763
+null-create-device switch Seville ${nports} 37.3891 -5.9845
+
+null-create-host Madrid 192.168.5.1 41.0797 -3.9559
+null-create-host Barcelona 192.168.5.2 41.8507 2.0399
+null-create-host Valencia 192.168.5.3 38.8488 -0.5097
+null-create-host Seville 192.168.5.4 38.0110 -6.4442
+
+region-add-devices rES \
+ null:0000000000000018 \
+ null:0000000000000019 \
+ null:000000000000001a \
+ null:000000000000001b \
+
+# -- Spain Connectivity
+
+null-create-link direct Barcelona Madrid
+null-create-link direct Barcelona Valencia
+null-create-link direct Seville Madrid
+null-create-link direct Seville Valencia
+null-create-link direct Madrid Valencia
+
+# -- Spain Peers
+
+#region-add-peer-loc rES rDE xx.xxxx xx.xxxx
+#region-add-peer-loc rES rUK xx.xxxx xx.xxxx
+#region-add-peer-loc rES rFR xx.xxxx xx.xxxx
+#region-add-peer-loc rES rIT xx.xxxx xx.xxxx
+
+
+# -- Inter-Region Connectivity
+
+# Spain-France
+null-create-link direct Barcelona Marseille
+null-create-link direct Madrid Bordeaux
+
+# France-Italy
+null-create-link direct Rome Nice
+null-create-link direct Milan-1 Lyon
+
+# Italy-Germany
+null-create-link direct Venice Munich
+
+# France-Germany
+null-create-link direct Lyon Stuttgart
+null-create-link direct Paris Frankfurt
+
+# England-France
+null-create-link direct Portsmouth Paris
+
+# England-Germany
+null-create-link direct London Bremen
+null-create-link direct London Frankfurt
EOF
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 24fda23..2377499 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
@@ -79,6 +79,10 @@
private static final Logger log = LoggerFactory.getLogger(ModelCache.class);
+ // TODO: add NetworkConfigService to service bundle
+// private final NetworkConfigService cfgService =
+// DefaultServiceDirectory.getService(NetworkConfigService.class);
+
private final ServiceBundle services;
private final EventDispatcher dispatcher;
private final UiTopology uiTopology = new UiTopology();
@@ -563,6 +567,11 @@
services.region().getRegions().forEach(r -> {
RegionId rid = r.id();
+
+// BasicRegionConfig rcfg = cfgService.getConfig(rid, BasicRegionConfig.class);
+// services.netcfg() ...
+ // TODO: figure out how to include peer-location data in UiRegion instance
+
UiRegion region = uiTopology.findRegion(rid);
if (region != null) {
reconcileDevicesAndHostsWithRegion(allDevices, allHosts, rid, region);
@@ -600,7 +609,7 @@
allDevices.remove(dev);
} else {
log.warn("Region device ID {} but no UiDevice in topology",
- devId);
+ devId);
}
Set<Host> hosts = services.host().getConnectedHosts(devId);
@@ -614,7 +623,7 @@
allHosts.remove(host);
} else {
log.warn("Region host ID {} but no UiHost in topology",
- hid);
+ hid);
}
}
});
diff --git a/web/gui/src/main/webapp/app/fw/svg/spriteData.js b/web/gui/src/main/webapp/app/fw/svg/spriteData.js
index b806ae9..1625a46 100644
--- a/web/gui/src/main/webapp/app/fw/svg/spriteData.js
+++ b/web/gui/src/main/webapp/app/fw/svg/spriteData.js
@@ -71,6 +71,12 @@
.addLabel('Segment Routing', 120, 10, {anchor: 'right'})
.register();
+ ssApi.createLayout('segmentRoutingTwo', 70, 75)
+ .addSprite('rack', 10, 40, 20)
+ .addSprite('rack', 40, 40, 20)
+ .addLabel('Segment Routing 2', 120, 10, {anchor: 'right'})
+ .register();
+
ssApi.dump();
// ----------------------------------------------------------$$$
}
diff --git a/web/gui/src/main/webapp/app/view/topo2/topo2-theme.css b/web/gui/src/main/webapp/app/view/topo2/topo2-theme.css
index bb26930..cdd84b3 100644
--- a/web/gui/src/main/webapp/app/view/topo2/topo2-theme.css
+++ b/web/gui/src/main/webapp/app/view/topo2/topo2-theme.css
@@ -196,7 +196,6 @@
}
#ov-topo2 svg .node.sub-region text {
- stroke: #000000;
}
#ov-topo2 svg .node.sub-region use {
@@ -607,7 +606,6 @@
}
.dark #ov-topo2 svg .node.sub-region text {
- stroke: #eeeeee;
}
.dark #ov-topo2 svg .node.sub-region use {