标签:添加 src index logs 提高 设置 command com 修改
执行ifconfig命令获取floodlight所在服务器的IP地址。
java -jar target/floodlight.jar
浏览器中,输入floodlight ui界面地址:http://localhost:8080/ui/index.html
切换到/home/mininet目录,请检查是否存在测试脚本fattree.py,如果有该脚本,请跳过此步骤,如果没有,请执行以下命令创建脚本并添加内容。
cd /home/mininet
touch fattree.py
vim fattree.py
添加以下脚本
"""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 = L1 * 2
L3 = L2
c = []
a = []
e = []
# add core ovs
for i in range( L1 ):
sw = self.addSwitch( ‘c{}‘.format( i + 1 ) )
c.append( sw )
# add aggregation ovs
for i in range( L2 ):
sw = self.addSwitch( ‘a{}‘.format( L1 + i + 1 ) )
a.append( sw )
# add edge ovs
for i in range( L3 ):
sw = self.addSwitch( ‘e{}‘.format( L1 + L2 + i + 1 ) )
e.append( sw )
# add links between core and aggregation ovs
for i in range( L1 ):
sw1 = c[i]
for sw2 in a[i/2::L1/2]:
# self.addLink(sw2, sw1, bw=10, delay=‘5ms‘, loss=10, max_queue_size=1000, use_htb=True)
self.addLink( sw2, sw1 )
# add links between aggregation and edge ovs
for i in range( 0, L2, 2 ):
for sw1 in a[i:i+2]:
for sw2 in e[i:i+2]:
self.addLink( sw2, sw1 )
#add hosts and its links with edge ovs
count = 1
for sw1 in e:
for i in range(2):
host = self.addHost( ‘h{}‘.format( count ) )
self.addLink( sw1, host )
count += 1
topos = { ‘mytopo‘: ( lambda: MyTopo() ) }
启动mininet,生成测试拓扑结构。不要忘了修改fattree.py为可执行文件。脚本中不要含有中文。
使用以下命令运行python脚本:
sudo mn --custom /home/liuhy/mininet/fattree.py --topo mytopo --controller=remote,ip=127.0.0.1,port=6653 --switch ovsk,protocols=OpenFlow10
连接成功截图:
用vim编辑python脚本时可以参考:VIM指令大全
运行脚本之后:
拓扑图:
图中c1和c2为核心交换机,a1-a4为聚合交换机,e1-e4为边缘交换机,h1-h8为主机。上述代码
拓扑创建了2个核心交换机、4个汇聚交换机、4个边缘交换机,每个边缘交换机分别下挂2个虚拟
主机,并给所有的交换机添加了逻辑链路。上述代码中为了提高带宽的利用率、调整流量需求达
到均衡的效果,每个核心交换机均与4个汇聚交换机相连,每个汇聚交换机分别下挂两个边缘交
换机,每个边缘交换机分别连接它所属的父交换机。
标签:添加 src index logs 提高 设置 command com 修改
原文地址:https://www.cnblogs.com/031602523liu/p/8747181.html