<s> """<STR_LIT>""" <EOL> from mininet . topo import Topo <EOL> from mininet . net import Mininet <EOL> from mininet . node import CPULimitedHost <EOL> from mininet . link import TCLink <EOL> from mininet . util import dumpNodeConnections <EOL> from mininet . log import setLogLevel <EOL> from sys import argv <EOL> class SingleSwitchTopo ( Topo ) : <EOL> "<STR_LIT>" <EOL> def __init__ ( self , n = <NUM_LIT:2> , lossy = True , ** opts ) : <EOL> Topo . __init__ ( self , ** opts ) <EOL> switch = self . addSwitch ( '<STR_LIT>' ) <EOL> for h in range ( n ) : <EOL> host = self . addHost ( '<STR_LIT>' % ( h + <NUM_LIT:1> ) , <EOL> cpu = <NUM_LIT> / n ) <EOL> if lossy : <EOL> self . addLink ( host , switch , <EOL> bw = <NUM_LIT:10> , delay = '<STR_LIT>' , loss = <NUM_LIT:10> , use_htb = True ) <EOL> else : <EOL> self . addLink ( host , switch , <EOL> bw = <NUM_LIT:10> , delay = '<STR_LIT>' , loss = <NUM_LIT:0> , use_htb = True ) <EOL> def perfTest ( lossy = True ) : <EOL> "<STR_LIT>" <EOL> topo = SingleSwitchTopo ( n = <NUM_LIT:4> , lossy = lossy ) <EOL> net = Mininet ( topo = topo , <EOL> host = CPULimitedHost , link = TCLink , <EOL> autoStaticArp = True ) <EOL> net . start ( ) <EOL> print "<STR_LIT>" <EOL> dumpNodeConnections ( net . hosts ) <EOL> print "<STR_LIT>" <EOL> h1 , h4 = net . getNodeByName ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> net . iperf ( ( h1 , h4 ) , l4Type = '<STR_LIT>' ) <EOL> net . stop ( ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> setLogLevel ( '<STR_LIT:info>' ) <EOL> perfTest ( lossy = ( '<STR_LIT>' not in argv ) ) </s>
