Welcome to NetApp Drive Automation Test Environment Tool

NDATE Ver: 4.O



"; echo "Logged in as - $user"; echo "
"; echo "Directory->$username"; echo "

"; echo " Note: Page will automatically refresh every 120 seconds."; $directory = "$username"; $files = glob($directory . "*"); $logarray = array(); $tim_arry = array(); foreach($files as $file){ if (preg_match('/\d+\_\d+\_.*/',$file)){ $tim_arry[filemtime($file)] = $file; } } krsort($tim_arry,SORT_NUMERIC); foreach($tim_arry as $n_file) { array_push($logarray,$n_file); } ?>
                                                                                                                                                                                                                  LOGOUT
"; //date $date=get_date($file,$username); if($date ==""){ echo ""; }else{ echo ""; } //Log directory $test_name1=""; list($test_name1,$filer_detail)= get_testname($file,$username); list($time_name)=get_time($file,$username); $filer_detail=implode($filer_detail); $f=count($test_name1); $c=count($time_name); echo ""; //}else{ // echo ""; // $i++; //} //Overall Status new list($parser_result,$script_result)=get_parser_result($file,$username); $f=count($parser_result); if (in_array($dir_name[1], $result)) { echo ""; }else{ //$ka=get_run($file); // if($ka == 0){ //echo ""; //}else{ if((preg_match('/FAILED/',$parser_result[0]))){ echo ""; }elseif((preg_match('/PASSED$/',$parser_result[0])) && (preg_match('/FAILED/',$script_result[0]))){ echo ""; } elseif((preg_match('/PASSED\s.*/',$parser_result[0]))){ if ((preg_match('/FAILED/',$script_result[0]))){ echo ""; }else{ echo ""; } }elseif((preg_match('/PASSED$/',$parser_result[0])) && (preg_match('/PASSED/',$script_result[0]))){ echo ""; } else{ echo ""; } } $flags = 0; //list($parser_result,$script_result)=get_parser_result($file,$username); if($f<=0){ echo ""; $var=$_SERVER[SERVER_ADDR]; //View logs if (in_array($dir_name[1], $result)){ echo ""; }else{ if(preg_match('/\/(\w+\/\S+)/',$file,$f)){ } echo ""; } //Total time // list($gtime)= get_time($file,$username); // if ($gtime ==""){ // echo ""; // }else{ // echo ""; // } //Filer info $drive_list=get_drive_type($file,$username); $drive =count($drive_list); if($drive <= 0){ $drive_list= ""; } list($check,$build,$version,$pnate_buid)=get_mode($file,$username); list($filer_model,$ontap,$shelf_id,$vendor,$channel)=get_info($file,$username); $flag = 0; echo ""; echo ""; } } } ?>
DATE LOG DIRECTORY OVERALL STATUS PR->PARSER Result
SR->SCRIPT Result
VIEW LOGS ADDITIONAL INFO
NA$date $file "; echo "

