当前位置: 首页>>代码示例>>Python>>正文


Python term.cleanUpScreens函数代码示例

本文整理汇总了Python中mininet.term.cleanUpScreens函数的典型用法代码示例。如果您正苦于以下问题:Python cleanUpScreens函数的具体用法?Python cleanUpScreens怎么用?Python cleanUpScreens使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了cleanUpScreens函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__( self, net, parent=None, width=4 ):
        Frame.__init__( self, parent )
        self.top = self.winfo_toplevel()
        self.top.title( 'Mininet' )
        self.net = net
        self.menubar = self.createMenuBar()
        cframe = self.cframe = Frame( self )
        self.consoles = {}  # consoles themselves
        titles = {
            'hosts': 'Host',
            'switches': 'Switch',
            'controllers': 'Controller'
        }
        for name in titles:
            nodes = getattr( net, name )
            frame, consoles = self.createConsoles(
                cframe, nodes, width, titles[ name ] )
            self.consoles[ name ] = Object( frame=frame, consoles=consoles )
        self.selected = None
        self.select( 'hosts' )
        self.cframe.pack( expand=True, fill='both' )
        cleanUpScreens()
        # Close window gracefully
        Wm.wm_protocol( self.top, name='WM_DELETE_WINDOW', func=self.quit )

        # Initialize graph
        graph = Graph( cframe )
        self.consoles[ 'graph' ] = Object( frame=graph, consoles=[ graph ] )
        self.graph = graph
        self.graphVisible = False
        self.updates = 0
        self.hostCount = len( self.consoles[ 'hosts' ].consoles )
        self.bw = 0

        self.pack( expand=True, fill='both' )
开发者ID:1514louluo,项目名称:mininet,代码行数:35,代码来源:consoles.py

示例2: __init__

    def __init__(self, net, parent=None, width=4):
        Frame.__init__(self, parent)
        self.top = self.winfo_toplevel()
        self.top.title("Mininet")
        self.net = net
        self.menubar = self.createMenuBar()
        cframe = self.cframe = Frame(self)
        self.consoles = {}  # consoles themselves
        titles = {"hosts": "Host", "switches": "Switch", "controllers": "Controller"}
        for name in titles:
            nodes = getattr(net, name)
            frame, consoles = self.createConsoles(cframe, nodes, width, titles[name])
            self.consoles[name] = Object(frame=frame, consoles=consoles)
        self.selected = None
        self.select("hosts")
        self.cframe.pack(expand=True, fill="both")
        cleanUpScreens()
        # Close window gracefully
        Wm.wm_protocol(self.top, name="WM_DELETE_WINDOW", func=self.quit)

        # Initialize graph
        graph = Graph(cframe)
        self.consoles["graph"] = Object(frame=graph, consoles=[graph])
        self.graph = graph
        self.graphVisible = False
        self.updates = 0
        self.hostCount = len(self.consoles["hosts"].consoles)
        self.bw = 0

        self.pack(expand=True, fill="both")
开发者ID:rad1dlp,项目名称:mininet,代码行数:30,代码来源:consoles.py

示例3: startTerms

 def startTerms(self):
     "Start a terminal for each node."
     info("*** Running terms on %s\n" % os.environ["DISPLAY"])
     cleanUpScreens()
     self.terms += makeTerms(self.controllers, "controller")
     self.terms += makeTerms(self.switches, "switch")
     self.terms += makeTerms(self.hosts, "host")
开发者ID:schuerg,项目名称:mn-ccnx,代码行数:7,代码来源:net.py

示例4: startTerms

 def startTerms( self ):
     "Start a terminal for each node."
     info( "*** Running terms on %s\n" % os.environ[ 'DISPLAY' ] )
     cleanUpScreens()
     self.terms += makeTerms( self.controllers, 'controller' )
     self.terms += makeTerms( self.switches, 'switch' )
     self.terms += makeTerms( self.hosts, 'host' )
开发者ID:arjunkrishnapr,项目名称:mininet,代码行数:7,代码来源:net.py

示例5: cleanup

