Skip to content

Commit

Permalink
Fix timestamp parser for OpenBMC ESELs
Browse files Browse the repository at this point in the history
Evidently the OpenBMC code changed their timestamp format at
some point so our parser isn't grabbing it anymore.

It will now handle data in a format like this:
    "raweSEL": "00 00 df 00 00 00 00 20 00 04
    ...
    "timestamp": "2019-10-31 10:20:50"

Change-Id: Ieeae63505ce0497a3b3fcf1fd0a92455c8319e29
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/86538
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Ilya Smirnov <ismirno@us.ibm.com>
Reviewed-by: Corey V Swenson <cswenson@us.ibm.com>
Reviewed-by: William G Hoffa <wghoffa@us.ibm.com>
  • Loading branch information
dcrowell77 authored and wghoffa committed Nov 8, 2019
1 parent c283187 commit d519d29
Showing 1 changed file with 34 additions and 10 deletions.
44 changes: 34 additions & 10 deletions src/build/debug/eSEL.pl
Expand Up @@ -6,7 +6,7 @@
#
# OpenPOWER HostBoot Project
#
# Contributors Listed Below - COPYRIGHT 2017,2018
# Contributors Listed Below - COPYRIGHT 2017,2019
# [+] International Business Machines Corp.
#
#
Expand Down Expand Up @@ -588,6 +588,11 @@ sub DecodeObmcEselData
$timestamp_found = 1;
last;
}
elsif($next_line =~ /timestamp/)
{
$timestamp_found = 2;
last;
}
elsif($next_line =~ /ESEL/ or
$next_line =~ /20 00 04/) # found the next ESEL
{
Expand All @@ -601,16 +606,35 @@ sub DecodeObmcEselData

if($timestamp_found)
{
# strip the "Timestamp", commas, spaces, and the newline
$next_line =~ s/"Timestamp"://g;
$next_line =~ s/,//g;
$next_line =~ s/ //g;
chomp $next_line;

# convert to date/time (we are given the timestamp in ms, so divide
# by 1000 to get s).
$timestamp =
if($timestamp_found == 1)
{
# strip the "Timestamp", commas, spaces, and the newline
$next_line =~ s/"Timestamp"://g;
$next_line =~ s/,//g;
$next_line =~ s/ //g;
chomp $next_line;

# convert to date/time (we are given the timestamp in ms, so divide
# by 1000 to get s).
$timestamp =
strftime("%m/%d/%Y %H:%M:%S", localtime($next_line/1000));
}
elsif($timestamp_found == 2)
{
# Field format :: "timestamp": "2019-10-31 10:20:50"
$next_line =~ s/"timestamp"://g;
$next_line =~ s/"//g; #drop the quotes
my @tmp1 = split( " ", $next_line ); #break the date and time apart
my @df = split( /-/, $tmp1[0] ); #break up the date fields
# Convert to :: 11/05/2019 12:25:41
$timestamp = "$df[1]/$df[2]/$df[0] $tmp1[1]";
($debug) && print "timestamp> $timestamp \n";
}
else
{
die "Bad timestamp\n";
}

($debug) && print "Timestamp for ESEL #$esel_record_count:$next_line\n";
($debug) && print "Decoded timestamp for ESEL #$esel_record_count:$timestamp\n";

Expand Down

0 comments on commit d519d29

Please sign in to comment.