Controller Documentation - OverFlowJAMK/General GitHub Wiki

Creating custom topology to mininet

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

Controller (Ryu)

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)

REST api

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

Librarys

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)

Useful links

Ryu and openflow:

REST with flask-restful library

VIM cheatsheet

⚠️ **GitHub.com Fallback** ⚠️