def cleanup():
    """Clean up junk which might be left over from old runs;
       do fast stuff before slow dp and link removal!"""

    info("*** Removing excess controllers/ofprotocols/ofdatapaths/pings/noxes"
         "\n")
    zombies = 'controller ofprotocol ofdatapath ping nox_core lt-nox_core '
    zombies += 'ovs-openflowd udpbwtest'
    # Note: real zombie processes can't actually be killed, since they
    # are already (un)dead. Then again,
    # you can't connect to them either, so they're mostly harmless.
    sh( 'killall -9 ' + zombies + ' 2> /dev/null' )

    info( "*** Removing junk from /tmp\n" )
    sh( 'rm -f /tmp/vconn* /tmp/vlogs* /tmp/*.out /tmp/*.log' )

    info( "*** Removing old screen sessions\n" )
    cleanUpScreens()

    info( "*** Removing excess kernel datapaths\n" )
    dps = sh( "ps ax | egrep -o 'dp[0-9]+' | sed 's/dp/nl:/'" ).split( '\n' )
    for dp in dps:
        if dp != '':
            sh( 'dpctl deldp ' + dp )

    info( "*** Removing all links of the pattern foo-ethX\n" )
    links = sh( "ip link show | egrep -o '(\w+-eth\w+)'" ).split( '\n' )
    for link in links:
        if link != '':
            sh( "ip link del " + link )

    info( "*** Cleanup complete.\n" )
开发者ID:09zwcbupt,项目名称:mininet,代码行数:32,代码来源:clean.py

示例6: cleanup

def cleanup():
    """Clean up junk which might be left over from old runs;
       do fast stuff before slow dp and link removal!"""

    info("*** Removing excess controllers/ofprotocols/ofdatapaths/pings/noxes"
         "\n")
    zombies = 'controller ofprotocol ofdatapath ping nox_core lt-nox_core '
    zombies += 'ovs-openflowd ovs-controller udpbwtest mnexec ivs'
    # Note: real zombie processes can't actually be killed, since they
    # are already (un)dead. Then again,
    # you can't connect to them either, so they're mostly harmless.
    # Send SIGTERM first to give processes a chance to shutdown cleanly.
    sh( 'killall ' + zombies + ' 2> /dev/null' )
    time.sleep(1)
    sh( 'killall -9 ' + zombies + ' 2> /dev/null' )

    # And kill off sudo mnexec
    sh( 'pkill -9 -f "sudo mnexec"')

    info( "*** Removing junk from /tmp\n" )
    sh( 'rm -f /tmp/vconn* /tmp/vlogs* /tmp/*.out /tmp/*.log' )

    info( "*** Removing old X11 tunnels\n" )
    cleanUpScreens()

    info( "*** Removing excess kernel datapaths\n" )
    dps = sh( "ps ax | egrep -o 'dp[0-9]+' | sed 's/dp/nl:/'" ).splitlines()
    for dp in dps:
        if dp:
            sh( 'dpctl deldp ' + dp )

    info( "***  Removing OVS datapaths" )
    dps = sh("ovs-vsctl --timeout=1 list-br").strip().splitlines()
    if dps:
        sh( "ovs-vsctl " + " -- ".join( "--if-exists del-br " + dp
                                       for dp in dps if dp ) )
    # And in case the above didn't work...
    dps = sh("ovs-vsctl --timeout=1 list-br").strip().splitlines()
    for dp in dps:
        sh( 'ovs-vsctl del-br ' + dp )

    info( "*** Removing all links of the pattern foo-ethX\n" )
    links = sh( "ip link show | "
                "egrep -o '([-_.[:alnum:]]+-eth[[:digit:]]+)'" ).splitlines()
    for link in links:
        if link:
            sh( "ip link del " + link )

    info( "*** Killing stale mininet node processes\n" )
    killprocs( 'mininet:' )

    info ( "*** Shutting down stale tunnels\n" )
    killprocs( 'Tunnel=Ethernet' )
    killprocs( '.ssh/mn')
    sh( 'rm -f ~/.ssh/mn/*' )
    
    info( "*** Cleanup complete.\n" )
开发者ID:Azmonkh,项目名称:mininet,代码行数:57,代码来源:clean.py

示例7: startTerms

 def startTerms(self):
     "Start a terminal for each node."
     if "DISPLAY" not in os.environ:
         error("Error starting terms: Cannot connect to display\n")
         return
     info("*** Running terms on %s\n" % os.environ["DISPLAY"])
     cleanUpScreens()
     self.terms += makeTerms(self.controllers, "controller")
     self.terms += makeTerms(self.switches, "switch")
     self.terms += makeTerms(self.hosts, "host")
开发者ID:ruifcardoso,项目名称:mininet,代码行数:10,代码来源:net.py

