trafficgen: pause trafficgenerator 41/10341/3
authorMaryam Tahhan <maryam.tahhan@intel.com>
Sun, 21 Feb 2016 14:29:32 +0000 (14:29 +0000)
committerMaryam Tahhan <maryam.tahhan@intel.com>
Tue, 23 Feb 2016 11:35:53 +0000 (11:35 +0000)
Add a mode to pause the traffic generator before transmission to bypass
manual setup if required.

Change-Id: Iad62a5e7cb83a311e2814d8a9ee2bc9b2d2ed4de
Signed-off-by: Maryam Tahhan <maryam.tahhan@intel.com>
Reviewed-by: Christian Trautman <ctrautma@redhat.com>
Reviewed-by: Martin Klozik <martinx.klozik@intel.com>
Reviewed-by: Al Morton <acmorton@att.com>
docs/userguide/testusage.rst
testcases/testcase.py
vsperf

index 06583d8..824ae6f 100755 (executable)
@@ -393,6 +393,7 @@ Mode of operation is driven by configuration parameter -m or --mode
             "normal" - execute vSwitch, VNF and traffic generator
             "trafficgen" - execute only traffic generator
             "trafficgen-off" - execute vSwitch and VNF
+            "trafficgen-pause" - execute vSwitch and VNF but wait before traffic transmission
 
 In case, that VSPERF is executed in "trafficgen" mode, then configuration
 of traffic generator should be configured through --test-param option.
index 6fa1092..c79e4d0 100644 (file)
@@ -199,6 +199,16 @@ class TestCase(object):
                     self._logger.debug("All is set. Please run traffic generator manually.")
                     input(os.linesep + "Press Enter to terminate vswitchperf..." + os.linesep + os.linesep)
                 else:
+                    if S.getValue('mode') == 'trafficgen-pause':
+                        time.sleep(2)
+                        true_vals = ('yes', 'y', 'ye', None)
+                        while True:
+                            choice = input(os.linesep + 'Transmission paused, should'
+                                           ' transmission be resumed? ' + os.linesep).lower()
+                            if not choice or choice not in true_vals:
+                                print('Please respond with \'yes\' or \'y\' ', end='')
+                            else:
+                                break
                     with traffic_ctl:
                         traffic_ctl.send_traffic(self._traffic)
 
diff --git a/vsperf b/vsperf
index 63913c7..d141227 100755 (executable)
--- a/vsperf
+++ b/vsperf
@@ -145,7 +145,8 @@ def parse_arguments():
     group.add_argument('-m', '--mode', help='vsperf mode of operation;\
             Values: "normal" - execute vSwitch, VNF and traffic generator;\
             "trafficgen" - execute only traffic generator; "trafficgen-off" \
-            - execute vSwitch and VNF', default='normal')
+            - execute vSwitch and VNF; trafficgen-pause - execute vSwitch \
+            and VNF but pause before traffic transmission ', default='normal')
 
     group.add_argument('-f', '--test-spec', help='test specification file')
     group.add_argument('-d', '--test-dir', help='directory containing tests')