Committed by
Gerrit Code Review
ONOS-297 Added sending a few more properties as part of ONOS instance messages.
Change-Id: I818849e6280bf74842ff5c03c6a81e99382543f5
Showing
1 changed file
with
7 additions
and
3 deletions
... | @@ -145,7 +145,8 @@ public abstract class TopologyViewMessages { | ... | @@ -145,7 +145,8 @@ public abstract class TopologyViewMessages { |
145 | statService = directory.get(StatisticService.class); | 145 | statService = directory.get(StatisticService.class); |
146 | topologyService = directory.get(TopologyService.class); | 146 | topologyService = directory.get(TopologyService.class); |
147 | 147 | ||
148 | - version = directory.get(CoreService.class).version().toString(); | 148 | + String ver = directory.get(CoreService.class).version().toString(); |
149 | + version = ver.replace(".SNAPSHOT", "*").replaceFirst("~.*$", ""); | ||
149 | } | 150 | } |
150 | 151 | ||
151 | // Retrieves the payload from the specified event. | 152 | // Retrieves the payload from the specified event. |
... | @@ -280,10 +281,13 @@ public abstract class TopologyViewMessages { | ... | @@ -280,10 +281,13 @@ public abstract class TopologyViewMessages { |
280 | // Produces a cluster instance message to the client. | 281 | // Produces a cluster instance message to the client. |
281 | protected ObjectNode instanceMessage(ClusterEvent event) { | 282 | protected ObjectNode instanceMessage(ClusterEvent event) { |
282 | ControllerNode node = event.subject(); | 283 | ControllerNode node = event.subject(); |
284 | + int switchCount = mastershipService.getDevicesOf(node.id()).size(); | ||
283 | ObjectNode payload = mapper.createObjectNode() | 285 | ObjectNode payload = mapper.createObjectNode() |
284 | .put("id", node.id().toString()) | 286 | .put("id", node.id().toString()) |
287 | + .put("ip", node.ip().toString()) | ||
285 | .put("online", clusterService.getState(node.id()) == ACTIVE) | 288 | .put("online", clusterService.getState(node.id()) == ACTIVE) |
286 | - .put("uiAttached", event.subject().equals(clusterService.getLocalNode())); | 289 | + .put("uiAttached", event.subject().equals(clusterService.getLocalNode())) |
290 | + .put("switches", switchCount); | ||
287 | 291 | ||
288 | ArrayNode labels = mapper.createArrayNode(); | 292 | ArrayNode labels = mapper.createArrayNode(); |
289 | labels.add(node.id().toString()); | 293 | labels.add(node.id().toString()); |
... | @@ -440,7 +444,7 @@ public abstract class TopologyViewMessages { | ... | @@ -440,7 +444,7 @@ public abstract class TopologyViewMessages { |
440 | new Separator(), | 444 | new Separator(), |
441 | new Prop("Intents", format(intentService.getIntentCount())), | 445 | new Prop("Intents", format(intentService.getIntentCount())), |
442 | new Prop("Flows", format(flowService.getFlowRuleCount())), | 446 | new Prop("Flows", format(flowService.getFlowRuleCount())), |
443 | - new Prop("Version", version.replace(".SNAPSHOT", "*")))); | 447 | + new Prop("Version", version))); |
444 | } | 448 | } |
445 | 449 | ||
446 | // Returns device details response. | 450 | // Returns device details response. | ... | ... |
-
Please register or login to post a comment