2019 SDN major operations - data center type connected to the network topology structures and
Proportional contribution
student ID | proportion |
---|---|
031702345 | 28% |
031702311 | 18% |
031702428 | 18% |
031702309 | 18% |
131700101 | 18% |
Experiments Overview
Two mutual backup center switch
Mutual backup connection twenty-two four switches in total
Each of the four groups then have two hosts attached to the switch
As a network topology of a data center type of realization of a small
Upper, middle and lower classes can be extended to implement support for more network hosts
Implemented to prevent malfunction caused by a single device in the network center area network outages
Lab topology
Experimental topology follows
a miniedit drawing
drawn by the NSP
Establish experimental network
Establish procedures are as follows
1. Turn OpenDayLigtht as a remote controller, or else run the mininet can not be connected to the controller
2. Run mininet build topology, such as operation codessudo mn --custom datacenter.py --topo mytopo --controller=remote,ip=127.0.0.1,port=6633 --switch ovsk,protocols=OpenFlow13
3. Open http://127.0.0.1:8181/index.html#/topology
to view the topology
4. Enter the net in mininet acquire network interface information as the basis for hair flow table
Python code topology mininet follows:
#!/usr/bin/python
#创建网络拓扑
"""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() ) }
OpenDayLigtht remote controller code as follows:
First run in the console ./karaf
open container
Then follows the order of mounting feature
install odl-restconf
install odl-l2switch-switch-ui
install odl-openflowplugin-all
install odl-mdsal-apidocs
install odl-dlux-core
install odl-dlux-node
install odl-dlux-yangui
Execution before exiting logout
exit
After the operation the topology YangUI visible in FIG.
Node number and the node name of the relation in the following table (load out all the reasons failed to load)
Issued initial flow connection link table
1. Empty all flow entries
sudo ovs-ofctl -O Openflow13 del-flows c1
sudo ovs-ofctl -O Openflow13 del-flows c2
sudo ovs-ofctl -O Openflow13 del-flows a3
sudo ovs-ofctl -O Openflow13 del-flows a4
sudo ovs-ofctl -O Openflow13 del-flows a5
sudo ovs-ofctl -O Openflow13 del-flows a6
sudo ovs-ofctl -O Openflow13 del-flows e7
sudo ovs-ofctl -O Openflow13 del-flows e8
sudo ovs-ofctl -O Openflow13 del-flows e9
sudo ovs-ofctl -O Openflow13 del-flows e10
2. Laminar table issued
#e7
sudo ovs-ofctl -O OpenFlow13 add-flow e7 priority=2,in_port=1,actions=output:3,output:4
sudo ovs-ofctl -O OpenFlow13 add-flow e7 priority=2,in_port=2,actions=output:3,output:4
sudo ovs-ofctl -O OpenFlow13 add-flow e7 priority=2,in_port=3,actions=output:1,output:2,output:4
sudo ovs-ofctl -O OpenFlow13 add-flow e7 priority=2,in_port=4,actions=output:1,output:2,output:3
#e8
sudo ovs-ofctl -O OpenFlow13 add-flow e8 priority=2,in_port=1,actions=output:3,output:4
sudo ovs-ofctl -O OpenFlow13 add-flow e8 priority=2,in_port=2,actions=output:3,output:4
sudo ovs-ofctl -O OpenFlow13 add-flow e8 priority=2,in_port=3,actions=output:1,output:2,output:4
sudo ovs-ofctl -O OpenFlow13 add-flow e8 priority=2,in_port=4,actions=output:1,output:2,output:3
#e9
sudo ovs-ofctl -O OpenFlow13 add-flow e9 priority=2,in_port=1,actions=output:3,output:4
sudo ovs-ofctl -O OpenFlow13 add-flow e9 priority=2,in_port=2,actions=output:3,output:4
sudo ovs-ofctl -O OpenFlow13 add-flow e9 priority=2,in_port=3,actions=output:1,output:2,output:4
sudo ovs-ofctl -O OpenFlow13 add-flow e9 priority=2,in_port=4,actions=output:1,output:2,output:3
#e10
sudo ovs-ofctl -O OpenFlow13 add-flow e10 priority=2,in_port=1,actions=output:3,output:4
sudo ovs-ofctl -O OpenFlow13 add-flow e10 priority=2,in_port=2,actions=output:3,output:4
sudo ovs-ofctl -O OpenFlow13 add-flow e10 priority=2,in_port=3,actions=output:1,output:2,output:4
sudo ovs-ofctl -O OpenFlow13 add-flow e10 priority=2,in_port=4,actions=output:1,output:2,output:3
3. Laminar table issued
#a3
sudo ovs-ofctl -O OpenFlow13 add-flow a3 priority=2,in_port=1,actions=output:3,output:4
sudo ovs-ofctl -O OpenFlow13 add-flow a3 priority=2,in_port=2,actions=output:3,output:4
sudo ovs-ofctl -O OpenFlow13 add-flow a3 priority=2,in_port=3,actions=output:1,output:2,output:4
sudo ovs-ofctl -O OpenFlow13 add-flow a3 priority=2,in_port=4,actions=output:1,output:2,output:3
#a4
sudo ovs-ofctl -O OpenFlow13 add-flow a4 priority=2,in_port=1,actions=output:3,output:4
sudo ovs-ofctl -O OpenFlow13 add-flow a4 priority=2,in_port=2,actions=output:3,output:4
sudo ovs-ofctl -O OpenFlow13 add-flow a4 priority=2,in_port=3,actions=output:1,output:2,output:4
sudo ovs-ofctl -O OpenFlow13 add-flow a4 priority=2,in_port=4,actions=output:1,output:2,output:3
#a5
sudo ovs-ofctl -O OpenFlow13 add-flow a5 priority=2,in_port=1,actions=output:3,output:4
sudo ovs-ofctl -O OpenFlow13 add-flow a5 priority=2,in_port=2,actions=output:3,output:4
sudo ovs-ofctl -O OpenFlow13 add-flow a5 priority=2,in_port=3,actions=output:1,output:2,output:4
sudo ovs-ofctl -O OpenFlow13 add-flow a5 priority=2,in_port=4,actions=output:1,output:2,output:3
#a6
sudo ovs-ofctl -O OpenFlow13 add-flow a6 priority=2,in_port=1,actions=output:3,output:4
sudo ovs-ofctl -O OpenFlow13 add-flow a6 priority=2,in_port=2,actions=output:3,output:4
sudo ovs-ofctl -O OpenFlow13 add-flow a6 priority=2,in_port=3,actions=output:1,output:2,output:4
sudo ovs-ofctl -O OpenFlow13 add-flow a6 priority=2,in_port=4,actions=output:1,output:2,output:3
4. Apply the upper flow table
#c1
sudo ovs-ofctl -O OpenFlow13 add-flow c1 priority=2,in_port=1,actions=output:3,output:4
sudo ovs-ofctl -O OpenFlow13 add-flow c1 priority=2,in_port=2,actions=output:3,output:4
sudo ovs-ofctl -O OpenFlow13 add-flow c1 priority=2,in_port=3,actions=output:1,output:2
sudo ovs-ofctl -O OpenFlow13 add-flow c1 priority=2,in_port=4,actions=output:1,output:2
#c2
sudo ovs-ofctl -O OpenFlow13 add-flow c2 priority=2,in_port=1,actions=output:3,output:4
sudo ovs-ofctl -O OpenFlow13 add-flow c2 priority=2,in_port=2,actions=output:3,output:4
sudo ovs-ofctl -O OpenFlow13 add-flow c2 priority=2,in_port=3,actions=output:1,output:2
sudo ovs-ofctl -O OpenFlow13 add-flow c2 priority=2,in_port=4,actions=output:1,output:2
5. The above code encapsulated into a shell document may be implemented key issued and emptying flow table
Test link availability
1. Run the command mininet in pingall
It indicates that the link has been successfully connected
2. OpenDayLigtht topology map can clearly see that every client
Iperf link performance test
h1 h2 connection test:
We can see bandwidth 9.92Gbits / sec
h1 h3 connection test:
We can see bandwidth 2.41Gbits / sec
h1 connection h8 test:
We can see a bandwidth of 122Mbits / sec
结论是随着跨交换机网络的转发,性能随着跨交换机网络而减弱,解决方法是用分时间片的方法来负载均衡。
负载均衡的实现
通过将某段时间流表设置成c1,a3,a5一组和c2,a4,a6一组来达到交换机的负载均衡,以提高性能。
负载均衡后再次执行链路性能测试
h1连接h2因为没有链路变化所以带宽基本不变
h1连接h3可以看到带宽从2.41Gbit/sec提高到了3.87Gbit/sec
h1连接h8可以看到带宽从122Mbit/sec提升到了292Mbit/sec
成组打开并关闭代码:
import os
import time
def runteam1():
os.system("./addt1.sh")
time.sleep(1)
os.system("./delt2.sh")
return 1;
def runteam2():
os.system("./addt2.sh")
time.sleep(1)
os.system("./delt1.sh")
return 1;
os.system("./delflows.sh")
os.system("./inite.sh")
while(True):
runteam1()
runteam2()
addt1.sh代码:
#c1
sudo ovs-ofctl -O OpenFlow13 add-flow c1 priority=2,in_port=1,actions=output:3,output:4
sudo ovs-ofctl -O OpenFlow13 add-flow c1 priority=2,in_port=2,actions=output:3,output:4
sudo ovs-ofctl -O OpenFlow13 add-flow c1 priority=2,in_port=3,actions=output:1,output:2
sudo ovs-ofctl -O OpenFlow13 add-flow c1 priority=2,in_port=4,actions=output:1,output:2
#a3
sudo ovs-ofctl -O OpenFlow13 add-flow a3 priority=2,in_port=1,actions=output:3,output:4
sudo ovs-ofctl -O OpenFlow13 add-flow a3 priority=2,in_port=2,actions=output:3,output:4
sudo ovs-ofctl -O OpenFlow13 add-flow a3 priority=2,in_port=3,actions=output:1,output:2,output:4
sudo ovs-ofctl -O OpenFlow13 add-flow a3 priority=2,in_port=4,actions=output:1,output:2,output:3
#a5
sudo ovs-ofctl -O OpenFlow13 add-flow a5 priority=2,in_port=1,actions=output:3,output:4
sudo ovs-ofctl -O OpenFlow13 add-flow a5 priority=2,in_port=2,actions=output:3,output:4
sudo ovs-ofctl -O OpenFlow13 add-flow a5 priority=2,in_port=3,actions=output:1,output:2,output:4
sudo ovs-ofctl -O OpenFlow13 add-flow a5 priority=2,in_port=4,actions=output:1,output:2,output:3
delt1.sh代码:
sudo ovs-ofctl -O Openflow13 del-flows c1
sudo ovs-ofctl -O Openflow13 del-flows a3
sudo ovs-ofctl -O Openflow13 del-flows a5
addt2.sh、delt2.sh、inite.sh、delflows.sh的代码和上述示例十分接近,故不在赘述
本次实验因为是在本机进行,所以使用的是ovs-ofctl命令,若要进行远程的流表的下发,则需要使用Restful接口远程下发流表,下发内容与以上近似。
实验总结
经过本次实验,对OpenFlow、Mininet、OpenDayLight、OVS控制器等有了更加深入的理解,对软件定义网络也更加熟悉和清晰。
代码链接
https://github.com/opsiff/SDNExample