diff options
author | 2021-09-01 11:26:28 +0530 | |
---|---|---|
committer | 2021-09-07 10:29:55 +0530 | |
commit | 17e20bfa70d1a9ce5e6ee6687245e3e22f3633a8 (patch) | |
tree | 76240b45f7bc1ef5de20a60866908b0a3c33b7a8 /vswitches | |
parent | 8f4fd575ae70079d2bff9f9af4b251a3961b7428 (diff) |
Clean Output Option.
This patch adds support for clean output - displaying only final
results.
User has to run with --verbosity and level as error or critical.
--verbosity is an existing option.
Remove unnecessary spaces
Signed-off-by: Sridhar K. N. Rao <sridhar.rao@spirent.com>
Change-Id: Id227a4b787c4c7e4dd97f28009946ac6a8a802d3
Diffstat (limited to 'vswitches')
-rw-r--r-- | vswitches/ovs.py | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/vswitches/ovs.py b/vswitches/ovs.py index 853bef85..a77e898e 100644 --- a/vswitches/ovs.py +++ b/vswitches/ovs.py @@ -26,9 +26,9 @@ import pexpect from conf import settings from src.ovs import OFBridge, flow_key, flow_match -from vswitches.vswitch import IVSwitch from tools import tasks from tools.module_manager import ModuleManager +from vswitches.vswitch import IVSwitch # enable caching of flows if their number exceeds given limit _CACHE_FLOWS_LIMIT = 10 @@ -100,6 +100,8 @@ class IVSwitchOvs(IVSwitch, tasks.Process): try: tasks.Process.start(self) + if settings.getValue('CLEAN_OUTPUT'): + self._disable_console_output() self.relinquish() except (pexpect.EOF, pexpect.TIMEOUT) as exc: self._logger.error("Exception during VSwitch start.") @@ -469,6 +471,15 @@ class IVSwitchOvs(IVSwitch, tasks.Process): self._logger.info('System reset after last run.') + def _disable_console_output(self): + """ + Configure vswitch to disable console output + """ + ovsappctl_tool_bin = settings.getValue('TOOLS')['ovs-appctl'] + tasks.run_task(['sudo', ovsappctl_tool_bin, 'vlog/set', ' console:off'], + self._logger, + 'Turning off the logs ...') + def _start_ovsdb(self): """Start ``ovsdb-server`` instance. @@ -483,13 +494,22 @@ class IVSwitchOvs(IVSwitch, tasks.Process): ovsdb_server_bin = settings.getValue('TOOLS')['ovsdb-server'] - tasks.run_background_task( - ['sudo', ovsdb_server_bin, - '--remote=punix:%s' % os.path.join(settings.getValue('TOOLS')['ovs_var_tmp'], 'db.sock'), - '--remote=db:Open_vSwitch,Open_vSwitch,manager_options', - '--pidfile=' + self._ovsdb_pidfile_path, '--overwrite-pidfile'], - self._logger, - 'Starting ovsdb-server...') + if settings.getValue('CLEAN_OUTPUT'): + tasks.run_background_task( + ['sudo', ovsdb_server_bin, + '--remote=punix:%s' % os.path.join(settings.getValue('TOOLS')['ovs_var_tmp'], 'db.sock'), + '--remote=db:Open_vSwitch,Open_vSwitch,manager_options', + '--pidfile=' + self._ovsdb_pidfile_path, '--overwrite-pidfile', '--verbose=off'], + self._logger, + 'Starting ovsdb-server...') + else: + tasks.run_background_task( + ['sudo', ovsdb_server_bin, + '--remote=punix:%s' % os.path.join(settings.getValue('TOOLS')['ovs_var_tmp'], 'db.sock'), + '--remote=db:Open_vSwitch,Open_vSwitch,manager_options', + '--pidfile=' + self._ovsdb_pidfile_path, '--overwrite-pidfile'], + self._logger, + 'Starting ovsdb-server...') def _kill_ovsdb(self): """Kill ``ovsdb-server`` instance. |