University of Bristol Masters Thesis, 2019
Read the full thesis here: https://github.com/franchiven/reinforcement-learning-SDN/blob/master/Thesis/FrancescoVenerandiThesis.pdf
This project investigated how Reinforcement Learning could be applied to different parts of a software defined network. The code included in this repository specifically looks at how Q-learning could be used for path finding in a SDN.
The primary aim of this project was to investigate how feasible a reinforcement learning, specifically a Q-learning algorithm, would be in finding the shortest paths within a network topology.
Below shows an example network (pan european network topology) which was used in the TensorFlow Q-learning.ipynb.
A nerual network trained on this topology managed to find the shortest path (by weight) from 0-10 (0 3 6 8 10) within a few thousand episodes (~5 seconds).
TensorFlow Q-learning.ipynb can be run on its own (put in your desired network topology) or in conjunction with a mininet virtual machine.
To run the entire SDN architecture:
- Install and open a virtual machine (VM) running Mininet.
- Install Ryu controller inside the virtual machine.
- Install all the necessary packages.
- Inside the VM open the folder: ryu/ryu/app. (This can be done with the command cd ryu/ryu/app once the machine has just started).
- Copy the following files in this repo into the new folder:
- l2DestForwardStaticRyuNS.py
- ShortestPathBridgeNet_NP.py
- TensorFlow Q-learning.ipynb
- NetRunnerNS.py
- PanEuroNet.json
- g_switchesOut.pickle
- Place your own IP address in NetRunnerNs line 71 and your own network topology (if desired) in NetRunnerNS line 70 and in ShortestPathBridgeNet_NP line 123.
- Follow the instructions in chapter 5 of the thesis to simulate the network.
- These are the two main commands to start the network:
- sudo python NetRunnerNS.py -f PanEuroNet.json -ip (place ip here)
- python l2DestForwardStaticRyuNS.py --netfile=PanEuroNet.json