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 @@
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;
......
{
"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": "otn",
"online": true,
"master": "ONOS",
"labels": [
"",
"otn-1",
"of:0000000000000001"
],
"metaUi": {
"x": 200,
"y": 200
}
}
}
{
"event": "addDevice",
"payload": {
"id": "of:0000000000000002",
"type": "otn",
"online": true,
"master": "ONOS",
"labels": [
"",
"otn-2",
"of:0000000000000002"
],
"metaUi": {
"x": 400,
"y": 150
}
}
}
{
"event": "addDevice",
"payload": {
"id": "of:0000000000003333",
"type": "virtual",
"online": true,
"master": "foo",
"labels": [
"",
"cord",
"of:0000000000003333"
],
"metaUi": {
"x": 200,
"y": 400
}
}
}
{
"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"
}
}
{
"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"
}
}
{
"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"
}
}
{
"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"
}
}
{
"title": "Show E-CORD Topology",
"params": {
"lastAuto": 8
},
"description": [
"Show E-CORD topology, including a couple of 'virtual' devices."
]
}