#!/usr/software/bin/perl # $Id: //depot/prod/test/Rsierranevada/storage/hdd/NADQ_SEA/NDATE/SUPPORT_SCRIPTS/post_job.thpl#3 $ # Copyright (c) 2005 Network Appliance, Inc. # All rights reserved # ## @summary Mode ## Delete extra log files ## @description ## Delete send_result_to_console.log file ## @param LOGDIR Location of the log file to be deleted ## @param LOGLVL Log level (delete logs if log level is less thsn 4) ## @status public ## @author maji@netapp.com #use strict; use NATE::TestInfo; use San; use Data::Dumper; use Net::SCP::Expect; use Storage::Common_Lib; sub clean_up_subdir(); my $status; my $Home = $ENV{HOME}; my $san_obj = new San( \*ntest::NTEST_STDOUT ); if ( $san_obj->error() ) { logresult( 'FATAL', "Failed to instantiate San object" . $san_obj->errmsg() ); } ######################################## ### Initialization/declaration ######################################### use vars qw( $LOGLVL $LOGDIR $TEST_CONFIG $RUNPYTH $PYTHPATH $AUTO_PUSH ); param( 'LOGDIR', '-default', '' ); param( 'LOGLVL', '-default', '2' ); param( 'RUNPYTH', '-default', '2' ); param( 'PYTHPATH', '-default', '/usr/software/bin/python' ); param( 'AUTO_PUSH', '-default', '0' ); if ( $LOGLVL < 4 ) { system("rm -rf $LOGDIR/HDD"); system("rm -f $LOGDIR/HDD.log"); system("rm -f $LOGDIR/0*"); #system("rm -f $LOGDIR/../../../HDD.log"); #system("rmdir -fr $LOGDIR/HDD"); } # Generate HTML log files ##html_log_gen($LOGDIR); ##As per the client suggestion on #BURT 979530 rename_folder_names(); #parser_301(); #Plot graph if AZCS test is selected. opendir( IMD, $LOGDIR ) || die("Cannot open directory"); logcomment("LOGDIR - $LOGDIR"); my @thefiles = readdir(IMD); logcomment("Files present in DIR: @thefiles"); my $consolefilename; closedir(IMD); foreach (@thefiles) { if ( ( $_ =~ /(\d+_.*_AZCS_DskQul_Perf.*\.log)/ ) && ( $RUNPYTH == 1 ) ) { $consolefilename = $1; my $user_path; $user_path = $PYTHPATH; logcomment("Console file slected : $consolefilename"); logcomment("Python path set by user : $user_path"); $san_obj->sanlog( -msg => "------------------------------------------------------------------------------------------" ); $san_obj->sanlog( -msg => "Path: $user_path" ); $san_obj->sanlog( -msg => "------------------------------------------------------------------------------------------" ); $san_obj->sanlog( -msg => "Plotting of disk_qual" ); $san_obj->sanlog( -msg => "------------------------------------------------------------------------------------------" ); system("chmod 777 $Home/NDATE/SUPPORT_SCRIPTS/nadq_plot.py"); system("chmod 777 $LOGDIR/$consolefilename"); logcomment("Command to execute: $user_path $Home/NDATE/SUPPORT_SCRIPTS/nadq_plot.py -o $LOGDIR $LOGDIR/$consolefilename\n"); system("$user_path $Home/NDATE/SUPPORT_SCRIPTS/nadq_plot.py -o $LOGDIR $LOGDIR/$consolefilename"); sleep(60); logcomment("Plotting of disk_qual completed\n"); $san_obj->sanlog( -msg => "------------------------------------------------------------------------------------------" ); $san_obj->sanlog( -msg => "Plotting of disk_qual completed" ); $san_obj->sanlog( -msg => "------------------------------------------------------------------------------------------" ); } ## end if (($_ =~ /(\d+_.*_AZCS_DskQul_Perf.*\.console)/... # Plotting for FILER_IO if ( ( ( $_ =~ /(.*_python_plot.*\.txt)/ ) && ( $RUNPYTH == 1 ) ) || ( ( $_ =~ /(.*_39a_plot.*\.txt)/ ) && ( $RUNPYTH == 1 ) ) || ( ( $_ =~ /(.*_Bgnd_Scan_plot.*\.txt)/ ) && ( $RUNPYTH == 1 ) ) || ( ( $_ =~ /(.*_43_plot.*\.txt)/ ) && ( $RUNPYTH == 1 ) ) || ( ( $_ =~ /(.*ERT_Maint.*\.txt)/ ) && ( $RUNPYTH == 1 ) ) || ( ( $_ =~ /(.*_G_LIST_plot.*\.txt)/ ) && ( $RUNPYTH == 1 ) ) ) { my $inputfilename = $1; my $user_path; $user_path = $PYTHPATH; logcomment("Input file slected : $inputfilename"); logcomment("Python path set by user : $user_path"); $san_obj->sanlog( -msg => "------------------------------------------------------------------------------------------" ); $san_obj->sanlog( -msg => "Path: $user_path" ); $san_obj->sanlog( -msg => "------------------------------------------------------------------------------------------" ); $san_obj->sanlog( -msg => "Plotting for available data " ); $san_obj->sanlog( -msg => "------------------------------------------------------------------------------------------" ); system("chmod 777 $Home/NDATE/SUPPORT_SCRIPTS/common_plot.py"); system("chmod 777 $LOGDIR/$inputfilename"); logcomment("Command to execute: $user_path $Home/NDATE/SUPPORT_SCRIPTS/common_plot.py -o $LOGDIR $LOGDIR/$inputfilename\n"); system("$user_path $Home/NDATE/SUPPORT_SCRIPTS/common_plot.py -o $LOGDIR $LOGDIR/$inputfilename"); sleep(60); logcomment("Plotting of filer_io completed\n"); $san_obj->sanlog( -msg => "------------------------------------------------------------------------------------------" ); $san_obj->sanlog( -msg => "Plotting completed, Charts are zipped into file" ); $san_obj->sanlog( -msg => "------------------------------------------------------------------------------------------" ); } ## end if ((($_ =~ /(.*_python_plot.*\.txt)/... # Plotting for Test 31, Perf if ( ( ( $_ =~ /(.*_31_plot.*\.txt)/ ) && ( $RUNPYTH == 1 ) ) || ( ( $_ =~ /(.*_301_plot.*\.txt)/ ) && ( $RUNPYTH == 1 ) ) ) { # if ( ( $_ =~ /(.*_31_plot.*\.txt)/ ) && ( $RUNPYTH == 1 ) ) { my $inputfilename = $1; my $user_path; $user_path = $PYTHPATH; logcomment("Input file slected : $inputfilename"); logcomment("Python path set by user : $user_path"); $san_obj->sanlog( -msg => "------------------------------------------------------------------------------------------" ); $san_obj->sanlog( -msg => "Path: $user_path" ); $san_obj->sanlog( -msg => "------------------------------------------------------------------------------------------" ); $san_obj->sanlog( -msg => "Plotting for available data " ); $san_obj->sanlog( -msg => "------------------------------------------------------------------------------------------" ); system("sudo chmod 777 $Home/NDATE/SUPPORT_SCRIPTS/mod_3x_plot.py"); system("sudo chmod 777 $LOGDIR/$inputfilename"); logcomment("Command to execute: $user_path $Home/NDATE/SUPPORT_SCRIPTS/mod_3x_plot.py -o $LOGDIR $LOGDIR/$inputfilename\n"); system("$user_path $Home/NDATE/SUPPORT_SCRIPTS/mod_3x_plot.py -o $LOGDIR $LOGDIR/$inputfilename"); sleep(70); logcomment("Plotting for Perf_DskQul completed\n"); $san_obj->sanlog( -msg => "------------------------------------------------------------------------------------------" ); $san_obj->sanlog( -msg => "Plotting completed, Charts are zipped into file" ); $san_obj->sanlog( -msg => "------------------------------------------------------------------------------------------" ); } ## end if (($_ =~ /(.*_31_plot.*\.txt)/... # Plotting for Test 31a and Test 31b, Dsk_Qual Perf (All and Single drives) if ( ( $_ =~ /(.*b_plot_python.*\.txt)/ ) && ( $RUNPYTH == 1 ) || ( $_ =~ /(.*a_plot_python.*\.txt)/ ) && ( $RUNPYTH == 1 ) ) { my $inputfilename = $1; my $user_path; $user_path = $PYTHPATH; logcomment("Input file slected : $inputfilename"); logcomment("Python path set by user : $user_path"); $san_obj->sanlog( -msg => "------------------------------------------------------------------------------------------" ); $san_obj->sanlog( -msg => "Path: $user_path" ); $san_obj->sanlog( -msg => "------------------------------------------------------------------------------------------" ); $san_obj->sanlog( -msg => "Plotting for available data " ); $san_obj->sanlog( -msg => "------------------------------------------------------------------------------------------" ); system("sudo chmod 777 $Home/NDATE/SUPPORT_SCRIPTS/31ab_2fan_plot.py"); system("sudo chmod 777 $LOGDIR/$inputfilename"); logcomment("Command to execute: $user_path $Home/NDATE/SUPPORT_SCRIPTS/multi_yax_plot.py -o $LOGDIR $LOGDIR/$inputfilename\n"); system("$user_path $Home/NDATE/SUPPORT_SCRIPTS/multi_yax_plot.py -o $LOGDIR $LOGDIR/$inputfilename"); sleep(80); logcomment("Plotting for Perf_DskQul completed\n"); $san_obj->sanlog( -msg => "------------------------------------------------------------------------------------------" ); $san_obj->sanlog( -msg => "Plotting completed, Charts are zipped into file" ); $san_obj->sanlog( -msg => "------------------------------------------------------------------------------------------" ); } ## end if (($_ =~ /(.*a_b_plot_python.*\.txt)/... } ## end foreach (@thefiles) # Zip all the files into the Logs.zip chdir("$LOGDIR") || die "Failed to change the directory"; parser_301(); # DATA LAKE - AUTO PUSH PASSED LOGS BURT# logcomment("DATA LAKE : AUTO PUSH ENABLE : $AUTO_PUSH"); if ( $AUTO_PUSH == 1 ) { foreach my $log_fl (@thefiles) { my ( $found, $scpt, $s_rslt ); my $pre_start = 0; my $post_end = 0; logcomment("Check for log file - $log_fl"); if ( ( $log_fl =~ /\.log/ ) && ( $log_fl !~ /check_filer|HDD|ntest|logcleanup|log_cleanup|CONVERT_SETUP/ ) ) { $log_fl = "$LOGDIR" . "/" . "$log_fl"; logcomment("DEBUG : Opening - $log_fl"); open( AUTOFILE, "$log_fl" ) or die "Failed opening $log_fl \n"; foreach my $line () { if ( $line =~ /\s+TESTSCRIPT:\s+(\S+)/ ) { $scpt = $1; logcomment("DATA LAKE : SCRIPT EXECUTED : $1"); $found = 1; } $pre_start = 1 if ( $line =~ /Begining of PRE_TEST logs for Filer/ ); $post_end = 1 if ( $line =~ /End of POST_TEST logs for Filer/ ); #Pass: 1 if ( ( $found == 1 ) && ( $line =~ /\s+Pass:\s+(\S+)|\s+Fail:\s+(\S+)/ ) && ( $pre_start == 1 ) && ( $post_end == 1 ) ) { $s_rslt = 1; logcomment("DATA LAKE : SCRIPT RESULT ::::::::: $s_rslt : DEBUG : $1"); } } if ( $s_rslt == 1 ) { logcomment("DATA LAKE : SCRIPT $scpt RESULT is $s_rslt(PASSED), User Selected auto push $AUTO_PUSH, Push log to data lake "); push_data_lake( log_file => $log_fl ); } else { logcomment("DATA LAKE : SCRIPT $scpt RESULT is $s_rslt(FAIL|FATAL), User Selected auto push $AUTO_PUSH, Push log to data lake"); } } } } # DATA LAKE - END logcomment("Creating Zip file for this test\n"); #Get test suite name and timestamp $LOGDIR =~ /(\d+_\d+)([^\/]+)/; my $timestamp = $1; my $logfilename = $2; my ( $major_version, $minor_version, $patch_version, $date ); $Home = trim($Home); my $version_file = "$Home/NDATE_ver"; my $version_build = `cat $version_file`; foreach my $line ( split /\n/, $version_build ) { if ( $line =~ /^\#/ ) { next; # skip overall result report starting with a '#'. } if ( $line =~ /^NDTE_MAJOR_VERSION\=(\d+)/ ) { $major_version = $1; } if ( $line =~ /^NDTE_MINOR_VERSION\=(\d+)/ ) { $minor_version = $1; } if ( $line =~ /^NDTE_PATCH_VERSION\=(\d+)/ ) { $patch_version = $1; } if ( $line =~ /^DATE\=(\S+)/ ) { $date = $1; } } ## end foreach my $line (split /\n/... my $version = "NDATE_"; $logfilename = "$version" . "$major_version.$minor_version.$patch_version" . "$logfilename" . "_" . "$timestamp" . ".zip"; my $zipfile = $logfilename; system("zip -r $logfilename *"); logcomment("Zip file $zipfile created\n"); $status = `unzip -tq $zipfile`; system("sudo rm -rf $Home/NDATE/SUPPORT_SCRIPTS/PARSED_OUTPUT*"); system("sudo rm -rf $Home/NDATE/shell_*"); if ( $status =~ /No errors/ ) { logcomment("All files zipped successfully into $LOGDIR/$logfilename"); $san_obj->sanlog( -msg => "------------------------------------------------------------------------------------------" ); $san_obj->sanlog( -msg => "All files zipped successfully into $LOGDIR/$logfilename" ); $san_obj->sanlog( -msg => "------------------------------------------------------------------------------------------" ); system("rm -f $LOGDIR/*.png"); } else { logcomment("Files are not zipped in the directory $LOGDIR\n"); $san_obj->sanlog( -msg => "------------------------------------------------------------------------------------------" ); $san_obj->sanlog( -msg => "Files are not zipped in the directory $LOGDIR\n" ); $san_obj->sanlog( -msg => "------------------------------------------------------------------------------------------" ); } ## end else [ if ($status =~ /No errors/) clean_up_subdir(); sub clean_up_subdir { my $main_log_dir; if ( $LOGDIR =~ /(\S+)\/HDD\/(\S+)/ ) { $main_log_dir = $1; logcomment("Actual log directory $main_log_dir"); } else { $main_log_dir = $LOGDIR; logcomment("Actual log directory is taken as $main_log_dir"); } my $dir_paths = `ls -lR $main_log_dir`; my @arr = split( "\n\n", $dir_paths ); foreach (@arr) { my @files; if ( $_ =~ /^\.\:/ ) { next; } elsif ( $_ =~ /^(\S+)\:/ ) { my $dir = $1; print "Sub directory path is $1\n"; foreach ( split /\n/, $_ ) { if ( $_ =~ /\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+(\S+\.log)$/g ) { my $path = "$dir/$1"; print "Sub directory file path is $path\n"; open( FH, "$path" ) || die("Not able to open the file $dir/$1 "); $/ = undef; my $data = ; close(FH); if ( $data =~ /\[HDD\S+\]/i ) { $data =~ s/\[HDD\S+\]//g; open( FH3, ">$path" ) || print("Not able to open the file $path"); print FH3 $data; close(FH3); } } $/ = "\n"; } } } } sub trim($) { my $string = shift; $string =~ s/^\s+|\s+$//gm; s/^\"(.*)\"$/$1/ || s/^\'(.*)\'$/$1/; return $string; } sub html_log_gen($) { my $log_dir_a = shift; my $main_log_dir; my $blue_line_data_active; my $line; if ( $log_dir_a =~ /(\S+)\/HDD\/(\S+)/ ) { $main_log_dir = $1; logcomment("Actual log directory $main_log_dir"); } else { $main_log_dir = $log_dir_a; logcomment("Actual log directory is taken as $main_log_dir"); } # read data file : na_scan_data.dataa my $Home = trim($Home); my $na_scan_data = "$Home/NDATE/SUPPORT_SCRIPTS/na_scan_data.data"; my @BLUE_LINE_DATA = (); open( FDATA, "$na_scan_data" ); while () { chomp( $line = $_ ); # # Check for START/END of entries # if ( $line =~ /BLUE_LINE_DATA_START/ ) { $blue_line_data_active = 1; } if ( $line =~ /BLUE_LINE_DATA_END/ ) { $blue_line_data_active = 0; } # # collect data when valid # if ( $blue_line_data_active == 1 ) { if ( $line =~ /"(.*?)"/ ) { push( @BLUE_LINE_DATA, $1 ); print "\n$1"; } } } close(FDATA); # End of data filer read. #Read main directoy and get all log files to parse opendir( IMD, $main_log_dir ) || die("Cannot open directory"); logcomment("LOGDIR - $main_log_dir"); my @myfiles = readdir(IMD); logcomment("Files present in DIR: @myfiles"); my $getfile; foreach my $file (@myfiles) { my $found = 0; if ( $file =~ /\.log/ ) { if ( $file =~ /_NADQ02_/ ) { if ( $file != /_job|check|ntest/ ) { $found = 1; } } } print "Found value - $found\n"; if ( $found == 1 ) { print "\nProcessing $main_log_dir/" . "$file\n"; #----------------------------------------------------------------- my $processing_file = "$main_log_dir/" . "$file"; print "DEUG : file to be processed : $processing_file\n"; open( FIN, "$processing_file" ); my $Home = trim($Home); my $html_file = $file; if ( $file =~ /(\S+)\.log/ ) { $html_file =~ s/\./_/g; } my $myhtml = "$main_log_dir/" . "$html_file" . ".html"; print "Creating html file $myhtml\n"; open( FH, ">$myhtml" ); # open(F1, ">debug.log"); print FH ""; print FH ""; print FH ""; print FH ""; print FH ""; print FH "

