Revision edf60032

View differences:

bin/mn
37 37
# built in topologies, created only when run
38 38
TOPODEF = 'minimal'
39 39
TOPOS = { 'minimal': lambda: SingleSwitchTopo( k=2 ),
40
         'linear': LinearTopo,
41
         'reversed': SingleSwitchReversedTopo,
42
         'single': SingleSwitchTopo,
43
         'tree': TreeTopo }
40
          'linear': LinearTopo,
41
          'reversed': SingleSwitchReversedTopo,
42
          'single': SingleSwitchTopo,
43
          'tree': TreeTopo }
44 44

  
45 45
SWITCHDEF = 'ovsk'
46 46
SWITCHES = { 'user': UserSwitch,
47
            'ovsk': OVSKernelSwitch,
47
             'ovsk': OVSKernelSwitch,
48 48
             'ovsl': OVSLegacyKernelSwitch }
49 49

  
50 50
HOSTDEF = 'proc'
......
66 66

  
67 67
# optional tests to run
68 68
TESTS = [ 'cli', 'build', 'pingall', 'pingpair', 'iperf', 'all', 'iperfudp',
69
         'none' ]
69
          'none' ]
70 70

  
71
ALTSPELLING = { 'pingall': 'pingAll', 'pingpair': 'pingPair',
72
    'iperfudp': 'iperfUdp', 'iperfUDP': 'iperfUdp', 'prefixlen': 'prefixLen' }
71
ALTSPELLING = { 'pingall': 'pingAll',
72
                'pingpair': 'pingPair',
73
                'iperfudp': 'iperfUdp',
74
                'iperfUDP': 'iperfUdp',
75
                'prefixlen': 'prefixLen' }