示例8: startTerms

 def startTerms( self ):
     "Start a terminal for each node."
     if 'DISPLAY' not in os.environ:
         error( "Error starting terms: Cannot connect to display\n" )
         return
     info( "*** Running terms on %s\n" % os.environ[ 'DISPLAY' ] )
     cleanUpScreens()
     self.terms += makeTerms( self.controllers, 'controller' )
     self.terms += makeTerms( self.switches, 'switch' )
     self.terms += makeTerms( self.hosts, 'host' )
开发者ID:hackerenRG,项目名称:mininet,代码行数:10,代码来源:net.py

示例9: cleanup

def cleanup():
    """Clean up junk which might be left over from old runs;
       do fast stuff before slow dp and link removal!"""

    info("*** Removing excess controllers/ofprotocols/ofdatapaths/pings/noxes"
         "\n")
    zombies = 'controller ofprotocol ofdatapath ping nox_core lt-nox_core '
    zombies += 'ovs-openflowd ovs-controller udpbwtest mnexec ivs'
    # Note: real zombie processes can't actually be killed, since they
    # are already (un)dead. Then again,
    # you can't connect to them either, so they're mostly harmless.
    # Send SIGTERM first to give processes a chance to shutdown cleanly.
    sh( 'killall ' + zombies + ' 2> /dev/null' )
    time.sleep(1)
    sh( 'killall -9 ' + zombies + ' 2> /dev/null' )

    # And kill off sudo mnexec
    sh( 'pkill -9 -f "sudo mnexec"')

    info( "*** Removing junk from /tmp\n" )
    sh( 'rm -f /tmp/vconn* /tmp/vlogs* /tmp/*.out /tmp/*.log' )

    info( "*** Removing old X11 tunnels\n" )
    cleanUpScreens()

    info( "*** Removing excess kernel datapaths\n" )
    dps = sh( "ps ax | egrep -o 'dp[0-9]+' | sed 's/dp/nl:/'" ).split( '\n' )
    for dp in dps:
        if dp != '':
            sh( 'dpctl deldp ' + dp )

    info( "***  Removing OVS datapaths" )
    dps = sh("ovs-vsctl --timeout=1 list-br").split( '\n' )
    for dp in dps:
        if dp:
            sh( 'ovs-vsctl del-br ' + dp )

    info( "*** Removing all links of the pattern foo-ethX\n" )
    links = sh( r"ip link show | egrep -o '(\w+-eth\w+)'" ).split( '\n' )
    for link in links:
        if link != '':
            sh( "ip link del " + link )

    info( "*** Removing all links of the pattern mn-brX\n" )
    bridges = sh( r"sudo brctl show | egrep -o '(mn+-br\w+)'" ).split( '\n' )
    for bridge in bridges:
        if bridge != '':
            sh( "ifconfig " + bridge  + " down")
            sh( "brctl delbr " + bridge )

    info( "*** Cleanup complete.\n" )
开发者ID:aimonb,项目名称:miniNeXT,代码行数:51,代码来源:clean.py

示例10: cleanup

def cleanup():
    """Clean up junk which might be left over from old runs;
       do fast stuff before slow dp and link removal!"""

    info("*** Removing excess controllers/switches/pings/noxes"
         "\n")
    zombies = 'controller ofprotocol ofdatapath ping nox_core lt-nox_core '
    zombies += 'ovs-openflowd udpbwtest ovs-openflowd ovs-controller'
    # Note: real zombie processes can't actually be killed, since they
    # are already (un)dead. Then again,
    # you can't connect to them either, so they're mostly harmless.
    sh( 'killall -9 ' + zombies + ' 2> /dev/null' )

    info( "*** Removing junk from /tmp\n" )
    sh( 'rm -f /tmp/vconn* /tmp/vlogs* /tmp/*.out /tmp/*.log /tmp/mn-*sock' )

    info( "*** Removing old screen sessions\n" )
    cleanUpScreens()

    info( "*** Removing excess kernel datapaths\n" )
    dps = sh( "ps ax | egrep -o 'dp[0-9]+' | sed 's/dp/nl:/'" ).split( '\n' )
    for dp in dps:
        if dp:
            sh( 'dpctl deldp ' + dp )

    # OVS is tricky. We try the default DB connection. 
    # Finally we also delete the kernel datapath
    ovsdps = sh( "ovs-vsctl --no-wait -t1 list-br 2>/dev/null | egrep '^mn-dp[0-9]+$'" ).split( '\n' )
    for dp in ovsdps:
        if dp:
            sh( 'ovs-vsctl --no-wait -t1 del-br ' + dp + ' 2>/dev/null')

    ovsdps = sh( "ovs-dpctl show | egrep '\[email protected]\mn-dp[0-9]+:'" ).split( '\n' )
    for dp in ovsdps:
        if dp:
            sh( 'ovs-dpctl del-dp ' + dp )
            
    info( "*** Removing all links of the pattern foo-ethX\n" )
    links = sh( "ip link show | egrep -o '(\w+-eth\w+)'" ).split( '\n' )
    for link in links:
        if link != '':
            sh( "ip link del " + link )

    info( "*** Cleanup complete.\n" )
