Support vswitch selection from the command line. 78/1078/6
authorMartin Klozik <martinx.klozik@intel.com>
Thu, 23 Jul 2015 07:30:19 +0000 (08:30 +0100)
committerMaryam Tahhan <maryam.tahhan@intel.com>
Tue, 4 Aug 2015 11:48:40 +0000 (11:48 +0000)
New command line argument '--vswitch' was introduced to override
vswitch implementation selected in configuration file.
Modified file:
* vsperf

JIRA: VSPERF-27
Change-Id: Ia0070ea9f998349dcca697a0fe9519a009479477
Signed-off-by: Martin Klozik (martinx.klozik@intel.com)
Reviewed-by: Maryam Tahhan <maryamtahhan@intel.com>
vsperf

diff --git a/vsperf b/vsperf
index cb02d6d..34f42ca 100755 (executable)
--- a/vsperf
+++ b/vsperf
@@ -130,6 +130,7 @@ def parse_arguments():
     group.add_argument('--verbosity', choices=list_logging_levels(),
                        help='debug level')
     group.add_argument('--trafficgen', help='traffic generator to use')
+    group.add_argument('--vswitch', help='vswitch implementation to use')
     group.add_argument('--sysmetrics', help='system metrics logger to use')
     group = parser.add_argument_group('test behavior options')
     group.add_argument('--xunit', action='store_true',
@@ -301,6 +302,16 @@ def main():
                           settings.getValue('TRAFFICGEN_DIR'))
             sys.exit(1)
 
+    # configure vswitch
+    if args['vswitch']:
+        vswitches = Loader().get_vswitches()
+        if args['vswitch'] not in vswitches:
+            logging.error('There are no vswitches matching \'%s\' found in'
+                          ' \'%s\'. Exiting...', args['vswitch'],
+                          settings.getValue('VSWITCH_DIR'))
+            sys.exit(1)
+
+
 
     # generate results directory name
     date = datetime.datetime.fromtimestamp(time.time())