"; my $nline; my $BLUE_LINE_DATA_VALID; my $pre; my $main; my $post; my $id; while () { chomp( $line = $_ ); $line =~ s/\\r//g; $line =~ s/\\n//g; $line =~ s/\\t//g; $line =~ s// /g; if ( $line !~ /^$/ ) { if ( $nline =~ // ) { } elsif ( $line =~ /^(\d+\s\d+)\s+/ ) { my $datetime = $1; my $nline = $'; $BLUE_LINE_DATA_VALID = 0; foreach my $test (@BLUE_LINE_DATA) { if ( $nline =~ /$test/ ) { $pre = $`; $main = $&; $post = $'; $BLUE_LINE_DATA_VALID = 1; last; } } if ( $nline =~ /={2,4}\s*step|={0,4}?PRE_TEST|===================================|POST_TEST.STEP/i ) { print FH "\n $&$'
"; } elsif ( $nline =~ /Comment/i ) { print FH "\n$datetime -- $` $&$'
"; } elsif ( $nline =~ /fail/i && $nline !~ /fail:/i ) { print FH "\n$datetime -- $nline
"; } elsif ( $nline =~ /FAIL/ ) { print FH "\n$datetime -- $`$&$'
"; } elsif ( $nline =~ /TEST SCRIPT: | TEST CONFIG: | DESCRIPTION: |TEST CASE\s+: / ) { print FH "\n$datetime -- $` "; print FH "$&$'
"; } elsif ( $nline =~ /WARNING/ ) { print FH "\n$datetime -- $` "; print FH "$&$'
"; } elsif ( $nline =~ /scsi\.cmd|checkcondition| SCSI:/i ) { print FH "\n$datetime -- $`$&$'
"; } elsif ( $nline =~ /\[.*?:\w+\]/ ) { my $lineinfo = $'; my $mycolor; print FH "\n$datetime -- $`$&"; if ( $nline =~ /pass|complete|success/i ) { $mycolor = "green"; } elsif ( $nline =~ /fail/i ) { $mycolor = "red"; } else { $mycolor = "blue"; } print FH " $lineinfo
"; } elsif ( $nline =~ /PASS/ ) { print FH "\n$datetime -- $`$&$'
"; } elsif ( $BLUE_LINE_DATA_VALID == 1 ) { print FH "\n$datetime -- $pre$main$post
"; $BLUE_LINE_DATA_VALID = 0; } elsif ( $nline =~ /\|LOADER-|setenv |unsetenv / ) { if ( $nline =~ /LOADER\S+/ ) { print FH "\n$datetime -- $`$&>$'
"; } else { print FH "\n$datetime -- $`$&$'
"; } } elsif ( $nline =~ /\[\d\S\.\d+\.\S+\]/ ) { $pre = $`; $main = $&; $post = $'; if ( $nline =~ /Starting PRINT LOG SENSE DATA/ ) { print FH "\n$datetime -- $pre$main$post
"; } elsif ( ( $nline =~ /Write ECC\s+: (\d+) / ) || ( $nline =~ /Write Retries\s+:\s+(\d+)/ ) || ( $nline =~ /Total Write errors:\s+(\d+)/ ) || ( $nline =~ /Total times tried\s+:\s+(\d+)/ ) || ( $nline =~ /Unrecoverable\s+:\s+(\d+)/ ) || ( $nline =~ /Read ECC\s+:\s+(\d+)/ ) || ( $nline =~ /Read Retries\s+:\s+(\d+)/ ) || ( $nline =~ /Total Read errors\s+:\s+(\d+)/ ) ) { print FH "\n$datetime -- $pre$main$post
"; } else { print FH "\n$datetime -- $pre$main$post
"; } } elsif ( $nline =~ /\|\[.*?\]/ ) { print FH "\n$datetime -- $`$&"; print FH " $'
"; } elsif ( $nline =~ / (\d\S\.\d+\.\S+) |\|(\d\S\.\d+\.\S+) |\|\s+(\d+\.\d+)\s*: NETAPP / ) { $id = $1 . $2 . $3; print FH "\n$datetime -- $`$&$'
"; } elsif ( $nline =~ /\d{1} cfg |\d{1} tst / ) { $pre = $`; $main = $& . $'; if ( $nline =~ /pass/i ) { print FH "\n$datetime -- $pre$main
"; } else { print FH "\n$datetime -- $nline
"; } print "\n $nline"; } elsif ( $nline =~ /NETAPP/ ) { print FH "\n$datetime -- $`$&$'
"; } elsif ( $nline =~ /blacksmith #/ ) { print FH "\n$datetime -- $`$&$'
"; } elsif ( $nline =~ /Time:\s+(\S+)/ ) { print FH "\n$datetime -- $`$&$'
"; print "\n $nline"; } elsif ( $nline =~ /Pass:\s+(\d+)/ ) { if ( $1 == 1 ) { print FH "\n$datetime -- $`$&$'
"; } else { print FH "\n$datetime -- $`$&$'
"; } print "\n $nline"; } elsif ( ( $nline =~ /Fail:\s+(\d+)/ ) || ( $nline =~ /Disable:\s+(\d+)/ ) || ( $nline =~ /Config:\s+(\d+)/ ) || ( $nline =~ /Script:\s+(\d+)/ ) || ( $nline =~ /Non App:\s+(\d+)/ ) || ( $nline =~ /Not Run:\s+(\d+)/ ) ) { if ( $1 == 0 ) { print FH "\n$datetime -- $`$&$'
"; } else { print FH "\n$datetime -- $`$&$'
"; } print "\n $nline"; } elsif ( $nline =~ /Disk: / ) { # print FH "$datetime -- $`$&$'
"; print FH "\n$datetime -- $`$&$'
"; } elsif ( $nline =~ /\/vol\/vol| \/\S+\/\S+/ ) { print FH "\n$datetime -- $`$&$'
"; } elsif ( ( $nline =~ /\|Shelf: / ) || ( $nline =~ /\|Bay: / ) || ( $nline =~ /\|Serial: / ) || ( $nline =~ /\|Vendor: / ) || ( $nline =~ /\|Model: / ) || ( $nline =~ /\|Rev: / ) || ( $nline =~ /\|RPM: / ) || ( $nline =~ /\|WWN: / ) || ( $nline =~ /\|UID: / ) || ( $nline =~ /\|Downrev: / ) || ( $nline =~ /\|Pri Port: / ) || ( $nline =~ /\|Sec Name: / ) || ( $nline =~ /\|Sec Port: / ) || ( $nline =~ /\|Power-on Hours: / ) || ( $nline =~ /\|Power cycle count: / ) || ( $nline =~ /\|Power cycle on error: / ) || ( $nline =~ /\|Blocks read: / ) || ( $nline =~ /\|Blocks written: / ) || ( $nline =~ /\|Time interval: / ) || ( $nline =~ /\|Glist count: / ) || ( $nline =~ /\|Scrub last done: / ) || ( $nline =~ /\|Scrub count: / ) || ( $nline =~ /\|LIP count: / ) || ( $nline =~ /\|Dynamically qualified: / ) || ( $nline =~ /\|Current owner: / ) || ( $nline =~ /\|Home owner: / ) || ( $nline =~ /\|Reservation owner: / ) || ( $nline =~ /\|Rated life used: / ) || ( $nline =~ /\|Spare blocks consumed: / ) || ( $nline =~ /\|Spare blocks consumed limit: / ) ) { if ( $nline =~ /glist/i ) { print FH "\n$datetime -- $`$&$'
"; } else { print FH "\n$datetime -- $`$&$'
"; } } ####################### else { print FH "\n$datetime -- $`$nline
"; } } else { print FH "\n$line
"; } } } print FH ""; print FH ""; close(FIN); close(F1); close(FH); } } } sub rename_folder_names { my $actual_log_dir; if ( $LOGDIR =~ /\/HDD/ ) { ($actual_log_dir) = $LOGDIR =~ /(\S+)\/HDD/; } else { $actual_log_dir = $LOGDIR; } opendir( READDIR, "$actual_log_dir" ); my @thefiles = readdir(READDIR); logcomment( "Total number of files present are : " . scalar @thefiles ); grep { logcomment "$_" } @thefiles; if ( !( -d "$actual_log_dir\/DEBUG" ) ) { system("sudo mkdir $actual_log_dir\/DEBUG"); } else { logcomment("Already DEBUG folder is present under $actual_log_dir"); } foreach my $file (@thefiles) { next if ( ( $file =~ /^\.+$/ ) || ( $file =~ /^db$/ ) ); next if ( ( -d "$actual_log_dir\/$file" ) && ( ( $file =~ /DRIVE_LOGS/ ) || ( $file =~ /^day_/ ) || ( $file =~ /^Node_/ ) ) ); #BURT961618 - abalaji && burt-1091013:aditis if ( ( -d "$actual_log_dir\/$file" ) && ( $file !~ /SYSTEM_LOGS|SK_TRACE_LOGS/ ) ) { if ( ( $file !~ /PARSED_FILES_|HDD|IOPS_LAT/g ) ) { logcomment("file $file"); system("sudo mv -f $actual_log_dir/$file $actual_log_dir/DEBUG/SUBTEST_$file"); } else { system("sudo mv -f $actual_log_dir/$file $actual_log_dir/DEBUG/"); } } elsif ( $file =~ /HDD_SUMMARY_RESULTS|HDD\.log|ntest\.log|post_job\.log/g ) { logcomment("inside $actual_log_dir\/$file"); logcomment("inside 2"); system("sudo mv $actual_log_dir/$file $actual_log_dir/DEBUG/"); #system("sudo rm -rf $actual_log_dir/$file"); } } } sub parser_301 { logcomment("inside parser_301"); $dummy_file = "$Home/NDATE/SUPPORT_SCRIPTS/PARSED_OUTPUT_$TEST_SUITE_NAME.txt"; open( DUM, "$dummy_file" ); @parse_arr = ; logcomment("after dummy file"); # my $file_to_parse,$parsed_file; my $parse_id = "301_NADQ02_Disk_Qual_BDP"; my $line_index = 1; foreach my $line (@parse_arr) { $line =~ s/^ //; $line =~ s/\s$//; $logpath = $line if ( $line_index == 1 ); $line_index++; } my $actua_log_dr = $LOGDIR; logcomment("Actual log dir inside parser 301: $actua_log_dr"); my $log_iops = "$actua_log_dr/DEBUG/SUBTEST_301_NADQ02_Disk_Qual_BDP/"; # opendir(DIR,"$logpath"); opendir( DIR, "$log_iops" ); my @files = readdir(DIR); foreach $file (@files) { if ( $file =~ /Disk_Qual_BDP/i ) { # $file_to_parse = $file; push( @file_arr, $file ); print "\nfiletoparse: $file_to_parse"; # last; } } foreach my $file_to_parse (@file_arr) { my $file_to_parse1 = "$actua_log_dr/$file_to_parse"; $html_file = "$file_to_parse1.html"; $html_file =~ s/.log//; $file_to_parse = "$log_iops" . "$file_to_parse"; #$file_to_parse =~ s/.log//; $parsed_file = "$file_to_parse" . "_parsed"; $parsed_file =~ s/.log//; $debug_file = "$file_to_parse" . "_debug.txt"; $debug_file =~ s/.log//; open( FIN, "$file_to_parse" ) || die("Can't open the $file_to_parse $!"); # open(FOUT,">$parsed_file.log") || die ("Can't open the $parsed_file $!"); # open(F1,">$debug_file") || die("Can't open the file $!"); $getperc = 3.0; $filecnt = 0; $fcnt = 1; if ( defined $file_to_parse ) { print F1 "\n\n################## File = $file_to_parse\n"; while () { chomp( $line = $_ ); $line =~ s/\\r//g; $line =~ s/\\n//g; # look for start of test output if ( $line =~ /User remarks/ ) { $start_t31_tests = 1; } # detected start of test output, now look for data if ( $start_t31_tests == 1 ) { # keep an eye out for end of data so we can turn off if ( ( $line =~ /comment/i ) || ( $line =~ /Ending/i ) ) { $start_t31_tests = 0; print F1 "\n--- end of data detected ---\n"; } else { if ( $line =~ /console\|/ ) { $tline = $'; #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Look for header data $cline = $prevline . $tline; $prevline = $tline; if ( $cline =~ /\[(\S+\.\S+\.\S+)\]: User remarks:\s+(T\s*\d+)/ ) { $t31_hdr = $& . $'; $t31_did = $1; $t31_testno = $2; $t31_testno =~ s/ //g; $t31_testno =~ s/T//; if ( $t31_hdr =~ /FW/ ) { $t31_hdr = $`; # T is tripped out to make sort easier at output print F1 "\n### $t31_id T$t31_testno - $t31_hdr"; } } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Look for test data # collapse entire line - best way to contain console corruption $tline =~ s/ //g; $tline =~ s/;//; push @pline, $tline; $t31test = join( " ", @pline ); $t31test =~ s/ //g; # print F1 "\n==> $t31test"; # see if we can get a valid entry #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if ( $t31test =~ /\w{2}\.\w+\.\w+,passed/ ) { $fline = $& . $'; if ( $fline =~ /CCT/ ) { $fline = $`; print F1 "\n-> $fline"; @pline = (); @t31data = split ",", $fline; # shorten this text name - it makes for a nicer display if ( $t31data[4] =~ /MULTI/ ) { $t31data[4] = "MULSEQSTRD"; } %t31_data_hash = ( T31_SEQ => $t31data[2], # T31_TEST => $t31data[3], T31_TEST_NAME => $t31data[4], T31_FIRST => $t31data[5], T31_END => $t31data[6], T31_BLOCK => $t31data[7], T31_QUE => $t31data[8], # T31_AVE => $t31data[9], # T31_MIN => $t31data[10], # T31_MAX => $t31data[11], # T31_AVE_STOP => $t31data[12], # T31_MIN_STOP => $t31data[13], # T31_MAX_STOP => $t31data[14], T31_T_MSECS => $t31data[15], T31_T_OPS => $t31data[16], T31_IOPS => $t31data[17], T31_RATE => $t31data[18], # T31_S_ERR => $t31data[19], # T31_H_ERR => $t31data[20], # T31_P_ERR => $t31data[21], # T31_D_ERR => $t31data[22], # T31_SEEK_T => $t31data[23], # T31_GLIST_S => $t31data[24], # T31_GLIST_E => $t31data[25], # T31_TIME_S => $t31data[26], # T31_TIME_E => $t31data[27], T31_PROD => $t31data[28], T31_VENDOR => $t31data[29], T31_FW => $t31data[30], T31_SN => $t31data[31], ); # $filecnt is used to seperate the 2 drives # hashed by T no, seq no, and file count $my_t31_hash{$t31_testno}{ $t31data[2] }{$filecnt} = {%t31_data_hash}; } } # if we see a CCT w/o passed then just empty the array so it don't grow too large if ( $t31test =~ /CCT/ ) { @pline = (); } } } } } $filecnt++; close(FIN); } ################################################################################################# ### POST PROCESS - NORMAL OUTPUT ################################################################################################# print FOUT "\n============================================================================"; print FOUT "\n>>> Test-3.1 DiskQual Performance - drive 2 is compared to drive 1"; printf FOUT "\n drive 1 : "; printf FOUT " %16s,", $my_t31_hash{1}{0}{0}->{T31_PROD}; printf FOUT " %4s,", $my_t31_hash{1}{0}{0}->{T31_FW}; printf FOUT " %8s", $my_t31_hash{1}{0}{0}->{T31_SN}; printf FOUT "\n drive 2 : "; printf FOUT " %16s,", $my_t31_hash{1}{0}{1}->{T31_PROD}; printf FOUT " %4s,", $my_t31_hash{1}{0}{1}->{T31_FW}; printf FOUT " %8s", $my_t31_hash{1}{0}{1}->{T31_SN}; print FOUT "\n postive delta=better, negative=worse"; print FOUT "\n============================================================================"; if ( $fcnt == 1 ) { print FOUT "\n\n Test/Seq Test_Descriton first(GB) End(GB) Blk Qd Tmsecs IOPS RATE "; print FOUT "\n----------- ----------------------------- ------ ------ ---- ---- --------- --------- -------"; foreach $testno ( sort { $a <=> $b } keys %my_t31_hash ) { for $seq ( 0 .. 30 ) { if ( exists $my_t31_hash{$testno}{$seq} ) { printf FOUT "\n"; printf FOUT " T%s", $testno; printf FOUT " %3s", $my_t31_hash{$testno}{$seq}{0}->{T31_SEQ}; printf FOUT " %30s", $my_t31_hash{$testno}{$seq}{0}->{T31_TEST_NAME}; printf FOUT " %6d", $my_t31_hash{$testno}{$seq}{0}->{T31_FIRST} * 512 / 1e9; printf FOUT " %6d", $my_t31_hash{$testno}{$seq}{0}->{T31_END} * 512 / 1e9; printf FOUT " %4s", $my_t31_hash{$testno}{$seq}{0}->{T31_BLOCK}; printf FOUT " %4s", $my_t31_hash{$testno}{$seq}{0}->{T31_QUE}; printf FOUT " %8s", $my_t31_hash{$testno}{$seq}{0}->{T31_T_MSECS}; printf FOUT " %8s", $my_t31_hash{$testno}{$seq}{0}->{T31_IOPS}; printf FOUT " %6.1f", $my_t31_hash{$testno}{$seq}{0}->{T31_RATE}; } } print FOUT "\n"; } } else { print FOUT "\n\n Test/Seq Test_Descriton First(GB)End(GB) Blk Qd d1-IOPS d1-RATE d2-IOPS d2-RATE iop% rate% warnings"; print FOUT "\n----------- ----------------------------- ------ ------ ---- ---- --------- -------- -------- ------- -------- ------ ------------------"; foreach $testno ( sort { $a <=> $b } keys %my_t31_hash ) { for $seq ( 0 .. 30 ) { if ( exists $my_t31_hash{$testno}{$seq} ) { $t0_iops = $my_t31_hash{$testno}{$seq}{0}->{T31_IOPS}; $t0_rate = $my_t31_hash{$testno}{$seq}{0}->{T31_RATE}; $t1_iops = $my_t31_hash{$testno}{$seq}{1}->{T31_IOPS}; $t1_rate = $my_t31_hash{$testno}{$seq}{1}->{T31_RATE}; printf FOUT "\n"; printf FOUT " T%s", $testno; printf FOUT " %3s", $my_t31_hash{$testno}{$seq}{0}->{T31_SEQ}; printf FOUT " %30s", $my_t31_hash{$testno}{$seq}{0}->{T31_TEST_NAME}; printf FOUT " %6d", $my_t31_hash{$testno}{$seq}{0}->{T31_FIRST} * 512 / 1e9; printf FOUT " %6d", $my_t31_hash{$testno}{$seq}{0}->{T31_END} * 512 / 1e9; printf FOUT " %4s", $my_t31_hash{$testno}{$seq}{0}->{T31_BLOCK}; printf FOUT " %4s", $my_t31_hash{$testno}{$seq}{0}->{T31_QUE}; printf FOUT " %8s", $t0_iops; printf FOUT " %6.1f", $t0_rate; printf FOUT " %8s", $t1_iops; printf FOUT " %6.1f", $t1_rate; # do comparisons $delta_iops = ( $t1_iops - $t0_iops ) / $t0_iops * 100; $delta_rate = ( $t1_rate - $t0_rate ) / $t0_rate * 100; printf FOUT " %6.1f", $delta_iops; printf FOUT " %6.1f", $delta_rate; $eflag = 0; # check for delta errors if ( $delta_iops < -$getperc ) { $eflag |= 1; } if ( $delta_rate < -$getperc ) { $eflag |= 2; } if ( $eflag == 1 ) { print FOUT " <-Iops"; } elsif ( $eflag == 2 ) { print FOUT " <-Rate"; } elsif ( $eflag == 3 ) { print FOUT " <-Iops <-Rate"; } if ( $eflag != 0 ) { $efail = 0; $t31_errline = $testno; $t31_errline .= "," . $my_t31_hash{$testno}{$seq}{0}->{T31_SEQ}; $t31_errline .= "," . $my_t31_hash{$testno}{$seq}{0}->{T31_TEST_NAME}; $t31_errline .= "," . $my_t31_hash{$testno}{$seq}{0}->{T31_FIRST} * 512 / 1e9; $t31_errline .= "," . $my_t31_hash{$testno}{$seq}{0}->{T31_END} * 512 / 1e9; $t31_errline .= "," . $my_t31_hash{$testno}{$seq}{0}->{T31_BLOCK}; $t31_errline .= "," . $my_t31_hash{$testno}{$seq}{0}->{T31_QUE}; $t31_errline .= "," . $t0_iops; $t31_errline .= "," . $t0_rate; $t31_errline .= "," . $t1_iops; $t31_errline .= "," . $t1_rate; $t31_errline .= "," . $delta_iops; $t31_errline .= "," . $delta_rate; push( @t31err, $t31_errline ); $t31_err_cnt++; } } } print FOUT "\n"; } } print FOUT "\n============================================================================"; print FOUT "\n Summary of exceeded deltas"; print FOUT "\n Total values exceeding $getperc% = $t31_err_cnt"; print FOUT "\n============================================================================"; if ( $t31_err_cnt == 0 ) { print FOUT "\n-no values exceeded"; } else { print FOUT "\n============================================================================"; print FOUT "\n\nTest/Seq Test_Descriton First / End(GB) Blk Qd d0-IOPS d0-RATE d1-IOPS d1-RATE d-iops d-rate"; print FOUT "\n-------- ------------------------------- ------- ------- ----- ----- --------- ------- --------- ------- ------- -------"; foreach $eline (@t31err) { @errarr = split ",", $eline; printf FOUT "\n"; printf FOUT " T%s ", $errarr[0]; printf FOUT " %2d ", $errarr[1]; printf FOUT " %30s ", $errarr[2]; printf FOUT " %6u ", $errarr[3]; printf FOUT " %6u ", $errarr[4]; printf FOUT " %4d ", $errarr[5]; printf FOUT " %4d ", $errarr[6]; printf FOUT " %8u ", $errarr[7]; printf FOUT " %6.1f ", $errarr[8]; printf FOUT " %8u ", $errarr[9]; printf FOUT " %6.1f ", $errarr[10]; printf FOUT " %6.1f ", $errarr[11]; printf FOUT " %6.1f ", $errarr[12]; } } print FOUT "\n============================================================================"; print FOUT "\n END of t31 performance data"; print FOUT "\n============================================================================"; @t31err = (); ################################################################################################# ### POST PROCESS - HTML OUTPUT ################################################################################################# open( FH, ">$html_file" ); print FH '

