Revision c1934706

View differences:

bin/mn
281 281
        if self.options.post:
282 282
            CLI( mn, script=self.options.post )
283 283

  
284
        mn.stop()
285 284

  
286 285
        elapsed = float( time.time() - start )
287 286
        info( 'completed in %0.3f seconds\n' % elapsed )
mininet/link.py
86 86

  
87 87
    def updateMAC( self ):
88 88
        "Return updated MAC address based on ifconfig"
89
        #heres where we send the unecessary ifconfigs
89 90
        ifconfig = self.ifconfig()
90 91
        macs = self._macMatchRegex.findall( ifconfig )
91 92
        self.mac = macs[ 0 ] if macs else None
......
102 103
    def isUp( self, setUp=False ):
103 104
        "Return whether interface is up"
104 105
        if setUp:
105
            self.ifconfig( 'up' )
106
        return "UP" in self.ifconfig()
106
            r = self.ifconfig( 'up' )
107
            if r:
108
                return False
109
            else:
110
                return True
111
        else:
112
            return "UP" in self.ifconfig()
107 113

  
108 114
    def rename( self, newname ):
109 115
        "Rename interface"
......
138 144
        results[ name ] = result
139 145
        return result
140 146

  
147
    def updateAddr( self ):
148
        "instead of updating ip and mac separately, use one ifconfig call to do it simultaneously"
149
        ifconfig = self.ifconfig()
150
        print ifconfig
151
        ips = self._ipMatchRegex.findall( ifconfig )
152
        macs = self._macMatchRegex.findall( ifconfig )
153
        self.ip = ips[ 0 ] if ips else None
154
        self.mac = macs[ 0 ] if macs else None
155
        return self.ip, self.mac
156

  
141 157
    def config( self, mac=None, ip=None, ifconfig=None,
142 158
                up=True, **_params ):
143 159
        """Configure Node according to (optional) parameters:
......
154 170
        self.setParam( r, 'setIP', ip=ip )
155 171
        self.setParam( r, 'isUp', up=up )
156 172
        self.setParam( r, 'ifconfig', ifconfig=ifconfig )
157
        self.updateIP()
158
        self.updateMAC()
173
        #should combine these next two operations into one. this is unecessary
174
        #self.updateAddr()
175
        #self.updateIP()
176
        #self.updateMAC()
159 177
        return r
160 178

  
161 179
    def delete( self ):
mininet/net.py
101 101
from mininet.util import quietRun, fixLimits, numCores, ensureRoot
102 102
from mininet.util import macColonHex, ipStr, ipParse, netParse, ipAdd
103 103
from mininet.term import cleanUpScreens, makeTerms
104
from multiprocessing.pool import ThreadPool
104 105

  
105 106
# Mininet version: should be consistent with README and LICENSE
106 107
VERSION = "2.1.0+"
......
159 160

  
160 161
        self.terms = []  # list of spawned xterm processes
161 162

  
163
        self.pool = ThreadPool( 64 )
164

  
162 165
        Mininet.init()  # Initialize Mininet if necessary
163 166

  
164 167
        self.built = False
......
374 377
            info( switchName + ' ' )
375 378

  
376 379
        info( '\n*** Adding links:\n' )
380
        # need to 'asynchronize' this too
377 381
        for srcName, dstName in topo.links(sort=True):
378 382
            src, dst = self.nameToNode[ srcName ], self.nameToNode[ dstName ]
379 383
            params = topo.linkInfo( srcName, dstName )
380 384
            srcPort, dstPort = topo.port( srcName, dstName )
381 385
            self.addLink( src, dst, srcPort, dstPort, **params )
386
            #self.pool.apply( self.addLink,  ( src, dst, srcPort, dstPort, params, ) )
387
            #self.pool.apply_async( self.addLink, args = ( src, dst )+ params, kwds = { 'Port1':srcPort, 'Port2':dstPort } )
382 388
            info( '(%s, %s) ' % ( src.name, dst.name ) )
383

  
389
        #self.pool.close()
390
        #self.pool.join()
384 391
        info( '\n' )
385 392

  
386 393
    def configureControlNetwork( self ):
mininet/util.py
82 82
    poller.register( popen.stdout, POLLIN )
83 83
    fdtofile = { popen.stdout.fileno(): popen.stdout }
84 84
    outDone, errDone = False, True
85
    #bookmark: rearrange this for aynch startup. shouldnt have to keep 
86
    # maybe we dont rearrange this. we really just need a method to call a command and NOT poll for output
85 87
    if popen.stderr:
86 88
        fdtofile[ popen.stderr.fileno() ] = popen.stderr
87 89
        poller.register( popen.stderr, POLLIN )
......
185 187
    intf = str( intf )
186 188
    cmd = 'ip link set %s netns %s' % ( intf, dstNode.pid )
187 189
    if srcNode:
188
        srcNode.cmd( cmd )
190
        output = srcNode.cmd( cmd )
189 191
    else:
190
        quietRun( cmd )
191
    if ( ' %s:' % intf ) not in dstNode.cmd( 'ip link show', intf ):
192
        output = quietRun( cmd )
193
    if output:
192 194
        if printError:
193 195
            error( '*** Error: moveIntf: ' + intf +
194 196
                   ' not successfully moved to ' + dstNode.name + '\n' )

Also available in: Unified diff