SDN第二次上机作业
安装floodlight
利用python脚本生成拓扑并连接控制器floodlight,利用控制器floodlight查看图形拓扑
#!/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() ) }
结果为:
利用字符界面下发流表,使得‘h1’和‘h2’ ping 不通
利用字符界面下发流表,通过测试‘h1’和‘h3’的联通性,来验证openflow的hardtime机制
初始连通性:
下发具有hardtime的流表:
测试结果如下: