GUI - added remapping of device type to glyph ID.
- this is so we can remap 'virtual' device type to 'cord' glyph (E-CORD demo)
- added ecord mock-server scenario.
Change-Id: I1a0ad48752f86ffb8abc75fbdc9bf8eabf10f692
diff --git a/web/gui/src/main/webapp/app/view/topo/topoD3.js b/web/gui/src/main/webapp/app/view/topo/topoD3.js
index c1315ff..a14ccbe 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoD3.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoD3.js
@@ -68,6 +68,17 @@
e: 'badgeError'
};
+ // NOTE: this type of hack should go away once we have implemented
+ // the server-side UiModel code.
+ // {virtual -> cord} is for the E-CORD demo at ONS 2016
+ var remappedDeviceTypes = {
+ virtual: 'cord'
+ };
+
+ function mapDeviceTypeToGlyph(type) {
+ return remappedDeviceTypes[type] || type || 'unknown';
+ }
+
function badgeStatus(badge) {
return status[badge.status] || status.i;
}
@@ -311,9 +322,8 @@
function deviceEnter(d) {
var node = d3.select(this),
- glyphId = d.type || 'unknown',
+ glyphId = mapDeviceTypeToGlyph(d.type),
label = trimLabel(deviceLabel(d)),
- //devCfg = deviceIconConfig,
noLabel = !label,
box, dx, dy, icon;
diff --git a/web/gui/src/test/_karma/ev/ecord/ev_1_addInstance.json b/web/gui/src/test/_karma/ev/ecord/ev_1_addInstance.json
new file mode 100644
index 0000000..20be9e2
--- /dev/null
+++ b/web/gui/src/test/_karma/ev/ecord/ev_1_addInstance.json
@@ -0,0 +1,14 @@
+{
+ "event": "addInstance",
+ "payload": {
+ "id": "ONOS",
+ "ip": "192.168.56.101",
+ "online": true,
+ "uiAttached": true,
+ "switches": 4,
+ "labels": [
+ "ONOS",
+ "192.168.56.101"
+ ]
+ }
+}
diff --git a/web/gui/src/test/_karma/ev/ecord/ev_2_addDevice_otn1.json b/web/gui/src/test/_karma/ev/ecord/ev_2_addDevice_otn1.json
new file mode 100644
index 0000000..43d172b
--- /dev/null
+++ b/web/gui/src/test/_karma/ev/ecord/ev_2_addDevice_otn1.json
@@ -0,0 +1,18 @@
+{
+ "event": "addDevice",
+ "payload": {
+ "id": "of:0000000000000001",
+ "type": "otn",
+ "online": true,
+ "master": "ONOS",
+ "labels": [
+ "",
+ "otn-1",
+ "of:0000000000000001"
+ ],
+ "metaUi": {
+ "x": 200,
+ "y": 200
+ }
+ }
+}
diff --git a/web/gui/src/test/_karma/ev/ecord/ev_3_addDevice_otn2.json b/web/gui/src/test/_karma/ev/ecord/ev_3_addDevice_otn2.json
new file mode 100644
index 0000000..aad26bd
--- /dev/null
+++ b/web/gui/src/test/_karma/ev/ecord/ev_3_addDevice_otn2.json
@@ -0,0 +1,18 @@
+{
+ "event": "addDevice",
+ "payload": {
+ "id": "of:0000000000000002",
+ "type": "otn",
+ "online": true,
+ "master": "ONOS",
+ "labels": [
+ "",
+ "otn-2",
+ "of:0000000000000002"
+ ],
+ "metaUi": {
+ "x": 400,
+ "y": 150
+ }
+ }
+}
diff --git a/web/gui/src/test/_karma/ev/ecord/ev_4_addDevice_virtual.json b/web/gui/src/test/_karma/ev/ecord/ev_4_addDevice_virtual.json
new file mode 100644
index 0000000..20eb582
--- /dev/null
+++ b/web/gui/src/test/_karma/ev/ecord/ev_4_addDevice_virtual.json
@@ -0,0 +1,18 @@
+{
+ "event": "addDevice",
+ "payload": {
+ "id": "of:0000000000003333",
+ "type": "virtual",
+ "online": true,
+ "master": "foo",
+ "labels": [
+ "",
+ "cord",
+ "of:0000000000003333"
+ ],
+ "metaUi": {
+ "x": 200,
+ "y": 400
+ }
+ }
+}
diff --git a/web/gui/src/test/_karma/ev/ecord/ev_5_addLink_otns.json b/web/gui/src/test/_karma/ev/ecord/ev_5_addLink_otns.json
new file mode 100644
index 0000000..19fbf74
--- /dev/null
+++ b/web/gui/src/test/_karma/ev/ecord/ev_5_addLink_otns.json
@@ -0,0 +1,13 @@
+{
+ "event": "addLink",
+ "payload": {
+ "id": "of:0000000000000001/1-of:0000000000000002/2",
+ "type": "direct",
+ "online": true,
+ "linkWidth": 2,
+ "src": "of:0000000000000001",
+ "srcPort": "1",
+ "dst": "of:0000000000000002",
+ "dstPort": "2"
+ }
+}
diff --git a/web/gui/src/test/_karma/ev/ecord/ev_6_addLink_rev_otns.json b/web/gui/src/test/_karma/ev/ecord/ev_6_addLink_rev_otns.json
new file mode 100644
index 0000000..9a20066
--- /dev/null
+++ b/web/gui/src/test/_karma/ev/ecord/ev_6_addLink_rev_otns.json
@@ -0,0 +1,13 @@
+{
+ "event": "addLink",
+ "payload": {
+ "id": "of:0000000000000002/2-of:0000000000000001/1",
+ "type": "direct",
+ "online": true,
+ "linkWidth": 2,
+ "src": "of:0000000000000002",
+ "srcPort": "2",
+ "dst": "of:0000000000000001",
+ "dstPort": "1"
+ }
+}
diff --git a/web/gui/src/test/_karma/ev/ecord/ev_7_addLink_otn1_virt.json b/web/gui/src/test/_karma/ev/ecord/ev_7_addLink_otn1_virt.json
new file mode 100644
index 0000000..3e2d9a9
--- /dev/null
+++ b/web/gui/src/test/_karma/ev/ecord/ev_7_addLink_otn1_virt.json
@@ -0,0 +1,13 @@
+{
+ "event": "addLink",
+ "payload": {
+ "id": "of:0000000000000001/9-of:0000000000003333/1",
+ "type": "direct",
+ "online": true,
+ "linkWidth": 2,
+ "src": "of:0000000000000001",
+ "srcPort": "9",
+ "dst": "of:0000000000003333",
+ "dstPort": "1"
+ }
+}
diff --git a/web/gui/src/test/_karma/ev/ecord/ev_8_addLink_rev_otn1_virt.json b/web/gui/src/test/_karma/ev/ecord/ev_8_addLink_rev_otn1_virt.json
new file mode 100644
index 0000000..dcc9efd
--- /dev/null
+++ b/web/gui/src/test/_karma/ev/ecord/ev_8_addLink_rev_otn1_virt.json
@@ -0,0 +1,13 @@
+{
+ "event": "addLink",
+ "payload": {
+ "id": "of:0000000000003333/1-of:0000000000000001/9",
+ "type": "direct",
+ "online": true,
+ "linkWidth": 2,
+ "src": "of:0000000000003333",
+ "srcPort": "1",
+ "dst": "of:0000000000000001",
+ "dstPort": "9"
+ }
+}
diff --git a/web/gui/src/test/_karma/ev/ecord/scenario.json b/web/gui/src/test/_karma/ev/ecord/scenario.json
new file mode 100644
index 0000000..baf2b16
--- /dev/null
+++ b/web/gui/src/test/_karma/ev/ecord/scenario.json
@@ -0,0 +1,9 @@
+{
+ "title": "Show E-CORD Topology",
+ "params": {
+ "lastAuto": 8
+ },
+ "description": [
+ "Show E-CORD topology, including a couple of 'virtual' devices."
+ ]
+}