73 76

  
74 77

  
75 78
def addDictOption( opts, choicesDict, default, name, helpStr=None ):
......
81 84
       help: string"""
82 85
    if default not in choicesDict:
83 86
        raise Exception( 'Invalid  default %s for choices dict: %s' %
84
                        ( default, name ) )
87
                         ( default, name ) )
85 88
    if not helpStr:
86 89
        helpStr = ( '|'.join( sorted( choicesDict.keys() ) ) +
87
                   '[,param=value...]' )
90
                    '[,param=value...]' )
88 91
    opts.add_option( '--' + name,
89
                    type='string',
90
                    default = default,
91
                    help = helpStr )
92
                     type='string',
93
                     default = default,
94
                     help = helpStr )
92 95

  
93 96

  
94 97
def version( *_args ):
......
158 161
        addDictOption( opts, TOPOS, TOPODEF, 'topo' )
159 162

  
160 163
        opts.add_option( '--clean', '-c', action='store_true',
161
                        default=False, help='clean and exit' )
164
                         default=False, help='clean and exit' )
162 165
        opts.add_option( '--custom', type='string', default=None,
163
                        help='read custom topo and node params from .py file' )
166
                         help='read custom topo and node params from .py file' )
164 167
        opts.add_option( '--test', type='choice', choices=TESTS,
165
                        default=TESTS[ 0 ],
166
                        help='|'.join( TESTS ) )
168
                         default=TESTS[ 0 ],
169
                         help='|'.join( TESTS ) )
167 170
        opts.add_option( '--xterms', '-x', action='store_true',
168
                        default=False, help='spawn xterms for each node' )
171
                         default=False, help='spawn xterms for each node' )
169 172
        opts.add_option( '--ipbase', '-i', type='string', default='10.0.0.0/8',
170 173
                         help='base IP address for hosts' )
171 174
        opts.add_option( '--mac', action='store_true',
172
                        default=False, help='automatically set host MACs' )
175
                         default=False, help='automatically set host MACs' )
173 176
        opts.add_option( '--arp', action='store_true',
174
                        default=False, help='set all-pairs ARP entries' )
177
                         default=False, help='set all-pairs ARP entries' )
175 178
        opts.add_option( '--verbosity', '-v', type='choice',
176
                        choices=LEVELS.keys(), default = 'info',
177
                        help = '|'.join( LEVELS.keys() )  )
179
                         choices=LEVELS.keys(), default = 'info',
180
                         help = '|'.join( LEVELS.keys() )  )
178 181
        opts.add_option( '--innamespace', action='store_true',
179
                        default=False, help='sw and ctrl in namespace?' )
182
                         default=False, help='sw and ctrl in namespace?' )
180 183
        opts.add_option( '--listenport', type='int', default=6635,
181 184
                         help='base port for passive switch listening' )
182 185
        opts.add_option( '--nolistenport', action='store_true',
183
                        default=False, help="don't use passive listening port")
186
                         default=False, help="don't use passive listening port")
184 187
        opts.add_option( '--pre', type='string', default=None,
185
                        help='CLI script to run before tests' )
188
                         help='CLI script to run before tests' )
186 189
        opts.add_option( '--post', type='string', default=None,
187
                        help='CLI script to run after tests' )
190
                         help='CLI script to run after tests' )
188 191
        opts.add_option( '--prefixlen', type='int', default=8,
189
                        help='prefix length (e.g. /8) for automatic '
190
                        'network configuration' )
192
                         help='prefix length (e.g. /8) for automatic '
193
                         'network configuration' )
191 194
        opts.add_option( '--pin', action='store_true',
192 195
                         default=False, help="pin hosts to CPU cores "
193 196
                         "(requires --host cfs or --host rt)" )
examples/consoles.py
74 74
            "Pop up a new terminal window for a node."
75 75
            net.terms += makeTerms( [ node ], title )
76 76
        label = Button( self, text=self.node.name, command=newTerm,
77
            **self.buttonStyle )
77
                        **self.buttonStyle )
78 78
        label.pack( side='top', fill='x' )
79 79
        text = Text( self, wrap='word', **self.textStyle )
80 80
        ybar = Scrollbar( self, orient='vertical', width=7,
81
            command=text.yview )
81
                          command=text.yview )
82 82
        text.configure( yscrollcommand=ybar.set )
83 83
        text.pack( side='left', expand=True, fill='both' )
84 84
        ybar.pack( side='right', fill='y' )
......
95 95
        # way to trigger a file event handler from Tk's
96 96
        # event loop!
97 97
        self.tk.createfilehandler( self.node.stdout, READABLE,
98
            self.handleReadable )
98
                                   self.handleReadable )
99 99

  
100 100
    # We're not a terminal (yet?), so we ignore the following
101 101
    # control characters other than [\b\n\r]
......
169 169

  
170 170
    "Graph that we can add bars to over time."
171 171

  
172
    def __init__( self, parent=None,
173
            bg = 'white',
174
            gheight=200, gwidth=500,
175
            barwidth=10,
176
            ymax=3.5,):
172
    def __init__( self, parent=None, bg = 'white', gheight=200, gwidth=500,
173
                  barwidth=10, ymax=3.5,):
177 174

  
178 175
        Frame.__init__( self, parent )
179 176

  
......
195 192
        width = 25
196 193
        ymax = self.ymax
197 194
        scale = Canvas( self, width=width, height=height,
198
            background=self.bg )
195
                        background=self.bg )
199 196
        opts = { 'fill': 'red' }
200 197
        # Draw scale line
201 198
        scale.create_line( width - 1, height, width - 1, 0, **opts )
......
211 208
        ofs = 20
212 209
        height = self.gheight + ofs
213 210
        self.graph.configure( scrollregion=( 0, -ofs,
214
            self.xpos * self.barwidth, height ) )
211
                              self.xpos * self.barwidth, height ) )
215 212
        self.scale.configure( scrollregion=( 0, -ofs, 0, height ) )
216 213

  
217 214
    def yview( self, *args ):
......
231 228
        xbar = Scrollbar( self, orient='horizontal', command=graph.xview )
232 229
        ybar = Scrollbar( self, orient='vertical', command=self.yview )
233 230
        graph.configure( xscrollcommand=xbar.set, yscrollcommand=ybar.set,
234
            scrollregion=(0, 0, width, height ) )
231
                         scrollregion=(0, 0, width, height ) )
235 232
        scale.configure( yscrollcommand=ybar.set )
236 233

  
237 234
        # Layout
examples/hwintf.py
21 21
    ips = re.findall( r'\d+\.\d+\.\d+\.\d+', quietRun( 'ifconfig ' + intf ) )
22 22
    if ips:
23 23
        error( 'Error:', intf, 'has an IP address,'
24
            'and is probably in use!\n' )
24
               'and is probably in use!\n' )
25 25
        exit( 1 )
26 26

  
27 27
if __name__ == '__main__':
examples/linearbandwidth.py
68 68
    hostCount = switchCount + 1
69 69

  
70 70
    switches = { 'reference user': UserSwitch,
71
            'Open vSwitch kernel': OVSKernelSwitch }
71
                 'Open vSwitch kernel': OVSKernelSwitch }
72 72

  
73 73
    topo = LinearTestTopo( hostCount )
74 74

  
examples/miniedit.py
112 112
        appMenu = Menu( mbar, tearoff=False )
113 113
        mbar.add_cascade( label=self.appName, font=font, menu=appMenu )
114 114
        appMenu.add_command( label='About MiniEdit', command=self.about,
115
            font=font)
115
                             font=font)
116 116
        appMenu.add_separator()
117 117
        appMenu.add_command( label='Quit', command=self.quit, font=font )
118 118

  
......
127 127
        editMenu = Menu( mbar, tearoff=False )
128 128
        mbar.add_cascade( label="Edit", font=font, menu=editMenu )
129 129
        editMenu.add_command( label="Cut", font=font,
130
            command=lambda: self.deleteSelection( None ) )
130
                              command=lambda: self.deleteSelection( None ) )
131 131

  
132 132
        runMenu = Menu( mbar, tearoff=False )
133 133
        mbar.add_cascade( label="Run", font=font, menu=runMenu )
......
143 143
        f = Frame( self )
144 144

  
145 145
        canvas = Canvas( f, width=self.cwidth, height=self.cheight,
146
            bg=self.bg )
146
                         bg=self.bg )
147 147

  
148 148
        # Scroll bars
149 149
        xbar = Scrollbar( f, orient='horizontal', command=canvas.xview )
......
177 177
        bbox = self.canvas.bbox( 'all' )
178 178
        if bbox is not None:
179 179
            self.canvas.configure( scrollregion=( 0, 0, bbox[ 2 ],
180
                bbox[ 3 ] ) )
180
                                   bbox[ 3 ] ) )
181 181

  
182 182
    def canvasx( self, x_root ):
183 183
        "Convert root x coordinate to canvas coordinate."
......
223 223
        for cmd, color in [ ( 'Stop', 'darkRed' ), ( 'Run', 'darkGreen' ) ]:
224 224
            doCmd = getattr( self, 'do' + cmd )
225 225
            b = Button( toolbar, text=cmd, font=self.smallFont,
226
                fg=color, command=doCmd )
226
                        fg=color, command=doCmd )
227 227
            b.pack( fill='x', side='bottom' )
228 228

  
229 229
        return toolbar
......
308 308
    def nodeIcon( self, node, name ):
309 309
        "Create a new node icon."
310 310
        icon = Button( self.canvas, image=self.images[ node ],
311
            text=name, compound='top' )
311
                       text=name, compound='top' )
312 312
        # Unfortunately bindtags wants a tuple
313 313
        bindtags = [ str( self.nodeBindings ) ]
314 314
        bindtags += list( icon.bindtags() )
......
322 322
        self.nodeCount += 1
323 323
        name = self.nodePrefixes[ node ] + str( self.nodeCount )
324 324
        icon = self.nodeIcon( node, name )
325
        item = self.canvas.create_window( x, y, anchor='c',
326
            window=icon, tags=node )
325
        item = self.canvas.create_window( x, y, anchor='c', window=icon,
326
                                          tags=node )
327 327
        self.widgetToItem[ icon ] = item
328 328
        self.itemToWidget[ item ] = icon
329 329
        self.selectItem( item )
......
437 437
        item = self.widgetToItem[ w ]
438 438
        x, y = self.canvas.coords( item )
439 439
        self.link = self.canvas.create_line( x, y, x, y, width=4,
440
            fill='blue', tag='link' )
440
                                             fill='blue', tag='link' )
441 441
        self.linkx, self.linky = x, y
442 442
        self.linkWidget = w
443 443
        self.linkItem = item
examples/multiping.py
40 40
            'done &' )
41 41

  
42 42
    print ( '*** Host %s (%s) will be pinging ips: %s' %
43
           ( host.name, host.IP(), targetips ) )
43
            ( host.name, host.IP(), targetips ) )
44 44

  
45 45
    host.cmd( cmd )
46 46

  
examples/multipoll.py
19 19
    tails, fdToFile, fdToHost = {}, {}, {}
20 20
    for h, outfile in outfiles.iteritems():
21 21
        tail = Popen( [ 'tail', '-f', outfile ],
22
                     stdout=PIPE, stderr=devnull )
22
                      stdout=PIPE, stderr=devnull )
23 23
        fd = tail.stdout.fileno()
24 24
        tails[ h ] = tail
25 25
        fdToFile[ fd ] = tail.stdout
examples/treeping64.py
10 10
    "Run ping test on 64-node tree networks."
11 11

  
12 12
    results = {}
13
    switches = {  # 'reference kernel': KernelSwitch,
14
        'reference user': UserSwitch,
15
        'Open vSwitch kernel': OVSKernelSwitch }
13
    switches = { # 'reference kernel': KernelSwitch,
14
                 'reference user': UserSwitch,
15
                 'Open vSwitch kernel': OVSKernelSwitch }
16 16

  
17 17
    for name in switches:
18 18
        print "*** Testing", name, "datapath"
mininet/cli.py
192 192
        "List interfaces."
193 193
        for node in self.nodelist:
194 194
            output( '%s: %s\n' %
195
                ( node.name, ','.join( node.intfNames() ) ) )
195
                    ( node.name, ','.join( node.intfNames() ) ) )
196 196

  
197 197
    def do_dump( self, _line ):
198 198
        "Dump node info."
......
303 303
            node = self.nodemap[ first ]
304 304
            # Substitute IP addresses for node names in command
305 305
            rest = [ self.nodemap[ arg ].IP()
306
                    if arg in self.nodemap else arg
307
                    for arg in rest ]
306
                     if arg in self.nodemap else arg
307
                     for arg in rest ]
308 308
            rest = ' '.join( rest )
309 309
            # Run cmd on node:
310 310
            builtin = isShellBuiltin( first )
mininet/link.py
202 202
            elif use_tbf:
203 203
                if latency_ms is None:
204 204
                    latency_ms = 15 * 8 / bw
205
                cmds += ['%s qdisc add dev %s root handle 1: tbf ' +
206
                        'rate %fMbit burst 15000 latency %fms' %
207
                         ( bw, latency_ms ) ]
205
                cmds += [ '%s qdisc add dev %s root handle 1: tbf ' +
206
                          'rate %fMbit burst 15000 latency %fms' %
207
                          ( bw, latency_ms ) ]
208 208
            else:
209 209
                cmds += [ '%s qdisc add dev %s root handle 1:0 htb default 1',
210
                         '%s class add dev %s parent 1:0 classid 1:1 htb ' +
211
                         'rate %fMbit burst 15k' % bw ]
210
                          '%s class add dev %s parent 1:0 classid 1:1 htb ' +
211
                          'rate %fMbit burst 15k' % bw ]
212 212
            parent = ' parent 1:1 '
213 213

  
214 214
            # ECN or RED
......
282 282

  
283 283
        # Bandwidth limits via various methods
284 284
        bwcmds, parent = self.bwCmds( bw=bw, speedup=speedup,
285
                                 use_hfsc=use_hfsc, use_tbf=use_tbf,
286
                                 latency_ms=latency_ms, enable_ecn=enable_ecn,
287
                                 enable_red=enable_red )
285
                                      use_hfsc=use_hfsc, use_tbf=use_tbf,
286
                                      latency_ms=latency_ms,
287
                                      enable_ecn=enable_ecn,
288
                                      enable_red=enable_red )
288 289
        cmds += bwcmds
289 290

  
290 291
        # Delay/jitter/loss/max_queue_size using netem
mininet/log.py
11 11
OUTPUT = 25
12 12

  
13 13
LEVELS = { 'debug': logging.DEBUG,
14
          'info': logging.INFO,
15
          'output': OUTPUT,
16
          'warning': logging.WARNING,
17
          'error': logging.ERROR,
18
          'critical': logging.CRITICAL }
14
           'info': logging.INFO,
15
           'output': OUTPUT,
16
           'warning': logging.WARNING,
17
           'error': logging.ERROR,
18
           'critical': logging.CRITICAL }
19 19

  
20 20
# change this to logging.INFO to get printouts when running unit tests
21 21
LOGLEVELDEFAULT = OUTPUT
mininet/moduledeps.py
48 48
            modprobeOutput = modprobe( mod )
49 49
            if modprobeOutput:
50 50
                error( 'Error inserting ' + mod +
51
                ' - is it installed and available via modprobe?\n' +
52
                'Error was: "%s"\n' % modprobeOutput )
51
                       ' - is it installed and available via modprobe?\n' +
52
                       'Error was: "%s"\n' % modprobeOutput )
53 53
            if mod not in lsmod():
54 54
                error( 'Failed to insert ' + mod + ' - quitting.\n' )
55 55
                exit( 1 )
......
63 63
    for arg in args:
64 64
        if not quietRun( 'which ' + arg ):
65 65
            error( 'Cannot find required executable %s.\n' % arg +
66
                'Please make sure that %s is installed ' % moduleName +
67
                'and available in your $PATH:\n(%s)\n' % environ[ 'PATH' ] )
66
                   'Please make sure that %s is installed ' % moduleName +
67
                   'and available in your $PATH:\n(%s)\n' % environ[ 'PATH' ] )
68 68
            exit( 1 )
mininet/net.py
107 107
    "Network emulation with hosts spawned in network namespaces."
108 108

  
109 109
    def __init__( self, topo=None, switch=OVSKernelSwitch, host=Host,
110
                 controller=Controller, link=Link, intf=Intf,
111
                 build=True, xterms=False, cleanup=False, ipBase='10.0.0.0/8',
112
                 inNamespace=False,
113
                 autoSetMacs=False, autoStaticArp=False, autoPinCpus=False,
114
                 listenPort=None ):
110
                  controller=Controller, link=Link, intf=Intf,
111
                  build=True, xterms=False, cleanup=False, ipBase='10.0.0.0/8',
112
                  inNamespace=False,
113
                  autoSetMacs=False, autoStaticArp=False, autoPinCpus=False,
114
                  listenPort=None ):
115 115
        """Create Mininet object.
