Simon Hunt

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
...@@ -68,6 +68,17 @@ ...@@ -68,6 +68,17 @@
68 e: 'badgeError' 68 e: 'badgeError'
69 }; 69 };
70 70
71 + // NOTE: this type of hack should go away once we have implemented
72 + // the server-side UiModel code.
73 + // {virtual -> cord} is for the E-CORD demo at ONS 2016
74 + var remappedDeviceTypes = {
75 + virtual: 'cord'
76 + };
77 +
78 + function mapDeviceTypeToGlyph(type) {
79 + return remappedDeviceTypes[type] || type || 'unknown';
80 + }
81 +
71 function badgeStatus(badge) { 82 function badgeStatus(badge) {
72 return status[badge.status] || status.i; 83 return status[badge.status] || status.i;
73 } 84 }
...@@ -311,9 +322,8 @@ ...@@ -311,9 +322,8 @@
311 322
312 function deviceEnter(d) { 323 function deviceEnter(d) {
313 var node = d3.select(this), 324 var node = d3.select(this),
314 - glyphId = d.type || 'unknown', 325 + glyphId = mapDeviceTypeToGlyph(d.type),
315 label = trimLabel(deviceLabel(d)), 326 label = trimLabel(deviceLabel(d)),
316 - //devCfg = deviceIconConfig,
317 noLabel = !label, 327 noLabel = !label,
318 box, dx, dy, icon; 328 box, dx, dy, icon;
319 329
......
1 +{
2 + "event": "addInstance",
3 + "payload": {
4 + "id": "ONOS",
5 + "ip": "192.168.56.101",
6 + "online": true,
7 + "uiAttached": true,
8 + "switches": 4,
9 + "labels": [
10 + "ONOS",
11 + "192.168.56.101"
12 + ]
13 + }
14 +}
1 +{
2 + "event": "addDevice",
3 + "payload": {
4 + "id": "of:0000000000000001",
5 + "type": "otn",
6 + "online": true,
7 + "master": "ONOS",
8 + "labels": [
9 + "",
10 + "otn-1",
11 + "of:0000000000000001"
12 + ],
13 + "metaUi": {
14 + "x": 200,
15 + "y": 200
16 + }
17 + }
18 +}
1 +{
2 + "event": "addDevice",
3 + "payload": {
4 + "id": "of:0000000000000002",
5 + "type": "otn",
6 + "online": true,
7 + "master": "ONOS",
8 + "labels": [
9 + "",
10 + "otn-2",
11 + "of:0000000000000002"
12 + ],
13 + "metaUi": {
14 + "x": 400,
15 + "y": 150
16 + }
17 + }
18 +}
1 +{
2 + "event": "addDevice",
3 + "payload": {
4 + "id": "of:0000000000003333",
5 + "type": "virtual",
6 + "online": true,
7 + "master": "foo",
8 + "labels": [
9 + "",
10 + "cord",
11 + "of:0000000000003333"
12 + ],
13 + "metaUi": {
14 + "x": 200,
15 + "y": 400
16 + }
17 + }
18 +}
1 +{
2 + "event": "addLink",
3 + "payload": {
4 + "id": "of:0000000000000001/1-of:0000000000000002/2",
5 + "type": "direct",
6 + "online": true,
7 + "linkWidth": 2,
8 + "src": "of:0000000000000001",
9 + "srcPort": "1",
10 + "dst": "of:0000000000000002",
11 + "dstPort": "2"
12 + }
13 +}
1 +{
2 + "event": "addLink",
3 + "payload": {
4 + "id": "of:0000000000000002/2-of:0000000000000001/1",
5 + "type": "direct",
6 + "online": true,
7 + "linkWidth": 2,
8 + "src": "of:0000000000000002",
9 + "srcPort": "2",
10 + "dst": "of:0000000000000001",
11 + "dstPort": "1"
12 + }
13 +}
1 +{
2 + "event": "addLink",
3 + "payload": {
4 + "id": "of:0000000000000001/9-of:0000000000003333/1",
5 + "type": "direct",
6 + "online": true,
7 + "linkWidth": 2,
8 + "src": "of:0000000000000001",
9 + "srcPort": "9",
10 + "dst": "of:0000000000003333",
11 + "dstPort": "1"
12 + }
13 +}
1 +{
2 + "event": "addLink",
3 + "payload": {
4 + "id": "of:0000000000003333/1-of:0000000000000001/9",
5 + "type": "direct",
6 + "online": true,
7 + "linkWidth": 2,
8 + "src": "of:0000000000003333",
9 + "srcPort": "1",
10 + "dst": "of:0000000000000001",
11 + "dstPort": "9"
12 + }
13 +}
1 +{
2 + "title": "Show E-CORD Topology",
3 + "params": {
4 + "lastAuto": 8
5 + },
6 + "description": [
7 + "Show E-CORD topology, including a couple of 'virtual' devices."
8 + ]
9 +}