开发者ID:bigswitch,项目名称:mininet,代码行数:44,代码来源:clean.py

示例11: stopXterms

 def stopXterms(self):
     "Kill each xterm."
     for term in self.terms:
         os.kill(term.pid, signal.SIGKILL)
     cleanUpScreens()
开发者ID:ruifcardoso,项目名称:mininet,代码行数:5,代码来源:net.py

示例12: stop

 def stop( self ):
     "Stop network."
     if self.net is not None:
         self.net.stop()
     cleanUpScreens()
     self.net = None
开发者ID:Phi-Ho,项目名称:pyretic,代码行数:6,代码来源:miniedit-2.0.0.3.1.py

示例13: myNetwork


#.........这里部分代码省略.........
    flow_2_1_mac = 'priority=255,in_port=2,dl_src=' + mac_hc4 + ',dl_dst=' + mac_h1 + ',,actions=output:1'
    s4.dpctl('add-flow', flow_1_2_mac, '')
    s4.dpctl('add-flow', flow_2_3_mac, '')
    s4.dpctl('add-flow', flow_3_2_mac, '')
    s4.dpctl('add-flow', flow_2_1_mac, '')


    # s1, s2, s3, s4 (ip)
    flow_1_2 = 'priority=255,ip,in_port=1,nw_src=10.0.0.1,nw_dst=10.0.0.4,actions=output:2'
    flow_2_3 = 'priority=255,ip,in_port=2,nw_src=10.0.0.1,nw_dst=10.0.0.4,actions=output:3'
    flow_3_2 = 'priority=255,ip,in_port=3,nw_src=10.0.0.4,nw_dst=10.0.0.1,actions=output:2'
    flow_2_1 = 'priority=255,ip,in_port=2,nw_src=10.0.0.4,nw_dst=10.0.0.1,actions=output:1'
    s1.dpctl('add-flow', flow_1_2, '')
    s1.dpctl('add-flow', flow_2_3, '')
    s1.dpctl('add-flow', flow_3_2, '')
    s1.dpctl('add-flow', flow_2_1, '')

    s2.dpctl('add-flow', flow_1_2, '')
    s2.dpctl('add-flow', flow_2_3, '')
    s2.dpctl('add-flow', flow_3_2, '')
    s2.dpctl('add-flow', flow_2_1, '')

    s3.dpctl('add-flow', flow_1_2, '')
    s3.dpctl('add-flow', flow_2_3, '')
    s3.dpctl('add-flow', flow_3_2, '')
    s3.dpctl('add-flow', flow_2_1, '')

    s2.dpctl('add-flow', 'priority=65535,arp,arp_tpa=10.0.0.1,actions=output:1', '')
    s2.dpctl('add-flow', 'priority=65535,arp,arp_tpa=10.0.0.2,actions=output:2', '')
    s2.dpctl('add-flow', 'priority=65535,arp,arp_tpa=10.0.0.3,actions=output:3', '')
    s2.dpctl('add-flow', 'priority=65535,arp,arp_tpa=10.0.0.4,actions=output:3', '')

    s3.dpctl('add-flow', 'priority=65535,arp,arp_tpa=10.0.0.1,actions=output:1', '')
    s3.dpctl('add-flow', 'priority=65535,arp,arp_tpa=10.0.0.2,actions=output:1', '')
    s3.dpctl('add-flow', 'priority=65535,arp,arp_tpa=10.0.0.3,actions=output:2', '')
    s3.dpctl('add-flow', 'priority=65535,arp,arp_tpa=10.0.0.4,actions=output:3', '')

    info( 'flows s1: ' + s1.dpctl('dump-flows', '', '') )
    info( 'flows s2: ' + s1.dpctl('dump-flows', '', '') )
    info( 'flows s3: ' + s1.dpctl('dump-flows', '', '') )
    info( 'flows s4: ' + s1.dpctl('dump-flows', '', '') )

    # net.pingAll()

    if (with_windows):
        cleanUpScreens()
        execInXterm([h2, h3], './sf_hhe.sh; read')
        execInXterm([hc1, hc4], './sf_eth_nsh.sh; read')
        execInXterm([h4], './server.sh')
        execInXterm([h4], './tcp_dump.sh')
        execInXterm([h1, hc1, h2, h3, hc4, h4], './tcp_dump.sh')
        execInXterm([h1], 'xterm')

        ## wireshark
        cmd='wireshark'
        opts='-i h1-eth0 -k'
        h1.cmd( cmd + ' ' + opts + '&' )
        opts='-i hc1-eth0 -k'
        hc1.cmd( cmd + ' ' + opts + '&' )
        opts='-i h2-eth0 -k'
        h2.cmd( cmd + ' ' + opts + '&' )
        opts='-i h3-eth0 -k'
        h3.cmd( cmd + ' ' + opts + '&' )
        opts='-i hc4-eth0 -k'
        hc4.cmd( cmd + ' ' + opts + '&' )
        opts='-i h4-eth0 -k'
        h4.cmd( cmd + ' ' + opts + '&' )
        time.sleep(1)
    else:
        h4.sendCmd('./server.sh')
        time.sleep(1)
        hc4.sendCmd('./sf_eth_nsh.sh')
        time.sleep(1)
        h3.sendCmd('./sf_hhe.sh')
        time.sleep(1)
        h2.sendCmd('./sf_hhe.sh')
        time.sleep(1)
        hc1.sendCmd('./sf_eth_nsh.sh')
        time.sleep(1)
        #h1.sendCmd('./tcp_dump.sh > h1_tcp_dump.txt')
        h1.cmd('./client.sh')

    time.sleep(1)

    h1.sendCmd('python3 ../sf_hhe/HttpClient.py -ip 10.0.0.4')
    output( h1.waitOutput() )

    if (with_windows):
        execInXterm([h1], './client.sh ; read')
        CLI(net)
        cleanUpScreens()
    else:
        h1.cleanup()
        hc1.cleanup()
        h2.cleanup()
        h3.cleanup()
        hc4.cleanup()
        h4.cleanup()

    net.stop()
