Simon Hunt

GUI -- Fixed link lookup bug when removing links.

 - fixed and extended the 'startup' test scenario  to show device coming online (and links added), followed by device going offline (and links removed).

Change-Id: I58f79b5b16d37504793f36db9959f8c3c26b5261
Showing 44 changed files with 227 additions and 86 deletions
......@@ -5,5 +5,9 @@
"title": "Host Intent Scenario",
"params": {
"lastAuto": 0
}
},
"description": [
"Currently this is just a sketch of the event sequence,",
" but is NOT YET a runnable scenario."
]
}
\ No newline at end of file
......
......@@ -22,4 +22,4 @@
"12. remove link",
""
]
}
\ No newline at end of file
}
......
......@@ -3,7 +3,7 @@
"payload": {
"id": "of:0000ffffffffff04",
"type": "roadm",
"online": false,
"online": true,
"labels": [
"0000ffffffffff04",
"FF:FF:FF:FF:FF:04",
......
......@@ -3,15 +3,15 @@
"payload": {
"id": "of:0000ffffffff000A",
"type": "switch",
"online": false,
"online": true,
"labels": [
"0000ffffffff000A",
"FF:FF:FF:FF:00:0A",
"?"
],
"metaUi": {
"Zx": 832,
"Zy": 223
"x": 832,
"y": 223
}
}
}
......
......@@ -3,7 +3,7 @@
"payload": {
"id": "of:0000ffffffff0001",
"type": "switch",
"online": false,
"online": true,
"labels": [
"0000ffffffff0001",
"FF:FF:FF:FF:00:01",
......
......@@ -3,7 +3,7 @@
"payload": {
"id": "of:0000ffffffffff01",
"type": "roadm",
"online": false,
"online": true,
"labels": [
"0000ffffffffff01",
"FF:FF:FF:FF:FF:01",
......
......@@ -3,7 +3,7 @@
"payload": {
"id": "of:0000ffffffff0004",
"type": "switch",
"online": false,
"online": true,
"labels": [
"0000ffffffff0004",
"FF:FF:FF:FF:00:04",
......
......@@ -3,15 +3,15 @@
"payload": {
"id": "of:0000ffffffffff0A",
"type": "roadm",
"online": false,
"online": true,
"labels": [
"0000ffffffffff0A",
"FF:FF:FF:FF:FF:0A",
"?"
],
"metaUi": {
"Zx": 840,
"Zy": 290
"x": 840,
"y": 290
}
}
}
......
......@@ -3,7 +3,7 @@
"payload": {
"id": "of:0000ffffffffff09",
"type": "roadm",
"online": false,
"online": true,
"labels": [
"0000ffffffffff09",
"FF:FF:FF:FF:FF:09",
......
{
"event": "addLink",
"payload": {
"id": "of:0000ffffffffff02/20-of:0000ffffffffff05/10",
"type": "optical",
"linkWidth": 4,
"src": "of:0000ffffffffff02",
"srcPort": "20",
"dst": "of:0000ffffffffff05",
"dstPort": "10",
"type": "optical",
"linkWidth": 6,
"props" : {
"BW": "80 G"
}
......
{
"event": "addLink",
"payload": {
"id": "of:0000ffffffff000A/2-of:0000ffffffffff0A/1",
"type": "optical",
"linkWidth": 2,
"src": "of:0000ffffffff000A",
"srcPort": "2",
"dst": "of:0000ffffffffff0A",
"dstPort": "1",
"type": "optical",
"linkWidth": 2,
"props" : {
"BW": "100 G"
}
......
{
"event": "addLink",
"payload": {
"id": "of:0000ffffffffff03/10-of:0000ffffffffff02/10",
"type": "optical",
"linkWidth": 2,
"src": "of:0000ffffffffff03",
"srcPort": "10",
"dst": "of:0000ffffffffff02",
"dstPort": "10",
"type": "optical",
"linkWidth": 2,
"props" : {
"BW": "70 G"
}
......
......@@ -3,7 +3,7 @@
"payload": {
"id": "of:0000ffffffffff08",
"type": "roadm",
"online": false,
"online": true,
"labels": [
"0000ffffffffff08",
"FF:FF:FF:FF:FF:08",
......
{
"event": "addLink",
"payload": {
"id": "of:0000ffffffffff07/21-of:0000ffffffffff05/20",
"type": "optical",
"linkWidth": 2,
"src": "of:0000ffffffffff07",
"srcPort": "21",
"dst": "of:0000ffffffffff05",
"dstPort": "20",
"type": "optical",
"linkWidth": 2,
"props" : {
"BW": "70 G"
}
......
{
"event": "addLink",
"payload": {
"id": "of:0000ffffffff0001/2-of:0000ffffffffff01/1",
"type": "optical",
"linkWidth": 2,
"src": "of:0000ffffffff0001",
"srcPort": "2",
"dst": "of:0000ffffffffff01",
"dstPort": "1",
"type": "optical",
"linkWidth": 2,
"props" : {
"BW": "70 G"
}
......
{
"event": "addLink",
"payload": {
"id": "of:0000ffffffffff09/20-of:0000ffffffffff0A/20",
"type": "optical",
"linkWidth": 2,
"src": "of:0000ffffffffff09",
"srcPort": "20",
"dst": "of:0000ffffffffff0A",
"dstPort": "20",
"type": "optical",
"linkWidth": 2,
"props" : {
"BW": "70 G"
}
......
{
"event": "addLink",
"payload": {
"src": "of:0000ffffffffff06",
"srcPort": "20",
"dst": "of:0000ffffffffff05",
"dstPort": "30",
"id": "of:0000ffffffffff07/30-of:0000ffffffffff08/20",
"type": "optical",
"linkWidth": 6,
"linkWidth": 4,
"src": "of:0000ffffffffff07",
"srcPort": "30",
"dst": "of:0000ffffffffff08",
"dstPort": "20",
"props" : {
"BW": "70 G"
}
......
{
"event": "addLink",
"payload": {
"src": "of:0000ffffffffff07",
"srcPort": "30",
"dst": "of:0000ffffffffff08",
"dstPort": "20",
"id": "of:0000ffffffffff02/10-of:0000ffffffffff01/10",
"type": "optical",
"linkWidth": 6,
"linkWidth": 2,
"src": "of:0000ffffffffff02",
"srcPort": "10",
"dst": "of:0000ffffffffff01",
"dstPort": "10",
"props" : {
"BW": "70 G"
}
......
{
"event": "addLink",
"payload": {
"src": "of:0000ffffffffff03",
"srcPort": "20",
"dst": "of:0000ffffffffff06",
"id": "of:0000ffffffffff04/27-of:0000ffffffffff08/10",
"src": "of:0000ffffffffff04",
"srcPort": "27",
"dst": "of:0000ffffffffff08",
"dstPort": "10",
"type": "optical",
"linkWidth": 2,
"props" : {
"BW": "70 G"
"BW": "30 G"
}
}
}
......
{
"event": "addLink",
"payload": {
"src": "of:0000ffffffffff02",
"srcPort": "10",
"dst": "of:0000ffffffffff01",
"dstPort": "10",
"id": "of:0000ffffffff0003/2-of:0000ffffffffff03/1",
"type": "optical",
"linkWidth": 2,
"src": "of:0000ffffffff0003",
"srcPort": "2",
"dst": "of:0000ffffffffff03",
"dstPort": "1",
"props" : {
"BW": "70 G"
}
......
{
"event": "addLink",
"payload": {
"id": "of:0000ffffffffff09/1-of:0000ffffffff0009/2",
"type": "optical",
"linkWidth": 2,
"src": "of:0000ffffffffff09",
"srcPort": "1",
"dst": "of:0000ffffffff0009",
"dstPort": "2",
"type": "optical",
"linkWidth": 2,
"props" : {
"BW": "70 G"
}
......
{
"event": "addLink",
"payload": {
"id": "of:0000ffffffffff03/30-of:0000ffffffffff04/10",
"type": "optical",
"linkWidth": 2,
"src": "of:0000ffffffffff03",
"srcPort": "30",
"dst": "of:0000ffffffffff04",
"dstPort": "10",
"type": "optical",
"linkWidth": 2,
"props" : {
"BW": "70 G"
}
......
{
"event": "addLink",
"payload": {
"id": "of:0000ffffffffff07/20-of:0000ffffffffff09/10",
"type": "optical",
"linkWidth": 2,
"src": "of:0000ffffffffff07",
"srcPort": "20",
"dst": "of:0000ffffffffff09",
"dstPort": "10",
"type": "optical",
"linkWidth": 2,
"props" : {
"BW": "70 G"
}
......
......@@ -3,7 +3,7 @@
"payload": {
"id": "of:0000ffffffffff03",
"type": "roadm",
"online": false,
"online": true,
"labels": [
"0000ffffffffff03",
"FF:FF:FF:FF:FF:03",
......
{
"event": "addLink",
"payload": {
"id": "of:0000ffffffffff0A/10-of:0000ffffffffff08/30",
"type": "optical",
"linkWidth": 4,
"src": "of:0000ffffffffff0A",
"srcPort": "10",
"dst": "of:0000ffffffffff08",
"dstPort": "30",
"type": "optical",
"linkWidth": 6,
"props" : {
"BW": "70 G"
}
......
{
"event": "addLink",
"payload": {
"id": "of:0000ffffffff0004/2-of:0000ffffffffff04/1",
"type": "optical",
"linkWidth": 2,
"src": "of:0000ffffffff0004",
"srcPort": "2",
"dst": "of:0000ffffffffff04",
"dstPort": "1",
"type": "optical",
"linkWidth": 2,
"props" : {
"BW": "70 G"
}
......
{
"event": "addLink",
"payload": {
"id": "of:0000ffffffffff07/1-of:0000ffffffff0007/2",
"type": "optical",
"linkWidth": 2,
"src": "of:0000ffffffffff07",
"srcPort": "1",
"dst": "of:0000ffffffff0007",
"dstPort": "2",
"type": "optical",
"linkWidth": 2,
"props" : {
"BW": "70 G"
}
......
{
"event": "addLink",
"event": "updateDevice",
"payload": {
"src": "of:0000ffffffff0003",
"srcPort": "2",
"dst": "of:0000ffffffffff03",
"dstPort": "1",
"type": "optical",
"linkWidth": 2,
"props" : {
"BW": "70 G"
"id": "of:0000ffffffffff06",
"type": "roadm",
"online": true,
"labels": [
"0000ffffffffff06",
"FF:FF:FF:FF:FF:06",
"?"
],
"metaUi": {
"x": 336,
"y": 254
}
}
}
......
{
"event": "addLink",
"payload": {
"id": "of:0000ffffffffff06/20-of:0000ffffffffff05/30",
"src": "of:0000ffffffffff06",
"srcPort": "30",
"dst": "of:0000ffffffffff08",
"dstPort": "10",
"srcPort": "20",
"dst": "of:0000ffffffffff05",
"dstPort": "30",
"type": "optical",
"linkWidth": 6,
"linkWidth": 4,
"props" : {
"BW": "70 G"
}
......
{
"event": "addLink",
"payload": {
"src": "of:0000ffffffffff04",
"srcPort": "27",
"dst": "of:0000ffffffffff08",
"dstPort": "10",
"id": "of:0000ffffffffff03/20-of:0000ffffffffff06/10",
"type": "optical",
"linkWidth": 2,
"src": "of:0000ffffffffff03",
"srcPort": "20",
"dst": "of:0000ffffffffff06",
"dstPort": "10",
"props" : {
"BW": "30 G"
"BW": "70 G"
}
}
}
......
{
"event": "addLink",
"payload": {
"id": "of:0000ffffffffff06/30-of:0000ffffffffff08/10",
"type": "optical",
"linkWidth": 4,
"src": "of:0000ffffffffff06",
"srcPort": "30",
"dst": "of:0000ffffffffff08",
"dstPort": "10",
"props" : {
"BW": "70 G"
}
}
}
{
"event": "updateDevice",
"payload": {
"id": "of:0000ffffffffff08",
"type": "roadm",
"online": false,
"labels": [
"0000ffffffffff08",
"FF:FF:FF:FF:FF:08",
"?"
],
"metaUi": {
"x": 539,
"y": 186
}
}
}
{
"event": "removeLink",
"payload": {
"id": "of:0000ffffffffff07/30-of:0000ffffffffff08/20",
"type": "optical",
"linkWidth": 4,
"src": "of:0000ffffffffff07",
"srcPort": "30",
"dst": "of:0000ffffffffff08",
"dstPort": "20",
"props" : {
"BW": "70 G"
}
}
}
{
"event": "removeLink",
"payload": {
"id": "of:0000ffffffffff04/27-of:0000ffffffffff08/10",
"src": "of:0000ffffffffff04",
"srcPort": "27",
"dst": "of:0000ffffffffff08",
"dstPort": "10",
"type": "optical",
"linkWidth": 2,
"props" : {
"BW": "30 G"
}
}
}
......@@ -3,7 +3,7 @@
"payload": {
"id": "of:0000ffffffff0007",
"type": "switch",
"online": false,
"online": true,
"labels": [
"0000ffffffff0007",
"FF:FF:FF:FF:00:07",
......
{
"event": "removeLink",
"payload": {
"id": "of:0000ffffffffff0A/10-of:0000ffffffffff08/30",
"type": "optical",
"linkWidth": 4,
"src": "of:0000ffffffffff0A",
"srcPort": "10",
"dst": "of:0000ffffffffff08",
"dstPort": "30",
"props" : {
"BW": "70 G"
}
}
}
{
"event": "removeLink",
"payload": {
"id": "of:0000ffffffffff06/30-of:0000ffffffffff08/10",
"type": "optical",
"linkWidth": 4,
"src": "of:0000ffffffffff06",
"srcPort": "30",
"dst": "of:0000ffffffffff08",
"dstPort": "10",
"props" : {
"BW": "70 G"
}
}
}
......@@ -3,7 +3,7 @@
"payload": {
"id": "of:0000ffffffff0009",
"type": "switch",
"online": false,
"online": true,
"labels": [
"0000ffffffff0009",
"FF:FF:FF:FF:00:09",
......
......@@ -3,7 +3,7 @@
"payload": {
"id": "of:0000ffffffffff02",
"type": "roadm",
"online": false,
"online": true,
"labels": [
"0000ffffffffff02",
"FF:FF:FF:FF:FF:02",
......
......@@ -3,7 +3,7 @@
"payload": {
"id": "of:0000ffffffff0003",
"type": "switch",
"online": false,
"online": true,
"labels": [
"0000ffffffff0003",
"FF:FF:FF:FF:00:03",
......
......@@ -3,7 +3,7 @@
"payload": {
"id": "of:0000ffffffffff07",
"type": "roadm",
"online": false,
"online": true,
"labels": [
"0000ffffffffff07",
"FF:FF:FF:FF:FF:07",
......
......@@ -3,7 +3,7 @@
"payload": {
"id": "of:0000ffffffffff05",
"type": "roadm",
"online": false,
"online": true,
"labels": [
"0000ffffffffff05",
"FF:FF:FF:FF:FF:05",
......
......@@ -6,5 +6,15 @@
"title": "Startup Scenario",
"params": {
"lastAuto": 32
}
},
"description": [
"Loads 16 devices (10 optical, 6 packet)",
" and their associated links.",
"",
"Press 'S' to load initial events.",
"",
"Press spacebar to complete the scenario...",
" * 4 events - device online, add 3 links",
" * 5 events - device offline, remove 4 links"
]
}
\ No newline at end of file
......
......@@ -30,6 +30,7 @@
// configuration data
var config = {
useLiveData: true,
fnTrace: true,
debugOn: false,
debug: {
showNodeXY: true,
......@@ -180,6 +181,11 @@
return config.debugOn && config.debug[what];
}
function fnTrace(msg, id) {
if (config.fnTrace) {
console.log('FN: ' + msg + ' [' + id + ']');
}
}
// ==============================
// Key Callbacks
......@@ -220,7 +226,7 @@
var v = scenario.view,
frame;
if (stack.length === 0) {
v.alert('Error:\n\nNo event #' + evn + ' found.');
v.alert('Oops!\n\nNo event #' + evn + ' found.');
return;
}
frame = stack.shift();
......@@ -334,6 +340,7 @@
function logicError(msg) {
// TODO, report logic error to server, via websock, so it can be logged
network.view.alert('Logic Error:\n\n' + msg);
console.warn(msg);
}
var eventDispatch = {
......@@ -350,6 +357,7 @@
};
function addDevice(data) {
fnTrace('addDevice', data.payload.id);
var device = data.payload,
nodeData = createDeviceNode(device);
network.nodes.push(nodeData);
......@@ -359,6 +367,7 @@
}
function addLink(data) {
fnTrace('addLink', data.payload.id);
var link = data.payload,
lnk = createLink(link);
if (lnk) {
......@@ -370,6 +379,7 @@
}
function addHost(data) {
fnTrace('addHost', data.payload.id);
var host = data.payload,
node = createHostNode(host),
lnk;
......@@ -388,6 +398,7 @@
}
function updateDevice(data) {
fnTrace('updateDevice', data.payload.id);
var device = data.payload,
id = device.id,
nodeData = network.lookup[id];
......@@ -400,6 +411,7 @@
}
function updateLink(data) {
fnTrace('updateLink', data.payload.id);
var link = data.payload,
id = link.id,
linkData = network.lookup[id];
......@@ -412,6 +424,7 @@
}
function updateHost(data) {
fnTrace('updateHost', data.payload.id);
var host = data.payload,
id = host.id,
hostData = network.lookup[id];
......@@ -424,6 +437,7 @@
}
function removeLink(data) {
fnTrace('removeLink', data.payload.id);
var link = data.payload,
id = link.id,
linkData = network.lookup[id];
......@@ -435,6 +449,7 @@
}
function showPath(data) {
fnTrace('showPath', data.payload.id);
var links = data.payload.links,
s = [ data.event + "\n" + links.length ];
links.forEach(function (d, i) {
......@@ -883,7 +898,7 @@
// remove from links array
var idx = find(linkData.id, network.links);
network.links.splice(linkData.index, 1);
network.links.splice(idx, 1);
// remove from SVG
updateLinks();
}
......@@ -1058,13 +1073,12 @@
d3.json(urlSc, function(err, data) {
var p = data && data.params || {},
desc = data && data.description || null,
intro;
intro = data && data.title;
if (err) {
view.alert('No scenario found:\n\n' + urlSc + '\n\n' + err);
} else {
sc.params = p;
intro = "Scenario loaded: " + ctx + '\n\n' + data.title;
if (desc) {
intro += '\n\n ' + desc.join('\n ');
}
......