NetApp HDD-Qual Engineering

'; $t31_err_cnt = 0; print FH ''; print FH ""; print FH '"; print FH ""; # START INFO BOX print FH ""; print FH '"; print FH ""; # START HEADERS print FH ''; print FH ""; print FH ""; print FH ""; print FH ""; print FH ""; print FH ""; print FH ""; print FH ""; print FH ""; print FH ""; foreach $testno ( sort { $a <=> $b } keys %my_t31_hash ) { for $seq ( 0 .. 30 ) { if ( exists $my_t31_hash{$testno}{$seq} ) { printf FH ''; printf FH ""; printf FH ""; printf FH ""; if ( $testno < 9 ) { if ( $seq < 7 ) { printf FH ""; } elsif ( $seq < 14 ) { printf FH ""; } else { printf FH ""; } } elsif ( $testno == 9 ) { if ( $seq < 8 ) { printf FH ""; } elsif ( $seq < 16 ) { printf FH ""; } else { printf FH ""; } } elsif ( $testno == 10 ) { printf FH ""; } elsif ( $testno == 11 ) { printf FH ""; } elsif ( $testno == 12 ) { printf FH ""; } elsif ( $testno < 17 ) { printf FH ""; } elsif ( $testno == 17 ) { if ( $seq < 6 ) { printf FH ""; } elsif ( $seq < 12 ) { printf FH ""; } elsif ( $seq < 18 ) { printf FH ""; } else { printf FH ""; } } printf FH ""; printf FH ""; printf FH ""; printf FH ""; printf FH "", $my_t31_hash{$testno}{$seq}{0}->{T31_RATE}; } } } print FH "\n
'; print FH "

