Controller Documentation - OverFlowJAMK/General GitHub Wiki
- Current topology code can be found from https://github.com/OverFlowJAMK/General/blob/master/topo.py
Initialize network and disable mininet's own controller <br >
net = Mininet( controller=None )
Add switches in network to listen our controller <br >
net.addController( 'c0', controller=RemoteController, ip='192.168.142.50', port=6633 )
Add hosts and give them name, ip and mac-address <br >
(Remember to add these to variables like h1, h2 etc to be able to link them later) <br >
h1 = net.addHost( 'h1', ip='10.0.0.101', mac='00:00:00:00:00:01' )
Add switches and define that those use OpenFlow protocol version 1.3 <br >
(Remember to add these to variables like s1, s2 etc to be able to link them later) <br >
s1 = net.addSwitch( 's1', protocols='OpenFlow13' )
Link hosts and switches together <br >
net.addLink( h1, s1 )
Start network <br >
net.start()
Run CLI <br >
CLI( net )
Define close operation <br >
net.stop()
When script is done it runs like a normal python script <br >
sudo python topo.py
- Current controller code can be found from https://github.com/OverFlowJAMK/General/blob/master/controller/dev.py
- Code is based on simple switch for openflow 1.3 example which can be found from https://github.com/osrg/ryu/blob/master/ryu/app/simple_switch_13.py
To run this script: <br >
sudo ryu-manager dev.py
Commands:
sudo ovs-vsctl show
Lists bridges and shows if switch is connected to controller
sudo ovs-ofctl dump-flows <switch>
Dumps switch flows (change switch name)
- Current api code can be found from https://github.com/OverFlowJAMK/General/blob/master/controller/restdev.py
- Current api documentation can be found from https://github.com/OverFlowJAMK/General/wiki/Network-API-Documentation
To access API from outside network
open port from iptables: <br >
sudo iptables -I INPUT -p tcp --dport 5000 -j ACCEPT
<br >
In code add current machine's ip to host parameter <br >
app.run(host='192.168.142.50')
When script is done it runs like a normal python script <br >
sudo python restdev.py
Pip is needed for installing external librarys <br >
Example: sudo pip install requests
Current external librarys are:
Controller
- Requests
REST
- Flask
- Flask-restful
- Flask-httpauth (for authentication, not implemented yet)