diff --git a/mininet/cli.py b/mininet/cli.py index 67ff1f90c63175502bdcf07bdf7a3630558656b0..fa8a50ba50aec4bef9615cceb88f2b845eab14a5 100644 --- a/mininet/cli.py +++ b/mininet/cli.py @@ -168,10 +168,25 @@ def do_iperf( self, line ): error( 'invalid number of args: iperf src dst\n' ) def do_iperfudp( self, line ): - "Simple iperf UDP test between two hosts." + "Simple iperf TCP test between two (optionally specified) hosts." args = line.split() - udpBw = args[ 0 ] if len( args ) else '10M' - self.mn.iperfUdp( udpBw ) + if not args: + self.mn.iperf( l4Type='UDP' ) + elif len(args) == 3: + udpBw = args[ 0 ] + hosts = [] + err = False + for arg in args[ 1:3 ]: + if arg not in self.nodemap: + err = True + error( "node '%s' not in network\n" % arg ) + else: + hosts.append( self.nodemap[ arg ] ) + if not err: + self.mn.iperf( hosts, l4Type='UDP', udpBw=udpBw ) + else: + error( 'invalid number of args: iperfudp bw src dst\n' + + 'bw examples: 10M\n' ) def do_intfs( self, line ): "List interfaces." diff --git a/mininet/net.py b/mininet/net.py index 9c1b0572d69c6bd1f0144ccabe3b4246f27c2810..5f1bb44f08b7fdcfad6b1ed03ba3189000994a6d 100755 --- a/mininet/net.py +++ b/mininet/net.py @@ -505,10 +505,6 @@ def iperf( self, hosts=None, l4Type='TCP', udpBw='10M' ): output( '*** Results: %s\n' % result ) return result - def iperfUdp( self, udpBw='10M' ): - "Run iperf UDP test." - return self.iperf( l4Type='UDP', udpBw=udpBw ) - def configLinkStatus( self, src, dst, status ): """Change status of src <-> dst links. src: node name