116 116
           topo: Topo (topology) object or None
117 117
           switch: default Switch class
......
307 307
    def configureControlNetwork( self ):
308 308
        "Control net config hook: override in subclass"
309 309
        raise Exception( 'configureControlNetwork: '
310
               'should be overriden in subclass', self )
310
                         'should be overriden in subclass', self )
311 311

  
312 312
    def build( self ):
313 313
        "Build mininet."
......
519 519
                output('waiting for iperf to start up...')
520 520
                sleep(.5)
521 521
        cliout = client.cmd( iperfArgs + '-t 5 -c ' + server.IP() + ' ' +
522
                           bwArgs )
522
                             bwArgs )
523 523
        debug( 'Client output: %s\n' % cliout )
524 524
        server.sendInt()
525 525
        servout += server.waitOutput()
......
617 617
    # in the control network location.
618 618

  
619 619
    def configureRoutedControlNetwork( self, ip='192.168.123.1',
620
            prefixLen=16 ):
620
                                       prefixLen=16 ):
621 621
        """Configure a routed control network on controller and switches.
622 622
           For use with the user datapath only right now."""
623 623
        controller = self.controllers[ 0 ]
mininet/node.py
52 52

  
53 53
from mininet.log import info, error, warn, debug
54 54
from mininet.util import ( quietRun, errRun, errFail, moveIntf, isShellBuiltin,
55
                          numCores, retry, mountCgroups )
