You can extend the sFlow-RT API with JavaScript, e.g. create a script called api.js in the sflow-rt home directory:
setHttpHandler(function(req) {
return topologyInterfaceToPort(req.query.agent,req.query.dataSource);
});
Run sFlow-RT with the script:
./start.sh -Dscript.file=api.js
Now start Mininet:
sudo mn --custom sflow-rt/extras/sflow.py
You can now query for the DPID using the REST API:
{
"node": "s1",
"ofport": "1",
"port": "s1-eth1",
"dpid": "0000000000000001"
}
This example just contains a single helper function, but you could add additional methods to simplify your Python controller.