1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | from mininet.topo import Topo class MyTopo( Topo ): "Simple topology example." def __init__( self ): "Create custom topo." # Initialize topology Topo.__init__( self ) # Add hosts and switches leftHost = self.addHost( 'h1' ) rightHost = self.addHost( 'h2' ) leftSwitch = self.addSwitch( 's1' ) middleSwitch = self.addSwitch( 's2' ) middleSwitch2 = self.addSwitch( 's4' ) rightSwitch = self.addSwitch( 's3' ) # Add links self.addLink( leftHost, leftSwitch ) self.addLink( leftSwitch, middleSwitch ) self.addLink( leftSwitch, middleSwitch2 ) self.addLink( middleSwitch, rightSwitch ) self.addLink( middleSwitch2, rightSwitch ) self.addLink( rightSwitch, rightHost ) topos = { 'mytopo': ( lambda: MyTopo ) } |
欢迎光临 51学通信论坛2017新版 (http://bbs.51xuetongxin.com/) | Powered by Discuz! X3 |