Revision c92c4efb mininet/net.py

View differences:

mininet/net.py
337 337
            cls: link class (optional)
338 338
            params: additional link params (optional)
339 339
            returns: link object"""
340
        # Accept node objects or names
340 341
        node1 = node1 if type( node1 ) != str else self[ node1 ]
341 342
        node2 = node2 if type( node2 ) != str else self[ node2 ]
342 343
        options = dict( params )
343
        options.setdefault( 'addr1', self.randMac() )
344
        options.setdefault( 'addr2', self.randMac() )
344
        # Port is optional
345 345
        if port1 is not None:
346 346
            options.setdefault( 'port1', port1 )
347 347
        if port2 is not None:
348 348
            options.setdefault( 'port2', port2 )
349
        # Set default MAC - this should probably be in Link
350
        options.setdefault( 'addr1', self.randMac() )
351
        options.setdefault( 'addr2', self.randMac() )
349 352
        cls = self.link if cls is None else cls
350 353
        link = cls( node1, node2, **options )
351 354
        self.links.append( link )

Also available in: Unified diff