55
                           numCores, retry, mountCgroups )
56 56
from mininet.moduledeps import moduleDeps, pathCheck, OVS_KMOD, OF_KMOD, TUN
57 57
from mininet.link import Link, Intf, TCIntf
58 58

  
......
120 120
        # bash -m: enable job control
121 121
        cmd = [ 'mnexec', opts, 'bash', '-m' ]
122 122
        self.shell = Popen( cmd, stdin=PIPE, stdout=PIPE, stderr=STDOUT,
123
            close_fds=True )
123
                            close_fds=True )
124 124
        self.stdin = self.shell.stdin
125 125
        self.stdout = self.shell.stdout
126 126
        self.pid = self.shell.pid
......
355 355
            return self.intfs[ min( ports ) ]
356 356
        else:
357 357
            warn( '*** defaultIntf: warning:', self.name,
358
                 'has no interfaces\n' )
358
                  'has no interfaces\n' )
359 359

  
360 360
    def intf( self, intf='' ):
361 361
        """Return our interface object with given name,
......
513 513
    def __repr__( self ):
514 514
        "More informative string representation"
515 515
        intfs = ( ','.join( [ '%s:%s' % ( i.name, i.IP() )
516
                        for i in self.intfList() ] ) )
516
                              for i in self.intfList() ] ) )
517 517
        return '<%s %s: %s pid=%s> ' % (
518 518
            self.__class__.__name__, self.name, intfs, self.pid )
519 519

  
......
775 775
    def __repr__( self ):
776 776
        "More informative string representation"
777 777
        intfs = ( ','.join( [ '%s:%s' % ( i.name, i.IP() )
778
                        for i in self.intfList() ] ) )
778
                              for i in self.intfList() ] ) )
779 779
        return '<%s %s: %s pid=%s> ' % (
780 780
            self.__class__.__name__, self.name, intfs, self.pid )
781 781

  
......
789 789
           name: name for the switch"""
