Hi Nirav,

I am running ryu.topology.js module within a docker container that runs an
express server (front end) and connects with another container (that
executes ryu with ryu.topology module). I have imported:

├── router.svg
├── ryu.topology.css
├── ryu.topology.js

within the front end and connected the websocket with between front end and
ryu in order to get topology information:

within ├──* ryu.topology.js:*

*Can be improved, it was just a test.*

var wsRyu = new WebSocket(
"ws://ip-ryu-docker-container:8080/v1.0/topology/ws");
wsRyu.onmessage = function(event) {
var data = JSON.parse(event.data);
var result = rpc[data.method](data.params);
var ret = {"id": data.id, "jsonrpc": "2.0", "result": result};
this.send(JSON.stringify(ret));
}


elem.drag = elem.force.drag().on("dragstart", _dragstart);
function _dragstart(d) {
var dpid = dpid_to_int(d.dpid)
d3.json("http://ip-ryu-docker-container:8080/stats/flow/"; + dpid, function(e,
data) {
flows = data[dpid];
console.log(flows);
elem.console.selectAll("ul").remove();
li = elem.console.append("ul")
.selectAll("li");
li.data(flows).enter().append("li")
.text(function (d) { return JSON.stringify(d, null, " "); });
});
d3.select(this).classed("fixed", d.fixed = true);
}



function initialize_topology() {
d3.json("http://ip-ryu-docker-container:8080/v1.0/topology/switches";,
function(error, switches) {
d3.json("http://ip-ryu-docker-container:8080/v1.0/topology/links";, function(
error, links) {
topo.initialize({switches: switches, links: links});
elem.update();
});
});
}


Also, take a look at this:
https://sourceforge.net/p/ryu/mailman/message/36480067/

Hope you find this useful

Best regards,


El dom., 3 feb. 2019 a las 15:45, Nirav Patel (<niravkpate...@gmail.com>)
escribió:

> Hello
> I have just started using ryu for building sdn applications. For one of my
> applications i am using a web based applications for sending commands to
> mininet thorough ryu - ryu api.
>
> To make it look a little better i was thinking to incorporate ryu topology
> view as seen on ryu controller.  Is there anyway this topology can be
> extracted and displayed on my application web page.
>  I am using python flask for my server application.
> _______________________________________________
> Ryu-devel mailing list
> Ryu-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>


-- 
*Joaquin Gonzalez*
*Celular:* (11) 15-6-518-7224
*Web*: http://uc.jgonzalez.com.ar
*PGP:* 4EEECCB12AB45A19A5AFCEAAFA0F690CF96788E0
<http://uc.jgonzalez.com.ar/PGP/PublicKey.txt>
----
Exploit. A defect in the game code (see bug) or design that can be used to
gain unfair advantages.
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to