xref: /openbmc/openpower-debug-collector/dump/tools/common/include/opfunctions (revision 9a39f43dc513ceb9d3e9b600fdc8c0f2c29209db)
124226c4fSGopichand Paturi#!/usr/bin/env bash
224226c4fSGopichand Paturi
324226c4fSGopichand Paturi# @brief fetch serial number
424226c4fSGopichand Paturi# @param serial number
524226c4fSGopichand Paturifunction fetch_serial_number() {
624226c4fSGopichand Paturi    serialNo=$(busctl get-property xyz.openbmc_project.Inventory.Manager \
724226c4fSGopichand Paturi            /xyz/openbmc_project/inventory/system xyz.openbmc_project.Inventory.Decorator.Asset \
824226c4fSGopichand Paturi        SerialNumber | cut -d " " -f 2 | sed "s/^\(\"\)\(.*\)\1\$/\2/g")
924226c4fSGopichand Paturi
1024226c4fSGopichand Paturi    if [ -z "$serialNo" ]; then
1124226c4fSGopichand Paturi        serialNo="0000000"
1224226c4fSGopichand Paturi    fi
1324226c4fSGopichand Paturi}
1424226c4fSGopichand Paturi
1524226c4fSGopichand Paturi# @brief Add BMC dump File Name
1624226c4fSGopichand Paturi# @param BMC Dump File Name
1724226c4fSGopichand Paturifunction get_bmc_dump_filename() {
1824226c4fSGopichand Paturi    fetch_serial_number
19*9a39f43dSSwethaParasa    dump_id=$(printf %08d $dump_id)
2024226c4fSGopichand Paturi    if [ $dump_type = "$TYPE_FAULTDATA" ]; then
2124226c4fSGopichand Paturi        header_dump_name="FLTDUMP"
2224226c4fSGopichand Paturi        name="NAGDUMP.${serialNo}.${dump_id}.${dDay}"
2324226c4fSGopichand Paturi    else
2424226c4fSGopichand Paturi        header_dump_name="BMCDUMP"
2524226c4fSGopichand Paturi        name="BMCDUMP.${serialNo}.${dump_id}.${dDay}"
2624226c4fSGopichand Paturi    fi
2724226c4fSGopichand Paturi}
28