def collect_data(duthost): keys = duthost.shell('sonic-db-cli STATE_DB KEYS "PHYSICAL_ENTITY_INFO|*"')['stdout_lines'] dev_data = {} for k in keys: data = duthost.shell('sonic-db-cli STATE_DB HGETALL "{}"'.format(k))['stdout_lines'] data = compose_dict_from_cli(data) dev_data[k] = data return {'keys': keys, 'data': dev_data}
def collect_data(duthost): keys = duthost.shell('redis-cli -n 6 keys "PCIE_DEVICE|*"')['stdout_lines'] dev_data = {} for k in keys: data = duthost.shell('redis-cli -n 6 hgetall "{}"'.format(k))['stdout_lines'] data = compose_dict_from_cli(data) dev_data[k] = data dev_summary_status = duthost.get_pmon_daemon_db_value(pcie_devices_status_tbl_key, status_field) return {'status': dev_summary_status, 'devices': dev_data}