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 @@
unknown: "M35,40a5,5,0,0,1,5-5h30a5,5,0,0,1,5,5v30a5,5,0,0,1-5,5" +
"h-30a5,5,0,0,1-5-5z",
query: "M51.4,69.9c0-0.9,0-1.6,0-2.1c0-2.7,0.4-5.1,1.2-7.1" +
"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," +
"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" +
"-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" +
"-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," +
"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 " +
"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" +
"c-0.3,1.2-0.5,3.2-0.6,6H51.4z M51,83.8v-7.9h8v7.9H51z",
node: "M15,100a5,5,0,0,1-5-5v-65a5,5,0,0,1,5-5h80a5,5,0,0,1,5,5" +
"v65a5,5,0,0,1-5,5zM14,22.5l11-11a10,3,0,0,1,10-2h40a10,3,0,0,1," +
"10,2l11,11zM16,35a5,5,0,0,1,10,0a5,5,0,0,1-10,0z",
......@@ -586,6 +595,10 @@
return glyphs.get(id);
}
function glyphDefined(id) {
return glyphs.has(id);
}
// Note: defs should be a D3 selection of a single <defs> element
function loadDefs(defs, glyphIds, noClear) {
var list = fs.isA(glyphIds) || ids(),
......@@ -649,6 +662,7 @@
registerGlyphSet: registerGlyphSet,
ids: ids,
glyph: glyph,
glyphDefined: glyphDefined,
loadDefs: loadDefs,
addGlyph: addGlyph
};
......
......@@ -163,6 +163,7 @@
// Returns the D3 selection of the icon.
function addDeviceIcon(elem, glyphId) {
var cfg = config.device,
gid = gs.glyphDefined(glyphId) ? glyphId : 'query',
g = elem.append('g')
.attr('class', 'svgIcon deviceIcon');
......@@ -175,7 +176,7 @@
});
g.append('use').attr({
'xlink:href': '#' + glyphId,
'xlink:href': '#' + gid,
width: cfg.dim,
height: cfg.dim
});
......
{
"event": "addDevice",
"payload": {
"id": "of:0000000000000009",
"type": "ids",
"online": true,
"master": "ONOS",
"labels": [
"",
"ids",
"of:0000000000000009"
],
"metaUi": {
"x": 200,
"y": 400
}
}
}
{
"event": "addDevice",
"payload": {
"id": "of:00000000000000010",
"type": "controller",
"online": true,
"master": "ONOS",
"labels": [
"",
"controller",
"of:0000000000000010"
],
"metaUi": {
"x": 350,
"y": 400
}
}
}
{
"event": "addDevice",
"payload": {
"id": "of:00000000000000011",
"type": "virtual",
"online": true,
"master": "ONOS",
"labels": [
"",
"virtual",
"of:0000000000000011"
],
"metaUi": {
"x": 500,
"y": 400
}
}
}
{
"event": "addDevice",
"payload": {
"id": "of:00000000000000012",
"type": "fiber_switch",
"online": true,
"master": "ONOS",
"labels": [
"",
"fiber_switch",
"of:0000000000000012"
],
"metaUi": {
"x": 650,
"y": 400
}
}
}
{
"event": "addDevice",
"payload": {
"id": "of:00000000000000013",
"type": "microwave",
"online": true,
"master": "ONOS",
"labels": [
"",
"microwave",
"of:0000000000000013"
],
"metaUi": {
"x": 300,
"y": 500
}
}
}
{
"event": "addDevice",
"payload": {
"id": "of:00000000000000014",
"type": "other",
"online": true,
"master": "ONOS",
"labels": [
"",
"other",
"of:0000000000000014"
],
"metaUi": {
"x": 450,
"y": 500
}
}
}
{
"event": "addDevice",
"payload": {
"id": "of:00000000000000015",
"type": "-unmatched-",
"online": true,
"master": "ONOS-B",
"labels": [
"",
"-unmatched-",
"of:0000000000000015"
],
"metaUi": {
"x": 600,
"y": 500
}
}
}
{
"event": "addInstance",
"payload": {
"id": "ONOS",
"ip": "192.168.56.101",
"online": true,
"uiAttached": true,
"switches": 4,
"labels": [
"ONOS",
"192.168.56.101"
]
}
}
{
"event": "addDevice",
"payload": {
"id": "of:0000000000000001",
"type": "switch",
"online": true,
"master": "ONOS",
"labels": [
"",
"switch",
"of:0000000000000001"
],
"metaUi": {
"x": 200,
"y": 200
}
}
}
{
"event": "addDevice",
"payload": {
"id": "of:0000000000000002",
"type": "router",
"online": true,
"master": "ONOS",
"labels": [
"",
"router",
"of:0000000000000002"
],
"metaUi": {
"x": 350,
"y": 200
}
}
}
{
"event": "addDevice",
"payload": {
"id": "of:0000000000000003",
"type": "roadm",
"online": true,
"master": "ONOS",
"labels": [
"",
"roadm",
"of:0000000000000003"
],
"metaUi": {
"x": 500,
"y": 200
}
}
}
{
"event": "addDevice",
"payload": {
"id": "of:0000000000000004",
"type": "otn",
"online": true,
"master": "ONOS",
"labels": [
"",
"otn",
"of:0000000000000004"
],
"metaUi": {
"x": 650,
"y": 200
}
}
}
{
"event": "addDevice",
"payload": {
"id": "of:0000000000000005",
"type": "roadm_otn",
"online": true,
"master": "ONOS",
"labels": [
"",
"roadm_otn",
"of:0000000000000005"
],
"metaUi": {
"x": 300,
"y": 300
}
}
}
{
"event": "addDevice",
"payload": {
"id": "of:0000000000000006",
"type": "firewall",
"online": true,
"master": "ONOS",
"labels": [
"",
"firewall",
"of:0000000000000006"
],
"metaUi": {
"x": 450,
"y": 300
}
}
}
{
"event": "addDevice",
"payload": {
"id": "of:0000000000000007",
"type": "balancer",
"online": true,
"master": "ONOS",
"labels": [
"",
"balancer",
"of:0000000000000007"
],
"metaUi": {
"x": 600,
"y": 300
}
}
}
{
"event": "addDevice",
"payload": {
"id": "of:0000000000000008",
"type": "ips",
"online": true,
"master": "ONOS",
"labels": [
"",
"ips",
"of:0000000000000008"
],
"metaUi": {
"x": 750,
"y": 300
}
}
}
{
"comments": [
"Showing all device types"
],
"title": "Show Device Types",
"params": {
"lastAuto": 16
},
"description": [
"Show all device types."
]
}