SDN第二次上机作业
1、安装floodlight
-参考链接:http://www.sdnlab.com/19189.html
-截图:
2、生成拓扑并连接控制器floodlight,利用控制器floodlight查看图形拓扑
-截图:
1.
2.
代码:
#!/usr/bin/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 )
#add hosts
host1 = self.addHost(\'h1\')
host2 = self.addHost(\'h2\')
host3 = self.addHost(\'h3\')
#add switch
switch1 = self.addSwitch(\'s1\')
switch2 = self.addSwitch(\'s2\')
switch3 = self.addSwitch(\'s3\')
switch4 = self.addSwitch(\'s4\')
#add link
self.addLink(host1,switch2,1,1)
self.addLink(host2,switch3,1,1)
self.addLink(host3,switch4,1,1)
self.addLink(switch1,switch2,1,2)
self.addLink(switch1,switch3,2,2)
self.addLink(switch1,switch4,3,2)
topos = { \'mytopo\': ( lambda: MyTopo() ) }
3、利用字符界面下发流表,使得‘h1’和‘h2’ ping 不通
-截图:
1.
2.
4、利用字符界面下发流表,通过测试‘h1’和‘h3’的联通性,来验证openflow的hardtime机制
-截图:
1.
2.
3.