Revision b1ec912d mininet/link.py

View differences:

mininet/link.py
33 33
    "Basic interface object that can configure itself."
34 34

  
35 35
    def __init__( self, name, node=None, port=None, link=None,
36
                  mac=None, srcNode=None, **params ):
36
                  mac=None, **params ):
37 37
        """name: interface name (e.g. h1-eth0)
38 38
           node: owning node (where this intf most likely lives)
39 39
           link: parent link if we're part of a link
......
71 71
            return self.ifconfig( ipstr, 'up' )
72 72
        else:
73 73
            if prefixLen is None:
74
                raise Exception( 'No prefix length set for IP address %s' % ( ipstr, ) )
74
                raise Exception( 'No prefix length set for IP address %s'
75
                                 % ( ipstr, ) )
75 76
            self.ip, self.prefixLen = ipstr, prefixLen
76 77
            return self.ifconfig( '%s/%s' % ( ipstr, prefixLen ) )
77 78

  
......
196 197

  
197 198
    def status( self ):
198 199
        "Return intf status as a string"
199
        links, err_, result_ = self.node.pexec( 'ip link show' )
200
        links, _err, _result = self.node.pexec( 'ip link show' )
200 201
        if self.name in links:
201 202
            return "OK"
202 203
        else:
......
419 420

  
420 421
    def intfName( self, node, n ):
421 422
        "Construct a canonical interface name node-ethN for interface n."
423
        # Leave this as an instance method for now
424
        assert self
422 425
        return node.name + '-eth' + repr( n )
423 426

  
424 427
    @classmethod
425
    def makeIntfPair( _cls, intfname1, intfname2, addr1=None, addr2=None ):
428
    def makeIntfPair( cls, intfname1, intfname2, addr1=None, addr2=None ):
426 429
        """Create pair of interfaces
427 430
           intfname1: name of interface 1
428 431
           intfname2: name of interface 2
429 432
           (override this method [and possibly delete()]
430 433
           to change link type)"""
434
        # Leave this as a class method for now
435
        assert cls
431 436
        return makeIntfPair( intfname1, intfname2, addr1, addr2 )
432 437

  
433 438
    def delete( self ):

Also available in: Unified diff