1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | 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 Switch1 = self.addSwitch( 's1' ) Switch2 = self.addSwitch( 's2' ) Switch3 = self.addSwitch( 's3' ) Host1=self.addHost('h1') Host2=self.addHost('h2') Server=self.addHost('server') Proxy=self.addHost('proxy') # Add links self.addLink( Switch1,Host1 ) self.addLink( Switch1,Host2 ) self.addLink( Switch1,Switch2 ) self.addLink( Switch3,Switch2 ) self.addLink( Switch2,Server ) self.addLink( Switch3,Proxy ) topos = { 'mytopo': ( lambda: MyTopo ) } |
欢迎光临 51学通信论坛2017新版 (http://bbs.51xuetongxin.com/) | Powered by Discuz! X3 |