diff options
-rw-r--r-- | src/dpdk/testpmd_proc.py | 6 | ||||
-rw-r--r-- | vnfs/qemu/qemu.py | 19 | ||||
-rwxr-xr-x | vsperf | 34 | ||||
-rw-r--r-- | vswitches/ovs.py | 7 | ||||
-rw-r--r-- | vswitches/vpp_dpdk_vhost.py | 8 |
5 files changed, 53 insertions, 21 deletions
diff --git a/src/dpdk/testpmd_proc.py b/src/dpdk/testpmd_proc.py index a8fa8eee..b89bcec2 100644 --- a/src/dpdk/testpmd_proc.py +++ b/src/dpdk/testpmd_proc.py @@ -27,8 +27,12 @@ from tools import tasks _TESTPMD_PROMPT = 'Done' +_NAME, _EXT = os.path.splitext(settings.getValue('LOG_FILE_VSWITCHD')) _LOG_FILE_VSWITCHD = os.path.join( - settings.getValue('LOG_DIR'), settings.getValue('LOG_FILE_VSWITCHD')) + settings.getValue('LOG_DIR'), + ("{name}_{uid}{ex}".format(name=_NAME, uid=settings.getValue( + 'LOG_TIMESTAMP'), ex=_EXT))) + class TestPMDProcess(tasks.Process): """Class wrapper for controlling a TestPMD instance. diff --git a/vnfs/qemu/qemu.py b/vnfs/qemu/qemu.py index d3e1b343..2ccf3aa0 100644 --- a/vnfs/qemu/qemu.py +++ b/vnfs/qemu/qemu.py @@ -46,12 +46,14 @@ class IVnfQemu(IVnf): Initialisation function. """ super(IVnfQemu, self).__init__() - + name, ext = os.path.splitext(S.getValue('LOG_FILE_QEMU')) + name = name + str(self._number) + rename_qemu = "{name}_{uid}{ex}".format(name=name, + uid=S.getValue('LOG_TIMESTAMP'), + ex=ext) self._expect = S.getValue('GUEST_PROMPT_LOGIN')[self._number] self._logger = logging.getLogger(__name__) - self._logfile = os.path.join( - S.getValue('LOG_DIR'), - S.getValue('LOG_FILE_QEMU')) + str(self._number) + self._logfile = os.path.join(S.getValue('LOG_DIR'), rename_qemu) self._timeout = S.getValue('GUEST_TIMEOUT')[self._number] self._monitor = '%s/vm%dmonitor' % ('/tmp', self._number) # read GUEST NICs configuration and use only defined NR of NICS @@ -115,10 +117,13 @@ class IVnfQemu(IVnf): self.GuestCommandFilter.prefix = self._log_prefix logger = logging.getLogger() + name, ext = os.path.splitext(S.getValue('LOG_FILE_GUEST_CMDS')) + name = name + str(self._number) + rename_gcmd = "{name}_{uid}{ex}".format(name=name, + uid=S.getValue('LOG_TIMESTAMP'), + ex=ext) cmd_logger = logging.FileHandler( - filename=os.path.join(S.getValue('LOG_DIR'), - S.getValue('LOG_FILE_GUEST_CMDS')) + - str(self._number)) + filename=os.path.join(S.getValue('LOG_DIR'), rename_gcmd)) cmd_logger.setLevel(logging.DEBUG) cmd_logger.addFilter(self.GuestCommandFilter()) logger.addHandler(cmd_logger) @@ -235,20 +235,29 @@ def parse_arguments(): def configure_logging(level): """Configure logging. """ - date = datetime.datetime.fromtimestamp(time.time()) - timestamp = date.strftime('%Y-%m-%d_%H-%M-%S') - settings.setValue('LOG_TIMESTAMP', timestamp) name, ext = os.path.splitext(settings.getValue('LOG_FILE_DEFAULT')) - rename_default = "{name}_{uid}{ex}".format(name=name, uid=timestamp, ex=ext) + rename_default = "{name}_{uid}{ex}".format(name=name, + uid=settings.getValue( + 'LOG_TIMESTAMP'), + ex=ext) log_file_default = os.path.join( settings.getValue('LOG_DIR'), rename_default) + name, ext = os.path.splitext(settings.getValue('LOG_FILE_HOST_CMDS')) + rename_hostcmd = "{name}_{uid}{ex}".format(name=name, + uid=settings.getValue( + 'LOG_TIMESTAMP'), + ex=ext) log_file_host_cmds = os.path.join( - settings.getValue('LOG_DIR'), settings.getValue('LOG_FILE_HOST_CMDS')) + settings.getValue('LOG_DIR'), rename_hostcmd) + name, ext = os.path.splitext(settings.getValue('LOG_FILE_TRAFFIC_GEN')) + rename_traffic = "{name}_{uid}{ex}".format(name=name, + uid=settings.getValue( + 'LOG_TIMESTAMP'), + ex=ext) log_file_traffic_gen = os.path.join( - settings.getValue('LOG_DIR'), - settings.getValue('LOG_FILE_TRAFFIC_GEN')) + settings.getValue('LOG_DIR'), rename_traffic) metrics_file = (settings.getValue('LOG_FILE_INFRA_METRICS_PFX') + - timestamp + '.log') + settings.getValue('LOG_TIMESTAMP') + '.log') log_file_infra_metrics = os.path.join(settings.getValue('LOG_DIR'), metrics_file) @@ -663,6 +672,11 @@ def main(): settings.load_from_dir(os.path.join(_CURR_DIR, 'conf')) + # Define the timestamp to be used by logs and results + date = datetime.datetime.fromtimestamp(time.time()) + timestamp = date.strftime('%Y-%m-%d_%H-%M-%S') + settings.setValue('LOG_TIMESTAMP', timestamp) + # Load non performance/integration tests if args['integration']: settings.load_from_dir(os.path.join(_CURR_DIR, 'conf/integration')) @@ -772,8 +786,8 @@ def main(): settings.setValue('WHITELIST_NICS', list(nic['pci'] for nic in nic_list)) # generate results directory name - date = datetime.datetime.fromtimestamp(time.time()) - results_dir = "results_" + date.strftime('%Y-%m-%d_%H-%M-%S') + # date = datetime.datetime.fromtimestamp(time.time()) + results_dir = "results_" + timestamp results_path = os.path.join(settings.getValue('LOG_DIR'), results_dir) settings.setValue('RESULTS_PATH', results_path) diff --git a/vswitches/ovs.py b/vswitches/ovs.py index 6dbf0cf8..03c8dadd 100644 --- a/vswitches/ovs.py +++ b/vswitches/ovs.py @@ -47,8 +47,13 @@ class IVSwitchOvs(IVSwitch, tasks.Process): """See IVswitch for general description """ super().__init__() + name, ext = os.path.splitext(settings.getValue('LOG_FILE_VSWITCHD')) + rename_vswitchd = "{name}_{uid}{ex}".format(name=name, + uid=settings.getValue( + 'LOG_TIMESTAMP'), + ex=ext) self._logfile = os.path.join(settings.getValue('LOG_DIR'), - settings.getValue('LOG_FILE_VSWITCHD')) + rename_vswitchd) self._ovsdb_pidfile_path = os.path.join(settings.getValue('TOOLS')['ovs_var_tmp'], "ovsdb-server.pid") self._vswitchd_pidfile_path = os.path.join(settings.getValue('TOOLS')['ovs_var_tmp'], diff --git a/vswitches/vpp_dpdk_vhost.py b/vswitches/vpp_dpdk_vhost.py index 5d676a01..f639d3d6 100644 --- a/vswitches/vpp_dpdk_vhost.py +++ b/vswitches/vpp_dpdk_vhost.py @@ -37,8 +37,12 @@ class VppDpdkVhost(IVSwitch, tasks.Process): """See IVswitch for general description """ super().__init__() - self._logfile = os.path.join(S.getValue('LOG_DIR'), - S.getValue('LOG_FILE_VPP')) + name, ext = os.path.splitext(S.getValue('LOG_FILE_VPP')) + rename_vpplf = "{name}_{uid}{ex}".format(name=name, + uid=S.getValue( + 'LOG_TIMESTAMP'), + ex=ext) + self._logfile = os.path.join(S.getValue('LOG_DIR'), rename_vpplf) self._expect = r'vpp#' self._cmd_template = ['sudo', '-E', S.getValue('TOOLS')['vpp']] self._phy_ports = [] |