1. Install lightweight network simulation tool Mininet
Get the start GitHub mininet source, and then enter the command to install the code are as follows:
git clone https://github.com/mininet/mininet.git
cd mininet/util
./install.sh
Results are as follows:
2. build a topology with character command, write command requires
(1) topology is as follows:
input the command:
sudo mn --topo linear,3
(2) topology is as follows:
(Ctrl + D command: exit the network net view network status)
(Note: I did not build a topology, to enter "mn -c" to clear the remaining buffer)
input the command:
sudo mn --topo tree,fanout=3,depth=2
3. The use of a visualization tool to build a topology, and requested to support OpenFlow 1.0 1.1 1.2 1.3, provided h1 (10.0.0.10), h2 (10.0.0.11), h3 (10.0.0.12), the topology is set up using the command to verify complete IP host, View topology port connection.
(1) opens at a terminal ~ / mininet / examples, run the following command:
./miniedit.py
(2) Next, open visualization tools, by utilizing the visualization tool more convenient to build the topology, using the status command to view.
After the configuration, run run
(3) You can view the network topology through the net command:
(4) using xterm statement validation host ip, each view port connection topology:
4. A Fat-tree topologies using Python script type is completed as shown below
(1) python code is as follows:
#!/usr/bin/python
# sudo mn --custom fattree.py --topo mytopo --switch ovsk,protocols=OpenFlow10
"""Custom topology example
Adding the 'topos' dict with a key/value pair to generate our newly defined
topology enables one to pass in '--topo=mytopo' from the command line.
"""
from mininet.topo import Topo
from mininet.net import Mininet
from mininet.node import RemoteController,CPULimitedHost
from mininet.link import TCLink
from mininet.util import dumpNodeConnections
class MyTopo(Topo):
"Simple topology example."
def __init__(self):
"Create custom topo."
# Initialize topology
Topo.__init__(self)
L1 = 2
L2 = 4
c = []
a = []
# add core ovs
for i in range(L1):
sw = self.addSwitch('s{}'.format(i+1))
c.append(sw)
# add aggregation ovs
for i in range(L2):
sw = self.addSwitch('s{}'.format(L1+i+1))
a.append(sw)
# add links between core and aggregation ovs
for i in range(L1):
sw1 = c[i]
for sw2 in a[0: :1]:
self.addLink(sw2, sw1)
#add hosts and its links with aggregation ovs
count = 1
for sw1 in a:
for i in range(2):
host = self.addHost('h{}'.format(count))
self.addLink(sw1, host)
count += 1
topos = {'mytopo': (lambda: MyTopo())}
(2) generating a topology:
sudo mn --custom fattree.py --topo mytopo --switch ovsk,protocols=OpenFlow10