SDN第二次上机作业
1、安装floodlight
- 参考链接:http://www.sdnlab.com/19189.html
- 安装完成如图:
2、生成拓扑并连接控制器floodlight,利用控制器floodlight查看图形拓扑
- 先写好python脚本:
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 = 1
L2 = L1 * 3
c = []
a = []
# 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 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 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() ) }
- 终端输入命令运行脚本创建拓扑:
-
控制器floodlight所示可视化图形拓扑的截图如图
-
但是总是会存在多余的host主机,经过百度和查看已交同学的博客,找到:Host过多的解决方案。
结果如图:
-
主机拓扑连通性检测截图如图:
3、利用字符界面下发流表,使得‘h1’和‘h2’ ping 不通
参考链接:http://www.sdnlab.com/19394.html
-
流表截图如图:
-
拓扑连通性测试截图(h1和h2ping不通)
4、利用字符界面下发流表,通过测试‘h1’和‘h3’的联通性,来验证openflow的hardtime机制
- 初始联通性见上一题。
- 下发具有hardtime的流表
- 测试h1和h3的联通性