790 790
        Switch.__init__( self, name, **kwargs )
791 791
        pathCheck( 'ofdatapath', 'ofprotocol',
792
            moduleName='the OpenFlow reference user switch (openflow.org)' )
792
                   moduleName='the OpenFlow reference user switch' +
793
                              '(openflow.org)' )
793 794
        if self.listenPort:
794 795
            self.opts += ' --listen=ptcp:%i ' % self.listenPort
795 796

  
......
812 813
           controllers: list of controller objects"""
813 814
        # Add controllers
814 815
        clist = ','.join( [ 'tcp:%s:%d' % ( c.IP(), c.port )
815
                           for c in controllers ] )
816
                            for c in controllers ] )
816 817
        ofdlog = '/tmp/' + self.name + '-ofd.log'
817 818
        ofplog = '/tmp/' + self.name + '-ofp.log'
818 819
        self.cmd( 'ifconfig lo up' )
819 820
        intfs = [ str( i ) for i in self.intfList() if not i.IP() ]
820 821
        self.cmd( 'ofdatapath -i ' + ','.join( intfs ) +
821
            ' punix:/tmp/' + self.name + ' -d ' + self.dpid +
822
            ' 1> ' + ofdlog + ' 2> ' + ofdlog + ' &' )
822
                  ' punix:/tmp/' + self.name + ' -d ' + self.dpid +
823
                  ' 1> ' + ofdlog + ' 2> ' + ofdlog + ' &' )
823 824
        self.cmd( 'ofprotocol unix:/tmp/' + self.name +
824
            ' ' + clist +
825
            ' --fail=closed ' + self.opts +
826
            ' 1> ' + ofplog + ' 2>' + ofplog + ' &' )
825
                  ' ' + clist +
826
                  ' --fail=closed ' + self.opts +
827
                  ' 1> ' + ofplog + ' 2>' + ofplog + ' &' )
827 828

  
828 829
    def stop( self ):
829 830
        "Stop OpenFlow reference user datapath."
......
846 847
        self.intf = self.dp
847 848
        if self.inNamespace:
848 849
            error( "OVSKernelSwitch currently only works"
849
                " in the root namespace.\n" )
850
                   " in the root namespace.\n" )
850 851
            exit( 1 )
851 852

  
852 853
    @classmethod
853 854
    def setup( cls ):
854 855
        "Ensure any dependencies are loaded; if not, try to load them."
855 856
        pathCheck( 'ovs-dpctl', 'ovs-openflowd',
856
            moduleName='Open vSwitch (openvswitch.org)')
857
                   moduleName='Open vSwitch (openvswitch.org)')
857 858
        moduleDeps( subtract=OF_KMOD, add=OVS_KMOD )
858 859

  
859 860
    def start( self, controllers ):
......
868 869
        self.cmd( 'ovs-dpctl', 'add-if', self.dp, ' '.join( intfs ) )
869 870
        # Run protocol daemon
870 871
        clist = ','.join( [ 'tcp:%s:%d' % ( c.IP(), c.port )
871
                           for c in controllers ] )
872
                            for c in controllers ] )
872 873
        self.cmd( 'ovs-openflowd ' + self.dp +
873
            ' ' + clist +
874
            ' --fail=secure ' + self.opts +
875
            ' --datapath-id=' + self.dpid +
876
            ' 1>' + ofplog + ' 2>' + ofplog + '&' )
874
                  ' ' + clist +
875
                  ' --fail=secure ' + self.opts +
876
                  ' --datapath-id=' + self.dpid +
877
                  ' 1>' + ofplog + ' 2>' + ofplog + '&' )
877 878
        self.execed = False
878 879

  
879 880
    def stop( self ):
......
897 898
    def setup( cls ):
898 899
        "Make sure Open vSwitch is installed and working"
899 900
        pathCheck( 'ovs-vsctl',
900
            moduleName='Open vSwitch (openvswitch.org)')
901
                   moduleName='Open vSwitch (openvswitch.org)')
901 902
        # This should no longer be needed, and it breaks
902 903
        # with OVS 1.7 which has renamed the kernel module:
903 904
        #  moduleDeps( subtract=OF_KMOD, add=OVS_KMOD )
......
970 971
       OpenFlow controller."""
