Pushing Sprint 4 demo GUI
diff --git a/web/js/onos-topology-route.js b/web/js/onos-topology-route.js
index 3b13b9c..cca644b 100644
--- a/web/js/onos-topology-route.js
+++ b/web/js/onos-topology-route.js
@@ -374,8 +374,7 @@
return "M" + d.source.x + "," + d.source.y + "A" + dr + "," + dr + " 0 0,1 " + d.target.x + "," + d.target.y;
});
- path
- .attr("stroke", function(d) {
+ path.attr("stroke", function(d) {
if(d.type == 1){
return "red"
} else {
diff --git a/web/js/onos-topology.js b/web/js/onos-topology.js
index 000d054..062d37b 100644
--- a/web/js/onos-topology.js
+++ b/web/js/onos-topology.js
@@ -235,14 +235,23 @@
});
circle.enter().append("svg:circle")
- .attr("r", radius)
+ .attr("r", function(d) {
+ if (d.group == 1000){
+ return radius/2;
+ }else{
+ return radius;
+ }
+ })
.call(node_drag);
// .call(force.drag);
text.enter().append("svg:text")
.attr("x", radius)
.attr("y", ".31em")
- .text(function(d) { return d.name.split(":")[5] + d.name.split(":")[6] + d.name.split(":")[7] });
+ .text(function(d) {
+ l=d.name.split(":").length
+ return d.name.split(":")[l-3] + ":" + d.name.split(":")[l-2] + ":" + d.name.split(":")[l-1]
+ });
circle.append("title")
.text(function(d) { return d.name; });
@@ -252,6 +261,7 @@
else if (d.group == 2){return "blue";}
else if (d.group == 3){return "green";}
else if (d.group == 4){return "orange";}
+ else if (d.group == 1000){return "black";}
else{ return "gray"; }
});
@@ -358,6 +368,7 @@
else if (d.group == 2){return "blue";}
else if (d.group == 3){return "green";}
else if (d.group == 4){return "orange";}
+ else if (d.group == 1000){return "black";}
else{ return "gray"; }
});
// text.attr("x", function(d) { return d.x; }).attr("y", function(d) { return d.y; });
diff --git a/web/onos-topology-route.html b/web/onos-topology-route.html
index 860a096..6c167c7 100644
--- a/web/onos-topology-route.html
+++ b/web/onos-topology-route.html
@@ -42,7 +42,7 @@
</marker>
</defs>
<script type="text/javascript">
-gui("http://onosnat.onlab.us:8080/wm/topology/toporoute/00:00:00:00:00:a1/2/00:00:00:00:00:c1/3/json");
+gui("http://onosnat.onlab.us:8080/wm/topology/toporoute/00:00:00:0d:00:d1/2/00:00:00:0d:00:d3/3/json");
</script>
</svg>
</body>
diff --git a/web/topology_rest.py b/web/topology_rest.py
index ce6b2d7..b109ccc 100755
--- a/web/topology_rest.py
+++ b/web/topology_rest.py
@@ -114,6 +114,7 @@
topo = {}
switches = []
links = []
+ devices = []
for v in parsedResult:
if v.has_key('dpid'):
@@ -123,19 +124,45 @@
sw = {}
sw['name']=dpid
sw['group']= -1
- if state == "ACTIVE":
- if dpid.split(":")[5] == "0a":
- sw['group']=1
- if dpid.split(":")[5] == "0b":
- sw['group']=2
- if dpid.split(":")[5] == "0c":
- sw['group']=3
- if dpid.split(":")[5] == "0d":
- sw['group']=4
+
+# if state == "ACTIVE":
+# if dpid.split(":")[5] == "0a":
+# sw['group']=1
+# if dpid.split(":")[5] == "0b":
+# sw['group']=2
+# if dpid.split(":")[5] == "0c":
+# sw['group']=3
+# if dpid.split(":")[5] == "0d":
+# sw['group']=4
if state == "INACTIVE":
sw['group']=0
switches.append(sw)
+## Comment in if we need devies
+# sw_index = len(switches) - 1
+# for p in v['ports']:
+# for d in p['devices']:
+# device = {}
+# device['attached_switch']=dpid
+# device['name']=d['mac']
+# if d['state'] == "ACTIVE":
+# device['group']=1000
+# else:
+# device['group']=1001
+#
+# switches.append(device)
+# device_index = len (switches) -1
+# link = {}
+# link['source'] = device_index
+# link['target'] = sw_index
+# link['type'] = -1
+# links.append(link)
+# link = {}
+# link['source'] = sw_index
+# link['target'] = device_index
+# link['type'] = -1
+# links.append(link)
+
# try:
# command = "curl -s \'http://%s:%s/wm/registry/controllers/json\'" % (RestIP, RestPort)
# result = os.popen(command).read()
@@ -215,12 +242,11 @@
topo['nodes'] = switches
topo['links'] = links
-# pp.pprint(topo)
+ pp.pprint(topo)
js = json.dumps(topo)
resp = Response(js, status=200, mimetype='application/json')
return resp
-
#@app.route("/wm/topology/toporoute/00:00:00:00:00:a1/2/00:00:00:00:00:c1/3/json")
#@app.route("/wm/topology/toporoute/<srcdpid>/<srcport>/<destdpid>/<destport>/json")
@app.route("/wm/topology/toporoute/<v1>/<p1>/<v2>/<p2>/json")