简体   繁体   中英

Save my own topology:Mininet

I'm a newer in Mininet, I started my topology with CLI command: "sudo mn", after that, I'm adding some hosts and switches... but I want to save it for the next time. How can I do it? Example: http://i1360.photobucket.com/albums/r653/HKati/Capture%20drsquoeacutecran%202016-04-23%20agrave%2007.08.02_zpsxcmh4u6s.png

I'm not sure if I got your question correctly but you can define your topology within a script:

Example my_topology.py

from mininet.topo import Topo

class MyTopo( Topo ):

    def __init__( self ):

        Topo.__init__( self )

        # Add hosts and switches
        left_host = self.addHost( 'h1' )
        right_host = self.addHost( 'h2' )
        left_switch = self.addSwitch( 's0' )
        right_switch = self.addSwitch( 's2' )

        # Add links
        self.addLink( leftHost, left_switch, bw=10, delay='10ms', loss=0, max_queue_size=1000 )
        self.addLink( left_switch, right_switch, bw=10, delay='10ms', loss=0, max_queue_size=1000 )
        self.addLink( right_switch, rightHost, bw=10, delay='10ms', loss=0, max_queue_size=1000 )

topos = { 'mytopo': ( lambda: MyTopo() ) }

Then you can start it with

mn --custom my_topology.py --topo mytopo --link tc,bw=10,delay=10ms

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM