ovs: Configurable arguments of ovs-*ctl 95/54595/1
authorMartin Klozik <martinx.klozik@intel.com>
Thu, 29 Mar 2018 06:29:34 +0000 (07:29 +0100)
committerMartin Klozik <martinx.klozik@intel.com>
Thu, 29 Mar 2018 06:29:34 +0000 (07:29 +0100)
This patch introduces new configuration parameters OVS_OFCTL_ARGS,
OVS_VSCTL_ARGS and OVS_APPCTL_ARGS, which specify default arguments
passed to respective ovs-*ctl tools. So user can specify default
arguments passed to these tools inside configuration file, testcase
parameters or by --test-params option. For example OVS_OFCTL_ARGS
can be modified to use different OpenFlow version by default.

JIRA: VSPERF-567

Change-Id: Ie7448ea94a54b8044af12d0246d66514e057b7dc
Signed-off-by: Martin Klozik <martinx.klozik@intel.com>
Reviewed-by: Al Morton <acmorton@att.com>
Reviewed-by: Christian Trautman <ctrautma@redhat.com>
Reviewed-by: Sridhar Rao <sridhar.rao@spirent.com>
Reviewed-by: Richard Elias <richardx.elias@intel.com>
conf/02_vswitch.conf
src/ovs/ofctl.py

index 6a830a0..4d0fc46 100644 (file)
@@ -201,6 +201,11 @@ VSWITCH = "OvsDpdkVhost"
 VSWITCH_JUMBO_FRAMES_ENABLED = False
 VSWITCH_JUMBO_FRAMES_SIZE = 9000
 
+# default arguments of OVS ctl tools
+OVS_VSCTL_ARGS = []
+OVS_OFCTL_ARGS = ['-O', 'OpenFlow13']   # backward compatible default value
+OVS_APPCTL_ARGS = []
+
 #########################
 ## VPP
 #########################
index 64d5446..110940c 100644 (file)
@@ -25,10 +25,10 @@ import re
 import netaddr
 
 from tools import tasks
-from conf import settings
+from conf import settings as S
 
-_OVS_BRIDGE_NAME = settings.getValue('VSWITCH_BRIDGE_NAME')
-_OVS_CMD_TIMEOUT = settings.getValue('OVS_CMD_TIMEOUT')
+_OVS_BRIDGE_NAME = S.getValue('VSWITCH_BRIDGE_NAME')
+_OVS_CMD_TIMEOUT = S.getValue('OVS_CMD_TIMEOUT')
 
 _CACHE_FILE_NAME = '/tmp/vsperf_flows_cache'
 
@@ -62,9 +62,11 @@ class OFBase(object):
         :return: None
         """
         if self.timeout == -1:
-            cmd = ['sudo', settings.getValue('TOOLS')['ovs-vsctl'], '--no-wait'] + args
+            cmd = ['sudo', S.getValue('TOOLS')['ovs-vsctl'], '--no-wait'] + \
+                  S.getValue('OVS_VSCTL_ARGS') + args
         else:
-            cmd = ['sudo', settings.getValue('TOOLS')['ovs-vsctl'], '--timeout', str(self.timeout)] + args
+            cmd = ['sudo', S.getValue('TOOLS')['ovs-vsctl'], '--timeout',
+                   str(self.timeout)] + S.getValue('OVS_VSCTL_ARGS') + args
         return tasks.run_task(
             cmd, self.logger, 'Running ovs-vsctl...', check_error)
 
@@ -77,9 +79,9 @@ class OFBase(object):
 
         :return: None
         """
-        cmd = ['sudo', settings.getValue('TOOLS')['ovs-appctl'],
+        cmd = ['sudo', S.getValue('TOOLS')['ovs-appctl'],
                '--timeout',
-               str(self.timeout)] + args
+               str(self.timeout)] + S.getValue('OVS_APPCTL_ARGS') + args
         return tasks.run_task(
             cmd, self.logger, 'Running ovs-appctl...', check_error)
 
@@ -180,8 +182,8 @@ class OFBridge(OFBase):
         :return: None
         """
         tmp_timeout = self.timeout if timeout is None else timeout
-        cmd = ['sudo', settings.getValue('TOOLS')['ovs-ofctl'], '-O',
-               'OpenFlow13', '--timeout', str(tmp_timeout)] + args
+        cmd = ['sudo', S.getValue('TOOLS')['ovs-ofctl'], '--timeout',
+               str(tmp_timeout)] + S.getValue('OVS_OFCTL_ARGS') + args
         return tasks.run_task(
             cmd, self.logger, 'Running ovs-ofctl...', check_error)