开发者ID:opendaylight,项目名称:sfc,代码行数:101,代码来源:sfc_topology_nsh.py

示例14: cleanup

    def cleanup( cls):
        """Clean up junk which might be left over from old runs;
           do fast stuff before slow dp and link removal!"""

        info( "*** Removing excess controllers/ofprotocols/ofdatapaths/"
              "pings/noxes\n" )
        zombies = 'controller ofprotocol ofdatapath ping nox_core lt-nox_core '
        zombies += 'ovs-openflowd ovs-controller udpbwtest mnexec ivs'
        # Note: real zombie processes can't actually be killed, since they
        # are already (un)dead. Then again,
        # you can't connect to them either, so they're mostly harmless.
        # Send SIGTERM first to give processes a chance to shutdown cleanly.
        sh( 'killall ' + zombies + ' 2> /dev/null' )
        time.sleep( 1 )
        sh( 'killall -9 ' + zombies + ' 2> /dev/null' )

        # And kill off sudo mnexec
        sh( 'pkill -9 -f "sudo mnexec"')

        info( "*** Removing junk from /tmp\n" )
        sh( 'rm -f /tmp/vconn* /tmp/vlogs* /tmp/*.out /tmp/*.log' )

        info( "*** Removing old X11 tunnels\n" )
        cleanUpScreens()

        info( "*** Removing excess kernel datapaths\n" )
        dps = sh( "ps ax | egrep -o 'dp[0-9]+' | sed 's/dp/nl:/'"
                  ).splitlines()
        for dp in dps:
            if dp:
                sh( 'dpctl deldp ' + dp )
        
        info( "***  Removing WiFi module and Configurations\n" )
        sh( 'rmmod mac80211_hwsim' )
        sh( 'killall -9 hostapd' )
        if(os.path.exists('ap.conf')):
            sh( 'rm ap.conf' )

        info( "***  Removing OVS datapaths\n" )
        dps = sh("ovs-vsctl --timeout=1 list-br").strip().splitlines()
        if dps:
            sh( "ovs-vsctl " + " -- ".join( "--if-exists del-br " + dp
                                            for dp in dps if dp ) )
        # And in case the above didn't work...
        dps = sh( "ovs-vsctl --timeout=1 list-br" ).strip().splitlines()
        for dp in dps:
            sh( 'ovs-vsctl del-br ' + dp )

        info( "*** Removing all links of the pattern foo-ethX\n" )
        links = sh( "ip link show | "
                    "egrep -o '([-_.[:alnum:]]+-eth[[:digit:]]+)'"
                    ).splitlines()
        # Delete blocks of links
        n = 1000  # chunk size
        for i in xrange( 0, len( links ), n ):
            cmd = ';'.join( 'ip link del %s' % link
                             for link in links[ i : i + n ] )
            sh( '( %s ) 2> /dev/null' % cmd )

        if 'tap9' in sh( 'ip link show' ):
            info( "*** Removing tap9 - assuming it's from cluster edition\n" )
            sh( 'ip link del tap9' )

        info( "*** Killing stale mininet node processes\n" )
        killprocs( 'mininet:' )

        info( "*** Shutting down stale tunnels\n" )
        killprocs( 'Tunnel=Ethernet' )
        killprocs( '.ssh/mn')
        sh( 'rm -f ~/.ssh/mn/*' )

        # Call any additional cleanup code if necessary
        for callback in cls.callbacks:
            callback()

        info( "*** Cleanup complete.\n" )
