mininet自定義多控制器網(wǎng)絡(luò)

以下是mininet多控制器網(wǎng)絡(luò)運行腳本,是根據(jù)mininet提供的example中controllers.py改寫的。



from mininet.net import Mininet

from mininet.node import OVSSwitch, Controller, RemoteController

from mininet.topolib import TreeTopo

from mininet.log import setLogLevel

from mininet.cli import CLI????????

setLogLevel( 'info' )

# Two local and one "external" controller (which is actually c0)

# Ignore the warning message that the remote isn't (yet) running

c0 = RemoteController( 'c0', ip='10.108.48.160')

c1 = RemoteController( 'c1', ip='10.108.50.78')

c2 = RemoteController( 'c2', ip='10.108.48.240' )

cmap = { 's1': c0, 's2': c1, 's1': c2, 's3':c1 }

class MultiSwitch( OVSSwitch ):

? ? "Custom Switch() subclass that connects to different controllers"

? ? def start( self, controllers ):

? ? ? ? return OVSSwitch.start( self, [ cmap[ self.name ] ] )

topo = TreeTopo( depth=2, fanout=2 )

net = Mininet( topo=topo, switch=MultiSwitch, build=False )

for c in [ c1, c2? ]:

? ? net.addController(c)

net.build()

net.start()

CLI( net )

net.stop()

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • *面試心聲:其實這些題本人都沒怎么背,但是在上海 兩周半 面了大約10家 收到差不多3個offer,總結(jié)起來就是把...
    Dove_iOS閱讀 27,655評論 30 472
  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi閱讀 7,872評論 0 10
  • 聽音樂看視頻閱讀 207評論 0 0
  • 1.做過項目里面印象最深或?qū)ψ约簬椭畲蟮氖悄膫€?具體成長是什么? 2.最近在看什么書? 3.api是如何工作的?...
    我在太行山下閱讀 265評論 0 0
  • 這是一個神奇的故事,純屬大腦破洞! 這天,我照樣打開《王者榮耀》app開黑,看著刺客阿珂一次又一次斬...
    菜包pangkai閱讀 206評論 0 0

友情鏈接更多精彩內(nèi)容