diff options
Diffstat (limited to 'framework/src/onos/web/gui/src')
19 files changed, 127 insertions, 32 deletions
diff --git a/framework/src/onos/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandler.java b/framework/src/onos/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandler.java index 82b7a782..700e57e3 100644 --- a/framework/src/onos/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandler.java +++ b/framework/src/onos/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandler.java @@ -289,6 +289,7 @@ public class TopologyViewMessageHandler extends TopologyViewMessageHandlerBase { @Override public void process(long sid, ObjectNode payload) { + removeListeners(); stopSummaryMonitoring(); traffic.stopMonitoring(); } diff --git a/framework/src/onos/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandlerBase.java b/framework/src/onos/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandlerBase.java index 840e89f3..f35b6c03 100644 --- a/framework/src/onos/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandlerBase.java +++ b/framework/src/onos/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandlerBase.java @@ -20,6 +20,7 @@ import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import org.onlab.osgi.ServiceDirectory; import org.onlab.packet.IpAddress; +import org.onlab.util.DefaultHashMap; import org.onosproject.cluster.ClusterEvent; import org.onosproject.cluster.ClusterService; import org.onosproject.cluster.ControllerNode; @@ -80,17 +81,9 @@ import java.util.concurrent.ConcurrentHashMap; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Strings.isNullOrEmpty; -import static org.onosproject.cluster.ClusterEvent.Type.INSTANCE_ADDED; -import static org.onosproject.cluster.ClusterEvent.Type.INSTANCE_REMOVED; import static org.onosproject.cluster.ControllerNode.State.ACTIVE; import static org.onosproject.net.DefaultEdgeLink.createEdgeLink; import static org.onosproject.net.PortNumber.portNumber; -import static org.onosproject.net.device.DeviceEvent.Type.DEVICE_ADDED; -import static org.onosproject.net.device.DeviceEvent.Type.DEVICE_REMOVED; -import static org.onosproject.net.host.HostEvent.Type.HOST_ADDED; -import static org.onosproject.net.host.HostEvent.Type.HOST_REMOVED; -import static org.onosproject.net.link.LinkEvent.Type.LINK_ADDED; -import static org.onosproject.net.link.LinkEvent.Type.LINK_REMOVED; import static org.onosproject.ui.topo.TopoConstants.CoreButtons; import static org.onosproject.ui.topo.TopoConstants.Properties; import static org.onosproject.ui.topo.TopoUtils.compactLinkString; @@ -100,6 +93,33 @@ import static org.onosproject.ui.topo.TopoUtils.compactLinkString; */ public abstract class TopologyViewMessageHandlerBase extends UiMessageHandler { + // default to an "add" event... + private static final DefaultHashMap<ClusterEvent.Type, String> CLUSTER_EVENT = + new DefaultHashMap<>("addInstance"); + + // default to an "update" event... + private static final DefaultHashMap<DeviceEvent.Type, String> DEVICE_EVENT = + new DefaultHashMap<>("updateDevice"); + private static final DefaultHashMap<LinkEvent.Type, String> LINK_EVENT = + new DefaultHashMap<>("updateLink"); + private static final DefaultHashMap<HostEvent.Type, String> HOST_EVENT = + new DefaultHashMap<>("updateHost"); + + // but call out specific events that we care to differentiate... + static { + CLUSTER_EVENT.put(ClusterEvent.Type.INSTANCE_REMOVED, "removeInstance"); + + DEVICE_EVENT.put(DeviceEvent.Type.DEVICE_ADDED, "addDevice"); + DEVICE_EVENT.put(DeviceEvent.Type.DEVICE_REMOVED, "removeDevice"); + + LINK_EVENT.put(LinkEvent.Type.LINK_ADDED, "addLink"); + LINK_EVENT.put(LinkEvent.Type.LINK_REMOVED, "removeLink"); + + HOST_EVENT.put(HostEvent.Type.HOST_ADDED, "addHost"); + HOST_EVENT.put(HostEvent.Type.HOST_REMOVED, "removeHost"); + HOST_EVENT.put(HostEvent.Type.HOST_MOVED, "moveHost"); + } + protected static final Logger log = LoggerFactory.getLogger(TopologyViewMessageHandlerBase.class); @@ -204,7 +224,7 @@ public abstract class TopologyViewMessageHandlerBase extends UiMessageHandler { } // Produces a cluster instance message to the client. - protected ObjectNode instanceMessage(ClusterEvent event, String messageType) { + protected ObjectNode instanceMessage(ClusterEvent event, String msgType) { ControllerNode node = event.subject(); int switchCount = mastershipService.getDevicesOf(node.id()).size(); ObjectNode payload = objectNode() @@ -222,10 +242,7 @@ public abstract class TopologyViewMessageHandlerBase extends UiMessageHandler { payload.set("labels", labels); addMetaUi(node.id().toString(), payload); - String type = messageType != null ? messageType : - ((event.type() == INSTANCE_ADDED) ? "addInstance" : - ((event.type() == INSTANCE_REMOVED ? "removeInstance" : - "addInstance"))); + String type = msgType != null ? msgType : CLUSTER_EVENT.get(event.type()); return JsonUtils.envelope(type, 0, payload); } @@ -251,8 +268,7 @@ public abstract class TopologyViewMessageHandlerBase extends UiMessageHandler { addGeoLocation(device, payload); addMetaUi(device.id().toString(), payload); - String type = (event.type() == DEVICE_ADDED) ? "addDevice" : - ((event.type() == DEVICE_REMOVED) ? "removeDevice" : "updateDevice"); + String type = DEVICE_EVENT.get(event.type()); return JsonUtils.envelope(type, 0, payload); } @@ -268,29 +284,32 @@ public abstract class TopologyViewMessageHandlerBase extends UiMessageHandler { .put("srcPort", link.src().port().toString()) .put("dst", link.dst().deviceId().toString()) .put("dstPort", link.dst().port().toString()); - String type = (event.type() == LINK_ADDED) ? "addLink" : - ((event.type() == LINK_REMOVED) ? "removeLink" : "updateLink"); + String type = LINK_EVENT.get(event.type()); return JsonUtils.envelope(type, 0, payload); } // Produces a host event message to the client. protected ObjectNode hostMessage(HostEvent event) { Host host = event.subject(); + Host prevHost = event.prevSubject(); String hostType = host.annotations().value(AnnotationKeys.TYPE); + ObjectNode payload = objectNode() .put("id", host.id().toString()) .put("type", isNullOrEmpty(hostType) ? "endstation" : hostType) .put("ingress", compactLinkString(edgeLink(host, true))) .put("egress", compactLinkString(edgeLink(host, false))); payload.set("cp", hostConnect(host.location())); + if (prevHost != null && prevHost.location() != null) { + payload.set("prevCp", hostConnect(prevHost.location())); + } payload.set("labels", labels(ip(host.ipAddresses()), host.mac().toString())); payload.set("props", props(host.annotations())); addGeoLocation(host, payload); addMetaUi(host.id().toString(), payload); - String type = (event.type() == HOST_ADDED) ? "addHost" : - ((event.type() == HOST_REMOVED) ? "removeHost" : "updateHost"); + String type = HOST_EVENT.get(event.type()); return JsonUtils.envelope(type, 0, payload); } diff --git a/framework/src/onos/web/gui/src/main/webapp/app/fw/svg/icon.js b/framework/src/onos/web/gui/src/main/webapp/app/fw/svg/icon.js index 12536361..cc26360f 100644 --- a/framework/src/onos/web/gui/src/main/webapp/app/fw/svg/icon.js +++ b/framework/src/onos/web/gui/src/main/webapp/app/fw/svg/icon.js @@ -51,6 +51,7 @@ devIcon_SWITCH: 'switch', devIcon_ROADM: 'roadm', + deviceTable: 'switch', flowTable: 'flowTable', portTable: 'portTable', groupTable: 'groupTable', diff --git a/framework/src/onos/web/gui/src/main/webapp/app/view/device/device.css b/framework/src/onos/web/gui/src/main/webapp/app/view/device/device.css index e0e9cf57..8d8a582b 100644 --- a/framework/src/onos/web/gui/src/main/webapp/app/view/device/device.css +++ b/framework/src/onos/web/gui/src/main/webapp/app/view/device/device.css @@ -23,7 +23,20 @@ } #ov-device div.ctrl-btns { - width: 240px; +} + +.light #ov-device .current-view use { + fill: white; +} +.dark #ov-device .current-view use { + fill: #304860; +} + +.light #ov-device .current-view rect { + fill: deepskyblue; +} +.dark #ov-device .current-view rect { + fill: #eee; } /* More in generic panel.css */ diff --git a/framework/src/onos/web/gui/src/main/webapp/app/view/device/device.html b/framework/src/onos/web/gui/src/main/webapp/app/view/device/device.html index 63a04db8..6f1813a0 100644 --- a/framework/src/onos/web/gui/src/main/webapp/app/view/device/device.html +++ b/framework/src/onos/web/gui/src/main/webapp/app/view/device/device.html @@ -9,6 +9,9 @@ ng-click="toggleRefresh()"></div> <div class="separator"></div> + <div ng-class="{'current-view': !!selId}" + icon icon-id="deviceTable" icon-size="36"></div> + <div ng-class="{active: !!selId}" icon icon-id="flowTable" icon-size="36" tooltip tt-msg="flowTip" diff --git a/framework/src/onos/web/gui/src/main/webapp/app/view/flow/flow.css b/framework/src/onos/web/gui/src/main/webapp/app/view/flow/flow.css index 4aa96210..30226222 100644 --- a/framework/src/onos/web/gui/src/main/webapp/app/view/flow/flow.css +++ b/framework/src/onos/web/gui/src/main/webapp/app/view/flow/flow.css @@ -23,7 +23,6 @@ } #ov-flow div.ctrl-btns { - width: 240px; } .light #ov-flow .current-view use { diff --git a/framework/src/onos/web/gui/src/main/webapp/app/view/flow/flow.html b/framework/src/onos/web/gui/src/main/webapp/app/view/flow/flow.html index 5fce98cf..8fc1839e 100644 --- a/framework/src/onos/web/gui/src/main/webapp/app/view/flow/flow.html +++ b/framework/src/onos/web/gui/src/main/webapp/app/view/flow/flow.html @@ -13,6 +13,11 @@ <div class="separator"></div> + <div class="active" + icon icon-id="deviceTable" icon-size="36" + tooltip tt-msg="deviceTip" + ng-click="nav('device')"></div> + <div class="current-view" icon icon-id="flowTable" icon-size="36"></div> diff --git a/framework/src/onos/web/gui/src/main/webapp/app/view/flow/flow.js b/framework/src/onos/web/gui/src/main/webapp/app/view/flow/flow.js index 15678d5e..7bb988a2 100644 --- a/framework/src/onos/web/gui/src/main/webapp/app/view/flow/flow.js +++ b/framework/src/onos/web/gui/src/main/webapp/app/view/flow/flow.js @@ -37,6 +37,7 @@ fs = _fs_; tbs = _tbs_; ns = _ns_; + $scope.deviceTip = 'Show device table'; $scope.portTip = 'Show port view for this device'; $scope.groupTip = 'Show group view for this device'; diff --git a/framework/src/onos/web/gui/src/main/webapp/app/view/group/group.css b/framework/src/onos/web/gui/src/main/webapp/app/view/group/group.css index 42f1c31d..6773aa83 100644 --- a/framework/src/onos/web/gui/src/main/webapp/app/view/group/group.css +++ b/framework/src/onos/web/gui/src/main/webapp/app/view/group/group.css @@ -23,7 +23,6 @@ } #ov-group div.ctrl-btns { - width: 240px; } .light #ov-group .current-view use { diff --git a/framework/src/onos/web/gui/src/main/webapp/app/view/group/group.html b/framework/src/onos/web/gui/src/main/webapp/app/view/group/group.html index b963f469..93484dc8 100644 --- a/framework/src/onos/web/gui/src/main/webapp/app/view/group/group.html +++ b/framework/src/onos/web/gui/src/main/webapp/app/view/group/group.html @@ -30,6 +30,11 @@ <div class="separator"></div> <div class="active" + icon icon-id="deviceTable" icon-size="36" + tooltip tt-msg="deviceTip" + ng-click="nav('device')"></div> + + <div class="active" icon icon-id="flowTable" icon-size="36" tooltip tt-msg="flowTip" ng-click="nav('flow')"></div> diff --git a/framework/src/onos/web/gui/src/main/webapp/app/view/group/group.js b/framework/src/onos/web/gui/src/main/webapp/app/view/group/group.js index 2510190b..2cb1f0c4 100644 --- a/framework/src/onos/web/gui/src/main/webapp/app/view/group/group.js +++ b/framework/src/onos/web/gui/src/main/webapp/app/view/group/group.js @@ -37,6 +37,7 @@ fs = _fs_; tbs = _tbs_; ns = _ns_; + $scope.deviceTip = 'Show device table'; $scope.flowTip = 'Show flow view for this device'; $scope.portTip = 'Show port view for this device'; diff --git a/framework/src/onos/web/gui/src/main/webapp/app/view/port/port.css b/framework/src/onos/web/gui/src/main/webapp/app/view/port/port.css index 7fcfee3f..2aaacfce 100644 --- a/framework/src/onos/web/gui/src/main/webapp/app/view/port/port.css +++ b/framework/src/onos/web/gui/src/main/webapp/app/view/port/port.css @@ -23,7 +23,6 @@ } #ov-port div.ctrl-btns { - width: 240px; } .light #ov-port .current-view use { diff --git a/framework/src/onos/web/gui/src/main/webapp/app/view/port/port.html b/framework/src/onos/web/gui/src/main/webapp/app/view/port/port.html index 8eecb9d6..fa79e5ea 100644 --- a/framework/src/onos/web/gui/src/main/webapp/app/view/port/port.html +++ b/framework/src/onos/web/gui/src/main/webapp/app/view/port/port.html @@ -30,6 +30,11 @@ <div class="separator"></div> <div class="active" + icon icon-id="deviceTable" icon-size="36" + tooltip tt-msg="deviceTip" + ng-click="nav('device')"></div> + + <div class="active" icon icon-id="flowTable" icon-size="36" tooltip tt-msg="flowTip" ng-click="nav('flow')"></div> diff --git a/framework/src/onos/web/gui/src/main/webapp/app/view/port/port.js b/framework/src/onos/web/gui/src/main/webapp/app/view/port/port.js index a157c5be..1e8585dd 100644 --- a/framework/src/onos/web/gui/src/main/webapp/app/view/port/port.js +++ b/framework/src/onos/web/gui/src/main/webapp/app/view/port/port.js @@ -37,6 +37,7 @@ fs = _fs_; tbs = _tbs_; ns = _ns_; + $scope.deviceTip = 'Show device table'; $scope.flowTip = 'Show flow view for this device'; $scope.groupTip = 'Show group view for this device'; diff --git a/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topo.js b/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topo.js index 7ddfd136..702584af 100644 --- a/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topo.js +++ b/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topo.js @@ -30,7 +30,7 @@ // references to injected services etc. var $scope, $log, $cookies, fs, ks, zs, gs, ms, sus, flash, wss, ps, - tes, tfs, tps, tis, tss, tls, tts, tos, fltr, ttbs, ttip, tov; + tds, tes, tfs, tps, tis, tss, tls, tts, tos, fltr, ttbs, ttip, tov; // DOM elements var ovtopo, svg, defs, zoomLayer, mapG, spriteG, forceG, noDevsLayer; @@ -425,7 +425,7 @@ .controller('OvTopoCtrl', ['$scope', '$log', '$location', '$timeout', '$cookies', 'FnService', 'MastService', 'KeyService', 'ZoomService', 'GlyphService', 'MapService', 'SvgUtilService', 'FlashService', - 'WebSocketService', 'PrefsService', + 'WebSocketService', 'PrefsService', 'TopoDialogService', 'TopoEventService', 'TopoForceService', 'TopoPanelService', 'TopoInstService', 'TopoSelectService', 'TopoLinkService', 'TopoTrafficService', 'TopoObliqueService', 'TopoFilterService', @@ -433,9 +433,9 @@ 'TopoOverlayService', function (_$scope_, _$log_, $loc, $timeout, _$cookies_, _fs_, mast, _ks_, - _zs_, _gs_, _ms_, _sus_, _flash_, _wss_, _ps_, _tes_, _tfs_, - _tps_, _tis_, _tss_, _tls_, _tts_, _tos_, _fltr_, _ttbs_, tspr, - _ttip_, _tov_) { + _zs_, _gs_, _ms_, _sus_, _flash_, _wss_, _ps_, _tds_, _tes_, + _tfs_, _tps_, _tis_, _tss_, _tls_, _tts_, _tos_, _fltr_, + _ttbs_, tspr, _ttip_, _tov_) { var params = $loc.search(), projection, dim, @@ -461,6 +461,7 @@ flash = _flash_; wss = _wss_; ps = _ps_; + tds = _tds_; tes = _tes_; tfs = _tfs_; // TODO: consider funnelling actions through TopoForceService... @@ -495,6 +496,7 @@ tes.stop(); ks.unbindKeys(); tps.destroyPanels(); + tds.closeDialog(); tis.destroyInst(); tfs.destroyForce(); ttbs.destroyToolbar(); diff --git a/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoDialog.js b/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoDialog.js index 93079183..0c47511b 100644 --- a/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoDialog.js +++ b/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoDialog.js @@ -106,6 +106,13 @@ .on('click', invoke); } + function setTitle(title) { + if (pApi) { + pApi.appendHeader('h2').text(title); + } + return dApi; + } + function addContent(content) { if (pApi) { pApi.appendBody(content); @@ -127,11 +134,11 @@ pApi = createDialog(); } pApi.reset(); - pApi.appendHeader('h2').text('=dialog='); panel.show(); // return the dialog object API dApi = { + setTitle: setTitle, addContent: addContent, addButton: addButton }; diff --git a/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoEvent.js b/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoEvent.js index 2957629a..9b07f878 100644 --- a/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoEvent.js +++ b/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoEvent.js @@ -55,6 +55,7 @@ removeDevice: tfs, addHost: tfs, updateHost: tfs, + moveHost: tfs, removeHost: tfs, addLink: tfs, updateLink: tfs, diff --git a/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoForce.js b/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoForce.js index 844d7dc9..175ee796 100644 --- a/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoForce.js +++ b/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoForce.js @@ -187,6 +187,35 @@ } } + function moveHost(data) { + var id = data.id, + d = lu[id], + lnk; + if (d) { + // first remove the old host link + removeLinkElement(d.linkData); + + // merge new data + angular.extend(d, data); + if (tms.positionNode(d, true)) { + sendUpdateMeta(d); + } + + // now create a new host link + lnk = tms.createHostLink(data); + if (lnk) { + d.linkData = lnk; + network.links.push(lnk); + lu[d.ingress] = lnk; + lu[d.egress] = lnk; + } + + updateNodes(); + updateLinks(); + fResume(); + } + } + function removeHost(data) { var id = data.id, d = lu[id]; @@ -1142,6 +1171,7 @@ removeDevice: removeDevice, addHost: addHost, updateHost: updateHost, + moveHost: moveHost, removeHost: removeHost, addLink: addLink, updateLink: updateLink, diff --git a/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoToolbar.js b/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoToolbar.js index 06285442..804e2a3c 100644 --- a/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoToolbar.js +++ b/framework/src/onos/web/gui/src/main/webapp/app/view/topo/topoToolbar.js @@ -23,7 +23,7 @@ 'use strict'; // injected references - var $log, fs, tbs, ps, tov, api; + var $log, fs, tbs, ps, tov, tds, api; // API: // getActionEntry @@ -192,6 +192,8 @@ }); } + // ensure dialog has closed (if opened by outgoing overlay) + tds.closeDialog(); thirdRow.clear(); if (!order.length) { @@ -271,14 +273,15 @@ angular.module('ovTopo') .factory('TopoToolbarService', ['$log', 'FnService', 'ToolbarService', 'PrefsService', - 'TopoOverlayService', + 'TopoOverlayService', 'TopoDialogService', - function (_$log_, _fs_, _tbs_, _ps_, _tov_) { + function (_$log_, _fs_, _tbs_, _ps_, _tov_, _tds_) { $log = _$log_; fs = _fs_; tbs = _tbs_; ps = _ps_; tov = _tov_; + tds = _tds_; return { init: init, |