Old GUI changes to show number of switches and links
diff --git a/web/js/onos-topology.js b/web/js/onos-topology.js
index 3772127..d086f6a 100644
--- a/web/js/onos-topology.js
+++ b/web/js/onos-topology.js
@@ -222,8 +222,23 @@
return changed
}
+ function nr_active_sw(){
+ var n=0;
+ var nodes = force.nodes();
+ for(var i=0;i<nodes.length;i++){
+ if(nodes[i].group!=0)
+ n++;
+ };
+ return n;
+ }
+
function draw(force, path, circle, text){
force.stop();
+ svg.append("svg:text")
+ .attr("x", 50)
+ .attr("y", 20)
+ .text(function(){return "Switch: " + force.nodes().length + " (Active: " + nr_active_sw() + ")/ Link: " + force.links().length});
+
path.enter().append("svg:path")
.attr("class", function(d) { return "link"; })
.attr("marker-end", function(d) {
diff --git a/web/onos-topology.html b/web/onos-topology.html
index 5834521..b4e5097 100644
--- a/web/onos-topology.html
+++ b/web/onos-topology.html
@@ -43,7 +43,7 @@
<path d="M0,-5L10,0L0,5" fill="red" stroke="red"/>
</marker>
</defs>
-<h1>ONOS Sprint 4 Demo GUI</h1>
+<h1>ONOS Simple Topology GUI</h1>
<h2>Controller Status</h2>
<div id="servers"></div>
<div id="onos-status"></div>
diff --git a/web/topology_rest.py b/web/topology_rest.py
index 38dba5d..1f61160 100755
--- a/web/topology_rest.py
+++ b/web/topology_rest.py
@@ -689,8 +689,8 @@
resp = Response(js, status=200, mimetype='application/json')
return resp
-@app.route("/controller_status")
-def controller_status():
+@app.route("/controller_status_old")
+def controller_status_old():
# onos_check="ssh -i ~/.ssh/onlabkey.pem %s ONOS/start-onos.sh status | awk '{print $1}'"
onos_check="cd; onos status | grep %s | awk '{print $2}'"
#cassandra_check="ssh -i ~/.ssh/onlabkey.pem %s ONOS/start-cassandra.sh status"
@@ -709,6 +709,30 @@
resp = Response(js, status=200, mimetype='application/json')
return resp
+
+@app.route("/controller_status")
+def controller_status():
+ url= "%s:%d/wm/onos/registry/controllers/json" % (RestIP, RestPort)
+ (code, result) = get_json(url)
+ parsedResult = json.loads(result)
+
+ cont_status=[]
+ for i in controllers:
+ status={}
+ if i in parsedResult:
+ onos=1
+ else:
+ onos=0
+ status["name"]=i
+ status["onos"]=onos
+ status["cassandra"]=0
+ cont_status.append(status)
+
+ js = json.dumps(cont_status)
+ resp = Response(js, status=200, mimetype='application/json')
+ return resp
+
+
### Command ###
@app.route("/gui/controller/<cmd>/<controller_name>")
def controller_status_change(cmd, controller_name):