diff options
Diffstat (limited to 'tools/systeminfo.py')
-rw-r--r-- | tools/systeminfo.py | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/tools/systeminfo.py b/tools/systeminfo.py index 62db852b..9d8eb5cb 100644 --- a/tools/systeminfo.py +++ b/tools/systeminfo.py @@ -71,8 +71,9 @@ def get_nic(): output = subprocess.check_output('lspci', shell=True) output = output.decode(locale.getdefaultlocale()[1]) for line in output.split('\n'): - for nic_pciid in S.getValue('WHITELIST_NICS'): - if line.startswith(nic_pciid): + for nic in S.getValue('NICS'): + # lspci shows PCI addresses without domain part, i.e. last 7 chars + if line.startswith(nic['pci'][-7:]): nics.append(''.join(line.split(':')[2:]).strip()) return nics @@ -167,6 +168,14 @@ def get_pid(proc_name_str): """ return get_pids([proc_name_str]) +def pid_isalive(pid): + """ Checks if given PID is alive + + :param pid: PID of the process + :returns: True if given process is running, False otherwise + """ + return os.path.isdir('/proc/' + str(pid)) + # This function uses long switch per purpose, so let us suppress pylint warning too-many-branches # pylint: disable=R0912 def get_version(app_name): @@ -181,7 +190,7 @@ def get_version(app_name): 'dpdk' : os.path.join(S.getValue('RTE_SDK'), 'lib/librte_eal/common/include/rte_version.h'), 'qemu' : os.path.join(S.getValue('QEMU_DIR'), 'VERSION'), 'l2fwd' : os.path.join(S.getValue('ROOT_DIR'), 'src/l2fwd/l2fwd.c'), - 'ixnet' : os.path.join(S.getValue('TRAFFICGEN_IXNET_LIB_PATH'), 'pkgIndex.tcl') + 'ixnet' : os.path.join(S.getValue('TRAFFICGEN_IXNET_LIB_PATH'), 'pkgIndex.tcl'), } @@ -239,6 +248,12 @@ def get_version(app_name): app_version = match_line(app_version_file['ixnet'], 'package provide IxTclNetwork') if app_version: app_version = app_version.split(' ')[3] + elif app_name.lower() == 'xena': + try: + app_version = S.getValue('XENA_VERSION') + except AttributeError: + # setting was not available after execution + app_version = 'N/A' elif app_name.lower() == 'dummy': # get git tag of file with Dummy implementation app_git_tag = get_git_tag(os.path.join(S.getValue('ROOT_DIR'), 'tools/pkt_gen/dummy/dummy.py')) |