971 972

  
972 973
    def __init__( self, name, inNamespace=False, command='controller',
973
                 cargs='-v ptcp:%d', cdir=None, ip="127.0.0.1",
974
                 port=6633, **params ):
974
                  cargs='-v ptcp:%d', cdir=None, ip="127.0.0.1",
975
                  port=6633, **params ):
975 976
        self.command = command
976 977
        self.cargs = cargs
977 978
        self.cdir = cdir
978 979
        self.ip = ip
979 980
        self.port = port
980 981
        Node.__init__( self, name, inNamespace=inNamespace,
981
            ip=ip, **params  )
982
                       ip=ip, **params  )
982 983
        self.cmd( 'ifconfig lo up' )  # Shouldn't be necessary
983 984
        self.checkListening()
984 985

  
......
1002 1003
        if self.cdir is not None:
1003 1004
            self.cmd( 'cd ' + self.cdir )
1004 1005
        self.cmd( self.command + ' ' + self.cargs % self.port +
1005
            ' 1>' + cout + ' 2>' + cout + '&' )
1006
                  ' 1>' + cout + ' 2>' + cout + '&' )
1006 1007
        self.execed = False
1007 1008

  
1008 1009
    def stop( self ):
......
1050 1051
        noxCoreDir = os.environ[ 'NOX_CORE_DIR' ]
