for(key, value) in list(item.items()):
logging.info(" Key: " + str(key) +
", Value: " + str(value))
+ if settings.getValue('CLEAN_OUTPUT'):
+ print(str(key) + ", " + str(value))
def get_results(self):
"""IResult interface implementation.
self._k8s = S.getValue('K8S')
if self._k8s:
if S.getValue('EXT_VSWITCH'):
- self._evfctl = extvswitchfctl.ExtVswitchFlowCtl()
+ self._evfctl = extvswitchflctl.ExtVswitchFlowCtl()
def run_initialize(self):
# dump vswitch flows before they are affected by VNF termination
if not self._vswitch_none:
- self._vswitch_ctl.dump_vswitch_connections()
+ if not S.getValue('CLEAN_OUTPUT'):
+ self._vswitch_ctl.dump_vswitch_connections()
# garbage collection for case that TestSteps modify existing deployment
self.step_stop_vnfs()
self._testcase_start_time))
logging.info("Testcase execution time: %s", self._testcase_run_time)
# report test results
+ if S.getValue('CLEAN_OUTPUT'):
+ print('BEGIN OF THE RESULTS')
self.run_report()
+ if S.getValue('CLEAN_OUTPUT'):
+ print('END OF THE RESULTS')
def _append_results(self, results):
"""
else:
raise RuntimeError('T-Rex: Trex host not defined')
- ping = subprocess.Popen(cmd_ping, shell=True, stderr=subprocess.PIPE)
+ if settings.getValue('CLEAN_OUTPUT'):
+ ping = subprocess.Popen(cmd_ping,
+ shell=True,
+ stdout=subprocess.DEVNULL,
+ stderr=subprocess.PIPE)
+ else:
+ ping = subprocess.Popen(cmd_ping,
+ shell=True,
+ stderr=subprocess.PIPE)
output, error = ping.communicate()
if ping.returncode:
self._trex_base_dir + "t-rex-64"
- find_trex = subprocess.Popen(cmd_find_trex,
- shell=True,
- stderr=subprocess.PIPE)
+ if settings.getValue('CLEAN_OUTPUT'):
+ find_trex = subprocess.Popen(cmd_find_trex,
+ shell=True,
+ stdout=subprocess.DEVNULL,
+ stderr=subprocess.PIPE)
+ else:
+ find_trex = subprocess.Popen(cmd_find_trex,
+ shell=True,
+ stderr=subprocess.PIPE)
+
output, error = find_trex.communicate()
if find_trex.returncode:
% (self._trex_host_ip_addr, self._trex_base_dir))
try:
- self._stlclient = STLClient(username=self._trex_user, server=self._trex_host_ip_addr,
- verbose_level='info')
+ if settings.getValue('CLEAN_OUTPUT'):
+ self._stlclient = STLClient(username=self._trex_user, server=self._trex_host_ip_addr,
+ verbose_level='error')
+ else:
+ self._stlclient = STLClient(username=self._trex_user, server=self._trex_host_ip_addr,
+ verbose_level='info')
self._stlclient.connect()
except STLError:
raise RuntimeError('T-Rex: Cannot connect to T-Rex server. Please check if it is '
self._stlclient.set_port_attr(my_ports, promiscuous=True)
packet_1, packet_2 = self.create_packets(traffic, ports_info)
- self.show_packet_info(packet_1, packet_2)
+ if not settings.getValue('CLEAN_OUTPUT'):
+ self.show_packet_info(packet_1, packet_2)
stream_1, stream_2, stream_1_lat, stream_2_lat = Trex.create_streams(packet_1, packet_2, traffic)
self._stlclient.add_streams(stream_1, ports=[0])
self._stlclient.add_streams(stream_2, ports=[1])
# if required, handle list-* operations
handle_list_options(args)
+ # Using verbosity to run 'clean' test-runs.
+ if args['verbosity']:
+ settings.setValue('VERBOSITY', args['verbosity'])
+ settings.setValue('CLEAN_OUTPUT', True)
+ else:
+ settings.setValue('CLEAN_OUTPUT', False)
+
configure_logging(settings.getValue('VERBOSITY'))
# CI build support
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
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.")
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.
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.