Lab topology
Controller: RYU
switch: s1, s2
host: h1, h2, h3, h3
connectivity (direct):
h1 of <-> S1; H2 <-> S1
H3 <-> S2; H4 <-> S2
S1 <- > s2
topology code is as follows:
#!/user/bin/env python from mininet.topo import Topo class MyTopo(Topo): def build(self): left=[] left.append(self.addHost("h1")) left.append(self.addHost("h2")) right=[] right.append(self.addHost("h3")) right.append(self.addHost("h4")) switchs=[] switchs.append(self.addSwitch("s1")) switchs.append(self.addSwitch("s2")) self.addLink(left[0],switchs[0]) self.addLink(left[1],switchs[0]) self.addLink(right[0],switchs[1]) self.addLink(right[1],switchs[1]) self.addLink(switchs[0],switchs[1]) topos = { ' mytopo ' :( lambda : MyTopo ())}
In mininet/custom
the example of a file topo-2sw-2host.py
.. Can be modified accordingly in accordance with the contents of the file, define their own topologies.
The custom network topology can be written into this custom directory.
启动 RYU
cd RYUPATH / ryu / app / # First RYU app directory to the next installation directory, there are corresponding module sudo ryu-manager ofctl_rest.py simple_switch.py # Start ofctl_rest.py module and simple_switch.py switch, this switch is openflow1.0
Start mininet
sudo mn --controller=remote,ip=192.168.31,port=6653 --custom ~/Desktop/mininet/custom/1.py --topo mytopo
Topology python file 1.py which is just defined, mytopo last two lines
topos = { 'mytopo' :( lambda: MyTopo ())} in the name of the specified topological