}
lst = top.hosts;
+ console.log(top.hosts);
for (var i = 0; i < lst.length; i++) {
- nodes.push({ "id": lst[i].mac, "type": "host" });
+ nodes.push({ "id": lst[i].mac, "type": "host","ip": lst[i].ipv4});
links.push({
"source": lst[i].port.dpid, "target": lst[i].mac, "value": 2,
"port": { "source": lst[i].port.port_no, "target": 0 }
node.append("image")
.attr("xlink:href", function (d) {
if (d.type === "switch") {
- return "img/switch.svg"
+ return "img/switch.png"
} else if (d.type === "cloud") {
return "img/cloud.svg"
} else {
.attr("class", "label")
.attr("dy", size + 14)
.text(function (d) { return d.id; });
+
+
+ node.append("text")
+ .attr("class", "label")
+ .attr("dy", size + 26)
+ .text(function (d) { if (d.type === "host")return (d.ip); });
// .text(function (d) { return d.id.replace(/^0+/, ''); });
function getTopology() {
tabObj.buildTabs("#main", ["Graph", "Tables"], "Nothing to show!");
- var $svg = $('<svg width="1616" height="900"></svg>');
+ var $svg = $('<svg width="800" height="600"></svg>');
var $data = $('<div id="data"></div>');
tabObj.buildContent('Graph', $svg);
tabObj.buildContent('Tables', $data);