Simon Hunt

GUI -- Added "devices" scenario to display all device types.

 - added "query" glyph.
 - added glyphDefined() predicate to glyph service.
 - made sure query glyph is displayed if a device type for which there is no corresponding glyph is encountered.

Change-Id: Id5339ad3b666b885e096ced57760c5f84d8bcfc2
...@@ -55,6 +55,15 @@ ...@@ -55,6 +55,15 @@
55 unknown: "M35,40a5,5,0,0,1,5-5h30a5,5,0,0,1,5,5v30a5,5,0,0,1-5,5" + 55 unknown: "M35,40a5,5,0,0,1,5-5h30a5,5,0,0,1,5,5v30a5,5,0,0,1-5,5" +
56 "h-30a5,5,0,0,1-5-5z", 56 "h-30a5,5,0,0,1-5-5z",
57 57
58 + query: "M51.4,69.9c0-0.9,0-1.6,0-2.1c0-2.7,0.4-5.1,1.2-7.1" +
59 + "c0.6-1.5,1.5-3,2.8-4.5c0.9-1.1,2.6-2.7,5.1-4.8c2.4-2.1,4-3.8," +
60 + "4.8-5.1 c0.7-1.3,1.1-2.6,1.1-4.1c0-2.7-1.1-5.1-3.2-7.1c-2.1-2" +
61 + "-4.8-3.1-7.9-3.1c-3,0-5.5,0.9-7.5,2.8c-2,1.9-3.3,4.8-4,8.7l-7.2" +
62 + "-0.8 c0.7-5.3,2.6-9.3,5.8-12.1c3.2-2.8,7.5-4.2,12.8-4.2c5.6,0," +
63 + "10.1,1.5,13.4,4.5c3.3,3,5,6.7,5,10.9c0,2.5-0.6,4.8-1.8,6.8 " +
64 + "s-3.5,4.6-6.9,7.6c-2.3,2-3.8,3.5-4.5,4.4c-0.7,1-1.2,2-1.6,3.3" +
65 + "c-0.3,1.2-0.5,3.2-0.6,6H51.4z M51,83.8v-7.9h8v7.9H51z",
66 +
58 node: "M15,100a5,5,0,0,1-5-5v-65a5,5,0,0,1,5-5h80a5,5,0,0,1,5,5" + 67 node: "M15,100a5,5,0,0,1-5-5v-65a5,5,0,0,1,5-5h80a5,5,0,0,1,5,5" +
59 "v65a5,5,0,0,1-5,5zM14,22.5l11-11a10,3,0,0,1,10-2h40a10,3,0,0,1," + 68 "v65a5,5,0,0,1-5,5zM14,22.5l11-11a10,3,0,0,1,10-2h40a10,3,0,0,1," +
60 "10,2l11,11zM16,35a5,5,0,0,1,10,0a5,5,0,0,1-10,0z", 69 "10,2l11,11zM16,35a5,5,0,0,1,10,0a5,5,0,0,1-10,0z",
...@@ -586,6 +595,10 @@ ...@@ -586,6 +595,10 @@
586 return glyphs.get(id); 595 return glyphs.get(id);
587 } 596 }
588 597
598 + function glyphDefined(id) {
599 + return glyphs.has(id);
600 + }
601 +
589 // Note: defs should be a D3 selection of a single <defs> element 602 // Note: defs should be a D3 selection of a single <defs> element
590 function loadDefs(defs, glyphIds, noClear) { 603 function loadDefs(defs, glyphIds, noClear) {
591 var list = fs.isA(glyphIds) || ids(), 604 var list = fs.isA(glyphIds) || ids(),
...@@ -649,6 +662,7 @@ ...@@ -649,6 +662,7 @@
649 registerGlyphSet: registerGlyphSet, 662 registerGlyphSet: registerGlyphSet,
650 ids: ids, 663 ids: ids,
651 glyph: glyph, 664 glyph: glyph,
665 + glyphDefined: glyphDefined,
652 loadDefs: loadDefs, 666 loadDefs: loadDefs,
653 addGlyph: addGlyph 667 addGlyph: addGlyph
654 }; 668 };
......
...@@ -163,6 +163,7 @@ ...@@ -163,6 +163,7 @@
163 // Returns the D3 selection of the icon. 163 // Returns the D3 selection of the icon.
164 function addDeviceIcon(elem, glyphId) { 164 function addDeviceIcon(elem, glyphId) {
165 var cfg = config.device, 165 var cfg = config.device,
166 + gid = gs.glyphDefined(glyphId) ? glyphId : 'query',
166 g = elem.append('g') 167 g = elem.append('g')
167 .attr('class', 'svgIcon deviceIcon'); 168 .attr('class', 'svgIcon deviceIcon');
168 169
...@@ -175,7 +176,7 @@ ...@@ -175,7 +176,7 @@
175 }); 176 });
176 177
177 g.append('use').attr({ 178 g.append('use').attr({
178 - 'xlink:href': '#' + glyphId, 179 + 'xlink:href': '#' + gid,
179 width: cfg.dim, 180 width: cfg.dim,
180 height: cfg.dim 181 height: cfg.dim
181 }); 182 });
......
1 +{
2 + "event": "addDevice",
3 + "payload": {
4 + "id": "of:0000000000000009",
5 + "type": "ids",
6 + "online": true,
7 + "master": "ONOS",
8 + "labels": [
9 + "",
10 + "ids",
11 + "of:0000000000000009"
12 + ],
13 + "metaUi": {
14 + "x": 200,
15 + "y": 400
16 + }
17 + }
18 +}
1 +{
2 + "event": "addDevice",
3 + "payload": {
4 + "id": "of:00000000000000010",
5 + "type": "controller",
6 + "online": true,
7 + "master": "ONOS",
8 + "labels": [
9 + "",
10 + "controller",
11 + "of:0000000000000010"
12 + ],
13 + "metaUi": {
14 + "x": 350,
15 + "y": 400
16 + }
17 + }
18 +}
1 +{
2 + "event": "addDevice",
3 + "payload": {
4 + "id": "of:00000000000000011",
5 + "type": "virtual",
6 + "online": true,
7 + "master": "ONOS",
8 + "labels": [
9 + "",
10 + "virtual",
11 + "of:0000000000000011"
12 + ],
13 + "metaUi": {
14 + "x": 500,
15 + "y": 400
16 + }
17 + }
18 +}
1 +{
2 + "event": "addDevice",
3 + "payload": {
4 + "id": "of:00000000000000012",
5 + "type": "fiber_switch",
6 + "online": true,
7 + "master": "ONOS",
8 + "labels": [
9 + "",
10 + "fiber_switch",
11 + "of:0000000000000012"
12 + ],
13 + "metaUi": {
14 + "x": 650,
15 + "y": 400
16 + }
17 + }
18 +}
1 +{
2 + "event": "addDevice",
3 + "payload": {
4 + "id": "of:00000000000000013",
5 + "type": "microwave",
6 + "online": true,
7 + "master": "ONOS",
8 + "labels": [
9 + "",
10 + "microwave",
11 + "of:0000000000000013"
12 + ],
13 + "metaUi": {
14 + "x": 300,
15 + "y": 500
16 + }
17 + }
18 +}
1 +{
2 + "event": "addDevice",
3 + "payload": {
4 + "id": "of:00000000000000014",
5 + "type": "other",
6 + "online": true,
7 + "master": "ONOS",
8 + "labels": [
9 + "",
10 + "other",
11 + "of:0000000000000014"
12 + ],
13 + "metaUi": {
14 + "x": 450,
15 + "y": 500
16 + }
17 + }
18 +}
1 +{
2 + "event": "addDevice",
3 + "payload": {
4 + "id": "of:00000000000000015",
5 + "type": "-unmatched-",
6 + "online": true,
7 + "master": "ONOS-B",
8 + "labels": [
9 + "",
10 + "-unmatched-",
11 + "of:0000000000000015"
12 + ],
13 + "metaUi": {
14 + "x": 600,
15 + "y": 500
16 + }
17 + }
18 +}
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": "switch",
6 + "online": true,
7 + "master": "ONOS",
8 + "labels": [
9 + "",
10 + "switch",
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": "router",
6 + "online": true,
7 + "master": "ONOS",
8 + "labels": [
9 + "",
10 + "router",
11 + "of:0000000000000002"
12 + ],
13 + "metaUi": {
14 + "x": 350,
15 + "y": 200
16 + }
17 + }
18 +}
1 +{
2 + "event": "addDevice",
3 + "payload": {
4 + "id": "of:0000000000000003",
5 + "type": "roadm",
6 + "online": true,
7 + "master": "ONOS",
8 + "labels": [
9 + "",
10 + "roadm",
11 + "of:0000000000000003"
12 + ],
13 + "metaUi": {
14 + "x": 500,
15 + "y": 200
16 + }
17 + }
18 +}
1 +{
2 + "event": "addDevice",
3 + "payload": {
4 + "id": "of:0000000000000004",
5 + "type": "otn",
6 + "online": true,
7 + "master": "ONOS",
8 + "labels": [
9 + "",
10 + "otn",
11 + "of:0000000000000004"
12 + ],
13 + "metaUi": {
14 + "x": 650,
15 + "y": 200
16 + }
17 + }
18 +}
1 +{
2 + "event": "addDevice",
3 + "payload": {
4 + "id": "of:0000000000000005",
5 + "type": "roadm_otn",
6 + "online": true,
7 + "master": "ONOS",
8 + "labels": [
9 + "",
10 + "roadm_otn",
11 + "of:0000000000000005"
12 + ],
13 + "metaUi": {
14 + "x": 300,
15 + "y": 300
16 + }
17 + }
18 +}
1 +{
2 + "event": "addDevice",
3 + "payload": {
4 + "id": "of:0000000000000006",
5 + "type": "firewall",
6 + "online": true,
7 + "master": "ONOS",
8 + "labels": [
9 + "",
10 + "firewall",
11 + "of:0000000000000006"
12 + ],
13 + "metaUi": {
14 + "x": 450,
15 + "y": 300
16 + }
17 + }
18 +}
1 +{
2 + "event": "addDevice",
3 + "payload": {
4 + "id": "of:0000000000000007",
5 + "type": "balancer",
6 + "online": true,
7 + "master": "ONOS",
8 + "labels": [
9 + "",
10 + "balancer",
11 + "of:0000000000000007"
12 + ],
13 + "metaUi": {
14 + "x": 600,
15 + "y": 300
16 + }
17 + }
18 +}
1 +{
2 + "event": "addDevice",
3 + "payload": {
4 + "id": "of:0000000000000008",
5 + "type": "ips",
6 + "online": true,
7 + "master": "ONOS",
8 + "labels": [
9 + "",
10 + "ips",
11 + "of:0000000000000008"
12 + ],
13 + "metaUi": {
14 + "x": 750,
15 + "y": 300
16 + }
17 + }
18 +}
1 +{
2 + "comments": [
3 + "Showing all device types"
4 + ],
5 + "title": "Show Device Types",
6 + "params": {
7 + "lastAuto": 16
8 + },
9 + "description": [
10 + "Show all device types."
11 + ]
12 +}