From 299925c22f278434cfd3f9092a716cb853c73990 Mon Sep 17 00:00:00 2001
From: Brandon Heller <brandonh@stanford.edu>
Date: Tue, 10 Aug 2010 04:28:18 -0700
Subject: [PATCH] Add more param choices for iperf udp on CLI

---
 mininet/cli.py | 21 ++++++++++++++++++---
 mininet/net.py |  4 ----
 2 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/mininet/cli.py b/mininet/cli.py
index 67ff1f90..fa8a50ba 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 9c1b0572..5f1bb44f 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
-- 
GitLab