diff options
author | Dan Crowell <dcrowell@us.ibm.com> | 2019-11-05 16:34:00 -0600 |
---|---|---|
committer | William G Hoffa <wghoffa@us.ibm.com> | 2019-11-08 15:21:34 -0600 |
commit | d519d2911d415a91a64c2d3e124694a701f6d349 (patch) | |
tree | f6b0bad73b11658f94d626cd8f14e0edae02d070 | |
parent | c283187cd8301a0c00259908dd950d31b2f82f67 (diff) | |
download | talos-hostboot-d519d2911d415a91a64c2d3e124694a701f6d349.tar.gz talos-hostboot-d519d2911d415a91a64c2d3e124694a701f6d349.zip |
Fix timestamp parser for OpenBMC ESELs
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>
-rwxr-xr-x | src/build/debug/eSEL.pl | 44 |
1 files changed, 34 insertions, 10 deletions
diff --git a/src/build/debug/eSEL.pl b/src/build/debug/eSEL.pl index ddce72f50..ed9ef2335 100755 --- a/src/build/debug/eSEL.pl +++ b/src/build/debug/eSEL.pl @@ -6,7 +6,7 @@ # # OpenPOWER HostBoot Project # -# Contributors Listed Below - COPYRIGHT 2017,2018 +# Contributors Listed Below - COPYRIGHT 2017,2019 # [+] International Business Machines Corp. # # @@ -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 { @@ -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"; |