1051 1052

  
1052 1053
        Controller.__init__( self, name,
1053
            command=noxCoreDir + '/nox_core',
1054
            cargs='--libdir=/usr/local/lib -v -i ptcp:%s ' +
1055
                    ' '.join( noxArgs ),
1056
            cdir=noxCoreDir, **kwargs )
1054
                             command=noxCoreDir + '/nox_core',
1055
                             cargs='--libdir=/usr/local/lib -v -i ptcp:%s ' +
1056
                                   ' '.join( noxArgs ),
1057
                             cdir=noxCoreDir,
1058
                             **kwargs )
1057 1059

  
1058 1060

  
1059 1061
class RemoteController( Controller ):
1060 1062
    "Controller running outside of Mininet's control."
1061 1063

  
1062 1064
    def __init__( self, name, ip='127.0.0.1',
1063
                 port=6633, **kwargs):
1065
                  port=6633, **kwargs):
1064 1066
        """Init.
1065 1067
           name: name to give controller
1066 1068
           ip: the IP address where the remote controller is
1067 1069
           listening
1068 1070
           port: the port where the remote controller is listening"""
1069
        Controller.__init__( self, name, ip=ip, port=port,
1070
            **kwargs )
1071
        Controller.__init__( self, name, ip=ip, port=port, **kwargs )
1071 1072

  
1072 1073
    def start( self ):
1073 1074
        "Overridden to do nothing."
mininet/util.py
181 181
    if not ( ' %s:' % intf ) in links:
182 182
        if printError:
183 183
            error( '*** Error: moveIntf: ' + intf +
184
                ' not successfully moved to ' + node.name + '\n' )
184
                   ' not successfully moved to ' + node.name + '\n' )
185 185
        return False
186 186
    return True
187 187

  
......
431 431

  
432 432
    if not constructor:
433 433
        raise Exception( "error: %s is unknown - please specify one of %s" %
434
               ( cname, constructors.keys() ) )
434
                         ( cname, constructors.keys() ) )
435 435

  
436 436
    def customized( name, *args, **params ):
437 437
        "Customized constructor, useful for Node, Link, and other classes"

Also available in: Unified diff