Thomas Vachuska
Committed by Gerrit Code Review

Testing & fixing GUI fail-over code.

Change-Id: I64843186bf05020ce77a1508a300391e0db6bf48
...@@ -22,7 +22,6 @@ import org.apache.felix.scr.annotations.Reference; ...@@ -22,7 +22,6 @@ import org.apache.felix.scr.annotations.Reference;
22 import org.apache.felix.scr.annotations.ReferenceCardinality; 22 import org.apache.felix.scr.annotations.ReferenceCardinality;
23 import org.onlab.packet.MacAddress; 23 import org.onlab.packet.MacAddress;
24 import org.onlab.packet.VlanId; 24 import org.onlab.packet.VlanId;
25 -import org.onosproject.cfg.ComponentConfigService;
26 import org.onosproject.cluster.ClusterService; 25 import org.onosproject.cluster.ClusterService;
27 import org.onosproject.mastership.MastershipService; 26 import org.onosproject.mastership.MastershipService;
28 import org.onosproject.net.Device; 27 import org.onosproject.net.Device;
...@@ -43,8 +42,8 @@ import org.onosproject.net.provider.AbstractProvider; ...@@ -43,8 +42,8 @@ import org.onosproject.net.provider.AbstractProvider;
43 import org.onosproject.net.provider.ProviderId; 42 import org.onosproject.net.provider.ProviderId;
44 import org.slf4j.Logger; 43 import org.slf4j.Logger;
45 44
46 -import static org.slf4j.LoggerFactory.getLogger;
47 import static org.onlab.util.Tools.toHex; 45 import static org.onlab.util.Tools.toHex;
46 +import static org.slf4j.LoggerFactory.getLogger;
48 47
49 /** 48 /**
50 * Null provider to advertise fake hosts. 49 * Null provider to advertise fake hosts.
...@@ -66,9 +65,6 @@ public class NullHostProvider extends AbstractProvider implements HostProvider { ...@@ -66,9 +65,6 @@ public class NullHostProvider extends AbstractProvider implements HostProvider {
66 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) 65 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
67 protected HostProviderRegistry providerRegistry; 66 protected HostProviderRegistry providerRegistry;
68 67
69 - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
70 - protected ComponentConfigService cfgService;
71 -
72 private HostProviderService providerService; 68 private HostProviderService providerService;
73 69
74 //make sure the device has enough ports to accomodate all of them. 70 //make sure the device has enough ports to accomodate all of them.
...@@ -94,7 +90,6 @@ public class NullHostProvider extends AbstractProvider implements HostProvider { ...@@ -94,7 +90,6 @@ public class NullHostProvider extends AbstractProvider implements HostProvider {
94 90
95 @Activate 91 @Activate
96 public void activate() { 92 public void activate() {
97 - cfgService.registerProperties(getClass());
98 providerService = providerRegistry.register(this); 93 providerService = providerRegistry.register(this);
99 for (Device dev : deviceService.getDevices()) { 94 for (Device dev : deviceService.getDevices()) {
100 addHosts(dev); 95 addHosts(dev);
...@@ -106,7 +101,6 @@ public class NullHostProvider extends AbstractProvider implements HostProvider { ...@@ -106,7 +101,6 @@ public class NullHostProvider extends AbstractProvider implements HostProvider {
106 101
107 @Deactivate 102 @Deactivate
108 public void deactivate() { 103 public void deactivate() {
109 - cfgService.unregisterProperties(getClass(), false);
110 providerRegistry.unregister(this); 104 providerRegistry.unregister(this);
111 deviceService.removeListener(hostProvider); 105 deviceService.removeListener(hostProvider);
112 providerService = null; 106 providerService = null;
......
...@@ -194,8 +194,8 @@ public class UiWebSocket ...@@ -194,8 +194,8 @@ public class UiWebSocket
194 } 194 }
195 195
196 ObjectNode payload = mapper.createObjectNode(); 196 ObjectNode payload = mapper.createObjectNode();
197 - payload.set("instances", instances); 197 + payload.set("clusterNodes", instances);
198 - sendMessage("onosInstances", 0, payload); 198 + sendMessage("bootstrap", 0, payload);
199 } 199 }
200 200
201 } 201 }
......
...@@ -40,10 +40,12 @@ ...@@ -40,10 +40,12 @@
40 40
41 var builtinHandlers = { 41 var builtinHandlers = {
42 bootstrap: function (data) { 42 bootstrap: function (data) {
43 - clusterNodes = data.instances; 43 + clusterNodes = data.clusterNodes;
44 clusterNodes.forEach(function (d, i) { 44 clusterNodes.forEach(function (d, i) {
45 if (d.uiAttached) { 45 if (d.uiAttached) {
46 clusterIndex = i; 46 clusterIndex = i;
47 + $log.info('Connected to cluster node ' + d.ip);
48 + // TODO: add connect info to masthead somewhere
47 } 49 }
48 }); 50 });
49 } 51 }
...@@ -228,7 +230,11 @@ ...@@ -228,7 +230,11 @@
228 wsock = _wsock_; 230 wsock = _wsock_;
229 vs = _vs_; 231 vs = _vs_;
230 232
231 - bindHandlers(builtinHandlers); 233 + // TODO: Consider how to simplify handler structure
234 + // Now it is an object of key -> object that has a method named 'key'.
235 + bindHandlers({
236 + bootstrap: builtinHandlers
237 + });
232 238
233 return { 239 return {
234 resetSid: resetSid, 240 resetSid: resetSid,
......