Oops! Fix updateLink() function in topology view.
(also add linkupdate scenario).

Change-Id: Ic0f6753745e43c5fc76a6cb180a0c8a66178c657
diff --git a/web/gui/src/main/webapp/app/view/topo/topoForce.js b/web/gui/src/main/webapp/app/view/topo/topoForce.js
index 175ee79..3c68f3e 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoForce.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoForce.js
@@ -230,7 +230,7 @@
             d = result.ldata;
 
         if (bad) {
-            //logicError(bad + ': ' + link.id);
+            $log.debug(bad + ': ' + link.id);
             return;
         }
 
@@ -255,10 +255,10 @@
         var result = tms.findLink(data, 'update'),
             bad = result.badLogic;
         if (bad) {
-            //logicError(bad + ': ' + link.id);
+            $log.debug(bad + ': ' + link.id);
             return;
         }
-        result.updateWith(link);
+        result.updateWith(data);
     }
 
     function removeLink(data) {
diff --git a/web/gui/src/test/_karma/ev/linkupdate/ev_10_removeLink_AB.json b/web/gui/src/test/_karma/ev/linkupdate/ev_10_removeLink_AB.json
new file mode 100644
index 0000000..99e9610
--- /dev/null
+++ b/web/gui/src/test/_karma/ev/linkupdate/ev_10_removeLink_AB.json
@@ -0,0 +1,13 @@
+{
+  "event": "removeLink",
+  "payload": {
+    "id": "of:000000000000000a/1-of:000000000000000b/2",
+    "type": "direct",
+    "online": true,
+    "linkWidth": 1.2,
+    "src": "of:000000000000000a",
+    "srcPort": "1",
+    "dst": "of:000000000000000b",
+    "dstPort": "2"
+  }
+}
diff --git a/web/gui/src/test/_karma/ev/linkupdate/ev_11_removeLink_BA.json b/web/gui/src/test/_karma/ev/linkupdate/ev_11_removeLink_BA.json
new file mode 100644
index 0000000..cc993b5
--- /dev/null
+++ b/web/gui/src/test/_karma/ev/linkupdate/ev_11_removeLink_BA.json
@@ -0,0 +1,13 @@
+{
+  "event": "removeLink",
+  "payload": {
+    "id": "of:000000000000000b/2-of:000000000000000a/1",
+    "type": "direct",
+    "online": true,
+    "linkWidth": 1.2,
+    "src": "of:000000000000000b",
+    "srcPort": "2",
+    "dst": "of:000000000000000a",
+    "dstPort": "1"
+  }
+}
diff --git a/web/gui/src/test/_karma/ev/linkupdate/ev_1_addInstance.json b/web/gui/src/test/_karma/ev/linkupdate/ev_1_addInstance.json
new file mode 100644
index 0000000..33bfb80
--- /dev/null
+++ b/web/gui/src/test/_karma/ev/linkupdate/ev_1_addInstance.json
@@ -0,0 +1,14 @@
+{
+  "event": "addInstance",
+  "payload": {
+    "id": "onos",
+    "ip": "192.168.56.101",
+    "online": true,
+    "uiAttached": true,
+    "switches": 2,
+    "labels": [
+      "onos",
+      "192.168.56.101"
+    ]
+  }
+}
diff --git a/web/gui/src/test/_karma/ev/linkupdate/ev_2_addDevice_A.json b/web/gui/src/test/_karma/ev/linkupdate/ev_2_addDevice_A.json
new file mode 100644
index 0000000..60284d4
--- /dev/null
+++ b/web/gui/src/test/_karma/ev/linkupdate/ev_2_addDevice_A.json
@@ -0,0 +1,18 @@
+{
+  "event": "addDevice",
+  "payload": {
+    "id": "of:000000000000000a",
+    "type": "switch",
+    "online": true,
+    "master": "onos",
+    "labels": [
+      "",
+      "sw-A",
+      "000000000000000a"
+    ],
+    "metaUi": {
+      "x": 300,
+      "y": 300
+    }
+  }
+}
diff --git a/web/gui/src/test/_karma/ev/linkupdate/ev_3_addDevice_B.json b/web/gui/src/test/_karma/ev/linkupdate/ev_3_addDevice_B.json
new file mode 100644
index 0000000..8dd7143
--- /dev/null
+++ b/web/gui/src/test/_karma/ev/linkupdate/ev_3_addDevice_B.json
@@ -0,0 +1,18 @@
+{
+  "event": "addDevice",
+  "payload": {
+    "id": "of:000000000000000b",
+    "type": "switch",
+    "online": true,
+    "master": "onos",
+    "labels": [
+      "",
+      "sw-B",
+      "000000000000000b"
+    ],
+    "metaUi": {
+      "x": 500,
+      "y": 310
+    }
+  }
+}
diff --git a/web/gui/src/test/_karma/ev/linkupdate/ev_4_addLink_AB.json b/web/gui/src/test/_karma/ev/linkupdate/ev_4_addLink_AB.json
new file mode 100644
index 0000000..0c727cc
--- /dev/null
+++ b/web/gui/src/test/_karma/ev/linkupdate/ev_4_addLink_AB.json
@@ -0,0 +1,13 @@
+{
+  "event": "addLink",
+  "payload": {
+    "id": "of:000000000000000a/1-of:000000000000000b/2",
+    "type": "direct",
+    "online": true,
+    "linkWidth": 1.2,
+    "src": "of:000000000000000a",
+    "srcPort": "1",
+    "dst": "of:000000000000000b",
+    "dstPort": "2"
+  }
+}
diff --git a/web/gui/src/test/_karma/ev/linkupdate/ev_5_addLink_BA.json b/web/gui/src/test/_karma/ev/linkupdate/ev_5_addLink_BA.json
new file mode 100644
index 0000000..866ebc9
--- /dev/null
+++ b/web/gui/src/test/_karma/ev/linkupdate/ev_5_addLink_BA.json
@@ -0,0 +1,13 @@
+{
+  "event": "addLink",
+  "payload": {
+    "id": "of:000000000000000b/2-of:000000000000000a/1",
+    "type": "direct",
+    "online": true,
+    "linkWidth": 1.2,
+    "src": "of:000000000000000b",
+    "srcPort": "2",
+    "dst": "of:000000000000000a",
+    "dstPort": "1"
+  }
+}
diff --git a/web/gui/src/test/_karma/ev/linkupdate/ev_6_updateLink_AB_off.json b/web/gui/src/test/_karma/ev/linkupdate/ev_6_updateLink_AB_off.json
new file mode 100644
index 0000000..4b0c444
--- /dev/null
+++ b/web/gui/src/test/_karma/ev/linkupdate/ev_6_updateLink_AB_off.json
@@ -0,0 +1,13 @@
+{
+  "event": "updateLink",
+  "payload": {
+    "id": "of:000000000000000a/1-of:000000000000000b/2",
+    "type": "direct",
+    "online": false,
+    "linkWidth": 1.2,
+    "src": "of:000000000000000a",
+    "srcPort": "1",
+    "dst": "of:000000000000000b",
+    "dstPort": "2"
+  }
+}
diff --git a/web/gui/src/test/_karma/ev/linkupdate/ev_7_updateLink_BA_off.json b/web/gui/src/test/_karma/ev/linkupdate/ev_7_updateLink_BA_off.json
new file mode 100644
index 0000000..43b9901
--- /dev/null
+++ b/web/gui/src/test/_karma/ev/linkupdate/ev_7_updateLink_BA_off.json
@@ -0,0 +1,13 @@
+{
+  "event": "updateLink",
+  "payload": {
+    "id": "of:000000000000000b/2-of:000000000000000a/1",
+    "type": "direct",
+    "online": false,
+    "linkWidth": 1.2,
+    "src": "of:000000000000000b",
+    "srcPort": "2",
+    "dst": "of:000000000000000a",
+    "dstPort": "1"
+  }
+}
diff --git a/web/gui/src/test/_karma/ev/linkupdate/ev_8_updateLink_AB_on.json b/web/gui/src/test/_karma/ev/linkupdate/ev_8_updateLink_AB_on.json
new file mode 100644
index 0000000..09c4b9c
--- /dev/null
+++ b/web/gui/src/test/_karma/ev/linkupdate/ev_8_updateLink_AB_on.json
@@ -0,0 +1,13 @@
+{
+  "event": "updateLink",
+  "payload": {
+    "id": "of:000000000000000a/1-of:000000000000000b/2",
+    "type": "direct",
+    "online": true,
+    "linkWidth": 1.2,
+    "src": "of:000000000000000a",
+    "srcPort": "1",
+    "dst": "of:000000000000000b",
+    "dstPort": "2"
+  }
+}
diff --git a/web/gui/src/test/_karma/ev/linkupdate/ev_9_updateLink_BA_on.json b/web/gui/src/test/_karma/ev/linkupdate/ev_9_updateLink_BA_on.json
new file mode 100644
index 0000000..f3a0e01
--- /dev/null
+++ b/web/gui/src/test/_karma/ev/linkupdate/ev_9_updateLink_BA_on.json
@@ -0,0 +1,13 @@
+{
+  "event": "updateLink",
+  "payload": {
+    "id": "of:000000000000000b/2-of:000000000000000a/1",
+    "type": "direct",
+    "online": true,
+    "linkWidth": 1.2,
+    "src": "of:000000000000000b",
+    "srcPort": "2",
+    "dst": "of:000000000000000a",
+    "dstPort": "1"
+  }
+}
diff --git a/web/gui/src/test/_karma/ev/linkupdate/scenario.json b/web/gui/src/test/_karma/ev/linkupdate/scenario.json
new file mode 100644
index 0000000..42fe376
--- /dev/null
+++ b/web/gui/src/test/_karma/ev/linkupdate/scenario.json
@@ -0,0 +1,10 @@
+{
+  "title": "Link Update scenario",
+  "description": [
+    "Add two devices and one link (auto).",
+    "Send a couple of updateLink events."
+  ],
+  "params": {
+    "lastAuto": 5
+  }
+}