Revision b57e5d93 mininet/node.py

View differences:

mininet/node.py
981 981
                if not intf.IP():
982 982
                    self.TCReapply( intf )
983 983

  
984
    def stop( self ):
984
    def stop( self, deleteIntfs=True ):
985 985
        "Stop OpenFlow reference user datapath."
986 986
        self.cmd( 'kill %ofdatapath' )
987 987
        self.cmd( 'kill %ofprotocol' )
988
        self.deleteIntfs()
988
        if deleteIntfs:
989
            self.deleteIntfs()
989 990

  
990 991

  
991 992
class OVSLegacyKernelSwitch( Switch ):
......
1031 1032
                  ' 1>' + ofplog + ' 2>' + ofplog + '&' )
1032 1033
        self.execed = False
1033 1034

  
1034
    def stop( self ):
1035
    def stop( self, deleteIntfs=True ):
1035 1036
        "Terminate kernel datapath."
1036 1037
        quietRun( 'ovs-dpctl del-dp ' + self.dp )
1037 1038
        self.cmd( 'kill %ovs-openflowd' )
1038
        self.deleteIntfs()
1039
        if deleteIntfs:
1040
            self.deleteIntfs()
1039 1041

  
1040 1042

  
1041 1043
class OVSSwitch( Switch ):
......
1183 1185
            self.TCReapply( intf )
1184 1186

  
1185 1187

  
1186
    def stop( self ):
1188
    def stop( self, deleteIntfs=True ):
1187 1189
        "Terminate OVS switch."
1188 1190
        self.cmd( 'ovs-vsctl del-br', self )
1189 1191
        if self.datapath == 'user':
1190 1192
            self.cmd( 'ip link del', self )
1191
        self.deleteIntfs()
1193
        if deleteIntfs:
1194
            self.deleteIntfs()
1192 1195

  
1193 1196

  
1194 1197
OVSKernelSwitch = OVSSwitch
......
1205 1208
        OVSSwitch.start( self, controllers=[] )
1206 1209

  
1207 1210

  
1208
class IVSSwitch(Switch):
1211
class IVSSwitch( Switch ):
1209 1212
    """IVS virtual switch"""
1210 1213

  
1211 1214
    def __init__( self, name, verbose=True, **kwargs ):
......
1251 1254

  
1252 1255
        self.cmd( ' '.join(args) + ' >' + logfile + ' 2>&1 </dev/null &' )
1253 1256

  
1254
    def stop( self ):
1257
    def stop( self, deleteIntfs=True ):
1255 1258
        "Terminate IVS switch."
1256 1259
        self.cmd( 'kill %ivs' )
1257 1260
        self.cmd( 'wait' )
1258
        self.deleteIntfs()
1261
        if deleteIntfs:
1262
            self.deleteIntfs()
1259 1263

  
1260 1264
    def attach( self, intf ):
1261 1265
        "Connect a data port"

Also available in: Unified diff