NADQ02 Test 3.1 Single Disk Performance Test - delta measured at $getperc%

"; print FH "
'; print FH "
    "; printf FH "
  • "; printf FH "drive 1 : "; printf FH "%20s", $my_t31_hash{1}{0}{0}->{T31_PROD}; printf FH ",%10s", $my_t31_hash{1}{0}{0}->{T31_FW}; printf FH ",%10s", $my_t31_hash{1}{0}{0}->{T31_SN}; printf FH "
  • "; print FH "

    positive delta is better, negative=worse

    "; print FH "
"; print FH "
Test Seq Description Area Blksz Qdepth Tmsec IOPs Rate
T$testno $my_t31_hash{$testno}{$seq}{0}->{ T31_SEQ } $my_t31_hash{$testno}{$seq}{0}->{ T31_TEST_NAME } OD MD ID OD MD ID OD MD ID FULL FULL OD MD ID $my_t31_hash{$testno}{$seq}{0}->{ T31_BLOCK } $my_t31_hash{$testno}{$seq}{0}->{ T31_QUE } $my_t31_hash{$testno}{$seq}{0}->{ T31_T_MSECS } $my_t31_hash{$testno}{$seq}{0}->{ T31_IOPS } %6.1f
"; # add a space between the cells close(F1); close(FH); close(FOUT); system("rm -rf $debug_file"); system("rm -rf $parsed_file.log"); } } ##Burt#518720 changes End