"; echo ""; echo ""; echo ""; echo "
"; echo "Test Executed"; echo ""; echo " Total completion time"; echo "
"; echo ""; echo ""; echo ""; echo ""; echo "
"; for($i=0;$i<$f;$i++){ echo "
  • "; echo "
    ";
    					echo "$test_name1[$i]";
    					echo "
    "; echo "
  • "; } echo "
    "; for($j=0;$j<$f;$j++){ echo "
    ";
    					echo "          $time_name[$j]";
    					echo "
    "; } echo "
    "; //Status //$tst_res = pass_fail($file,$username); //if ($tst_res ==""){ // echo "
    NOT COMPLETED COMPLETED EXECUTING nnnn EXECUTING FAILED Script FAILED Script FAILED Warning PASSED Complete logs Not Available Complete logs Not Available "; $flags = 8; } if ($flags == 0){ echo ""; } echo "
    "; echo "
    "; echo "
    "; for($i=0;$i<$f;$i++){ echo "
  • "; echo "
    ";
    					if((preg_match('/FAILED/',$parser_result[$i])) && ($flags == 0)){
    	                    echo "PR:$parser_result[$i]
    SR:$script_result[$i]";} elseif((preg_match('/PASSED.*/',$parser_result[$i])) && ($flags == 0)){ echo "PR:$parser_result[$i]
    SR:$script_result[$i]";} elseif((preg_match('/PASSED/',$parser_result[$i])) && ($flags == 0)){ echo "PR:$parser_result[$i]
    SR:$script_result[$i]"; } echo "
    "; } echo"
  • "; echo "
    Under Execution Click here to View Logs NA $gtime "; if(($filer_model== "") && ($ontap == "") && ($shelf_id == "") && ($vendor== "") &&($channel== "") && ($drive_list== "")){ echo "Data not Available"; $flag = 1; } if((($filer_model == "") || ($ontap == "") ||($shelf_id == "") || ($vendor== "") ||($channel== "") || ($drive_list== "")||($build == "")||($version == "") ||($pnate_buid == "")) && ($flag == 0)){ if($build == ""){ } else{ echo "NDATE Build Date:$build
    "; } if($pnate_buid == ""){ } else{ echo "Pnate Build Version:$pnate_buid
    "; } if($version == ""){ } else{ echo "NDATE Version:$version
    "; } if($filer_detail == ""){ echo "Filer Node: Not Available
    "; } else{ if( preg_match ('/\d/',$filer_detail )){ echo "Filer Node:$filer_detail
    "; } } if($check == ""){ echo "Test Setup:Cluster mode
    "; } else{ echo "Test Setup:$check
    "; } if($filer_model ==""){ echo "Filer Mode: Not Available
    "; } else{ echo "Filer Mode:$filer_model
    "; } if($ontap == ""){ echo "Version:Not Available
    "; } else{ echo "Version:$ontap
    "; } if($shelf_id == ""){ echo "Shelf ID:Not Available
    "; } else{ echo "Shelf ID: $shelf_id
    "; } if($vendor== ""){ echo "Vendor:Not Available
    "; } else{ echo "Vendor: $vendor
    "; } if($channel== ""){ echo "Channel:Not Available
    "; } else{ echo "Channel:$channel
    "; } }else if((($filer_model != "") || ($filer_detail !="") || ($ontap != "") ||($shelf_id != "") || ($vendor != "") ||($channel != "") || ($drive_list != "")) && ($flag == 0)){ echo "Pnate Build Version: $pnate_buid
    NDATE Build Date: $build
    NDATE Version: $version
    FilerNode: $filer_detail
    Test Setup:$check
    Filer Model:$filer_model
    Version: $ontap
    Shelf ID: $shelf_id
    Vendor: $vendor
    Channel: $channel
    Drive Type:$drive_list"; } echo "
    1) { $check='Cluster Setup'; return array($check,$build,$version,$pnate_buid); } else { $check ='Dual Setup'; return array($check,$build,$version,$pnate_buid); } } function pass_fail($file,$username){ $dir_to_read ="$file"; $pass=0; $fail=0; $warn=0; $ignore = array( 'cgi-bin', '.', '..' ); $dh = opendir($dir_to_read); $filename =""; $log_array = array(); while (false !== ($filename = readdir($dh))) { if( !in_array( $filename, $ignore ) ){ $ext = strrchr($filename, ".log"); if( preg_match('/NADQ.*\.log$/', $filename)){ if(!(preg_match('/END_FILER_CONFIG/',$filename))){ array_push($log_array, $filename); } } } } foreach($log_array as $logfile){ $line1 = ''; $path_file = "$file/$logfile"; $file_n = escapeshellarg($path_file); // for the security concious (should be everyone!) $line1 = `tail -n 1 $file_n`; if ( preg_match('/\d+\s+\d+\s+(.*)/',$line1,$match)){ //return $match[1]; if ( preg_match ('/No\sresults\sreported/',$match[1])){ $pass++; }elseif( preg_match ('/Warning/',$match[1])){ $warn++; }elseif((preg_match ('/fatal/',$match[1])) || (preg_match ('/Script/',$match[1]))||(preg_match ('/failure/',$match[1]))||(preg_match ('/errors/',$match[1]))){ $fail++; }else{ $res = $match[1]; } } $logfile = ""; } return array($pass,$warn,$fail,$res); } function get_info($file,$username){ $logdir = "$file"; $dh = opendir($logdir); $index = 0; $ind = 0; $drive_list = array(); $drive_avail =array(); $flag =0; while (false !== ($filename = readdir($dh))) { if(!(preg_match ('/END_FILER_CONFIG/',$filename))){ $flag =1; } if( (preg_match ('/END_FILER_CONFIG/',$filename))|| (preg_match ('/Pre_Post/',$filename))) { $logfile = "$logdir/$filename"; $fp = fopen($logfile, "r") or die ("Could not open the file"); while (! feof ($fp) ) { $line = fgets($fp); $array; $pattern1 = "/Vendor \'(\S+)\s+\', Product \'(\S+)\s+\'/"; // if ($flag == 1){ $pattern2 = "/Release (\S+)\s+/"; // }else{ // $pattern2 = "/Release (\S+ \S+)\:/"; // } $pattern3 = "/Model Name:\s+(\w+\d+)/"; $pattern4 = "//"; $pattern5 = "/\:\s+(\S+)\s+Host Adapter/"; # $pattern6 = "/System ID\:\s+(\S+)\s+\((\S+)\)/"; if (preg_match ($pattern1, $line, $array)) { $vendor = $array[1]; $shelf_id = $array[2]; } if (preg_match ($pattern2, $line, $array)) { $ontap = $array[1]; } if (preg_match ($pattern3, $line, $array)) { $filer_model = $array[1]; rtrim($filer_model); } if (preg_match ($pattern4, $line, $array)) { if (preg_match ($pattern5, $line, $array)) { $channel = $array[1]; } } } if (!(in_array($filer_detail, $filer_lists , true))) { array_push($filer_lists, $filer_detail); return array($filer_model,$ontap,$shelf_id,$vendor,$channel); } } } } function get_date($file,$username){ $dir_to_read1 ="$file"; $ignore = array( 'cgi-bin', '.', '..' ); $dh1 = opendir($dir_to_read1); $filename =""; $log_array = array(); while (false !== ($filename = readdir($dh1))) { if( !in_array( $filename, $ignore ) ){ $ext = strrchr($filename, ".log"); $files =array(); $files1=array(); $dhand=opendir("$file"); while (false !== ($filen = readdir($dhand))) { if (($filen != '..') && ($filen != '.')){ $files1[]=$filen;} } foreach($files1 as $line){ # $year = ""; # $month = ""; # $day = ""; if( (preg_match('/NADQ.*\.log$/', $line)) && (!(preg_match('/END_FILER_CONFIG/',$line)))){ $handle=file_get_contents("$file/$line"); for($i=0;$i<8;$i++){ $files[]=$handle[$i]; } $val = implode($files); list($year,$month) = str_split($val,4); $len_mon = strlen($month); if ($len_mon == 4){ list($mnt,$day) = str_split($month,2); $date = "$year/$mnt/$day"; return $date; } array_push($log_array, $line); } } } } } function get_time($file,$username) { $dir_to_read ="$file"; $time_array=array(); $ignore = array( 'cgi-bin', '.', '..' ); $dh = opendir($dir_to_read); while (false !== ($filename = readdir($dh))) { if( !in_array( $filename, $ignore ) ){ $ext = strrchr($filename, "."); if( preg_match('/^PARSED*/', $filename)){ $par_dir = "$file/$filename"; $pr_dh = opendir($par_dir); while (false !== ($par_filename = readdir($pr_dh))) { if ( preg_match('/^cwpar_OUTPUT*/',$par_filename)) { $par_filename = "$file/$filename/$par_filename"; $pattern = '/Total\s+Test\s+time\s+\=\s+(.*)/'; $pat = '/0\:0\:0/'; $fp = fopen( $par_filename, "r" ) or die("Couldn't open $filename"); while ( ! feof( $fp ) ) { $line = fgets($fp). "
    "; if ( preg_match($pattern, $line, $m)){ if(preg_match($pat,$m[1],$t)){ }else{ array_push($time_array,$m[1]); $m[1] = ' '; } } } } } } } } return array($time_array); } function get_run($file,$username){ $dir_to_read ="$file"; $status =0; $ignore = array( 'cgi-bin', '.', '..' ); $di = opendir($dir_to_read); while (false !== ($filename = readdir($di))) { if( !in_array( $filename, $ignore ) ){ if( (preg_match('/NADQ.*\.log$/', $filename))){ $status =1; } } } return $status; } function get_parser_result($file,$username){ $dir_to ="$file"; $parse=array(); $script=array(); $ignore = array( 'cgi-bin', '.', '..' ); $di = opendir($dir_to); $flag = 0; $flag_sc=0; while (false !== ($filename = readdir($di))) { if( !in_array( $filename, $ignore ) ){ if( (preg_match('/HDD\_SUMMARY\_RESULTS$/',$filename))){ $par_filename = "$file/$filename"; $fp = fopen($par_filename, "r" ) or die("Couldn't open $filename"); while ( ! feof( $fp ) ) { $line = fgets($fp); if((preg_match('/Test\:(\S+)\_NADQ02\_(\S+)/',$line))|| (preg_match('/Test\:NADQ02\_(\S+)/',$line))|| (preg_match('/Test\:CONVERT_SETUP_INSTALL_IMAGE/',$line))){ $flag = 1; $flag_sc=1; } if ((preg_match('/\s+Script\sResults\:\s(\S+)\s/',$line,$sc)) && ($flag_sc == 1)){ array_push($script,$sc[1]); $flag_sc=0; } if ((preg_match('/\s+Parser\sResults\:\s(.*)/',$line,$s)) && ($flag == 1)){ array_push($parse,$s[1]); $flag = 0; } } } } } return array($parse,$script); } ?>