Revision 216a4b7c mininet/net.py

View differences:

mininet/net.py
104 104
    "Network emulation with hosts spawned in network namespaces."
105 105

  
106 106
    def __init__( self, topo=None, switch=OVSKernelSwitch, host=Host,
107
                 controller=Controller, link=Link,
107
                 controller=Controller, link=Link, intf=None, 
108 108
                 build=True, xterms=False, cleanup=False,
109 109
                 inNamespace=False,
110 110
                 autoSetMacs=False, autoStaticArp=False, listenPort=None ):
......
114 114
           host: default Host class/constructor
115 115
           controller: default Controller class/constructor
116 116
           link: default Link class/constructor
117
           intf: default Intf class/constructor
117 118
           ipBase: base IP address for hosts,
118 119
           build: build now from topo?
119 120
           xterms: if build now, spawn xterms?
......
123 124
           autoStaticArp: set all-pairs static MAC addrs?
124 125
           listenPort: base listening port to open; will be incremented for
125 126
               each additional switch in the net if inNamespace=False"""
127
        self.topo = topo
126 128
        self.switch = switch
127 129
        self.host = host
128 130
        self.controller = controller
129 131
        self.link = link
130
        self.topo = topo
132
        self.intf = intf
131 133
        self.inNamespace = inNamespace
132 134
        self.xterms = xterms
133 135
        self.cleanup = cleanup
......
199 201
    def configHosts( self ):
200 202
        "Configure a set of hosts."
201 203
        for host in self.hosts:
204
            info( host.name + ' ' )
202 205
            host.configDefault( defaultRoute=host.defaultIntf )
203 206
            # You're low priority, dude!
204 207
            # BL: do we want to do this here or not?
205 208
            # May not make sense if we have CPU lmiting...
206 209
            # quietRun( 'renice +18 -p ' + repr( host.pid ) )
207
            info( host.name + ' ' )
208 210
        info( '\n' )
209 211

  
210 212
    def buildFromTopo( self, topo=None ):
......
235 237
            ei = topo.edgeInfo( srcId, dstId )
236 238
            link = getattr( ei, 'cls', link )
237 239
            params = ei.params
240
            if self.intf and not 'intf' in params:
241
                params[ 'intf' ] = self.intf
238 242
            if not link:
239 243
                link = self.link
240 244
            info( '(%s, %s) ' % ( src.name, dst.name ) )
......
447 451
            error( 'could not parse iperf output: ' + iperfOutput )
448 452
            return ''
449 453

  
454
    # XXX This should be cleaned up
455

  
450 456
    def iperf( self, hosts=None, l4Type='TCP', udpBw='10M' ):
451 457
        """Run iperf between two hosts.
452 458
           hosts: list of hosts; if None, uses opposite hosts

Also available in: Unified diff