开发者ID:MGKhKhD,项目名称:mininet-wifi,代码行数:76,代码来源:clean.py

示例15: cleanup

    def cleanup(cls):
        """Clean up junk which might be left over from old runs;
           do fast stuff before slow dp and link removal!"""

        info("*** Removing excess controllers/ofprotocols/ofdatapaths/" "pings/noxes\n")
        zombies = "controller ofprotocol ofdatapath ping nox_core lt-nox_core "
        zombies += "ovs-openflowd ovs-controller udpbwtest mnexec ivs"
        # Note: real zombie processes can't actually be killed, since they
        # are already (un)dead. Then again,
        # you can't connect to them either, so they're mostly harmless.
        # Send SIGTERM first to give processes a chance to shutdown cleanly.
        sh("killall " + zombies + " 2> /dev/null")
        time.sleep(1)
        sh("killall -9 " + zombies + " 2> /dev/null")

        # And kill off sudo mnexec
        sh('pkill -9 -f "sudo mnexec"')

        info("*** Removing junk from /tmp\n")
        sh("rm -f /tmp/vconn* /tmp/vlogs* /tmp/*.out /tmp/*.log")

        info("*** Removing old X11 tunnels\n")
        cleanUpScreens()

        info("*** Removing excess kernel datapaths\n")
        dps = sh("ps ax | egrep -o 'dp[0-9]+' | sed 's/dp/nl:/'").splitlines()
        for dp in dps:
            if dp:
                sh("dpctl deldp " + dp)

        info("***  Removing OVS datapaths\n")
        dps = sh("ovs-vsctl --timeout=1 list-br").strip().splitlines()
        if dps:
            sh("ovs-vsctl " + " -- ".join("--if-exists del-br " + dp for dp in dps if dp))
        # And in case the above didn't work...
        dps = sh("ovs-vsctl --timeout=1 list-br").strip().splitlines()
        for dp in dps:
            sh("ovs-vsctl del-br " + dp)

        info("*** Removing all links of the pattern foo-ethX\n")
        links = sh("ip link show | " "egrep -o '([-_.[:alnum:]]+-eth[[:digit:]]+)'").splitlines()
        # Delete blocks of links
        n = 1000  # chunk size
        for i in xrange(0, len(links), n):
            cmd = ";".join("ip link del %s" % link for link in links[i : i + n])
            sh("( %s ) 2> /dev/null" % cmd)

        if "tap9" in sh("ip link show"):
            info("*** Removing tap9 - assuming it's from cluster edition\n")
            sh("ip link del tap9")

        info("*** Killing stale mininet node processes\n")
        killprocs("mininet:")

        info("*** Shutting down stale tunnels\n")
        killprocs("Tunnel=Ethernet")
        killprocs(".ssh/mn")
        sh("rm -f ~/.ssh/mn/*")

        # Call any additional cleanup code if necessary
        for callback in cls.callbacks:
            callback()

        # Containernet should also cleanup pending Docker
        cmd = "docker rm -f $( docker ps --filter 'label=com.containernet' -a -q)"
        call(cmd, shell=True, stdout=open(os.devnull, "wb"), stderr=open(os.devnull, "wb"))

        info("*** Cleanup complete.\n")
开发者ID:mpeuster,项目名称:containernet,代码行数:68,代码来源:clean.py


注:本文中的mininet.term.cleanUpScreens函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。