Revision c273f490 mininet/node.py

View differences:

mininet/node.py
258 258
        assert not self.waiting
259 259
        printPid = kwargs.get( 'printPid', True )
260 260
        # Allow sendCmd( [ list ] )
261
        if len( args ) == 1 and type( args[ 0 ] ) is list:
261
        if len( args ) == 1 and isinstance( args[ 0 ], list ):
262 262
            cmd = args[ 0 ]
263 263
        # Allow sendCmd( cmd, arg1, arg2... )
264 264
        elif len( args ) > 0:
......
352 352
                     [ 'mnexec', '-da', str( self.pid ) ] }
353 353
        defaults.update( kwargs )
354 354
        if len( args ) == 1:
355
            if type( args[ 0 ] ) is list:
355
            if isinstance( args[ 0 ], list ):
356 356
                # popen([cmd, arg1, arg2...])
357 357
                cmd = args[ 0 ]
358 358
            elif isinstance( args[ 0 ], basestring ):
......
539 539
        f = getattr( self, method, None )
540 540
        if not f:
541 541
            return
542
        if type( value ) is list:
542
        if isinstance( value, list ):
543 543
            result = f( *value )
544
        elif type( value ) is dict:
544
        elif isinstance( valude, dict ):
545 545
            result = f( **value )
546 546
        else:
547 547
            result = f( value )
......
774 774
        "Specify (real) cores that our cgroup can run on"
775 775
        if not cores:
776 776
            return
777
        if type( cores ) is list:
777
        if isinstance( cores, list ):
778 778
            cores = ','.join( [ str( c ) for c in cores ] )
779 779
        self.cgroupSet( resource='cpuset', param='cpus',
780 780
                        value=cores )
......
937 937
           over tc queuing disciplines. To resolve the conflict,
938 938
           we re-create the user switch's configuration, but as a
939 939
           leaf of the TCIntf-created configuration."""
940
        if type( intf ) is TCIntf:
940
        if isinstance( intf, TCIntf ):
941 941
            ifspeed = 10000000000 # 10 Gbps
942 942
            minspeed = ifspeed * 0.001
943 943

  
......
1097 1097
        """Unfortunately OVS and Mininet are fighting
1098 1098
           over tc queuing disciplines. As a quick hack/
1099 1099
           workaround, we clear OVS's and reapply our own."""
1100
        if type( intf ) is TCIntf:
1100
        if isinstance( intf, TCIntf ):
1101 1101
            intf.config( **intf.params )
1102 1102

  
1103 1103
    def attach( self, intf ):

Also available in: Unified diff