1.生成拓扑并连接控制器floodlight,利用控制器floodlight查看图形拓扑
from mininet.topo import Topo
class MyTopo( Topo ):
"Simple topology example."
def __init__( self ):
# Initialize topology
Topo.__init__( self )
sw1 = self.addSwitch('s1')
sw2 = self.addSwitch('s2')
sw3 = self.addSwitch('s3')
sw4 = self.addSwitch('s4')
h1 = self.addHost('h1')
h2 = self.addHost('h2')
h3 = self.addHost('h3')
self.addLink(h1,sw2,1,1)
self.addLink(h2,sw3,1,1)
self.addLink(sw2,sw1,2,1)
self.addLink(sw3,sw1,2,2)
self.addLink(sw1,sw4,3,1)
self.addLink(sw4,h3,2,1)
topos = { 'mytopo': ( lambda: MyTopo() ) }
2.利用字符界面下发流表,使得'h1'和'h2' ping 不通
3.利用字符界面下发流表,通过测试‘h1’和‘h3’的联通性,来验证openflow的hardtime机制