#!/opt/bin/perl # Copyright (c) 2005 Network Appliance, Inc. # # All rights reserved ## $Id: //depot/prod/test/Rsierranevada/storage/hdd/NADQ_SEA/FS/ndate$20 $ # #----------------------------------------------------------------------------- ## This script allows to ## 1 - Execute test suite ## 2 - Create/update/delete a test suite ## 3 - Create/update/delete filer configuration files (Host file) ## 4 - Update NDATE package ## 4a - Installation of NDATE package from server ** ## 5 - Execute the last test suite ## 6 - Execute ERT/SSD_Durability test ## 7 - Run the stand-alone script at run time ** ## 8 - Re-installation/Upgradation of PNATE ## 9 - Convert Filer Setups or Install Image ## ## ## ## @Automated ## @status public # @burts: 1031614 #----------------------------------------------------------------------------- use strict; use Term::ANSIColor; use Term::ANSIColor qw(:constants); use FileHandle; use Fcntl; # for O_WRONLY, etc. use Cwd ( 'abs_path', 'cwd', 'getcwd' ); use Sys::Hostname; use Net::Ping; use POSIX; use File::Copy; use Shell; use Data::Dumper; use LWP::Simple qw($ua head); use Net::OpenSSH; sub dashboard(); sub getchompstrip ( $@ ); sub arrayeq ( $$ ); sub oops ( $ ); sub make_param ( $@ ); sub banner(); sub pnate_banner(); sub check_services(); sub install_nate_package(); sub install_pnate_package(;$); sub install_perl_package(); sub create_local_host(); sub create_hosts_info(@); sub create_hosts(); sub update_host($); sub delete_host($); sub update_host_vi(); sub create_runlist(); sub create_ERT_runlist(); sub update_runlist(); sub update_runlist_EOE($); sub delete_runlis(); sub create_hosts_from_list(); sub display_tc_info(); sub display_runlist( $ ); sub trim($); sub check_os(); sub set_logdir($); sub init_display(); sub execute_runlist($$$$); sub execute_cmd($$); sub usage_ndate(); sub check_file_version(); sub verify_jobs(); sub display_filertype($); sub display_ir_br_filers(@); sub install_STAF(); sub delete_runlist(); sub disply_duplicates($$); sub add_fw_files($); sub check_log_size(); sub check_shell_process(); sub check_shell_process_terminal(); sub gettestcount( $ ); sub gettotaldates( $ ); sub terminatezomprocess(); sub execute_staf(); sub set_python_path(); sub set_perl_path(); sub clean_up_pnate(); sub switch_off_valid(); sub run_stand_alone(); sub setup_npm(); sub uninstall_pnate(); sub pnate_requirement_info(); sub create_hosts_info_C; sub set_client(); sub _unique(@); sub create_SSD_Durability_runlist(); sub uniq; my $fc_bm_option; my $result; my $result_option; my $tempsize; sub exe_nvme_cli(); sub create_Stress_testing_runlist(); # my $cmode_data; my $drive_type; my $FILER_DETAILS_CMODE; my $FILER_DETAILS_7MODE; my $test_suite_no = 1; my @FINAL_TC_Exe = (); #Burt1037194 nmamatha - test list to compare the for FW my $Home = $ENV{HOME}; my $user = `whoami`; my %local_TC = {}; my $STAF_Path = "$Home/NDATE/STAF"; my $Durability = 0; my $Run_ID = 0; my $DurabilityFile; my $Wipe_LBAs = undef; my $Disk_Serial_Number; my @disk_serial_nums; my $user_selected_option; my $Stress_test = 0; my $runlist_info_file_stress; my $fast_mode_test = "0"; my $AUTO_PUSH = 1; my $CMPRSN = 0; my $modl_of_drv; #my $STAF_staf_a = "/usr/software/test/staf/staf-3.4.1a" my $STAF_staf_a = "/usr/PNATE/staf"; my $test_count; my $days_count; my $ems_parser_exec = 0; my $add_vol = 0; my $write_add_vol = 0; my $presult_options = 2; my $PNATE_Upgrade = 0; my $new_cleanup_added = 0; my $skip_cleanup_mini = "n"; my $delete_mini_added = 0; my $FIXED_MODE_TEST = 0; my $kernel = "FS"; my $SSD_option = 0; my $frequency_14_19; my $total_no_day; my $flag_set = 0; my $mode_flag; my $GROUP_NO = undef; my $KERNEL_TYPE = undef; my $STAND_ALONE = 0; my $STAND_ALONE_COUNT = 1; my @node; my $validate; my $ping_pong; my $C_7_option; #variable for selecting the option C/7 mode my $option_TYPE = '7_mode'; #variable for selecting the type 7_mode or C_mode my $filer_list_file; my $temp_parse_id; my $cluster_config = 0; my $config = 0; my $file_C = ""; my @file_C; my $option_4a; my $ADD_TEST_CASES = 0; my @ADD_TEST_CASES; my $type_of_test = 0; my $Filer_mode = ""; my @Filer_mode = (); my $test_order_c = 0; ##test_order_c varibale use to take onle 2 value i.e, 1.Maint and 2.File_system my $maint_flag = 0; ##maint_flag variable use for selcting all file system scripts first for execution my $file_flag = 0; ##file_flag variable use for knowing all file system gets initiated and maint is going to start. ##file_flag use to put check_filer_setup onle once when maintenance will initiated my $temp_file_nohup = 0; ##variable use for Cmode nohup and creating the .txt file my $Primary_Node; ##variable use for cluster setup run in dual mode and hold primary node. my $path_option; my @path_options = (); my $Primary_Flag = 0; my $selection; my $option_k; my $ALM_USERNAME; my $DONT_PUSH = 1; my $PATH; my $ALM_PUSH = undef; my $ert_host_list; my %FILER_LIST; my $OPTIONS_FLOW; my $dbhandle; ##This parameters $user_type and $lib_type values will gets modified from the make file. #1.Vendors 2.Netapp internal users 3.Developers (In case of $user_type) #1.NATE libraries 2.PNATE libraries (In case of $lib_type) my $user_type = 3; my $lib_type = 2; my $build_type = 1; my $NVMe_setup_9 = undef; my $Tahiti = "NO"; my $AFU_UPDATE = 0; my $NVMe_MNS = 0; my %TC_NAME; my @check; sub _array_diff(\@\@); system("clear"); check_os(); check_shell_process(); #set_client(); print BOLD, CYAN, "", RESET; $Home = trim($Home); if ( !($Home) ) { print "\n Environment variable HOME is not set: Home = $Home \n"; print BOLD, RED, <<'EOD', RESET; ------------------------------------------------------------------------------ Please set the HOME environment variable first using export/setenv command. ----------------------------------------------------------------------------- EOD exit 0; } ## end if (!($Home)) if ( $ARGV[0] =~ /(help|HELP|Help|usage|USAGE|Usage)/ ) { usage_ndate; } # Set default timeout for running the test to 10 minutes. # Accept user defined timeout 30 to 3600 seconds. my $ALARM = 0; my $ping_host = Net::Ping->new(); my $logdir = ""; my $loglvl = "3"; my $logsize = 10485760; my $runlist = ""; my $test_mode = "DEV"; my $execmd = ""; my $check_ser = "y"; my $terminate_on_error = "1"; my $test_type = ""; my $test_wait_time = 3; my $MAIL_TO = 'default'; my $MAIL_FROM = 'default'; my $EMAIL = 'n'; my $EMSG = 'null'; my $FILER_TYPE = 'IC'; my $addparser = "1"; my $runpyth = "1"; my $python_path = ""; my $armadillo = "2"; #used for SCM now my $ert_reset_value = "120"; my $ert_adap_reset_value = "120"; my $reset_value = "120"; my $adap_reset_value = "120"; my $temp_reset_value = "0"; my $temp_adap_reset_value = "0"; my $enableshell = "2"; my $MINI_DISK_CREATE = "2"; my $fast_mode = "0"; my $mixed_config = "0"; #Mixed SAS/BSAS Configuration my $PERL_PATH = "/usr/software/bin"; my $hybrid_aggr = "0"; my $MAX_DRIVES_TO_FAIL = 5; my $MAX_SCRUB_OPERATIONS = 1; my $MAX_DATA_DRIVES_TO_FAIL = 3; my $mini_size; my $SAS_SETUP = "N"; my $FC_SETUP = "N"; my $SATA_SETUP = "N"; my $SSD = "N"; my $SAS = "N"; my $SATA_SSD = "N"; my $BSAS = "N"; #Mixed SAS/BSAS Configuration my $FIPS = "NO"; my $NVMe = "NO"; my $ERT = "N"; my $boot_mode = 0; my $boot_type = "A"; my $check_filer_setup = "Y"; my $ERT_START_DAY = 1; my $ERT_END_DAY = 42; my $TOTAL_ERT_DAYS; my $ERT_SP_DAY = 0; my $PID = ""; my $mini_choice; my $check_mini; my $dele_mini_add; my $cleanup_added; my $create_flag; my $min_t; my $log_dir; my $shell_dum_file; my $quick_mode = 0; my $add = 0; my $fde_enable = "no"; my %A; # get command line switches into %A my $filer_name_nohup = ""; my $SLBA = 0; my $ELBA = 0; my $Loop = 0; my @final_list; my $CLIENT_PARM_SET = 0; my $AUTO_PUSH = 1; my $CMPRSN = 0; my $SKT_LOGS = 0; # To check command line option for the Boilermaker my $command_option; for ( my $i = 0 ; $i < @ARGV ; ) { if ( $ARGV[$i] =~ /^--$/ ) { print BOLD, RED, "Please enter correct argument/value\n", RESET; usage_ndate; } if ( $ARGV[$i] !~ /^-{1,2}(.*)$/ ) { $i++; next; } my $arg = $1; splice @ARGV, $i, 1; if ( $arg =~ /^([\w]+)=(.*)$/ ) { my $val = $2; $val = trim($val); if ($val) { $A{$1} = $val; } else { print BOLD, RED, "Please enter correct argument/value\n", RESET; usage_ndate; } } else { print BOLD, RED, "Please enter correct argument/value\n", RESET; usage_ndate; } } ## end for (my $i = 0 ; $i < @ARGV... # Set default timeout for running the test to 10 minutes. # # Accept user defined timeout 30 to 3600 seconds. # if ( ( $A{t} =~ /^\d+$/ ) && ( ( $A{t} <= 3600 ) && ( $A{t} >= 30 ) ) ) { $ALARM = $A{t}; print "User interaction timeout set to $ALARM seconds \n"; } else { #$ALARM = 600; $ALARM = 2400; # print "\nUser interaction timeout set to $ALARM seconds \n\n"; } local $SIG{ALRM} = sub { die "prompt timeout" }; # NB: \n required eval { alarm $ALARM; #----------------------------------------------------------------------------- my $result; if ( !( -e "$Home/NDATE" ) ) { my $servise_all = check_services; if ( $servise_all == 0 ) { print BOLD, RED, "\nAbove services are not running\n", RESET; } else { print BOLD, GREEN, "All dependent services (nfs,rsh,telnet) are running and sudo is enabled\n\n", RESET; } if ( !( -e "$Home/NDATE" ) ) { FRESH_INSTALL:; ##The option of NATE or PNATE libraries will be available only in case of developers in makefile(Wipro Team) ##By default ndate uses PNATE libraries if ( ( $user_type == 3 ) && ( $lib_type == 1 ) ) { $presult_options = 1; } if ( $presult_options == 2 ) { print "Fresh Installation of NDATE package\n"; if ( ( !-e "/usr/PNATE/nate" ) || ( !-e "/usr/PNATE/pnate" ) || ( !-e "/usr/PNATE/staf" ) ) { pnate_requirement_info(); print BOLD, GREEN, <<'EOD', RESET; -------------------------------------------------------------- INFORMATION: 1.PNATE will be installed in directory "/usr". Please ensure that the user has sufficient permissions and memory to this directory. 2.If the user selects the option "YES",the installation will takes approximately 10Minutes of time. --------------------------------------------------------------- EOD my $continue_install; while (1) { print BOLD, CYAN, "\nDo you want to continue? Default value is yes ", RESET; print BOLD, CYAN, "\nPlease enter y or n: ", RESET; $continue_install = getchompstrip( "", '', "" ); if ( $continue_install =~ /^$/ ) { print BOLD, CYAN, "\n\n You selected the default value of YES.Hence continuing with the process of PNATE installation.\n", RESET; $continue_install = "y"; $PNATE_Upgrade = 1; last; } elsif ( ( $continue_install =~ /^y$/ ) || ( $continue_install =~ /^Y$/ ) || ( $continue_install =~ /^yes$/ ) || ( $continue_install =~ /^Yes$/ ) ) { $continue_install = "y"; $PNATE_Upgrade = 1; last; } elsif ( ( $continue_install =~ /^n$/ ) || ( $continue_install =~ /^N$/ ) || ( $continue_install =~ /^no$/ ) || ( $continue_install =~ /^No$/ ) ) { $continue_install = "n"; last; } else { print BOLD, RED, " Please enter again: ", RESET; } } ## end while (1) if ( $continue_install =~ /n/ ) { goto FRESH_INSTALL; } } install_pnate_package(); execute_staf(); } else { ## Delete if exists unlink("$Home/.pnate_ndate_debug"); install_nate_package(); install_STAF(); } sleep 1; } ## end if (!(-e "$Home/NDATE"... ## Install perl packages if ( ( !( -e "/usr/software/bin/perl5.8.8" ) ) && ( $presult_options == 1 ) ) { install_perl_package(); print BOLD, CYAN, <<'EOD', RESET; ------------------------------------------------------------------------------ Perl modules installed under /usr/software EOD } ## end if (!(-e "/usr/software/bin/perl5.8.8"... exit if ( !( -e "$Home/NDATE" ) ); } ## end if (!(-e "$Home/NDATE"... banner; if ( -e "$Home/.pnate_ndate_debug" ) { # Run the staf execute_staf(); } else { my $cnt = unlink("$Home/.pnate_ndate_debug"); #Executing the STAF scripts based on the version of LINUX architecture install_STAF(); } if ( ( $A{s} ) && ( ( $A{s} eq "n" ) || ( $A{s} eq "N" ) ) ) { $check_ser = "n"; } elsif ( ( $A{s} ) && ( ( $A{s} eq "y" ) || ( $A{s} eq "Y" ) ) ) { $check_ser = "y"; } ## Burt 532027 < Updated value w = 4 > if ( ( $A{l} && ( ( !( $A{l} =~ /^\d+$/ ) ) || ( !( ( $A{l} <= 4 ) && ( $A{l} >= 3 ) ) ) ) ) || ( $A{p} && ( ( !( $A{p} =~ /^\d+$/ ) ) || ( !( $A{p} >= 1 ) ) || ( !( $A{p} <= 2 ) ) ) ) || ( $A{g} && ( ( !( $A{g} =~ /^\d+$/ ) ) || ( !( $A{g} >= 1 ) ) || ( !( $A{g} <= 2 ) ) ) ) || ( $A{h} && ( ( !( $A{h} =~ /^\d+$/ ) ) || ( !( $A{h} >= 1 ) ) || ( !( $A{h} <= 2 ) ) ) ) || ( ( $A{T} && ( $A{T} =~ /^\d+$/ ) ) && ( !( ( $A{T} <= 3 ) && ( $A{T} >= 1 ) ) ) ) || ( ( $A{m} ) && ( !( ( $A{m} eq 'DEV' ) || ( $A{m} eq 'QUAL' ) ) ) ) || ( $A{b} && ( $A{b} !~ /[1-7]$|4d$/ ) ) || ( ( $A{s} ) && ( !( ( $A{s} eq 'n' ) || ( $A{s} eq 'N' ) || ( $A{s} eq 'y' ) || ( $A{s} eq 'Y' ) ) ) ) || ( ( $A{E} ) && ( !( ( $A{E} eq 'n' ) || ( $A{E} eq 'N' ) || ( $A{E} eq 'y' ) || ( $A{E} eq 'Y' ) || ( $A{E} =~ /^d$/i ) ) ) ) || ( $A{w} && ( ( !( $A{w} =~ /^\d+$/ ) ) && ( !( ( $A{w} <= 4 ) && ( $A{w} >= 1 ) ) ) ) ) || ( ( $A{z} && ( ( !( $A{z} =~ /^\d+$/ ) ) ) ) ) ) { print BOLD, RED, "\nPlease enter correct argument/value\n", RESET; usage_ndate; } ## end if (($A{l} && ((!($A{l... ## End of Burt 532027 < Updated value w = 4 > if ( $A{EMSG} ) { $EMSG = $A{EMSG}; } if ( ( $A{ETO} ) && ( !( $A{ETO} =~ /\@/ ) ) ) { print BOLD, RED, "Missing @ in email id. Please enter correct argument/value\n", RESET; usage_ndate; } if ( ( $A{EFROM} ) && ( !( $A{EFROM} =~ /\@/ ) ) ) { print BOLD, RED, "Missing @ in email id. Please enter correct argument/value\n", RESET; usage_ndate; } if ( ( $A{E} ) && ( ( $A{E} eq "Y" ) || ( $A{s} eq "y" ) ) ) { $check_ser = "y"; } elsif ( ( $A{E} ) && ( ( $A{E} eq "N" ) || ( $A{s} eq "n" ) ) ) { $check_ser = "n"; } if ( ( $A{p} ) && ( ( $A{p} eq "2" ) || ( $A{p} eq "1" ) ) ) { $addparser = trim( $A{p} ); } elsif ( ( $A{E} ) && ( ( $A{E} eq "N" ) || ( $A{s} eq "n" ) ) ) { $addparser = "1"; } if ( ( $A{g} ) && ( ( $A{g} eq "2" ) || ( $A{g} eq "1" ) ) ) { $runpyth = trim( $A{g} ); } elsif ( ( $A{E} ) && ( ( $A{E} eq "N" ) || ( $A{s} eq "n" ) ) ) { $runpyth = "1"; } if ( ( $A{h} ) && ( ( $A{h} eq "2" ) || ( $A{h} eq "1" ) ) ) { $enableshell = trim( $A{h} ); } elsif ( ( $A{E} ) && ( ( $A{E} eq "N" ) || ( $A{s} eq "n" ) ) ) { $enableshell = "2"; } if ( ( $A{f} ) && ( ( $A{f} eq "1" ) || ( $A{f} eq "1" ) ) ) { $MINI_DISK_CREATE = "1"; $fast_mode = "1"; } elsif ( ( $A{E} ) && ( ( $A{E} eq "N" ) || ( $A{s} eq "n" ) ) ) { $MINI_DISK_CREATE = "2"; } if ( $A{w} ) { $test_wait_time = trim( $A{w} ); } if ( $A{a} ) { $AUTO_PUSH = 1 if ( $A{a} eq "1" ); } if ( $A{b} ) { $boot_type = "M"; $command_option = $A{b}; if ( $A{b} == 1 ) { $boot_mode = 1; } elsif ( $A{b} == 2 ) { print BOLD, YELLOW, "\nPlease note that the booting with 24/7 is not supported for IC kernel.\nIf you want to use the IC kernel then please re-execute the ndate without -b=2 option.\n", RESET; $boot_mode = "24\/7"; } elsif ( $A{b} == 3 ) { print BOLD, YELLOW, <<'EOD', RESET; Note: Option -b=3 does not exist for the BOILERMAKER. Refer the ./ndate help. EOD $boot_mode = "4a"; } elsif ( $A{b} eq "4" ) { $boot_mode = 4; } elsif ( $A{b} =~ /4d/ ) { $boot_mode = "4d"; } elsif ( $A{b} == 5 ) { $boot_mode = 5; } elsif ( $A{b} == 6 ) { $boot_type = "N"; } elsif ( $A{b} == 7 ) { $check_filer_setup = "N"; #Skips check filer setup } } ## end if ($A{b}) if ( $A{u} ) { $dbhandle = trim( $A{u} ); print "wipro technology pankaj dbhandle=$dbhandle\n"; } my $defailt_vals = "$Home/NDATE/default_params"; open( H_LOGFILE, "< $defailt_vals" ) or die "Failed opening $defailt_vals \n"; my @defaults; foreach my $line () { if ( $line =~ /^\#/ ) { next; # skip overall result report starting with a '#'. } if ( $line =~ /^LOGDIR=(.*)/ ) { if ( $A{d} ) { $logdir = trim( $A{d} ); } else { $logdir = $1; } } if ( $line =~ /^LOGLVL=(.*)/ ) { if ( ( $A{l} && ( $A{l} =~ /^\d+$/ ) ) && ( ( $A{l} <= 4 ) && ( $A{l} >= 3 ) ) ) { $loglvl = trim( $A{l} ); } else { $loglvl = "3"; } } if ( $line =~ /^LOGDIRSIZE=(.*)/ ) { if ( $A{z} && ( ( ( $A{z} =~ /^\d+$/ ) ) ) ) { $logsize = trim( $A{z} ); $tempsize = $logsize; my $mega = $tempsize * 1024; my $giga = $mega * 1024; $logsize = $giga; $logsize = ceil($logsize); } else { $logsize = 10485760; $tempsize = 10; } } ## end if ($line =~ /^LOGDIRSIZE=(.*)/) if ( $line =~ /^EMAIL=(.*)/ ) { if ( $A{E} ) { $EMAIL = trim( $A{E} ); } else { $EMAIL = $1; } } if ( $line =~ /^EMAIL_TO=(.*)/ ) { if ( $A{ETO} ) { $MAIL_TO = trim( $A{ETO} ); } else { $MAIL_TO = $1; } } if ( $line =~ /^EMAIL_FROM=(.*)/ ) { if ( $A{EFROM} ) { $MAIL_FROM = trim( $A{EFROM} ); } else { $MAIL_FROM = $1; } } if ( $line =~ /^RUNLIST=(.*)/ ) { if ( ( $A{e} ) && ( -e "$Home/NDATE/TEST_LISTS/$A{e}" ) ) { $runlist = trim( $A{e} ); } else { $runlist = $1; } } if ( $line =~ /^TEST_MODE=(.*)/ ) { if ( ( $A{m} ) && ( ( $A{m} eq "DEV" ) || ( $A{m} eq "QUAL" ) ) ) { $test_mode = trim( $A{m} ); } else { $test_mode = $1; } } if ( $line =~ /^EOE=(.*)/ ) { if ( ( $A{T} && ( $A{T} =~ /^\d+$/ ) ) && ( ( $A{T} <= 3 ) && ( $A{T} >= 1 ) ) ) { $terminate_on_error = trim( $A{T} ); } else { $terminate_on_error = $1; } } if ( $line =~ /^EXECMD=(.*)/ ) { $execmd = $1; } if ( $line =~ /^PYTHPATH=(.*)/ ) { $python_path = $1; } } ## end foreach my $line () close H_LOGFILE; if ( -e "$Home/NDATE/FILER_INFO/hdd-nate101" ) { system("rm $Home/NDATE/FILER_INFO/hdd-nate101"); } if ( ($logdir) && !( $logdir =~ /(NULL|null)/ ) ) { my $ret_val = set_logdir($logdir); $logdir = "$Home/NDATE/TEST_LOGS" if ( $ret_val == 0 ); } else { $logdir = "$Home/NDATE/TEST_LOGS"; set_logdir("$Home/NDATE/TEST_LOGS"); } MainMenu: if ( $A{e} ) { create_local_host(); execute_runlist( $A{e}, $logdir, $loglvl, $test_mode ); } else { verify_jobs(); $result_option = init_display(); } while (1) { if ( -e "$Home/NDATE/FILER_INFO/FILERS_LIST_t" ) { system("rm $Home/NDATE/FILER_INFO/FILERS_LIST_t"); } ## Execute ERT tests: option 6 TEST_CASE_ADD_ERT: if ( $result_option == 6 ) { my $flag = 0; my $back = 0; my $option; while (1) { print BOLD, CYAN, <<'EOD', RESET; -------------------------------------------------------------- Which type of setup would you like to be executed Select one of the options to continue 1 > ERT 2 > SSD Durability 3 > Long Term Data Handling (Currentlty not available) 4 > Stress Testing To go back to previous options press 'b' Note: Default option is 1 ERT. -------------------------------------------------------------- EOD while (1) { $option = getchompstrip( "", "", "" ); $option = trim($option); alarm $ALARM; if ( ( $option =~ /\d/ ) && ( $option <= 4 ) && ( $option >= 1 ) && ( $option != 3 ) ) { $flag = 1; last; } elsif ( $option eq '' ) { $flag = 1; $option = 1; print BOLD, WHITE, "\nYou selected ERT.\n\n", RESET; last; } elsif ( $option =~ /^(b|B)$/ ) { $back = 1; last; } else { oops "Please enter correct value 1/2/b"; } } ## end while (1) if ( $flag == 1 ) { last; } else { last; } } ## end while (1) if ( $back == 1 ) { $result_option = init_display(); next; } my @command; #$ERT = "Y"; print "\n"; { chdir("$Home/NDATE/TEST_LISTS") && last; oops "Not able to change location to directory:$Home/NDATE/TEST_LISTS"; } if ( $option == 1 ) { $ERT = "Y"; $KERNEL_TYPE = "DEBUG"; my $runlist = create_ERT_runlist; } elsif ( $option == 2 ) { $SSD_option = 1; $Durability = 1; $KERNEL_TYPE = "NON_DEBUG"; my $runlist = create_SSD_Durability_runlist; } elsif ( $option == 3 ) { print "\nTest Long_Term_Data_Handling is not available as of now\n"; } elsif ( $option == 4 ) { $Stress_test = 1; $KERNEL_TYPE = "NON_DEBUG"; my $runlist = create_Stress_testing_runlist; } print "ERT \n"; push( @command, "$Home/NDATE/NATE/bin/ntest" ); push( @command, "-v none" ); #push(@command, "-nolocaldb"); push( @command, "GNOTE_LOG_ACTIVE=0" ); push( @command, "NATE_CONN_SERVICE=0" ); push( @command, "STEST_FILE=$runlist" ); push( @command, "POSTJOB=$Home/NDATE/SUPPORT_SCRIPTS/post_job.thpl" ); push( @command, "LOGLVL=$loglvl" ); push( @command, "AUTO_PUSH=$AUTO_PUSH" ); push( @command, "RUNPYTH=$runpyth" ); if ( $runpyth == 1 ) { push( @command, "PYTHPATH=$python_path" ); } if ( $enableshell == 1 ) { push( @command, "DISABLESHELL=$enableshell" ); } push( @command, "stest/stest.thpl" ); push( @command, "LOGLVL=$loglvl" ); push( @command, "FILER=FILER" ); push( @command, "RUNID=HDD" ); push( @command, "TEST_MODE=$test_mode" ); push( @command, "EOE=$terminate_on_error" ); push( @command, "TEST_WAIT_TIME=$test_wait_time" ); push( @command, "CHECK_FILER_SETUP=$check_filer_setup" ); push( @command, "CLIENT=CLIENTS" ); if ( $option == 1 ) { push( @command, "ERT=Y" ); } my $cmdd = ( join( " ", @command ) . " " ); if ( $MAIL_TO =~ /default/ ) { print BOLD, CYAN, <<'EOD', RESET; Email IDs to send mail is not set Enter IDs using 'comma' as a separator EOD my $email_ids; while (1) { my $correct_email = 0; $email_ids = getchompstrip( "Email To:", "", "" ); alarm $ALARM; $email_ids = trim($email_ids); if ( $email_ids =~ /[=\$\*;\#]/ ) { print "\nEmail ids :Characters = * ; \$ # not allowed\n"; } elsif ( !length($email_ids) ) { print "\nFiler name:Please enter non empty email ids\n"; } else { my @arr2 = split( /,/, $email_ids ); foreach my $email (@arr2) { if ( !( $email =~ /@/ ) ) { $correct_email = 1; oops "Not an valid email id :$email"; } } last if ( $correct_email == 0 ); } ## end else [ if ($email_ids =~ /[=\$\*;\#]/) } ## end while (1) $MAIL_TO = $email_ids; } ## end if ($MAIL_TO =~ /default/) if ( $MAIL_FROM =~ /default/ ) { print BOLD, CYAN, <<'EOD', RESET; Email from is not set Enter IDs using 'comma' as a separator EOD my $email_ids; while (1) { my $correct_email = 0; $email_ids = ""; $email_ids = getchompstrip( "Email From:", "", "" ); alarm $ALARM; $email_ids = trim($email_ids); if ( $email_ids =~ /[=\$\*;\#]/ ) { print "\nEmail ids :Characters = * ; \$ # not allowed\n"; } elsif ( !length($email_ids) ) { print "\nFiler name:Please enter non empty email ids\n"; } else { my @arr2 = split( /,/, $email_ids ); foreach my $email (@arr2) { if ( !( $email =~ /@/ ) ) { $correct_email = 1; oops "Not an valid email id :$email"; } } last if ( $correct_email == 0 ); } ## end else [ if ($email_ids =~ /[=\$\*;\#]/) } ## end while (1) $MAIL_FROM = $email_ids; } ## end if ($MAIL_FROM =~ /default/) ################################## execute the command ############################# { chdir("$Home/NDATE") && last; oops "Not able to change location to directory: $Home/NDATE"; } open( H_DEFAULT, ">$defailt_vals" ) or die "write:Failed opening $defailt_vals \n"; print( H_DEFAULT "RUNLIST=$runlist\n" ); print( H_DEFAULT "LOGLVL=$loglvl\n" ); print( H_DEFAULT "EOE=$terminate_on_error\n" ); print( H_DEFAULT "LOGDIR=$Home/NDATE/TEST_LOGS\n" ); print( H_DEFAULT "EXECMD=$cmdd\n" ); print( H_DEFAULT "TEST_MODE=$test_mode\n" ); print( H_DEFAULT "EMAIL=$EMAIL\n" ); print( H_DEFAULT "EMAIL_MSG=$EMSG\n" ); print( H_DEFAULT "EMAIL_TO=$MAIL_TO\n" ); print( H_DEFAULT "EMAIL_FROM=$MAIL_FROM\n" ); if ( $logsize == 0 ) { $logsize = 10485760; } print( H_DEFAULT "LOGDIRSIZE=$logsize\n" ); print( H_DEFAULT "PYTHPATH=$python_path\n" ); close H_DEFAULT; # Set only n or y if ( $EMAIL !~ /^d$/i ) { $EMAIL = "y"; } if ( $check_filer_setup eq 'N' ) { print BOLD, CYAN, "Check filer setup will be skipped\n", RESET; } if ( $test_mode eq "DEV" ) { print BOLD, CYAN, "Test Mode selected : Development\n", RESET; } else { print BOLD, CYAN, "Test Mode selected : Qualification\n", RESET; } print BOLD, CYAN, "Log level selected : $loglvl \n", RESET; if ( $terminate_on_error == 1 ) { print BOLD, CYAN, "Test Exit Mode selected : INSPECT\n", RESET; } elsif ( $terminate_on_error == 2 ) { print BOLD, CYAN, "Test Exit Mode selected : INSPECT,FATAL\n", RESET; } elsif ( $terminate_on_error == 3 ) { print BOLD, CYAN, "Test Exit Mode selected : INSPECT,FATAL,FAIL\n", RESET; } ## Burt 532027 < Updated value w = 4 > if ( $test_wait_time != 3 ) { print BOLD, CYAN, "Individual Test Time reduced to : 10% \n", RESET if ( $test_wait_time == 1 ); print BOLD, CYAN, "Individual Test Time reduced to : 50% \n", RESET if ( $test_wait_time == 2 ); print BOLD, CYAN, "Individual Test Time reduced to : 95% \n", RESET if ( $test_wait_time == 4 ); } ## end if ($test_wait_time !=... ## End of Burt 532027 < Updated value w = 4 > print BOLD, CYAN, "Log path set to : $logdir \n", RESET; if ( ( $EMAIL eq 'y' ) || ( $EMAIL eq 'Y' ) ) { print BOLD, CYAN, "Send email set to : $MAIL_TO \n", RESET; print BOLD, CYAN, "Email from set to : $MAIL_FROM \n", RESET; } if ( $option == 1 ) { if ( $test_wait_time == 1 ) { $TOTAL_ERT_DAYS = 1; } elsif ( $test_wait_time == 2 ) { $TOTAL_ERT_DAYS = $TOTAL_ERT_DAYS / 2; } } print BOLD, CYAN, "\n Command: $cmdd \n", RESET; display_runlist($runlist); print BOLD, CYAN, <<'EOD', RESET; ------------------------------------------------------------------ Press ENTER to execute the test in BACKGROUND mode OR choose "f" for FOREGROUND run To go back to previous options press "b" ------------------------------------------------------------------ EOD my $state = 0; while (1) { $result = getchompstrip( "", "", "" ); alarm $ALARM; $result = trim($result); if ( $result =~ /(q|Q)/ ) { exit 0; } if ( $result =~ /(help|HELP|Help)/ ) { print BOLD, GREEN, " If the user pressed cntrl+C accidentally on the client console will terminate the test.\n", " This may happen if the client console frozen.\n", " So execute the test in background mode in case the test execution time is more.\n\n", " To terminate the test suite manually, find the process id associate with the test (ps -au |grep ntest).\n", " Kill the process id (kill -9 process_id). \n", RESET; } elsif ( $result =~ /(b|B)/ ) { $state = 1; last; } elsif ( ( $result eq "f" ) || ( $result eq "F" ) || ( $result eq "" ) ) { check_log_size(); last; } else { oops "Please choose correct option\n b - Back\n f - Foreground\n Press ENTER to Background test execution"; } } ## end while (1) if ( $state == 1 ) { $result_option = 1; $result_option = init_display if ( $test_suite_no == 1 ); next; } system('clear'); my $background = 1; if ( $result =~ /^(F|f)/ ) { $background = 0; } execute_cmd( $cmdd, $background ); last; } ## end if ($result_option == ... if ( $result_option eq '4a' ) { my $back = 0; system("clear"); print BOLD, YELLOW, "\n", " #..................................................................................# \n", " #..................................................................................# \n", " # # \n", " # WELCOME TO AUTOMATIC PACKAGE COPYING AND INSTALLATION WIZARD. #\n", " # # \n", " #..................................................................................# \n", " #..................................................................................# \n", RESET; my $Home = $ENV{HOME}; my $mypwd = $Home; chomp($mypwd); print BOLD, GREEN, "\n Current working directory is $mypwd \n", RESET; #my $mnt = '\mnt'; my $mnt = "$Home\/mnt_temp"; system("mkdir $mnt"); print BOLD, GREEN, " \nPlease Enter the Server Ip address from which you would like to copy Package files \n\n", RESET; print BOLD, YELLOW, " \t1. Bluemoon - SVL - 172.22.193.161/\n", RESET; print BOLD, GREEN, " \t2. Jaeger - SVL - 172.23.8.10\n", RESET; print BOLD, GREEN, " \t3. ICT Webserver - 10.113.132.16\n", RESET; print BOLD, GREEN, "\n Default Bluemoon will be selected - 172.22.193.161", RESET; print BOLD, YELLOW, "\n Press enter to select default option\n", RESET; my $server_ip; my $blue = 0; my $ict = 0; while (1) { my $s_val = getchompstrip( "", '', "" ); if ( ( $s_val eq '' ) || ( $s_val == 1 ) ) { print BOLD, GREEN, " Server chosen is Bluemoon, Mounting Bluemoon\n", RESET; $server_ip = '10.56.10.113'; $blue = 1; last; } elsif ( $s_val == 2 ) { print BOLD, GREEN, " Server Chosen Jeager, Mounting Jeager\n", RESET; $server_ip = '172.23.8.10'; last; } elsif ( $s_val =~ /^(b|B)$/ ) { $back = 1; last; } elsif ( $s_val == 3 ) { print BOLD, GREEN, " Server Chosen ICT WebServer, Mounting ICT WebServer\n", RESET; $server_ip = '10.113.132.16'; $ict = 1; last; } else { if ( $s_val =~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/ ) { $server_ip = $s_val; print BOLD, GREEN, "\nServer chosen by the user is $s_val\n", RESET; last; } else { print BOLD, RED, "Please choose correct IP address\n", RESET; } } } if ( $back == 1 ) { $result_option = init_display(); next; } print BOLD, CYAN, "\n Mounting $server_ip\n", RESET; my $test_mnt = "$mypwd\/" . "test_mount_" . "$$"; `touch $test_mnt`; if ( ( $blue == 0 ) && ( $ict == 0 ) ) { `sudo mount -F -o soft $server_ip:/ $mnt >& $test_mnt`; } elsif ( ( $ict == 1 ) && ( $blue == 0 ) ) { `sudo mount -F -o soft 10.113.132.16:/opt/lampp/htdocs/ndate $mnt >& $test_mnt`; } else { `sudo mount -F -o soft $server_ip:/bluemoon_vol/web/NDATE $mnt >& $test_mnt`; } $/ = undef; open( FH, "$test_mnt" ); my $mount_st = ; close FH; $/ = "\n"; if ( $mount_st =~ /already mounted or busy/i ) { print BOLD, RED, "\n $mount_st \n", RESET; print BOLD, YELLOW, "\n $mnt is already mounted so trying to un-mount it first and mounting again properly\n", RESET; qx/sudo umount -l $mnt/; if ( ( $blue == 0 ) && ( $ict == 0 ) ) { `sudo mount -F -o soft $server_ip:/ $mnt >& $test_mnt`; } elsif ( ( $ict == 1 ) && ( $blue == 0 ) ) { `sudo mount -F -o soft 10.113.132.16:/opt/lampp/htdocs/ndate $mnt >& $test_mnt`; } else { `sudo mount -F -o soft $server_ip:/bluemoon_vol/web/NDATE $mnt >& $test_mnt`; } if ( $? !~ /0/ ) { print BOLD, RED, "\n Error occured during mounting the server $server_ip\n", RESET; print BOLD, RED, " Exiting from the ndate tool,Please correct the mounting issues and try again later\n", RESET; #system("sudo rm -rf $test_mnt"); exit; } else { print BOLD, GREEN, "\n Mounting done successfully \n", RESET; } } elsif ( !$mount_st ) { print BOLD, GREEN, "\n Mounting done successfully \n", RESET; } else { print BOLD, RED, "\n Could not mount the server $server_ip, reason is \n $mount_st\n", RESET; print BOLD, RED, " Exiting from the ndate tool, Please correct the mounting issues and try again\n", RESET; #system("sudo rm -rf $test_mnt"); exit; } #system("sudo rm -rf $test_mnt"); my $file_path; if ( ( $blue == 0 ) && ( $ict == 0 ) ) { $file_path = "$mnt\/etc\/nateNightly"; } elsif ( ( $ict == 1 ) && ( $blue == 0 ) ) { $file_path = "$mnt"; } else { $file_path = "$mnt"; } my @dirs; opendir( OPE, "$file_path" ); my @all_files = readdir(OPE); foreach my $file (@all_files) { $file =~ s/^\s+|\s+$//g; if ( -d "$file_path/$file" ) { push( @dirs, $file ) if ( $file =~ /^NDATE/ ); } } closedir(OPE); print BOLD, GREEN, "\n NDATE directories present under $file_path are\n", RESET; my (%match); my $index = 1; foreach (@dirs) { $match{$index} = $_; print BOLD, CYAN, "\n $index $_\n"; $match{$_} = $_; $index++; } if ( !@dirs ) { print BOLD, RED, "\n No directories present under the path $file_path , exiting from the rest of the test\n", RESET; exit 0; } print BOLD, GREEN, "\nPlease choose any one of the above NDATE directory Or the number associated with it to copy and install\n", RESET; my $dir_name; while (1) { my $dir_val = getchompstrip( "", '', "" ); #my $dir_val = <>; chomp($dir_val); if ( $dir_val eq '' ) { print BOLD, GREEN, "\n Please select number from above list \n", RESET; } else { print "\n $file_path/$match{$dir_val} \n"; if ( ( -e "$file_path/$match{$dir_val}" ) && ( $match{$dir_val} =~ /\S+/ ) ) { print BOLD, GREEN, "\n option selected is -- $dir_val\n", RESET; $dir_name = $match{$dir_val}; last; } else { print BOLD, RED, "\n Choosed directory $dir_val is not present under the path $file_path, please choose the correct directory name\n", RESET; print BOLD, GREEN, "\n Please choose one of the below directory \n", RESET; # grep{print BOLD, CYAN,"\n $_\n"}@dirs; $index = 1; foreach (@dirs) { $match{$index} = $_; print BOLD, CYAN, "\n $index $_\n"; $match{$_} = $_; $index++; } } } } my $copying_path; if ( ( $blue == 0 ) && ( $ict == 0 ) ) { $copying_path = "$mnt\/etc\/nateNightly\/" . "$dir_name"; } elsif ( ( $ict == 1 ) && ( $blue == 0 ) ) { $copying_path = "$mnt" . "/" . "$dir_name"; } else { $copying_path = "$mnt" . "/" . "$dir_name"; } print BOLD, GREEN, "\n copying directories from path $copying_path\n"; system("cd $copying_path"); my $ls = `ls -l $copying_path`; opendir( OPE1, "$copying_path" ); my @files = readdir(OPE1); closedir(OPE1); print BOLD, GREEN, "\n Files present under $copying_path are \n"; foreach (@files) { if ( $_ =~ /^\.+$/ ) { next; } print BOLD, CYAN, "\n $_ \n"; } my ( $idx, $maingz ); my $flag = 0; foreach my $file (@files) { next if ( $file =~ /^\.+$/ ); $idx++; if ( $file =~ /NDATE_(\S+)\.gz/ ) { $maingz = $file; $flag = 1; last; } } if ( !$flag ) { print BOLD, RED, "\n No NDATE folder found , exiting from the tool\n"; exit; } print "\n\n"; print BOLD, GREEN, "Copying NDATE files to location $mypwd -- (wait...)\n"; system("sudo cp -rf $copying_path/* $mypwd"); print BOLD, GREEN, "\n Copying NDATE files completed\n"; my $HOME = $ENV{HOME}; chdir("$mypwd"); chomp( my $pdir = `pwd` ); print BOLD, CYAN, "\n Current dir is $pdir\n"; print BOLD, GREEN, "\n - unpacking $maingz ...\n"; my $myunpack = qx/sudo tar -xvf $maingz/; print BOLD, WHITE, "$myunpack \n"; print BOLD, GREEN, "\n - Un-mounting Server $server_ip -- $mnt\n"; system("sudo umount -v $mnt"); #if not unmounted use sudo umount -l $mnt #system("rm -rf $mnt"); $option_4a = 1; goto option_4; } if ( $result_option =~ /^9$/ ) { my ( @filers, $Convert ); my $flag = 0; my $back = 0; my $option; while (1) { print BOLD, CYAN, <<'EOD', RESET; -------------------------------------------------------------- Which Mode would you like to convert Select one of the options to continue 1 > Setup C-Mode - SAS 2 > Install Kernel Image on the Filer - SAS 3 > Add or Delete Image file - SAS/NVMe 4 > Wipe DOT meta data area - SAS 5 > Setup NVMe/Apollo-Tahiti System 6 > Update NVMe System BIOS and Firmware 7 > Setup NVMe Multi-NameSpace - MNS To go back to previous options press "b" Note: Default option is 3 > Add or Delete Image file -------------------------------------------------------------- EOD while (1) { $option = getchompstrip( "", "", "" ); $option = trim($option); alarm $ALARM; if ( ( $option =~ /\d/ ) && ( $option <= 7 ) && ( $option >= 1 ) ) { $flag = 1; last; } elsif ( $option eq '' ) { $flag = 1; $option = 3; print BOLD, WHITE, "\nYou selected Add or Delete Image file.\n\n", RESET; last; } elsif ( $option =~ /^(b|B)$/ ) { $back = 1; last; } else { oops "Please enter correct value 1/2/3/b"; } } ## end while (1) if ( $flag == 1 ) { if ( $option == 1 ) { $Convert = 'CMode'; } elsif ( $option == 2 ) { $Convert = 'none'; } elsif ( $option == 4 ) { $Wipe_LBAs = 'Wipe_LBAS'; } elsif ( $option == 5 ) { $NVMe_setup_9 = 'yes_setup'; } elsif ( $option == 6 ) { $AFU_UPDATE = 1; } elsif ( $option == 7 ) { $NVMe_MNS = 1; } else { $Convert = 'add_del'; } last; } else { last; } } ## end while (1) if ( $back == 1 ) { $result_option = init_display(); next; } my ( $filers, $image, $FILER, $flag2 ); if ( $Convert eq 'CMode' || $Wipe_LBAs eq 'Wipe_LBAS' ) { #$FILER_LIST{'convert_to'} = $Convert; my @selected_filers = _display_filer('CMode'); print BOLD, CYAN, <<'EOD', RESET; -------------------------------------------------------------- Available CMODE filer configuration files are listed below -------------------------------------------------------------- EOD my %sort; foreach my $filer (@selected_filers) { if ( $filer =~ /(\S+)-(\d+)/ ) { $sort{$filer} = $1; } elsif ( $filer =~ /(^\d+)/ ) { $sort{$1} = "num"; } elsif ( $filer =~ /(\S+)/ ) { $sort{$filer} = $1; } } my @sorted; my $value = "num"; my @keys = grep { $sort{$_} eq $value } keys %sort; @keys = sort { $a <=> $b } @keys; foreach my $key (@keys) { push( @sorted, $key ); } my @keys = grep { $sort{$_} ne $value } keys %sort; my @values = grep { $_ ne $value } values %sort; @values = do { my %seen; grep { !$seen{$_}++ } @values; }; @values = sort (@values); foreach my $val (@values) { my @keys = grep { $sort{$_} eq $val } keys %sort; my @sortdone = sort { my ($aa) = $a =~ /.*-(.+)/; my ($bb) = $b =~ /.*-(.+)/; $aa <=> $bb; } @keys; foreach my $key (@sortdone) { push( @sorted, $key ); } } # my @sorted = sort {$a cmp $b} @selected_filers; foreach (@sorted) { print BOLD, MAGENTA, "$_\n", RESET; } begin: print BOLD, CYAN, <<'EOD', RESET; -------------------------------------------------------------- Please enter the two SFO pair filers separated by comma Ex: FILERA,FILERB -------------------------------------------------------------- EOD $FILER_LIST{'convert_to'} = $Convert; #while(1){ while (1) { my $check = 1; $filers = getchompstrip( "", "", "" ); $filers = trim($filers); my @initial_check = split( ',', $filers ); @check = _unique(@initial_check); alarm $ALARM; if ( $filers eq '' ) { oops "Please enter correct value "; } elsif ( scalar @initial_check != 2 ) { print BOLD, RED, <<'EOD', RESET; -------------------------------------------------------------- Please enter the two SFO pair filers separated by comma Ex: FILERA,FILERB -------------------------------------------------------------- EOD } elsif ( scalar @check != 2 ) { print BOLD, RED, <<'EOD', RESET; -------------------------------------------------------------- You have entered the same filer twice Please enter the two SFO pair filers separated by comma Ex: FILERA,FILERB -------------------------------------------------------------- EOD } else { print BOLD, GREEN, "\nYou have chosen the filers @check.\n\n", RESET; $FILER = join( '_', @check ); $FILER_LIST{'filer'}{$FILER} = join( ',', @check ); #my @filers = split(',',$filers); foreach (@check) { my $chk = _check_filer_config( 'CMode', $_ ); if ( $chk == 0 ) { $check = 0; } } if ( $check == 1 ) { last; } else { %FILER_LIST = (); goto begin; } } } ## end while (1) print BOLD, CYAN, <<'EOD', RESET; -------------------------------------------------------------- Would you like to install new IMAGE on the filer ? (y/n) Default option is 'n' -------------------------------------------------------------- EOD my ($image_option); $flag2 = 0; while (1) { $image_option = getchompstrip( "", "", "" ); $image_option = trim($image_option); alarm $ALARM; if ( $image_option =~ /^(y|n)$/i ) { $flag2 = 1; last; } elsif ( $image_option eq '' ) { $flag2 = 1; $image_option = 'n'; print BOLD, WHITE, "You have choosed not to Install New Image\n", RESET; last; } else { oops "Please enter correct value y/n"; } } if ( $flag2 == 1 ) { if ( $image_option =~ /n/i ) { $image = 'N'; $FILER_LIST{'image'}{$FILER} = $image; } else { print BOLD, CYAN, "\n-----------------------------------------------------------------------------\n\n", RESET; my $DEBUG = "DEBUG"; my $image_d = _update_image_file_list($DEBUG); print BOLD, CYAN, "\n-----------------------------------------------------------------------------\n\n", RESET; #$FILER_LIST{'image'}{$FILER} = $image; my $NON_DEBUG = "NON_DEBUG"; my $image_n = _update_image_file_list($NON_DEBUG); print BOLD, CYAN, "\n-----------------------------------------------------------------------------\n\n", RESET; print BOLD, CYAN, <<'EOD', RESET; Please choose the Default KERNEL type to be present on the filer 1> DEBUG 2> NON DEBUG Default option is 1> DEBUG -------------------------------------------------------------- EOD while (1) { $image = getchompstrip( "", "", "" ); $image = trim($image); if ( ( $image =~ /1/ ) || ( $image =~ /^debug/i ) ) { $image = $image_d; last; } elsif ( ( $image =~ /2/ ) || ( $image =~ /nondebug/i ) || ( $image =~ /non debug/i ) ) { $image = $image_n; last; } elsif ( $image eq '' ) { print BOLD, WHITE, "\nYou have choosen the DEBUG KERNEL", RESET; $image = $image_d; last; } else { oops "Please enter correct value 1 or 2"; } } $FILER_LIST{'image'}{$FILER} = $image; } } #} #print("dumping". Dumper(%FILER_LIST)); if ( $Wipe_LBAs eq 'Wipe_LBAS' ) { print BOLD, CYAN, <<'EOD', RESET; -------------------------------------------------------------- Select option 1 to wipe selected drives and option 2 to wipe all drives 1> User selected drives 2> All drives Default option is 2> All -------------------------------------------------------------- EOD while (1) { my $wipe_options_temp = getchompstrip( "", "", "" ); my $wipe_options = trim($wipe_options_temp); alarm $ALARM; if ( ( $wipe_options =~ /\d/ ) && ( ( $wipe_options == 2 ) || ( $wipe_options == 1 ) ) ) { $user_selected_option = $wipe_options; last; } elsif ( $wipe_options eq '' ) { print BOLD, GREEN, "\nYou have selected to wipe all drives.", RESET; last; } else { oops "Please enter correct value 1/2"; } } ## End of while(10 $Disk_Serial_Number = ""; if ( $user_selected_option == 1 ) { my @keys = keys %{ $FILER_LIST{'filer'} }; my @filer_list = split( ",", $FILER_LIST{'filer'}{ $keys[0] } ); @node = @filer_list; foreach my $val (@node) { FIRST: #-------------------------------------------------------------- print <<"EOD"; Please enter the disk serial number for node $val For example : 3QN02C7100009843Y1H4 EOD while (1) { $Disk_Serial_Number = getchompstrip( "Serial number", "", "" ); alarm $ALARM; if ( $Disk_Serial_Number =~ /[=\$\*,;\#]/ ) { oops('Characters "=" "$" "*" "," ";" "$" "#" not allowed'); } elsif ( $Disk_Serial_Number =~ /^\s*$/ ) { oops('Serial number must be nonempty'); goto FIRST; } else { push( @disk_serial_nums, $Disk_Serial_Number ); } last; } # end foreach (@node) $Disk_Serial_Number = "$disk_serial_nums[0]" . ',' . "$disk_serial_nums[1]"; } } else { print BOLD, GREEN, "\nAll drives are selected for wipe.", RESET; } } # end of if Wipe_LBAs } elsif ( ( $Convert eq 'none' ) || ( $NVMe_setup_9 eq 'yes_setup' ) ) { $Convert = "CMODE" if ( $NVMe_setup_9 eq 'yes_setup' ); my @selected_filers = _display_filer('CMode'); @selected_filers = _unique(@selected_filers); ##array @selected_filers may contain duplications[Filer names] print BOLD, CYAN, <<'EOD', RESET; -------------------------------------------------------------- Available filers are listed below -------------------------------------------------------------- EOD my %sort; foreach my $filer (@selected_filers) { if ( $filer =~ /(\S+)-(\d+)/ ) { $sort{$filer} = $1; } elsif ( $filer =~ /(^\d+)/ ) { $sort{$1} = "num"; } elsif ( $filer =~ /(\S+)/ ) { $sort{$filer} = $1; } } my @sorted; my $value = "num"; my @keys = grep { $sort{$_} eq $value } keys %sort; @keys = sort { $a <=> $b } @keys; foreach my $key (@keys) { push( @sorted, $key ); } my @keys = grep { $sort{$_} ne $value } keys %sort; my @values = grep { $_ ne $value } values %sort; @values = do { my %seen; grep { !$seen{$_}++ } @values; }; @values = sort (@values); foreach my $val (@values) { my @keys = grep { $sort{$_} eq $val } keys %sort; my @sortdone = sort { my ($aa) = $a =~ /.*-(.+)/; my ($bb) = $b =~ /.*-(.+)/; $aa <=> $bb; } @keys; foreach my $key (@sortdone) { push( @sorted, $key ); } } foreach (@sorted) { print BOLD, MAGENTA, "$_\n", RESET; } begin2: print BOLD, CYAN, <<'EOD', RESET; ---------------------------------------------------------------------------------------------------- Please enter the two filer names which are SFO pair separated by comma Ex: FILERA,FILERB ---------------------------------------------------------------------------------------------------- EOD $FILER_LIST{'convert_to'} = 'N'; while (1) { my $check = 1; $filers = getchompstrip( "", "", "" ); $filers = trim($filers); alarm $ALARM; my @filter_filers1 = split( ',', $filers ); my @filter_filers = _unique(@filter_filers1); print "FIELRS : @filter_filers1\n"; if ( $filers eq '' ) { oops "Please enter correct names\n"; } elsif ( scalar @filter_filers1 != scalar @filter_filers ) { print BOLD, RED, " You have entered two filers with same name, Please select again\n\n", RESET; } elsif ( scalar @filter_filers1 != 2 ) { print BOLD, RED, "Please enter the two filer names separated by comma \n\t Ex: FILERA,FILERB\n\n", RESET; } else { my $a = scalar @filter_filers; if ( scalar @filter_filers > 1 ) { $FILER = join( '_', @filter_filers ); $FILER_LIST{'filer'}{$FILER} = join( ',', @filter_filers ); } else { $FILER = $filter_filers[0]; $FILER_LIST{'filer'}{$FILER} = "$FILER"; } foreach (@filter_filers) { $check = _check_filer_config( "$Convert", $_ ); } if ( $check == 1 ) { last; } else { %FILER_LIST = (); goto begin2; } } } ## end while (1)a if ( $NVMe_setup_9 ne 'yes_setup' ) { print BOLD, CYAN, "\n-----------------------------------------------------------------------------\n\n", RESET; my $DEBUG = "DEBUG"; my $image_d = _update_image_file_list($DEBUG); $image_d = trim($image_d); print BOLD, CYAN, "\n-----------------------------------------------------------------------------\n\n", RESET; my $NON_DEBUG = "NON_DEBUG"; my $image_n = _update_image_file_list($NON_DEBUG); $image_n = trim($image_n); print BOLD, CYAN, "\n-----------------------------------------------------------------------------\n\n", RESET; print BOLD, CYAN, <<'EOD', RESET; Please choose the Default KERNEL type to be present on the filer 1> DEBUG 2> NON-DEBUG Default option is 1> DEBUG -------------------------------------------------------------- EOD while (1) { $image = getchompstrip( "", "", "" ); $image = trim($image); if ( ( $image =~ /1/ ) || ( $image =~ /^debug/i ) ) { $image = $image_d; last; } elsif ( ( $image =~ /2/ ) || ( $image =~ /nondebug/i ) || ( $image =~ /non debug/i ) ) { $image = $image_n; last; } elsif ( $image eq '' ) { print BOLD, WHITE, "\nYou have choosen the DEBUG KERNEL", RESET; $image = $image_d; last; } else { oops "Please enter correct value 1 or 2"; } } $FILER_LIST{'image'}{$FILER} = $image; } elsif ( $NVMe_setup_9 eq 'yes_setup' ) { my $boot_state; print BOLD, WHITE, "\n\n Select options to proceed \n\t1.Maintenance Mode\n\t2.File System Mode (With cluster)\n\t3.Install Kernel(Apollo-Tahiti)\n\n", RESET; while (1) { $boot_state = getchompstrip( "", "", "" ); $boot_state = trim($boot_state); alarm $ALARM; if ( $boot_state == 1 ) { $FILER_LIST{$FILER}{'BOOT_STATE'} = 'MAINTENANCE'; $FILER_LIST{$FILER}{'MODE'} = 'MAINTENANCE'; $FILER_LIST{'image'}{$FILER} = 'NA'; $FILER_LIST{$FILER}{'ENV_PATH'} = 'FILER_INFO'; last; } elsif ( $boot_state == 2 ) { $FILER_LIST{$FILER}{'BOOT_STATE'} = 'FILE_SYSTEM'; $FILER_LIST{$FILER}{'MODE'} = 'FILE_SYSTEM'; $FILER_LIST{'image'}{$FILER} = 'NA'; $FILER_LIST{$FILER}{'ENV_PATH'} = 'FILER_INFO'; last; } elsif ( $boot_state == 3 ) { $FILER_LIST{$FILER}{'BOOT_STATE'} = 'INSTALL_IMAGE'; $FILER_LIST{$FILER}{'MODE'} = 'FILE_SYSTEM'; print BOLD, YELLOW, "\nEnter DEBUG Kernel path"; my $image_d = _update_image_file_list("DEBUG"); print BOLD, YELLOW, "\nEnter NON-DEBUG Kernel path"; my $image_n = _update_image_file_list("NON_DEBUG"); print BOLD, YELLOW, "\n\nWhich Kernel must be loaded as primary image, Enter DEBUG or NONDEBUG \n"; while (1) { my $req_version = getchompstrip( "", "", "" ); $req_version = trim($req_version); if ( $req_version =~ /debug|nondebug/i ) { print BOLD, WHITE, "\n User Selected $req_version kernel as default kernel"; $FILER_LIST{'image'}{$FILER} = $req_version; last; } else { print BOLD, RED, "\n Enter debug or nondebug\n"; } } last; } else { print BOLD, RED, "\n PLEASE SELECT option 1 ,2 or 3 \n", RESET; } } my $env_path; my ( $na, $nb ) = $FILER =~ /(\S+)\_(\S+)/; print BOLD, WHITE, "\n\n NOTE: Apollo Systems requires ENVIRONMENT variables to boot, Make sure FILER_INFO $Home/NDATE/FILER_INFO/$na and $Home/NDATE/FILER_INFO/$nb has all required variables\n", RESET; print BOLD, YELLOW, "\n Press Enter to continue......\n"; while (1) { $env_path = getchompstrip( "", "", "" ); $env_path = trim($env_path); alarm $ALARM; if ( $env_path eq '' ) { $FILER_LIST{$FILER}{'ENV_PATH'} = 'FILER_INFO'; last; } elsif ( $env_path ne '' ) { print BOLD, RED, "Press Enter ..\n"; } } } #enf of NVMe_setup_9 #print("dumping". Dumper(%FILER_LIST)); } elsif ( $Convert eq 'add_del' ) { print BOLD, CYAN, <<'EOD', RESET; -------------------------------------------------------------- Select option 1 to add KERNEL Image files, option 2 to delete KERNEL Image files 1> add 2> delete Default option is 2> delete -------------------------------------------------------------- EOD my ( $add_del, $flag_a_d ); while (1) { $add_del = getchompstrip( "", "", "" ); $add_del = trim($add_del); alarm $ALARM; if ( ( $add_del =~ /\d/ ) && ( $add_del <= 2 ) && ( $add_del >= 1 ) ) { $flag_a_d = 1; last; } elsif ( $add_del eq '' ) { $flag_a_d = 1; $add_del = 2; print BOLD, WHITE, "\nYou have choosed to delete IMAGE for the list.\n\n", RESET; last; } else { oops "Please enter correct value 1/2"; } } if ( $flag_a_d == 1 ) { my $value = _add_del_image($add_del); if ($value) { goto MainMenu; } } last; } elsif ( $AFU_UPDATE == 1 ) { print BOLD, WHITE, "\n\t Selected Apollo Fimrware update ( SP, LOADER, BIOS, BMC, BMC_Backup etc...)", RESET; print BOLD, YELLOW, "\n\t NOTE: Accessible webserver IP with all firmware placed in webserver is requried", RESET; my ( $fl_2_update, $web_ip ); while (1) { print BOLD, WHITE, "\n\n\t\tEnter Filer name - One filer at a time :", RESET; $fl_2_update = getchompstrip( "", "", "" ); $fl_2_update = trim($fl_2_update); alarm $ALARM; if ( $fl_2_update !~ '' ) { $FILER_LIST{'filer'}{$fl_2_update} = "$fl_2_update"; last; } else { print BOLD, RED, "\n\n\t\t Please Enter Filer !!!", RESET; } } while (1) { print BOLD, WHITE, "\n\n\t\tEnter Web server IP ", RESET; $web_ip = getchompstrip( "", "", "" ); $web_ip = trim($web_ip); alarm $ALARM; if ( $web_ip !~ '' ) { $FILER_LIST{$fl_2_update}{'AFU_WEBSERVER'} = $web_ip; last; } else { print BOLD, RED, "\n\n\t\t Please Enter web server IP !!!!!", RESET; } } } elsif ( $NVMe_MNS == 1 ) { print BOLD, WHITE, "\n\t Selected NVMe - Multi Namespace Setup option", RESET; mns_begin: while (1) { print BOLD, WHITE, "\n\n\t\tEnter Filer names - Example - (FILER_A,FILER_B)", RESET; my $check = 1; my $filers = getchompstrip( "", "", "" ); $filers = trim($filers); alarm $ALARM; my @filter_filers1 = split( ',', $filers ); my @filter_filers = _unique(@filter_filers1); print "FIELRS : @filter_filers1\n"; if ( $filers eq '' ) { oops "Please enter correct names\n"; } elsif ( scalar @filter_filers1 != scalar @filter_filers ) { print BOLD, RED, " You have entered two filers with same name, Please select again\n\n", RESET; } elsif ( scalar @filter_filers1 != 2 ) { print BOLD, RED, "Please enter the two filer names separated by comma \n\t Ex: FILERA,FILERB\n\n", RESET; } else { my $a = scalar @filter_filers; if ( scalar @filter_filers > 1 ) { $FILER = join( '_', @filter_filers ); $FILER_LIST{'filer'}{$FILER} = join( ',', @filter_filers ); } else { $FILER = $filter_filers[0]; $FILER_LIST{'filer'}{$FILER} = "$FILER"; } foreach (@filter_filers) { $check = _check_filer_config( "CMode", $_ ); } if ( $check == 1 ) { last; } else { %FILER_LIST = (); goto mns_begin; } } } #end of while } { chdir("$Home/NDATE/") && last; oops "Not able to change location to directory:$Home/NDATE/"; } my $defailt_vals = 'default_params'; $/ = undef; open( DEFAULT, "<$defailt_vals" ) or die "Read:Failed opening $defailt_vals \n"; my $defaults = ; close DEFAULT; $/ = "\n"; if ( ( $defaults =~ /MAIL_TO\s*=\s*default/ ) || ( $defaults =~ /MAIL_TO\s*=\s*$/ ) ) { $MAIL_TO = 1; } else { ($MAIL_TO) = $defaults =~ /MAIL_TO\s*=\s*(\S+)/; } if ( ( $defaults =~ /MAIL_FROM\s*=\s*default/ ) || ( $defaults =~ /MAIL_FROM\s*=\s*$/ ) ) { $MAIL_FROM = 1; } else { ($MAIL_FROM) = $defaults =~ /MAIL_FROM\s*=\s*(\S+)/; } if ( $defaults =~ /EMAIL\s*=\s*(\S+)/ ) { if ( $A{E} ) { $EMAIL = trim( $A{E} ); } else { $EMAIL = 'Y'; } } if ( $MAIL_TO == 1 ) { print BOLD, CYAN, <<'EOD', RESET; Email IDs to send mail is not set Enter IDs using 'comma' as a separator EOD my $email_ids; while (1) { my $correct_email = 0; $email_ids = getchompstrip( "Email To:", "", "" ); alarm $ALARM; $email_ids = trim($email_ids); if ( $email_ids =~ /[=\$\*;\#]/ ) { print "\nEmail ids :Characters = * ; \$ # not allowed\n"; } elsif ( !length($email_ids) ) { print "\nFiler name:Please enter non empty email ids\n"; } else { my @arr2 = split( /,/, $email_ids ); foreach my $email (@arr2) { if ( !( $email =~ /@/ ) ) { $correct_email = 1; oops "Not an valid email id :$email"; } } last if ( $correct_email == 0 ); } ## end else [ if ($email_ids =~ /[=\$\*;\#]/) } ## end while (1) $MAIL_TO = $email_ids; } ## end if ($MAIL_TO =~ /default/) if ( $MAIL_FROM == 1 ) { print BOLD, CYAN, <<'EOD', RESET; Email from is not set Enter IDs using 'comma' as a separator EOD my $email_ids; while (1) { my $correct_email = 0; $email_ids = ""; $email_ids = getchompstrip( "Email From:", "", "" ); alarm $ALARM; $email_ids = trim($email_ids); if ( $email_ids =~ /[=\$\*;\#]/ ) { print "\nEmail ids :Characters = * ; \$ # not allowed\n"; } elsif ( !length($email_ids) ) { print "\nFiler name:Please enter non empty email ids\n"; } else { my @arr2 = split( /,/, $email_ids ); foreach my $email (@arr2) { if ( !( $email =~ /@/ ) ) { $correct_email = 1; oops "Not an valid email id :$email"; } } last if ( $correct_email == 0 ); } ## end else [ if ($email_ids =~ /[=\$\*;\#]/) } ## end while (1) $MAIL_FROM = $email_ids; } ## end if ($MAIL_FROM =~ /default/) my @command; print "\n"; { chdir("$Home/NDATE/TEST_LISTS") && last; oops "Not able to change location to directory:$Home/NDATE/TEST_LISTS"; } if ( $Convert eq 'CMode' ) { print BOLD, CYAN, <<'EOD', RESET; --------------------------------------------------------------- Do you want to add testcases 1> Yes 2> No Default is 2> No --------------------------------------------------------------- EOD my $test_case_add = 0; while (1) { $test_case_add = getchompstrip( "", '', "" ); alarm $ALARM; $test_case_add = trim($test_case_add); if ( $test_case_add =~ /^1$/ ) { print BOLD, GREEN, "\n User wants to add test-cases\n", RESET; $FILER_LIST{$FILER}{'MODE'} = 'MAINTENANCE'; $check_filer_setup = "Y"; # $FILER_LIST{$FILER}{'ADD_TEST_CASE'}='1'; last; } elsif ( $option == 3 ) { $FILER_LIST{$FILER}{'MODE'} = 'MAINTENANCE'; last; } elsif ( ( $test_case_add =~ /^2$/ ) || ( $test_case_add eq '' ) ) { print BOLD, GREEN, "\n User dont want add test-cases\n", RESET; my ( $Mode_option, $MODE_SELECTED ); while (1) { $Mode_option = 1; $Mode_option = trim($Mode_option); alarm $ALARM; if ( $Mode_option =~ /^1$/i ) { $FILER_LIST{$FILER}{'MODE'} = 'FILE_SYSTEM'; last; } elsif ( $Mode_option =~ /^2$/i ) { $FILER_LIST{$FILER}{'MODE'} = 'MAINTENANCE'; last; } elsif ( $Mode_option =~ /^$/i ) { print BOLD, WHITE, "\n Default option is selected i.e Maintenance Mode.\n\n", RESET; $FILER_LIST{$FILER}{'MODE'} = 'FILE_SYSTEM'; last; } else { oops "Please enter correct the value 1/2"; } } last; } else { oops('Selected option must be either 1 or 2'); } } ## end while (1) if ( $test_case_add =~ /^1$/ ) { $ADD_TEST_CASES = 1; my $log_dir = 'SETUP'; my %whole_data = %FILER_LIST; push( @ADD_TEST_CASES, "parallel dirname=$log_dir \{\n" ); foreach ( keys( %{ $whole_data{'filer'} } ) ) { my ( $dirname, $test_config ); if ( $whole_data{'filer'}{$_} =~ /(\S+)\,\S+/ ) { ($dirname) = $whole_data{'filer'}{$_} =~ /(\S+)\,\S+/; } else { $dirname = $_; } if ( $whole_data{convert_to} =~ /CMode/ ) { $test_config = 'E'; } else { $test_config = 'D'; } push( @ADD_TEST_CASES, " serial dirname=$dirname exit_on_errors=\"INSPECT\" \{\n" ); push( @ADD_TEST_CASES, " CONVERT_TO=$whole_data{convert_to}\n" ); push( @ADD_TEST_CASES, " IMAGE=$whole_data{image}{$_}\n" ); push( @ADD_TEST_CASES, " EMAIL=$EMAIL\n" ); push( @ADD_TEST_CASES, " MAIL_TO=$MAIL_TO\n" ); push( @ADD_TEST_CASES, " MAIL_FROM=$MAIL_FROM\n" ); push( @ADD_TEST_CASES, " FILER=$whole_data{'filer'}{$_}\n" ); push( @ADD_TEST_CASES, " TEST_CONFIG=$test_config\n" ); push( @ADD_TEST_CASES, " TEST_SUITE_NAME=$log_dir\n" ); push( @ADD_TEST_CASES, " KERNEL=$kernel\n" ); push( @ADD_TEST_CASES, " MODE=$whole_data{$_}{'MODE'}\n" ); push( @ADD_TEST_CASES, " ADD_TEST_CASE=1\n" ); push( @ADD_TEST_CASES, " $Home/NDATE/SUPPORT_SCRIPTS/CONVERT_SETUP_INSTALL_IMAGE.thpl RUNID=CONVERT_SETUP_INSTALL_IMAGE\n" ); push( @ADD_TEST_CASES, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl" ); push( @ADD_TEST_CASES, " PARSE_ID=CONVERT_SETUP_INSTALL_IMAGE\n" ); push( @ADD_TEST_CASES, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); push( @ADD_TEST_CASES, " $Home/NDATE/SUPPORT_SCRIPTS/nate_logpar_r41e.thpl\n" ); push( @ADD_TEST_CASES, " $Home/NDATE/SUPPORT_SCRIPTS/send_result_to_console.thpl RUNID=send_result_to_console\n" ); push( @ADD_TEST_CASES, " \}\n" ); } push( @ADD_TEST_CASES, "\}\n" ); print BOLD, CYAN, <<'EOD', RESET; --------------------------------------------------------------- Do you want to add ERT or HDD test cases ? Select any of the below options 1> ERT/SSD Durability 2> HDD or SSD Drive Default is 2> i.e HDD or SSD --------------------------------------------------------------- EOD my ( $test_select, $test_type ); while (1) { $test_select = getchompstrip( "", '', "" ); alarm $ALARM; if ( $test_select =~ /^$/ ) { print BOLD, GREEN, "\n Default option is selected 2> HDD\n", RESET; $test_type = 'HDD'; last; } else { $test_select = trim($test_select); if ( $test_select =~ /^1$/ ) { print BOLD, GREEN, "\n User selected option is ERT\n", RESET; $test_type = 'ERT'; last; } elsif ( $test_select =~ /^2$/ ) { print BOLD, GREEN, "\n User selected option is HDD\n", RESET; $test_type = 'HDD'; last; } else { oops('Selected option must be either 1 or 2'); } } } if ( $test_type =~ /HDD/ ) { $result_option = 2; goto TEST_CASE_ADD; } else { $result_option = 6; goto TEST_CASE_ADD_ERT; } } } $runlist = create_mode_runlist( \%FILER_LIST ); push( @command, "$Home/NDATE/NATE/bin/ntest" ); push( @command, "-v none" ); #push(@command, "-nolocaldb"); push( @command, "GNOTE_LOG_ACTIVE=0" ); push( @command, "NATE_CONN_SERVICE=0" ); push( @command, "STEST_FILE=$runlist" ); push( @command, "POSTJOB=$Home/NDATE/SUPPORT_SCRIPTS/post_job.thpl" ); push( @command, "LOGLVL=$loglvl" ); push( @command, "AUTO_PUSH=$AUTO_PUSH" ); push( @command, "RUNPYTH=$runpyth" ); if ( $runpyth == 1 ) { push( @command, "PYTHPATH=$python_path" ); } if ( $enableshell == 1 ) { push( @command, "DISABLESHELL=$enableshell" ); } push( @command, "stest/stest.thpl" ); push( @command, "FILER=FILER" ); push( @command, "RUNID=HDD" ); push( @command, "TEST_MODE=$test_mode" ); push( @command, "EOE=$terminate_on_error" ); push( @command, "TEST_WAIT_TIME=$test_wait_time" ); push( @command, "CHECK_FILER_SETUP=$check_filer_setup" ); push( @command, "CLIENT=CLIENTS" ); my $execmd = ( join( " ", @command ) . " " ); ################################## execute the command ############################# { chdir("$Home/NDATE") && last; oops "Not able to change location to directory: $Home/NDATE"; } open( H_DEFAULT, ">$defailt_vals" ) or die "write:Failed opening $defailt_vals \n"; print( H_DEFAULT "RUNLIST=$runlist\n" ); print( H_DEFAULT "LOGLVL=$loglvl\n" ); print( H_DEFAULT "EOE=$terminate_on_error\n" ); print( H_DEFAULT "LOGDIR=$Home/NDATE/TEST_LOGS\n" ); print( H_DEFAULT "EXECMD=$execmd\n" ); print( H_DEFAULT "TEST_MODE=$test_mode\n" ); print( H_DEFAULT "EMAIL=$EMAIL\n" ); print( H_DEFAULT "EMAIL_MSG=$EMSG\n" ); print( H_DEFAULT "MAIL_TO=$MAIL_TO\n" ); print( H_DEFAULT "MAIL_FROM=$MAIL_FROM\n" ); if ( $logsize == 0 ) { $logsize = 10485760; } print( H_DEFAULT "LOGDIRSIZE=$logsize\n" ); print( H_DEFAULT "PYTHPATH=$python_path\n" ); close H_DEFAULT; print BOLD, CYAN, "\n Command: $execmd \n", RESET; print BOLD, CYAN, <<'EOD', RESET; ------------------------------------------------------------------ Press ENTER to execute the test in BACKGROUND mode OR choose "f" for FOREGROUND run To go back to previous options press "b" ------------------------------------------------------------------ EOD my $state = 0; while (1) { $result = getchompstrip( "", "", "" ); alarm $ALARM; $result = trim($result); if ( $result =~ /(q|Q)/ ) { exit 0; } if ( ( $result eq "b" ) || ( $result eq "B" ) ) { $state = 1; last; } elsif ( $result =~ /(help|HELP|Help)/ ) { print BOLD, GREEN, " If the user pressed cntrl+C accidentally on the client console will terminate the test.\n", " This may happen if the client console frozen.\n", " So execute the test in background mode in case the test execution time is more.\n\n", " To terminate the test suite manually, find the process id associate with the test (ps -au |grep ntest).\n", " Kill the process id (kill -9 process_id). \n", RESET; } elsif ( $result =~ /(b|B)/ ) { $state = 1; last; } elsif ( ( $result eq "f" ) || ( $result eq "F" ) || ( $result eq "" ) ) { check_log_size(); last; } else { oops "Please enter correct value y/n/b/help"; } } ## end while (1) system('clear'); my $background = 1; if ( ( -e "$defailt_vals" ) ) { if ( open( H_LOGFILE, ">$defailt_vals" ) ) { print( H_LOGFILE "RUNLIST=$runlist\n" ); print( H_LOGFILE "LOGLVL=$loglvl\n" ); print( H_LOGFILE "TEST_MODE=$test_mode\n" ); print( H_LOGFILE "EOE=$terminate_on_error\n" ); print( H_LOGFILE "LOGDIR=$Home/NDATE/TEST_LOGS\n" ); print( H_LOGFILE "EXECMD=$execmd\n" ); print( H_LOGFILE "EMAIL=$EMAIL\n" ); print( H_LOGFILE "EMAIL_MSG=$EMSG\n" ); print( H_LOGFILE "EMAIL_TO=$MAIL_TO\n" ); print( H_LOGFILE "EMAIL_FROM=$MAIL_FROM\n" ); if ( $logsize == 0 ) { $logsize = 10485760; } print( H_LOGFILE "LOGDIRSIZE=$logsize\n" ); print( H_LOGFILE "PYTHPATH=$python_path\n" ); close H_LOGFILE; } else { print BOLD, RED, "write:Failed opening $defailt_vals \n", RESET; } } ## end if ((-e "$defailt_vals"... if ( $result =~ /^(Y|y)/ ) { $background = 0; } display_runlist($runlist); execute_cmd( $execmd, $background ); last; } ## Execute last executed command: option 5 if ( $result_option == 5 ) { if ( !($execmd) || ( $execmd =~ /(null|NULL)/ ) ) { print BOLD, RED, "Last executed command not available", RESET; $result_option = 1; next; } my $cmd_runlist; if ( $execmd =~ /STEST_FILE=(.*) POSTJOB(.*)/ ) { $cmd_runlist = $1; } else { print BOLD, RED, "Last executed command not available", RESET; $result_option = 1; next; } if ( !( -e "$Home/NDATE/TEST_LISTS/$cmd_runlist" ) ) { print BOLD, RED, "$cmd_runlist test suite does not exists \n", RESET; $result_option = 1; next; } $cmd_runlist = trim($cmd_runlist); if ( $cmd_runlist =~ /^ERT/ ) { print BOLD, RED, "Last executed command not available", RESET; $result_option = 1; next; } display_runlist($cmd_runlist); if ( $check_filer_setup eq "N" ) { print BOLD, CYAN, "Check filer setup will be skipped\n", RESET; } if ( $test_mode eq "DEV" ) { print BOLD, CYAN, "Test Mode selected : Development\n", RESET; } else { print BOLD, CYAN, "Test Mode selected : Qualification\n", RESET; } print BOLD, CYAN, "Log level selected : $loglvl \n", RESET; if ( $terminate_on_error == 1 ) { print BOLD, CYAN, "Test Exit Mode selected : INSPECT\n", RESET; } elsif ( $terminate_on_error == 2 ) { print BOLD, CYAN, "Test Exit Mode selected : INSPECT,FATAL\n", RESET; } elsif ( $terminate_on_error == 3 ) { print BOLD, CYAN, "Test Exit Mode selected : INSPECT,FATAL,FAIL\n", RESET; } ## Burt 532027 < Updated value w = 4 > if ( $test_wait_time != 3 ) { print BOLD, CYAN, "Individual Test Time reduced to : 10% - Applicable only for few tests \n", RESET if ( $test_wait_time == 1 ); print BOLD, CYAN, "Individual Test Time reduced to : 50% - Applicable only for few tests \n", RESET if ( $test_wait_time == 2 ); print BOLD, CYAN, "Individual Test Time reduced to : 95% - Applicable only for few tests \n", RESET if ( $test_wait_time == 4 ); } ## end if ($test_wait_time !=... ## End of Burt 532027 < Updated value w = 4 > print BOLD, CYAN, "Log path set to : $logdir \n", RESET; if ( ( $EMAIL eq 'y' ) || ( $EMAIL eq 'Y' ) ) { print BOLD, CYAN, "Send email set to : $MAIL_TO \n", RESET; print BOLD, CYAN, "Email from set to : $MAIL_FROM \n", RESET; } if ( $runlist =~ /^ERT/ ) { if ( $test_wait_time == 1 ) { print BOLD, RED, "\nERT tests going to take 1 day.\n", RESET; } elsif ( $test_wait_time == 2 ) { print BOLD, RED, "\nERT tests going to take ($TOTAL_ERT_DAYS/2) days.\n", RESET; } else { print BOLD, RED, "\nERT tests going to take $TOTAL_ERT_DAYS days.\n", RESET; } } ## end if ($runlist =~ /ERT/) print BOLD, CYAN, "\n Command: $execmd \n", RESET; print BOLD, CYAN, <<'EOD', RESET; ------------------------------------------------------------------ Press ENTER to execute the test in BACKGROUND mode OR choose "f" for FOREGROUND run To go back to previous options press "b" ------------------------------------------------------------------ EOD my $state = 0; while (1) { $result = getchompstrip( "", "", "" ); alarm $ALARM; $result = trim($result); if ( $result =~ /(q|Q)/ ) { exit 0; } if ( ( $result eq "b" ) || ( $result eq "B" ) ) { $state = 1; last; } elsif ( $result =~ /(help|HELP|Help)/ ) { print BOLD, GREEN, " If the user pressed cntrl+C accidentally on the client console will terminate the test.\n", " This may happen if the client console frozen.\n", " So execute the test in background mode in case the test execution time is more.\n\n", " To terminate the test suite manually, find the process id associate with the test (ps -au |grep ntest).\n", " Kill the process id (kill -9 process_id). \n", RESET; } elsif ( $result =~ /(b|B)/ ) { $state = 1; last; } elsif ( ( $result eq "f" ) || ( $result eq "F" ) || ( $result eq "" ) ) { check_log_size(); last; } else { oops "Please choose correct option\n b - Back\n f - Foreground\n Press ENTER to Background test execution"; } } ## end while (1) if ( $state == 1 ) { $result_option = 1; $result_option = init_display if ( $test_suite_no == 1 ); next; } system('clear'); my $background = 1; if ( ( -e "$defailt_vals" ) ) { if ( open( H_LOGFILE, ">$defailt_vals" ) ) { print( H_LOGFILE "RUNLIST=$runlist\n" ); print( H_LOGFILE "LOGLVL=$loglvl\n" ); print( H_LOGFILE "TEST_MODE=$test_mode\n" ); print( H_LOGFILE "EOE=$terminate_on_error\n" ); print( H_LOGFILE "LOGDIR=$Home/NDATE/TEST_LOGS\n" ); print( H_LOGFILE "EXECMD=$execmd\n" ); print( H_LOGFILE "EMAIL=$EMAIL\n" ); print( H_LOGFILE "EMAIL_MSG=$EMSG\n" ); print( H_LOGFILE "EMAIL_TO=$MAIL_TO\n" ); print( H_LOGFILE "EMAIL_FROM=$MAIL_FROM\n" ); if ( $logsize == 0 ) { $logsize = 10485760; } print( H_LOGFILE "LOGDIRSIZE=$logsize\n" ); print( H_LOGFILE "PYTHPATH=$python_path\n" ); close H_LOGFILE; } else { print BOLD, RED, "write:Failed opening $defailt_vals \n", RESET; } } ## end if ((-e "$defailt_vals"... if ( $result =~ /^(f|F)/ ) { $background = 0; } execute_cmd( $execmd, $background ); last; } ## end if ($result_option == ... ## Create filer config files: option - 3 if ( $result_option == 3 ) { my $flag = 0; my $back = 0; my $option; while (1) { print BOLD, CYAN, <<'EOD', RESET; ------------------------------------------------------------------------------ Select one of the options to continue 1 > Create/modify filer config files with interactive GUI 3 > Delete filer config files To go back to previous options press "b" Default option '1' ------------------------------------------------------------------------------ EOD #2 > Use legacy filer configuration methods while (1) { $option = getchompstrip( "", "", "" ); $option = trim($option); alarm $ALARM; if ( ( $option =~ /\d/ ) && ( $option <= 3 ) && ( $option >= 1 ) ) { $flag = 1; last; } elsif ( $option eq '' ) { $flag = 1; $option = 1; print BOLD, YELLOW, "\n Default option 1 is selected.\n\n", RESET; last; } elsif ( $option =~ /^(b|B)$/ ) { $back = 1; last; } else { oops "Please enter correct value 1/2/3/b"; } } ## end while (1) if ( $flag == 1 ) { if ( $option == 1 ) { ui_method(); } elsif ( $option == 2 ) { legacy_method(); } elsif ( $option == 3 ) { del_config(); } else { print BOLD, RED, "\n Something not acceptable, so exiting\n\n", RESET; exit; } last; } if ( $back == 1 ) { last; } } if ( $back == 1 ) { $result_option = init_display(); next; } } sub del_config() { del: my @selected_filers = _display_filer('CMode'); @selected_filers = _unique(@selected_filers); my $home = $ENV{HOME}; my $name; my @selected_filers = _display_filer('CMode'); @selected_filers = _unique(@selected_filers); ##array @selected_filers may contain duplications[Filer names] if (@selected_filers) { print BOLD, CYAN, <<'EOD', RESET; ------------------------------------------------------------------------------ Filer configuration files available under $home/NDATE/FILER_INFO are ------------------------------------------------------------------------------ EOD my %sort; foreach my $filer (@selected_filers) { if ( $filer =~ /(\S+)-(\d+)/ ) { $sort{$filer} = $1; } elsif ( $filer =~ /(^\d+)/ ) { $sort{$1} = "num"; } elsif ( $filer =~ /(\S+)/ ) { $sort{$filer} = $1; } } my @sorted; my $value = "num"; my @keys = grep { $sort{$_} eq $value } keys %sort; @keys = sort { $a <=> $b } @keys; foreach my $key (@keys) { push( @sorted, $key ); } my @keys = grep { $sort{$_} ne $value } keys %sort; my @values = grep { $_ ne $value } values %sort; @values = do { my %seen; grep { !$seen{$_}++ } @values; }; @values = sort (@values); foreach my $val (@values) { my @keys = grep { $sort{$_} eq $val } keys %sort; my @sortdone = sort { my ($aa) = $a =~ /.*-(.+)/; my ($bb) = $b =~ /.*-(.+)/; $aa <=> $bb; } @keys; foreach my $key (@sortdone) { push( @sorted, $key ); } } =head foreach ( sort { if ( ( ( $a =~ /^\D+\d+/ ) && ( $b =~ /^\D+\d+/ ) ) ) { my ($t1) = $a =~ /(\D+)/; my ($t2) = $b =~ /(\D+)/; if ( $t1 =~ /^$t2$/ ) { my ($tst1) = $a =~ /(\d+)/; my ($tst2) = $b =~ /(\d+)/; return $tst1 <=> $tst2; } else { return $a cmp $b; } } else { return $a cmp $b; } } @selected_filers ) =cut foreach (@sorted) { print BOLD, MAGENTA, "$_\n"; } } else { print BOLD, RED, <<'EOD', RESET; ------------------------------------------------------------------------------ No filer configuration files present exiting from the tool ------------------------------------------------------------------------------ EOD exit; } # del: print BOLD, CYAN, <<'EOD', RESET; ------------------------------------------------------------------------------ Enter the filer name you wish to delete ------------------------------------------------------------------------------ EOD while (1) { $name = getchompstrip( "", "", "" ); $name = trim($name); alarm $ALARM; if ( $name eq '' ) { oops "Please enter correct value "; } elsif ( $name eq 'help' ) { display_help(); } else { print BOLD, GREEN, "\n You have selected the filer name $name\n\n", RESET; last; } } ## end while (1) my $found = 0; foreach (@selected_filers) { if ( $_ =~ /^$name$/ ) { $found = 1; last; } } if ( $found == 0 ) { print BOLD, RED, "\nNo filer information found for the filer $name \n\n", RESET; print BOLD, RED, "\n Please Re-enter the name again \n\n", RESET; goto del; # create_filer_info_ui($name); } else { my ( $sev_mode, $cmode ); my $filer_br = "$name" . "_BR"; my $filer_c = "$name" . "_C"; # if (-e "$home/NDATE/FILER_INFO/$filer_br"){ # print BOLD, CYAN," 7Mode configuration file found for the filer $name\n\n",RESET; # $sev_mode=1; # } if ( -e "$home/NDATE/FILER_INFO/$filer_c" ) { print BOLD, CYAN, " CMode configuration file found for the filer $name\n\n", RESET; $cmode = 1; } if ( ($cmode) && ($sev_mode) ) { print BOLD, YELLOW, "Both CMode and 7Mode configuration file found for the filer $name\n\n", RESET; print BOLD, CYAN, <<'EOD', RESET; ------------------------------------------------------------------------------ Please choose any of below option 1> To delete 7Mode configuration file 2> To delete CMode configuration file 3> To delete both 7Mode and CMode configuration files Default option is 3> ------------------------------------------------------------------------------ EOD while (1) { my $choose = getchompstrip( "", "", "" ); $choose = trim($choose); alarm $ALARM; if ( ( $choose eq '' ) || ( $choose =~ /^3$/ ) ) { print BOLD, GREEN, "\n You have chosen the default option \n", RESET; print BOLD, GREEN, "\n Deleting both 7Mode and CMode configuration files of the filer $name\n\n", RESET; system("sudo rm -rf $home/NDATE/FILER_INFO/$filer_br"); system("sudo rm -rf $home/NDATE/FILER_INFO/$filer_c"); system("sudo rm -rf $home/NDATE/FILER_INFO/$name"); } elsif ( $choose =~ /^1$/ ) { print BOLD, GREEN, "\n You have chosen to delete 7Mode configuration file of the filer $name\n\n", RESET; print BOLD, YELLOW, "\n 7Mode configuration file is deleted\n\n", RESET; system("sudo rm -rf $home/NDATE/FILER_INFO/$filer_br"); system("sudo rm -rf $home/NDATE/FILER_INFO/$name"); } elsif ( $choose =~ /^2$/i ) { print BOLD, GREEN, "\n You have chosen to delete CMODE configuration file of the filer $name\n\n", RESET; print BOLD, YELLOW, "\n CMode configuration file is deleted\n\n", RESET; system("sudo rm -rf $home/NDATE/FILER_INFO/$filer_c"); system("sudo rm -rf $home/NDATE/FILER_INFO/$name"); } else { print BOLD, GREEN, "\n Please enter the correct value\n", RESET; next; } print BOLD, CYAN, <<'EOD', RESET; ------------------------------------------------------------------------------ Would you like to delete one more configuration file Please enter 'y' to delete 'n' to exit ------------------------------------------------------------------------------ EOD while (1) { my $repeat = getchompstrip( "", "", "" ); $repeat = trim($repeat); alarm $ALARM; if ( $repeat =~ /^y$/i ) { print BOLD, GREEN, "\n You have selected to delete one more configuration file\n", RESET; goto del; } elsif ( $repeat =~ /^n$/i ) { print BOLD, GREEN, "\n You have selected $repeat, going to main menu\n", RESET; # exit; last; } else { oops "Please enter correct value either y or n"; } } last; } ## end while (1) } elsif ($sev_mode) { print BOLD, GREEN, "Do you want to delete 7Mode configuration file for the filer $name\n\n", RESET; print BOLD, CYAN, <<'EOD', RESET; ------------------------------------------------------------------------------ Please enter 'y' to delete else Please enter 'n' to skip ------------------------------------------------------------------------------ EOD while (1) { my $choose = getchompstrip( "", "", "" ); $choose = trim($choose); alarm $ALARM; if ( $choose =~ /y/ ) { print BOLD, GREEN, "\n You have selected to delete configuration file\n", RESET; system("sudo rm -rf $home/NDATE/FILER_INFO/$filer_br"); system("sudo rm -rf $home/NDATE/FILER_INFO/$name"); print BOLD, YELLOW, "\n Filer $name :: 7Mode configuration file is deleted\n\n", RESET; # last; } elsif ( $choose =~ /n/i ) { print BOLD, GREEN, "\n Not deleting the configuration file\n", RESET; # last; # exit; } else { print BOLD, GREEN, "\n Please enter the correct value y/n \n", RESET; next; } print BOLD, CYAN, <<'EOD', RESET; ------------------------------------------------------------------------------ Would you like to delete one more configuration file Please enter 'y' to delete 'n' to exit ------------------------------------------------------------------------------ EOD while (1) { my $repeat = getchompstrip( "", "", "" ); $repeat = trim($repeat); alarm $ALARM; if ( $repeat =~ /^y$/i ) { print BOLD, GREEN, "\n You have chosen to delete one more configuration file\n", RESET; goto del; } elsif ( $repeat =~ /^n$/i ) { print BOLD, GREEN, "\n You have selected $repeat, going to main menu\n", RESET; # exit; last; } else { oops "Please enter correct value either y or n"; next; } } last; } } elsif ($cmode) { print BOLD, GREEN, "Do you want to delete CMode configuration file for the filer $name\n\n", RESET; print BOLD, CYAN, <<'EOD', RESET; ------------------------------------------------------------------------------ Please enter 'y' to delete else Please enter 'n' to skip ------------------------------------------------------------------------------ EOD while (1) { my $choose = getchompstrip( "", "", "" ); $choose = trim($choose); alarm $ALARM; if ( $choose =~ /y/ ) { print BOLD, GREEN, "\n You have selected to delete configuration file\n", RESET; system("sudo rm -rf $home/NDATE/FILER_INFO/$filer_c"); system("sudo rm -rf $home/NDATE/FILER_INFO/$name"); print BOLD, YELLOW, "\nFiler $name :: CMode configuration file is deleted\n\n", RESET; # last; } elsif ( $choose =~ /n/i ) { print BOLD, GREEN, "\n Not deleting the configuration file\n", RESET; # exit; } else { print BOLD, GREEN, "\n Please enter the correct value y/n \n", RESET; next; } print BOLD, CYAN, <<'EOD', RESET; ------------------------------------------------------------------------------ Would you like to delete one more configuration file Please enter 'y' to delete 'n' to exit ------------------------------------------------------------------------------ EOD while (1) { my $repeat = getchompstrip( "", "", "" ); $repeat = trim($repeat); alarm $ALARM; if ( $repeat =~ /^y$/i ) { goto del; } elsif ( $repeat =~ /^n$/i ) { print BOLD, GREEN, "\n You have selected $repeat, going to main menu\n", RESET; # exit; last; } else { oops "Please enter correct value either y or n"; next; } } last; } } } } sub ui_method() { edition: my $name; my @selected_filers = _display_filer('CMode'); @selected_filers = _unique(@selected_filers); ##array @selected_filers may contain duplications[Filer names] my $home = $ENV{HOME}; if (@selected_filers) { print BOLD, CYAN, <<'EOD', RESET; ------------------------------------------------------------------------------ Filer configuration files available under $home/NDATE/FILER_INFO are ------------------------------------------------------------------------------ EOD my %sort; foreach my $filer (@selected_filers) { if ( $filer =~ /(\S+)-(\d+)/ ) { $sort{$filer} = $1; } elsif ( $filer =~ /(^\d+)/ ) { $sort{$1} = "num"; } elsif ( $filer =~ /(\S+)/ ) { $sort{$filer} = $1; } } my @sorted; my $value = "num"; my @keys = grep { $sort{$_} eq $value } keys %sort; @keys = sort { $a <=> $b } @keys; foreach my $key (@keys) { push( @sorted, $key ); } my @keys = grep { $sort{$_} ne $value } keys %sort; my @values = grep { $_ ne $value } values %sort; @values = do { my %seen; grep { !$seen{$_}++ } @values; }; @values = sort (@values); foreach my $val (@values) { my @keys = grep { $sort{$_} eq $val } keys %sort; my @sortdone = sort { my ($aa) = $a =~ /.*-(.+)/; my ($bb) = $b =~ /.*-(.+)/; $aa <=> $bb; } @keys; foreach my $key (@sortdone) { push( @sorted, $key ); } } =head foreach ( sort { if ( ( ( $a =~ /^\D+\d+/ ) && ( $b =~ /^\D+\d+/ ) ) ) { my ($t1) = $a =~ /(\D+)/; my ($t2) = $b =~ /(\D+)/; if ( $t1 =~ /^$t2$/ ) { my ($tst1) = $a =~ /(\d+)/; my ($tst2) = $b =~ /(\d+)/; return $tst1 <=> $tst2; } else { return $a cmp $b; } } else { return $a cmp $b; } } @selected_filers ) =cut foreach (@sorted) { print BOLD, MAGENTA, "$_\n"; } } else { print BOLD, RED, <<'EOD', RESET; ------------------------------------------------------------------------------ No filer configuration files present ------------------------------------------------------------------------------ EOD } #edition: print BOLD, CYAN, <<'EOD', RESET; ------------------------------------------------------------------------------ Enter the filer name you wish to create or modify ------------------------------------------------------------------------------ EOD while (1) { $name = getchompstrip( "", "", "" ); $name = trim($name); alarm $ALARM; if ( $name eq '' ) { oops "Please enter correct value "; } elsif ( $name eq 'help' ) { display_help(); } else { print BOLD, GREEN, "\n You have selected the filer name $name\n\n", RESET; last; } } ## end while (1) my $found = 0; foreach (@selected_filers) { if ( $_ =~ /^$name$/ ) { $found = 1; last; } } if ( $found == 0 ) { print BOLD, RED, "\nNo filer information found for the filer $name \n\n", RESET; my $home = $ENV{HOME}; # print BOLD, GREEN,"Would you like to create 7Mode or CMode\n\n",RESET; print BOLD, CYAN, <<'EOD', RESET; ------------------------------------------------------------------------------ Would you like to create CMode configuration file Please enter 'y' to create 'n' to exit ------------------------------------------------------------------------------ EOD my $option = 'CMode'; while (1) { my $select = getchompstrip( "", "", "" ); $select = trim($select); alarm $ALARM; if ( $select eq '' ) { oops "Please enter correct value "; } elsif ( $select =~ /^y$/i ) { print BOLD, GREEN, "\n You have selected to create CMode configuration file\n", RESET; $option = 'CMode'; create_filer_info_ui( $name, $option ); last; } elsif ( $select =~ /^n$/i ) { last; } else { print BOLD, GREEN, "\n Please enter the correct value\n", RESET; } } #create_filer_info_ui($name,$option); } else { my ( $sev_mode, $cmode ); my $filer_br = "$name" . "_BR"; my $filer_c = "$name" . "_C"; # if (-e "$home/NDATE/FILER_INFO/$filer_br"){ # print BOLD, CYAN," 7Mode configuration file found for the filer $name\n\n",RESET; # $sev_mode=1; # } if ( -e "$home/NDATE/FILER_INFO/$filer_c" ) { print BOLD, CYAN, " CMode configuration file found for the filer $name\n\n", RESET; $cmode = 1; } if ( ($cmode) && ($sev_mode) ) { print BOLD, YELLOW, "Both CMode and 7Mode configuration file found for the filer $name\n\n", RESET; print BOLD, CYAN, <<'EOD', RESET; ------------------------------------------------------------------------------ Please enter '7' to edit 7Mode Please enter 'c' to edit CMode ------------------------------------------------------------------------------ EOD while (1) { my $choose = getchompstrip( "", "", "" ); $choose = trim($choose); alarm $ALARM; if ( $choose eq '' ) { oops "Please enter correct value "; } elsif ( $choose =~ /7/ ) { print BOLD, GREEN, "\n You have selected to edit 7Mode configuration file\n", RESET; edit_filer_info_ui( $name, '7Mode' ); # last; } elsif ( $choose =~ /c/i ) { print BOLD, GREEN, "\n You have selected to edit CMODE configuration file\n", RESET; edit_filer_info_ui( $name, 'CMode' ); # last; } else { print BOLD, GREEN, "\n Please enter the correct value\n", RESET; next; } print BOLD, YELLOW, <<'EOD', RESET; ============================================================================ Would you like to edit or Create one more configuration file Please enter 'y' to create/edit 'n' to exit ============================================================================ EOD while (1) { my $repeat = getchompstrip( "", "", "" ); $repeat = trim($repeat); alarm $ALARM; if ( $repeat =~ /^y$/i ) { goto edition; } elsif ( $repeat =~ /^n$/i ) { print BOLD, GREEN, "\n You have selected $repeat\n", RESET; # exit; last; } else { oops "Please enter correct value either y or n"; } } last; } ## end while (1) } elsif ($sev_mode) { print BOLD, YELLOW, <<'EOD', RESET; Do you want to edit 7Mode configuration file for the filer OR Do you want to Create CMode configuration file for the filer EOD print BOLD, CYAN, <<'EOD', RESET; ------------------------------------------------------------------------------ Please Select any of the given option 1> To edit the 7Mode Configuration file 2> To Create CMode Configuration file Please enter 'n' to skip ------------------------------------------------------------------------------ EOD while (1) { my $choose = getchompstrip( "", "", "" ); $choose = trim($choose); alarm $ALARM; if ( $choose =~ /^1$/ ) { print BOLD, GREEN, "\n You have selected to edit configuration file\n", RESET; edit_filer_info_ui( $name, '7Mode' ); # last; } elsif ( $choose =~ /n/i ) { print BOLD, GREEN, "\n Not editing the configuration file\n", RESET; # exit; } elsif ( $choose =~ /^2$/i ) { print BOLD, GREEN, "\n Creating CMode configuration file\n", RESET; create_filer_info_ui( $name, 'CMode' ); # exit; } else { print BOLD, GREEN, "\n Please enter the correct value 1/2/n \n", RESET; next; } print BOLD, YELLOW, <<'EOD', RESET; ============================================================================ Would you like to edit or Create one more configuration file Please enter 'y' to create/edit 'n' to exit ============================================================================ EOD while (1) { my $repeat = getchompstrip( "", "", "" ); $repeat = trim($repeat); alarm $ALARM; if ( $repeat =~ /^y$/i ) { goto edition; } elsif ( $repeat =~ /^n$/i ) { print BOLD, GREEN, "\n You have selected $repeat, going to main menu\n", RESET; # exit; last; } else { oops "Please enter correct value either y or n"; next; } } last; } } elsif ($cmode) { # print BOLD, GREEN,"Do you want to edit CMode configuration file for the filer $name \n\n",RESET; # print BOLD, YELLOW,"Or do you want to Create 7Mode configuration file for the filer $name \n\n",RESET; print BOLD, CYAN, <<'EOD', RESET; ------------------------------------------------------------------------------ Do you want to edit CMode configuration file for the filer Please enter 'y' to edit 'n' to exit ------------------------------------------------------------------------------ EOD while (1) { my $choose = getchompstrip( "", "", "" ); $choose = trim($choose); alarm $ALARM; if ( $choose =~ /^y$/i ) { print BOLD, GREEN, "\n You have selected to edit configuration file\n", RESET; edit_filer_info_ui( $name, 'CMode' ); # last; } elsif ( $choose =~ /n/i ) { print BOLD, GREEN, "\n Not editing the configuration file\n", RESET; last; } else { print BOLD, GREEN, "\n Please enter the correct value y/n \n", RESET; next; } print BOLD, YELLOW, <<'EOD', RESET; ============================================================================ Would you like to edit or Create one more configuration file Please enter 'y' to create/edit 'n' to exit ============================================================================ EOD while (1) { my $repeat = getchompstrip( "", "", "" ); $repeat = trim($repeat); alarm $ALARM; if ( $repeat =~ /^y$/i ) { goto edition; } elsif ( $repeat =~ /^n$/i ) { print BOLD, GREEN, "\n You have selected $repeat, going to main menu\n", RESET; # exit; last; } else { oops "Please enter correct value either y or n"; next; } } last; } } else { print BOLD, RED, "No Configuration file found with extension _BR or _C for the filer $name \n\n", RESET; exit; } } } sub create_filer_info_ui($$) { my ( $filer, $option ) = @_; my $home = $ENV{HOME}; $FILER_DETAILS_CMODE = "$home/NDATE/FILER_INFO/FILER_DETAILS_CMODE"; system("sudo rm -rf $home/NDATE/FILER_INFO/FILER_DETAILS_CMODE"); if ( $option =~ /CMode/i ) { repeat: print BOLD, CYAN, "\n Please enter the details, save and quit after the completion\n", RESET; # my $cmode_data ="############################################################## my $cmode_data = "############################################################## ##Fields Mentioned with * are mandatory ########################################################## #######HOST DETAILS####### FILER Name* = $filer Ex: hdd-111 Partner Filer Name* = Ex: hdd-112 Location of filer = [This parameter is optional] Ex: svl MODEL* = FAS3070 Ex: FAS3070 #######NODE MANAGEMENT DETAILS####### Node Management Ip* = Ex: 172.23.1.3 Node Management Net MASK* = Ex: 255.255.255.0 Node Management Port* = Ex: e0M Node Management Gateway* = Ex: 172.23.1.1 MTU* = 9000 Ex: 9000 or 1500 ######CLUSTER MANAGAMENT DETAILS####### Cluster Management Port* = Ex: e0a Cluster Management Ip* = Ex:172.23.2.10 Cluster Management Net MASK* = Ex: 255.255.255.0 Cluster Management Gateway* = Ex: 172.23.2.1 ######CLUSTER DETAILS####### Cluster Port* = Ex: e0b Cluster Ip* = Ex: 172.23.3.11 Cluster Net MASK* = Ex: 255.255.255.0 Cluster Gateway* = Ex: 172.23.3.1 ######LICENSE DETAILS####### Base License Key* = GINBJXTZGYSEBGAAAAAAAAAAAAAA Ex: GINBJXTZGYSEBGAAAAAAAAAAAAAA Secondary Base License Key = ETYYFLXUQUMADFAAAAAAAAAAAAAAA Ex: ETYYFLXUQUMADFAAAAAAAAAAAAAAA #######CLUSTER NAME####### Cluster Name* = Ex: Clus_hdd_111_112 #######DEFAULT PARAMETERS####### Terminal Server Ip* = Ex: 10.23.9.3 Terminal Server port* = Ex: 6006 Password* = Ex: netapp1! DNS Ip = [This parameter is optional] Ex: 10.32.33.3 #######BMC LOGIN DETAILS ####### BMC_user = admin BMC_password = netapp1! "; # my $FILER_DETAILS_CMODE = "$home/NDATE/FILER_INFO/FILER_DETAILS_CMODE"; open( FH, ">$FILER_DETAILS_CMODE" ); print FH $cmode_data; close FH; create_cmode_file(); print BOLD, YELLOW, <<'EOD', RESET; ------------------------------------------------------------------------------ Would you like to edit or Create one more configuration file Please enter 'y' to create/edit 'n' to exit ------------------------------------------------------------------------------ EOD while (1) { my $repeat = getchompstrip( "", "", "" ); $repeat = trim($repeat); alarm $ALARM; if ( $repeat =~ /^y$/i ) { print BOLD, GREEN, "\n You have chosen to create one more configuration file\n", RESET; print BOLD, CYAN, <<'EOD', RESET; ------------------------------------------------------------------------------ Please enter the details of the filer ------------------------------------------------------------------------------ EOD # goto repeat; goto edition; } elsif ( $repeat =~ /^n$/i ) { print BOLD, GREEN, "\n You have selected $repeat, going to main menu\n", RESET; # exit; last; } else { oops "Please enter correct value either y or n"; } } ## end while (1) } else { print BOLD, CYAN, "\n Please enter the details, Save and quit after the completion\n", RESET; my $seven_mode_data = "############################################################## ##Fields Mentioned with * are mandatory ########################################################## #######HOST DETAILS####### FILER Name* = $filer Ex: hdd-100 Partner Filer Name* = Ex: hdd-101 MODEL* = Ex: FAS3200 FILER Ip* = Ex: 172.10.3.99 FILER Net MASK* = Ex: 255.255.240.0 IFC Port* = [If filer converted from CMode to 7Mode IFC port will same as Node Management Port] Ex: e0a FILER Gateway Ip* = Ex: 172.10.3.1 Terminal Server Ip* = Ex : 172.10.30.2 Terminal Server port* = Ex: 6006 Password* = Ex: netapp1! DNS Ip = [This parameter is optional] Ex: 10.32.33.3 VERSION = [This parameter is optional] Ex: RrollingrockN_121111_2045 "; my $home = $ENV{HOME}; $FILER_DETAILS_7MODE = "$home/NDATE/FILER_INFO/FILER_DETAILS_7MODE"; open( FH, ">$FILER_DETAILS_7MODE" ); print FH $seven_mode_data; close FH; create_7mode_file(); print BOLD, YELLOW, <<'EOD', RESET; ------------------------------------------------------------------------------ Would you like to edit or Create one more configuration file Please enter 'y' to create/edit 'n' to exit ------------------------------------------------------------------------------ EOD while (1) { my $repeat = getchompstrip( "", "", "" ); $repeat = trim($repeat); alarm $ALARM; if ( $repeat =~ /^y$/i ) { print BOLD, GREEN, "\n You have chosen to create one more configuration file\n", RESET; print BOLD, CYAN, <<'EOD', RESET; ------------------------------------------------------------------------------ Please enter the details of the filer ------------------------------------------------------------------------------ EOD # goto repeat; goto edition; } elsif ( $repeat =~ /^n$/i ) { print BOLD, GREEN, "\n You have selected $repeat, going to main menu\n", RESET; # exit; last; } else { oops "Please enter correct value either y or n"; } } ## end while (1) } } sub create_7mode_file() { my $fine = 1; while ($fine) { system("sudo vi $FILER_DETAILS_7MODE"); open( FH1, "$FILER_DETAILS_7MODE" ); my @sev_mode_data = ; my %sev_details; my %defect_sev; close FH1; foreach my $var (@sev_mode_data) { chomp($var); $var =~ s/^\s+|\s+$//g; if ( $var =~ /FILER Name\*\s*\=\s*(.*)/ ) { $sev_details{'FILER Name'} = $1; next; } if ( $var =~ /Partner Filer Name\*\s*\=\s*(.*)/ ) { $sev_details{'Partner Filer Name'} = $1; next; } if ( $var =~ /MODEL\*\s*\=\s*(.*)/ ) { $sev_details{'MODEL'} = $1; next; } if ( $var =~ /FILER Ip\*\s*\=\s*(.*)/ ) { $sev_details{'FILER Ip'} = $1; next; } if ( $var =~ /FILER Net MASK\*\s*\=\s*(.*)/i ) { $sev_details{'FILER Net MASK'} = $1; next; } if ( $var =~ /IFC Port\*\s*\=\s*(.*)/ ) { $sev_details{'IFC Port'} = $1; next; } if ( $var =~ /FILER Gateway Ip\*\s*\=\s*(.*)/ ) { $sev_details{'FILER Gateway Ip'} = $1; next; } if ( $var =~ /Terminal Server Ip\*\s*\=\s*(.*)/ ) { $sev_details{'Terminal Server Ip'} = $1; next; } if ( $var =~ /DNS Ip\s*\=\s*(.*)/ ) { $sev_details{'DNS Ip'} = $1; next; } if ( $var =~ /VERSION\s*\=\s*(.*)/ ) { $sev_details{'VERSION'} = $1; next; } if ( $var =~ /Terminal Server port\*\s*\=\s*(.*)/ ) { $sev_details{'Terminal Server port'} = $1; next; } if ( $var =~ /Password\*\s*\=\s*(.*)/ ) { $sev_details{'Password'} = $1; next; } } foreach my $key ( keys %sev_details ) { $sev_details{$key} =~ s/^\s+|\s+$//g; if ( $key =~ /FILER Name|Terminal Server port|IFC Port|MODEL|Partner Filer Name|Password/ ) { if ( $sev_details{$key} eq '' ) { $defect_sev{$key} = $sev_details{$key}; } next; } if ( $key =~ /FILER Ip|FILER Net MASK|FILER Gateway Ip|Terminal Server Ip/ ) { if ( $sev_details{$key} !~ /^\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b$/ ) { $defect_sev{$key} = $sev_details{$key}; } next; } if ( $key =~ /DNS|VERSION/i ) { if ( $key =~ /DNS/i ) { if ( $sev_details{$key} ) { if ( $sev_details{$key} !~ /^\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b$/ ) { $defect_sev{$key} = $sev_details{$key}; } } } if ( $key =~ /VERSION/i ) { if ( $sev_details{$key} eq '' ) { $sev_details{$key} = 'NULL'; } } next; } } if ( keys %defect_sev ) { #print Dumper(\%defect_sev); print BOLD, YELLOW, <<'EOD', RESET; ------------------------------------------------------------------------------ Some of the parameter values entered are incorrect ------------------------------------------------------------------------------ EOD foreach my $key ( keys %defect_sev ) { print BOLD, RED, "\nThe Parameter $key has improper value i.e ", RESET; print BOLD, YELLOW, "$defect_sev{$key}\n", RESET; } print BOLD, CYAN, "\nPlease enter to continue to edit\n", RESET; while (1) { my $option = getchompstrip( "", "", "" ); $option = trim($option); alarm $ALARM; if ( ( $option eq '' ) || ( $option =~ /./ ) ) { system("clear"); last; } } ## end while (1) next; } else { system("clear"); print BOLD, YELLOW, <<'EOD', RESET; ------------------------------------------------------------------------------ Please verify the details which you have entered ############################################################## ##Fields Mentioned with * are mandatory ########################################################## EOD print BOLD, YELLOW, "\n\t\t\t#######HOST DETAILS#######\n", RESET; print BOLD, CYAN, "\t\tFILER Name*\t\t= $sev_details{'FILER Name'} Partner Filer Name*\t= $sev_details{'Partner Filer Name'} MODEL\t\t\t= $sev_details{'MODEL'} \n", RESET; print BOLD, GREEN, "\t\tFILER Ip*\t\t= $sev_details{'FILER Ip'} FILER Net MASK*\t\t= $sev_details{'FILER Net MASK'} IFC Port*\t\t= $sev_details{'IFC Port'} FILER Gateway Ip*\t= $sev_details{'FILER Gateway Ip'} \n", RESET; print BOLD, CYAN, "\t\tTerminal Server Ip*\t= $sev_details{'Terminal Server Ip'} Terminal Server port*\t= $sev_details{'Terminal Server port'} Password*\t\t= $sev_details{'Password'} \n", RESET; print BOLD, CYAN, "\t\tDNS Ip*\t\t\t= $sev_details{'DNS Ip'} VERSION*\t\t= $sev_details{'VERSION'} \n", RESET; print BOLD, CYAN, <<'EOD', RESET; ------------------------------------------------------------------------------ Please enter 'f' to finish, 'e' to edit ------------------------------------------------------------------------------ EOD my ($edit_option); while (1) { $edit_option = getchompstrip( "", "", "" ); $edit_option = trim($edit_option); alarm $ALARM; if ( ( $edit_option eq '' ) || ( $edit_option !~ /^(f|e)$/i ) ) { oops "Please enter correct value either f or e"; } else { print BOLD, GREEN, "\n Configuration details are saved for the $sev_details{'FILER Name'}\n\n", RESET; last; } } if ( $edit_option =~ /f/i ) { $fine = 0; #print"\n create file and exit\n"; create_config_file_7mode( \%sev_details ); last; } elsif ( $edit_option =~ /e/i ) { next; } } } } sub create_config_file_7mode($) { my %seven_detail = %{ $_[0] }; my $push = "hostname=$seven_detail{'FILER Name'} hosttype=filer-cfe part_host=$seven_detail{'Partner Filer Name'} NETBOOT=0 VERSION=$seven_detail{'VERSION'} default_password=$seven_detail{'Password'} default_ip=$seven_detail{'FILER Ip'} GATEWAY=$seven_detail{'FILER Gateway Ip'} IFC=$seven_detail{'IFC Port'} default_ip_gx=$seven_detail{'FILER Ip'} MEDIATYPE=auto TIMEZONE=GMT conn console {conntype=serial;connhost=$seven_detail{'Terminal Server Ip'};connport=$seven_detail{'Terminal Server port'};password=$seven_detail{'Password'}} conn rsh {conntype=rsh-socket;connhost=$seven_detail{'FILER Ip'};password=$seven_detail{'Password'}} conn rsh-socket {conntype=rsh-socket;connhost=$seven_detail{'FILER Ip'};password=$seven_detail{'Password'}} conn 7-system {prompt_password=$seven_detail{'Password'}} MODEL=$seven_detail{'MODEL'} MASK=$seven_detail{'FILER Net MASK'} "; if ( $seven_detail{'DNS Ip'} ) { $push = $push . "DNS_ip=" . $seven_detail{'DNS Ip'}; } my $Home = $ENV{HOME}; my $file = $seven_detail{'FILER Name'} . "_BR"; #print "push b $push\n"; system("sudo rm -rf $Home/NDATE/FILER_INFO/$file"); system("touch $Home/NDATE/FILER_INFO/$file"); system("chmod 777 $Home/NDATE/FILER_INFO/$file"); open( FH, ">$Home/NDATE/FILER_INFO/$file" ) || die "cannot write file $file"; print FH $push; close FH; system("sudo rm -rf $Home/NDATE/FILER_INFO/$seven_detail{'FILER Name'}"); system("sudo touch $Home/NDATE/FILER_INFO/$seven_detail{'FILER Name'}"); system("sudo chmod 777 $Home/NDATE/FILER_INFO/$seven_detail{'FILER Name'}"); system("sudo cp -rf $Home/NDATE/FILER_INFO/$file $Home/NDATE/FILER_INFO/$seven_detail{'FILER Name'}"); } sub create_cmode_file() { my $fine = 1; while ($fine) { system("sudo vi $FILER_DETAILS_CMODE"); # $/=undef; open( FH1, "$FILER_DETAILS_CMODE" ); my @cmode_data = ; # my $var = ; my %cmode_details; my %defect; # $/="\n"; close FH1; foreach my $var (@cmode_data) { # print "\n $var"; chomp($var); $var =~ s/^(\s+|\s+)$//g; if ( $var =~ /FILER Name\*\s*\=\s*(.*)/ ) { $cmode_details{'FILER Name'} = $1; $cmode_details{'FILER Name'} =~ s/^(\")$//; } if ( $var =~ /Partner Filer Name\*\s*\=\s*(.*)/ ) { $cmode_details{'Partner Filer Name'} = $1; } if ( $var =~ /Location of filer\s*\=\s*(.*)/i ) { $cmode_details{'Location of filer'} = $1; } if ( $var =~ /Node Management IP\*\s*\=\s*(.*)/i ) { $cmode_details{'Node Management Ip'} = $1; } if ( $var =~ /Terminal Server Ip\*\s*\=\s*(.*)/i ) { $cmode_details{'Terminal Server Ip'} = $1; } if ( $var =~ /Terminal Server port\*\s*\=\s*(.*)/i ) { $cmode_details{'Terminal Server port'} = $1; } if ( $var =~ /Node Management Net MASK\*\s*\=\s*(.*)/i ) { $cmode_details{'Node Management Net MASK'} = $1; } if ( $var =~ /Node Management Port\*\s*\=\s*(.*)/i ) { $cmode_details{'Node Management Port'} = $1; } if ( $var =~ /Node Management Gateway\*\s*\=\s*(.*)/i ) { $cmode_details{'Node Management Gateway'} = $1; } if ( $var =~ /MTU\*\s*\=\s*(.*)/i ) { $cmode_details{'MTU'} = $1; } if ( $var =~ /Cluster Management Port\*\s*\=\s*(.*)/i ) { $cmode_details{'Cluster Management Port'} = $1; } if ( $var =~ /Cluster Management Ip\*\s*\=\s*(.*)/i ) { $cmode_details{'Cluster Management Ip'} = $1; } if ( $var =~ /Cluster Management Net Mask\*\s*\=\s*(.*)/i ) { $cmode_details{'Cluster Management Net MASK'} = $1; } if ( $var =~ /Cluster Management Gateway\*\s*\=\s*(.*)/i ) { $cmode_details{'Cluster Management Gateway'} = $1; } if ( $var =~ /Cluster Port\*\s*\=\s*(.*)/i ) { $cmode_details{'Cluster Port'} = $1; } if ( $var =~ /Cluster Ip\*\s*\=\s*(.*)/i ) { $cmode_details{'Cluster Ip'} = $1; } if ( $var =~ /Cluster Net MASK\*\s*\=\s*(.*)/i ) { $cmode_details{'Cluster Net MASK'} = $1; } if ( $var =~ /Cluster Gateway\*\s*\=\s*(.*)/i ) { $cmode_details{'Cluster Gateway'} = $1; } if ( $var =~ /Base License Key\*\s*\=\s*(.*)/i ) { $cmode_details{'Base License Key'} = $1; } if ( $var =~ /Secondary Base License Key\s*\=\s*(.*)/i ) { $cmode_details{'Secondary Base License Key'} = $1; } if ( $var =~ /Cluster Name\*\s*\=\s*(.*)/i ) { $cmode_details{'Cluster Name'} = $1; } if ( $var =~ /Password\*\s*\=\s*(.*)/i ) { $cmode_details{'Password'} = $1; } if ( $var =~ /DNS Ip\s*\=\s*(.*)/i ) { $cmode_details{'DNS_Ip'} = $1; } if ( $var =~ /MODEL\*\s*\=\s*(.*)/i ) { $cmode_details{'MODEL'} = $1; } if ( $var =~ /BMC_user\s*\=\s*(\S+)/ ) { $cmode_details{'BMC_user'} = $1; } if ( $var =~ /BMC_password\s*\=\s*(\S+)/ ) { $cmode_details{'BMC_password'} = $1; } } foreach my $key ( keys %cmode_details ) { $cmode_details{$key} =~ s/^\s+|\s+$//g; if ( $key =~ /Secondary Base License Key|Location of filer|DNS_Ip/ ) { ##NOT mandatory if ( $key =~ /DNS/i ) { if ( ( $cmode_details{$key} ) && ( $cmode_details{$key} !~ /NULL/i ) ) { if ( $cmode_details{$key} !~ /^\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b$/ ) { $defect{$key} = $cmode_details{$key}; } } else { $cmode_details{$key} = 'NULL'; } next; } if ( $cmode_details{$key} eq '' ) { $cmode_details{$key} = 'NULL'; } next; } if ( ( $key =~ /Node|Cluster|Terminal/i ) && ( $key !~ /Port|Cluster Name|Server/i ) ) { ##mandatory fields ALL IP's if ( $cmode_details{$key} !~ /^\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b$/ ) { $defect{$key} = $cmode_details{$key}; } next; } if ( $key =~ /Terminal Server Ip/i ) { ##mandatory fields ALL IP's if ( $cmode_details{$key} !~ /^\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b$/ ) { $defect{$key} = $cmode_details{$key}; } next; } if ( ( $key =~ /Base License Key|Name|Password|Port|/i ) && ( $key !~ /^Secondary Base License Key$/i ) ) { ##mandatory fields if ( $cmode_details{$key} eq '' ) { $defect{$key} = $cmode_details{$key}; } next; } if ( $key =~ /^MODEL$/i ) { ##mandatory fields print "Inside Model\n"; if ( $cmode_details{$key} eq '' ) { $defect{$key} = $cmode_details{$key}; } next; } if ( ( $key =~ /^MTU$/i ) && ( $cmode_details{$key} !~ /^(\d+)$/g ) ) { ##mandatory fields $defect{$key} = $cmode_details{$key}; next; } } #print Dumper(\%cmode_details); if ( keys %defect ) { #print Dumper(\%defect); print BOLD, YELLOW, <<'EOD', RESET; ------------------------------------------------------------------------------ Some of the parameter values are entered incorrect ------------------------------------------------------------------------------ EOD foreach my $key ( keys %defect ) { print BOLD, RED, "\nThe Parameter $key has improper value i.e ", RESET; print BOLD, YELLOW, "$defect{$key}\n", RESET; } print BOLD, CYAN, "\nPlease enter to continue to edit\n", RESET; while (1) { my $option = getchompstrip( "", "", "" ); $option = trim($option); alarm $ALARM; if ( ( $option eq '' ) || ( $option =~ /./ ) ) { last; } } ## end while (1) next; } else { $cmode_details{'FILER Name'} =~ s/"//g; system("clear"); print BOLD, YELLOW, <<'EOD', RESET; ------------------------------------------------------------------------------ Please verify the details which you have entered ############################################################## ##Fields Mentioned with * are mandatory ########################################################## EOD print BOLD, YELLOW, "\n\t\t\t#######HOST DETAILS#######\n", RESET; print BOLD, CYAN, "\t\tFILER Name* = $cmode_details{'FILER Name'} Partner Filer Name* = $cmode_details{'Partner Filer Name'} Location of filer = $cmode_details{'Location of filer'} \n", RESET; print BOLD, YELLOW, "\n\t\t\t#######NODE MANAGEMENT DETAILS#######\n", RESET; print BOLD, CYAN, "\t\tNode Management Ip* = $cmode_details{'Node Management Ip'} Node Management Net MASK* = $cmode_details{'Node Management Net MASK'} Node Management Port* = $cmode_details{'Node Management Port'} Node Management Gateway* = $cmode_details{'Node Management Gateway'} MTU* = $cmode_details{'MTU'} \n", RESET; print BOLD, YELLOW, "\n\t\t\t######CLUSTER MANAGAMENT DETAILS#######\n", RESET; print BOLD, CYAN, "\t\tCluster Management Port* = $cmode_details{'Cluster Management Port'} Cluster Management Ip* = $cmode_details{'Cluster Management Ip'} Cluster Management Net MASK*= $cmode_details{'Cluster Management Net MASK'} Cluster Management Gateway* = $cmode_details{'Cluster Management Gateway'} \n", RESET; print BOLD, YELLOW, "\n\t\t\t######CLUSTER DETAILS#######\n", RESET; print BOLD, CYAN, "\t\tCluster Port* = $cmode_details{'Cluster Port'} Cluster Ip* = $cmode_details{'Cluster Ip'} Cluster Net MASK* = $cmode_details{'Cluster Net MASK'} Cluster Gateway* = $cmode_details{'Cluster Gateway'} \n", RESET; print BOLD, YELLOW, "\n\t\t\t#######LICENSE DETAILS#######\n", RESET; print BOLD, CYAN, "\t\tBase License Key* = $cmode_details{'Base License Key'} Secondary Base License Key = $cmode_details{'Secondary Base License Key'} \n", RESET; print BOLD, YELLOW, "\n\t\t\t#######CLUSTER NAME#######\n", RESET; print BOLD, CYAN, "\t\tCluster Name* = $cmode_details{'Cluster Name'} \n", RESET; print BOLD, YELLOW, "\n\t\t\t#######DEFAULT PARAMETERS#######\n", RESET; print BOLD, CYAN, "\t\tPassword* = $cmode_details{'Password'} DNS Ip = $cmode_details{'DNS_Ip'} Terminal Server Ip = $cmode_details{'Terminal Server Ip'} Terminal Server port = $cmode_details{'Terminal Server port'} MODEL = $cmode_details{'MODEL'} \n", RESET; print BOLD, YELLOW, "\n\t\t\t#######BMC LOGIN DETAILSS#######\n", RESET; print BOLD, CYAN, "\t\tBMC_user* = $cmode_details{'BMC_user'} BMC_password* = $cmode_details{'BMC_password'} \n", RESET; print BOLD, CYAN, <<'EOD', RESET; ------------------------------------------------------------------------------ Please enter 'f' to finish, 'e' to edit again ------------------------------------------------------------------------------ EOD my ($edit_option); while (1) { $edit_option = getchompstrip( "", "", "" ); $edit_option = trim($edit_option); alarm $ALARM; if ( ( $edit_option eq '' ) || ( $edit_option !~ /^(f|e)$/i ) ) { oops "Please enter correct value either f or e"; } else { print BOLD, GREEN, "\n You have selected $edit_option\n", RESET; last; } } if ( $edit_option =~ /f/i ) { $fine = 0; print BOLD, GREEN, "\nConfiguration details are saved for the filer $cmode_details{'FILER Name'}\n\n", RESET; sleep(0.5); create_config_file_cmode( \%cmode_details ); last; } elsif ( $edit_option =~ /e/i ) { next; } # print Dumper(\%defect); ##print banner with all the values ##ask to continue if no go to while ##if yes copy to _C file } } } sub edit_filer_info_ui($$) { my ( $filer, $mode ) = @_; my $Home = $ENV{HOME}; if ( $mode =~ /CMode/i ) { $filer = $filer . "_C"; } else { $filer = $filer . "_BR"; } if ( $mode =~ /CMode/i ) { open( FH, "$Home/NDATE/FILER_INFO/$filer" ) || die "Filer $filer configuration file cannot be found "; my %details_cmode; my @details = ; foreach (@details) { if ( ( $_ =~ /hostname\s*\=\s*\"(\S+)\"/ ) || ( $_ =~ /hostname\s*\=\s*(\S+)/ ) ) { $details_cmode{'FILER Name'} = $1; $details_cmode{'FILER Name'} =~ s/^("+)$//g; } if ( $_ =~ /part_host\s*\=\s*(\S+)/ ) { $details_cmode{'Partner Filer Name'} = $1; } if ( $_ =~ /^MGMT_IP$\s*\=\s*(\S+)/ ) { $details_cmode{'Node Management Ip'} = $1; } if ( $_ =~ /^MGMT_MASK$\s*\=\s*(\S+)/ ) { $details_cmode{'Node Management Net MASK'} = $1; } if ( $_ =~ /MGMT_MTU\s*\=\s*(\S+)/ ) { $details_cmode{'MTU'} = $1; } if ( $_ =~ /^MGMT_PORT$\s*\=\s*(\S+)/ ) { $details_cmode{'Node Management Port'} = $1; } if ( $_ =~ /^MGMT_GATEWAY$\s*\=\s*(\S+)/ ) { $details_cmode{'Node Management Gateway'} = $1; } if ( $_ =~ /CLUSTER_PORT1\s*\=\s*(\S+)/ ) { $details_cmode{'Cluster Port'} = $1; } if ( $_ =~ /CLUSTER_IP1\s*\=\s*(\S+)/ ) { $details_cmode{'Cluster Ip'} = $1; } if ( $_ =~ /CLUSTER_MASK1\s*\=\s*(\S+)/ ) { $details_cmode{'Cluster net MASK'} = $1; } if ( $_ =~ /CLUSTER_GATEWAY1\s*\=\s*(\S+)/ ) { $details_cmode{'Cluster Gateway'} = $1; } if ( $_ =~ /CLUSTER_MGMT_PORT\s*\=\s*(\S+)/ ) { $details_cmode{'Cluster Management Port'} = $1; } if ( $_ =~ /CLUSTER_MGMT_IP\s*\=\s*(\S+)/ ) { $details_cmode{'Cluster Management Ip'} = $1; } if ( $_ =~ /CLUSTER_MGMT_MASK\s*\=\s*(\S+)/ ) { $details_cmode{'Cluster Management Net MASK'} = $1; } if ( $_ =~ /CLUSTER_MGMT_GATEWAY\s*\=\s*(\S+)/ ) { $details_cmode{'Cluster Management Gateway'} = $1; } if ( $_ =~ /^BASE_LICENSE$\s*\=\s*(\S+)/ ) { $details_cmode{'Base License Key'} = $1; } if ( $_ =~ /SECONDARY_BASE_LICENSE\s*\=\s*(\S+)/ ) { $details_cmode{'Secondary Base License Key'} = $1; } if ( $_ =~ /CLUSTER_NAME\s*\=\s*(\S+)/ ) { $details_cmode{'Cluster Name'} = $1; } if ( $_ =~ /DNS_ip\s*\=\s*(\S+)/ ) { $details_cmode{'DNS_Ip'} = $1; } if ( $_ =~ /SITE\s*\=\s*(\S+)/ ) { $details_cmode{'SITE'} = $1; } if ( $_ =~ /MODEL\s*\=\s*(\S+)/i ) { $details_cmode{'MODEL'} = $1; } if ( $_ =~ /conn\s*console\s*{conntype=serial\;connhost=(\S+)\;connport=(\S+)\;/ ) { $details_cmode{'Terminal Server Ip'} = $1; $details_cmode{'Terminal Server port'} = $2; } if ( $_ =~ /default_password\s*\=\s*(\S+)/ ) { $details_cmode{'Password'} = $1; } if ( $_ =~ /BMC_user\s*\=\s*(\S+)/ ) { $details_cmode{'BMC_user'} = $1; } if ( $_ =~ /BMC_password\s*\=\s*(\S+)/ ) { $details_cmode{'BMC_password'} = $1; } } my $cmode_data_edit = "############################################################## ##Fields Mentioned with * are mandatory ########################################################## #######HOST DETAILS####### FILER Name* = $details_cmode{'FILER Name'} Partner Filer Name* = $details_cmode{'Partner Filer Name'} Location of filer = $details_cmode{'SITE'} MODEL* = $details_cmode{'MODEL'} #######NODE MANAGEMENT DETAILS####### Node Management Ip* = $details_cmode{'Node Management Ip'} Node Management Net MASK* = $details_cmode{'Node Management Net MASK'} Node Management Port* = $details_cmode{'Node Management Port'} Node Management Gateway* = $details_cmode{'Node Management Gateway'} MTU* = $details_cmode{'MTU'} ######CLUSTER MANAGAMENT DETAILS####### Cluster Management Port* = $details_cmode{'Cluster Management Port'} Cluster Management Ip* = $details_cmode{'Cluster Management Ip'} Cluster Management Net MASK* = $details_cmode{'Cluster Management Net MASK'} Cluster Management Gateway* = $details_cmode{'Cluster Management Gateway'} ######CLUSTER DETAILS####### Cluster Port* = $details_cmode{'Cluster Port'} Cluster Ip* = $details_cmode{'Cluster Ip'} Cluster Net MASK* = $details_cmode{'Cluster net MASK'} Cluster Gateway* = $details_cmode{'Cluster Gateway'} #######LICENSE DETAILS####### Base License Key* = $details_cmode{'Base License Key'} Secondary Base License Key = $details_cmode{'Secondary Base License Key'} #######CLUSTER NAME####### Cluster Name* = $details_cmode{'Cluster Name'} #######DEFAULT PARAMETERS####### Terminal Server Ip* = $details_cmode{'Terminal Server Ip'} Terminal Server port* = $details_cmode{'Terminal Server port'} Password* = $details_cmode{'Password'} DNS Ip = $details_cmode{'DNS_Ip'} #######BMC LOGIN DETAILS####### BMC_user = $details_cmode{'BMC_user'} BMC_password = $details_cmode{'BMC_password'} "; my $home = $ENV{HOME}; $FILER_DETAILS_CMODE = "$home/NDATE/FILER_INFO/FILER_DETAILS_CMODE"; open( FH, ">$FILER_DETAILS_CMODE" ); print FH $cmode_data_edit; close FH; create_cmode_file(); # create_config_file_cmode(\%details_cmode); } else { open( FH, "$Home/NDATE/FILER_INFO/$filer" ) || die "Filer $filer configuration file cannot be found "; my %details_sev_mode; my @details = ; foreach (@details) { if ( $_ =~ /hostname\s*\=\s*(\S+)/ ) { $details_sev_mode{'FILER Name'} = $1; next; } if ( $_ =~ /part_host\s*\=\s*(\S+)/ ) { $details_sev_mode{'Partner Filer Name'} = $1; next; } if ( $_ =~ /MODEL\s*\=\s*(\S+)/ ) { $details_sev_mode{'MODEL'} = $1; next; } if ( $_ =~ /VERSION\s*\=\s*(\S+)/ ) { $details_sev_mode{'VERSION'} = $1; next; } if ( $_ =~ /default_password\s*\=\s*(\S+)/ ) { $details_sev_mode{'Password'} = $1; next; } if ( $_ =~ /default_ip\s*\=\s*(\S+)/ ) { $details_sev_mode{'FILER Ip'} = $1; next; } if ( $_ =~ /GATEWAY\s*\=\s*(\S+)/ ) { $details_sev_mode{'FILER Gateway Ip'} = $1; next; } if ( $_ =~ /IFC\s*\=\s*(\S+)/ ) { $details_sev_mode{'IFC Port'} = $1; next; } if ( $_ =~ /MASK\s*\=\s*(\S+)/ ) { $details_sev_mode{'FILER Net MASK'} = $1; next; } if ( $_ =~ /conn\s*console\s*{conntype=serial\;connhost=(\S+)\;connport=(\S+)\;/ ) { $details_sev_mode{'Terminal Server Ip'} = $1; $details_sev_mode{'Terminal Server port'} = $2; next; } if ( $_ =~ /DNS_ip\s*\=\s*(\S+)/i ) { $details_sev_mode{'DNS Ip'} = $1; next; } } close FH; my $sev_mode_data_edit = "############################################################## ##Fields Mentioned with * are mandatory ########################################################## #######HOST DETAILS####### FILER Name* =$details_sev_mode{'FILER Name'} Partner Filer Name* =$details_sev_mode{'Partner Filer Name'} MODEL* =$details_sev_mode{'MODEL'} FILER Ip* =$details_sev_mode{'FILER Ip'} FILER Net MASK* =$details_sev_mode{'FILER Net MASK'} IFC Port* =$details_sev_mode{'IFC Port'} FILER Gateway Ip* =$details_sev_mode{'FILER Gateway Ip'} Terminal Server Ip* =$details_sev_mode{'Terminal Server Ip'} Terminal Server port* =$details_sev_mode{'Terminal Server port'} Password* =$details_sev_mode{'Password'} DNS Ip =$details_sev_mode{'DNS Ip'} VERSION =$details_sev_mode{'VERSION'} "; my $home = $ENV{HOME}; $FILER_DETAILS_7MODE = "$home/NDATE/FILER_INFO/FILER_DETAILS_7MODE"; open( FH, ">$FILER_DETAILS_7MODE" ); print FH $sev_mode_data_edit; close FH; create_7mode_file(); } } sub create_config_file_cmode($) { my %details = %{ $_[0] }; $details{'FILER Name'} =~ s/^("+)$//g; my $push = "hostname\=\"$details{'FILER Name'}\" part_host=$details{'Partner Filer Name'} NETBOOT=0 VERSION= hosttype=filer-ng-cfe SITE=$details{'Location of filer'} FILER=$details{'FILER Name'} SFOPAIR=\"$details{'FILER Name'}\,$details{'Partner Filer Name'}\" LOCATION=NDATE MGMT_IP=$details{'Node Management Ip'} MGMT_MASK=$details{'Node Management Net MASK'} MGMT_PORT=$details{'Node Management Port'} MGMT_GATEWAY=$details{'Node Management Gateway'} MGMT_MTU=$details{'MTU'} CLUSTER_PORT1=$details{'Cluster Port'} CLUSTER_IP1=$details{'Cluster Ip'} CLUSTER_MASK1=$details{'Cluster Net MASK'} CLUSTER_GATEWAY1=$details{'Cluster Gateway'} CLUSTER_MTU1=$details{'MTU'} CLUSTER_MGMT_PORT=$details{'Cluster Management Port'} CLUSTER_MGMT_IP=$details{'Cluster Management Ip'} CLUSTER_MGMT_MASK=$details{'Cluster Management Net MASK'} CLUSTER_MGMT_GATEWAY=$details{'Cluster Management Gateway'} net inet4_sp { nettype=sp netmask=$details{'Cluster Net MASK'} gateway=$details{'Cluster Gateway'} family=inet4 address=$details{'Cluster Ip'} } BMC_user=$details{'BMC_user'} BMC_password=$details{'BMC_password'} BASE_LICENSE=$details{'Base License Key'} SECONDARY_BASE_LICENSE=$details{'Secondary Base License Key'} CLUSTER_NAME=$details{'Cluster Name'} default_password=$details{'Password'} default_ip=$details{'Node Management Ip'} DNS_ip=$details{'DNS_Ip'} TIMEZONE=GMT conn pm_cons {conntype=pm_cons} conn console {conntype=serial\;connhost=$details{'Terminal Server Ip'}\;connport=$details{'Terminal Server port'}\;password=$details{'Password'}} conn rsh {conntype=rsh-socket;connhost=$details{'Node Management Ip'};timeout=3600;password=$details{'Password'}} conn rsh-socket {conntype=rsh-socket;connhost=$details{'Node Management Ip'};timeout=3600;password=$details{'Password'}} conn ssh {conntype=ssh-persist;connhost=$details{'Node Management Ip'};username=admin;password=$details{'Password'}} conn c-login {conntype=ssh-persist;connhost=$details{'Node Management Ip'};username=admin;password=$details{'Password'}} conn c-system {conntype=ssh-persist;connhost=$details{'Node Management Ip'};username=admin;password=$details{'Password'}} conn c-system {initial_command=\"set -privilege test;systemshell -node local\"} conn c-system {prompt_password=$details{'Password'}} conn cli {prompt_password=$details{'Password'}} MODEL=$details{'MODEL'} CONFIGS=\'$details{'MODEL'}\' IFC=$details{'Node Management Port'} PATH="; my $Home = $ENV{HOME}; my $file = $details{'FILER Name'} . "_C"; #print "push b $push\n"; system("sudo rm -rf $Home/NDATE/FILER_INFO/$file"); system("sudo touch $Home/NDATE/FILER_INFO/$file"); system("sudo chmod 777 $Home/NDATE/FILER_INFO/$file"); open( FH, ">$Home/NDATE/FILER_INFO/$file" ) || die "cannot write file"; print FH $push; close FH; system("sudo rm -rf $Home/NDATE/FILER_INFO/$details{'FILER Name'}"); system("sudo touch $Home/NDATE/FILER_INFO/$details{'FILER Name'}"); system("sudo chmod 777 $Home/NDATE/FILER_INFO/$details{'FILER Name'}"); system("sudo cp -rf $Home/NDATE/FILER_INFO/$file $Home/NDATE/FILER_INFO/$details{'FILER Name'}"); } sub legacy_method () { my $CLIENT = hostname(); my @clienta = split( /\./, $CLIENT ); $CLIENT = $clienta[0]; { chdir("$Home/NDATE/FILER_INFO") && last; oops "Not able to change location to directory:$Home/NDATE/FILER_INFO"; } my @host_names = ; if ( !(@host_names) ) { print BOLD, RED, "No configuration file is available. Please create a filer configuration file to run a test suite.\n\n", RESET; } my $flag = 0; # my $option; #$C_7_option = 1; #Default selection is for 7 mode $C_7_option = 2; #Default selection is for C mode =head ## Execution selection for 7 mode and C mode while (1) { print BOLD, BLUE, <<'EOD', RESET; -------------------------------------------------------------- Which type of setup would you like to be executed Select one of the options to continue 1 > 7 mode. 2 > C mode. Note: Default option is 7 mode. -------------------------------------------------------------- EOD while (1) { $option = getchompstrip( "", "", "" ); $option = trim($option); alarm $ALARM; if ( ( $option =~ /\d/ ) && ( $option <= 2 ) && ( $option >= 1 ) ) { $flag = 1; last; } elsif ( $option eq '' ) { $flag = 1; $option = 1; print BOLD, WHITE, "\nYou selected 7 mode.\n\n", RESET; last; } else { oops "Please enter correct value 1/2"; } } ## end while (1) if ( $flag == 1 ) { last; } } ## end while (1) =cut #$C_7_option = $option; #$option_TYPE = '7_mode'; #Default selection type is 7 mode # Set Type of the Filer if ( $C_7_option == 2 ) { $option_TYPE = 'C_mode'; #Selection type is C mode } if ( ( $option_TYPE == '7_mode' ) || ( $option_TYPE == 'C_mode' ) ) { $FILER_TYPE = 'BR'; # FILER_TYPE for 4.0 is BR only $fc_bm_option = 2; } ## Check at least one host file ## Create at least one host file before creating the test suit { chdir("$Home/NDATE/FILER_INFO") && last; oops "Not able to change location to directory:$Home/NDATE/FILER_INFO"; } my @hostlist = <*>; my $hostlist_size = @hostlist; my $config_file = 0; if ( $option_TYPE == '7_mode' ) { foreach my $hostlist (@hostlist) { if ( $hostlist !~ /_BR/ ) { $config_file = 1; } else { $config_file = 0; last; } } } else { foreach my $hostlist (@hostlist) { if ( $hostlist !~ /_C/ ) { $config_file = 1; } else { $config_file = 0; last; } } } if ( $build_type == 1 ) { if ( $hostlist_size <= 2 ) { $config_file = 1; } } if ( $build_type == 2 ) { if ( $hostlist_size < 2 ) { $config_file = 1; } } if ( $config_file == 1 ) { print BOLD, YELLOW, "\n\n Please create at least one config file before creating the test suite\n\n", RESET; print BOLD, CYAN, <<'EOD', RESET; -------------------------------------------------------------- Select one of the options to continue 1 > Create filer config files in VI editor mode 2 > Create filer config files through command line interface Enter 'help' for more information ---------------------------------------------------------------- EOD my $model = 0; my $exit_mode = 0; while (1) { $model = getchompstrip( "", "", "" ); $model = trim($model); if ( $model =~ /(q|Q|b|B|N|n)/ ) { $exit_mode = 1; last; } alarm $ALARM; if ( $model =~ /(help|HELP|Help)/ ) { print BOLD, GREEN, <<'EOD', RESET; Filer configuration files are used to store relevant characteristics of each filer. In order to run tests we need to describe each filer in filer configuration file. Filer configuration consists of: EOD print BOLD, GREEN, "\n Filer model:Filer MODEL\n", " Enter 1 for FAS2000, 2 for FAS3000 and 3 for FAS6000, 4 for FAS960 series\n\n", " Filer id : Name of the filer. It also shows the same name when\n", " the filer is up in file system mode\n\n", " Filer ip : Filer ip address\n\n", " Terminal serv ip : Terminal server ip address\n\n", " Port no : Terminal server port no, connect the filer in serial mode\n", " using terminal server ip address and port no\n\n", " Gateway ip : Gateway ip address mentioned in the filer\n\n", " Boot file : Name of the kernel file, FILER boots at the time of reboot/boot\n\n", RESET; if ( $fc_bm_option == 1 ) { print BOLD, GREEN, " TFTP serv ip: TFTP server ip address, location of the kernel files (/tftpboot)\n\n", RESET; } else { print BOLD, GREEN, " Version : Name of the Filer version\n\n", RESET; } } elsif ( ( ( $model =~ /^\d+$/ ) && ( ( $model <= 2 ) && ( $model >= 1 ) ) ) ) { last; } else { oops "Please enter correct value 1-2/help/y/n/b/q"; } } my $state = 0; if ( $model == 1 ) { while (1) { print BOLD, CYAN, "Please save the file after modification\n", RESET; sleep 3; if ( $option_TYPE == '7_mode' ) { system("vi $Home/NDATE/FILER_INFO/FILERS_LIST"); } else { system("vi $Home/NDATE/FILER_INFO/FILERS_LIST_C"); } create_hosts_from_list(); print BOLD, CYAN, <<'EOD', RESET; Would you like to continue to create filer config files ? (y/n/b) .............................................................. EOD my $flag = "n"; while (1) { $flag = getchompstrip( "", "", "" ); alarm $ALARM; if ( ( $flag eq "b" ) || ( $flag eq "B" ) ) { $state = 1; last; } elsif ( ( $flag eq "y" ) || ( $flag eq "Y" ) || ( $flag eq "n" ) || ( $flag eq "N" ) ) { last; } else { oops "Please enter correct value y/n/b"; } } ## end while (1) last if ( $flag =~ /^(N|n|b|B)/ ); } ## end while (1) if ( $state == 1 ) { $result_option = 3; next; } } elsif ( $model == 2 ) { while (1) { my $crt_host = create_hosts(); if ( $crt_host == 0 ) { $result_option = 3; last; } print BOLD, CYAN, <<'EOD', RESET; Would you like to continue to create filer config files ? (y/n/b) .............................................................. EOD my $flag = "n"; while (1) { $flag = getchompstrip( "", "", "" ); alarm $ALARM; if ( ( $flag eq "b" ) || ( $flag eq "B" ) ) { $state = 1; last; } elsif ( ( $flag eq "y" ) || ( $flag eq "Y" ) || ( $flag eq "n" ) || ( $flag eq "N" ) ) { last; } else { oops "Please enter correct value y/n/b"; } } ## end while (1) last if ( $flag =~ /^(N|n|b|B)/ ); } ## end while (1) if ( $state == 1 ) { $result_option = 3; next; } } } else { print BOLD, CYAN, "Filer configuration files are available under $Home/NDATE/FILER_INFO folder\n", RESET; print BOLD, CYAN, <<'EOD', RESET; -------------------------------------------------------------- Select one of the options to continue 1 > Create filer config files in VI editor mode 2 > Create filer config files through command line interface 3 > Update filer config files in VI editor mode 4 > Update filer config files through command line interface 5 > Delete filer config files Enter 'help' for more information ---------------------------------------------------------------- EOD my $model = 0; my $exit_mode = 0; while (1) { $model = getchompstrip( "", "", "" ); $model = trim($model); if ( $model =~ /(q|Q|b|B|N|n)/ ) { $exit_mode = 1; last; } alarm $ALARM; if ( $model =~ /(help|HELP|Help)/ ) { print BOLD, GREEN, <<'EOD', RESET; Filer configuration files are used to store relevant characteristics of each filer. In order to run tests we need to describe each filer in filer configuration file. Filer configuration consists of: EOD print BOLD, GREEN, "\n Filer model:Filer MODEL\n", " Enter 1 for FAS2000, 2 for FAS3000 and 3 for FAS6000, 4 for FAS960 series\n\n", " Filer id : Name of the filer. It also shows the same name when\n", " the filer is up in file system mode\n\n", " Filer ip : Filer ip address\n\n", " Terminal serv ip : Terminal server ip address\n\n", " Port no : Terminal server port no, connect the filer in serial mode\n", " using terminal server ip address and port no\n\n", " Gateway ip : Gateway ip address mentioned in the filer\n\n", " Boot file : Name of the kernel file, FILER boots at the time of reboot/boot\n\n", RESET; if ( $fc_bm_option == 1 ) { print BOLD, GREEN, " TFTP serv ip: TFTP server ip address, location of the kernel files (/tftpboot)\n\n", RESET; } else { print BOLD, GREEN, " Version : Name of the Filer version\n\n", RESET; } } elsif ( ( ( $model =~ /^\d+$/ ) && ( ( $model <= 5 ) && ( $model >= 1 ) ) ) ) { last; } else { oops "Please enter correct value 1-4/help/y/n/b/q"; } } ## end while (1) if ( $exit_mode == 1 ) { if ( $model =~ /(q|Q)/ ) { exit 0; } elsif ( $model =~ /(b|B)/ ) { $result_option = init_display(); next; } elsif ( $model =~ /(N|n)/ ) { $result_option = 2; next; } } ## end if ($exit_mode == 1) my $state = 0; if ( $model == 1 ) { while (1) { print BOLD, CYAN, "Please save the file after modification\n", RESET; sleep 3; if ( $option_TYPE == '7_mode' ) { system("vi $Home/NDATE/FILER_INFO/FILERS_LIST"); create_hosts_from_list(); } if ( $option_TYPE == 'C_mode' ) { system("vi $Home/NDATE/FILER_INFO/FILERS_LIST_C"); create_hosts_from_list(); } print BOLD, CYAN, <<'EOD', RESET; Would you like to continue to create filer config files ? (y/n/b) .............................................................. EOD my $flag = "n"; while (1) { $flag = getchompstrip( "", "", "" ); alarm $ALARM; if ( ( $flag eq "b" ) || ( $flag eq "B" ) ) { $state = 1; last; } elsif ( ( $flag eq "y" ) || ( $flag eq "Y" ) || ( $flag eq "n" ) || ( $flag eq "N" ) ) { last; } else { oops "Please enter correct value y/n/b"; } } ## end while (1) last if ( $flag =~ /^(N|n|b|B)/ ); } ## end while (1) if ( $state == 1 ) { $result_option = 3; next; } } elsif ( $model == 2 ) { while (1) { my $crt_host = create_hosts(); if ( $crt_host == 0 ) { $result_option = 3; last; } print BOLD, CYAN, <<'EOD', RESET; Would you like to continue to create filer config files ? (y/n/b) .............................................................. EOD my $flag = "n"; while (1) { $flag = getchompstrip( "", "", "" ); alarm $ALARM; if ( ( $flag eq "b" ) || ( $flag eq "B" ) ) { $state = 1; last; } elsif ( ( $flag eq "y" ) || ( $flag eq "Y" ) || ( $flag eq "n" ) || ( $flag eq "N" ) ) { last; } else { oops "Please enter correct value y/n/b"; } } ## end while (1) last if ( $flag =~ /^(N|n|b|B)/ ); } ## end while (1) if ( $state == 1 ) { $result_option = 3; next; } } elsif ( $model == 3 ) { my @host_files; while (1) { print BOLD, CYAN, "Will open a file in vi editor \n", RESET; sleep 3; update_host_vi(); # Update all files once again @host_files = <*>; display_ir_br_filers(@host_files); print BOLD, CYAN, <<'EOD', RESET; Would you like to continue to update filer config files ? (y/n/b) .............................................................. EOD my $flag = "n"; while (1) { $flag = getchompstrip( "", "", "" ); alarm $ALARM; if ( ( $flag eq "b" ) || ( $flag eq "B" ) ) { $state = 1; last; } elsif ( ( $flag eq "y" ) || ( $flag eq "Y" ) || ( $flag eq "n" ) || ( $flag eq "N" ) ) { last; } else { oops "Please enter correct value y/n/b"; } } ## end while (1) last if ( $flag =~ /^(N|n|b|B)/ ); } ## end while (1) if ( $state == 1 ) { $result_option = 3; next; } } elsif ( $model == 4 ) { while (1) { my @host_files; my %filer_exits; my %ic_or_br_filers; @host_files = <*>; %ic_or_br_filers = display_ir_br_filers(@host_files); print BOLD, CYAN, "\nFollowing host files exist for $FILER_TYPE\n"; print BOLD, CYAN, "Note: Select the filers as it appears below.\n"; foreach $_ ( keys %ic_or_br_filers ) { #if (($_ =~ /_IC/) || ($_ =~ /_BR/)) { $filer_exits{$_} = "BR", print BOLD, WHITE, "$_\n", if ( ( $ic_or_br_filers{$_} eq "BR" ) && ( $fc_bm_option == 2 ) ); $filer_exits{$_} = "IC", print BOLD, WHITE, "$_\n", if ( ( $ic_or_br_filers{$_} eq "IC" ) && ( $fc_bm_option == 1 ) ); $filer_exits{$_} = "C", print BOLD, WHITE, "$_\n", if ( ( $ic_or_br_filers{$_} eq "C" ) && ( $fc_bm_option == 2 ) ); #} } ## end foreach $_ (keys %ic_or_br_filers) print BOLD, CYAN, <<'EOD', RESET; Please select the filer config file you like to update --------------------------------------------------------------------------- Example : FilerA EOD my $filer_name = ""; while (1) { $filer_name = getchompstrip( "", '', "" ); $filer_name = trim($filer_name); alarm $ALARM; if ( $filer_name =~ /[=\$\*,;\#]/ ) { oops('Characters "=" "$" "*" "," ";" "$" "#" not allowed'); } elsif ( !length($filer_name) ) { oops('filer name must be nonempty'); } elsif ( !( -e $filer_name ) ) { print "******* filer file $filer_name does not exists ****** \n"; } elsif ( !( exists( $filer_exits{$filer_name} ) ) ) { print "******* filer file $filer_name does not exists ****** \n"; print "******* filer you selected is different type(Ironcity/Boilermaker) ****** \n"; } else { last; } } ## end while (1) update_host($filer_name); # Update all files once again display_ir_br_filers(@host_files); print BOLD, CYAN, <<'EOD', RESET; Would you like to continue to update filer config files ? (y/n/b) .............................................................. EOD my $flag = "n"; while (1) { $flag = getchompstrip( "", "", "" ); alarm $ALARM; if ( ( $flag eq "b" ) || ( $flag eq "B" ) ) { $state = 1; last; } elsif ( ( $flag eq "y" ) || ( $flag eq "Y" ) || ( $flag eq "n" ) || ( $flag eq "N" ) ) { last; } else { oops "Please enter correct value y/n/b"; } } ## end while (1) last if ( $flag =~ /^(N|n|B|b)/ ); } ## end while (1) if ( $state == 1 ) { $result_option = 3; next; } } elsif ( $model == 5 ) { my %filer_types; my %filer_exits; my $host_name; while (1) { print BOLD, CYAN, <<'EOD', RESET; Please select the filer config file you like to delete --------------------------------------------------------------------------- Example : FilerA EOD @host_names = ; if ( @host_names > 1 ) { # Distinguish filers basing on the IC/BR %filer_types = display_ir_br_filers(@host_names); #@host_names = sort {$a <=> $b} keys %filer_types; print "The following filer config files are available:\n\n"; if ( $fc_bm_option == 1 ) { print BOLD, "\nIroncity filers:\n"; foreach $host_name ( sort { $a <=> $b } @host_names ) { if ( $host_name =~ /_IC/ ) { $filer_exits{$host_name} = $host_name, print( BOLD, GREEN, "$host_name\n", RESET ) if ( ( $host_name ne $CLIENT ) && !( $host_name =~ /FILERS_LIST/ ) ); } } } elsif ( $option_TYPE == '7_mode' ) { print BOLD, "\nBoilermaker filers:\n"; foreach $host_name ( sort { $a <=> $b } @host_names ) { if ( $host_name =~ /_BR/ ) { $filer_exits{$host_name} = "BR", print( BOLD, GREEN, "$host_name \n", RESET ) if ( ( $host_name ne $CLIENT ) && !( $host_name =~ /FILERS_LIST/ ) ); } } } else { my @hostfile_C; print BOLD, "\nC_Mode filers:\n"; foreach $host_name ( sort { $a <=> $b } @host_names ) { if ( $host_name =~ /_C/ ) { $filer_exits{$host_name} = "C", print( BOLD, GREEN, "$host_name \n", RESET ) if ( ( $host_name ne $CLIENT ) && !( $host_name =~ /FILERS_LIST/ ) && !( $host_name =~ /FILERS_LIST_C/ ) ); } } } } else { print BOLD, RED, "No configuration file available to delete\n\n", RESET; exit 0; } my $filer_name = ""; while (1) { $filer_name = getchompstrip( "", '', "" ); $filer_name = trim($filer_name); alarm $ALARM; if ( $filer_name =~ /[=\$\*,;\#]/ ) { oops('Characters "=" "$" "*" "," ";" "$" "#" not allowed'); } elsif ( !length($filer_name) ) { oops('filer config name must be nonempty'); } elsif ( !( -e $filer_name ) ) { print "******* filer config file $filer_name does not exists ****** \n"; } elsif ( !( exists( $filer_exits{$filer_name} ) ) ) { print "******* filer file $filer_name does not exists ****** \n"; print "******* filer you selected is different type(Ironcity/Boilermaker) ****** \n"; } else { last; } } ## end while (1) delete_host($filer_name); print BOLD, CYAN, <<'EOD', RESET; Would you like to continue to delete filer config files ? (y/n/b) .............................................................. EOD my $flag = "n"; while (1) { $flag = getchompstrip( "", "", "" ); alarm $ALARM; if ( ( $flag eq "b" ) || ( $flag eq "B" ) ) { $state = 1; last; } elsif ( ( $flag eq "y" ) || ( $flag eq "Y" ) || ( $flag eq "n" ) || ( $flag eq "N" ) ) { last; } else { oops "Please enter correct value y/n/b"; } } ## end while (1) last if ( $flag =~ /^(N|n|B|b)/ ); } ## end while (1) if ( $state == 1 ) { $result_option = 3; next; } } ## end elsif ($model == 5) } ##end else if ($hostlist_size < 2) print BOLD, CYAN, <<'EOD', RESET; Would you like to create a test suite? (y/n/b/q) ............................................... EOD while (1) { $result = getchompstrip( "", "", "" ); alarm $ALARM; $result = trim($result); if ( ( $result eq "y" ) || ( $result eq "Y" ) || ( $result eq "n" ) || ( $result eq "N" ) || ( $result eq "B" ) || ( $result eq "b" ) || ( $result eq "q" ) || ( $result eq "Q" ) ) { last; } else { oops "Please enter correct value y/n/b/q"; } } ## end while (1) my $back_t = 0; if ( $result =~ /^(Y|y)/ ) { $runlist = create_runlist; print BOLD, CYAN, <<'EOD', RESET; Would you like to execute a test suite? (y/n/b) Default option is 'y' ................................... EOD while (1) { $result = getchompstrip( "", "", "" ); alarm $ALARM; $result = trim($result); if ( ( $result eq "y" ) || ( $result eq "Y" ) || ( $result eq "n" ) || ( $result eq "N" ) || ( $result eq "B" ) || ( $result eq "b" ) ) { last; } elsif ( $result eq '' ) { $result = "y"; print BOLD, CYAN, "You have chosen to execute the Test\n", RESET; last; } else { oops "Please enter correct value y/n"; } } ## end while (1) if ( $result =~ /^(Y|y)/ ) { $result_option = 1; next; } elsif ( $result =~ /^(B|b)/ ) { $result_option = 2; next; } else { print "*** Exiting from NDATE tool *** \n"; exit(0); } } elsif ( $result =~ /^(B|b)/ ) { $result_option = 3; next; } elsif ( $result =~ /^(N|n)/ ) { print BOLD, CYAN, <<'EOD', RESET; Would you like to execute a test suite? (y/n/b/q) Default option is 'y' ................................... EOD while (1) { $result = getchompstrip( "", "", "" ); alarm $ALARM; $result = trim($result); if ( ( $result eq "y" ) || ( $result eq "Y" ) || ( $result eq "n" ) || ( $result eq "N" ) || ( $result eq "B" ) || ( $result eq "b" ) || ( $result eq "q" ) || ( $result eq "Q" ) ) { last; } elsif ( $result eq '' ) { $result = "y"; print BOLD, CYAN, "You have chosen to execute the Test\n", RESET; last; } else { oops "Please enter correct value y/n"; } } ## end while (1) if ( $result =~ /^(Y|y)/ ) { $result_option = 1; next; } elsif ( $result =~ /^(B|b)/ ) { $result_option = 2; next; } else { print "*** Exiting from NDATE tool *** \n"; exit(0); } } else { print "*** Exiting from NDATE tool *** \n"; exit(0); } } ## end if ($result_option == ... ## End of option - 3 ## Create runlist, option - 2 #TEST_CASE_ADD: if ( $result_option == 2 ) { ## Check at least one host file { chdir("$Home/NDATE/FILER_INFO") && last; oops "Not able to change location to directory:$Home/NDATE/FILER_INFO"; } my @hostlist = <*>; my $hostlist_size = @hostlist; my $ret = 0; if ( $hostlist_size < 2 ) { print BOLD, YELLOW, "\n\n Please create at least one config file before creating the test suite\n\n", RESET; $result_option = 3; next; } { chdir("$Home/NDATE/TEST_LISTS") && last; oops "Not able to change location to directory:$Home/NDATE/TEST_LISTS"; } my @run_lists = <*>; if ( @run_lists > 0 ) { print BOLD, GREEN, "Test suites are available under $Home/NDATE/TEST_LISTS folder\n", RESET; print BOLD, CYAN, <<'EOD', RESET; -------------------------------------------------------------- Select one of the options to continue 1 > Create a test suite 2 > Update a test suite 3 > Delete a test suite To go back to previous options press "b" Enter 'help' for more information ---------------------------------------------------------------- EOD my $model = 0; my $exit_mode = 0; while (1) { $model = getchompstrip( "", "", "" ); if ( $model =~ /^(b|B)$/ ) { $exit_mode = 1; last; } alarm $ALARM; if ( $model =~ /(help|HELP|Help)/ ) { display_tc_info; } elsif ( ( ( $model =~ /^\d+$/ ) && ( ( $model <= 3 ) && ( $model >= 1 ) ) ) ) { last; } else { oops "Please enter correct value 1-3/b/help"; } } ## end while (1) if ( $exit_mode == 1 ) { # if ( $model =~ /^(q|Q)$/ ) { # exit 0; # } if ( $model =~ /^(b|B)$/ ) { $result_option = init_display(); next; } # elsif ( $model =~ /^(N|n)$/ ) { # $result_option = 1; # next; # } } ## end if ($exit_mode == 1) if ( $model == 1 ) { TEST_CASE_ADD: $runlist = create_runlist(); } elsif ( $model == 2 ) { update_runlist(); } elsif ( $model == 3 ) { my $flag_t = 0; while (1) { $ret = delete_runlist(); last if ( $ret == 3 ); print BOLD, CYAN, <<'EOD', RESET; Would you like to continue to delete test suits ? (y/n) .............................................................. EOD my $flag = "n"; while (1) { $flag = getchompstrip( "", "", "" ); alarm $ALARM; if ( ( $flag eq "y" ) || ( $flag eq "Y" ) || ( $flag eq "n" ) || ( $flag eq "N" ) ) { last; } else { oops "Please enter correct value y/n"; } } ## end while (1) if ( $flag =~ /^(N|n)/ ) { $flag_t = 1; last; } } ## end while (1) if ( $flag_t =~ 1 ) { $result_option = init_display(); next; } } elsif ( $model == 4 ) { $ERT = "Y"; create_ERT_runlist(); } } else { print BOLD, YELLOW, "*** No test suite available. Create at least one test suite ****\n\n", RESET; print BOLD, CYAN, <<'EOD', RESET; ----------------------------------------------------------------------- Select one of the following test setup 1 > Enter '1' for HDD/SSD/NVMe/SCM Qualification tests 2 > Enter '2' for ERT tests Enter 'help' for more information ----------------------------------------------------------------------- EOD my $test_suite_type = 0; while (1) { $test_suite_type = getchompstrip( "", "", "" ); alarm $ALARM; if ( $test_suite_type =~ /(help|HELP|Help)/ ) { print BOLD, GREEN, " 1 for HDD Qualification Tests\n", " 2 for HDD Engineering Reliablity Tests\n", RESET; } elsif ( ( $test_suite_type <= 2 ) && ( $test_suite_type >= 1 ) ) { last; } else { oops "Please enter correc value 1-2/help"; } } ## end while (1) if ( $test_suite_type == 1 ) { $runlist = create_runlist(); } else { create_ERT_runlist(); } } ## end else [ if (@run_lists > 0) next if ( $ret == 3 ); print BOLD, CYAN, <<'EOD', RESET; Would you like to execute a test suite? (y/n/b) Default option is 'y' ................................... EOD while (1) { $result = getchompstrip( "", "", "" ); alarm $ALARM; $result = trim($result); if ( ( $result eq "y" ) || ( $result eq "Y" ) || ( $result eq "n" ) || ( $result eq "N" ) || ( $result eq "B" ) || ( $result eq "b" ) ) { last; } elsif ( $result eq '' ) { $result = "y"; print BOLD, CYAN, "You have chosen to execute the Test\n", RESET; last; } else { oops "Please enter correct value (y/n/b)"; } } ## end while (1) if ( $result =~ /^(Y|y)/ ) { $result_option = 1; next; } elsif ( $result =~ /^(B|b)$/ ) { $result_option = 2; next; } else { $result_option = init_display(); next; } } ## end if ($result_option == ... ## End of create runlists, option - 2 ################################# create the command line ###################### ## Select and execute runlist, option - 1 my @command; if ( $result_option == 1 ) { my $back = 0; #system("clear"); print "\n"; { chdir("$Home/NDATE/TEST_LISTS") && last; oops "Not able to change location to directory:$Home/NDATE/TEST_LISTS"; } my @test_plans = <*>; my $my_runlist = ""; if ( @test_plans == 0 ) { $result_option = 2; next; } my $ssd_val = 0; if ( @test_plans > 1 ) { $test_suite_no = 0; if ( ( $runlist =~ /(NULL|null)/ ) || ( $runlist =~ /^ERT/ ) ) { print "Select one of the test suites available for execution:\n-------------------------------------------------------\n\n"; } else { print "Select one of the test suites available for execution:\nDefault test suite selected : $runlist\n-------------------------------------------------------\n\n"; } my @nor_tests; my @ert_tests; my @ssd_test; foreach my $test_plan (@test_plans) { if ( ( $test_plan =~ /^ERT/ ) ) { # print BOLD, BLUE, "########## ERT TEST SUITES ##########\n"; # print BOLD, BLUE, "$test_plan \n", RESET; push( @ert_tests, $test_plan ); } elsif ( ( $test_plan =~ /^SSD/ ) ) { # print BOLD, BLUE, "########## SSD Durability TEST SUITES ##########\n"; # print BOLD, BLUE, "$test_plan \n", RESET; push( @ssd_test, $test_plan ); $ssd_val = 1; } else { # print BOLD, BLUE, "############ HDD TEST SUITES ############\n"; # print BOLD, BLUE, "$test_plan \n", RESET; push( @nor_tests, $test_plan ); } } ## end foreach my $test_plan (@test_plans) print BOLD, GREEN, "########## ERT TEST SUITES ##########\n"; foreach my $ert_suit (@ert_tests) { print BOLD, MAGENTA, "$ert_suit\n", RESET; } print BOLD, GREEN, "########## SSD Durability TEST SUITES ##########\n"; foreach my $ssd_suit (@ssd_test) { print BOLD, MAGENTA, "$ssd_suit\n", RESET; } print BOLD, GREEN, "\n############ HDD TEST SUITES ############\n"; foreach my $norm_suit (@nor_tests) { print BOLD, MAGENTA, "$norm_suit\n", RESET; } print CYAN, "\nTo go back to previous options press 'b'", RESET, "\n-----------------------------------------------------------\n"; while (1) { if ( ( $runlist =~ /(NULL|null)/ ) || ( $runlist =~ /^ERT/ ) ) { $my_runlist = getchompstrip( "", '', "" ); } else { $my_runlist = getchompstrip( "Default:", '', "$runlist\n" ); } $my_runlist = trim($my_runlist); if ( $my_runlist =~ /^(b|B)$/ ) { $back = 1; last; } alarm $ALARM; if ( $my_runlist =~ /[=\$\*,;\#]/ ) { oops('Characters "=" "$" "*" "," ";" "$" "#" not allowed'); } #elsif ($my_runlist =~ /^ERT/) { # oops( # 'This option is not supported for ERT test, use option 6 from the main menu.' # ); #} elsif ( !length($my_runlist) ) { oops('Name of the test suite must be nonempty'); } elsif ( !( -e $my_runlist ) ) { print BOLD, YELLOW, "\n ******* The test suite $my_runlist does not exists. Please select again *******\n", RESET; } else { last; } } ## end while (1) } else { $test_suite_no = 1; $my_runlist = $test_plans[0]; print BOLD, CYAN, "Only one test suite available: $my_runlist\n", RESET; } if ( $back == 1 ) { $result_option = init_display(); next; } $runlist = $my_runlist; display_runlist($runlist); if ( $option_TYPE == 'C_mode' ) { push( @command, "nohup" ); } push( @command, "$Home/NDATE/NATE/bin/ntest" ); push( @command, "-v none" ); #push(@command, "-nolocaldb"); push( @command, "GNOTE_LOG_ACTIVE=0" ); push( @command, "NATE_CONN_SERVICE=0" ); push( @command, "STEST_FILE=$my_runlist" ); if ( $option_TYPE == 'C_mode' ) { push( @command, "SITE=svl" ); push( @command, "'SETENV=bootarg.install.ramdisksize=>300M'" ); } push( @command, "POSTJOB=$Home/NDATE/SUPPORT_SCRIPTS/post_job.thpl" ); push( @command, "LOGLVL=$loglvl" ); push( @command, "AUTO_PUSH=$AUTO_PUSH" ); push( @command, "POWERCYCLE=0" ); push( @command, "RUNPYTH=$runpyth" ); if ( $runpyth == 1 ) { push( @command, "PYTHPATH=$python_path" ); } push( @command, "stest/stest.thpl" ); push( @command, "FILER=FILER" ); if ( $option_TYPE == '7_mode' ) { if ( $enableshell == 1 ) { push( @command, "DISABLESHELL=$enableshell" ); } #push(@command, "FILER=FILER"); } push( @command, "RUNID=HDD" ); push( @command, "TEST_MODE=$test_mode" ); push( @command, "EOE=$terminate_on_error" ); push( @command, "TEST_WAIT_TIME=$test_wait_time" ); push( @command, "CHECK_FILER_SETUP=$check_filer_setup" ); push( @command, "CLIENT=CLIENTS" ); if ( $option_TYPE == 'C_mode' ) { # push(@command, ">>$logdir/$runlist.txt"); $filer_name_nohup =~ s/,/_/g; #my $temp_file_nohup = "nohup_" . "$runlist" . "_" ."$filer_name_nohup"; $temp_file_nohup = "nohup_" . "$runlist" . "_" . "$filer_name_nohup"; #push(@command, "| tee $logdir/$temp_file_nohup.txt"); } #if( ($EMAIL =~ /No/i) || ($EMAIL =~ /N/i)){ # push(@command,"EMAIL=$EMAIL"); # push(@command, "EMAIL_TO=$MAIL_TO"); # push(@command,"EMAIL_FROM=$MAIL_FROM"); #} my $cmdd = ( join( " ", @command ) . " " ); ################################## execute the command ############################# { chdir("$Home/NDATE") && last; oops "Not able to change location to directory: $Home/NDATE"; } ## Store the last command executed and runlist selected open( H_DEFAULT, ">$defailt_vals" ) or die "write:Failed opening $defailt_vals \n"; print( H_DEFAULT "RUNLIST=$my_runlist\n" ); print( H_DEFAULT "LOGLVL=$loglvl\n" ); print( H_DEFAULT "EOE=$terminate_on_error\n" ); print( H_DEFAULT "LOGDIR=$Home/NDATE/TEST_LOGS\n" ); print( H_DEFAULT "EXECMD=$cmdd\n" ); print( H_DEFAULT "TEST_MODE=$test_mode\n" ); print( H_DEFAULT "EMAIL=$EMAIL\n" ); print( H_DEFAULT "EMAIL_MSG=$EMSG\n" ); print( H_DEFAULT "EMAIL_TO=$MAIL_TO\n" ); print( H_DEFAULT "EMAIL_FROM=$MAIL_FROM\n" ); if ( $logsize == 0 ) { $logsize = 10485760; } print( H_DEFAULT "LOGDIRSIZE=$logsize\n" ); print( H_DEFAULT "PYTHPATH=$python_path\n" ); close H_DEFAULT; if ( $check_filer_setup eq "N" ) { print BOLD, CYAN, "Check filer setup will be skipped\n", RESET; } if ( $test_mode eq "DEV" ) { print BOLD, CYAN, "Test Mode selected : Development\n", RESET; } else { print BOLD, CYAN, "Test Mode selected : Qualification\n", RESET; } print BOLD, CYAN, "Log level selected : $loglvl \n", RESET; if ( $terminate_on_error == 1 ) { print BOLD, CYAN, "Test Exit Mode selected : INSPECT\n", RESET; } elsif ( $terminate_on_error == 2 ) { print BOLD, CYAN, "Test Exit Mode selected : INSPECT,FATAL\n", RESET; } elsif ( $terminate_on_error == 3 ) { print BOLD, CYAN, "Test Exit Mode selected : INSPECT,FATAL,FAIL\n", RESET; } ## Burt 532027 < Updated value w = 4 > if ( $test_wait_time != 3 ) { print BOLD, CYAN, "Individual Test Time reduced to : 10% - Applicable only for few tests \n", RESET if ( $test_wait_time == 1 ); print BOLD, CYAN, "Individual Test Time reduced to : 50% - Applicable only for few tests \n", RESET if ( $test_wait_time == 2 ); print BOLD, CYAN, "Individual Test Time reduced to : 95% -Applicable only for few tests \n", RESET if ( $test_wait_time == 4 ); } ## end if ($test_wait_time !=... ## End of Burt 532027 < Updated value w = 4 > print BOLD, CYAN, "Log path set to : $logdir \n", RESET; if ( ( $EMAIL eq 'y' ) || ( $EMAIL eq 'Y' ) ) { print BOLD, CYAN, "Send email set to : $MAIL_TO \n", RESET; print BOLD, CYAN, "Email from set to : $MAIL_FROM \n", RESET; } if ( $runlist =~ /^ERT/ ) { if ( $test_wait_time == 1 ) { print BOLD, RED, "\nERT tests going to take 1 day.\n", RESET; } elsif ( $test_wait_time == 2 ) { print BOLD, RED, "\nERT tests going to take ($TOTAL_ERT_DAYS/2) days.\n", RESET; } else { print BOLD, RED, "\nERT tests going to take $TOTAL_ERT_DAYS days.\n", RESET; } } ## end if ($runlist =~ /ERT/) print BOLD, CYAN, "\nCommand: $cmdd \n", RESET; print BOLD, CYAN, <<'EOD', RESET; ------------------------------------------------------------------ Press ENTER to execute the test in BACKGROUND mode OR choose "f" for FOREGROUND run To go back to previous options press "b" ------------------------------------------------------------------ EOD my $state = 0; while (1) { $result = getchompstrip( "", "", "" ); alarm $ALARM; $result = trim($result); if ( $result =~ /(q|Q)/ ) { exit 0; } if ( $result =~ /(help|HELP|Help)/ ) { print BOLD, GREEN, " If the user pressed cntrl+C accidentally on the client console will terminate the test.\n", " This may happen if the client console frozen.\n", " So execute the test in background mode in case the test execution time is more.\n\n", " To terminate the test suite manually, find the process id associate with the test (ps -au |grep ntest).\n", " Kill the process id (kill -9 process_id). \n", RESET; } elsif ( $result =~ /^(b|B)$/ ) { $state = 1; last; } elsif ( ( $result eq "f" ) || ( $result eq "F" ) || ( $result eq "" ) ) { check_log_size(); last; } else { oops "Please choose correct option\n b - Back\n f - Foreground\n Press ENTER to Background test execution"; } } ## end while (1) if ( $state == 1 ) { $result_option = 1; $result_option = init_display if ( $test_suite_no == 1 ); next; } system('clear'); my $background = 1; if ( $result =~ /^(F|f)/ ) { $background = 0; } execute_cmd( $cmdd, $background ); last; } ## end if ($result_option == ... ## Option - 4, update NDATE if ( $result_option == 4 ) { option_4: my $servise_all = check_services; my $back = 0; if ( $servise_all == 0 ) { print BOLD, RED, "\nAbove services are not running\n", RESET; } else { print BOLD, GREEN, "All dependent services (nfs,rsh,telnet) are running and sudo is enabled\n\n", RESET; } if ( !( -e "$Home/NDATE" ) ) { if ( ( $user_type == 3 ) && ( $lib_type == 1 ) ) { $presult_options = 1; } if ( $presult_options == 2 ) { my $continue_install; if ( ( !-e "/usr/PNATE/nate" ) || ( !-e "/usr/PNATE/pnate" ) || ( !-e "/usr/PNATE/staf" ) ) { pnate_requirement_info(); print BOLD, GREEN, <<'EOD', RESET; -------------------------------------------------------------- INFORMATION: 1.PNATE will be installed in directory "/usr". Please ensure that the user has sufficient permissions and memory to this directory. 2.If the user selects the option "YES",the installation will takes approximately 10Minutes of time. --------------------------------------------------------------- EOD while (1) { print BOLD, CYAN, "\nDo you want to continue? Default value is yes ", RESET; print BOLD, CYAN, "\nPlease enter y or n: ", RESET; $continue_install = getchompstrip( "", '', "" ); if ( $continue_install =~ /^$/ ) { print BOLD, CYAN, "\n\n You selected the default value of YES.Hence continuing with the process of PNATE installation.\n", RESET; $continue_install = "y"; $PNATE_Upgrade = 1; last; } elsif ( ( $continue_install =~ /^y$/ ) || ( $continue_install =~ /^Y$/ ) || ( $continue_install =~ /^yes$/ ) || ( $continue_install =~ /^Yes$/ ) ) { $continue_install = "y"; $PNATE_Upgrade = 1; last; } elsif ( ( $continue_install =~ /^n$/ ) || ( $continue_install =~ /^N$/ ) || ( $continue_install =~ /^no$/ ) || ( $continue_install =~ /^No$/ ) ) { $continue_install = "n"; $PNATE_Upgrade = 0; last; } elsif ( $continue_install =~ /^(b|B)$/ ) { $back = 1; last; } else { print BOLD, RED, " Please enter again: ", RESET; } } ## end while (1) } if ( $continue_install =~ /n/ ) { init_display(); } else { print "PNATE installation at 2nd stage\n"; install_pnate_package(); # Run the staf execute_staf(); } } else { install_nate_package(); install_STAF(); } } else { # print BOLD, YELLOW, "\n-------------------------------------------\n", "NATE package exists under $Home/NDATE \nPlease go through the README file or the release note before updating the package.\n", RESET; print CYAN, BOLD, "\nTo go back to Main Menu press 'b'", RESET, BOLD, YELLOW, "\n-------------------------------------------\n", RESET; print BOLD, CYAN, <<'EOD', RESET; Would you like to overwrite (Default Y)(y/n/b/help) : EOD while (1) { $result = getchompstrip( "", "", "" ); alarm $ALARM; $result = trim($result); if ( ( $result eq "y" ) || ( $result eq "Y" ) || ( $result eq "n" ) || ( $result eq "N" ) ) { last; } elsif ( $result =~ /(help|HELP|Help)/ ) { print BOLD, GREEN, <<'EOD', RESET; It will update all NDATE package files and does not delete,update rename new files created (host configuration files, test suites, logs etc) after package installation. Please take backup if you like to keep modified existing package files. EOD } elsif ( $result =~ /^$/ ) { $result = "Y"; print BOLD, GREEN, "Default option Y is selected\n", RESET; last; } elsif ( $result =~ /^(b|B)$/ ) { $back = 1; last; } else { oops "Please enter correct value y/n/help"; } } ## end while (1) if ( $result =~ /^(Y|y)/ ) { system("cp $Home/NDATE/default_params $Home/NDATE/default_params_t"); if ( ( $user_type == 3 ) && ( $lib_type == 1 ) ) { $presult_options = 1; } if ( $presult_options == 2 ) { my $continue_install; if ( ( !-e "/usr/PNATE/nate" ) || ( !-e "/usr/PNATE/pnate" ) || ( !-e "/usr/PNATE/staf" ) ) { pnate_requirement_info(); print BOLD, GREEN, <<'EOD', RESET; -------------------------------------------------------------- INFORMATION: 1.PNATE will be installed in directory "/usr". Please ensure that the user has sufficient permissions and memory to this directory. 2.If the user selects the option "YES",the installation will takes approximately 15Minutes of time. --------------------------------------------------------------- EOD while (1) { print BOLD, CYAN, "\nDo you want to continue? Default value is yes ", RESET; print BOLD, CYAN, "\nPlease enter y or n: ", RESET; $continue_install = getchompstrip( "", '', "" ); if ( $continue_install =~ /^$/ ) { print BOLD, CYAN, "\n\n You selected the default value of YES.Hence continuing with the process of PNATE installation.\n", RESET; $continue_install = "y"; $PNATE_Upgrade = 1; last; } elsif ( ( $continue_install =~ /^y$/ ) || ( $continue_install =~ /^Y$/ ) || ( $continue_install =~ /^yes$/ ) || ( $continue_install =~ /^Yes$/ ) ) { $continue_install = "y"; $PNATE_Upgrade = 1; last; } elsif ( ( $continue_install =~ /^n$/ ) || ( $continue_install =~ /^N$/ ) || ( $continue_install =~ /^no$/ ) || ( $continue_install =~ /^No$/ ) ) { $continue_install = "n"; $PNATE_Upgrade = 0; last; } else { print BOLD, RED, " Please enter again: ", RESET; } } ## end while (1) } if ( $continue_install =~ /n/ ) { init_display(); } else { install_pnate_package(); # Run the staf execute_staf(); } } else { my $cnt = unlink("$Home/.pnate_ndate_debug"); install_nate_package(); install_STAF(); } system("mv $Home/NDATE/default_params_t $Home/NDATE/default_params"); print BOLD, GREEN, "---------------------------------------------------\n", "Nate package overwritten under $Home/NDATE\n", "---------------------------------------------------\n", RESET; } ## end if ($result =~ /^(Y|y)/) } ## end else [ if (!(-e "$Home/NDATE"... if ( $back == 1 ) { $result_option = init_display(); next; } if ( ( !( -e "/usr/software/bin/perl5.8.8" ) ) && ( $presult_options == 1 ) ) { install_perl_package(); } elsif ( $presult_options != 2 ) { ##Perl modules overwritting should not executed while using PNATE print BOLD, RED, <<'EOD', RESET; ---------------------------------------- WARNING!! Overwitten Perl package module might cause corruption of NDATE package. ......................................... EOD print BOLD, CYAN, <<'EOD', RESET; ---------------------------------------- Perl package exists under /usr/software Would you like to overwrite? (y/n) Default is "n": ......................................... EOD while (1) { $result = getchompstrip( "", "", "" ); alarm $ALARM; $result = trim($result); if ( ( $result eq "y" ) || ( $result eq "Y" ) || ( $result eq "n" ) || ( $result eq "N" ) ) { last; } elsif ( $result =~ /^$/ ) { print BOLD, CYAN, "\n Default value selected. The Perl packages will not be overwritten \n", RESET; last; } else { oops "Please enter correct value y/n"; } } ## end while (1) if ( $result =~ /^(Y|y)/ ) { print BOLD, RED, <<'EOD', RESET; ---------------------------------------- ################## WARNING ####################### It is not mandatory to install Perl Packages everytime NDATE is installed. Installing the same will overwrite the existing package and might also corrupt the existing Perl modules. Please go through the Release notes before updating the Perl package Would you still like to continue? (y/n) ################## WARNING ####################### ......................................... EOD while (1) { $result = getchompstrip( "", "", "" ); alarm $ALARM; $result = trim($result); if ( ( $result eq "y" ) || ( $result eq "Y" ) || ( $result eq "n" ) || ( $result eq "N" ) ) { last; } elsif ( $result =~ /^$/ ) { print BOLD, CYAN, "\n Default value selected. The Perl packages will not be overwritten \n"; last; } else { oops "Please enter correct value y/n"; } } ## end while (1) } ## end if ($result =~ /^(Y|y)/) if ( $result =~ /^(Y|y)/ ) { print BOLD, RED, <<'EOD', RESET; -------------------------------------------------- Are you sure you want to overwrite the Perl package /usr/software? (y/n) ......................................... EOD while (1) { $result = getchompstrip( "", "", "" ); alarm $ALARM; $result = trim($result); if ( ( $result eq "y" ) || ( $result eq "Y" ) || ( $result eq "n" ) || ( $result eq "N" ) ) { last; } elsif ( $result =~ /^$/ ) { print BOLD, CYAN, "\n Default value selected. The Perl packages will not be overwritten \n"; last; } else { oops "Please enter correct value y/n"; } } ## end while (1) } ## end if ($result =~ /^(Y|y)/) if ( $result =~ /^(Y|y)/ ) { install_perl_package(); print BOLD, GREEN, <<'EOD', RESET; -------------------------------------------- Perl package overwritten under /usr/software -------------------------------------------- EOD } ## end if ($result =~ /^(Y|y)/) } ## end else [ if (!(-e "/usr/software/bin/perl5.8.8"... set_client(); } ## end if ($result_option == ... if ( $option_4a == 1 ) { Add_Default_Kernel_Images(); set_client(); print BOLD, CYAN, "\n NDATE installed successfully ,Please re-run the wrapper again\n", RESET; exit; } set_client(); Add_Default_Kernel_Images(); $result_option = init_display(); next; } ## end while (1) alarm 0; }; if ($@) { if ( $@ =~ /prompt timeout/ ) { print "\n Timeout (Waiting for $ALARM seconds): Please re-execute \n"; exit 0; } else { } } else { # print "\n Command started executing successfully \n"; } # =================================== SUBS =================================== # Display prompt, showing default @default, and return the values # entered by the user; in an array context, we ask for multiple values # until an empty line is entered. # if $nulldefault, return undef if we would otherwise have returned # the default (e.g. because user just pressed enter to accept the # default or, for whatever reason, typed out the default again). The # assumption being, if $nulldefault, that the default is guessable by # tharn itself, so we shouldn't clutter the config file with such # information (or potentially prevent future, modified versions of # tharn from making better guesses). use constant MARGIN => 14; sub getchompstrip ($@) { my ( $prompt, $preprompt, @default ) = @_; my @result = (); print $preprompt, substr( ( $prompt . " " x MARGIN ), 0, MARGIN - 1 ), "", join( ( "\n" . " " x MARGIN ), @default ), ( wantarray ? ( "\n" . " " x ( MARGIN - 1 ) ) : "" ), ( wantarray ? ( " " x ( MARGIN - 1 ) . "* Multiple entries allowed. Null line terminates. *\n" ) : "" ); while (1) { print " " x ( MARGIN - 1 ) . ">"; $_ = ; chomp; if ( !@result && !$_ ) { @result = @default; last; } if ( !@result && ( $_ eq " " ) ) { last; } s/^\"(.*)\"$/$1/ || s/^\'(.*)\'$/$1/; last if ( !$_ ); push @result, $_; last if ( !wantarray ); } ## end while (1) return wantarray ? @result : $result[0]; } ## end sub getchompstrip ($@) sub arrayeq ($$) { my ( $aref, $bref ) = @_; return ( join( chr(1), @$aref ) eq ( join( chr(1), @$bref ) ) ); } sub oops ($) { print BOLD, YELLOW, "\n", " " x MARGIN, "** ", $_[0], "**\n", RESET; } sub make_value ( $ ) { my ($value) = @_; return $value; } sub make_param ( $@ ) { my ( $key, @values ) = @_; return $key . '=' . join( ',', map { make_value($_) } @values ); } # return true if this type of connection is to an appliance (filer or # cache) rather than something else. # # For non-simulator appliances this is always true, for unix and windows # hosts always false. For appliance simulator connections, however, some # types of connection types are assumed to be intended to contact the # simulator itself (and so should act like appliance connections) # while some other kinds, generally those not supported by ontap # but supported by unix, are considered as going to the simhost # running the simulator, and are used to reach a shell to invoke the # simulator and use its console (and so should act like unix host # connections, and default their IP address to simhost instead of # to default_ip). # # (this function also exists in Tharn_Connectrec.pm; please consider # keeping them in sync) #============================= Install nate package ================================= sub install_nate_package() { my @dir; $Term::ANSIColor::AUTORESET = 1; # Remove ! later clean_up_pnate(); unlink("$Home/.ntest"); print BOLD, CYAN, "\nInstalling NDATE package under $Home/NDATE folder\n\n", RESET; sleep 3; if ( !( -e "$Home/NDATE.tar.gz" ) ) { print BOLD, RED, "NDATE.tar.gz package file does not exist \n", RESET; exit 0; } if ( -d "$Home/NDATE/TEST_SCRIPTS" ) { system("sudo rm -rf $Home/NDATE/TEST_SCRIPTS/"); } system('cd $Home && tar -xzf NDATE.tar.gz'); ## Check for unix version(32-64 bit) and copy correct library my $unix_ver_cmd = `uname -m`; my $unix_ver_data = 0; chdir("$Home/NDATE/HDD_LIBS"); if ( !( -e "$Home/NDATE/FILER_INFO" ) ) { system('cd ~/NDATE && mkdir FILER_INFO'); } if ( !( -e "$Home/NDATE/TEST_LISTS" ) ) { system('cd ~/NDATE && mkdir TEST_LISTS'); } if ( !( -e "$Home/NDATE/NATE/recover" ) ) { system('cd ~/NDATE/NATE && mkdir recover'); } #dashboard(); set_client(); print BOLD, CYAN, <<'EOD', RESET; ------------------------------------------------------------------------------ NDATE package installed EOD sleep 3; $Term::ANSIColor::AUTORESET = 0; print BOLD, CYAN, "", RESET; } ## end sub install_nate_package() #============================= Install perl package ================================== sub dashboard() { my $path = "/etc/httpd/conf/httpd.conf"; system("sudo chmod 777 $path"); system("sudo chmod 777 /etc/httpd/conf.d/welcome.conf"); system("sudo chmod 777 /etc/httpd/conf.d/php.conf"); my $pth; if ( $Home =~ /\/(.*)\/.*/ ) { $pth = $1; } my $apach = 0; if ( -d "$Home" ) { my $present = system("sudo cp -rf $Home/NDATE/SUPPORT_SCRIPTS/NDATE_WEB/index.php $Home/.. 2>$Home/dash.txt"); system("sudo rm -rf $Home/dash.txt"); my $opt; =head NDATE Dashboard would require Apache service to be configured on your server. Enter "Y" if you like NDATE to configure the same for you, else enter "N", if you want to configure manually. (Default : Y) Please Note: While configuring the Apache service, NDATE will be modifying the httpd service related files. If the user choses to configure manually, the steps to do the same can be refered in the document: Dashboard_Debug_Steps.doc, embedded in the NDATE Release Notes under section 3.1.18. =cut print BOLD, CYAN, <<'EOD', RESET; Configuring Apache Server: EOD while (1) { #$opt = getchompstrip( "", "", "" ); #$opt = trim($opt); $opt = "yes"; if ( ( ( $opt != ~/\d/ ) && ( $opt =~ /^yes$/ ) ) || ( $opt =~ /^y$/ ) ) { $apach = 1; last; } elsif ( ( ( $opt != ~/\d/ ) && ( $opt =~ /^no$/ ) ) || ( $opt =~ /^n$/i ) ) { $apach = 0; last; } elsif ( $opt eq '' ) { $apach = 1; print BOLD, WHITE, "\nBy default Y\n\n", RESET; last; } else { oops "Please enter correct value y/n or yes/no"; } } if ( ( $present != 0 ) && ( $apach == 1 ) ) { print BOLD, RED, <<'EOD', RESET; ------------------------------------------------------------------------------ Warning: There is permission issue in home directory therefore we are copy the files in /var/www/html EOD system("sudo cp -rf $Home/NDATE/SUPPORT_SCRIPTS/NDATE_WEB/*.* /var/www/html"); my $loc = 'DocumentRoot' . " " . "\"\\/$pth\""; my $loc1 = 'DocumentRoot \"\/var\/www\/html\"'; `sed 's/$loc/$loc1/' /etc/httpd/conf/httpd.conf > conf_back`; `sudo mv conf_back /etc/httpd/conf/httpd.conf`; my $loc2 = 'Directory \"\/var\/www\/html\"'; my $loc3 = 'Directory' . " " . "\"\\/$pth\""; `sed 's/$loc3/$loc2/' /etc/httpd/conf/httpd.conf > conf_back`; `sudo mv conf_back /etc/httpd/conf/httpd.conf`; } else { if ( $apach == 1 ) { system("sudo cp -rf $Home/NDATE/SUPPORT_SCRIPTS/NDATE_WEB/*.* $Home/.."); my $value1 = 'DocumentRoot \"\/var\/www\/html\"'; my $value = 'DocumentRoot' . " " . "\"\\/$pth\""; `sed 's/$value1/$value/' /etc/httpd/conf/httpd.conf > conf_back`; `sudo mv conf_back /etc/httpd/conf/httpd.conf`; my $value2 = 'Directory \"\/var\/www\/html\"'; my $value3 = 'Directory' . " " . "\"\\/$pth\""; `sed 's/$value2/$value3/' /etc/httpd/conf/httpd.conf > conf_back`; `sudo mv conf_back /etc/httpd/conf/httpd.conf`; } } my $value4 = 'Options \-Indexes'; my $value5 = 'Options Indexes'; if ( $apach == 1 ) { `sed 's/$value4/$value5/' /etc/httpd/conf.d/welcome.conf > wel_end`; `sudo mv wel_end /etc/httpd/conf.d/welcome.conf`; my $value6 = 'DirectoryIndex index\.html'; my $value7 = 'DirectoryIndex index\.php'; `sed 's/$value6/$value7/' /etc/httpd/conf.d/php.conf > conf_bck`; `sudo mv conf_bck /etc/httpd/conf.d/php.conf`; } } if ( $apach == 1 ) { if ( -d "$Home" ) { my $run = system('sudo /sbin/service httpd restart'); sleep 5; if ( $run == 0 ) { print BOLD, CYAN, <<'EOD', RESET; The Apache server is successfully configured EOD } else { my $ru = system('sudo /etc/init.d/httpd restart'); sleep 5; if ( $ru == 0 ) { print BOLD, CYAN, <<'EOD', RESET; The Apache server is successfully configured EOD } else { print BOLD, RED, <<'EOD', RESET; WARNING:The Apache server is not successfully configured . please configure manualy EOD } } } } ##setting client value in .ntest file set_client(); } ## end sub dashboard() sub install_perl_package () { $Term::ANSIColor::AUTORESET = 1; print BOLD, CYAN, ""; print BOLD, CYAN, <<'EOD', RESET; ------------------------------------------------------------------------------ Perl modules not installed Installing Perl modules under /usr/software EOD sleep 3; if ( !( -e "$Home/NDATE" ) ) { print BOLD, CYAN, <<'EOD', RESET; ------------------------------------------------------------------------------ NDATE package not installed Creating NDATE package first EOD sleep 3; if ( !( -e "$Home/.pnate_ndate_debug" ) ) { install_nate_package(); } #install_STAF(); print BOLD, CYAN, <<'EOD', RESET; NDATE package created EOD sleep 3; } ## end if (!(-e "$Home/NDATE"... my @support_ver_out = `cat /etc/issue`; my $support_ver = $support_ver_out[0]; if ( ( $support_ver =~ /.*Red Hat Linux/ ) || ( $support_ver =~ /.*Fedora/ ) || ( $support_ver =~ /.*Red Hat Enterprise/ ) ) { my $unix_ver_cmd = `uname -m`; my $unix_ver_data = 0; if ( !( ( $unix_ver_cmd =~ /.*i686/ ) || ( $unix_ver_cmd =~ /.*x86_64/ ) ) ) { print "Unsupported system. It supports only i686 and x86_64 type system. \n"; exit 0; } if ( !( -e "/usr/software" ) ) { system("sudo mkdir /usr/software"); } my $unix_distribution = `cat /proc/version`; my $rel_ver = 0; if ( ( $unix_ver_cmd =~ /.*i686/ ) && ( ( ( ( $unix_distribution =~ /.*Red Hat 4/ ) || ( $unix_distribution =~ /.*Red Hat 5/ ) ) && ( $support_ver =~ /.*Fedora release (2|3|4|5|6|7|8|9|10)/ ) ) || ( $support_ver =~ /.*Red Hat Enterprise Linux Server release 4/ ) || ( $support_ver =~ /.*Red Hat Enterprise Linux 4/ ) || ( $support_ver =~ /.*Red Hat Enterprise Linux Server release 5/ ) || ( $support_ver =~ /.*Red Hat Enterprise Linux 5/ ) ) ) { system("cd /usr/software && sudo tar -xf $Home/NDATE/PERL_MOD/perl_mod_non_redhat_32.tar.gz"); } elsif ( ( $unix_ver_cmd =~ /.*i686/ ) && ( ( $unix_distribution =~ /.*Red Hat Linux (8|9)/ ) || ( $unix_distribution =~ /.*Fedora release 1/ ) || ( $support_ver =~ /.*Red Hat Enterprise Linux Server release 3/ ) || ( $support_ver =~ /.*Red Hat Enterprise Linux 3/ ) ) ) { system("cd /usr/software && sudo tar -xf $Home/NDATE/PERL_MOD/perl_mod_redhat_32.tar.gz"); } elsif ( ( $unix_ver_cmd =~ /.*x86_64/ ) && ( $unix_distribution =~ /.*Red Hat/ ) ) { system("cd /usr/software && sudo tar -xf $Home/NDATE/PERL_MOD/perl_*64.tar.gz"); } else { print BOLD, YELLOW, "Unsupported system. It supports only i686 and x86_64. \n", RESET; exit 0; } if ( !( -e "/usr/lib/libexpat.so.0" ) && ( -e "/usr/lib/libexpat.so.1.5.2" ) ) { system("sudo ln -s /usr/lib/libexpat.so.1.5.2 /usr/lib/libexpat.so.0"); system("sudo ln -s /usr/lib/libexpat.so.1.5.2 /usr/lib/libexpat.so.1"); } elsif ( !( -e "/usr/lib/libexpat.so.0" ) && ( -e "/usr/lib/libexpat.so.0.5.0" ) ) { system("sudo ln -s /usr/lib/libexpat.so.0.5.0 /usr/lib/libexpat.so.0"); system("sudo ln -s /usr/lib/libexpat.so.0.5.0 /usr/lib/libexpat.so.1"); } elsif ( !( -e "/usr/lib/libexpat.so.0" ) && ( -e "/lib/libexpat.so.1.5.2" ) ) { system("sudo ln -s /lib/libexpat.so.1.5.2 /usr/lib/libexpat.so.0"); system("sudo ln -s /lib/libexpat.so.1.5.2 /usr/lib/libexpat.so.1"); } else { } } else { print BOLD, CYAN, "System version: $support_ver \n", RESET; print BOLD, RED, <<'EOD', RESET; Not supported Linux version Supported Linux version are: Red Hat Linux 8/9 - 32 bit system Red Hat Enterprise Linux (3-4) - 32/64 bit system Fedora (1-10) - 32/64 bit system Ubuntu - 32 bit system EOD exit 0; } ## end else [ if (($support_ver =~ /.*Red Hat Linux/... print BOLD, GREEN, "Perl module installed successfully \n", RESET; if ( !( -e "$Home/.pnate_ndate_debug" ) ) { install_STAF(); } } ## end sub install_perl_package () sub create_hosts_from_list() { { chdir("$Home/NDATE/FILER_INFO") && last; oops "Not able to change location to directory:$Home/NDATE/FILER_INFO"; } if ( $option_TYPE == '7_mode' ) { $filer_list_file = "$Home/NDATE/FILER_INFO/FILERS_LIST"; } if ( $option_TYPE == 'C_mode' ) { $filer_list_file = "$Home/NDATE/FILER_INFO/FILERS_LIST_C"; } system("cd $Home/NDATE/FILER_INFO; chmod 644 $filer_list_file"); open( H_FILERFILE, "< $filer_list_file " ) or die ">>>>> read: Failed opening $filer_list_file <<<<<"; my $line = ""; my $filer_no = 0; my $filer_model_f = ""; foreach $line () { if ( $line =~ /^\#/ ) { next; # ignore comments } my @filers = split( " ", $line ); $filer_no++; my $DbDir = cwd(); print "Validating Filer - $filer_no inputs \n"; if ( $option_TYPE == '7_mode' ) { create_hosts_info(@filers); } if ( $option_TYPE == 'C_mode' ) { create_hosts_info_C(@filers); } } ## end foreach $line () } ## end sub create_hosts_from_list() #=============================Create HOSTS ================================== # This sub routine creates host files. The host file contains filer # information like name of the filer, filer/gatway/TFTP server ip address, # boot firmware etc. The host files are different based on the filer type. # sub create_hosts() { if ( !( -e "$Home/NDATE/FILER_INFO" ) ) { system('cd ~/NDATE && mkdir FILER_INFO'); } my $CLIENT = hostname(); my @clienta = split( /\./, $CLIENT ); $CLIENT = $clienta[0]; my $DbDir; { chdir("$Home/NDATE/FILER_INFO") && last; oops "Not able to change location to directory:$Home/NDATE/FILER_INFO"; } $DbDir = cwd(); #---------------------------------------------------------------------------------- my $cmd_filer_info = ""; my @filer_info; if ( $fc_bm_option == 1 ) { print BOLD, CYAN, <<'EOD', RESET; ------------------------------------------------------------------------------------------------------------------- Please enter the filer information in following order and semicolon (;) as a separator 1 - FAS2000 2 - FAS3000 3 - FAS6000 4 - FAS960 Filer model Filer id Filer ip Terminal serv ip Port no Gateway ip TFTP serv ip PartnerHost ----------- -------- -------- ---------------- ------- ---------- ------------ ------------ EOD print("Example: 1 ; hdd-115 ; 172.23.8.115 ; 172.23.8.248 ; 6038 ; 172.23.8.1 ; 172.23.8.23 ; RironcityN__2230.2d ; hdd-115"); } ## end if ($fc_bm_option == 1) if ( $fc_bm_option == 2 ) { if ( $option_TYPE == '7_mode' ) { print BOLD, CYAN, <<'EOD', RESET; ------------------------------------------------------------------------------------------------------------------- Please enter the filer information in following order and semicolon (;) as a separator 1 - FAS2000 2 - FAS3000 3 - FAS6000 Filer model Filer id Filer ip Terminal serv ip Port no Gateway ip Version password MASK DNS ip PartnerHost IFC ----------- -------- -------- ---------------- ------- ---------- ------- -------- ---- ------ ----------- --- EOD print("Example: 1; hdd-97; 172.23.8.97; 172.23.8.247; 6005; 172.23.8.1; RboilermakerN_100609_0300.8d; netapp1!; 255.255.255.0; 172.19.2.30 ; hdd-97; e0a\n"); print "\n 1. NetApp Internal users must create soft link for the desired kernel to netboot before running NDATE3.0 'ln -s /rlse/DOT/ Auto create test suite name 2> Enter test suite name manually Note: Option 2 is Default -------------------------------------------------------------- EOD # my ( $auto_manual, $flag_a_m ); while (1) { $auto_manual = getchompstrip( "", "", "" ); $auto_manual = trim($auto_manual); alarm $ALARM; if ( ( $auto_manual =~ /\d/ ) && ( $auto_manual <= 2 ) && ( $auto_manual >= 1 ) ) { $flag_a_m = 1; last; } elsif ( $auto_manual eq '' ) { $flag_a_m = 1; $auto_manual = 2; print BOLD, WHITE, "\nYou have choosed to create test suite name manually.\n\n", RESET; last; } else { oops "Please enter correct value 1/2"; } } ## end while (1) $select = 0; if ( !( -e "$Home/NDATE/TEST_LISTS" ) ) { system('cd ~/NDATE && mkdir TEST_LISTS'); } { chdir("$Home/NDATE/TEST_LISTS") && last; oops "Not able to change location to directory:$Home/NDATE/TEST_LISTS"; } my $CLIENT = hostname(); my @clienta = split( /\./, $CLIENT ); $CLIENT = $clienta[0]; my $hostname_s; my @test_plans = <*>; my $ssd_val = 0; if ( $auto_manual == 2 ) { if ( @test_plans > 0 ) { my @ert_test; my @nor_test; my @ssd_test; print "The following test suite were found:\n\n"; foreach my $test_plan (@test_plans) { if ( ( $test_plan =~ /^ERT/ ) ) { # print BOLD, BLUE, "########## ERT TEST SUITES ##########\n"; # print BOLD, BLUE, "$test_plan \n", RESET; push( @ert_test, $test_plan ); } elsif ( ( $test_plan =~ /SSD/ ) ) { # print BOLD, BLUE, "########## SSD Durability TEST SUITES ##########\n"; # print BOLD, BLUE, "$test_plan \n", RESET; push( @ssd_test, $test_plan ); $ssd_val = 1; } else { # print BOLD, BLUE, "############ HDD TEST SUITES ############\n"; # print BOLD, BLUE, "$test_plan \n", RESET; push( @nor_test, $test_plan ); } } ## end foreach my $test_plan (@test_plans) print BOLD, GREEN, "########## ERT TEST SUITES ##########\n"; foreach my $ert_suit (@ert_test) { print BOLD, MAGENTA, "$ert_suit\n", RESET; } print BOLD, GREEN, "########## SSD Durability TEST SUITES ##########\n"; foreach my $ssd_suit (@ssd_test) { print BOLD, MAGENTA, "$ssd_suit\n", RESET; } print BOLD, GREEN, "\n############ HDD TEST SUITES ############\n"; foreach my $norm_suit (@nor_test) { print BOLD, MAGENTA, "$norm_suit\n", RESET; } } else { print BOLD, YELLOW, "*** No test suite available ****\n\n", RESET; } } option_2_name: if ( !$ADD_TEST_CASES ) { if ( $auto_manual ne 2 ) { print BOLD, CYAN, <<'EOD', RESET; ------------------------------------------------------------------------------------------- As user selected auto test suite, Enter drive model string to be added in test suite name : Note: Press Enter to ignore adding drive model string ------------------------------------------------------------------------------------------- EOD while (1) { alarm $ALARM; $model_id = getchompstrip( "", '', "" ); $model_id = trim($model_id); if ( $model_id ne '' ) { print BOLD, GREEN, "\n User has selected drive model $model_id to be added \n", RESET; # $runlist = $runlist . "\_" . $threads; last; } else { last; } } print BOLD, CYAN, <<'EOD', RESET; ------------------------------------------------------------------------------------------- As user selected auto test suite, Enter firmware revision string to be added in test suite name : Note: Press Enter to ignore adding firmware revision string ------------------------------------------------------------------------------------------- EOD while (1) { alarm $ALARM; $fw_rev = getchompstrip( "", '', "" ); $fw_rev = trim($fw_rev); if ( $fw_rev ne '' ) { print BOLD, GREEN, "\n User has selected $fw_rev firmware revision string \n", RESET; # $runlist = $runlist . "\_" . $threads; last; } else { last; } } } else { print BOLD, CYAN, <<'EOD', RESET; Enter the name of the test suite to create To go back to the previous options press 'b' Enter 'help' for more information --------------------------------------------------------------- EOD my $back_t = 0; if ( $SSD_option == 1 ) { while (1) { my $runlist_c = getchompstrip( "", '', "" ); alarm $ALARM; $runlist_c = trim($runlist_c); if ( ( $runlist_c eq "b" ) || ( $runlist_c eq "B" ) ) { $result_option = 2; $back_t = 1; last; } $runlist = $runlist_c; if ( $runlist =~ /(help|HELP|Help)/ ) { print "If you enter test suite name as default_suite, \nthe actual test suite name will be SSD_default_suite"; } elsif ( $runlist =~ /[=\$\*,;\#]/ ) { oops('Characters "=" "$" "*" "," ";" "$" "#" not allowed'); } elsif ( !length($runlist) ) { oops('runlist must be nonempty'); } else { last; } } ## end while (1) $runlist = "SSD_" . $runlist; } else { while (1) { my $runlist_c = getchompstrip( "", '', "" ); alarm $ALARM; $runlist_c = trim($runlist_c); if ( ( $runlist_c eq "b" ) || ( $runlist_c eq "B" ) ) { $result_option = 2; $back_t = 1; last; } $runlist = $runlist_c; if ( $runlist =~ /(help|HELP|Help)/ ) { display_tc_info; } elsif ( $runlist =~ /[=\$\*,;\@\s]/ ) { oops('Characters "=" "$" "*" "," ";" "$" "#" "space" not allowed'); } elsif ( !length($runlist) ) { oops('runlist must be nonempty'); } else { last; } } ## end while (1) } next if ( $back_t == 1 ); } } $log_dir = ""; system('clear'); my $test_list = {}; my $file = ""; my $flag_test1 = 0; my @hparams; my @pohr; my $pohr_flag = 0; my @pohr_F; my @pohr_M; my @pohr_default; if ($ADD_TEST_CASES) { my ( $filer, $Image ); foreach my $line (@ADD_TEST_CASES) { if ( $line =~ /FILER=(\S+)/ ) { $filer = $1; } elsif ( $line =~ /CONVERT_TO=(\S+)/ ) { $Image = $1; } } my $date = `date`; my ( $day, $hr, $min, $sec ) = $date =~ /\S+\s*\S+\s*(\S+)\s*(\S+)\:(\S+)\:(\S+)/; $filer =~ s/\,/_/g; if ( $Image =~ /CMode/i ) { $runlist = "CONVERT_SETUP_test_case_" . $filer . "_" . "$day$hr$min$sec"; } else { $runlist = "IMAGE_INSTALL_test_case_" . $filer . "_" . "$day$hr$min$sec"; } push( @hparams, @ADD_TEST_CASES ); } # $log_dir = $runlist; # push( @hparams, "parallel dirname=$log_dir \{\n" ); my $flag = 0; $C_7_option = 2; =head while (1) { print BOLD, BLUE, <<'EOD', RESET; -------------------------------------------------------------- Which type of setup would you like to be execute. Select one of the options to continue 1 > 7 mode. 2 > C mode. Note: Default option is 7 mode. -------------------------------------------------------------- EOD while (1) { $option = getchompstrip( "", "", "" ); $option = trim($option); alarm $ALARM; if ( ( $option =~ /\d/ ) && ( $option <= 2 ) && ( $option >= 1 ) ) { $flag = 1; last; } elsif ( $option eq '' ) { $flag = 1; $option = 1; print BOLD, WHITE, "\nYou selected 7 mode.\n\n", RESET; last; } else { oops "Please enter correct value 1/2"; } } ## end while (1) if ( $flag == 1 ) { last; } } ## end while (1) #$C_7_option = $option; # Set Type of the Filer if ( $C_7_option == 2 ) { $option_TYPE = 'C_mode'; my $flag_k = 0; while (1) { print BOLD, BLUE, <<'EOD', RESET; -------------------------------------------------------------- Which type of Kernel image would you like to be boot. Select one of the options to continue 1 > FullSteam 2 > SierraNevada. Note: Default option is RollingRock. -------------------------------------------------------------- EOD while (1) { $option_k = getchompstrip( "", "", "" ); $option_k = trim($option_k); alarm $ALARM; if ( ( $option_k =~ /\d/ ) && ( $option_k <= 2 ) && ( $option_k >= 1 ) ) { $flag_k = 1; last; } elsif ( $option_k eq '' ) { $flag_k = 1; $option_k = 1; print BOLD, WHITE, "\nYou selected RfullsteamN.\n\n", RESET; last; } else { oops "Please enter correct value 1/2"; } } ## end while (1) if ( $flag_k == 1 ) { last; } } ## end while (1) } =cut $option_TYPE = 'C_mode'; $fc_br_option = $C_7_option; if ( $option_TYPE == '7_mode' ) { my $option; my @host_arr1; my $flag = 0; $fc_bm_option = 1; if ( $SSD_option == 1 ) { $fc_br_option = 2; $select = 1; } else { ##for FC if ( $select == 0 ) { $fc_br_option = 2; $FILER_TYPE = "BR"; } ## end if ($select == 0) } } ##end if ($option_TYPE == '7_mode') # Set Type of the Filer if ( $fc_br_option == 2 ) { $FILER_TYPE = 'BR'; $type_of_test = 2; $config = 2; } my $run_list_fixed; while (1) { my $host_select_all = 0; my $hostname; my @final_TC; my $custom_TC = 0; my $test_dir = ""; system('clear'); # if ($option_TYPE == '7_mode') { option_6b_test: if ( ( $SSD_option == 1 ) && ( $fc_br_option == 2 ) && ( ( $option_TYPE == '7_mode' ) || ( $option_TYPE == 'C_mode' ) ) ) { my $flag_k = 0; while (1) { print BOLD, CYAN, <<'EOD', RESET; -------------------------------------------------------------- Which type of Kernel image would you like to be boot. Select one of the options to continue 1 > Fullsteam. 2 > Longboard/Kalyaniblack Note: Default option is 1> Fullsteam. To go back press option 'b' -------------------------------------------------------------- EOD while (1) { $option_k = getchompstrip( "", "", "" ); $option_k = trim($option_k); alarm $ALARM; if ( ( $option_k =~ /(\d)/ ) && ( $option_k <= 2 ) && ( $option_k >= 1 ) ) { if ( $option_k == 1 ) { $kernel = "FS"; } elsif ( $option_k == 2 ) { $kernel = "LB"; } $flag_k = 1; last; } elsif ( $option_k eq '' ) { $flag_k = 1; $option_k = 1; print BOLD, WHITE, "\nYou selected Fullsteam.\n\n", RESET; last; } elsif ( $option_k =~ /^(b|B)$/ ) { goto option_2_name; next; } else { oops "Please enter correct value 1/2/b"; } } ## end while (1) if ( $flag_k == 1 ) { last; } } print BOLD, CYAN, <<'EOD', RESET; ----------------------------------------------------------------------- Select one of the following test types for SSD Durability 1 > Enter '1' for SAS Shelf - SAS SSD test 2 > Enter '2' for SAS Shelf - SATA SSD test To go back press 'b' Enter 'help' for more information ----------------------------------------------------------------------- EOD } else { =head print BOLD, CYAN, <<'EOD', RESET; ----------------------------------------------------------------------- Which kind of tests do you want to run? Select one of the following test configurations 1> Normal 2> Fixed setup Default is 2> Fixed setup ----------------------------------------------------------------------- EOD while (1) { $selection = getchompstrip( "", "", "" ); $selection = 2; if ( $selection =~ /^$/ ) { print BOLD, GREEN, "Default option i.e 2> Fixed setup type is selected\n", RESET; $selection = 2; last; } elsif ( $selection =~ /^(1|2)$/ ) { last; } else { oops "Please enter correct value 1/2"; } } =cut option_2_Kernel: $option_TYPE = 'C_mode'; my $flag_k = 0; while (1) { print BOLD, CYAN, <<'EOD', RESET; -------------------------------------------------------------- Which type of Kernel image would you like to be boot. Select one of the options to continue 1 > Fullsteam. 2 > Kalyaniblack/Harpoon/VR Note: Default option is 1> Fullsteam. To go back press option 'b' -------------------------------------------------------------- EOD while (1) { $option_k = getchompstrip( "", "", "" ); $option_k = trim($option_k); alarm $ALARM; if ( ( $option_k =~ /(\d)/ ) && ( $option_k <= 2 ) && ( $option_k >= 1 ) ) { if ( $option_k == 1 ) { $kernel = "FS"; } elsif ( $option_k == 2 ) { $kernel = "VR"; } $flag_k = 1; last; } elsif ( $option_k eq '' ) { $flag_k = 1; $option_k = 1; print BOLD, WHITE, "\nYou selected Fullsteam.\n\n", RESET; last; } elsif ( $option_k =~ /^(b|B)$/ ) { goto option_2_name; next; } else { oops "Please enter correct value 1/2/b"; } } ## end while (1) if ( $flag_k == 1 ) { last; } } option_2_types: print BOLD, CYAN, <<'EOD', RESET; ----------------------------------------------------------------------- Select one of the following test types 1 > Enter '1' for SAS Shelf - SAS HDD test 2 > Enter '2' for SAS Shelf - SATA HDD test 3 > Enter '3' for SAS Shelf - SATA SSD test 4 > Enter '4' for SCM Configuration test 5 > Enter '5' for SAS Shelf - SAS SSD test 6 > Enter '6' for Mixed SAS/BSAS Configuration test 7 > Enter '7' for FIPS Configuration test 8 > Enter '8' for Apollo - NVMe Drive test 9 > Enter '9' for Apollo-Tahiti - NVMeOF Shelf Enter 'help' for more information To go back to previous options press 'b' ----------------------------------------------------------------------- EOD } ## end else [ if ($fc_br_option == 1) $SATA_SETUP = "N"; $SSD = "N"; $SATA_SSD = "N"; #my $type_of_test = 0; while (1) { $type_of_test = getchompstrip( "", "", "" ); if ( ( $type_of_test =~ /^(b|B)$/ ) && ( $SSD_option == 1 ) ) { goto option_2_name; next; } if ( ( $type_of_test =~ /^(b|B)$/ ) && ( $SSD_option != 1 ) ) { goto option_2_Kernel; next; } if ( $SSD_option != 1 ) { $type_of_test = $type_of_test + 1; ##For delete the FC support from option 1 we have increment the value by 1 } alarm $ALARM; if ( $type_of_test =~ /(help|HELP|Help)/ ) { print BOLD, GREEN, " Select type of test cases, it is not possible to execute different\n", " type of tests on a same filer. You can execute different type of tests on different filers\n", RESET; } elsif ( ( $type_of_test <= 10 ) && ( $type_of_test >= 1 ) && ( $fc_br_option == 2 ) && ( $SSD_option != 1 ) ) { last; } elsif ( ( $type_of_test <= 2 ) && ( $type_of_test >= 1 ) && ( $SSD_option == 1 ) ) { last; } else { print BOLD, CYAN, oops "Please enter correct value "; } } ## end while (1) # For MINI DISKa if ( $fc_br_option == 2 ) { $tye_tst = $type_of_test - 1; $drive_type = "SAS_HDD" if ( $tye_tst == 1 ); $drive_type = "SATA_HDD" if ( $tye_tst == 2 ); $drive_type = "SATA_SSD" if ( $tye_tst == 3 ); $drive_type = "SCM" if ( $tye_tst == 4 ); $drive_type = "SAS_SSD" if ( $tye_tst == 5 ); $drive_type = "BSAS" if ( $tye_tst == 6 ); $drive_type = "FIPS" if ( $tye_tst == 7 ); $drive_type = "NVMe" if ( $tye_tst == 8 ); $drive_type = "Tahiti" if ( $tye_tst == 9 ); } if ( ( $Durability == 1 ) && ( ( $fc_br_option == 2 ) ) ) { $drive_type = "SAS_SSD"; } if ( $MINI_DISK_CREATE == 1 ) { #BR if ( $fc_br_option == 2 ) { if ( $type_of_test == 1 ) { $test_type = "SAS"; } elsif ( $type_of_test == 2 ) { $SATA_SETUP = "Y"; $test_type = "SAS"; } elsif ( $type_of_test == 3 ) { $armadillo = "1"; $test_type = "SCM"; } } } # For BR if ( ( $fc_br_option == 2 ) && ( $MINI_DISK_CREATE == 2 ) && ( $SSD_option != 1 ) ) { if ( $type_of_test == 1 ) { $SATA_SETUP = "Y"; $test_type = "FC"; } elsif ( $type_of_test == 5 ) { $armadillo = "1"; $test_type = "SCM"; } elsif ( $type_of_test == 2 ) { $test_type = "SAS"; } elsif ( $type_of_test == 3 ) { $SATA_SETUP = "Y"; $test_type = "SAS"; } elsif ( $type_of_test == 4 ) { $SSD = "Y"; $test_type = "SSD"; $SATA_SSD = "Y"; } elsif ( $type_of_test == 6 ) { $SSD = "YES"; $SAS = "Y"; $test_type = "SSD"; } elsif ( $type_of_test == 7 ) { $BSAS = "YES"; $SAS = "Y"; $test_type = "SAS"; $mixed_config = "1"; } elsif ( $type_of_test == 8 ) { $FIPS = "YES"; $test_type = "SAS"; $hybrid_aggr = "0"; } elsif ( $type_of_test == 9 ) { $NVMe = "YES"; $test_type = "NVMe"; } elsif ( $type_of_test == 10 ) { $Tahiti = "YES"; $test_type = "Tahiti"; } else { ; } } ## end if ($fc_br_option == 2) && ($MINI_DISK_CREATE == 2) && ($SSD_option != 1) # For IC if ( ( $fc_br_option == 1 ) && ( $MINI_DISK_CREATE == 2 ) ) { if ( $type_of_test == 1 ) { $test_type = "FC"; } elsif ( $type_of_test == 2 ) { $SATA_SETUP = "Y"; $test_type = "FC"; } elsif ( $type_of_test == 3 ) { $test_type = "SAS"; } elsif ( $type_of_test == 4 ) { $SATA_SETUP = "Y"; $test_type = "SAS"; } elsif ( $type_of_test == 5 ) { $SSD = "Y"; $test_type = "SSD"; $SATA_SSD = "Y"; } else { ; } } ## end if ($fc_br_option == 1) && ($MINI_DISK_CREATE == 2) # For SSD #if ((($SSD_option == 1) || ($ssd_val == 1)) && ($fc_br_option == 2)) if ( ( $SSD_option == 1 ) && ( $fc_br_option == 2 ) ) { if ( $type_of_test == 1 ) { $SSD = "Y"; $test_type = "SSD"; } elsif ( $type_of_test == 2 ) { $SSD = "Y"; $SATA_SETUP = "Y" if ( $Durability != 1 ); $test_type = "SSD"; } else { ; } } ## end if (($ssd_val == 1) && ($fc_br_option == 2)) { if ( $type_of_test == 5 ) { chdir("$Home/NDATE/TEST_SCRIPTS/$test_type") && last; oops "Not able to change location to directory:$Home/NDATE/TEST_SCRIPTS/$test_type"; } else { chdir("$Home/NDATE/TEST_SCRIPTS/$test_type") && last; oops "Not able to change location to directory:$Home/NDATE/TEST_SCRIPTS/$test_type"; } } #my $config = 0; #my $cluster_config = 0; if ( ( $SSD_option != 1 ) && ( $option_TYPE == '7_mode' ) ) { print BOLD, CYAN, <<'EOD', RESET; ----------------------------------------------------------------------- Select one of the following setup configuration for the test execution 1 > Enter '1' for running tests on Dual Path Config(D) 2 > Enter '2' for running tests on Cluster Config(C) Enter 'help' for more information ----------------------------------------------------------------------- EOD print BOLD, RED, <<'EOD', RESET; If you selected CLUSTER config: WARNING: 1. Make sure both filers are configured as a cluster. 2. Make sure all environmental varaibles(partner-sysid, ic-type) are set or re-set respectively. 3. Configuration and both filers have the same. 4. Ontap release before you start any NDATE cluster tests. EOD #my $config = 0; #my $cluster_config = 0; while (1) { $config = getchompstrip( "", "", "" ); alarm $ALARM; if ( $config =~ /(help|HELP|Help)/ ) { print BOLD, GREEN, " Cluster test needs minimum 2 filers. Make sure to create 2 filers\n", " before executing cluster tests\n", RESET; } elsif ( ( $config <= 2 ) && ( $config >= 1 ) ) { last; } else { oops "Please enter correct value 1-2/help"; } } ## end while (1) if ( $config == 2 ) { $cluster_config = "C"; } else { $cluster_config = "D"; } } else { $config = 1; $cluster_config = "D"; } #system('clear'); # } ##end if ($option_TYPE == '7_mode') if ( $option_TYPE == 'C_mode' ) { my $flag = 0; print "\n"; print BOLD, GREEN, <<'EOD', RESET; --------------------------------------------------------------------------------------- As user has seleced CMODE, test will be executing on both Nodes based on the Test-type --------------------------------------------------------------------------------------- EOD $flag = 1; $path_option = 2; $config = $path_option; $cluster_config = "E"; } #if ( $option_TYPE == 'C_mode' ) #CHECK FOR FIPS and enable OKM if ( $FIPS eq 'YES' ) { my $Home = $ENV{HOME}; my $OKM_file = "$Home/NDATE/SUPPORT_FILES/OKM"; print BOLD, YELLOW, "\nUser Selected FIPS mode, On-board key manager will be configured,\n\n", RESET; print BOLD, YELLOW, "Enter the cluster-wide passphrase for onboard key management :\n", RESET; print BOLD, CYAN, "\tNOTE: passphrase should be of type alphanumeric of size 32..256\n", RESET; print BOLD, CYAN, "\tPress \"b\" for previosu menu, help for more infomration\n\n", RESET; print BOLD, YELLOW, "\tPRE_DEFINED PASS-PHRASE WILL BE USED FROM OKM CONFIG FILE - < $OKM_file >\n", RESET; my $pass_phrase; open( OKMFILE, "$OKM_file" ); my @pass_str = ; close OKMFILE; foreach my $line (@pass_str) { if ( $line =~ /(\S+)\=(\S+)/ ) { $pass_phrase = $2; print BOLD, YELLOW, "\t\t\nPASSPHRASE - $pass_phrase will be used for On-board key Manager\n", RESET; } else { print BOLD, RED, "OKM configuration file or mandatory pass-phrase cannot be found, Create OKM file under -$OKM_file\n", RESET; } } while (1) { #comment as of now, later need to modify as user input. #burt1030259 # $pass_phrase = getchompstrip( "", "", "" ); alarm $ALARM; if ( $type_of_test =~ /^(b|B)$/ ) { goto option_2_types; } if ( $pass_phrase =~ /(help|HELP|Help)/ ) { print BOLD, GREEN, " Passphrase should be alphanumeric (abcd1234) and length of te passphrase shoudl be 32 to 256\n", RESET; } if ( $pass_phrase ne "" ) { print BOLD, GREEN, "\t\nValidating passphrase .....\n\n", RESET; loader_start_end(); my $count = $pass_phrase =~ tr/a-zA-Z0-9/a-zA-Z0-9/; if ( ( $count >= 32 ) && ( $count <= 256 ) ) { print BOLD, GREEN, "\tPassphrase - $pass_phrase. meets requirements, Proceeding with next steps\n", RESET; # my $Home = $ENV{HOME}; # my $dir = "$Home/NDATE/SUPPORT_FILES"; # system("sudo mkdir -p $dir "); # my $OKM_file = "$Home/NDATE/SUPPORT_FILES/OKM"; # system("sudo touch $OKM_file"); # system("sudo chmod 777 $OKM_file"); # open( OKMFILE, ">> $OKM_file" ); # print OKMFILE "OKM_PASS=$pass_phrase"; sleep 2; last; } else { print BOLD, RED, "\tPassphrase DO NOT MEET requirements, Please re-enter passphrase ( alphanumeric of sixe 32..256)\n", RESET; } } else { print BOLD, RED, "\tEnter Passphrase to proceed, As selected test option is FIPS\n", RESET; } } } $custom_TC = 1; my @arr1; my $arr1_ssd; my @arr_maint; my @arr_file; my @arr_user; my @all_testcases; my @all_testcases_ssd; while (1) { my $tc_added = 0; if ( $SSD_option != 1 ) { print BOLD, GREEN, <<'EOD'; ------------------------------------------------ Available test cases are: EOD } my @test_scripts = <*.thpl>; my $TC_no = 0; my %TC_with_no; my $runlist_info_file; my $Mode_type_var; if ( $option_TYPE =~ /7_mode/i ) { $Mode_type_var = '7MODE'; } else { $Mode_type_var = 'CMODE'; } if ( ( $armadillo eq '2' ) && ( $MINI_DISK_CREATE eq '2' ) && ( $SATA_SETUP eq 'Y' ) && ( $NVMe eq 'NO' ) && ( $Tahiti eq 'NO' ) ) { $runlist_info_file = "$Home/NDATE/TEST_SCRIPTS/SAS/test_details_SATA_HDD"; } elsif ( ( $armadillo eq '2' ) && ( $MINI_DISK_CREATE eq '2' ) && ( $BSAS eq 'N' ) && ( $SATA_SETUP eq 'N' ) && ( $FIPS eq 'NO' ) && ( $SSD eq 'N' ) && ( $NVMe eq 'NO' ) && ( $Tahiti eq 'NO' ) ) { $runlist_info_file = "$Home/NDATE/TEST_SCRIPTS/SAS/test_details_SAS_HDD"; } elsif ( ( $armadillo eq '2' ) && ( $MINI_DISK_CREATE eq '2' ) && ( $BSAS eq 'N' ) && ( $SATA_SETUP eq 'N' ) && ( $FIPS eq 'NO' ) && ( $SSD eq 'Y' ) && ( $Durability == 1 ) && ( $Tahiti eq 'NO' ) ) { $runlist_info_file = "$Home/NDATE/TEST_SCRIPTS/SSD/test_details_ssd_durability_CMODE"; $selection = 1; open( FILE, "$runlist_info_file" ) or die ">>>>> read: Failed opening $runlist_info_file <<<<<"; my @tests = ; close FILE; foreach my $line (@tests) { $line =~ s/^\s+|\s+$//g; if ( $line =~ /^(\d+)\s*\:\s*(\S+)\s*\:/ ) { $Run_ID = $1; $DurabilityFile = $2; } } } elsif ( ( $armadillo eq '2' ) && ( $MINI_DISK_CREATE eq '2' ) && ( $BSAS eq 'N' ) && ( $SATA_SETUP eq 'N' ) && ( $FIPS eq 'NO' ) && ( $SSD eq 'Y' ) && ( $NVMe eq 'NO' ) && ( $Tahiti eq 'NO' ) ) { $runlist_info_file = "$Home/NDATE/TEST_SCRIPTS/SSD/test_details_SATA_SSD"; } elsif ( ( $armadillo eq '1' ) && ( $MINI_DISK_CREATE eq '2' ) && ( $BSAS eq 'N' ) && ( $SATA_SETUP eq 'N' ) && ( $FIPS eq 'NO' ) && ( $SSD eq 'N' ) && ( $NVMe eq 'NO' ) && ( $Tahiti eq 'NO' ) ) { $runlist_info_file = "$Home/NDATE/TEST_SCRIPTS/SCM/test_details_SCM"; } elsif ( ( $armadillo eq '2' ) && ( $MINI_DISK_CREATE eq '2' ) && ( $BSAS eq 'N' ) && ( $SATA_SETUP eq 'N' ) && ( $FIPS eq 'NO' ) && ( $SSD eq 'YES' ) && ( $NVMe eq 'NO' ) && ( $Tahiti eq 'NO' ) ) { $runlist_info_file = "$Home/NDATE/TEST_SCRIPTS/SSD/test_details_SAS_SSD"; } elsif ( ( $armadillo eq '2' ) && ( $MINI_DISK_CREATE eq '2' ) && ( $BSAS eq 'YES' ) && ( $SATA_SETUP eq 'N' ) && ( $FIPS eq 'NO' ) && ( $SSD eq 'N' ) && ( $NVMe eq 'NO' ) && ( $Tahiti eq 'NO' ) ) { $runlist_info_file = "$Home/NDATE/TEST_SCRIPTS/SAS/test_details_BSAS"; } elsif ( ( $armadillo eq '2' ) && ( $MINI_DISK_CREATE eq '2' ) && ( $BSAS eq 'N' ) && ( $SATA_SETUP eq 'N' ) && ( $FIPS eq 'YES' ) && ( $SSD eq 'N' ) && ( $NVMe eq 'NO' ) && ( $Tahiti eq 'NO' ) ) { $runlist_info_file = "$Home/NDATE/TEST_SCRIPTS/SAS/test_details_FIPS"; } elsif ( ( $armadillo eq '2' ) && ( $MINI_DISK_CREATE eq '2' ) && ( $BSAS eq 'N' ) && ( $SATA_SETUP eq 'N' ) && ( $NVMe eq 'YES' ) && ( $SSD eq 'N' ) && ( $FIPS eq 'NO' ) && ( $Tahiti eq 'NO' ) ) { $runlist_info_file = "$Home/NDATE/TEST_SCRIPTS/NVMe/test_details_NVme"; } elsif ( ( $armadillo eq '2' ) && ( $MINI_DISK_CREATE eq '2' ) && ( $BSAS eq 'N' ) && ( $SATA_SETUP eq 'N' ) && ( $NVMe eq 'NO' ) && ( $SSD eq 'N' ) && ( $FIPS eq 'NO' ) && ( $Tahiti eq 'YES' ) ) { $runlist_info_file = "$Home/NDATE/TEST_SCRIPTS/Tahiti/test_details_Tahiti"; } #print "$armadillo | $MINI_DISK_CREATE | $BSAS | $SATA_SETUP|$FIPS|$SSD|$NVMe|$Tahiti\n"; if ( $selection != 1 ) { ( $run_list_fixed = $runlist_info_file ) =~ s/test_details/test_details_FIXED/; if ( !( -e $run_list_fixed ) ) { print BOLD, RED, "Test details page $run_list_fixed not available, Please check manually\n", RESET; exit; } } my @entire_data; # print" test case details $runlist_info_file"; fixed: if ( defined $run_list_fixed ) { $FIXED_MODE_TEST = 1; $runlist_info_file = $run_list_fixed; open( FILE, "$runlist_info_file" ) or die ">>>>> read: Failed opening $runlist_info_file <<<<<"; my @tests = ; close FILE; print BOLD, GREEN, "Available test-case under different groups are\n\n", RESET; foreach my $line (@tests) { $line =~ s/^\s+|\s+$//g; if ( $line =~ /^(\d+)\s*\:\s*(\S+)\s*\:/ ) { print BOLD, MAGENTA, "$1 ", RESET; print BOLD, MAGENTA "$2", RESET; print "\n"; } elsif ( $line =~ /Comment|Available in later release/ ) { print BOLD, YELLOW, "$line\n", RESET; } else { print BOLD, CYAN, "$line\n", RESET; } } # grep{print BOLD, CYAN,"$_",RESET}@tests; my ( @groups, @lines, %group_hash ); foreach (@tests) { if ( $_ =~ /(GROUP\s+(\S+).*)/ ) { $group_hash{$2} = $1; push( @groups, $2 ); push( @lines, $1 ); } } print BOLD, CYAN, <<'EOD', RESET; -------------------------------------------------------------------------------------------------------------- Please select the required group from which you want to select test-cases, Below are the available groups -------------------------------------------------------------------------------------------------------------- EOD grep { print BOLD, MAGENTA, "$_ > $group_hash{$_}\n", RESET } sort { $a <=> $b } keys %group_hash; print BOLD, CYAN, <<'EOD', RESET; -------------------------------------------------------------------------------------------------------------- Please select any one group Number to view the test-case present under that group Ex: 1 or 2 (To go back to the previous options press 'b') -------------------------------------------------------------------------------------------------------------- EOD my $flag; while (1) { $group = getchompstrip( "", "", "" ); if ( ( $group =~ /^(b|B)$/ ) && ( $SSD_option != 1 ) ) { goto option_2_types; next; } $group =~ s/^(\s+|\s+)$//g; foreach (@groups) { if ( $_ =~ /^$group$/ ) { $flag = $group; last; } } $STAND_ALONE = 0; $STAND_ALONE_COUNT = 1; if ( ( $group_hash{$flag} =~ /- STAND ALONE SCRIPTS - DEBUG/ ) && ($FIXED_MODE_TEST) ) { $STAND_ALONE = 1; } my $data = join( "\n", @tests ); my @pieces = split( "GROUP", $data ); foreach (@pieces) { if ( $_ =~ /$flag\s+\-/ ) { foreach my $line ( split( "\n", $_ ) ) { $line =~ s/^\s+|\s+//g; push( @entire_data, "$line" . "\n" ) if ( ( $line =~ /\.thpl/ ) && ( $line =~ /\S/ ) ); } # print BOLD, BLUE,"Test-cases available under selected group are\n $_\n",RESET; last; } } if ( !( scalar @entire_data ) ) { print BOLD, RED, "\n No Test-Cases available under group : $flag, Please select the other group\n", RESET; print BOLD, CYAN, <<'EOD', RESET; -------------------------------------------------------------------------------------------------------------- Please select any one group Number to view the test-case present under that group Ex: 1 or 2 -------------------------------------------------------------------------------------------------------------- EOD next; } else { # print "\n some data is there \n"; } if ( defined $flag ) { print BOLD, GREEN, "Test-cases present under the group : $flag are listed below, Please select the test-cases\n\n", RESET; print BOLD, CYAN, "===================================================\n", RESET; print BOLD, CYAN, "$group_hash{$flag}\n", RESET; print BOLD, CYAN, "===================================================\n", RESET; $GROUP_NO = $flag; ($KERNEL_TYPE) = $group_hash{$flag} =~ /(\S+)\s*\-\s*KERNEL/i; last; } else { print BOLD, RED, "**************************************************************************************************************************\n", RESET; print BOLD, RED, " Selected group does not exist, Please select the correct group from $groups[0] to $groups[-1] as shown above\n", RESET; print BOLD, RED, "**************************************************************************************************************************\n", RESET; # grep{print BOLD, BLUE,"$_\n",RESET;}@groups; } } } else { open( H_RUNINFO, "< $runlist_info_file " ) or die ">>>>> read: Failed opening $runlist_info_file <<<<<"; @entire_data = ; close H_RUNINFO; } foreach my $line (@entire_data) { if ( $line =~ /^\#/ ) { next; # skip overall result report starting with a '#' or new line. } my @Test_script = split( ":", $line ); if ( ( $Test_script[0] =~ /^\d+$/ ) || ( $Test_script[0] =~ /^\d+\w+$/ ) ) { $TC_no++; $TC_with_no{ $Test_script[0] } = { name => $Test_script[1], mode => $Test_script[2], sup_setup => $Test_script[3], }; if ( $SSD_option != 1 ) { if ( defined $GROUP_NO ) { print BOLD, MAGENTA, "$Test_script[0]" . "." . "$Test_script[1]\n", RESET; } else { print BOLD, MAGENTA, "$Test_script[0]" . "." . "$Test_script[1]" . " : $Test_script[2] " . " : $Test_script[3] " . " : $Test_script[4]", RESET; } } # To display in the same order while selecting the 'all' if ( $Test_script[1] =~ /NADQ02_SSD_Durability_Test/ ) { $arr1_ssd = $Test_script[1]; push( @path_options, 1 ); } else { push( @all_testcases, $Test_script[1] ); } } elsif ( $SSD_option != 1 ) { if ( $Test_script[0] =~ /info/ ) { print BOLD, CYAN, "$Test_script[1]", RESET; } } else { } } ## end foreach my $line () %TC_NAME = %TC_with_no; select_again: if ( $SSD_option != 1 ) { print BOLD, CYAN, <<'EOD', RESET; ------------------------------------------------------------------------ Enter the number or name of the test cases using 'comma' as a separator OR enter "all" for all the test cases. 'all' option is not allowed for GROUP 6 Example : 101, 103, NADQ02_FC_POHR.thpl : all - For all the test cases ------------------------------------------------------------------------ EOD $temp_list = getchompstrip( "", '', "" ); alarm $ALARM; my $setup_selected; if ( $config == 2 ) { $setup_selected = 'Cluster'; } else { $setup_selected = 'Duel'; } my ( $setup_1, $setup_2 ); if ( ( $config == 2 ) && ( $option_TYPE eq '7_mode' ) ) { $setup_1 = 'C'; $setup_2 = 'D'; } elsif ( ( $config == 2 ) && ( $option_TYPE eq 'C_mode' ) ) { $setup_1 = 'C'; $setup_2 = 'C'; } elsif ( ( $config == 1 ) && ( $option_TYPE eq 'C_mode' ) ) { $setup_1 = 'A'; #$setup_2 = 'C'; } else { $setup_1 = 'A'; #$setup_2 = 'D'; $setup_2 = 'B'; } my ( $setup_t, @setup_arr ); $temp_list = trim($temp_list); =head Burt No: 1221244 : sags ############################### Check for multiple entry of a test case ############# my @check_unique1 = split( /,/, $temp_list ); my @check_unique2 = _unique(@check_unique1); if ( scalar @check_unique1 != scalar @check_unique2 ) { print BOLD, RED, "*********************************************************************************************************", RESET; print BOLD, RED, "\n Multiple entry of a single test case is not allowed, Please select again \n", RESET; print BOLD, RED, "*********************************************************************************************************\n", RESET; goto select_again; } =cut #################################################################################### $OPTIONS_FLOW = $temp_list; my @arr2 = split( /,/, $temp_list ); @arr2 = _unique(@arr2); #if($GROUP_NO); my @not_found; foreach my $num (@arr2) { my $file = $TC_with_no{$num}->{name}; if ( !( -e "$Home/NDATE/TEST_SCRIPTS/$test_type\/$file" ) ) { push( @not_found, $file ); print BOLD, RED, "\n Could not find the test-script $file under $test_type \n", RESET; } } if (@not_found) { print BOLD, RED, "*********************************************************************************************************", RESET; print BOLD, RED, "\n Please check the correct test-cases and select again \n", RESET; print BOLD, RED, "*********************************************************************************************************\n", RESET; goto select_again; } $test_count = @arr2; gettestcount($test_count); my $arr_size = keys(%TC_with_no); %local_TC = {}; %local_TC = %TC_with_no; if ( $temp_list =~ /(ALL|all|All)/ ) { #burt1031614 if ( $STAND_ALONE == 1 ) { print BOLD, RED, "'All' option is not allowed for GROUP 6 - STAND ALONE SCRIPTS. User can select only one test at a time.\n", RESET; goto select_again; } else { print "All test cases are selected \n"; } #@arr2 = <*.thpl>; @arr2 = @all_testcases; $test_count = @arr2; gettestcount($test_count); my @test_nos = keys(%TC_with_no); my @sorted_test_nos = sort @test_nos; my @arr3; foreach my $test_num (@sorted_test_nos) { push( @arr3, $TC_with_no{$test_num}->{name} ); } #foreach my $tc_no ( sort @arr2 ) { foreach my $tc_no (@arr3) { $tc_no = trim($tc_no); if ( $tc_no =~ /.*thpl/ ) { foreach my $val ( keys %TC_with_no ) { if ( $TC_with_no{$val}->{name} =~ /$tc_no/ ) { @setup_arr = split( /\//, $TC_with_no{$val}->{sup_setup} ); $setup_t = join( " ", @setup_arr ); # print"\n HIhihi $setup_t \n"; if ( !( ( $setup_t =~ /$setup_1/ ) || ( $setup_t =~ /$setup_2/ ) ) ) { print BOLD, GREEN, "\n------------------------------------------------------- \n"; print " $TC_with_no{$val}->{name} test is only for setup: $setup_t and cannot be included for $setup_selected testing\n"; print " Not included in this test suite \n"; print "------------------------------------------------------- \n", RESET; next; } ## end if (!(($setup_t =~ /$setup_1/... push( @arr_user, $tc_no ); if ( ( $option_TYPE == 'C_mode' ) && ( $TC_with_no{$tc_no}->{name} =~ /NADQ02_SAS_POHR/ ) ) { # if ( $option_TYPE == 'C_mode' ) while (1) { print BOLD, CYAN, <<'EOD', RESET; ----------------------------------------------------------------------------------- please selet the mode on which you would like to execute NADQ02_SAS_POHR.thpl: 1. CLI 2. MAINTENANCE Note: Default option is 1. CLI ----------------------------------------------------------------------------------- EOD while (1) { $option = getchompstrip( "", "", "" ); $option = trim($option); alarm $ALARM; if ( ( $option =~ /\d/ ) && ( $option <= 2 ) && ( $option >= 1 ) ) { $flag = 1; last; } elsif ( $option eq '' ) { $flag = 1; $option = 1; print BOLD, WHITE, "\nYou selected Default option 1. CLI\n\n", RESET; last; } else { oops "Please enter correct value 1/2"; } } ## end while (1) if ( $option == 1 ) { push( @Filer_mode, 'F' ); push( @arr_file, $tc_no ); $ems_parser_exec = 1; $tc_added++; push( @pohr_F, " POHR_Cmode=F" ); push( @pohr_default, " POHR_Cmode=F" ); } elsif ( $option == 2 ) { push( @arr_maint, $tc_no ); $tc_added++; push( @pohr_M, " POHR_Cmode=M" ); push( @pohr_default, " POHR_Cmode=M" ); } if ( $flag == 1 ) { last; } } ## end while (1) } else { if ( $TC_with_no{$val}->{mode} =~ /ainte/ ) { push( @Filer_mode, 'M' ); push( @arr_maint, $tc_no ); $tc_added++; } else { push( @Filer_mode, 'F' ); push( @arr_file, $tc_no ); $ems_parser_exec = 1; $tc_added++; } } } ## end if ($TC_with_no{$val}->... } ## end foreach my $val (keys %TC_with_no) } ## end if ($tc_no =~ /.*thpl/) } ## end foreach my $tc_no (@arr2) last; } else { my ( $cmode_flag, $cmode_flag1, $i ) = ( 0, 0, 0 ); my @total_tests = keys %TC_with_no; foreach my $tc_no (@arr2) { $tc_no = trim($tc_no); if ( ( ( $tc_no =~ /^\d+$/ ) || ( $tc_no =~ /^\d+\w+$/ ) ) && ( ( $tc_no > 0 ) ) ) { if ( !length( $TC_with_no{$tc_no}->{name} ) ) { print BOLD, RED, "*********************************************************************************************************\n", RESET; print BOLD, RED, "Test case no does not exists: $tc_no, Please select the numbers within the group selected\n", RESET if ( defined $run_list_fixed ); print BOLD, RED, "Test case no does not exists: $tc_no, Please select the correct test-cases with in the range\n", RESET if ( !defined $run_list_fixed ); print BOLD, RED, "*********************************************************************************************************\n", RESET; # @arr2=(); goto select_again; } } } foreach my $tc_no (@arr2) { $tc_no = trim($tc_no); if ( ( ( $tc_no =~ /^\d+$/ ) || ( $tc_no =~ /^\d+\w+$/ ) ) && ( ( $tc_no > 0 ) ) ) { if ( !length( $TC_with_no{$tc_no}->{name} ) ) { print BOLD, RED, "Test case no does not exists: $tc_no \n", RESET; # @arr2=(); goto select_again; } else { @setup_arr = split( /\//, $TC_with_no{$tc_no}->{sup_setup} ); $setup_t = join( " ", @setup_arr ); $cmode_flag = $setup_t if ( $i > 0 ); if ( $option_TYPE =~ /C_mode/ ) { $i++; if ( $cmode_flag1 !~ /$cmode_flag/ ) { print BOLD, RED, "\n------------------------------------------------------- \n"; print " $TC_with_no{$tc_no}->{name} test is only for setup $setup_t and cannot be included for $setup_selected testing\n"; print " Not included in this test suite \n"; print "------------------------------------------------------- \n", RESET; sleep 3; next; } if ( $setup_t =~ /A/ ) { $cmode_flag = 'A'; push( @path_options, 1 ); } else { $cmode_flag = 'C'; } $cmode_flag1 = $cmode_flag; $config = 1; $cluster_config = "E"; } elsif ( !( ( $setup_t =~ /$setup_1/ ) || ( $setup_t =~ /$setup_2/ ) ) ) { print BOLD, GREEN, "\n------------------------------------------------------- \n"; print " $TC_with_no{$tc_no}->{name} test is only for setup $setup_t and cannot be included for $setup_selected testing\n"; print " Not included in this test suite \n"; print "------------------------------------------------------- \n", RESET; next; } ## end if (!(($setup_t =~ /$setup_1/... push( @arr_user, $TC_with_no{$tc_no}->{name} ); if ( ( $option_TYPE == 'C_mode' ) && ( ( $TC_with_no{$tc_no}->{name} =~ /NADQ02_SAS_POHR/ ) || ( $TC_with_no{$tc_no}->{name} =~ /NADQ02_SSD_POHR/ ) ) ) { while (1) { print BOLD, CYAN, <<'EOD', RESET; ----------------------------------------------------------------------------------- please selet the mode on which you would like to execute NADQ02_SAS_POHR.thpl: 1. CLI 2. MAINTENANCE Note: Default option is 1. CLI ----------------------------------------------------------------------------------- EOD while (1) { $option = getchompstrip( "", "", "" ); $option = trim($option); alarm $ALARM; if ( ( $option =~ /\d/ ) && ( $option <= 2 ) && ( $option >= 1 ) ) { $flag = 1; last; } elsif ( $option eq '' ) { $flag = 1; $option = 1; print BOLD, GREEN, "\nYou selected Default option 1. CLI\n\n", RESET; last; } else { oops "Please enter correct value 1/2"; } } ## end while (1) if ( $option == 1 ) { push( @Filer_mode, 'F' ); push( @arr_file, $TC_with_no{$tc_no}->{name} ); $ems_parser_exec = 1; $tc_added++; push( @pohr_F, " POHR_Cmode=F" ); push( @pohr_default, " POHR_Cmode=F" ); } elsif ( $option == 2 ) { push( @Filer_mode, 'M' ); push( @arr_maint, $TC_with_no{$tc_no}->{name} ); $tc_added++; push( @pohr_M, " POHR_Cmode=M" ); push( @pohr_default, " POHR_Cmode=M" ); } if ( $flag == 1 ) { last; } } ## end while (1) } else { if ( $TC_with_no{$tc_no}->{mode} =~ /ainte/ ) { $Filer_mode = 'M'; push( @Filer_mode, $Filer_mode ); push( @arr_maint, $TC_with_no{$tc_no}->{name} ); $tc_added++; } else { $Filer_mode = 'F'; push( @Filer_mode, $Filer_mode ); push( @arr_file, $TC_with_no{$tc_no}->{name} ); $ems_parser_exec = 1; $tc_added++; } } } ## end else [ if (!length($TC_with_no... } elsif ( $tc_no =~ /.*thpl/ ) { foreach my $val ( keys %TC_with_no ) { if ( $TC_with_no{$val}->{name} =~ /$tc_no/ ) { @setup_arr = split( /\//, $TC_with_no{$val}->{sup_setup} ); $setup_t = join( " ", @setup_arr ); if ( !( ( $setup_t =~ /$setup_1/ ) || ( $setup_t =~ /$setup_2/ ) ) ) { print BOLD, GREEN, "\n------------------------------------------------------- \n"; print " $TC_with_no{$val}->{name} test is only for setup: $setup_t and cannot be included for $setup_selected testing\n"; print " Not included in this test suite \n"; print "------------------------------------------------------- \n", RESET; next; } ## end if (!(($setup_t =~ /$setup_1/... push( @arr_user, $tc_no ); if ( ( $option_TYPE == 'C_mode' ) && ( $TC_with_no{$tc_no}->{name} =~ /NADQ02_SAS_POHR/ ) ) { while (1) { print BOLD, CYAN, <<'EOD', RESET; ----------------------------------------------------------------------------------- please selet the mode on which you would like to execute NADQ02_SAS_POHR.thpl: 1. CLI 2. MAINTENANCE Note: Default option is 1. CLI ----------------------------------------------------------------------------------- EOD while (1) { $option = getchompstrip( "", "", "" ); $option = trim($option); alarm $ALARM; if ( ( $option =~ /\d/ ) && ( $option <= 2 ) && ( $option >= 1 ) ) { $flag = 1; last; } elsif ( $option eq '' ) { $flag = 1; $option = 1; print BOLD, GREEN, "\nYou selected Default option 1. CLI\n\n", RESET; last; } else { oops "Please enter correct value 1/2"; } } ## end while (1) if ( $option == 1 ) { push( @Filer_mode, 'F' ); push( @arr_file, $TC_with_no{$tc_no}->{name} ); $ems_parser_exec = 1; $tc_added++; push( @pohr_F, " POHR_Cmode=F" ); push( @pohr_default, " POHR_Cmode=F" ); } elsif ( $option == 2 ) { push( @Filer_mode, 'M' ); push( @arr_maint, $TC_with_no{$tc_no}->{name} ); $tc_added++; push( @pohr_M, " POHR_Cmode=M" ); push( @pohr_default, " POHR_Cmode=M" ); } if ( $flag == 1 ) { last; } } ## end while (1) } else { if ( $TC_with_no{$val}->{mode} =~ /ainte/ ) { $Filer_mode = 'M'; push( @Filer_mode, $Filer_mode ); push( @arr_maint, $tc_no ); $tc_added++; } else { $Filer_mode = 'F'; push( @Filer_mode, $Filer_mode ); push( @arr_file, $tc_no ); $ems_parser_exec = 1; $tc_added++; } } } ## end if ($TC_with_no{$val}->... } ## end foreach my $val (keys %TC_with_no) } else { print BOLD, RED, " Not a numeric value or entered number does not exists in the test list: Test case no selected - $tc_no \n or test case does not exists: Test case selected : $TC_with_no{$tc_no} \n", RESET; } } ## end foreach my $tc_no (@arr2) #burt1031614 if ( ( $tc_added >= 2 ) && ( $STAND_ALONE == 1 ) ) { print BOLD, RED, "User cannot select more than one test in GROUP 6 : STAND ALONE\n", RESET; @arr_file = (); $tc_added = 0; goto select_again; } if ( $tc_added > 0 ) { last; } print "\n**********************************************************************************************************"; print BOLD, RED, "\nNo test case selected. Please enter valid inputs\n", RESET; print "**********************************************************************************************************\n"; sleep 3; } ## end else [ if ($temp_list =~ /(ALL|all|All)/) } else { last; } ## else if ($SSD_option != 1) } ## end while (1) if ( ( @arr_maint > 0 ) && ( @arr_file > 0 ) ) { my $test_order = 0; if ( $option_TYPE eq '7_mode' ) { print BOLD, CYAN, <<'EOD', RESET; Select order of testing 1 - Execute all Maintenance tests first then File System tests 2 - Execute all File System tests first then Maintenance tests 3 - User selected order Enter 'help' for more information EOD #my $test_order = 0; while (1) { $test_order = getchompstrip( "Default ", "", "3" ); alarm $ALARM; if ( $test_order =~ /(help|HELP|Help)/ ) { print("Efficient way to execute the test suite\n"); } elsif ( ( $config <= 3 ) && ( $config >= 1 ) ) { last; } else { oops "Please enter correct value 1-3/help"; } } ## end while (1) if ( $test_order == 1 ) { @arr1 = ( @arr_maint, @arr_file ); } elsif ( $test_order == 2 ) { @arr1 = ( @arr_file, @arr_maint ); } else { @arr1 = (@arr_user); } } else { print BOLD, CYAN, <<'EOD', RESET; Select order of testing 1 - Execute all Maintenance tests first then File System tests 2 - Execute all File System tests first then Maintenance tests Enter 'help' for more information EOD while (1) { $test_order = getchompstrip( "Default ", "", "2" ); alarm $ALARM; if ( $test_order =~ /(help|HELP|Help)/ ) { print("Efficient way to execute the test suite\n"); } elsif ( ( $config <= 2 ) && ( $config >= 1 ) ) { last; } else { oops "Please enter correct value 1-2/help"; } } ## end while (1) } $test_order_c = $test_order; ##test_order_c hold the 1.maint and 2.file if ( $test_order == 1 ) { @arr1 = ( @arr_maint, @arr_file ); @pohr = ( @pohr_M, @pohr_F ); $Filer_mode = 'M'; } elsif ( $test_order == 2 ) { @arr1 = ( @arr_file, @arr_maint ); @pohr = ( @pohr_F, @pohr_M ); $Filer_mode = 'F'; } else { if ( $Filer_mode[0] == "" ) { $Filer_mode = 'F'; } else { $Filer_mode = 'F'; } @arr1 = (@arr_user); @pohr = (@pohr_default); } } elsif ( $SSD_option == 1 ) { my $flag_frequency_14_19 = 0; my $flag_total_no_day = 0; push( @arr1, $arr1_ssd ); if ( $arr1_ssd =~ /NADQ02_SSD_Durability_Test/ ) { print BOLD, CYAN, <<'EOD', RESET; -------------------------------------------------------------------------------------------- Please indicate the number of times per day that the durability data needs to be collected : To go back press 'b' Note: Default option is 1 time. -------------------------------------------------------------------------------------------- EOD while (1) { $frequency_14_19 = getchompstrip( "", "", "" ); $frequency_14_19 = trim($frequency_14_19); alarm $ALARM; if ( ( $frequency_14_19 =~ /\d/ ) && ( $frequency_14_19 >= 1 ) ) { $flag_frequency_14_19 = 1; } elsif ( $frequency_14_19 eq '' ) { $flag_frequency_14_19 = 1; $frequency_14_19 = 1; print BOLD, WHITE, "\nYou are selecting the default value 1.\n\n", RESET; } elsif ( $frequency_14_19 =~ /^(b|B)$/ ) { goto option_6b_test; next; } else { oops "Please enter correct value i.e, >1"; } if ( $flag_frequency_14_19 == 1 ) { last; } } print BOLD, CYAN, <<'EOD', RESET; ------------------------------------------------------------------------------------------------------ Please indicate the number of days would you like the durability test to continue running : Note: **Default option is 1 day. **Each day the durability data will be collected for the number of times the user has selected above **Filersio will be running in the background for the entire duration selected ------------------------------------------------------------------------------------------------------ EOD while (1) { $total_no_day = getchompstrip( "", "", "" ); $total_no_day = trim($total_no_day); alarm $ALARM; if ( ( $total_no_day =~ /\d/ ) && ( $total_no_day >= 1 ) ) { $flag_total_no_day = 1; } elsif ( $total_no_day eq '' ) { $flag_total_no_day = 1; $total_no_day = 1; print BOLD, WHITE, "\nYou are selecting the default value 1.\n\n", RESET; } else { oops "Please enter correct value i.e, >1"; } if ( $flag_total_no_day == 1 ) { last; } } } } else { @arr1 = (@arr_user); foreach my $Same_Filer_mode (@Filer_mode) { if ( $Same_Filer_mode eq 'M' ) { $Filer_mode = 'M'; @pohr = (@pohr_default); } else { $Filer_mode = 'F'; @pohr = (@pohr_default); } } } ## Adding for mini disk burt# # my $check_mini; my @mini_test_ary; my @normal_test; foreach (@arr1) { if ( ( $_ =~ /PwrCyc|NSSR/ ) || ( $_ =~ /Hot_Plug_Removal/ ) ) { $check_mini = 1; push( @mini_test_ary, $_ ); } else { push( @normal_test, $_ ); } } if ( ( $check_mini == 1 ) && ( !$GROUP_NO ) ) { my $mini_order = 0; if ( @normal_test > 0 ) { print BOLD, CYAN, <<'EOD', RESET; Default Mini disk Creation test has been selected, Select the order of test to execute 1 - Execute Mini disk creation tests first then normal tests 2 - Execute Normal tests first and then mini disk creation tests Enter 'help' for more information EOD $mini_order = 0; while (1) { $mini_order = getchompstrip( "Default ", "", "1" ); alarm $ALARM; if ( $mini_order =~ /(help|HELP|Help)/ ) { print("To avoid multiple booting of filer, select an option to save time.\n"); } elsif ( ( $config <= 2 ) && ( $config >= 1 ) ) { last; } else { oops "Please enter correct value 1-3/help"; } } } if ( $mini_order == 1 ) { @arr1 = ( @mini_test_ary, @normal_test ); } elsif ( $mini_order == 2 ) { @arr1 = ( @normal_test, @mini_test_ary ); } } #Mini disk optio n END -BURT# End ##getting user sequence of test as entered by the user my ( @FIANL, @OPTIONS ); foreach my $nam ( split( /\,/, $OPTIONS_FLOW ) ) { push( @OPTIONS, $TC_NAME{$nam}->{name} ); } foreach my $fil (@OPTIONS) { foreach my $fil2 (@arr1) { if ( $fil eq $fil2 ) { push( @FIANL, $fil ); next; } } } @arr1 = @FIANL if ( $OPTIONS_FLOW !~ /ALL/i ); #@arr1 = uniq(@arr1); Burt No: 1221244 : sags foreach my $file (@arr1) { if ( $file =~ /^([^\'\"]).*[\'\"]$/s ) { warning("Extraneous text precedes quoted string: $file"); } elsif ( $file =~ /^[\'\"].*[^\'\"]$/s ) { warning("Extraneous text follows quoted string: $file"); } elsif ( !( -e $file ) ) { print BOLD, RED, "******* test case file does not exists $file ****** Please select again\n", RESET; goto select_again; } else { push( @final_TC, $file ); push( @FINAL_TC_Exe, $file ) unless grep { $_ =~ /$file/ } @FINAL_TC_Exe; #Burt1037194 nmamatha print BOLD, GREEN, "Test case verified and selected $file \n", RESET; } } ## end foreach my $file (@arr1) { chdir("$Home/NDATE/FILER_INFO") && last; oops "Not able to change location to directory:$Home/NDATE/FILER_INFO"; } my @host_arr1; #my $flag = 0; =head if ($select == 0) { $fc_br_option = 1; $FILER_TYPE = "IC"; while(1) { print BOLD, BLUE, <<'EOD', RESET; -------------------------------------------------------------- Select Data ONTAP to continue 1 > For Ironcity. 2 > For Boilermaker or RollingRock. Note: Default option is IC(Ironcity). Note: Please ensure that if the password option is enabled on the filer ONTAP, please ensure that the filer configuration file is updated with the default password. EOD print BOLD, RED, " --------------------------------------------------------------- WARNING: 1. If you are running tests on ClUSTER configuration both Filers MUST be same type. 2. Do not add the different types of filers(IC/BR) to the test cases. For example: In case if you select the IC add the IC filers only. ---------------------------------------------------------------", RESET; while (1) { $option = getchompstrip("", "", ""); $option = trim($option); alarm $ALARM; if (($option =~ /\d/) && ($option <= 2) && ($option >= 1)) { $flag = 1; last; } else { oops "Please enter correct value 1/2"; } } ## end while (1) if ($flag == 1) { last; } } ## end while (1) $fc_br_option = $option; $select = 1; } # Set Type of the Filer if ($fc_br_option == 2) { $FILER_TYPE = 'BR'; } ############################################## =cut @hosts = <*>; my @hostfiles = (); $" = ","; # Distingish filers basing on the IC/BR %filer_types = display_ir_br_filers(@hosts); my @sorted = sort { $a cmp $b } %filer_types; foreach $_ (@sorted) { if ( $filer_types{$_} eq $FILER_TYPE ) { #print "$_ $filer_types{$_}\n"; #print "$FILER_TYPE - $_\n"; # This is to remove the non exists filers $filer_exits{$_} = $_; push( @hostfiles, $_ ); } ## end if ($filer_types{$_} eq... } ## end foreach $_ (sort { $a <=> $b... #@hostfiles = <*>; if ( !(@hostfiles) ) { print BOLD, YELLOW, "\n\n ****** No configuration files detected. Please create at least one host file before creating a test suite*******\n", RESET; exit(0); } else { if ( $option_TYPE == '7_mode' ) { print "\nAvailable filers for $FILER_TYPE:\n"; } elsif ( !$ADD_TEST_CASES ) { print "\nAvailable filers for CMode:\n"; } my %sort; foreach my $filer (@hostfiles) { if ( $filer =~ /(\S+)-(\d+)/ ) { $sort{$filer} = $1; } elsif ( $filer =~ /(^\d+)/ ) { $sort{$1} = "num"; } elsif ( $filer =~ /(\S+)/ ) { $sort{$filer} = $1; } } my @sorted; my $value = "num"; my @keys = grep { $sort{$_} eq $value } keys %sort; @keys = sort { $a <=> $b } @keys; foreach my $key (@keys) { push( @sorted, $key ); } my @keys = grep { $sort{$_} ne $value } keys %sort; my @values = grep { $_ ne $value } values %sort; @values = do { my %seen; grep { !$seen{$_}++ } @values; }; @values = sort (@values); foreach my $val (@values) { my @keys = grep { $sort{$_} eq $val } keys %sort; my @sortdone = sort { my ($aa) = $a =~ /.*-(.+)/; my ($bb) = $b =~ /.*-(.+)/; $aa <=> $bb; } @keys; foreach my $key (@sortdone) { push( @sorted, $key ); } } # @hostfiles = sort{$a cmp $b}@hostfiles; foreach my $hostfile (@sorted) { if ( ( $hostfile !~ /_IC/ ) && ( $hostfile !~ /_BR/ ) && ( !$ADD_TEST_CASES ) ) { print( BOLD, MAGENTA, "$hostfile \n", RESET ) if ( ( $hostfile ne $CLIENT ) && !( $hostfile =~ /FILERS_LIST/ ) && !( $hostfile =~ /FILERS_LIST_C/ ) ); } } } ## end else [ if (!(@hostfiles)) if ($ADD_TEST_CASES) { ## directly taking the filer names form option 9 #print("dumping". Dumper(%FILER_LIST)); my @keys = keys %{ $FILER_LIST{'filer'} }; @host_arr1 = split( ",", $FILER_LIST{'filer'}{ $keys[0] } ); @node = @host_arr1; # last; } elsif ( ( $config == 2 ) && ( $option_TYPE ne 'C_mode' ) ) { print <<"EOD"; .................................................................... Select one of the filer in the cluster setup Enter the name of the filer Example: FILERA .................................................................... EOD my $host_no = ""; while (1) { alarm $ALARM; $host_no = getchompstrip( "", '', "" ); if ( $host_no =~ /[=\$\*,;\#]/ ) { oops('Characters "=" "$" "*" "," ";" "$" "#" not allowed'); } elsif ( !length($host_no) ) { oops('filer name must be nonempty'); } elsif ( !( -e $host_no ) ) { print "******* filer file $host_no does not exists ****** \n"; } elsif ( !( exists( $filer_exits{$host_no} ) ) ) { print "******* filer file $host_no does not exists ****** \n"; print "******* filer you selected is different type(Ironcity/Boilermaker) ****** \n"; } else { my ( %host, $flag ); @host{@final_list} = 1; if ( exists( $host{$host_no} ) ) { print BOLD, RED, "You have already entered the filer name $host_no, Please choose the different filer****** \n", RESET; next; } push( @host_arr1, $host_no ); push( @final_list, $host_no ); print BOLD, GREEN, "Filer selected and verified $host_no", RESET; last; } } ## end while (1) } #end if ($config == 2) elsif ( $option_TYPE == 'C_mode' ) { print BOLD, GREEN, <<'EOD', RESET; ................................................................................ Select name of the filers, seperated by 'comma', on which you would like to execute the test The selected filers should part of the C-Mode setup Example : FILERA, FILERB, FILERC ................................................................................. EOD foreach my $option (@path_options) { if ( $option == 1 ) { $Primary_Flag = 1; print BOLD, GREEN, <<'EOD', RESET; Important: The first node selected will be assumed as the PRIMARY NODE for test execution. So, please enter the filer names seperated by comma accordingly Example: If the selection is: FilerA,FilerB : then the PRIMARY NODE will be assumed as:FilerA EOD } } my $select_filers = 0; while (1) { my $filer_same = 0; my $flag = 0; my $host_list = getchompstrip( "", '', "" ); alarm $ALARM; @host_arr2 = split( /,/, $host_list ); if ( $Primary_Flag == 1 ) { $Primary_Node = $host_arr2[0]; print BOLD, CYAN, "\n PRIMARY NODE selected by the user is : $Primary_Node\n\n", RESET; } my ( %host, $fla ); @host{@final_list} = 1; foreach (@host_arr2) { if ( exists( $host{$_} ) ) { print BOLD, RED, "You have already entered the filer name $_, Please choose the different filer****** \n", RESET; $fla = 1; } } if ( $fla == 1 ) { next; } my $no_host_arr2 = @host_arr2; my @host_arr_uniq = keys %{ { map { $_ => undef } @host_arr2 } }; my $no_host_arr_uniq = @host_arr_uniq; if ( $no_host_arr2 != $no_host_arr_uniq ) { $filer_same = 1; } foreach my $host_no (@host_arr2) { $host_no = trim($host_no); if ( $host_no =~ /[=\$\*,;\#]/ ) { oops('Characters "=" "$" "*" "," ";" "$" "#" not allowed'); last; } elsif ( !length($host_no) ) { oops('filer name must be nonempty'); } elsif ( !( -e $host_no ) ) { print BOLD, YELLOW, "******* filer file $host_no does not exists ****** \n", RESET; $flag = 1; } elsif ( !( exists( $filer_exits{$host_no} ) ) ) { print "******* filer file $host_no does not exists ****** \n"; print "******* filer you selected is different type(Ironcity/Boilermaker) ****** \n"; $flag = 1; } if ( $filer_same == 1 ) { oops('Both filers are same'); last; } else { push( @host_arr1, $host_no ); $select_filers++; } } ## end foreach my $host_no (@host_arr2) my $host_arr1 = @host_arr1; if ( $host_arr1 le 1 ) { print BOLD, CYAN, "For Cluster Setup You have to select more than 1 filer \n", RESET; print BOLD, RED, "Example : FILERA, FILERB\n\n", RESET; @host_arr1 = (); } elsif ( ( $flag eq 1 ) && ( $host_arr1 gt 1 ) ) { print BOLD, RED, "The filer selected does not have a filer config file. Either re-initiate ndate and create the filer config file for the desired filer, OR Please select from the above list of available filers \n", RESET; @host_arr1 = (); } else { print BOLD, GREEN, " Filer selected and verified @host_arr1 \n\n", RESET; push( @final_list, @host_arr1 ); @node = @host_arr1; last if ( $select_filers >= 1 ); } } ## end while (1) } #end elsif ( $option_TYPE == 'C_mode' ) else { print <<"EOD"; ................................................................................ Select name of the filers 'comma' as a separator on which you like to execute the Duel mode test cases OR enter "all" to select all filers Example : FILERA, FILERB, FILERC : all ................................................................................. EOD #my @host; my $select_filers = 0; while (1) { my $host_list = getchompstrip( "", '', "" ); alarm $ALARM; @host_arr2 = split( /,/, $host_list ); my $all_hosts = ""; my @unique = _unique(@host_arr2); my @diff = _array_diff( @host_arr2, @unique ); if (@diff) { print BOLD, RED, "you have entered the duplicate entries i,e @diff, Please re-enter again", RESET; next; } $all_hosts = $host_arr2[0]; trim($all_hosts); #push(@host,$all_hosts); if ( ( $all_hosts eq "ALL" ) || ( $all_hosts eq "all" ) || ( $all_hosts eq "All" ) ) { print "All Filers are selected \n"; foreach my $hostfile (@hostfiles) { push( @host_arr1, $hostfile ) if ( ( $hostfile ne $CLIENT ) && !( $hostfile =~ /FILERS_LIST/ ) ); $host_select_all = 1; $select_filers = 1; } } else { my ( %host, $flag ); @host{@final_list} = 1; foreach (@host_arr2) { if ( exists( $host{$_} ) ) { print BOLD, RED, "You have already entered the filer name $_, Please choose the different filer****** \n", RESET; $flag = 1; } } if ( $flag == 1 ) { next; } foreach my $host_no (@host_arr2) { $host_no = trim($host_no); if ( $host_no =~ /[=\$\*,;\#]/ ) { oops('Characters "=" "$" "*" "," ";" "$" "#" not allowed'); } elsif ( !length($host_no) ) { oops('filer name must be nonempty'); } elsif ( !( -e $host_no ) ) { print BOLD, YELLOW, "******* filer file $host_no does not exists ****** \n", RESET; } elsif ( !( exists( $filer_exits{$host_no} ) ) ) { print "******* filer file $host_no does not exists ****** \n"; print "******* filer you selected is different type(Ironcity/Boilermaker) ****** \n"; } else { push( @host_arr1, $host_no ); push( @final_list, $host_no ); $select_filers++; print BOLD, GREEN, " Filer selected and verified $host_no \n", RESET; } } ## end foreach my $host_no (@host_arr2) } ## end else [ if (($all_hosts eq "ALL"... last if ( $select_filers >= 1 ); } ## end while (1) } ## end else [ if ($config == 2) # Burt-1213019 khosur if ( $auto_manual ne 2 ) { my $filer_list = join( ",", @host_arr2 ) if (@host_arr2); my $filer_list = join( ",", @check ) if (@check); my $filer_list = join( ",", @node ) if (@node); if ( $filer_list =~ /(\w+)\-(\d+)\-(\d+)\-(\d+)\,(\w+)\-(\d+)\-(\d+)\-(\d+)/ ) { $filer_list =~ s/\,(\w+)\-(\d+)\-(\d+)//g; $filer_list =~ s/\-/\_/g; } $filer_list =~ s/\,\w+\-/\-/g; $filer_list =~ s/\-/\_/g; $filer_list =~ s/\,/\_/g; $type_of_test = $type_of_test - 1; my @test_list = split( ",", $temp_list ); my @test_list = split( ",", $temp_list ); if ( ( scalar @test_list > 1 ) && ( $temp_list =~ /^\d+\,/ ) ) { $runlist = "AT_" . $filer_list . "\_G" . $group . "_MULTI_TEST"; } elsif ( $temp_list =~ /(ALL|all|All)/ ) { $runlist = "AT_" . $filer_list . "\_G" . $group . "_ALL"; } else { if ( $fw_rev eq '' and $model_id eq '' ) { $runlist = "AT_" . $filer_list . "\_G" . $group . "\_" . "T" . $temp_list . "\_" . $kernel . '_' . $tye_tst; } elsif ( $fw_rev ne '' and $model_id eq '' ) { $runlist = "AT_" . $filer_list . "\_G" . $group . "\_" . "T" . $temp_list . "\_" . $fw_rev . "\_" . $kernel . '_' . $tye_tst; } elsif ( $fw_rev eq '' and $model_id ne '' ) { $runlist = "AT_" . $filer_list . "\_G" . $group . "\_" . "T" . $temp_list . "\_" . $model_id . "\_" . $kernel . '_' . $tye_tst; } else { $runlist = "AT_" . $filer_list . "\_G" . $group . "\_" . "T" . $temp_list . "\_" . $model_id . "\_" . $fw_rev . "\_" . $kernel . '_' . $tye_tst; } } } $log_dir = $runlist; push( @hparams, "parallel dirname=$log_dir \{\n" ); foreach $hostname (@host_arr1) { $hostname_s = $hostname; push( @hparams, " serial dirname=$hostname exit_on_errors=\"INSPECT\" \{\n" ); push( @hparams, " frequency_14_19=$frequency_14_19\n" ) if ( $SSD_option eq '1' ); push( @hparams, " total_no_day=$total_no_day\n" ) if ( $SSD_option eq '1' ); push( @hparams, " TEST_SETUP=FC\n" ) if ( $test_type eq 'FC' ); push( @hparams, " SATA_SETUP=Y\n" ) if ( $SATA_SETUP eq 'Y' ); push( @hparams, " TEST_SETUP=SAS\n" ) if ( $test_type eq 'SAS' ); push( @hparams, " SSD=Y\n" ) if ( ( $SSD eq 'Y' ) || ( $SSD eq 'YES' ) ); push( @hparams, " SATA_SSD=Y\n" ) if ( $SATA_SSD eq 'Y' ); push( @hparams, " TEST_SETUP=SAS\n" ) if ( $test_type eq 'SSD' ); push( @hparams, " ARMADILLO=$armadillo\n" ); push( @hparams, " MIXED_CONFIG=$mixed_config\n" ) if ( $BSAS == "YES" && $SAS == "Y" ); push( @hparams, " FIPS_SELECTED=YES\n" ) if ( $drive_type eq 'FIPS' ); push( @hparams, " SETUP_TYPE=7\n" ) if ( $option_TYPE eq '7_mode' ); push( @hparams, " SETUP_TYPE=C\n" ) if ( $option_TYPE eq 'C_mode' ); push( @hparams, " DRIVE_TYPE=$drive_type" ); my $node_cluster = ""; my $pri; if ( ( $config == 2 ) && ( $option_TYPE != 'C_mode' ) ) { #my @host_names = <*>; # Copy only the BR/IC only my @host_names = @hostfiles; if ( @host_names > 1 ) { ; } else { print BOLD, CYAN, "No configuration file available\n\n", RESET; } while (1) { print "\nPlease enter the partner node"; $node_cluster = getchompstrip( "", '', "" ); alarm $ALARM; if ( $node_cluster =~ /[=\$\*,;\#]/ ) { oops('Characters "=" "$" "*" "," ";" "$" "#" not allowed'); } elsif ( !length($node_cluster) ) { oops('hostname must be nonempty'); } elsif ( $node_cluster =~ /^$hostname$/ ) { oops('Both filers are same'); } elsif ( !( -e $node_cluster ) ) { oops('******* host file does not exists ******'); } elsif ( !( exists( $filer_exits{$node_cluster} ) ) ) { oops("******* filer file $node_cluster does not exists ******"); oops("******* filer you selected is different type(Ironcity/Boilermaker) ******"); } else { my %host; @host{@final_list} = 1; if ( exists( $host{$node_cluster} ) ) { print BOLD, RED, "You have already entered the filer name $node_cluster, Please choose the different filer****** \n", RESET; next; } push( @final_list, $node_cluster ); last; } } ## end while (1) } ## end if ( ( $config == 2 ) && ( $option_TYPE != 'C_mode' ) ) # For scripts 34,55,56,57 and 35 asks user for creating additional volumes if -b != 6 foreach $file (@final_TC) { # print BOLD, YELLOW,"SELECT THE OPTIONS FOR THE TEST $file",RESET; if ( ( $file =~ /_Raid_ReconstructionTime/ ) || ( $file =~ /_Raid_Recons_SickDiskCopy_Time/ ) || ( $file =~ /_Raid_ScrubTime/ ) || ( $file =~ /PwrCyc|NSSR/ ) || ( $file =~ /_Write_Cache_Integrity_Test/ ) ) { my $def_valu = 0; if ( ( $file =~ /PwrCyc|NSSR/ ) || ( $file =~ /_Write_Cache_Integrity_Test/ ) ) { $def_valu = 1; ##volume creation is must for this test-cases } #verifying the user input, if not already provided if ( ( ( $add_vol == 0 ) && ( ( $file =~ /_Raid_ReconstructionTime/ ) || ( $file =~ /_Raid_Recons_SickDiskCopy_Time/ ) || ( $file =~ /_Raid_ScrubTime/ ) ) && ( $hybrid_aggr == 0 ) ) && ( !$GROUP_NO ) ) { print BOLD, CYAN, "\n =========================================================================="; print BOLD, CYAN, "\n Would you like to create additional volumes? (y/n).\n The default value is - 'NO'"; print BOLD, RED, "\n This choice will be effective for the tests: Raid_ReconstructionTime and Raid_ScrubTime, whichever selected"; } ##end if ($add_vol == 0) if ( ( $write_add_vol == 0 ) && ( ( $file =~ /_PwrCyc|NSSR/ ) || ( $file =~ /_Write_Cache_Integrity_Test/ ) ) ) { my $len = rindex $file, '.thpl'; my $runid = substr( $file, 0, $len ); =head if ( $file =~ /_PwrCyc_FW_DL/i ) { if ( $flag_test1 == 0 ) { print BOLD, CYAN, "=========================================================================="; print "$runid : This test case needs upgraded disk firmware. \n\n FIRMWARE FILE SETUP REQUIREMENTS:\n ================================\n\n 1. Firmware files should have a naming convention like Product_Id.Revision_No.LOD \n Example: X299_HJUPI02TSSS.NAxx.LOD or X299_HJUPI02TSSS.NQxx.LOD.\n\n 2. Delete all firmware files in NDATE/FIRMWARE/DISKFW/HIGH.\n\n 3. Copy the firmware files to $Home/NDATE/FIRMWARE/DISKFW/HIGH location before running the test case.\n\n 4. NOTE: Please ensure that the user has copied '.NQ00.LOD' file in $Home/NDATE/FIRMWARE/DISKFW/HIGH directory.This file is mandatory for 'disk_fw_update -Q'\n ** Make sure only one firmware file is copied for each Product ID\n ** NAXX or NQXX version is recommended. Other version might not work properly.\n\n Example: Below there are 2 files with same PRODUCT ID 'X299_HJUPI02TSSS' which is not allowed:\n X299_HJUPI02TSSS.NA01.LOD\n X299_HJUPI02TSSS.NA02.LOD"; print "\n ========================================================================== \n", RESET; my @firmware = `cd $Home/NDATE/FIRMWARE/DISKFW/HIGH;ls *.LOD 2>/dev/null`; if ( @firmware < 1 ) { print BOLD, RED, "\nFirmware file not present in $Home/NDATE/FIRMWARE/DISKFW/HIGH location\n", RESET; print BOLD, RED, "\nPlease copy relevant firmware file to $Home/NDATE/FIRMWARE/DISKFW/HIGH directory before running the test case\n", RESET; my $path = "$Home/NDATE/FIRMWARE/DISKFW/HIGH"; add_fw_files($path); alarm $ALARM; #exit(0); } else { print BOLD, CYAN, "\n\nFollowing firmware files are available in the directory $Home/NDATE/FIRMWARE/DISKFW/HIGH\n", RESET; $" = "\t"; print BOLD, CYAN "========================================================================== \n"; print BOLD, CYAN, "\t@firmware\n\n"; disply_duplicates( [@firmware], "$Home/NDATE/FIRMWARE/DISKFW/HIGH" ); # print BOLD, CYAN, "Enter to continue", RESET; # getchompstrip("", '', ""); alarm $ALARM; } ## end else [ if (@firmware < 1) $flag_test1 = 1; } ## end if ($flag_test1 == 0) @node = join( ",", @node ); } ## end if (($file =~ /PwrCyc_FW_DL =cut if ( !$GROUP_NO ) { print BOLD, CYAN "\n =========================================================================="; print BOLD, CYAN "\n Would you like to create additional volumes? (y/n).The default value is - 'YES':.\n Volume creation is must for: PowerCycle_Test and Write_Cache_Integrity_Test.\n If you select the option as 'YES' please ensure the sufficient spare drives(minimum of 4) are available.\n Enter the option 'NO' only if the filer is already having flexible volumes other than root volume."; print BOLD, RED "\n This choice will be effective for the tests PwrCyc and Write_Cache_Integrity_Test, whichever selected"; } } ## end if (($write_add_vol ==... if ( ( ( $write_add_vol == 0 ) && ( ( $file =~ /PwrCyc|NSSR/ ) || ( $file =~ /_Write_Cache_Integrity_Test/ ) ) ) || ( ( $add_vol == 0 ) && ( ( $file =~ /_Raid_ReconstructionTime/ ) || ( $file =~ /_Raid_Recons_SickDiskCopy_Time/ ) || ( $file =~ /_Raid_ScrubTime/ ) ) ) ) { print # "\n ========================================================================== \n"; my $Vol_create; if ($GROUP_NO) { # print BOLD, MAGENTA,"\n GROUP TEST has been selected, So volumes will be created in check_filer_setup\n", RESET; } elsif ( $hybrid_aggr == 0 ) { while (1) { alarm $ALARM; $Vol_create = getchompstrip( "", '', "" ); $Vol_create = trim($Vol_create); if ( $Vol_create =~ /^\d+$/ ) { print BOLD, RED, " Entered value is numeric.Please enter (y/n)\n", RESET; } elsif ( $Vol_create =~ /^$/ ) { if ( $def_valu == 0 ) { print BOLD, CYAN, "\n Default value selected is 'NO'. The script will not create additional volumes\n", RESET; $Vol_create = "no"; } else { print BOLD, CYAN, "\n Default value selected is 'YES'.The script will create additional volumes\n", RESET; $Vol_create = "yes"; } push( @hparams, " VOL_CREATE_CHOICE=$Vol_create" ) if ( ( $file =~ /PwrCyc|NSSR/ ) || ( $file =~ /_Write_Cache_Integrity_Test/ ) ); push( @hparams, " VOL_CREATE_CHOICE_RAID=$Vol_create" ) if ( ( $file =~ /_Raid_ReconstructionTime/ ) || ( $file =~ /_Raid_Recons_SickDiskCopy_Time/ ) || ( $file =~ /_Raid_ScrubTime/ ) ); last; } elsif ( ( $Vol_create =~ /^y$/i ) || ( $Vol_create =~ /^yes$/i ) ) { $Vol_create = "yes"; push( @hparams, " VOL_CREATE_CHOICE=$Vol_create" ) if ( ( $file =~ /PwrCyc|NSSR/ ) || ( $file =~ /_Write_Cache_Integrity_Test/ ) ); push( @hparams, " VOL_CREATE_CHOICE_RAID=$Vol_create" ) if ( ( $file =~ /_Raid_ReconstructionTime/ ) || ( $file =~ /_Raid_Recons_SickDiskCopy_Time/ ) || ( $file =~ /_Raid_ScrubTime/ ) ); last; } elsif ( ( $Vol_create =~ /^n$/i ) || ( $Vol_create =~ /^no$/i ) ) { $Vol_create = "no"; push( @hparams, " VOL_CREATE_CHOICE=$Vol_create" ) if ( ( $file =~ /PwrCyc|NSSR/ ) || ( $file =~ /_Write_Cache_Integrity_Test/ ) ); push( @hparams, " VOL_CREATE_CHOICE_RAID=$Vol_create" ) if ( ( $file =~ /_Raid_ReconstructionTime/ ) || ( $file =~ /_Raid_Recons_SickDiskCopy_Time/ ) || ( $file =~ /_Raid_ScrubTime/ ) ); last; } else { print BOLD, RED, " Please enter again. Please enter (y/n)", RESET; } } ## end while (1) } else { $Vol_create = "yes"; push( @hparams, " VOL_CREATE_CHOICE=$Vol_create" ) if ( ( $file =~ /PwrCyc|NSSR/ ) || ( $file =~ /_Write_Cache_Integrity_Test/ ) ); push( @hparams, " VOL_CREATE_CHOICE_RAID=$Vol_create" ) if ( ( $file =~ /_Raid_ReconstructionTime/ ) || ( $file =~ /_Raid_Recons_SickDiskCopy_Time/ ) || ( $file =~ /_Raid_ScrubTime/ ) ); } #end of hybrid aggr if ( $Vol_create =~ "n" ) { print BOLD, CYAN, " Additional Volumes will not be created for the above selected RAID test \n", RESET if ( ( $file =~ /_Raid_ReconstructionTime/ ) || ( $file =~ /_Raid_Recons_SickDiskCopy_Time/ ) || ( $file =~ /_Raid_ScrubTime/ ) ); print BOLD, CYAN, " Additional Volumes will not be created for the above selected test\n", RESET if ( ( $file =~ /PwrCyc|NSSR/ ) || ( $file =~ /_Write_Cache_Integrity_Test/ ) ); } else { if ( ( $hybrid_aggr == 1 ) ) { print BOLD, CYAN, " Hybrid Aggregate option has been selected,\n", RESET; } print BOLD, CYAN, " Additional Volumes will be created for the above selected RAID test \n", RESET if ( ( $file =~ /_Raid_ReconstructionTime/ ) || ( $file =~ /_Raid_Recons_SickDiskCopy_Time/ ) || ( $file =~ /_Raid_ScrubTime/ ) ); print BOLD, CYAN, " Additional Volumes will be created for the above selected test\n", RESET if ( ( ( $file =~ /PwrCyc|NSSR/ ) || ( $file =~ /_Write_Cache_Integrity_Test/ ) ) && ( !$GROUP_NO ) ); } ## end else [ if ($Vol_create =~ "n") $add_vol = 1 if ( ( $file =~ /_Raid_ReconstructionTime/ ) || ( $file =~ /_Raid_Recons_SickDiskCopy_Time/ ) || ( $file =~ /_Raid_ScrubTime/ ) ); # $write_add_vol = 1 # if ( ($file =~ /PwrCyc/) # || ($file =~ /_Write_Cache_Integrity_Test/)); } ## end if ((($write_add_vol ==... } ## end if (($file =~ /_Raid_ReconstructionTime/... } ## end foreach $file (@final_TC) # For the test script no:37 the user will be prompted to enter the choice of generating the trace files foreach $file (@final_TC) { if ( $file =~ /_IO_ResponseT/ ) { #Adding a user defined parameter to introduce a choice whether the user wants to generate #the trace files through the script print BOLD, CYAN, "\n ========================================================================== \n"; print "\n $file : Please enter yes/no if the user wants the script to generate the trace files.\n The default value is - NO:\n"; print "\n ========================================================================== \n"; my $IO_choice; while (1) { alarm $ALARM; $IO_choice = getchompstrip( "", '', "" ); $IO_choice = trim($IO_choice); if ( $IO_choice =~ /^\d+$/ ) { print BOLD, RED, " Please enter yes/y/no/n"; } elsif ( $IO_choice =~ /^$/ ) { print BOLD, CYAN, "\n Default selected. The script will not produce the trace files\n"; $IO_choice = "n"; push( @hparams, " IO_TRACE_CHOICE=$IO_choice" ); last; } elsif ( ( $IO_choice =~ /^y$/ ) || ( $IO_choice =~ /^yes$/ ) ) { $IO_choice = "y"; push( @hparams, " IO_TRACE_CHOICE=$IO_choice" ); last; } elsif ( ( $IO_choice =~ /^n$/ ) || ( $IO_choice =~ /^no$/ ) ) { $IO_choice = "n"; push( @hparams, " IO_TRACE_CHOICE=$IO_choice" ); last; } else { print BOLD, RED, " Please enter again. Please enter yes/y/no/n"; } } ## end while (1) if ( $IO_choice =~ "n" ) { print BOLD, CYAN, "\n The IO_ResponseT script will not create trace logs \n"; } else { print BOLD, CYAN, "\n The IO_ResponseT script create trace logs \n"; } if ( $runpyth == 1 ) { set_python_path(); } #Adding a user defined parameter to introduce th product ID to test the script on specific drives print BOLD, GREEN, "\n ========================================================================== \n"; print "\n $file : The following is used to select drives to execute the test: \n"; print BOLD, GREEN, "\n ========================================================================== \n"; print "\n 1) If your system has mixed drive models, would you like to select a particular model #, or \n 2) Would like the test to assume the drive model at run time to be tested on the system (Default)\n"; my ( $choice, $pro_id ); while (1) { alarm $ALARM; $choice = getchompstrip( "", '', "" ); $choice = trim($choice); if ( ( $choice =~ /^$/ ) || ( $choice == 2 ) ) { print BOLD, CYAN, "\n Default selected. The script will select the drives randomly\n"; $pro_id = "N"; push( @hparams, " MODEL_ID=$pro_id" ); last; } elsif ( $choice == 1 ) { print "\n Please enter the model number of the drives: "; $pro_id = getchompstrip( "", '', "" ); $pro_id = trim($pro_id); if ( $pro_id =~ /^$/ ) { print BOLD, CYAN, "\n Default selected. The script will select the drives randomly\n"; $pro_id = "N"; push( @hparams, " MODEL_ID=$pro_id" ); last; } else { push( @hparams, " MODEL_ID=$pro_id" ); last; } } else { print BOLD, RED, "\n Please enter the correct choice\n Please select your choice: "; } } ## end while (1) } ## end if ($file =~ /_IO_ResponseT/) ##burt#644256 changes start(create minidisks by def for Test#55 and Test#57) if ( $file =~ /PwrCyc|NSSR/ ) { $MINI_DISK_CREATE = 1; } ##burt#644256 changes end if ( $file =~ /WAF_Test/ ) { print BOLD, YELLOW, "\n WAF_Test will execute infinitely, User need to manually stop the execution by stopping associated process ID\n"; } if ( $file =~ /Multi_Stream_Wrt/ ) { my $flag_ch = 0; $flag_ch = 1 if ( $file =~ /with_Temp/ ); print BOLD, GREEN, ".................................................................................\n"; print BOLD, GREEN, "You can execute this test on user selected single spare drive or on single random spare drive selected during runtime\n"; print BOLD, GREEN, "\nSelect one of the options to continue\n"; print BOLD, GREEN, " 1 > Enter '1' for executing this test on a user selected single spare drive\n"; print BOLD, GREEN, " 2 > Enter '2' for executing this test on single random spare drive selected during runtime\n\n"; print BOLD, YELLOW, "\t Default option is 2> Single random spare drive selected during runtime.\n"; print BOLD, GREEN, ".................................................................................\n"; while (1) { my $model = getchompstrip( "", "", "" ); alarm $ALARM; if ( $model =~ /(help|HELP|Help)/ ) { print BOLD, GREEN, "Multi stream test will be execute only on one spare drive, enter spare drive serial number or select default\n", RESET; } elsif ( $model == 1 ) { print BOLD, YELLOW, "\nYou have chosen $file to run on user selected single spare drive\n", RESET; print BOLD, YELLOW, "\nEnter Serial number of available spare drive on system\n", RESET; while (1) { my $model_d = getchompstrip( "", "", "" ); my $drv_serial_no = $model_d; if ( $drv_serial_no ne '' ) { print BOLD, WHITE, "\nUser entered serial number : $drv_serial_no\n\n", RESET; if ( $flag_ch == 0 ) { push( @hparams, "\n MSW_SERIAL_NO=$drv_serial_no\n" ); } else { push( @hparams, "\n MSW_SERIAL_NO_522=$drv_serial_no\n" ); } last; } else { print BOLD, RED, "\nEnter Serial number of available spare drive\n"; } } last; } elsif ( ( $model eq '' ) || ( $model == 2 ) ) { #$model = 2; print BOLD, WHITE, "\nYou have chosen to run on single random spare drive selected during runtime.\n\n", RESET; push( @hparams, "\n MSW_SERIAL_NO=RANDOM\n" ); last; } else { print BOLD, RED, "\nPlease enter correct value 1-2/help\n"; } } ## end while (1) } if ( $drive_type =~ /HDD$/ ) { if ( $file =~ /Port_Saturation/i ) { print BOLD, YELLOW, "\nYou have chosen to run the test on $drive_type\n", RESET; print BOLD, CYAN, "\n--------------------------------------------------------------"; print BOLD, CYAN, "\nEnter number of drives to execute Port Saturation test \n"; my $max_drives; while (1) { alarm $ALARM; $max_drives = getchompstrip( "", '', "" ); $max_drives = trim($max_drives); if ( $max_drives ne '' ) { print BOLD, GREEN, "\n Maximum number of drives user entered for Port Saturation Test = $max_drives\n", RESET; push( @hparams, " HDD_DRIVES=$max_drives\n" ); last; } else { print BOLD, RED, "\n Please enter number of drives to execute Port Saturation test \n", RESET; } } } } if ( $file =~ /NVMe_Cluster_Reboot_Power_Cli/i ) { print BOLD, YELLOW, "\nUser Selected NVMe_Cluster_Reboot_Power_Cli script, Thsi requires rpower to be configured\n", RESET; print BOLD, CYAN, "\nEnter number of power cycles to be performed\n", RESET; my ( $pwr_cycle, $sleep, $action, $filer_rpower, $rpower_full_path ); while (1) { alarm $ALARM; $pwr_cycle = getchompstrip( "", '', "" ); $pwr_cycle = trim($pwr_cycle); if ( $pwr_cycle eq '' ) { $pwr_cycle = 10; print BOLD, YELLOW, "\nDefault power cycle value : 10 selected \n", RESET; push( @hparams, " CYCLE=$pwr_cycle\n" ); last; } else { print BOLD, YELLOW, "\nPower cycle value - $pwr_cycle selected \n", RESET; push( @hparams, " CYCLE=$pwr_cycle\n" ); last; } } print BOLD, CYAN, "\nEnter Sleep time\n", RESET; print BOLD, YELLOW, "\t Default : 600 sec\n", RESET; while (1) { alarm $ALARM; $sleep = getchompstrip( "", '', "" ); $sleep = trim($sleep); if ( $sleep eq '' ) { $sleep = 600; print BOLD, YELLOW, "\nDefault sleep time value : 600 selected \n", RESET; push( @hparams, " SLEEP=$sleep\n" ); last; } else { print BOLD, YELLOW, "\nSleep time - $sleep selected \n", RESET; push( @hparams, " SLEEP=$sleep\n" ); last; } } print BOLD, CYAN, "\nSelect Action to perform\n", RESET; print BOLD, CYAN, "\t1.R-POWER\n", RESET; print BOLD, CYAN, "\t2.REBOOT\n", RESET; print BOLD, CYAN, "Default : power\n", RESET; while (1) { alarm $ALARM; $action = getchompstrip( "", '', "" ); $action = trim($action); if ( $action eq '' ) { $action = 'power'; print BOLD, YELLOW, "\nDefault action : rpower selected \n", RESET; push( @hparams, " ACTION=$action\n" ); last; } elsif ( $action == 1 ) { $action = 'power'; print BOLD, YELLOW, "\nPerform - $action selected \n", RESET; push( @hparams, " ACTION=$action\n" ); last; } elsif ( $action == 2 ) { $action = 'reboot'; print BOLD, YELLOW, "\nPerform - $action selected \n", RESET; push( @hparams, " ACTION=$action\n" ); last; } else { print BOLD, RED, "Enter 1 or 2 \n", RESET; } } print BOLD, CYAN, "\nEnter filer rpower value\n", RESET; print BOLD, CYAN, "\tExample : FILER_RPOWER=stor-2220-3a-3b.lab.netapp.com\n", RESET; while (1) { alarm $ALARM; $filer_rpower = getchompstrip( "", '', "" ); $filer_rpower = trim($filer_rpower); if ( $filer_rpower eq '' ) { print BOLD, RED, "\n Plesae enter mandatory filer rpower value\n", RESET; } else { print BOLD, CYAN, "\tFiler rpoower : $filer_rpower entered\n", RESET; push( @hparams, " FILER_RPOWER=$filer_rpower\n" ); last; } } print BOLD, CYAN, "\nEnter filer rpower full path \n", RESET; print BOLD, CYAN, "\tExample : /usr/software/utils/bin/rpower\n", RESET; while (1) { alarm $ALARM; $rpower_full_path = getchompstrip( "", '', "" ); $rpower_full_path = trim($rpower_full_path); if ( $rpower_full_path eq '' ) { print BOLD, RED, "\n Plesae enter mandatory filer rpower full path \n", RESET; } else { print BOLD, CYAN, "\tFiler rpoower full path : $rpower_full_path\n", RESET; push( @hparams, " FILER_RPOWER_FULL_PATH=$rpower_full_path\n" ); last; } } } if ( $file =~ /NVMe_Th_Disk_IO_Latency/ ) { print BOLD, CYAN, "\n--------------------------------------------------------------"; print BOLD, CYAN, "\nEnter drive SERIAL number to execute performance test \n"; my $user_serial_nu; while (1) { alarm $ALARM; $user_serial_nu = getchompstrip( "", '', "" ); $user_serial_nu = trim($user_serial_nu); if ( $user_serial_nu ne '' ) { print BOLD, CYAN, "\n Drive Serial number - $user_serial_nu\n"; push( @hparams, " USER_SERIAL_NO=$user_serial_nu\n" ); last; } else { print BOLD, RED, "\n Please enter drive SERIAL number \n"; } } } if ( $file =~ /Disk_IO_Latency/ && $file !~ /NVMe_Th_Disk_IO_Latency/ ) { print BOLD, CYAN, "\n--------------------------------------------------------------"; print BOLD, CYAN, "\nEnter drive SERIAL number to execute performance test \n"; #print BOLD, YELLOW, "\n\tTo Execute on all drives, enter \'all\' \n", RESET if ( $file =~ /NVMe/ ); my $user_serial_nu; while (1) { alarm $ALARM; $user_serial_nu = getchompstrip( "", '', "" ); $user_serial_nu = trim($user_serial_nu); if ( $user_serial_nu ne '' ) { print BOLD, CYAN, "\n Drive Serial number - $user_serial_nu\n"; push( @hparams, " USER_SERIAL_NO=$user_serial_nu\n" ); last; } else { print BOLD, RED, "\n Please enter drive SERIAL number \n"; } } } if ( $file =~ /NADQ02_SCM_\d+/ ) { print BOLD, CYAN, "\n--------------------------------------------------------------"; print BOLD, CYAN, "\n SCM config test script has been selected, User has option to seelcted pre-condition mode\n", RESET; my ( $usr_sel_pre, $sel_pre_cond ); while (1) { alarm $ALARM; print BOLD, CYAN, "\n What type of precondition would you prefer ?\n", RESET; print BOLD, CYAN, "\n\t Following are the choices:", RESET; print BOLD, CYAN, "\n\t 1) Random (4KB)", RESET; print BOLD, CYAN, "\n\t 2) Sequential (128KB)", RESET; print BOLD, CYAN, "\n\t 3) No precondition", RESET; $usr_sel_pre = getchompstrip( "", '', "" ); $usr_sel_pre = trim($usr_sel_pre); if ( $usr_sel_pre eq '' ) { print BOLD, RED, "\n\t Enter option 1, 2, or 3 \n", RESET; } elsif ( $usr_sel_pre == 1 ) { print BOLD, YELLOW, "\n\t User Selected Random (4KB) pre-condition option\n", RESET; $sel_pre_cond = "random"; push( @hparams, " USR_PRE_COND=$sel_pre_cond\n" ); last; } elsif ( $usr_sel_pre == 2 ) { print BOLD, YELLOW, "\n\t User Selected Sequential (128KB) pre-condition option\n", RESET; $sel_pre_cond = "sequential"; push( @hparams, " USR_PRE_COND=$sel_pre_cond\n" ); last; } elsif ( $usr_sel_pre == 3 ) { print BOLD, YELLOW, "\n\t User Selected NO pre-condition option\n", RESET; $sel_pre_cond = "none"; push( @hparams, " USR_PRE_COND=$sel_pre_cond\n" ); last; } else { print BOLD, RED, "\n\t Enter option 1, 2, or 3 \n", RESET; } } my ($runtime); print BOLD, CYAN, "\nEnter runtime of IO on SCM drive in seconds\n", RESET; while (1) { alarm $ALARM; print BOLD, CYAN, "\tDefault : 3600 seconds\n", RESET; $runtime = getchompstrip( "", '', "" ); $runtime = trim($runtime); if ( $runtime == '' ) { print BOLD, YELLOW, "\n\t Selected default 3600 sec i.e 1hr runtime\n", RESET; push( @hparams, " RUN_TIME=3600\n" ); last; } else { print BOLD, YELLOW, "\n\t Selected $runtime sec \n", RESET; push( @hparams, " RUN_TIME=$runtime\n" ); last; } } } if ( $file =~ /NADQ02_NVMe_Sys_PwrCyc_BMC_Loader|NADQ02_NVMe_Sys_PwrCyl_Rpow_Loader/ ) { my $user_sel_loop; push( @hparams, " SKIP_CHK_FIL_SET=YES\n" ); while (1) { print BOLD, CYAN, "\nTest NADQ02_NVMe_Sys_PwrCyc_BMC_Loader will be executed based on loop count", RESET; print BOLD, CYAN, "\n\t How many loop test should executed ?", RESET; print BOLD, CYAN, "\n\n\tPress Enter to select Default : 5 loops", RESET; print BOLD, CYAN, "\n ", RESET; alarm $ALARM; $user_sel_loop = getchompstrip( "", '', "" ); $user_sel_loop = trim($user_sel_loop); if ( $user_sel_loop eq '' ) { $user_sel_loop = 5; print BOLD, CYAN, "\n Default loop : $user_sel_loop selected \n\n", RESET; push( @hparams, " USER_LOOPS=$user_sel_loop\n" ); last; } else { print BOLD, CYAN, "\n Loop count $user_sel_loop selected \n\n", RESET; push( @hparams, " USER_LOOPS=$user_sel_loop\n" ); last; } } if ( $file =~ /NADQ02_NVMe_Sys_PwrCyl_Rpow_Loader/ ) { my ( $filer_rpower, $rpower_full_path ); print BOLD, CYAN, "\nEnter filer rpower value\n", RESET; print BOLD, CYAN, "\tExample : FILER_RPOWER=stor-2220-3a-3b.lab.netapp.com\n", RESET; while (1) { alarm $ALARM; $filer_rpower = getchompstrip( "", '', "" ); $filer_rpower = trim($filer_rpower); if ( $filer_rpower eq '' ) { print BOLD, RED, "\n Plesae enter mandatory filer rpower value\n", RESET; } else { print BOLD, CYAN, "\tFiler rpoower : $filer_rpower entered\n", RESET; push( @hparams, " FILER_RPOWER=$filer_rpower\n" ); last; } } print BOLD, CYAN, "\nEnter filer rpower full path, including rpower command \n", RESET; print BOLD, CYAN, "\tExample : /usr/software/utils/bin/rpower\n", RESET; while (1) { alarm $ALARM; $rpower_full_path = getchompstrip( "", '', "" ); $rpower_full_path = trim($rpower_full_path); if ( $rpower_full_path eq '' ) { print BOLD, RED, "\n Plesae enter mandatory filer rpower full path \n", RESET; } else { print BOLD, CYAN, "\tFiler rpoower full path : $rpower_full_path\n", RESET; push( @hparams, " FILER_RPOWER_FULL_PATH=$rpower_full_path\n" ); last; } } } } if ( $file =~ /NADQ02_NVMe_Th_Filer_SIO_Test/ ) { my ($runtime); while (1) { print BOLD, CYAN, "\nTahiti Filer sio IO script selected", RESET; print BOLD, CYAN, ", How long IO has to be executed? \n\n", RESET; print BOLD, YELLOW, "\tNote: Entered value should be in hours(minimum time is 1 hr)\n", RESET; print BOLD, CYAN, "\tDefault time is: 1 hr\n", RESET; print BOLD, CYAN, "\n ", RESET; alarm $ALARM; $runtime = getchompstrip( "", '', "" ); $runtime = trim($runtime); if ( $runtime eq '' ) { $runtime = 1; print BOLD, CYAN, "\n Default time: 1 hour is selected", RESET; print BOLD, CYAN, "\n filersio will be executed for $runtime hour", RESET; push( @hparams, " RUNTIME=$runtime\n" ); last; } else { if ( $runtime >= 1 ) { print BOLD, CYAN, "\n Filersio will be executed for $runtime hours", RESET; push( @hparams, " RUNTIME=$runtime\n" ); last; } else { print BOLD, CYAN, "\n Please Enter valid time for filersio", RESET; } } } } #BURT1243432 if ( $file =~ /NADQ02_NVMe_Th_Maint_Enum/ ) { my $loops; print BOLD, CYAN, "\n--------------------------------------------------------------"; print BOLD, CYAN, "\n How many loops test should execute: "; print BOLD, YELLOW, "\n\tDefault loop count : 10", RESET; while (1) { $loops = getchompstrip( "", '', "" ); $loops = trim($loops); print BOLD, CYAN, "\n--------------------------------------------------------------"; if ( $loops =~ /\d+/ ) { print BOLD, CYAN, "\nUser Entered loop count : $loops\n\n", RESET; push( @hparams, " LOOPS=$loops\n" ); last; } elsif ( $loops eq '' ) { print BOLD, CYAN, "\n Default value 10 selected ", RESET; push( @hparams, " LOOPS=$loops\n" ); last; } else { print BOLD, RED, "\nEnter only numbers", RESET; } } } ##Burt1242483 changes if ( $file =~ /Single_Drv_Fixed_IOPS/ ) { print BOLD, GREEN, ".................................................................................\n"; print BOLD, GREEN, "Enter Variables Required for test execution\n"; my ( $runtime, $quedep, $iocap ); print BOLD, YELLOW, "\nYou have chosen $file to run on user selected single spare drive\n", RESET; print BOLD, YELLOW, "\nEnter Serial number of available spare drive on system\n", RESET; while (1) { my $model_d = getchompstrip( "", "", "" ); my $drv_serial_no = $model_d; if ( $drv_serial_no ne '' ) { print BOLD, WHITE, "\nUser entered serial number : $drv_serial_no\n\n", RESET; push( @hparams, "\n MSW_SERIAL_NO=$drv_serial_no" ); last; } else { print BOLD, RED, "\nEnter Serial number of available spare drive\n"; } } while (1) { alarm $ALARM; print BOLD, YELLOW, "\t Enter runtime for disk latency command, Enter in minutes\n"; print BOLD, WHITE, "\t\tDefault : 150 seconds\n"; $runtime = getchompstrip( "", "", "" ); if ( $runtime eq '' ) { $runtime = 150; print BOLD, WHITE, "\n\tDefault value : 150 seconds selected\n"; push( @hparams, "\n RUNTIME=$runtime" ); last; } elsif ( $runtime !~ /^\d+/ ) { print BOLD, RED, "\nEnter only numbers\n"; } else { my $runtime_s = $runtime * 60; print BOLD, WHITE, "\n\tUser Entered $runtime_s seconds / $runtime minutes\n"; push( @hparams, "\n RUNTIME=$runtime_s" ); last; } } while (1) { alarm $ALARM; print BOLD, YELLOW, "\t Enter Que Depth for disk latency command\n"; print BOLD, WHITE, "\t\tDefault : 1 \n"; $quedep = getchompstrip( "", "", "" ); if ( $quedep eq '' ) { $quedep = 1; print BOLD, WHITE, "\n\tDefault value : $quedep selected\n"; push( @hparams, "\n QDEPT=$quedep" ); last; } elsif ( $quedep !~ /^\d+/ ) { print BOLD, RED, "\nEnter only numbers\n"; } else { print BOLD, WHITE, "\n\tUser Entered $quedep \n"; push( @hparams, "\n QDEPT=$quedep" ); last; } } while (1) { alarm $ALARM; print BOLD, YELLOW, "\t Enter IO Cap for disk latency command\n"; print BOLD, WHITE, "\t\tDefault : 12000 \n"; $iocap = getchompstrip( "", "", "" ); if ( $iocap eq '' ) { $iocap = 12000; print BOLD, WHITE, "\n\tDefault value : $iocap selected\n"; push( @hparams, "\n IOCAP=$iocap" ); last; } elsif ( $iocap !~ /^\d+/ ) { print BOLD, RED, "\nEnter only numbers\n"; } else { print BOLD, WHITE, "\n\tUser Entered $iocap \n"; push( @hparams, "\n IOCAP=$iocap" ); last; } } } if ( $file =~ /Client_IO/ ) { if ( $CLIENT_PARM_SET == 0 ) { print BOLD, CYAN, "\n--------------------------------------------------------------"; print BOLD, CYAN, "\nClient IO test has been selected, Checking client host file under $Home/NDATE/FILER_INFO\n", RESET; my ( $nos_of_drvs, $io_type, $nos_of_vols, $CLIENT_SELECTED ); while (1) { alarm $ALARM; print BOLD, CYAN, "\nEnter number of DRIVES to be used for creation of aggregate\n\tDefault Drive count : 5\n"; $nos_of_drvs = getchompstrip( "", '', "" ); $nos_of_drvs = trim($nos_of_drvs); if ( ( $nos_of_drvs < 4 ) && ( $nos_of_drvs ne '' ) ) { print BOLD, RED, "\nMinimum drive count should be 5\n"; } elsif ( $nos_of_drvs eq '' ) { print BOLD, CYAN, "\nDefault : 5 selected"; $nos_of_drvs = 5; push( @hparams, " CLNT_NUMBER_OF_DRVS_SELTD=$nos_of_drvs\n" ); last; } else { print BOLD, CYAN, "\nSelected total drive count "; push( @hparams, " CLNT_NUMBER_OF_DRVS_SELTD=$nos_of_drvs\n" ); last; } } while (1) { alarm $ALARM; print BOLD, CYAN, "\n\nEnter Drive Model ID to be used to create aggregate\n"; $modl_of_drv = getchompstrip( "", '', "" ); $modl_of_drv = trim($modl_of_drv); if ( $modl_of_drv ne '' ) { push( @hparams, " DRIVE_MOD_ID=$modl_of_drv\n" ); last; } else { print BOLD, RED, "\nEnter MODEL ID of drive"; } } while (1) { alarm $ALARM; print BOLD, CYAN, "\n\nAvaliable client host files are :\n"; my $dir = "$Home/NDATE/FILER_INFO"; my $output = `grep -r "CLIENT_HOST_FILE_NDATE" $dir`; my @lines = split( /\n/, $output ); my @clients; foreach my $line (@lines) { if ( $line =~ /(.*)\:(.*)/ ) { my $clientpath = $1; if ( $clientpath =~ /.*FILER_INFO\/(.*)/ ) { push( @clients, $1 ); } } } rechek: if (@clients) { my $i = 1; foreach my $clint_n (@clients) { print BOLD, YELLOW, "$i) $clint_n\n"; $i++; } print BOLD, CYAN, "\nSelect client name from above list\n"; print BOLD, CYAN, "\t Note: Enter corresponding number to select\n"; my $c_seletd = getchompstrip( "", '', "" ); $c_seletd = trim($c_seletd); if ( ( $c_seletd > scalar @clients ) || ( $c_seletd eq '' ) ) { print BOLD, CYAN, "Entered client is not available, Please slect valid number\n"; goto rechek; } else { print BOLD, CYAN, "Selected client is $clients[$c_seletd -1]\n"; $CLIENT_SELECTED = $clients[ $c_seletd - 1 ]; push( @hparams, " CLIENTS=$CLIENT_SELECTED\n" ); last; } } else { rechk_IP: print BOLD, YELLOW, "\n\nClient host file doesnt Exist, Enter corresponding values to create clietn host file\n"; print BOLD, CYAN, "\tEnter Client hostname (without domain)\n\tExample: johnny.lab.netapp.com is hostname, Enter: johnny\n"; my $hostname_c = getchompstrip( "", '', "" ); $hostname_c = trim($hostname_c); print BOLD, CYAN, "\tEnter default client IP \n"; my $c_ip = getchompstrip( "", '', "" ); $c_ip = trim($c_ip); if ( $c_ip !~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/ ) { print BOLD, RED, "\tEnter Valid IP\n"; goto rechk_IP; } else { print BOLD, CYAN, "\tClient default IP : $c_ip is enterd\n"; } print BOLD, CYAN, "\tEnter default client password \n"; my $c_pwd = getchompstrip( "", '', "" ); $c_pwd = trim($c_pwd); print BOLD, CYAN, "\tEnter default client username \n"; my $c_user = getchompstrip( "", '', "" ); $c_user = trim($c_user); my $hosttype_c = "unix-linux"; my $dir = "$Home/NDATE/FILER_INFO/"; my $selected_clnt_file = "$dir" . "$hostname_c"; open( CH_FILE, ">>$selected_clnt_file" ) || die "Can not open file $selected_clnt_file"; print CH_FILE "#CLIENT_HOST_FILE_NDATE#\n"; print CH_FILE "default_ip=$c_ip\ndefault_password=$c_pwd\ndefault_username=$c_user\nhosttype=unix-linux\nnfs_version=4\n"; print CH_FILE "conn rsh {connhost=$c_ip;conntype=rsh-persay;password=$c_pwd;timeout=54000;username=$c_user}\n"; print CH_FILE "conn ssh {connhost=$c_ip;conntype=libssh-persist;password=$c_pwd;username=$c_user}\n"; print CH_FILE "conn ssh {conntype=ssh-persist;connhost=$c_ip;username=$c_user;password=$c_pwd}\n"; print CH_FILE "conn c-login {conntype=ssh-persist;connhost=$c_ip;username=$c_user;password=$c_pwd}\n"; print CH_FILE "conn c-system {conntype=ssh-persist;connhost=$c_ip;username=$c_user;password=$c_pwd}\n"; print CH_FILE "conn c-system {initial_command=\"set -privilege test;systemshell -node local\"}\n"; print CH_FILE "conn c-system {prompt_password=$c_pwd}\n"; print CH_FILE "conn cli {prompt_password=$c_pwd}\n"; close(CH_FILE); last; } } while (1) { alarm $ALARM; print BOLD, CYAN, "\n\nTwo Logical Interface port and 20 Logical Interface ( LIF ) IP's are required, Enter Corresponding LIF details\n"; print BOLD, CYAN, "\tNote: Data port on Filer has to be used, Make sure port is UP, \n\n\tExample : e0j or e0d\n"; print BOLD, CYAN, "\tEnter Logical Interface Port 1 : \n"; my $lifport1 = getchompstrip( "", '', "" ); $lifport1 = trim($lifport1); if ( $lifport1 ne '' ) { print BOLD, CYAN, "\tEnter Logical Interface Port 2 :\n"; my $lifport2 = getchompstrip( "", '', "" ); $lifport2 = trim($lifport2); if ( $lifport2 ne '' ) { print BOLD, YELLOW, "Ports $lifport1 and $lifport2 will be used for creating lif\n"; push( @hparams, " LIF_PORT_1=$lifport1\n" ); push( @hparams, " LIF_PORT_2=$lifport2\n" ); print BOLD, CYAN, "\nEnter Subnet Mask for LIF IP's \n"; my $net_msk = getchompstrip( "", '', "" ); $net_msk = trim($net_msk); push( @hparams, " NET_MASK=$net_msk\n" ); last; } else { print BOLD, RED, "Enter ports to be used for creating LIF\n"; } } else { print BOLD, RED, "Enter ports to be used for creating LIF\n"; } } my $start_ip; my $end_ip; my $valid_ip = 0; my @LIF_IP; while (1) { REINT_1: alarm $ALARM; print BOLD, CYAN, "\n\n40 IP's are required to create LIF's , IP's are captured from $Home/NDATE/FILER_INFO/NDATE_LIF_CONFIG.config file \n"; print BOLD, CYAN, "\tNote: Two format - Range or Manual, Range should be in sequence"; my $format = "$Home/NDATE/FILER_INFO/NDATE_LIF_CONFIG.config"; print BOLD, CYAN, "\n\tEnter complete Path of LIF IP's config file, format available at $format\n"; my $liffile; while (1) { alarm $ALARM; $liffile = getchompstrip( "", '', "" ); $liffile = trim($liffile); if ( $liffile ne '' ) { print BOLD, YELLOW, "\n\n\tEntered Path - $liffile\n"; push( @hparams, " LIF_CONFIG_FILE=$liffile\n" ); last; } else { print BOLD, RED, "\n\n\t Enter Valid path of file which contains IP \n"; } } open( READ, "$liffile" ) || print BOLD, RED, "\tFAILED to get config file\n"; foreach my $line () { chomp($line); if ( $line =~ /START_IP_RANGE:(\S+)/ ) { $start_ip = $1; print "\n\tStarting range IP : $start_ip\n"; } if ( $line =~ /END_IP_RANGE:(\S+)/ ) { $end_ip = $1; print "\tEnding rang IP : $end_ip\n"; } } if ( ( $start_ip ne '' ) && ( $end_ip ne '' ) ) { print "\tFORMAT 1 - RANGE is specified, Generating IP between those range\n"; @LIF_IP = (); for ( my $i = 1 ; $i <= 40 ; $i++ ) { my ( $p1, $p2 ) = $start_ip =~ /(\d+\.\d+\.\d+)\.(\d+)/; my $ip = $p2 + $i; push( @LIF_IP, "$p1" . "." . "$ip" ); } } else { print "\tRange format is not valid, Proceeding with format 2 check\n"; @LIF_IP = (); open( READ, "$liffile" ) || print BOLD, RED, "\tFAILED to read the config file\n"; foreach my $line () { chomp($line); if ( $line =~ /IP_\d+\:(\S+)/ ) { print "IP Found - $1\n"; push( @LIF_IP, $1 ); } } } my $total_ip_cap = @LIF_IP; print BOLD, CYAN, "\n\t Total IP captured from config file : $total_ip_cap\n"; if ( $total_ip_cap < 40 ) { $valid_ip = 0; print BOLD, RED, "Open another session and modify config file, then press Enter \n"; my $ctr = getchompstrip( "", '', "" ); if ( $ctr ne '' ) { print BOLD, RED, "Press Enter ... \n"; } if ( $ctr eq '' ) { print BOLD, YELLOW, "Re-Checking IP's from $liffile file \n"; goto REINT_1; } } else { print BOLD, CYAN, "\n\t Valid 40 LIF ips are present, Proceeding with next steps\n"; last; } } while (1) { alarm $ALARM; print BOLD, CYAN, "\n\nEnter I/O type to be initiated from client - $CLIENT_SELECTED, Available type - hammer, sio and dt"; sleep 1; print BOLD, YELLOW, "\n\tCurrently only SIO I/O tool is supported , Selecting sio \n"; # $io_type = getchompstrip( "", '', "" ); $io_type = "sio"; $io_type = trim($io_type); if ( $io_type ne '' ) { push( @hparams, " CLNT_SLTD_IO_TYPE=$io_type\n" ); my $data_set = 400; if ( $io_type =~ /sio/ ) { print BOLD, CYAN, "\n\nEnter DATA SET size to be created for sio command \n"; #$data_set = getchompstrip( "", '', "" ); $data_set = trim($data_set); if ( $data_set eq '' ) { print BOLD, CYAN, "\tDefault data set size $data_set has been selected\n"; push( @hparams, " DATA_SET_SZG=200\n" ); } else { print BOLD, CYAN, "\tEntered data set size is $data_set G\n"; push( @hparams, " DATA_SET_SZG=$data_set\n" ); } print BOLD, CYAN, "\n\nEnter desired I/O rate, \n\tDefault data rate :4800000\n"; my $data_rate = 4800000; $data_rate = trim($data_rate); if ( $data_rate eq '' ) { print BOLD, CYAN, "\tDefault :$data_rate I/O data rate has been selected"; push( @hparams, " DESIRED_RATE=$data_rate\n" ); last; } else { print BOLD, CYAN, "\tEntered I/O data rate : $data_rate\n"; push( @hparams, " DESIRED_RATE=$data_rate\n" ); last; } } } } $CLIENT_PARM_SET = 1; } #end of CLIENT_PARM_SET chec } # End of Client IO if ( ( $file =~ /NonHomo_Perf_Test|Homogenous_Perf|Homo_Perf_Test|Homogns_Perf_80_20_RW|Homogns_Perf_Seq|Homogns_Perf_Rand_Read/ ) || ( $file =~ /NVMe_Perf_Rnd_Rd_Sq_Wr_50_50_FSIO|NVMe_Perf_Aged_Rnd_Rd_FSIO|NVMe_Perf_Rnd_Rd_FSIO|NVMe_Perf_Sq_Wr_100_FSIO|NVMe_Perf_Sq_Wr_80_20_FSIO|NVMe_Perf_Non_Hmgs_Rnd_Rd_Sq_Wr_50_50_FSIO|NVMe_Th_Perf_Non_Hmgs_Rnd_Rd_Sq_Wr_50_50_FSIO/ ) || ( $file =~ /NVMe_Client_IO_Non_Hmgs_Rand_Read_SIO|NVMe_Client_IO_Non_Hmgs_50_50_SIO/ ) || ( $file =~ /NVMe_Client_IO_Non_Hmgs_SEQ_RD_SIO/ ) || ( $file =~ /NVMe_WAF_Dual_port/i ) || ( $file =~ /NVMe_Th_WAF_Dual_port/i ) || ( $file =~ /NVMe_Th_Perf_Non_Hmgs_Rnd_Rd_Sq_Wr_50_50_FSIO|NVMe_Th_Perf_Rnd_Rd_Sq_Wr_50_50_FSIO|NVMe_Th_Perf_Aged_Rnd_Rd_FSIO|NVMe_Th_Perf_Rnd_Rd_FSIO|NVMe_Th_Perf_Sq_Wr_100_FSIO|NVMe_Th_Perf_Sq_Wr_80_20_FSIO/ ) ) { my $TC; ($TC) = ( $file =~ /NADQ02_(\S+)\.thpl/i ); if ( $file =~ /Non_Hmgs_50_50_SIO_Test|Non_Hmgs_Rand_Read_SIO_Test|Non_Hmgs_SEQ_RD_SIO/ ) { print BOLD, CYAN, "\n--------------------------------------------------------------"; print BOLD, CYAN, "\nFor test $TC ,Enter Model Id of drive that needs to be included in the aggregate to make it Non-Homogenous \n", RESET; my $model; while (1) { alarm $ALARM; $model = getchompstrip( "", '', "" ); $model = trim($model); if ( ( $model ne '' ) && ( $modl_of_drv ne $model ) ) { print BOLD, GREEN, "\n Drive MODEL number selected - $model\n", RESET; push( @hparams, " DRIVE_ID_NON_HOMO= $model\n" ); last; } else { if ( $modl_of_drv eq $model ) { print BOLD, RED, "\n To create non-homogeneous aggregate Drive MODEL ID's should be different \n", RESET; print BOLD, GREEN, "\n The entered Drive MODEL ID's($model and $modl_of_drv) are same\n", RESET; print BOLD, RED, "\n Please re-enter different drive MODEL ID\n", RESET; } else { print BOLD, RED, "\n Please enter drive MODEL number \n", RESET; } } } } if ( ( $file =~ /NonHomo_Perf_Test|NVMe_Perf_Non_Hmgs_Rnd_Rd_Sq_Wr_50_50_FSIO|NVMe_Th_Perf_Non_Hmgs_Rnd_Rd_Sq_Wr_50_50_FSIO/ ) ) { my $model; print BOLD, CYAN, "\n--------------------------------------------------------------"; print BOLD, CYAN, "\nFor test $TC , Enter MODEL ID of the Drive to create aggregate \n", RESET; while (1) { alarm $ALARM; $model = getchompstrip( "", '', "" ); $model = trim($model); if ( $model ne '' ) { print BOLD, GREEN, "\n Drive MODEL number selected - $model\n", RESET; push( @hparams, "\n MODEL_DRIVE_ID_$TC = $model\n" ); last; } else { print BOLD, RED, "\n Please enter drive MODEL number \n", RESET; } } print BOLD, CYAN, "\n--------------------------------------------------------------"; print BOLD, CYAN, "\nFor test $TC ,Enter ID string of drive that needs to be included in the aggregate to make it non-homogeneous \n", RESET; my $model_to_for_non_hmgs; while (1) { alarm $ALARM; $model_to_for_non_hmgs = getchompstrip( "", '', "" ); $model_to_for_non_hmgs = trim($model_to_for_non_hmgs); if ( ( $model_to_for_non_hmgs ne '' ) && ( $model_to_for_non_hmgs ne $model ) ) { print BOLD, GREEN, "\n Drive MODEL number selected - $model_to_for_non_hmgs\n", RESET; push( @hparams, " DRIVE_ID_NON_HOMO= $model_to_for_non_hmgs\n" ); last; } else { if ( $model_to_for_non_hmgs eq $model ) { print BOLD, RED, "\n To create non-homogeneous aggregate Drive MODEL ID's should be different \n", RESET; print BOLD, GREEN, "\n The entered Drive MODEL ID's($model and $model_to_for_non_hmgs) are same\n", RESET; print BOLD, RED, "\n Please re-enter different drive MODEL ID\n", RESET; } else { print BOLD, RED, "\n Please enter drive MODEL number \n", RESET; } } } print BOLD, CYAN, "\n--------------------------------------------------------------"; print BOLD, CYAN, "\nFor test $TC , Enter Number of drives to be used for the aggregate creation (min 5 - 10 max) default is 5\n", RESET; my $num_drives; while (1) { alarm $ALARM; $num_drives = getchompstrip( "", '', "" ); $num_drives = trim($num_drives); if ( $num_drives ne '' ) { if ( ( $num_drives >= 5 ) && ( $num_drives < 11 ) ) { print BOLD, GREEN, "\n User has selected $num_drives drives for aggregate creation \n", RESET; push( @hparams, " DRIVES_NUMBR_$TC = $num_drives\n" ); last; } else { print BOLD, RED, "\n User need to select in the given range\n", RESET; } } else { print BOLD, GREEN, "\n Default Number of drives selected for the aggregate creation : 5 \n", RESET; push( @hparams, " DRIVES_NUMBR_$TC = 5\n" ); last; } } } if ( ( $file =~ /NVMe_Perf_Rnd_Rd_Sq_Wr_50_50_FSIO|NVMe_Perf_Aged_Rnd_Rd_FSIO|NVMe_Perf_Rnd_Rd_FSIO|NVMe_Perf_Sq_Wr_100_FSIO|NVMe_Perf_Sq_Wr_80_20_FSIO/ ) || ( $file =~ /NVMe_Th_Perf_Rnd_Rd_Sq_Wr_50_50_FSIO|NVMe_Th_Perf_Aged_Rnd_Rd_FSIO|NVMe_Th_Perf_Rnd_Rd_FSIO|NVMe_Th_Perf_Sq_Wr_100_FSIO|NVMe_Th_Perf_Sq_Wr_80_20_FSIO/ ) ) { print BOLD, CYAN, "\n-------------------------------"; print BOLD, CYAN, "\nFor test $TC , Enter MODEL ID of the Drive to create aggregate \n", RESET; my $model; while (1) { alarm $ALARM; $model = getchompstrip( "", '', "" ); $model = trim($model); if ( $model ne '' ) { print BOLD, GREEN, "\n Drive MODEL number selected - $model\n", RESET; push( @hparams, "\n MODEL_DRIVE_ID_$TC= $model\n" ); last; } else { print BOLD, RED, "\n Please enter drive model number\n", RESET; } } print BOLD, CYAN, "\n--------------------------------------------------------------"; print BOLD, CYAN, "\nFor test $TC , Enter Number of drives to be used for the aggregate creation (min 5 - 10 max) default is 5\n", RESET; my $num_drives; while (1) { alarm $ALARM; $num_drives = getchompstrip( "", '', "" ); $num_drives = trim($num_drives); if ( $num_drives ne '' ) { if ( ( $num_drives >= 5 ) && ( $num_drives < 11 ) ) { print BOLD, GREEN, "\n User has selected $num_drives drives for aggregate creation \n", RESET; push( @hparams, " DRIVES_NUMBR_$TC = $num_drives\n" ); last; } else { print BOLD, RED, "\n User need to select in the given range\n", RESET; } } else { print BOLD, GREEN, "\n Default Number of drives selected for the aggregate creation : 5 \n", RESET; push( @hparams, " DRIVES_NUMBR_$TC = 5\n" ); last; } } } ##WAF if ( $file =~ /NVMe_WAF_Dual_port/i || $file =~ /NVMe_Th_WAF_Dual_port/i ) { print BOLD, CYAN, "\n--------------------------------------------------------------"; print BOLD, CYAN, "\nFor test $TC , Enter Number of drives to be used for the aggregate creation (min 5 - 10 max) default is 5\n", RESET; my $num_drives; while (1) { alarm $ALARM; $num_drives = getchompstrip( "", '', "" ); $num_drives = trim($num_drives); if ( $num_drives ne '' ) { if ( ( $num_drives >= 5 ) && ( $num_drives < 11 ) ) { print BOLD, GREEN, "\n User has selected $num_drives drives for aggregate creation \n", RESET; push( @hparams, " DRIVES_NUMBR_$TC = $num_drives\n" ); last; } else { print BOLD, RED, "\n User need to select in the given range\n", RESET; } } else { print BOLD, GREEN, "\n Default Number of drives selected for the aggregate creation : 5 \n", RESET; push( @hparams, " DRIVES_NUMBR_$TC = 5\n" ); last; } } print BOLD, CYAN, "\n--------------------------------------------------------------"; print BOLD, CYAN, "\nFor test $TC , Enter MODEL ID of the Drive to create aggregate \n", RESET; my $model; while (1) { alarm $ALARM; $model = getchompstrip( "", '', "" ); $model = trim($model); if ( $model ne '' ) { print BOLD, GREEN, "\n Drive MODEL number selected - $model\n", RESET; push( @hparams, "\n DRIVE_ID_$TC = $model\n" ); last; } else { print BOLD, RED, "\n Please enter drive MODEL number \n", RESET; } } } ## WAF if ( ( $file !~ /NVMe_WAF_Dual_port/i && $file !~ /NVMe_Th_WAF_Dual_port/i ) && ( $file !~ /NVMe_Client_IO_Non_Hmgs_Rand_Read_SIO_Test/i && $file !~ /NVMe_Client_IO_Non_Hmgs_50_50_SIO_Test/i && $file !~ /NVMe_Client_IO_Non_Hmgs_SEQ_RD_SIO_Test/i ) ) { print BOLD, CYAN, "\n--------------------------------------------------------------"; print BOLD, CYAN, "\nFor test $TC ,Enter Size of the Volume (min 250g, max 1000g ) default is 250g\n", RESET; my $vol_size; while (1) { alarm $ALARM; $vol_size = getchompstrip( "", '', "" ); $vol_size = trim($vol_size); if ( $vol_size ne '' ) { ( my $vol = $vol_size ) =~ s/g//i; if ( ( $vol < 1001 ) && ( $vol >= 250 ) ) { print BOLD, GREEN, "\n User selected Volume Size is $vol" . "g \n", RESET; push( @hparams, " VOL_SIZE_$TC = $vol \n " ); last; } else { print BOLD, RED, "\n User need to select in the given range\n", RESET; } } else { print BOLD, GREEN, "\n Default Volume Size selected is 250g \n", RESET; push( @hparams, " VOL_SIZE_$TC = 250\n" ); last; } } print BOLD, CYAN, "\n--------------------------------------------------------------"; print BOLD, CYAN, "\nFor test $TC , Enter Number of filersio instances to run (minimum is 5) default is 5\n", RESET; my $threads; while (1) { alarm $ALARM; $threads = getchompstrip( "", '', "" ); $threads = trim($threads); if ( $threads ne '' ) { #if ( ( $threads > 4 ) && ( $threads < 11 ) ) { if ( $threads > 4 ) { print BOLD, GREEN, "\n User selected Filersio Instances is $threads \n", RESET; push( @hparams, " FILERSIO_READ_THREADS_$TC = $threads \n" ); last; } else { print BOLD, RED, "\n Number of filersio instances should be equal or greater than 5.\n", RESET; } } else { print BOLD, GREEN, "\n Default FILERSIO_READ_INSTANCES selected is 5 \n", RESET; push( @hparams, " FILERSIO_READ_THREADS_$TC = 5\n" ); last; } } } if ( $file =~ /Aged_Homogenous_Perf/i ) { print BOLD, CYAN, "\n--------------------------------------------------------------"; print BOLD, CYAN, "\nFor test $TC , Enter Number of filersio write instances that are to be run (minimum is 5) default is 5\n", RESET; my $threads; while (1) { alarm $ALARM; $threads = getchompstrip( "", '', "" ); $threads = trim($threads); if ( $threads ne '' ) { if ( $threads > 4 ) { print BOLD, GREEN, "\n User selected FILERSIO_WRITE_READ_INSTANCES is $threads \n", RESET; push( @hparams, " FILERSIO_WRITE_READ_THREADS = $threads \n" ); last; } else { print BOLD, RED, "\n Number of filersio instances should be equal or greater than 5.\n", RESET; } } else { print BOLD, GREEN, "\n User selected FILERSIO_WRITE_READ_INSTANCES is 5\n", RESET; push( @hparams, " FILERSIO_WRITE_READ_THREADS = 5\n" ); last; } } } if ( $file =~ /NVMe/ ) { print BOLD, CYAN, "\n--------------------------------------------------------------"; print BOLD, CYAN, "\nFor test $TC , ENVIRONMENT VARIABLE FILE is needed, Make sure FILER CONFIG file has required variables\n", RESET; print BOLD, YELLOW, "\n Press enter to continue ... \n", RESET; my $env_loc; while (1) { alarm $ALARM; $env_loc = getchompstrip( "", '', "" ); $env_loc = trim($env_loc); if ( $env_loc eq '' ) { push( @hparams, " ENV_FIL_LOC = 'FILER_INFO'\n" ); last; } else { print BOLD, RED, "\n Press ENTER key ...\n", RESET; } } } } =head if ($file =~ /DVT_Baseline/){ print BOLD, CYAN, "\n--------------------------------------------------------------"; print BOLD, CYAN, "\nEnter drive MODEL to execute Performance test \n"; my $user_serial_nu; while (1) { alarm $ALARM; $user_serial_nu = getchompstrip( "", '', "" ); $user_serial_nu = trim($user_serial_nu); if ($user_serial_nu ne '') { print BOLD, CYAN, "\n Drive MODEL - $user_serial_nu\n"; push( @hparams, " DRIVE_MODEL=$user_serial_nu\n" ); last; }else{ print BOLD, RED, "\n Please enter drive MODEL \n"; } } } =cut ##Hiding the below functionality from the user as per the burt#494833. Please dont delete the implementation of this functionality as this might be used in future release. Setting the default value of creating mini disks as "No". ###=cut # FileSys_Disk_FW_Download,SAS_Hammer_Scrub,SAS_Hammer,SAS_Hot_Plug_Removal,SAS_FA_Byte,SAS_Disk_FW_Download_Background #SAS_FileSys_Disk_FW_Download_2_Diff_FWs,NADQ02_Disk_FW_DL_Dev_Rst if ( ( $MINI_DISK_CREATE == 1 ) && ( !$GROUP_NO ) ) { my $mini_choice_in_built; if ( $boot_type ne "N" ) { if ( $mini_size eq '' ) { if ( $file =~ /PwrCyc|NSSR/ ) { ##For test#55 and 57 under burt#644256 print BOLD, YELLOW, "\n This test requires mini disks to be created on the filer\n" if ( !$GROUP_NO ); $mini_choice_in_built = "n"; push( @hparams, " MINI_CREATE=$mini_choice_in_built\n" ); } else { print BOLD, YELLOW, "\n You have used option '-f' which will create mini disk on filer. \n"; $mini_choice = "y"; push( @hparams, " MINI_CREATE=0\n" ); $quick_mode = 1; print BOLD, YELLOW, "\n NOTE: This might involve rebooting to maintenance mode to create mini disk. \n"; } if ( ( ( $mini_choice =~ /^y$/ ) || ( $mini_choice =~ /^yes$/ ) || ( $mini_choice_in_built =~ /^n$/ ) ) && ( !$GROUP_NO ) ) { #Adding a user defined parameter to introduce a choice whether the user wants to create #mini disks before starting the test print BOLD, CYAN, "\n ========================================================================== "; print "\nPlease select the size of mini disk to be created:\n Option: 1 (For 10% of the max disk size) Default or\n Option: 2 (For 50% of the max disk size)\n"; print " ========================================================================== \n"; while (1) { alarm $ALARM; $mini_size = getchompstrip( "", '', "" ); $mini_size = trim($mini_size); if ( $mini_size =~ /^$/ ) { print BOLD, CYAN, "\n Default selected. The script will create mini disks of size 10% of the max disk size\n"; $mini_size = "1"; push( @hparams, " MINI_CREATE_SIZE=$mini_size" ); last; } elsif ( $mini_size == 2 ) { $mini_size = "2"; push( @hparams, " MINI_CREATE_SIZE=$mini_size" ); print BOLD, CYAN, "\n The script will create mini disks of size 50% of the max disk size\n"; last; } elsif ( $mini_size == 1 ) { $mini_size = "1"; push( @hparams, " MINI_CREATE_SIZE=$mini_size" ); print BOLD, CYAN, "\n The script will create mini disks of size 10% of the max disk size\n"; last; } else { print BOLD, RED, " Please enter again. Please enter 1/2"; } } ## end while (1) } ## end if (mini_size == '')... } #end if (mini_choice)... } ## end if ($boot_type ne "N") } ## end if ($MINI_DISK_CREATE ... ###=cut if ( $file =~ /_ATI_Bgnd_Scan\.thpl/ ) { while (1) { alarm $ALARM; if ( $runpyth == 1 ) { set_python_path(); } last; } if ( $SLBA == 0 ) { #print BOLD, CYAN, "\n ........................................................................"; alarm $ALARM; print BOLD, CYAN, "\nNADQ02_ATI_Bgnd_Scan : SubTest 3 - Write Servo Margin Test, please provide the STARTING LBA for write range , must be at least LBA 1100", RESET; while (1) { alarm $ALARM; my $reset_input = getchompstrip( "", '', "" ); $reset_input = trim($reset_input); if ( ( $reset_input =~ /^$/ ) || ( $reset_input !~ /^\d+$/ ) ) { print BOLD, RED, " Please enter only numbers", RESET; } elsif ( $reset_input =~ /^\d+$/ ) { $reset_value = $reset_input; if ( $reset_value < 1100 ) { print BOLD, WHITE, "\nInvalid entry - Try again.", RESET; print BOLD, WHITE, "Select (default=1100, at least 1100)\n", RESET; } else { print BOLD, YELLOW, "\nNADQ02_ATI_Bgnd_Scan : SubTest 3 - Write Servo Margin Test, Selected starting LBA for write range value is $reset_value.\n", RESET; last; } } ## end elsif ($reset_input =~ /^\d+$/) } ##end while (1) push( @hparams, " SLBA=$reset_value" ); $SLBA = $reset_value; } ##end if ($SLBA == 0) if ( $ELBA == 0 ) { #print BOLD, CYAN, "\n =========================================================================="; alarm $ALARM; print BOLD, CYAN, "\nNADQ02_ATI_Bgnd_Scan : SubTest 3 - Write Servo Margin Test, Please provide the ENDING LBA for write range.", RESET; print BOLD, CYAN, "\n NOTE : Make sure input value cover all physical heads on the drive.", RESET; while (1) { alarm $ALARM; my $reset_input = getchompstrip( "", '', "" ); $reset_input = trim($reset_input); if ( ( $reset_input =~ /^$/ ) || ( $reset_input !~ /^\d+$/ ) ) { print BOLD, RED, " Please enter only numbers", RESET; } elsif ( $reset_input <= $SLBA ) { print BOLD, RED, " ELBA should be greater than SLBA, Please enter ELBA greater than SLBA", RESET; } elsif ( $reset_input =~ /^\d+$/ ) { $reset_value = $reset_input; print BOLD, YELLOW, "\nNADQ02_ATI_Bgnd_Scan : SubTest 3 - Write Servo Margin Test, Selected ending LBA value is $reset_value.\n", RESET; last; } ## end elsif ($reset_input =~ /^\d+$/) } ##end while (1) push( @hparams, " ELBA=$reset_value" ); $ELBA = $reset_value; } ##end if ($ELBA == 0) if ( $Loop == 0 ) { alarm $ALARM; print BOLD, CYAN, "\nNADQ02_ATI_Bgnd_Scan : SubTest 3 - Write Servo Margin Test, Please provide the number test loops for random write step and random read steps 26 to 28. \nDefault value : 5000", RESET; while (1) { alarm $ALARM; my $reset_input = getchompstrip( "", '', "" ); $reset_input = trim($reset_input); if ( $reset_input =~ /^$/ ) { $reset_value = 5000; print BOLD, YELLOW, "\nNADQ02_ATI_Bgnd_Scan : SubTest 3 - Write Servo Margin Test, Default value selected. Number of test loops for random write step and random read steps 26 to 28 value is $reset_value.\n", RESET; last; } elsif ( $reset_input !~ /^\d+$/ ) { print BOLD, RED, " Please enter only numbers", RESET; } elsif ( $reset_input =~ /^\d+$/ ) { $reset_value = $reset_input; print BOLD, YELLOW, "\nNADQ02_ATI_Bgnd_Scan : SubTest 3 - Write Servo Margin Test, Selected number test loops for random write step and random read steps 26 to 28 value is $reset_value.\n", RESET; last; } ## end elsif ($reset_input =~ /^\d+$/) } ##end while (1) push( @hparams, " Loop=$reset_value" ); $Loop = $reset_value; } ##end if ($Loop == 0) } ##end if ($file =~ /_ATI_Bgnd_Scan\.thpl/) if ( ( $FILER_TYPE ne "IC" ) && ( ( $file =~ /SSD_SCSI_Cmd_Compl/ ) || ( $file =~ /FC_SCSI_Cmd_Compl/ ) || ( $file =~ /SAS_SCSI_Cmd_Compl/ ) ) ) { while (1) { print BOLD, CYAN, "\n ========================================================================== \n"; alarm $ALARM; print BOLD, CYAN, "\nDo you want to run the test to check the FDE Drives? Default value is no "; print BOLD, CYAN, "\nPlease enter y or n: "; $fde_enable = getchompstrip( "", '', "" ); if ( $fde_enable =~ /^$/ ) { print BOLD, YELLOW, "\n\n You selected the default value of NO. The FDE test steps will not be executed. \n", RESET; $fde_enable = "no"; push( @hparams, " FDE_ENABLE=$fde_enable" ); last; } elsif ( ( $fde_enable =~ /^y$/ ) || ( $fde_enable =~ /^Y$/ ) || ( $fde_enable =~ /^yes$/ ) || ( $fde_enable =~ /^Yes$/ ) ) { $fde_enable = "yes"; push( @hparams, " FDE_ENABLE=$fde_enable" ); last; } elsif ( ( $fde_enable =~ /^n$/ ) || ( $fde_enable =~ /^N$/ ) || ( $fde_enable =~ /^no$/ ) || ( $fde_enable =~ /^No$/ ) ) { $fde_enable = "no"; push( @hparams, " FDE_ENABLE=$fde_enable" ); last; } else { print BOLD, RED, " Please enter again: "; } } ## end while (1) while (1) { print BOLD, CYAN, "\n ========================================================================== \n"; alarm $ALARM; print BOLD, CYAN, "\nDo you want to record the Primary Defect List and Grown Defect List? Default value is no "; print BOLD, CYAN, "\nPlease enter y or n: "; my $defect_rec; $defect_rec = getchompstrip( "", '', "" ); if ( $defect_rec =~ /^$/ ) { print BOLD, YELLOW, "\n\n You selected the default value of NO. The defect list will not be recorded. \n", RESET; $defect_rec = "no"; push( @hparams, " REC_DEFECT=$defect_rec" ); last; } elsif ( ( $defect_rec =~ /^y$/ ) || ( $defect_rec =~ /^Y$/ ) || ( $defect_rec =~ /^yes$/ ) || ( $defect_rec =~ /^Yes$/ ) ) { $defect_rec = "yes"; push( @hparams, " REC_DEFECT=$defect_rec" ); last; } elsif ( ( $defect_rec =~ /^n$/ ) || ( $defect_rec =~ /^N$/ ) || ( $defect_rec =~ /^no$/ ) || ( $defect_rec =~ /^No$/ ) ) { $defect_rec = "no"; push( @hparams, " REC_DEFECT=$defect_rec" ); last; } else { print BOLD, RED, " Please enter again: "; } } ## end while (1) } ## end if (($file =~ /SSD_SCSI_Cmd_Compl/... if ( ( ( $test_type eq "SAS" ) || ( $test_type eq "SSD" ) ) && ( ( $file =~ /DiskQual_Dev_Reset/ ) || ( $file =~ /Disk_FW_DL_Dev_Rst|FW_DL_Ctrl_Rst/ ) || ( $file =~ /Hmr_Adp_Rst|Hmr_Ctrl_Rst|Fsio_Ctrl_Rst/ ) ) ) { if ( $temp_reset_value == 0 ) { print BOLD, CYAN, "\n =========================================================================="; alarm $ALARM; if ( $file =~ /Disk_FW_DL_Dev_Rst|FW_DL_Ctrl_Rst/ ) { print BOLD, CYAN, "\nPlease provide the device reset values (60 to 360). Default value is 90", RESET; } else { print BOLD, CYAN, "\nPlease provide the device reset values (60 to 360). Default value is 90", RESET; } print BOLD, CYAN, "\nThis value will be valid for all related tests selected\n", RESET; while (1) { alarm $ALARM; my $reset_input = getchompstrip( "", '', "" ); $reset_input = trim($reset_input); if ( $reset_input =~ /^$/ ) { $reset_value = 120; $reset_value = 90 if ( $file =~ /Disk_FW_DL_Dev_Rst|Hmr_Adp_Rst|FW_DL_Ctrl_Rst|Hmr_Ctrl_Rst|Fsio_Ctrl_Rst/ ); print BOLD, CYAN, "\n Default selected. Device reset value = $reset_value\n", RESET; last; } elsif ( $reset_input !~ /^\d+$/ ) { print BOLD, RED, " Please enter only numbers", RESET; } elsif ( $reset_input =~ /^\d+$/ ) { $reset_value = $reset_input; if ( ( $reset_value < 60 ) || ( $reset_value > 360 ) ) { print BOLD, WHITE, "\nInvalid entry - Try again.", RESET; print BOLD, WHITE, "Select (default=120, min=60, max=360)seconds\n", RESET; } else { print BOLD, WHITE, "\nSelected device reset value is $reset_value.\n", RESET; last; } } ## end elsif ($reset_input =~ /^\d+$/) } ##end while (1) push( @hparams, " RESETVALUE=$reset_value" ); $temp_reset_value = $reset_value; } ##end if ($temp_reset_value == 0) } ##end if ($file =~ /DiskQual_Dev_Reset/) if ( ( ( $test_type eq "SAS" ) || ( $test_type eq "SSD" ) ) && ( ( $file =~ /DiskQual_Adapt_Reset/ ) ) ##|| ($file =~ /Hmr_Adp_Rst/) ADAPRESETVALUE value is hard-coded in the script to value 90 ) { if ( $temp_adap_reset_value == 0 ) { print BOLD, CYAN, "\n =========================================================================="; alarm $ALARM; print BOLD, CYAN, "\nPlease provide the adapter reset values (60 to 360). Default value is 120", RESET; print BOLD, CYAN, "\nThis value will be valid for all related tests selected\n", RESET; while (1) { alarm $ALARM; my $reset_input = getchompstrip( "", '', "" ); $reset_input = trim($reset_input); if ( $reset_input =~ /^$/ ) { $adap_reset_value = 120; print BOLD, CYAN, "\n Default selected. Adapter reset value = 120\n\n", RESET; last; } elsif ( $reset_input !~ /^\d+$/ ) { print BOLD, RED, " Please enter only numbers", RESET; } elsif ( $reset_input =~ /^\d+$/ ) { $adap_reset_value = $reset_input; if ( ( $adap_reset_value < 60 ) || ( $adap_reset_value > 360 ) ) { print BOLD, WHITE, "\nInvalid entry - Try again.", RESET; print BOLD, WHITE, "Select (default=120, min=60, max=360)seconds\n", RESET; } else { print BOLD, WHITE, "\nSelected adapter reset value is $adap_reset_value.\n", RESET; last; } } ## end elsif ($reset_input =~ /^\d+$/) } ##end while (1) push( @hparams, " ADAPRESETVALUE=$adap_reset_value" ); $temp_adap_reset_value = $adap_reset_value; } ##end if ($temp_adap_reset_value == 0) } ##end if ($file =~ /DiskQual_Dev_Reset/) if ( ( $MINI_DISK_CREATE == 2 ) && ( $mini_choice ne 'n' ) ) { $mini_choice = "n"; push( @hparams, " MINI_CREATE=$mini_choice\n" ); } # For the test script no:45 the user will be prompted to enter the wait time for Step#13,14 and 15 if ( $file =~ /_Hot_Plug_Removal/ ) { #Adding a user defined parameter to introduce a choice whether the user wants to generate #the trace files through the script print BOLD, CYAN, "\n ========================================================================== \n"; print "\n $file : The following steps in the script requires a user defined wait time value, for which the script will wait for the user to remove the drives from the filer.\n The default value for each of these steps is 1200 seconds i.e. 20 minutes.\n\n The steps and the corresponding time variables are:"; if ( $test_type ne "SAS" ) { print "\n Step 13 - Remove one SES drive (ses_wait_time)\n Step 14 - Remove one SPARE drive (spare_wait_time)\n Step 15 - Remove one RAID drive from each RAID Group (raid_wait_time)\n Step 16 - Re-Insert the removes drives (re_insert_wait_time) \n\n Please enter the wait time value, as per the prompt, in seconds\n"; } else { print "\n Step 12 - Remove one SPARE drive (spare_wait_time)\n Step 13 - Remove one RAID drive from each RAID Group (raid_wait_time)\n Step 14 - Re-Insert the removes drives (re_insert_wait_time) \n\n Please enter the wait time value, as per the prompt, in seconds\n"; } print BOLD, CYAN, "\n ========================================================================== \n"; if ( $test_type ne "SAS" ) { print "\n Enter the value of ses_wait_time (in seconds) = "; my $ses_wait_time; while (1) { alarm $ALARM; $ses_wait_time = getchompstrip( "", '', "" ); $ses_wait_time = trim($ses_wait_time); if ( $ses_wait_time =~ /^$/ ) { print BOLD, CYAN, "\n Default selected. ses_wait_time = 1200 seconds\n"; $ses_wait_time = "1200"; push( @hparams, " SES_WAIT_TIME=$ses_wait_time" ); last; } elsif ( $ses_wait_time =~ /^\d+$/ ) { push( @hparams, " SES_WAIT_TIME=$ses_wait_time" ); last; } elsif ( $ses_wait_time !~ /^\d+$/ ) { print BOLD, RED, " Please enter only numbers"; } else { print BOLD, RED, " Please enter again. Please enter ses_wait_time in seconds"; } } ## end while (1) print BOLD, CYAN, "\n SES_WAIT_TIME = $ses_wait_time seconds\n"; } ## end if ($test_type ne "SAS") print "\n Enter the value of spare_wait_time (in seconds) = "; my $spare_wait_time; while (1) { alarm $ALARM; $spare_wait_time = getchompstrip( "", '', "" ); $spare_wait_time = trim($spare_wait_time); if ( $spare_wait_time =~ /^$/ ) { print BOLD, CYAN, "\n Default selected. spare_wait_time = 1200 seconds\n"; $spare_wait_time = "1200"; push( @hparams, " SPARE_WAIT_TIME=$spare_wait_time" ); last; } elsif ( $spare_wait_time =~ /^\d+$/ ) { push( @hparams, " SPARE_WAIT_TIME=$spare_wait_time" ); last; } elsif ( $spare_wait_time !~ /^\d+$/ ) { print BOLD, RED, " Please enter only numbers"; } else { print BOLD, RED, " Please enter again. Please enter spare_wait_time in seconds"; } } ## end while (1) print BOLD, CYAN, "\n SPARE_WAIT_TIME = $spare_wait_time seconds\n"; print "\n Please enter the value of raid_wait_time (in seconds) = "; my $raid_wait_time; while (1) { alarm $ALARM; $raid_wait_time = getchompstrip( "", '', "" ); $raid_wait_time = trim($raid_wait_time); if ( $raid_wait_time =~ /^$/ ) { print BOLD, CYAN, "\n Default selected. raid_wait_time = 1200 seconds\n"; $raid_wait_time = "1200"; push( @hparams, " RAID_WAIT_TIME=$raid_wait_time" ); last; } elsif ( $raid_wait_time =~ /^\d+$/ ) { push( @hparams, " RAID_WAIT_TIME=$raid_wait_time" ); last; } elsif ( $raid_wait_time !~ /^\d+$/ ) { print BOLD, RED, " Please enter only numbers"; } else { print BOLD, RED, " Please enter again. Please enter raid_wait_time in seconds"; } } ## end while (1) print BOLD, CYAN, "\n RAID_WAIT_TIME = $raid_wait_time\n"; print "\n Please enter the value of re_insert_wait_time (in seconds) = "; my $re_insert_wait_time; while (1) { alarm $ALARM; $re_insert_wait_time = getchompstrip( "", '', "" ); $re_insert_wait_time = trim($re_insert_wait_time); if ( $re_insert_wait_time =~ /^$/ ) { print BOLD, CYAN, "\n Default selected. re_insert_wait_time = 1200 seconds\n"; $re_insert_wait_time = "1200"; push( @hparams, " RE_INSERT_WAIT_TIME=$re_insert_wait_time" ); last; } elsif ( $re_insert_wait_time =~ /^\d+$/ ) { push( @hparams, " RE_INSERT_WAIT_TIME=$re_insert_wait_time" ); last; } elsif ( $re_insert_wait_time !~ /^\d+$/ ) { print BOLD, RED, " Please enter only numbers"; } else { print BOLD, RED, " Please enter again. Please enter re_insert_wait_time in seconds"; } } ## end while (1) print BOLD, CYAN, "\n RE_INSERT_WAIT_TIME = $re_insert_wait_time\n"; if ( $test_type eq "SAS" ) { print "\n Enter the times Steps 12-16 should be repeted by the script: "; my $repeat_time; while (1) { alarm $ALARM; $repeat_time = getchompstrip( "", '', "" ); $repeat_time = trim($repeat_time); if ( $repeat_time =~ /^$/ ) { print BOLD, CYAN, "\n Default selected. Number of times the Steps 12-16 will be repeated = 1\n"; $repeat_time = "1"; push( @hparams, " LOOP_TIMES=$repeat_time" ); last; } elsif ( $repeat_time =~ /^\d+$/ ) { push( @hparams, " LOOP_TIMES=$repeat_time" ); last; } elsif ( $repeat_time !~ /^\d+$/ ) { print BOLD, RED, " Please enter only numbers"; } else { print BOLD, RED, " Please enter again. Please enter the loop repeat times in integers only."; } } ## end while (1) print BOLD, CYAN, "\n LOOP_TIMES = $repeat_time\n"; } ## end if ($test_type eq "SAS") } ## end if ($file =~ /_Hot_Plug_Removal/) # For the test script no:40 the user will be prompted to enter the special kernel if ( ( $file =~ /Skip_Mask_Test/ ) && ( $file !~ /NADQ02_SAS_Skip_Mask_Test_Command_Verification/ ) ) { #Adding a user defined parameter to enter the special kernel print BOLD, RED, "\n $file : This test is internal to NetApp use only"; print BOLD, CYAN, "\n ========================================================================== \n"; print BOLD, CYAN, "\n Please enter the special kernel path, to be used in the script, that has SM flag disabled."; print "\n For example: 10.57.83.10/~gillette/FDE/final/bedrock/export/x86.debug/netboot/netboot/kernel\n"; print BOLD, CYAN, "\n Note: Please ensure that the kernel path is correct. The script will boot the filer with the kernel path supplied.\n"; print BOLD, CYAN, "\n ========================================================================== \n"; print "\n Please enter: "; my $kernel_path; while (1) { alarm $ALARM; $kernel_path = getchompstrip( "", '', "" ); $kernel_path = trim($kernel_path); if ( $kernel_path =~ /^$/ ) { print BOLD, RED, " The kernel file path cannot be blank. Please enter: \n"; } else { push( @hparams, " SPECIAL_KERNEL=$kernel_path" ); last; } } ## end while (1) print BOLD, CYAN, "\n Special Kernel entered by the user is: $kernel_path\n"; } ## end if ($file =~ /Skip_Mask_Test/) # For the test script no:31a the user will be prompted to enter the Fan Speed Maximum and Fan Speed Increment if ( $file =~ /Disk_Qual_Perf_IVS/ ) { print BOLD, CYAN, "\n Test - Disk_Qual_Perf_IVS Select below option - \n"; print BOLD, CYAN, "--------------------------------------------------------------\n"; print BOLD, CYAN, "Please select option 1 to run Standard test, option 2 to run Custom test\n\n"; print BOLD, CYAN, "1> Standard\n"; print BOLD, CYAN, "2> Custom\n\n"; print BOLD, CYAN, "Default option is 1> Standard\n"; print BOLD, CYAN, "--------------------------------------------------------------\n"; my ( $option, $flag_a ); while (1) { $option = getchompstrip( "", "", "" ); $option = trim($option); alarm $ALARM; if ( ( $option =~ /\d/ ) && ( $option <= 2 ) && ( $option >= 1 ) ) { $flag_a = 1; last; } elsif ( $option eq '' ) { $flag_a = 1; $option = 1; #print BOLD, WHITE, "\nYou have chosen to run Custom Test.\n\n", RESET; last; } else { oops "Please enter correct value 1/2"; } } my ( %list, %list1 ); @list{ 'DS4486', 'DS424x', 'FAS2220', 'DS2246', 'FAS2240-2', 'FAS2240-4', 'FAS3270' } = qw(8000 9000 8000 8000 7500 9000 9000); @list1{ 'BOAB', 'SEQUOIA', 'RUCKUS', 'HACKBERR', 'Vespa-2', 'Vespa-4', 'NEW' } = qw(8000 9000 8000 8000 7500 9000 9000); if ( $option == 2 ) { print BOLD, CYAN, "\n You have chosen to run Custom Test."; print BOLD, CYAN, "\n ========================================================================== "; print BOLD, CYAN, "\n Please find the Maximum Fan Speed of different platforms."; print BOLD, CYAN, "\n BOAB (DS4486)\t\t8000"; print BOLD, CYAN, "\n SEQUOIA (DS424x)\t\t9000"; print BOLD, CYAN, "\n RUCKUS (FAS2220)\t\t8000"; print BOLD, CYAN, "\n NEW (FAS3270)\t\t9000"; print BOLD, CYAN, "\n HACKBERR (DS2246)\t\t8000"; print BOLD, CYAN, "\n Vespa-2 (FAS2240-2)\t\t7500"; print BOLD, CYAN, "\n Vespa-4 (FAS2240-4)\t\t9000"; #Adding a user defined parameter to enter the Fan Speed Maximum and Fan Speed Increment print BOLD, CYAN, "\n =========================================================================="; print BOLD, CYAN, "\n Please choose the platform you would like run the test ."; print BOLD, CYAN, "\n ==========================================================================\n"; print " Ex: RUCKUS or Model name i.e FAS2220"; print "\n Please choose:"; my ( $platform, $PLATFORM_MAX_SPEED ); while (1) { alarm $ALARM; $platform = getchompstrip( "", '', "" ); $platform = trim($platform); if ( $platform =~ /^$/ ) { print BOLD, RED, " The platform cannot be blank. Please enter: \n"; } elsif ( defined( $list{$platform} ) ) { print "\n"; print BOLD, GREEN, " According to the platform, user can select Maximum fan Speed up-to $list{$platform}\n"; push( @hparams, " PLATFORM_MAX_SPEED=$list{$platform}" ); $PLATFORM_MAX_SPEED = $list{$platform}; last; } elsif ( defined( $list1{$platform} ) ) { print "\n"; print BOLD, GREEN, " According to the platform, user can select Maximum fan Speed up-to $list1{$platform}\n"; push( @hparams, " PLATFORM_MAX_SPEED=$list1{$platform}" ); $PLATFORM_MAX_SPEED = $list1{$platform}; last; } else { oops "Please enter correct platform name from the displayed list"; } } #Adding a user defined parameter to enter the Fan Speed Maximum and Fan Speed Increment print BOLD, CYAN, "\n =========================================================================="; print BOLD, CYAN, "\n Please enter the Fan Speed Maximum you would like to test."; print BOLD, CYAN, "\n =========================================================================="; print "\n Please enter: "; my $fan_speed_maximum; while (1) { alarm $ALARM; $fan_speed_maximum = getchompstrip( "", '', "" ); $fan_speed_maximum = trim($fan_speed_maximum); if ( $fan_speed_maximum =~ /^$/ ) { print BOLD, RED, " The Fan speed cannot be blank. Please enter: \n"; } elsif ( $fan_speed_maximum !~ /\d+/ ) { print BOLD, RED, "Please Enter the fan speed in numbers\n"; } elsif ( $fan_speed_maximum > $PLATFORM_MAX_SPEED ) { print BOLD, RED, " Entered Maximum fan-speed $fan_speed_maximum is greater than the Platform maximum speed $PLATFORM_MAX_SPEED, Please enter the fan-speed less than the Platform maximum speed\n"; } else { push( @hparams, " MAX_FAN_SPEED=$fan_speed_maximum" ); last; } } ## end while (1) print BOLD, CYAN, "\n =========================================================================="; print BOLD, CYAN, "\n Please enter the Initial Fan Speed\n"; print BOLD, CYAN, "\n =========================================================================="; print "\n Please enter: "; my $initial_fan_speed; while (1) { alarm $ALARM; $initial_fan_speed = getchompstrip( "", '', "" ); $initial_fan_speed = trim($initial_fan_speed); if ( $initial_fan_speed =~ /^$/ ) { print BOLD, RED, " The Fan speed cannot be blank. Please enter: \n"; } elsif ( $initial_fan_speed !~ /\d+/ ) { print BOLD, RED, "Please Enter the fan speed in numbers\n"; } elsif ( $initial_fan_speed > $fan_speed_maximum ) { print BOLD, RED, "Initial Fan Speed cannot be greater than Max Fan Speed. Please enter:\n"; } else { push( @hparams, " INITIAL_FAN_SPEED=$initial_fan_speed" ); last; } } ## end while (1) print BOLD, CYAN, "\n ========================================================================== \n"; print " Please enter the Increment Fan Speed which is dividable between Starting and Max Fan Speed.\n"; print " Ex: If the Initial Fan speed is 4000 and Max Fan speed is 6000\n"; print " Then Increment Fan Speed should be 1000 or any other number which is divisible of both 4000 and 6000."; print BOLD, CYAN, "\n ========================================================================== \n"; print "\n Please enter: "; my $fan_speed_increment; while (1) { alarm $ALARM; $fan_speed_increment = getchompstrip( "", '', "" ); $fan_speed_increment = trim($fan_speed_increment); if ( $fan_speed_increment =~ /^$/ ) { print BOLD, RED, " The Fan speed cannot be blank. Please enter: \n"; } elsif ( $fan_speed_increment !~ /\d+/ ) { print BOLD, RED, "Please Enter the fan speed in numbers\n"; } elsif ( $fan_speed_increment > $fan_speed_maximum ) { print BOLD, RED, "Increment Fan Speed cannot be greater than Maximum Fan Speed. Please enter: \n"; } elsif ( ( $fan_speed_maximum % $fan_speed_increment ) || ( $initial_fan_speed % $fan_speed_increment ) ) { print BOLD, RED, " The Increment Fan Speed is not dividable between Starting and Max Fan Speeds\n"; print BOLD, RED, " Please enter the correct value:"; } else { push( @hparams, " FAN_SPEED_INCREMENT=$fan_speed_increment" ); last; } } ## end while (1) print BOLD, CYAN, "\n fan speed maximum entered by the user is: $fan_speed_maximum and fan" . "speed increment entered entered by user is: $fan_speed_increment\n"; } else { print BOLD, CYAN, "\n You have chosen to run Standard Test."; print BOLD, CYAN, "\n ========================================================================="; print BOLD, CYAN, "\n Please find the Maximum Fan Speed of different platforms."; print BOLD, CYAN, "\n BOAB (DS4486)\t\t8000"; print BOLD, CYAN, "\n SEQUOIA (DS424x)\t\t9000"; print BOLD, CYAN, "\n RUCKUS (FAS2220)\t\t8000"; print BOLD, CYAN, "\n HACKBERR (DS2246)\t\t8000"; print BOLD, CYAN, "\n Vespa-2 (FAS2240-2)\t\t7500"; print BOLD, CYAN, "\n Vespa-4 (FAS2240-4)\t\t9000"; #Adding a user defined parameter to enter the Fan Speed Maximum and Fan Speed Increment print BOLD, CYAN, "\n =========================================================================="; print BOLD, CYAN, "\n Please choose the platform you would like run the test ."; print BOLD, CYAN, "\n ==========================================================================\n"; print " Ex: RUCKUS or Model name i.e FAS2220\n "; print " Please choose:"; my $platform; while (1) { alarm $ALARM; $platform = getchompstrip( "", '', "" ); $platform = trim($platform); if ( $platform =~ /^$/ ) { print BOLD, RED, " The platform cannot be blank. Please enter: \n"; } elsif ( defined( $list{$platform} ) ) { print "\n"; print BOLD, GREEN, " According to the platform, Maximum fan Speed is set to $list{$platform}\n"; print BOLD, GREEN, " Initial Speed is set to 3000 rpm, Incremental fan speed is set to 1000 rpm for the test\n"; push( @hparams, " PLATFORM_MAX_SPEED=$list{$platform}" ); push( @hparams, " INITIAL_FAN_SPEED=3000" ); push( @hparams, " FAN_SPEED_INCREMENT=1000" ); push( @hparams, " MAX_FAN_SPEED=$list{$platform}" ); last; } elsif ( defined( $list1{$platform} ) ) { print "\n"; print BOLD, GREEN, " According to the platform, Maximum fan Speed is set to $list1{$platform}\n"; print BOLD, GREEN, " Initial Speed is set to 3000 rpm, Incremental fan speed is set 1000 rpm for the test\n"; push( @hparams, " PLATFORM_MAX_SPEED=$list1{$platform}" ); push( @hparams, " INITIAL_FAN_SPEED=3000" ); push( @hparams, " FAN_SPEED_INCREMENT=1000" ); push( @hparams, " MAX_FAN_SPEED=$list1{$platform}" ); last; } else { oops "Please enter correct platform name from the displayed list"; } } } # Plotting check for 31a an 31b while (1) { alarm $ALARM; if ( $runpyth == 1 ) { set_python_path(); } last; } } ## end if (($file =~ /Disk_Qual_Perf_IVS/... # if ( ($file =~ /_Hammer_Scrub/))#|| ($file =~ /_Disk_FW_Download_Background/)) # burt899086 scrub priority is not set anymore =head if ( ( $file =~ /_Hmr_Scrub/ ) ) { while (1) { alarm $ALARM; print BOLD, CYAN, "\nPlease, set scrub priority level as low, medium or high.\n", RESET; print BOLD, CYAN, "\nNote: high would provide more CPU utilization to scrub process.\nDefault : medium", RESET; $pri = getchompstrip( "", '', "" ); $pri = trim($pri); if ( $pri =~ /low|medium|high/ ) { push( @hparams, " SCRUB_PRIORITY_LEVEL=$pri" ); print BOLD, CYAN, "\n\n You selected Scrub priority level as $pri.\n", RESET; last; } elsif ( $pri =~ /\w+\d+/ ) { print BOLD, CYAN, "Invalid value - Try again\n", RESET; } elsif ( $pri eq '' ) { print BOLD, CYAN, "You selected default value as medium.\n", RESET; push( @hparams, " SCRUB_PRIORITY_LEVEL=medium" ); last; } else { print BOLD, CYAN, "\nInvalid entry - Try again.\n"; } } ## end while (1) } ## end if (($file =~ /_Hammer_Scrub/... =cut if ( $file =~ /_AZCS_DskQul_Perf\.thpl/ ) { my $loopcount; while (1) { alarm $ALARM; print BOLD, CYAN, "\nPlease, enter value for LOOP COUNT (-L)\n", RESET; print BOLD, YELLOW, "\nNote: This is the number total IO's disk_qual will send to the disk. Default value of this is 4000\n", RESET; print BOLD, CYAN, "Default : 4000", RESET; $loopcount = getchompstrip( "", '', "" ); $loopcount = trim($loopcount); if ( $loopcount =~ /^$/ ) { print BOLD, CYAN, "\n Default selected. loopcount = 4000\n", RESET; $loopcount = "4000"; push( @hparams, " LOOPCOUNT=$loopcount" ); last; } elsif ( $loopcount =~ /^\d+$/ ) { push( @hparams, " LOOPCOUNT=$loopcount" ); last; } elsif ( $loopcount !~ /^\d+$/ ) { print BOLD, RED, " Please enter only numbers", RESET; } else { print BOLD, RED, " Please enter again. Please enter loop count (Only integers greater than 0)"; } } ## end while (1) print BOLD, CYAN, "\n LOOPCOUNT = $loopcount\n"; # if ( $runpyth == 1 ) { # set_python_path(); # } } ## end if ($file =~ /_AZCS_DskQul_Perf\.thpl/) if ( $file =~ /Freset_Dsk_Latency/ ) { while (1) { print BOLD, CYAN, "\n This test requires total runtime and reset interval time", RESET; alarm $ALARM; print BOLD, CYAN, "\n\t Enter overall test RUNTIME : ", RESET; print BOLD, CYAN, "\n\t\tDefault : 4 hrs", RESET; my $runtime = getchompstrip( "", '', "" ); $runtime = trim($runtime); if ( $runtime =~ /^$/ ) { print BOLD, CYAN, "\n\n\t You selected default : 4 hrs", RESET; push( @hparams, " TOT_RUNTIME=14400" ); } else { print BOLD, CYAN, "\n\n\t You entered $runtime hrs", RESET; my $tot_time = $runtime * 3600; push( @hparams, " TOT_RUNTIME=$tot_time" ); } print BOLD, CYAN, "\n\t Enter reset Interval time :", RESET; print BOLD, CYAN, "\n\t\tDefault : 60 sec", RESET; my $inttime = getchompstrip( "", '', "" ); $inttime = trim($inttime); if ( $inttime =~ /^$/ ) { print BOLD, CYAN, "\n\n\t You selected default : 60 Seconds", RESET; push( @hparams, " INTERVAL=60" ); last; } else { print BOLD, CYAN, "\n\n\t You entered $inttime seconds", RESET; push( @hparams, " INTERVAL=$inttime" ); last; } } } if ( $file =~ /Enum_Panic_Cmd|Enum_BMC_Sys_P|Enum_GB_TC/ ) { while (1) { print BOLD, CYAN, "\n ========================================================================== \n"; alarm $ALARM; print BOLD, CYAN, "\n\t Enter number of loops to perform Giveback-Takeover ", RESET; print BOLD, CYAN, "\n\t\t Default : Infinite", RESET; print BOLD, CYAN, "\n\n\t\t Press ENTER to select default value", RESET; my $sfo_loop = getchompstrip( "", '', "" ); $sfo_loop = trim($sfo_loop); if ( $sfo_loop =~ /^$/ ) { print BOLD, CYAN, "\n\n\t You selected default : Infinite loop", RESET; print BOLD, YELLOW, "\n\t Make sure you stop/kill/reset test process , As you have selected infinite loop", RESET; push( @hparams, " SFO_LOOP_TIME=INFINITE" ); last; } else { print BOLD, CYAN, "\n\n\t You entered $sfo_loop loop times", RESET; push( @hparams, " SFO_LOOP_TIME=$sfo_loop" ); last; } } if ( $file !~ /No_IO/ ) { while (1) { print BOLD, CYAN, "\n ========================================================================== \n"; alarm $ALARM; print BOLD, CYAN, "\n\t Enter total number of FILERSIO threads includes read and write threads", RESET; print BOLD, CYAN, "\n\t\t Default : 15", RESET; print BOLD, CYAN, "\n\n\t\t Press ENTER to select default value", RESET; my $sio_ct = getchompstrip( "", '', "" ); $sio_ct = trim($sio_ct); if ( $sio_ct =~ /^$/ ) { print BOLD, CYAN, "\n\n\t You selected default : 15 threads ", RESET; push( @hparams, " FILER_SIO=15" ); last; } else { print BOLD, CYAN, "\n\n\t You entered $sio_ct threads ", RESET; push( @hparams, " FILER_SIO=$sio_ct" ); last; } } } } if ( $file =~ /PwrCyc|PCIe_Reset|NSSR|Fsio_Ctrl|Disk_FW_DL_Ctrl_Rst/ ) { my $sleep_time = ''; while (1) { print BOLD, CYAN, "\n ========================================================================== \n"; alarm $ALARM; print BOLD, CYAN, "\nEnter the number of seconds to sleep for each Power cycle for the test $file ", RESET; print BOLD, CYAN, "\nNote:", RESET; if ( $file =~ /NVMe/ ) { print BOLD, CYAN, "\n1. Default is 10 seconds.", RESET; print BOLD, CYAN, "\n2. Minimum is 10 and Maximum is 600.", RESET; print BOLD, CYAN, "\n3. Enter only numric Ex: 10 or 600 ...etc\n", RESET; print BOLD, CYAN, "\n ========================================================================== \n", RESET; } else { print BOLD, CYAN, "\n1. Default is 120 seconds.", RESET; print BOLD, CYAN, "\n2. Minimum is 120 and Maximum is 600.", RESET; print BOLD, CYAN, "\n3. Enter only numric Ex: 150 or 500 ...etc\n", RESET; print BOLD, CYAN, "\n ========================================================================== \n", RESET; } $sleep_time = getchompstrip( "", '', "" ); $sleep_time = trim($sleep_time); if ( $sleep_time =~ /^$/ ) { print BOLD, CYAN, "\n\n You selected default time 120 seconds to sleep.\n" if ( $file !~ /NVMe/ ); print BOLD, CYAN, "\n\n You selected default time 10 seconds to sleep.\n" if ( $file =~ /NVMe/ ); push( @hparams, " POW_SLP_TIME=120" ) if ( $file !~ /NVMe/ ); push( @hparams, " POW_SLP_TIME=10" ) if ( $file =~ /NVMe/ ); last; } elsif ( ( $sleep_time >= 120 ) && ( $sleep_time <= 600 ) ) { print BOLD, CYAN, "You selected sleep time as $sleep_time\n", RESET; push( @hparams, " POW_SLP_TIME=$sleep_time" ); last; } elsif ( ( $sleep_time < 120 ) || ( $sleep_time > 600 ) ) { print BOLD, CYAN, "You selected sleep time as $sleep_time.\n", RESET; if ( $file =~ /NVMe/ ) { print BOLD, CYAN, "NVMe Script selected... Sleep time selected :$sleep_time ", RESET; push( @hparams, " POW_SLP_TIME=$sleep_time" ); last; } else { print BOLD, WHITE, "Select (default=120, min=120, max=600)seconds\n" if ( $file !~ /NVMe/ ); print BOLD, WHITE, "Select (default=10, min=10, max=600)seconds\n" if ( $file =~ /NVMe/ ); } } else { print BOLD, WHITE, "\nInvalid entry - Try again.\n"; } } ## end while (1) } ## end if (($file =~ /_Write_Cache_Integrity_Test/... if ( $file =~ /WCache_Integrity/ ) { my $sleep_time = ''; while (1) { print BOLD, CYAN, "\n ========================================================================== \n"; alarm $ALARM; print BOLD, CYAN, "\nEnter the number of seconds to sleep for each Power cycle for the test $file ", RESET; print BOLD, CYAN, "\nNote: 1. Default is 120 seconds. 2. Minimum is 65 and Maximum is 600. 3. Enter only numric Ex: 120 or 500 ...etc\n", RESET; print BOLD, CYAN, "\n ========================================================================== \n", RESET; $sleep_time = getchompstrip( "", '', "" ); $sleep_time = trim($sleep_time); if ( $sleep_time =~ /^$/ ) { print BOLD, CYAN, "\n\n You selected default time 120 seconds to sleep.\n", RESET; push( @hparams, " POW_SLP_TIME=120" ); last; } elsif ( ( $sleep_time >= 65 ) && ( $sleep_time <= 600 ) ) { print BOLD, CYAN, "You selected sleep time as $sleep_time\n", RESET; push( @hparams, " POW_SLP_TIME=$sleep_time" ); last; } elsif ( ( $sleep_time < 65 ) || ( $sleep_time > 600 ) ) { print BOLD, CYAN, "You selected sleep time as $sleep_time.\n", RESET; print BOLD, WHITE, "Select (default=120, min=65, max=600)seconds\n"; } else { print BOLD, WHITE, "\nInvalid entry - Try again.\n"; } } ## end while (1) } ## end if (($file =~ /_Write_Cache_Integrity_Test/... if ( $file =~ /_COGENFILE_DDBV/ ) { while (1) { print BOLD, CYAN, "\n ========================================================================== \n"; alarm $ALARM; print BOLD, CYAN, "\nSelect 'y' to compare the test output file DDB.txt.", RESET; print BOLD, CYAN, "\nSelect 'n' not to compare the test output file DDB.txt.\n", RESET; print BOLD, CYAN, "\nNote: 1. Provide the text file DDB.txt in the directory $ENV{HOME}/NDATE/TEST_LOGS/ 2. Provide the name of the file as DDB.txt. 3. Copy the entare output of the command 'fcadmin bridge cmd_sr1216 -d -c ddb_read -s' in the text file DDB.txt.\n", RESET; print BOLD, WHITE, " Warning: 1. All the required fields(except SerialNum) will be compared to all of the test devices(drives). No need to copy the each drive output.\n", RESET; print BOLD, CYAN, "\n ========================================================================== \n", RESET; $pri = getchompstrip( "", '', "" ); $pri = trim($pri); if ( $pri =~ /y/i ) { print BOLD, CYAN, "\n\n You selected to compare test output with the comprison file DDB.txt\n", RESET; if ( -e "$ENV{HOME}/NDATE/TEST_LOGS/DDB.txt" ) { print BOLD, CYAN, "\nDDB.txt file exists in the path $ENV{PATH}/NDATE/TEST_LOGS/DDB.txt\n", RESET; push( @hparams, "COMPARE_DDB=$pri" ); last; } print BOLD, CYAN, "\nDDB.txt file not exists in the path $ENV{PATH}/NDATE/TEST_LOGS/DDB.txt - Try again\n", RESET; } elsif ( $pri =~ /n/i ) { print BOLD, CYAN, "You selected not to compare.\n", RESET; push( @hparams, "COMPARE_DDB=$pri" ); last; } elsif ( $pri eq '' ) { $pri = 'n'; print BOLD, CYAN, "You selected not to compare.\n", RESET; push( @hparams, "COMPARE_DDB=$pri" ); last; } else { print BOLD, WHITE, "\nInvalid entry - Try again.\n"; } } ## end while (1) } ## end if ($file =~ /_COGENFILE_DDBV/) my @dir = (); if ( $file =~ /DQP_Validation/ ) { while (1) { print BOLD, CYAN, "\n ========================================================================== \n"; alarm $ALARM; print "\n Please enter the path of the DQP files\n"; print "Note: 1. This test is internal to NetApp only. 2. Default directry is $ENV{HOME}/NDATE/TEST_LOGS/50_DQP_FILES.Copy the DQP files under this directry.\n 3. Provide the absolute path of the directry.(Ex:/home//dirname - Try 'pwd' at prompt)"; print BOLD, CYAN, "\n ========================================================================== \n", RESET; $pri = getchompstrip( "", '', "" ); $pri = trim($pri); if ( $pri =~ /\w+$/ ) { @dir = ls("$pri/qual*"); if ( @dir > 0 ) { push( @hparams, " DQPFILEDIR=$pri" ); last; } print BOLD, RED, "No DQP files present in the directry -- Try again\n", RESET; next; } elsif ( $pri =~ /\*\^\:\;/ ) { print BOLD, RED, "Special symbols not allowed -- Try again\n", RESET; next; } elsif ( $pri eq '' ) { $pri = "$ENV{HOME}/NDATE/TEST_LOGS/50_DQP_FILES"; print BOLD, CYAN, "\n\n You selected the default directry $pri\n", RESET; if ( -d $pri ) { @dir = ls("$pri/qual*"); if ( @dir > 0 ) { push( @hparams, " DQPFILEDIR=$pri" ); last; } print BOLD, RED, "No DQP files present in the directry -- Try again\n", RESET; next; } else { mkdir("$pri"); print BOLD, CYAN, "\n\n Default directry $pri created.\n", RESET; print BOLD, CYAN, "\n\n Please copy DQP files into $pri directry -- Try again.\n", RESET; next; } ## end else [ if (-d $pri) } ## end elsif ($pri eq '') } ## end while (1) } ## end if ($file =~ /DQP_Validation/) if ( $file =~ /_SATA_SCSI_Cmd_Compl/ ) { while (1) { print BOLD, CYAN, "\n ========================================================================== \n"; alarm $ALARM; print BOLD, CYAN, "\nSelect 'y' to compare the test output file ACORN.txt", RESET; print BOLD, CYAN, "\nSelect 'n' not to compare the test output file ACORN.txt\n", RESET; print BOLD, CYAN, "\nNote: 1. Provide the text file in the directory $ENV{HOME}/NDATE/TEST_LOGS/ 2. Provide the name of the file as ACORN.txt. 3. Copy the entare output or required fields (PCB PART NUMBER, FIRMWARE REVISION, BOOT LOADER VERSION, CONFIG DATA VERSION) of the command 'acorn get_status ' in the text file ACORN.txt.\n", RESET; print BOLD, WHITE, " Warning: 1. All the above required fields will be compared to all of the test devices(drives). No need to copy the each drive output.\n", RESET; print BOLD, CYAN, "\n ========================================================================== \n", RESET; $pri = getchompstrip( "", '', "" ); $pri = trim($pri); if ( $pri =~ /y/i ) { print BOLD, CYAN, "\n\n You selected to compare test output with the comprison file ACORN.txt\n", RESET; if ( -e "$ENV{HOME}/NDATE/TEST_LOGS/ACORN.txt" ) { print BOLD, CYAN, "\nACORN.txt file exists in the path $ENV{PATH}/NDATE/TEST_LOGS/ACORN.txt\n", RESET; push( @hparams, "COMPARE_DDB=$pri" ); last; } print BOLD, CYAN, "\nACORN.txt file not exists in the path $ENV{PATH}/NDATE/TEST_LOGS/ - Try again\n", RESET; } elsif ( $pri =~ /n/i ) { print BOLD, CYAN, "You selected not to compare.\n", RESET; push( @hparams, "COMPARE_DDB=$pri" ); last; } elsif ( $pri eq '' ) { $pri = 'n'; print BOLD, CYAN, "You selected not to compare.\n", RESET; push( @hparams, "COMPARE_DDB=$pri" ); last; } else { print BOLD, WHITE, "\nInvalid entry - Try again.\n"; } } ## end while (1) } ## end if ($file =~ /_SATA_SCSI_Cmd_Compl/) ############################################################# #For all the scripts, the user will be prompted to enter the value #of the parameter MAIL_TO and MAIL_FROM if ( ( $file =~ /_Hot_Plug_Removal/ ) && ( $EMAIL !~ /d/i ) ) { $EMAIL = "y"; } if ( $MAIL_TO =~ /default/ ) { print BOLD, CYAN, <<'EOD', RESET; Email IDs to send mail is not set for the test Enter IDs using 'comma' as a separator EOD my $email_ids; while (1) { my $correct_email = 0; $email_ids = getchompstrip( "Email To:", "", "" ); alarm $ALARM; $email_ids = trim($email_ids); if ( $email_ids =~ /[=\$\*;\#]/ ) { print "\nEmail ids :Characters = * ; \$ # not allowed\n"; } elsif ( !length($email_ids) ) { print "\nFiler name:Please enter non empty email ids\n"; } else { my @arr2 = split( /,/, $email_ids ); foreach my $email (@arr2) { if ( !( $email =~ /@/ ) ) { $correct_email = 1; oops "Not an valid email id :$email"; } } last if ( $correct_email == 0 ); } ## end else [ if ($email_ids =~ /[=\$\*;\#]/) } ## end while (1) $MAIL_TO = $email_ids; } ## end if ($MAIL_TO =~ /default/) if ( $MAIL_FROM =~ /default/ ) { print BOLD, CYAN, <<'EOD', RESET; Email from is not set for the test Enter IDs using 'comma' as a separator EOD my $email_ids; while (1) { my $correct_email = 0; $email_ids = ""; $email_ids = getchompstrip( "Email From:", "", "" ); alarm $ALARM; $email_ids = trim($email_ids); if ( $email_ids =~ /[=\$\*;\#]/ ) { print "\nEmail ids :Characters = * ; \$ # not allowed\n"; } elsif ( !length($email_ids) ) { print "\nFiler name:Please enter non empty email ids\n"; } else { my @arr2 = split( /,/, $email_ids ); foreach my $email (@arr2) { if ( !( $email =~ /@/ ) ) { $correct_email = 1; oops "Not an valid email id :$email"; } } last if ( $correct_email == 0 ); } ## end else [ if ($email_ids =~ /[=\$\*;\#]/) } ## end while (1) $MAIL_FROM = $email_ids; } ## end if ($MAIL_FROM =~ /default/) #push(@hparams, " EMAIL=$EMAIL"); #push(@hparams, " MAIL_TO=$MAIL_TO\n"); #push(@hparams, " MAIL_FROM=$MAIL_FROM\n"); } ## end foreach $file (@final_TC) $temp_parse_id = "check_filer_setup"; push( @hparams, " KERNEL=$kernel\n" ); push( @hparams, " EMAIL=$EMAIL" ); push( @hparams, " MAIL_TO=$MAIL_TO\n" ); push( @hparams, " MAIL_FROM=$MAIL_FROM\n" ); if ( $option_TYPE eq 'C_mode' ) { #push( @hparams, " Filer_mode=$Filer_mode\n"); if ( length($Primary_Node) ) { push( @hparams, " Primary_Node=$Primary_Node\n" ); } push( @hparams, " FILER=@node\n" ); push( @hparams, " TEST_CONFIG=E\n" ); if ( $addparser eq "1" ) { push( @hparams, " TEST_SUITE_NAME=$runlist\n" ); } if ( $test_order_c == 1 ) { ## Option 1 is for selecting all maint test first push( @hparams, " Filer_mode=M" ); if ($FIXED_MODE_TEST) { if ( ( !$flag_set ) || ( $mode_flag !~ /M/i ) ) { push( @hparams, " GROUP_NO=$GROUP_NO", "\n", "KERNEL_TYPE=$KERNEL_TYPE" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams, " PARSE_ID=check_filer_setup " ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); $flag_set = 1; $mode_flag = 'M'; } } else { push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams, " PARSE_ID=check_filer_setup " ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); } } elsif ( $SSD_option == 1 ) { push( @hparams, " Filer_mode=F" ); if ($FIXED_MODE_TEST) { if ( ( !$flag_set ) || ( $mode_flag !~ /F/i ) ) { push( @hparams, " GROUP_NO=$GROUP_NO", "\n", "KERNEL_TYPE=$KERNEL_TYPE" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams, " PARSE_ID=check_filer_setup " ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); $flag_set = 1; $mode_flag = 'F'; } } else { $DurabilityFile =~ s/.thpl//g; my $runid_no = "$Run_ID\_$DurabilityFile"; push( @hparams, " GROUP_NO=$DurabilityFile", "\n", "KERNEL_TYPE=$KERNEL_TYPE " ) if ( $Durability == 1 ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams, " PARSE_ID=check_filer_setup " ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); if ( $Durability == 1 ) { push( @hparams, "\t\t$Home/NDATE/TEST_SCRIPTS/$test_type/$DurabilityFile.thpl RUNID=$Run_ID\_$DurabilityFile TEST_CONFIG = E" ); push( @hparams, "\t\t$Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams, "\t\tPARSE_ID=$runid_no" ); push( @hparams, "\t\t$Home/NDATE/SUPPORT_SCRIPTS/parser.thpl" ); push( @hparams, "\t\t$Home/NDATE/SUPPORT_SCRIPTS/nate_logpar_r41e.thpl \n" ); push( @hparams, "\t\t$Home/NDATE/SUPPORT_SCRIPTS/ems_par_r2.thpl" ); } my @ALM = ALM_push($runid_no); push( @hparams, @ALM ); } # push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/$temp_parse_id.thpl RUNID=$temp_parse_id"); } else { $maint_flag = 1; } if ( ( ( $quick_mode == 1 ) && ( $add == 1 ) ) && ( !$GROUP_NO ) ) { push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/MINI_DISK_CREATE.thpl RUNID=MINI_DISK_CREATE" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams, " PARSE_ID=MINI_DISK_CREATE " ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); $fast_mode = 1; } } elsif ( $config == 2 ) { push( @hparams, " TEST_CONFIG=C" ); if ( $addparser eq "1" ) { push( @hparams, " TEST_SUITE_NAME=$runlist\n" ); } if ($node_cluster) { push( @hparams, " FILER=$hostname,$node_cluster" ); } else { push( @hparams, " FILER=$hostname" ); } if ( $test_order_c == 1 ) { ## Option 1 is for selecting all maint test first push( @hparams, " Filer_mode=M" ); if ($FIXED_MODE_TEST) { if ( ( !$flag_set ) || ( $mode_flag !~ /M/i ) ) { push( @hparams, " GROUP_NO=$GROUP_NO", "\n", "KERNEL_TYPE=$KERNEL_TYPE" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams, " PARSE_ID=check_filer_setup " ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); $flag_set = 1; $mode_flag = 'M'; } } else { push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams, " PARSE_ID=check_filer_setup " ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); } } elsif ( $SSD_option == 1 ) { push( @hparams, " Filer_mode=F" ); if ($FIXED_MODE_TEST) { if ( ( !$flag_set ) || ( $mode_flag !~ /F/i ) ) { push( @hparams, " GROUP_NO=$GROUP_NO", "\n", "KERNEL_TYPE=$KERNEL_TYPE" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams, " PARSE_ID=check_filer_setup " ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); $flag_set = 1; $mode_flag = 'F'; } } else { push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams, " PARSE_ID=check_filer_setup " ); } } else { $maint_flag = 1; } # push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/$temp_parse_id.thpl RUNID=$temp_parse_id"); # push( @hparams, " PARSE_ID=$temp_parse_id" ); # push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" # ); # if (($quick_mode == 1)){ # push(@hparams," $Home/NDATE/SUPPORT_SCRIPTS/MINI_DISK_CREATE.thpl RUNID=MINI_DISK_CREATE"); # push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n"); # push( @hparams, " PARSE_ID=MINI_DISK_CREATE " ); # push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n"); # $fast_mode = 1; # } } else { push( @hparams, " TEST_CONFIG=D" ); if ( $addparser eq "1" ) { push( @hparams, " TEST_SUITE_NAME=$runlist\n" ); } push( @hparams, " FILER=$hostname\n" ); if ( $test_order_c == 1 ) { ## Option 1 is for selecting all maint test first push( @hparams, " Filer_mode=M" ); if ($FIXED_MODE_TEST) { if ( ( !$flag_set ) || ( $mode_flag !~ /M/i ) ) { push( @hparams, " GROUP_NO=$GROUP_NO", "\n", "KERNEL_TYPE=$KERNEL_TYPE" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams, " PARSE_ID=check_filer_setup " ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); $flag_set = 1; $mode_flag = 'M'; } } else { push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams, " PARSE_ID=check_filer_setup " ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); } } elsif ( $SSD_option == 1 ) { push( @hparams, " Filer_mode=F" ); if ($FIXED_MODE_TEST) { if ( ( !$flag_set ) || ( $mode_flag !~ /F/i ) ) { push( @hparams, " GROUP_NO=$GROUP_NO", "\n", "KERNEL_TYPE=$KERNEL_TYPE" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams, " PARSE_ID=check_filer_setup " ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); $flag_set = 1; $mode_flag = 'F'; } } else { push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams, " PARSE_ID=check_filer_setup " ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); } } else { $maint_flag = 1; # push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/$temp_parse_id.thpl RUNID=$temp_parse_id"); # push( @hparams, " PARSE_ID=$temp_parse_id " ); # push( @hparams," $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n"); } # if (($quick_mode == 1)){ # push(@hparams, # " $Home/NDATE/SUPPORT_SCRIPTS/MINI_DISK_CREATE.thpl RUNID=MINI_DISK_CREATE" # ); # push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n"); # push( @hparams, " PARSE_ID=MINI_DISK_CREATE " ); # push( @hparams," $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n"); # $fast_mode = 1; # } } ## end else [ if ($config == 2) my $error_1 = "test is only for Cluster test and cannot be included for Duel path testing\n"; my $error_2 = "Not included in this test suite \n"; my $error_3 = "test is only for Dual path and cannot be included for cluster testing\n"; $test_type = trim($test_type); # my $count =0; foreach $file (@final_TC) { # $count++; my $runid_no; foreach my $val_id ( keys %local_TC ) { if ( $local_TC{$val_id}->{name} =~ /$file/ ) { $runid_no = $val_id; my @temp_f = split( /\./, $file ); # $runid_no = $runid_no . "_" . $temp_f[0] . "_" . $count; $runid_no = $runid_no . "_" . $temp_f[0]; last; } elsif ( $SSD_option eq '1' ) { my @temp_f = split( /\./, $file ); $runid_no = "509" . "_" . $temp_f[0]; ##only for durability 60#test last; } } if ( $file =~ /_Disk_Qual_PVT/ ) { print BOLD, YELLOW, <<"EOD", reset; -------------------------------------------------------------- -------------------------------------------------------------- NOTE: For BSAS, if there are multiple dongles vendors for the test config, make sure we have an even mixed of the dongle suppliers in the test shelf. Example: For Sequioa, there must be 12 drives with Acorn dongles and 12 drives with Filbert dongles in the unit under test. -------------------------------------------------------------- -------------------------------------------------------------- EOD } ## end if ($file =~ /_DiskQual_PVT/) if ( $file =~ /_Disk_Perfm_Norm/ ) { print BOLD, YELLOW, <<"EOD", reset; ********************************************************************* -------------------------------------------------------------- The test must be run on a full shelf of drive. All drives in the shelf must be of the same bare drive model NOTE: For BSAS, if there are multiple dongles vendors for the test config, make sure we have an even mixed of the dongle suppliers in the test shelf. Example: For Sequioa, there must be 12 drives with Acorn dongles and 12 drives with Filbert dongles. -------------------------------------------------------------- ********************************************************************* EOD } ## end if ($file =~ /_Disk_Perfm_Norm/) if ( ( $file =~ /_Disk_Qual_BDP\.thpl/ ) || ( $file =~ /_Dense_IO_Perf\.thpl/ ) || ( $file =~ /_FRMT_W_O_GLIST\.thpl/ ) || ( $file =~ /_AZCS_DskQul_Perf\.thpl/ ) || ( $file =~ /_ECC_Corruption\.thpl/ ) ) { if ( $runpyth == 1 ) { set_python_path(); } my $test_drives = "single"; my @temp_f = split( /\./, $file ); my $temp_file = $temp_f[0]; my $model = 1; # print "\n--------------------------------------------------------------\n"; print "Test case selected: "; print BOLD, CYAN, "$temp_file test \n\n", RESET; if ( ( $file =~ /_Disk_Qual_BDP\.thpl/ ) && ( $mixed_config == 1 ) ) { $model = 2; print BOLD, YELLOW, "NOTE:You can execute this test only on all drives.\n\n"; } elsif ( ( $file !~ /_FRMT_W_O_GLIST\.thpl/ ) && ( $file !~ /_AZCS_DskQul_Perf\.thpl/ ) && ( $file !~ /_ECC_Corruption\.thpl/ ) ) { print <<"EOD"; You can execute this test on single disk or All disks Select one of the options to continue 1 > Enter '1' for executing this test on a single disk per Node 2 > Enter '2' for executing this test on ALL disks Default option is 1> Single disk per node Enter 'help' for more information -------------------------------------------------------------- EOD while (1) { $model = getchompstrip( "", "", "" ); alarm $ALARM; if ( $model =~ /(help|HELP|Help)/ ) { print BOLD, GREEN, "Test details mentioned in the NADQ02 test plan", RESET; } elsif ( ( $model <= 2 ) && ( $model >= 1 ) ) { if ( ( $model == 2 ) && ( $file =~ /_AZCS_DskQul_Perf\.thpl/ ) ) { oops "Please enter 1 for this test case $file, 'ALL' option is not applicable"; next; } last; } elsif ( $model eq '' ) { $model = 1; print BOLD, WHITE, "\nYou have chosen to run on single disk.\n\n", RESET; last; } else { oops "Please enter correct value 1-2/help"; } } ## end while (1) } else { print BOLD, GREEN, "You can execute this test only on single disk\n\n"; } my $len = rindex $file, '.thpl'; my $runid = substr( $file, 0, $len ); if ( $model == 1 ) { my @disk_serial; foreach my $val (@node) { #-------------------------------------------------------------- print <<"EOD"; Please enter the disk serial number for node $val For example : 3QN02C7100009843Y1H4 EOD my $disk_name = ""; if ( $config == 1 | 2 ) { while (1) { $disk_name = getchompstrip( "Serial number", "", "" ); alarm $ALARM; if ( $disk_name =~ /[=\$\*,;\#]/ ) { oops('Characters "=" "$" "*" "," ";" "$" "#" not allowed'); } elsif ( !length($disk_name) ) { oops('Disk name must be nonempty'); } else { last; } } ## end while (1) push( @disk_serial, $disk_name ); } } # end foreach (@node) =head my $disk_name = ""; my $disk_nameB = ""; if ( $config == 2 ) { while (1) { print BOLD, GREEN, "Please enter the disk serial number for filerA\n"; $disk_name = getchompstrip( "Serial number ", "", "" ); alarm $ALARM; if ( $disk_name =~ /[=\$\*,;\#]/ ) { oops( 'Characters "=" "$" "*" "," ";" "$" "#" not allowed' ); } elsif ( !length($disk_name) ) { oops('Disk name must be nonempty'); } else { last; } } ## end while (1) while (1) { print BOLD, GREEN, "Please enter the disk serial number for filerB\n"; $disk_nameB = getchompstrip( "Serial number", "", "" ); alarm $ALARM; if ( $disk_nameB =~ /[=\$\*,;\#]/ ) { oops( 'Characters "=" "$" "*" "," ";" "$" "#" not allowed' ); } elsif ( !length($disk_nameB) ) { oops('Disk name must be nonempty'); } else { last; } } ## end while (1) } =cut push( @hparams, " Filer_mode=M" ); if ($FIXED_MODE_TEST) { if ( ( !$flag_set ) || ( $mode_flag !~ /M/i ) ) { push( @hparams, " GROUP_NO=$GROUP_NO", "\n", "KERNEL_TYPE=$KERNEL_TYPE" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams, " PARSE_ID=check_filer_setup " ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); $flag_set = 1; $mode_flag = 'M'; } } else { push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams, " PARSE_ID=check_filer_setup " ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); } #if (($quick_mode == 1)){ # push(@hparams, # " $Home/NDATE/SUPPORT_SCRIPTS/MINI_DISK_CREATE.thpl RUNID=MINI_DISK_CREATE" # ); #$fast_mode = 1; #} if ( $config == 1 | 2 ) { push( @hparams, " $Home/NDATE/TEST_SCRIPTS/$test_type/$file RUNID=$runid_no TEST_CONFIG=$cluster_config TEST_DRIVES=single DRIVE_ID=$disk_serial[0] DRIVE_IDB=$disk_serial[1]" ); } #if ( $config == 2 ) { #push( @hparams, " $Home/NDATE/TEST_SCRIPTS/$test_type/$file RUNID=$runid_no TEST_CONFIG=$cluster_config TEST_DRIVES=single DRIVE_ID=$disk_name DRIVE_IDB=$disk_nameB" ); #} push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams, " PARSE_ID=$runid_no " ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); if ( ( $addparser eq "1" ) && ( $file !~ /check_filer_setup/ ) ) { push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/nate_logpar_r41e.thpl \n" ); #if($ALM_PUSH=~/y/i) { my @ALM = ALM_push($runid_no); push( @hparams, @ALM ); } } } elsif ( $model == 2 ) { push( @hparams, " Filer_mode=M" ); if ($FIXED_MODE_TEST) { if ( ( !$flag_set ) || ( $mode_flag !~ /M/i ) ) { push( @hparams, " GROUP_NO=$GROUP_NO", "\n", "KERNEL_TYPE=$KERNEL_TYPE" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams, " PARSE_ID=check_filer_setup " ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); $flag_set = 1; $mode_flag = 'M'; } } else { push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams, " PARSE_ID=check_filer_setup " ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); } push( @hparams, " $Home/NDATE/TEST_SCRIPTS/$test_type/$file RUNID=$runid_no TEST_CONFIG=$cluster_config TEST_DRIVES=all " ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams, " PARSE_ID=$runid_no " ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); if ( ( $addparser eq "1" ) && ( $file !~ /check_filer_setup/ ) ) { push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/nate_logpar_r41e.thpl \n" ); #if($ALM_PUSH=~/y/i) { my @ALM = ALM_push($runid_no); push( @hparams, @ALM ); } } } else { } print BOLD, GREEN, "$file : Test case will be tested on $hostname filer\n", RESET; } elsif ( $file =~ /SSD_precond/ ) { push( @hparams, " $Home/NDATE/TEST_SCRIPTS/$test_type/NADQ02_SSD_precond.thpl RUNID=NADQ02_SSD_precond TEST_CONFIG=$cluster_config" ); push( @hparams, " PARSE_ID=NADQ02_SSD_precond" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); if ( $addparser eq "1" ) { push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/nate_logpar_r41e.thpl \n" ); } #MINI #if($ALM_PUSH=~/y/i) { my @ALM = ALM_push('NADQ02_SSD_precond'); push( @hparams, @ALM ); } } elsif ( ( $file =~ /Hot_Plug_Removal/ ) || ( $file =~ /PwrCyc$|NSSR/ ) ) { if ( $create_flag == 0 ) { if ( $fast_mode == 0 ) { push( @hparams, " Filer_mode=F" ); # print"inside \n "; if ($FIXED_MODE_TEST) { if ( ( !$flag_set ) || ( $mode_flag !~ /F/i ) ) { push( @hparams, " GROUP_NO=$GROUP_NO", "\n", "KERNEL_TYPE=$KERNEL_TYPE" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams, " PARSE_ID=check_filer_setup " ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); $flag_set = 1; $mode_flag = 'F'; } } else { push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams, " PARSE_ID=check_filer_setup " ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); } if ( !$GROUP_NO ) { push( @hparams, " MINI_CREATE_SIZE=1", " $Home/NDATE/SUPPORT_SCRIPTS/MINI_DISK_CREATE.thpl RUNID=MINI_DISK_CREATE", " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl", " PARSE_ID=MINI_DISK_CREATE", " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl" ); } $create_flag = 1; $dele_mini_add = 1; $cleanup_added = 2; } } push( @hparams, " $Home/NDATE/TEST_SCRIPTS/$test_type/$file RUNID=$runid_no TEST_CONFIG=$cluster_config" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams, " PARSE_ID=$runid_no" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/nate_logpar_r41e.thpl \n" ); #if($ALM_PUSH=~/y/i) { my @ALM = ALM_push($runid_no); push( @hparams, @ALM ); } } else { my $fw; my $len = rindex $file, '.thpl'; my $runid = substr( $file, 0, $len ); if ( ( $file =~ /Disk_FW_DL_Dev_Rst|FW_DL_Ctrl_Rst/ ) || ( $file =~ /FileSys_Disk_FW_Download\.thpl/ ) || ( $file =~ /_FA_Byte/ ) || ( $file =~ /Disk_FW_DL_Bgnd/ ) || ( $file =~ /Disk_FW_DL/ ) || ( $file =~ /PwrCyc_FW_DL|NSSR_FW_DL/ ) || ( $file =~ /Disk_FW_FSys_IO_PwrCyc/ ) || ( $file =~ /_Ping_Pong/ ) ) { ##_Disk_FW_Download_Background if ( $flag_test1 == 0 ) { if ( ( $file =~ /Disk_FW_DL_Dev_Rst|FW_DL_Ctrl_Rst/ ) || ( $file =~ /FileSys_Disk_FW_Download\.thpl/ ) || ( $file =~ /_FA_Byte/ ) ) { print BOLD, YELLOW, "\n ========================================================================== \n"; print "\n $runid : This test case needs upgraded disk firmware. \n\n FIRMWARE FILE SETUP REQUIREMENTS:\n ================================\n\n 1. Firmware files should have a naming convention like Product_Id.Revision_No.LOD \n Example: X299_HJUPI02TSSS.NAxx.LOD or X299_HJUPI02TSSS.NQxx.LOD.\n\n 2. Delete all firmware files in NDATE/FIRMWARE/DISKFW/HIGH.\n\n 3. Copy the firmware files to $Home/NDATE/FIRMWARE/DISKFW/HIGH location before running the test case.\n\n 4. NOTE: Please ensure that the user has copied '.NQ00.LOD' file in $Home/NDATE/FIRMWARE/DISKFW/HIGH directory.This file is mandatory for 'disk_fw_update -Q'\n ** Make sure only one firmware file is copied for each Product ID\n ** NAXX or NQXX version is recommended. Other version might not work properly.\n\n Example: Below there are 2 files with same PRODUCT ID 'X299_HJUPI02TSSS' which is not allowed:\n X299_HJUPI02TSSS.NA01.LOD\n X299_HJUPI02TSSS.NA02.LOD"; } else { print BOLD, YELLOW, "\n ========================================================================== \n"; print "\n $runid : This test case needs upgraded disk firmware. \n\n FIRMWARE FILE SETUP REQUIREMENTS:\n ================================\n\n 1. Firmware files should have a naming convention like Product_Id.Revision_No.LOD \n Example: X299_HJUPI02TSSS.NAxx.LOD or X299_HJUPI02TSSS.NQxx.LOD.\n\n 2. Delete all firmware files in NDATE/FIRMWARE/DISKFW/HIGH.\n\n 3. Copy the firmware files to $Home/NDATE/FIRMWARE/DISKFW/HIGH location before running the test case.\n ** Make sure only one firmware file is copied for each Product ID\n ** NAXX or NQXX version is recommended. Other version might not work properly.\n\n Example: Below there are 2 files with same PRODUCT ID 'X299_HJUPI02TSSS' which is not allowed:\n X299_HJUPI02TSSS.NA01.LOD\n X299_HJUPI02TSSS.NA02.LOD"; } print "\n ========================================================================== \n", RESET; my @firmware = `cd $Home/NDATE/FIRMWARE/DISKFW/HIGH;ls *.LOD 2>/dev/null`; if ( @firmware < 1 ) { print BOLD, RED, "\nFirmware file not present in $Home/NDATE/FIRMWARE/DISKFW/HIGH location\n", RESET; print BOLD, RED, "\nPlease copy relevant firmware file to $Home/NDATE/FIRMWARE/DISKFW/HIGH directory before running the test case\n", RESET; my $path = "$Home/NDATE/FIRMWARE/DISKFW/HIGH"; add_fw_files($path); alarm $ALARM; } else { print BOLD, CYAN, "\nFollowing firmware files are available in the directory $Home/NDATE/FIRMWARE/DISKFW/HIGH:", RESET; $" = "\t"; print BOLD, CYAN "\n ========================================================================== \n"; print BOLD, CYAN, "\t@firmware\n"; disply_duplicates( [@firmware], "$Home/NDATE/FIRMWARE/DISKFW/HIGH" ); # print BOLD, CYAN, "Enter to continue", RESET; # getchompstrip("", '', ""); alarm $ALARM; } ## end else [ if (@firmware < 1) my @firmware_l = `cd $Home/NDATE/FIRMWARE/DISKFW/LOW;ls *.LOD 2>/dev/null`; if ( @firmware_l < 1 ) { print BOLD, RED, "\nFirmware file not present in $Home/NDATE/FIRMWARE/DISKFW/LOW location\n", RESET; print BOLD, RED, "\nPlease copy relevant firmware file to $Home/NDATE/FIRMWARE/DISKFW/LOW before running the test case\n", RESET; my $path = "$Home/NDATE/FIRMWARE/DISKFW/LOW"; add_fw_files($path); alarm $ALARM; } else { print BOLD, CYAN, "\nFollowing firmware files are available in $Home/NDATE/FIRMWARE/DISKFW/LOW location::\n", RESET; $" = "\t"; print BOLD, CYAN "========================================================================== \n"; print BOLD, CYAN, "\t@firmware_l\n", RESET; disply_duplicates( [@firmware_l], "$Home/NDATE/FIRMWARE/DISKFW/LOW" ); } =head ########################################## while(1) { print BOLD, CYAN, "\nEnter the Firmware(NAxx or NQxx):\n", RESET; print BOLD, CYAN, "\nWhere 'xx' stands for the numeric 0,1,2,3..etc. Ex: NA00 or NA02 or NQ06\n", RESET; $fw = getchompstrip("", '', ""); $fw = trim($fw); alarm $ALARM; if ($fw =~ /[=\$\*,;\#\!]/) { oops('Characters "=" "$" "*" "," ";" "$" "#" "!" not allowed'); } elsif (!length($fw)) { oops('Disk Firmware name must be nonempty'); } elsif ($fw !~ /^NA\d+$|^NQ\d+$/) { oops('Disk Firmware name must be NAxx or NQxx only. where xx stands for the numeric only(00,11,23..etc).'); }else { last; } } # end of while ##################################################################### =cut $flag_test1 = 1; } ## end if ($flag_test1 == 0) } ## end if (($file =~ /_Disk_FW_Update-Device_reset/... # if ($file =~ /_FileSys_Disk_FW_Download_2_Diff_FWs/) { =head if (( $file =~ /_Ping_Pong/ )){ print BOLD, CYAN, "==========================================================================\n"; print "$runid : This test case needs higher and lower version firmware files.. \n\n FIRMWARE FILE SETUP REQUIREMENTS:\n ================================\n\n 1. Firmware files should have a naming convention like Product_Id.Revision_No.LOD \n Example: X299_HJUPI02TSSS.NAxx.LOD or X299_HJUPI02TSSS.NQxx.LOD.\n\n 2. Delete all firmware files in ~/NDATE/FIRMWARE/DISKFW/HIGH and ~/NDATE/FIRMWARE/DISKFW/LOW.\n\n 3.Copy higher version firmware file to ~/NDATE/FIRMWARE/DISKFW/HIGH and lower version firmware file to ~/NDATE/FIRMWARE/DISKFW/LOW.\n\n ** Make sure only one firmware file is copied for each Product ID for both HIGH and LOW version\n ** NAXX or NQXX version is recommended. Other version might not work properly.\n\n Example: Below there are 2 files with same PRODUCT ID 'X299_HJUPI02TSSS' which is not allowed:\n X299_HJUPI02TSSS.NA01.LOD\n X299_HJUPI02TSSS.NA02.LOD"; print "\n ========================================================================== \n", RESET; if ( !( -e "$Home/NDATE/FIRMWARE/DISKFW/HIGH" ) ) { print "Creating directory \"HIGH\" under $Home/NDATE/FIRMWARE/DISKFW before running this test case\n"; `mkdir $Home/NDATE/FIRMWARE/DISKFW/HIGH`; } if ( !( -e "$Home/NDATE/FIRMWARE/DISKFW/LOW" ) ) { print "Creating directory \"LOW\" under $Home/NDATE/FIRMWARE/DISKFW before running this test case\n"; `mkdir $Home/NDATE/FIRMWARE/DISKFW/LOW`; } my @firmware_h = `cd $Home/NDATE/FIRMWARE/DISKFW/HIGH;ls *.LOD 2>/dev/null`; my @firmware_l = `cd $Home/NDATE/FIRMWARE/DISKFW/LOW;ls *.LOD 2>/dev/null`; if ( ( @firmware_h < 1 ) && ( @firmware_l < 1 ) ) { print BOLD, RED, "\nFirmware file not present in $Home/NDATE/FIRMWARE/DISKFW/HIGH and $Home/NDATE/FIRMWARE/DISKFW/LOW locations\n", RESET; print BOLD, RED, "\nPlease copy relevant firmware file to $Home/NDATE/FIRMWARE/DISKFW/HIGH and $Home/NDATE/FIRMWARE/DISKFW/LOW directory before running the test case\n", RESET; my $path = "$Home/NDATE/FIRMWARE/DISKFW/HIGH"; add_fw_files($path); alarm $ALARM; } if ( @firmware_h < 1 ) { print BOLD, RED, "\nFirmware file not present in $Home/NDATE/FIRMWARE/DISKFW/HIGH location\n", RESET; print BOLD, RED, "\nPlease copy relevant firmware file to $Home/NDATE/FIRMWARE/DISKFW/HIGH directory before running the test case\n", RESET; my $path = "$Home/NDATE/FIRMWARE/DISKFW/HIGH"; add_fw_files($path); alarm $ALARM; } else { print BOLD, CYAN, "Following firmware files are available in $Home/NDATE/FIRMWARE/DISKFW/HIGH location:", RESET; $" = "\t"; print BOLD, CYAN "\n ========================================================================== \n"; print BOLD, CYAN, "\t@firmware_h\n", RESET; disply_duplicates( [@firmware_h], "$Home/NDATE/FIRMWARE/DISKFW/HIGH" ); } ## end else [ if (@firmware_h < 1) if ( @firmware_l < 1 ) { print BOLD, RED, "\nFirmware file not present in $Home/NDATE/FIRMWARE/DISKFW/LOW location\n", RESET; print BOLD, RED, "\nPlease copy relevant firmware file to $Home/NDATE/FIRMWARE/DISKFW/LOW before running the test case\n", RESET; my $path = "$Home/NDATE/FIRMWARE/DISKFW/LOW"; add_fw_files($path); alarm $ALARM; } else { print BOLD, CYAN, "\nFollowing firmware files are available in $Home/NDATE/FIRMWARE/DISKFW/LOW location::\n", RESET; $" = "\t"; print BOLD, CYAN "========================================================================== \n"; print BOLD, CYAN, "\t@firmware_l\n", RESET; disply_duplicates( [@firmware_l], "$Home/NDATE/FIRMWARE/DISKFW/LOW" ); } ## end else [ if (@firmware_l < 1) # getchompstrip("Enter to continue", '', ""); alarm $ALARM; =cut =head ######################################################################### while(1) { print BOLD, CYAN, "\nEnter the Firmware(NAxx or NQxx):\n", RESET; print BOLD, CYAN, "\nWhere 'xx' stands for the numeric 0,1,2,3..etc. Ex: NA00 or NA02 or NQ06\n", RESET; $fw = getchompstrip("", '', ""); $fw = trim($fw); alarm $ALARM; if ($fw =~ /[=\$\*,;\#\!]/) { oops('Characters "=" "$" "*" "," ";" "$" "#" "!" not allowed'); } elsif (!length($fw)) { oops('Disk Firmware name must be nonempty'); } elsif ($fw !~ /^NA\d+$|^NQ\d+$/) { oops('Disk Firmware name must be NAxx or NQxx only. where xx stands for the numeric only(00,11,23..etc).'); }else { last; } } # end of while ####################################################################### =cut =head alarm $ALARM; } ## end if ($file =~ ... =cut if ( ( ( $dele_mini_add == 1 ) && ( $delete_mini_added == 0 ) ) && ( !$GROUP_NO ) ) { print BOLD, RED, "\n\n Do you want to delete mini disk created after exectuion of test(s)\n", RESET; print BOLD, RED, "\n Press y/n - Default - yes(y)\n", RESET; while (1) { my $s_val = getchompstrip( "", '', "" ); if ( ( $s_val =~ /y/i ) || ( $s_val eq '' ) ) { $skip_cleanup_mini = "y"; print BOLD, GREEN "\n Mini disk created will be cleaned up after execution of test(s)\n"; last; } elsif ( ( $s_val =~ /n/i ) ) { print BOLD, GREEN "\n Mini disk created will not be cleaned up after execution of test(s) \n"; $delete_mini_added = 1; last; } else { print BOLD, RED, " Please enter y/n: ", RESET; } } if ( $skip_cleanup_mini =~ /y/i ) { while (1) { print BOLD, WHITE "\n--------------------------------------------------------------------------\n"; print BOLD, GREEN "Do you want to Re-initilize file system after deleting mini disk\n (Note: Involves zeroing of drives - 4d Booting \n DEFAULT - No)\n"; print BOLD, WHITE "\n--------------------------------------------------------------------------"; my $choic = getchompstrip( "", '', "" ); if ( ( $choic =~ /no/i ) || ( $choic =~ /No/ ) || ( $choic eq '' ) || ( $choic =~ /n/i ) ) { if ( $choic eq '' ) { print BOLD, GREEN, "Default (No) Selected\n", RESET; } else { print BOLD, GREEN, "User selected option $choic \n", RESET; } push( @hparams, " RE_INIT = 0" ); last; } elsif ( ( $choic =~ /yes/i ) || ( $choic =~ /Yes/ ) || ( $choic =~ /y/i ) ) { print BOLD, GREEN, "User selected option $choic \n", RESET; push( @hparams, " RE_INIT = 1" ); last; } else { print BOLD, RED, "Please enter yes or no:", RESET; } } push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/DELETE_MINI_DISK.thpl RUNID=DELETE_MINI_DISK" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams, " PARSE_ID=DELETE_MINI_DISK " ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); $cleanup_added = 1; $dele_mini_add = 0; $delete_mini_added = 1; } } if ( $option_TYPE == '7_mode' ) { #push( @hparams, " $Home/NDATE/TEST_SCRIPTS/$test_type/$file RUNID=$runid_no TEST_CONFIG=$cluster_config" # ); my $arr_file = @arr_file; ##arr_file holds the number of file sys scripts if ( ( $maint_flag == 1 ) && ( $file_flag == $arr_file ) ) { ##maint_flag if for execute all filesystem test first push( @hparams, " Filer_mode=M" ); ##file_flag if flag variable used only once means just after all file sys script if ($FIXED_MODE_TEST) { if ( ( !$flag_set ) || ( $mode_flag !~ /M/i ) ) { push( @hparams, " GROUP_NO=$GROUP_NO", "\n", "KERNEL_TYPE=$KERNEL_TYPE" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams, " PARSE_ID=check_filer_setup " ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); $flag_set = 1; $mode_flag = 'M'; } } else { push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams, " PARSE_ID=check_filer_setup " ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); } } foreach my $file_arr (@arr_file) { if ( ( $file =~ /$file_arr/ ) && ( $file !~ /NADQ02_SAS_POHR|NADQ02_SSD_POHR/ ) ) { push( @hparams, " Filer_mode=F" ); if ($FIXED_MODE_TEST) { if ( ( !$flag_set ) || ( $mode_flag !~ /F/i ) ) { push( @hparams, " GROUP_NO=$GROUP_NO", "\n", "KERNEL_TYPE=$KERNEL_TYPE" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams, " PARSE_ID=check_filer_setup " ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); $flag_set = 1; $mode_flag = 'F'; } } else { push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams, " PARSE_ID=check_filer_setup " ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); } if ( ( $quick_mode == 1 ) && ( !$GROUP_NO ) ) { push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/MINI_DISK_CREATE.thpl RUNID=MINI_DISK_CREATE" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams, " PARSE_ID=MINI_DISK_CREATE " ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); $fast_mode = 1; $add = 1; } } } if ( $file =~ /NADQ02_SAS_POHR|NADQ02_SSD_POHR/ ) { if ( $pohr[$pohr_flag] =~ /F/ ) { if ($FIXED_MODE_TEST) { if ( ( !$flag_set ) || ( $mode_flag !~ /F/i ) ) { push( @hparams, " GROUP_NO=$GROUP_NO", "\n", "KERNEL_TYPE=$KERNEL_TYPE" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams, " PARSE_ID=check_filer_setup " ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); $flag_set = 1; $mode_flag = 'F'; } } else { push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams, " PARSE_ID=check_filer_setup " ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); } } push( @hparams, $pohr[$pohr_flag] ); $pohr_flag++; } push( @hparams, " $Home/NDATE/TEST_SCRIPTS/$test_type/$file RUNID=$runid_no TEST_CONFIG=$cluster_config" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams, " PARSE_ID=$runid_no" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); if ( ( $addparser eq "1" ) && ( $file !~ /check_filer_setup/ ) ) { push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/nate_logpar_r41e.thpl \n" ); } #if($ALM_PUSH=~/y/i) { my @ALM = ALM_push($runid_no); push( @hparams, @ALM ); } } if ( $option_TYPE == 'C_mode' ) { my $arr_file = @arr_file; ##arr_file holds the number of file sys scripts if ( ( $maint_flag == 1 ) && ( $file_flag == $arr_file ) ) { #if ( ( $maint_flag == 1 ) && ( $file_flag == $arr_file ) && ( $file_flag == scalar(@final_TC) ) ) ##maint_flag if for execute all filesystem test first push( @hparams, " Filer_mode=M" ); ##file_flag if flag variable used only once means just after all file sys script if ($FIXED_MODE_TEST) { if ( ( !$flag_set ) || ( $mode_flag !~ /M/i ) ) { push( @hparams, " GROUP_NO=$GROUP_NO", "\n", "KERNEL_TYPE=$KERNEL_TYPE" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams, " PARSE_ID=check_filer_setup " ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); $flag_set = 1; $mode_flag = 'M'; } } else { push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams, " PARSE_ID=check_filer_setup " ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); } } foreach my $file_arr (@arr_file) { if ( ( $file =~ /$file_arr/ ) && ( $file !~ /NADQ02_SAS_POHR|NADQ02_SSD_POHR/ ) ) { push( @hparams, " Filer_mode=F" ); if ($FIXED_MODE_TEST) { if ( ( !$flag_set ) || ( $mode_flag !~ /F/i ) ) { push( @hparams, " GROUP_NO=$GROUP_NO", "\n", "KERNEL_TYPE=$KERNEL_TYPE" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams, " PARSE_ID=check_filer_setup " ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); $flag_set = 1; $mode_flag = 'F'; } } else { push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams, " PARSE_ID=check_filer_setup " ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); } if ( ( $quick_mode == 1 ) && ( !$GROUP_NO ) ) { push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/MINI_DISK_CREATE.thpl RUNID=MINI_DISK_CREATE" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams, " PARSE_ID=MINI_DISK_CREATE" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl " ); $fast_mode = 1; $add = 1; } } } if ( $file =~ /NADQ02_SAS_POHR|NADQ02_SSD_POHR/ ) { if ( $pohr[$pohr_flag] =~ /F/ ) { push( @hparams, " Filer_mode=F" ); if ($FIXED_MODE_TEST) { if ( ( !$flag_set ) || ( $mode_flag !~ /F/i ) ) { push( @hparams, " GROUP_NO=$GROUP_NO", "\n", "KERNEL_TYPE=$KERNEL_TYPE" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams, " PARSE_ID=check_filer_setup " ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); $flag_set = 1; $mode_flag = 'F'; } } else { push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams, " PARSE_ID=check_filer_setup " ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); } } push( @hparams, $pohr[$pohr_flag] ); $pohr_flag++; } push( @hparams, " $Home/NDATE/TEST_SCRIPTS/$test_type/$file RUNID=$runid_no TEST_CONFIG=E" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams, " PARSE_ID=$runid_no" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl " ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/nate_logpar_r41e.thpl \n\n" ); @arr_file = uniq(@arr_file); if ( ($STAND_ALONE) && ( $STAND_ALONE_COUNT < scalar @arr_file ) ) { push( @hparams, " Filer_mode=F" ); push( @hparams, " GROUP_NO=$GROUP_NO", "\n", "KERNEL_TYPE=$KERNEL_TYPE" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams, " PARSE_ID=check_filer_setup " ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); $STAND_ALONE_COUNT = $STAND_ALONE_COUNT + 1; } #if($ALM_PUSH=~/y/i) { my @ALM = ALM_push($runid_no); push( @hparams, @ALM ); } push( @file_C, $file ); $file_flag++; } if ( $mini_choice =~ /y/ ) { #push(@hparams,"$Home/NDATE/SUPPORT_SCRIPTS/DELETE_MINI_DISK.thpl RUNID=DELETE_MINI_DISK"); #push(@hparams, " PARSE_ID=DELETE_MINI_DISK"); #push(@hparams,"$Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n"); } if ( $option_TYPE == '7_mode' ) { print BOLD, GREEN, "\n $file : Test case will be tested on $hostname filer\n", RESET; } } ## end else [ if (($file =~ /_Disk_Qual_BDP\.thpl/... $file_C = $file; } ## End of file addition ##By default ems parser will be executed on the file system tests. if ( ( ( $cleanup_added = 2 ) && ( $dele_mini_add != 0 ) && ( $delete_mini_added == 0 ) || ( $fast_mode == 1 ) ) && ( !$GROUP_NO ) ) { print BOLD, RED, "\n\n Do you want to delete mini disk created after exectuion of test(s)\n", RESET; print BOLD, RED, "\n Press y/n : Default - yes(y)\n", RESET; while (1) { my $s_val = getchompstrip( "", '', "" ); if ( ( $s_val =~ /y/i ) || ( $s_val eq '' ) ) { $skip_cleanup_mini = "y"; print BOLD, GREEN "\n Mini disk created will be cleaned up after execution of test(s)\n"; last; } elsif ( ( $s_val =~ /n/i ) ) { print BOLD, GREEN "\n Mini disk created will not be cleaned up after execution of test(s) \n"; $delete_mini_added = 1; last; } else { print BOLD, RED, " Please enter y/n: ", RESET; } } if ( $skip_cleanup_mini =~ /y/i ) { while (1) { print BOLD, WHITE "\n-------------------------------------------------------------------------- \n"; print BOLD, GREEN "Do you want to Re-initilize file system after deleting mini disk\n (Note: Involves zeroing of drives - 4d Booting \n DEFAULT - No)\n"; print BOLD, WHITE "\n-------------------------------------------------------------------------- "; my $choic = getchompstrip( "", '', "" ); if ( ( $choic =~ /no/i ) || ( $choic =~ /No/ ) || ( $choic eq '' ) || ( $choic =~ /n/i ) ) { if ( $choic eq '' ) { print BOLD, GREEN, "Default (No) Selected\n", RESET; } else { print BOLD, GREEN, "User selected option $choic \n", RESET; } push( @hparams, " RE_INIT = 0" ); last; } elsif ( ( $choic =~ /yes/i ) || ( $choic =~ /Yes/ ) || ( $choic =~ /y/i ) ) { print BOLD, GREEN, "User selected option $choic \n", RESET; push( @hparams, " RE_INIT = 1" ); last; } else { print BOLD, RED, "Please enter yes or no:", RESET; } } push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/DELETE_MINI_DISK.thpl RUNID=DELETE_MINI_DISK" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams, " PARSE_ID=DELETE_MINI_DISK" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl " ); $cleanup_added = 0; $delete_mini_added = 1; } } if ( ( $option_TYPE == '7_mode' ) || ( $option_TYPE == 'C_mode' ) ) { if ( $ems_parser_exec == 1 ) { push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/ems_par_r2.thpl \n" ); } ## End of file addition } if ( ( ( $mini_choice =~ /y/ ) && ( $new_cleanup_added != 1 ) && ( $dele_mini_add != 0 ) && ( $delete_mini_added == 0 ) ) && ( !$GROUP_NO ) ) { print BOLD, RED, "\n\n Do you want to delete mini disk created after exectuion of test(s)\n", RESET; print BOLD, RED, "\n Press y/n - Default - Yes(y)\n", RESET; while (1) { my $s_val = getchompstrip( "", '', "" ); if ( ( $s_val =~ /y/i ) || ( $s_val eq '' ) ) { $skip_cleanup_mini = "y"; print BOLD, GREEN "\n Mini disk created will be cleaned up after execution of test(s)\n"; last; } elsif ( ( $s_val =~ /n/i ) ) { print BOLD, GREEN "\n Mini disk created will not be cleaned up after execution of test(s) \n"; $delete_mini_added = 1; last; } else { print BOLD, RED, " Please enter y/n: ", RESET; } } if ( $skip_cleanup_mini =~ /y/i ) { while (1) { print BOLD, WHITE "\n--------------------------------------------------------------------------\n"; print BOLD, GREEN "Do you want to Re-initilize file system after deleting mini disk\n (Note: Involves zeroing of drives - 4d Booting \n DEFAULT - No)\n"; print BOLD, WHITE "\n-------------------------------------------------------------------------- "; my $choic = getchompstrip( "", '', "" ); if ( ( $choic =~ /no/i ) || ( $choic =~ /No/ ) || ( $choic eq '' ) || ( $choic =~ /n/i ) ) { if ( $choic eq '' ) { print BOLD, GREEN, "Default (No) Selected\n", RESET; } else { print BOLD, GREEN, "User selected option $choic \n", RESET; } push( @hparams, " RE_INIT = 0" ); last; } elsif ( ( $choic =~ /yes/i ) || ( $choic =~ /Yes/ ) || ( $choic =~ /y/i ) ) { print BOLD, GREEN, "User selected option $choic \n", RESET; push( @hparams, " RE_INIT = 1" ); last; } else { print BOLD, RED, "Please enter yes or no:", RESET; } } push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/DELETE_MINI_DISK.thpl RUNID=DELETE_MINI_DISK" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams, " PARSE_ID=DELETE_MINI_DISK" ); push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl " ); $new_cleanup_added = 1; $delete_mini_added = 1; } } if ( ( $option_TYPE == '7_mode' ) || ( $option_TYPE == 'C_mode' ) ) { push( @hparams, " $Home/NDATE/SUPPORT_SCRIPTS/send_result_to_console.thpl RUNID=send_result_to_console \n" ); } push( @hparams, " \}\n" ); if ( $option_TYPE == 'C_mode' ) { last; } } ## end foreach $hostname (@host_arr1) if ( $option_TYPE == 'C_mode' ) { foreach my $file (@file_C) { if ($Primary_Node) { print BOLD, GREEN, "\n $file : Test case will be tested on $Primary_Node filer(s)\n", RESET; } else { print BOLD, GREEN, "\n$file : Test case will be tested on filer(s) : " . join( ",", @node ), RESET; } } } last if ( $host_select_all == 1 ); last if ( $ADD_TEST_CASES == 1 ); =head print BOLD, CYAN, <<'EOD', RESET; Would you like to continue to add test cases to the test suite ? (y/n) Enter 'help' for more information ..................................................... EOD =cut my $runlist_flag = "n"; =head while (1) { $runlist_flag = getchompstrip( "", "", "" ); alarm $ALARM; if ( $runlist_flag =~ /(help|HELP|Help)/ ) { print BOLD, GREEN, " Enter 'y' for executing different set of tests on different filer\n", " Make sure that the filer is not selected for any other tests in the same test suite\n", " All tests will be executed in parallel mode\n"; RESET; } elsif (( $runlist_flag eq "y" ) || ( $runlist_flag eq "Y" ) || ( $runlist_flag eq "n" ) || ( $runlist_flag eq "N" ) ) { $flag_test1 = 0; last; } else { oops "Please enter correct value y/n/help"; } } ## end while (1) =cut last if ( $runlist_flag =~ /^(N|n)/ ) } ## end while (1) push( @hparams, "\}\n" ); { chdir("$Home/NDATE/TEST_LISTS") && last; oops "Not able to change location to directory:$Home/NDATE/TEST_LISTS"; } foreach (@hparams) { if ( ( ( $_ =~ /=hdd-/ ) || ( $_ =~ /=bb12-/ ) ) && ( ( $_ =~ /_IC/ ) || ( $_ =~ /_BR/ ) || ( $_ =~ /_C/ ) ) ) { #Rename the filer name my @name_arr = split( $_, "_" ); $_ = $name_arr[0]; } } my $fh = new FileHandle( $runlist, O_WRONLY | O_CREAT | O_TRUNC ) or die "cannot open \"$runlist\": $!\n"; print $fh ( join( "\n", @hparams ) . "\n" ) or die "cannot write to \"$runlist\": $!\n"; $fh->close() or die "cannot close \"$runlist\": $!\n"; undef $fh; print BOLD, GREEN, "\n------------------------------------------------------------------\n"; print " Test suite file $Home/NDATE/TEST_LISTS/$runlist created"; print "\n-------------------------------------------------------------------\n", RESET; my $defailt_vals = "$Home/NDATE/default_params"; if ( open( H_LOGFILE, ">$defailt_vals" ) ) { print( H_LOGFILE "RUNLIST=$runlist\n" ); print( H_LOGFILE "LOGLVL=$loglvl\n" ); print( H_LOGFILE "TEST_MODE=$test_mode\n" ); print( H_LOGFILE "EOE=$terminate_on_error\n" ); print( H_LOGFILE "LOGDIR=$Home/NDATE/TEST_LOGS\n" ); print( H_LOGFILE "EXECMD=$execmd\n" ); print( H_LOGFILE "EMAIL=$EMAIL\n" ); print( H_LOGFILE "EMAIL_MSG=$EMSG\n" ); print( H_LOGFILE "EMAIL_TO=$MAIL_TO\n" ); print( H_LOGFILE "EMAIL_FROM=$MAIL_FROM\n" ); if ( $logsize == 0 ) { $logsize = 10485760; } print( H_LOGFILE "LOGDIRSIZE=$logsize\n" ); print( H_LOGFILE "PYTHPATH=$python_path\n" ); close H_LOGFILE; } ## end if (open(H_LOGFILE, ">$defailt_vals"... return $runlist; } ## end sub create_runlist() sub create_local_host() { my $CLIENT = hostname(); my @clienta = split( /\./, $CLIENT ); $CLIENT = $clienta[0]; while (1) { $_ = "$Home/NDATE/FILER_INFO"; chdir($_) && last; oops "Not able to change location to directory:$Home/NDATE/FILER_INFO"; } my $filename = $CLIENT; my $ipaddress = ""; if ( !( -e $filename ) ) { my @hosts_etc = `cat /etc/hosts`; foreach my $line (@hosts_etc) { if ( $line =~ $CLIENT ) { my @ipaddr_line = split( " ", $line ); $ipaddress = $ipaddr_line[0]; } } my $fh = new FileHandle ">$filename" or die "cannot open \"$filename\": $!\n"; print $fh "default_ip=$ipaddress\nhosttype=unix" or die "cannot write to \"$filename\": $!\n"; $fh->close() or die "cannot close \"$filename\": $!\n"; #print "local host file: $filename :created\n"; undef $fh; } ## end if (!(-e $filename)) } ## end sub create_local_host() sub display_runlist ( $ ) { my ($value) = @_; my $line; my $ert_days_num = 0; chdir("$Home/NDATE/TEST_LISTS"); my $newparserexc = 0; my @test_suite_file_array = (); my $filer_id; if ( !( -e $value ) ) { print "The test suite :$value: does not exists under $Home/NDATE/TEST_LISTS \n"; exit(0); } open( H_RULLIST_FILE, "< $value " ) or die ">>>>> read: Failed opening $value <<<<<" if ( -e $value ); my $f_state = 0; my $dup_tc = ""; my $ert_t_id = 0; @test_suite_file_array = (); my $convesion = join( "\n", @test_suite_file_array ); if ( $convesion =~ /CONVERT_TO\s*=\s*CMode/ig ) { my $flag = 0; my @Filers; @Filers = $convesion =~ /FILER\s*=\s*(\S+)\,(\S+)/g; foreach (@Filers) { my $FILER_C = "$_" . "_C"; if ( !( -e "$Home/NDATE/FILER_INFO/$FILER_C" ) ) { print BOLD, RED, "CMode Configuation file for the filer $_ doesn't exist under $Home/NDATE/FILER_INFO/, kindly create and try again\n", RESET; $flag = 1; } else { system("sudo cp $Home/NDATE/FILER_INFO/$FILER_C $Home/NDATE/FILER_INFO/$_"); } } if ( $flag == 1 ) { print BOLD, RED, "Exiting from the tool", RESET; exit; } return 1; } elsif ( $convesion =~ /CONVERT_TO\s*=\s*7Mode/ ) { my $flag = 0; my $Filers; ($Filers) = $convesion =~ /FILER\s*=\s*(\S+)/g; my @Filers = split( ',', $Filers ); foreach (@Filers) { my $Filer_BR = "$_" . "_BR"; if ( !( -e "$Home/NDATE/FILER_INFO/$Filer_BR" ) ) { print BOLD, RED, "7Mode Configuation file for the filer $_ doesn't exist under $Home/NDATE/FILER_INFO/, kindly create and try again\n", RESET; $flag = 1; } else { system("sudo cp $Home/NDATE/FILER_INFO/$Filer_BR $Home/NDATE/FILER_INFO/$_"); } } if ( $flag == 1 ) { print BOLD, RED, "Exiting from the tool", RESET; exit; } return 1; } elsif ( $convesion =~ /CONVERT_TO\s*=\s*N/ig ) { my $Filer; ($Filer) = $convesion =~ /FILER\s*=\s*(\S+)/g; my @Filer = split( ',', $Filer ); foreach (@Filer) { my $Filer_C = "$_" . "_C"; my $Filer_BR = "$_" . "_BR"; if ( !( ( -e "$Home/NDATE/FILER_INFO/$_" ) || ( -e "$Home/NDATE/FILER_INFO/$Filer_C" ) || ( -e "$Home/NDATE/FILER_INFO/$Filer_BR" ) ) ) { print BOLD, RED, "Configuation file for the filer $_ doesn't exist under $Home/NDATE/FILER_INFO/, kindly create and try again\n", RESET; print BOLD, RED, "Exiting from the tool", RESET; exit; } else { #my $Filer_C = "$_"."_C"; #my $Filer_BR = "$_"."_BR"; if ( -e "$Home/NDATE/FILER_INFO/$Filer_C" ) { system("sudo cp $Home/NDATE/FILER_INFO/$Filer_C $Home/NDATE/FILER_INFO/$_"); } elsif ( -e "$Home/NDATE/FILER_INFO/$Filer_BR" ) { system("sudo cp $Home/NDATE/FILER_INFO/$Filer_BR $Home/NDATE/FILER_INFO/$_"); } } } return 1; } foreach $line (@test_suite_file_array) { my $node; if ( $line =~ /(.*)SETUP_TYPE=(.*)/ ) { $option_TYPE = $2; if ( $option_TYPE == '7' ) { $option_TYPE = '7_mode'; } else { $option_TYPE = 'C_mode'; } } if ( $line =~ /.*FILER=(.*)/ ) { @node = $1; $node = $1; } if ( $line =~ /KERNEL=(\S+)/i ) { my $kernel_type = $1; my @final_data; open( FH_NACL, "$Home/NDATE/.ntest" ); my @data = ; foreach (@data) { if ( $_ =~ /NATE_LIB\+\=\$HOME\/NDATE\/HDD_LIBS\/lib\/NACL/ ) { next; } #if($_=~/NATE_LIB\+\=\/usr\/PNATE\/nacl_lib$/){ # push(@final_data,$_); # next; #} if ( $_ =~ /usr\/PNATE\/nacl_lib\S+/ ) { #push(@final_data,'NATE_LIB+=/usr/PNATE/nacl_lib',"\n"); push( @final_data, 'NATE_LIB+=/usr/PNATE/nacl_lib_R8.4x', "\n" ) if ( $kernel_type =~ /LB|VR|KB|DB/ ); # print "\n\n kernel_type $kernel_type\n\n"; push( @final_data, 'NATE_LIB+=/usr/PNATE/nacl_lib_Rfullsteam', "\n" ) if ( $kernel_type =~ /FS/ ); next; } if ( $_ =~ /ONTAP_BRANCH/ ) { unshift( @final_data, 'ONTAP_BRANCH=nacl_lib_Rfullsteam', "\n" ) if ( $kernel_type =~ /FS/ ); unshift( @final_data, 'ONTAP_BRANCH=nacl_lib_R8.4x', "\n" ) if ( $kernel_type =~ /LB|VR|KB|DB/ ); next; } push( @final_data, $_ ); } close(FH_NACL); open( FH_NACL_new, ">$Home/NDATE/.ntest" ); print FH_NACL_new @final_data; close(FH_NACL_new); } if ( ( $line =~ /^\#/ ) || ( $line =~ /.*FILER_LIST/ ) ) { next; # skip overall result report starting with a '#' or new line. } elsif ( ( $option_TYPE == '7' ) && ( $line =~ /(.*)serial dirname=(.*) exit_on_errors=(.*)/ ) ) { $filer_id = $2; if ( !( -e "$Home/NDATE/FILER_INFO/$2" ) ) { print BOLD, RED, "\n\n FILER: $2 selected for the following tests <-- filer configuration $2 does not exists\n", RESET; } else { print BOLD, MAGENTA, "\n\n FILER: $2 selected for the following tests", RESET; #display_filertype("$2"); } $f_state = 1; } elsif ( ( $option_TYPE == 'C' ) && ( $line =~ /(.*)FILER=(.*)/ ) ) { my @node_arr2 = split( /,/, $node ); my $node_arr2 = @node_arr2; for ( my $i = 0 ; $i < $node_arr2 ; $i++ ) { if ( !( -e "$Home/NDATE/FILER_INFO/$node_arr2[$i]" ) ) { print BOLD, RED, "\n\n FILER: $node_arr2[$i] selected for the following tests <-- filer configuration $node_arr2[$i] does not exists\n", RESET; } } foreach my $line_C (@test_suite_file_array) { if ( $line_C =~ /(.*)TEST_SCRIPTS\/(.*)\/(.*)RUNID(.*)/ ) { $file_C = $3; } } $filer_name_nohup = $2; print BOLD, MAGENTA, "FILER: $2 of type C-Mode is selected for the following tests:\n", # $file_C ", RESET; $filer_id = $2; $f_state = 1; #last; } elsif ( ( $line =~ /.*check_filer_setup.thpl*/ ) || ( $line =~ /.*check_filer_setup.thpl*/ ) ) { $line =~ /(.*)SUPPORT_SCRIPTS\/(.*)RUNID(.*)/; my $tc = "$Home/NDATE/SUPPORT_SCRIPTS/$2"; # print "$tc\n"; $tc = trim($tc); if ( !( -e "$tc" ) ) { print BOLD, RED, "\n $tc does not exests", RESET; } } elsif ( ( $line =~ /.*FILERB/ ) && ( $f_state == 1 ) ) { $line =~ /(.*)FILERB\=(.*)/; if ( !( -e "$Home/NDATE/FILER_INFO/$2" ) ) { print BOLD, RED, "\n partner node : $2 <-- filer configuration does not exists\n", RESET; } else { print MAGENTA, "\n partner node : $2 \n", RESET; #display_filertype($2); } $f_state = 0; } elsif ( $line =~ /.*TEST_SCRIPTS/ ) { $line =~ /(.*)TEST_SCRIPTS\/(.*)\/(.*)RUNID(.*)/; my $tc = "$Home/NDATE/TEST_SCRIPTS/$2/$3"; $tc = trim($tc); next if ( $dup_tc eq $tc ); $dup_tc = $tc; if ( !( -e "$tc" ) ) { print BOLD, RED, "\n $tc does not exests", RESET; } else { print BOLD, CYAN, "\n $3 ", RESET; ### check for duplicate firmware files if ( $3 =~ /FW|FA/i ) { $validate = 1; } elsif ( $3 =~ /PING/i ) { $ping_pong = 1; } } } elsif ( $line =~ /.*ERT_TEST_ID/ ) { $line =~ /(.*)ERT_TEST_ID=(.*)/; if ( $ert_t_id == 0 ) { $ert_t_id = 1; print BOLD, CYAN, "\n Test starts from day $2 \n", RESET; } $ert_days_num++; } elsif ( $line =~ /.*nate_logpar_r41e.*/ ) { $newparserexc = 1; } else { } } ## end foreach $line (@test_suite_file_array) ## check for firmware files before strating the test if ( ( $validate == 1 ) || ( $ping_pong == 1 ) ) { if ( !( -e "$Home/NDATE/FIRMWARE/DISKFW/HIGH" ) ) { print "Creating directory \"LOW\" under $Home/NDATE/FIRMWARE/DISKFW before running this test case\n"; `mkdir $Home/NDATE/FIRMWARE/DISKFW/HIGH`; } my @firmware = `cd $Home/NDATE/FIRMWARE/DISKFW/HIGH;ls *.LOD 2>/dev/null`; if ( @firmware < 1 ) { print BOLD, RED, "\nFirmware file not present in $Home/NDATE/FIRMWARE/DISKFW/HIGH location\n", RESET; print BOLD, RED, "\nPlease copy relevant firmware file to $Home/NDATE/FIRMWARE/DISKFW/HIGH directory before running the test case\n", RESET; my $path = "$Home/NDATE/FIRMWARE/DISKFW/HIGH"; add_fw_files($path); alarm $ALARM; } else { print BOLD, CYAN, "\n\nFollowing firmware files are available in the directory $Home/NDATE/FIRMWARE/DISKFW/HIGH\n", RESET; $" = "\t"; print BOLD, CYAN "========================================================================== \n"; print BOLD, CYAN, "\t@firmware\n\n"; disply_duplicates( [@firmware], "$Home/NDATE/FIRMWARE/DISKFW/HIGH" ); # print BOLD, CYAN, "Enter to continue", RESET; # getchompstrip("", '', ""); alarm $ALARM; } ## end else [ if (@firmware < 1) } ### for ping_pong test check both high and low directories if ( $ping_pong == 1 ) { if ( !( -e "$Home/NDATE/FIRMWARE/DISKFW/LOW" ) ) { print "Creating directory \"LOW\" under $Home/NDATE/FIRMWARE/DISKFW before running this test case\n"; `mkdir $Home/NDATE/FIRMWARE/DISKFW/LOW`; } my @firmware = `cd $Home/NDATE/FIRMWARE/DISKFW/LOW;ls *.LOD 2>/dev/null`; if ( @firmware < 1 ) { print BOLD, RED, "\nFirmware file not present in $Home/NDATE/FIRMWARE/DISKFW/LOW location\n", RESET; print BOLD, RED, "\nPlease copy relevant firmware file to $Home/NDATE/FIRMWARE/DISKFW/LOW directory before running the test case\n", RESET; my $path = "$Home/NDATE/FIRMWARE/DISKFW/LOW"; add_fw_files($path); alarm $ALARM; } else { print BOLD, CYAN, "\nFollowing firmware files are available in the directory $Home/NDATE/FIRMWARE/DISKFW/LOW\n", RESET; $" = "\t"; print BOLD, CYAN "\n ========================================================================== \n"; print BOLD, CYAN, "\t@firmware\n\n"; disply_duplicates( [@firmware], "$Home/NDATE/FIRMWARE/DISKFW/LOW" ); # print BOLD, CYAN, "Enter to continue", RESET; # getchompstrip("", '', ""); alarm $ALARM; } ## end else [ if (@firmware < 1) } if ( $option_TYPE == '7' ) { my @filers = split( /,/, $filer_id ); for ( my $i = 0 ; $i <= $#filers ; $i++ ) { my $filer_id_BR = "$filers[$i]" . "_BR"; system("sudo cp -rf $Home/NDATE/FILER_INFO/$filer_id_BR $Home/NDATE/FILER_INFO/$filers[$i]"); # if(-e "$Home/NDATE/TEST_LISTS/$filers[$i]"){ # print "\n file exist \n"; # system("sudo rm -rf $Home/NDATE/TEST_LISTS/$filers[$i]"); # } } } else { my @filers = split( /,/, $filer_id ); for ( my $i = 0 ; $i <= $#filers ; $i++ ) { my $filer_id_C = "$filers[$i]" . "_C"; system("sudo cp -rf $Home/NDATE/FILER_INFO/$filer_id_C $Home/NDATE/FILER_INFO/$filers[$i]"); #if(-e "$Home/NDATE/TEST_LISTS/$filers[$i]"){ # print "\n file exist \n"; # system("sudo rm -rf $Home/NDATE/TEST_LISTS/$filers[$i]"); #} } } $TOTAL_ERT_DAYS = $ert_days_num; my $file_test_sute = "$Home/NDATE/TEST_LISTS/$value"; system("chmod 755 $file_test_sute"); if ( $option_TYPE == '7_mode' ) { if ( ( $newparserexc == 0 ) && ( $addparser eq "1" ) ) { #Editing the test suite file and adding the parser open( H_RULLIST_FILE_wr, ">$file_test_sute" ) or die ">>>>> read: Failed opening $value <<<<<"; my @writw_runlist = (); my $last_line; foreach (@test_suite_file_array) { my $line = $_; push( @writw_runlist, $line ); if ( $line !~ /parser\.thpl/ ) { if ( $line =~ /check_filer_setup/ ) { $last_line = "check_filer_setup"; } else { $last_line = "NADQ"; } } if ( ( $_ =~ /parser\.thpl/ ) && ( $last_line !~ /check_filer_setup/ ) ) { push( @writw_runlist, "\n TEST_SUITE_NAME=$value\n $Home/NDATE/SUPPORT_SCRIPTS/nate_logpar_r41e.thpl \n" ); } } ## end foreach (@test_suite_file_array) print H_RULLIST_FILE_wr @writw_runlist; close H_RULLIST_FILE_wr; } elsif ( ( $newparserexc == 1 ) && ( $addparser eq "2" ) ) { #Editing the test suite file and adding the parser open( H_RULLIST_FILE_wr1, ">$file_test_sute" ) or die ">>>>> read: Failed opening $value <<<<<"; my @writw_runlist = (); foreach (@test_suite_file_array) { if ( !( $_ =~ /nate_logpar_r41e/ ) ) { push( @writw_runlist, $_ ); } } print H_RULLIST_FILE_wr1 @writw_runlist; close H_RULLIST_FILE_wr1; } ## end elsif (($newparserexc == ... } if ( $enableshell == 2 ) { print "\n----------------------------------------------------- \n"; print BOLD, RED, "Maximum Log directory size specified : $tempsize GB", RESET; print "\n------------------------------------------------------ \n"; } if ( $check_filer_setup eq "N" ) { print "\n------------------------------------------------------ \n"; print BOLD, GREEN, "As user has selected -b=7, check filer setup will be skipped ", RESET; print "\n------------------------------------------------------ \n"; } print "\n------------------------------------------------------ \n"; print BOLD, GREEN, "For more details view the test suite - $Home/NDATE/TEST_LISTS/$value ", RESET; print "\n------------------------------------------------------ \n"; return 1; } ## end sub display_runlist ( $ ) sub display_tc_info() { print BOLD, YELLOW, <<'EOD', RESET; -------------------------------------------------------------------------- Test suite is a combination of test cases and filers on which test cases to execute. Same test cases can be executed on a single or multiple filers in serial or parallel mode. While selecting the test cases, by default it takes all test cases. INFORMATION: Please note that a Finisar Analyzer with SanMetrics SW must be used for the test cases: - FC-SAS_MPVV : FC/SAS Mode Page Value Verification - Disktest_Basic : Basic Data Handling: disktest - Disk_Qual_WRV : disk_qual Write/Read/Verify Test case needs upgraded disk firmware from ~/NDATE/TEST_LISTS location - Disk_FW_Update-Device_reset : Disk Firmware update with device reset - FA_Byte : FA Byte Test - FileSys_Disk_FW_Download : Disk Firmware Download For details please refer 'NADQ-02 HDD Qualification Test Plan EOD } ## end sub display_tc_info() sub check_os() { my $system_os = `uname -a`; if ( $system_os =~ "SunOS" ) { print "\n********************************************\nThis package does not support Sun solaris OS \n********************************************\n"; exit(0); } } ## end sub check_os() sub trim($) { my $string = shift; $string =~ s/^\s+|\s+$//gm; return $string; } sub execute_cmd ( $$ ) { my ( $cmd, $option ) = @_; if ( $check_ser ne "n" ) { print "\nChecking system services\n"; my $servise_all = check_services; if ( $servise_all == 0 ) { print BOLD, RED, "\nAbove services are not running\n", RESET; print BOLD, CYAN, <<'EOD', RESET; Would you like to execute the test suite? (y/n) Default is 'y' Enter 'help' for more information ......................................................... EOD while (1) { $result = getchompstrip( "", "", "" ); alarm $ALARM; $result = trim($result); if ( $result =~ /(help|HELP|Help)/ ) { print BOLD, GREEN, "\n sudo : 'sudo' is required as some tests need to have root privileges\n", " to mount the Filer root file system on Client Host to transfer\n", " Disk Drive firmware files to the Filer before the test starts\n", "\n telnet/ftp/rlogin: Ensure that telnet, ftp, rsh,\n", " rlogin(witout asking for password) features are enabled\n", " on Client Host for accessing the Client Host both for the\n", " test User as well as for the Filer under test for transferring\n", " the disk firmware files to the Filer.\n", "\n NFS : Need NFS service running on Client Host to enable/permit\n", " the specific tests to auto-mount the Filer File system on\n", " Client Host to copy the Firmware specific files.\n", RESET; } elsif ( $result =~ /(Q|q)/ ) { exit 0; } elsif ( ( $result eq "y" ) || ( $result eq "Y" ) || ( $result eq "n" ) || ( $result eq "N" ) ) { last; } elsif ( $result eq '' ) { $result = "y"; print BOLD, WHITE, "\nYou have chosen to execute Test.\n\n", RESET; last; } else { oops "Please enter correct value"; } } ## end while (1) if ( $result =~ /^(n|N)/ ) { exit 0; } } elsif ( $servise_all == 1 ) { print BOLD, GREEN, "All dependent services (nfs,rsh,telnet) are running and sudo is enabled\n\n", RESET; } } ## end if ($check_ser ne "n") if ( !($loglvl) ) { $loglvl = 3; } create_local_host(); update_runlist_EOE($runlist); { chdir("$Home/NDATE") && last; oops "Not able to change location to directory: $Home/NDATE"; } $EMSG = 'y' if ( $EMSG eq 'null' ); if ( $MAIL_TO =~ /default/ ) { print BOLD, CYAN, <<'EOD', RESET; Email IDs to send mail is not set for the test Enter IDs using 'comma' as a separator EOD my $email_ids; while (1) { my $correct_email = 0; $email_ids = getchompstrip( "Email To:", "", "" ); alarm $ALARM; $email_ids = trim($email_ids); if ( $email_ids =~ /[=\$\*;\#]/ ) { print "\nEmail ids :Characters = * ; \$ # not allowed\n"; } elsif ( !length($email_ids) ) { print "\nFiler name:Please enter non empty email ids\n"; } else { my @arr2 = split( /,/, $email_ids ); foreach my $email (@arr2) { if ( !( $email =~ /@/ ) ) { $correct_email = 1; oops "Not an valid email id :$email"; } } last if ( $correct_email == 0 ); } ## end else [ if ($email_ids =~ /[=\$\*;\#]/) } ## end while (1) $MAIL_TO = $email_ids; } ## end if ($MAIL_TO =~ /default/) if ( $MAIL_FROM =~ /default/ ) { print BOLD, CYAN, <<'EOD', RESET; Email from is not set for the test Enter IDs using 'comma' as a separator EOD my $email_ids; while (1) { my $correct_email = 0; $email_ids = ""; $email_ids = getchompstrip( "Email From:", "", "" ); alarm $ALARM; $email_ids = trim($email_ids); if ( $email_ids =~ /[=\$\*;\#]/ ) { print "\nEmail ids :Characters = * ; \$ # not allowed\n"; } elsif ( !length($email_ids) ) { print "\nFiler name:Please enter non empty email ids\n"; } else { my @arr2 = split( /,/, $email_ids ); foreach my $email (@arr2) { if ( !( $email =~ /@/ ) ) { $correct_email = 1; oops "Not an valid email id :$email"; } } last if ( $correct_email == 0 ); } ## end else [ if ($email_ids =~ /[=\$\*;\#]/) } ## end while (1) $MAIL_FROM = $email_ids; } ## end if ($MAIL_FROM =~ /default/) $execmd = $cmd; if ( !( $cmd =~ /^ERT/ ) ) { my $defailt_vals = "$Home/NDATE/default_params"; if ( ( -e "$defailt_vals" ) ) { if ( open( H_LOGFILE, ">$defailt_vals" ) ) { print( H_LOGFILE "RUNLIST=$runlist\n" ); print( H_LOGFILE "LOGLVL=$loglvl\n" ); print( H_LOGFILE "TEST_MODE=$test_mode\n" ); print( H_LOGFILE "EOE=$terminate_on_error\n" ); print( H_LOGFILE "LOGDIR=$Home/NDATE/TEST_LOGS\n" ); print( H_LOGFILE "EXECMD=$execmd\n" ); print( H_LOGFILE "EMAIL=$EMAIL\n" ); print( H_LOGFILE "EMAIL_MSG=$EMSG\n" ); print( H_LOGFILE "EMAIL_TO=$MAIL_TO\n" ); print( H_LOGFILE "EMAIL_FROM=$MAIL_FROM\n" ); if ( $logsize == 0 ) { $logsize = 10485760; } print( H_LOGFILE "LOGDIRSIZE=$logsize\n" ); print( H_LOGFILE "PYTHPATH=$python_path\n" ); close H_LOGFILE; } else { print BOLD, RED, "write:Failed opening $defailt_vals \n", RESET; } } ## end if ((-e "$defailt_vals"... } ## end if (!($cmd =~ /ERT/)) alarm 0; $EMSG = 'y' if ( $EMSG eq 'null' ); $cmd = $cmd . "MAIL_TO=$MAIL_TO EMAIL=$EMAIL MAIL_FROM=$MAIL_FROM MAIL_MSG=$EMSG FILER_TYPE=$FILER_TYPE"; $cmd = $cmd . " BOOT_MODE=$boot_mode" if ( $boot_mode != 0 ); $cmd = $cmd . " BOOT_TYPE=$boot_type"; $cmd = $cmd . " HANDLE=$dbhandle " if ( $dbhandle == 1 ); $cmd = $cmd . "| tee $logdir/$temp_file_nohup.txt"; my ( $sec, $min, $hour, $mday, $mon, $year ) = localtime(); $mon++; $year += 1900; my ( $year_1, $year_2 ) = $year =~ /^(\d{2})(\d{2})\z/; $mon = ( $mon =~ /^[0-9]$/ ) ? "0$mon" : "$mon"; $mday = ( $mday =~ /^[0-9]$/ ) ? "0$mday" : "$mday"; $hour = ( $hour =~ /^[0-9]$/ ) ? "0$hour" : "$hour"; $min = ( $min =~ /^[0-9]$/ ) ? "0$min" : "$min"; $sec = ( $sec =~ /^[0-9]$/ ) ? "0$sec" : "$sec"; my $timestamp = $year_2 . $mon . $mday . "_" . $hour . $min . $sec . "_" . $runlist; # my $timestamp = $year . $mon . $mday . "_" . $hour . $min . $sec . "_" . $runlist; if ( $cmd =~ /(.*)(STEST_FILE=.*)/ ) { $cmd = $1 . " JOBID=$timestamp " . $2; } if ( !( -e "$Home/NDATE/NATE/bin/ntest" ) ) { print BOLD, RED, "\nThe critical files required for running the test are missing.Hence not able to run the test\n\n", RESET; } if ( $option == 1 ) { exec "$cmd &"; } else { exec $cmd ; } } ## end sub execute_cmd ( $$ ) sub create_hosts_info(@) { my (@filers) = @_; { chdir("$Home/NDATE/FILER_INFO") && last; oops "Not able to change location to directory:$Home/NDATE/FILER_INFO"; } my @hparams; my $DbDir = cwd(); my $valid_in = 0; my $filer_model = "Not defined"; my $dns; my $mask; my $part_host; my $dname = ""; $filers[0] = trim( $filers[0] ); if ( $filers[0] =~ /^\d+$/ ) { $filers[1] = trim( $filers[1] ); $filers[2] = trim( $filers[2] ); $filers[3] = trim( $filers[3] ); $filers[4] = trim( $filers[4] ); $filers[5] = trim( $filers[5] ); $filers[6] = trim( $filers[6] ); $filers[7] = trim( $filers[7] ); $filers[8] = trim( $filers[8] ); $filers[9] = trim( $filers[9] ); $filers[10] = trim( $filers[10] ); $filers[11] = trim( $filers[11] ); print BOLD, WHITE, "\n"; if ( ( $filers[0] =~ /^\d+$/ ) && ( ( $filers[0] <= 4 ) && ( $filers[0] >= 1 ) ) ) { # If BR filer type 4 is invalid if ( ( $filers[0] == 4 ) && ( $fc_bm_option == 2 ) ) { print " Not a valid filer type enter 1,2 or 3 for Boliermaker \n"; $valid_in = 1; } } else { print " Not a valid filer type enter 1, 2, 3 or 4 \n"; $valid_in = 1; } if ( $filers[1] =~ /[=\$\*,;\#]/ ) { print "\nFiler name:Characters = * , ; \$ # not allowed\n"; $valid_in = 1; } elsif ( !length( $filers[1] ) ) { print "\nFiler name:Please enter non empty host id\n"; $valid_in = 1; } else { } if ( $filers[2] =~ /[=\$\*,;\#]/ ) { print "\nFiler IP: Characters = * , ; \$ # not allowed\n"; $valid_in = 1; } elsif ( !length( $filers[2] ) ) { print "\nFiler IP:Please enter non empty filer ip address\n"; $valid_in = 1; } elsif ( $filers[2] !~ /^([\d]+)\.([\d]+)\.([\d]+)\.([\d]+)$/ ) { print "\nFiler IP: $filers[2] not an valid IP address format\n"; $valid_in = 1; } else { my @ipaddr = `nslookup $filers[2]`; my $ip_found = 1; foreach my $line (@ipaddr) { if ( $line =~ ' server can' ) { $ip_found = 0; if ( ( $ping_host->ping( $filers[2] ) ) ) { $ip_found = 1; $ping_host->close(); } } } ## end foreach my $line (@ipaddr) if ( ( $ip_found == 0 ) && ( $fc_bm_option == 1 ) ) { oops("Filer IP: $filers[2] not accessible"); } } ## end else [ if ($filers[2] =~ /[=\$\*,;\#]/) if ( $filers[5] =~ /[=\$\*,;\#]/ ) { print "\nGateway IP:Characters = \$ * , ; # not allowed\n"; $valid_in = 1; } elsif ( !length( $filers[5] ) ) { print "\nGateway IP:Please enter non empty gateway ip address\n"; $valid_in = 1; } elsif ( $filers[5] !~ /^([\d]+)\.([\d]+)\.([\d]+)\.([\d]+)$/ ) { print "\nGateway IP:$filers[5] not an valid IP address format\n"; $valid_in = 1; } elsif ( !( $ping_host->ping( $filers[5] ) ) ) { oops("Gateway IP: $filers[5] is not accessible"); $ping_host->close(); } else { ; } print BOLD, WHITE, "\n"; if ( $fc_bm_option == 1 ) { if ( $filers[6] =~ /[=\$\*,;\#]/ ) { print "\nTFTP server IP:Characters = \$ * , ; # not allowed\n"; $valid_in = 1; } elsif ( !length( $filers[6] ) ) { print "\nTFTP server IP:Please enter non empty TFTP ip address\n"; $valid_in = 1; } elsif ( $filers[6] !~ /^([\d]+)\.([\d]+)\.([\d]+)\.([\d]+)$/ ) { print "\nTFTP server IP:$filers[6] not an valid IP address format\n"; $valid_in = 1; } elsif ( !( $ping_host->ping( $filers[6] ) ) ) { oops("TFTP server IP: $filers[6] is not accessible"); $ping_host->close(); } else { ; } } ## end if ($fc_bm_option == 1) if ( $filers[3] =~ /[=\$\*,;\#]/ ) { print "\nTerminal server IP: Characters = \$ * , ; # not allowed\n"; $valid_in = 1; } elsif ( !length( $filers[3] ) ) { print "\nTerminal server IP:Please enter non empty terminal server ip address\n"; $valid_in = 1; } elsif ( $filers[3] !~ /^([\d]+)\.([\d]+)\.([\d]+)\.([\d]+)$/ ) { print "\nTerminal server IP: $filers[3] not an valid IP address format\n"; $valid_in = 1; } elsif ( !( $ping_host->ping( $filers[3] ) ) ) { oops("Terminal server IP: $filers[3] is not accessible"); $ping_host->close(); } elsif ( ( $filers[6] !~ /\w+/ ) && ( $fc_bm_option == 2 ) ) { $valid_in = 1; print "Please provide the correct version of the Boilermaker filer.\n"; } elsif ( ( $filers[8] =~ /^$/ ) && ( $fc_bm_option == 2 ) ) { $valid_in = 1; print "Please provide the value for all parameters of the filer. Enter 'NULL' for default.\n"; } elsif ( ( $filers[9] =~ /^$/ ) && ( $fc_bm_option == 2 ) ) { $valid_in = 1; print "Please provide the value for all parameters of the filer. Enter 'NULL' for default.\n"; } elsif ( ( $filers[10] =~ /^$/ ) && ( $fc_bm_option == 2 ) ) { $valid_in = 1; print "Please provide the value for all parameters of the filer. Enter 'NULL' for default.\n"; } elsif ( ( $filers[8] =~ /^$/ ) && ( $fc_bm_option == 1 ) ) { $valid_in = 1; print "Please provide the value for all parameters of the filer. Enter 'NULL' for default.\n"; } elsif ( ( $filers[11] =~ /^$/ ) && ( $fc_bm_option == 2 ) ) { $valid_in = 1; print "Please provide the value of IFC port parameters of the filer.\n"; } else { ; } if ( $filers[4] =~ /^\d+$/ ) { # print "\nPlease enter numeric value for terminal server port number\n"; # $valid_in = 1; ; } if ( $valid_in == 0 ) { my $bootimage = "\'" . '/ethernet:' . $filers[6] . ',' . "$filers[7]" . ',' . $filers[2] . "\'"; my $version; #$bootimage = # "\'netboot " . "$filers[8]" . "\'" if ($fc_bm_option == 2); $version = $filers[6] if ( $fc_bm_option == 2 ); # Remove _IC or _BR $filers[1] =~ s/_IC$|_BR$|_C$//; push( @hparams, make_param( 'hostname', $filers[1] ) ); if ( $fc_bm_option == 1 ) { if ( $filers[0] < 4 ) { push( @hparams, make_param( 'hosttype', 'filer-cfe' ) ); } else { push( @hparams, make_param( 'hosttype', 'filer' ) ); } if ( ( $filers[7] ne "" ) && ( $filers[7] ne "NULL" ) ) { push( @hparams, make_param( 'part_host', $filers[7] ) ); } else { push( @hparams, make_param( 'part_host', $filers[1] ) ); } } ## end if ($fc_bm_option == 1) # For BR if ( $fc_bm_option == 2 ) { if ( $filers[0] <= 3 ) { push( @hparams, make_param( 'hosttype', 'filer-cfe' ) ); } if ( ( $filers[10] ne "" ) && ( $filers[10] ne "NULL" ) ) { push( @hparams, make_param( 'part_host', $filers[10] ) ); } else { push( @hparams, make_param( 'part_host', $filers[1] ) ); } } if ( $filers[0] < 4 ) { if ( $fc_bm_option == 1 ) { push( @hparams, make_param( 'NETBOOT', "1" ) ); push( @hparams, make_param( 'NETBOOT_FILE', $filers[7] ) ); push( @hparams, make_param( 'TFTPHOST_IP', $filers[6] ) ); push( @hparams, make_param( 'default_password', $filers[8] ) ); } else { # For B.R. NETBOOT is always 0. push( @hparams, make_param( 'NETBOOT', 0 ) ); $version = $filers[6]; push( @hparams, make_param( 'VERSION', $version ) ); push( @hparams, make_param( 'default_password', $filers[7] ) ); } ## end else [ if ($fc_bm_option == 1) } ## end if ($filers[0] < 4) push( @hparams, make_param( 'default_ip', $filers[2] ) ); push( @hparams, make_param( 'GATEWAY', $filers[5] ) ); if ( ( $filers[8] eq "" ) || ( $filers[8] !~ /\d+\.\d+\.\d+\.\d/ ) ) { push( @hparams, make_param( 'MASK', "255.255.0.0" ) ); } push( @hparams, make_param( 'MEDIATYPE', "auto" ) ); push( @hparams, make_param( 'TIMEZONE', "GMT" ) ); if ( $filers[8] !~ /^$/ ) { push( @hparams, ("conn console {conntype=serial;connhost=$filers[3];connport=$filers[4];password=$filers[7]}") ); } else { push( @hparams, ("conn console {conntype=serial;connhost=$filers[3];connport=$filers[4]}") ); } push( @hparams, ("conn rsh {conntype=rsh-socket;connhost=$filers[2];password=$filers[7]}") ); push( @hparams, ("conn rsh-socket {conntype=rsh-socket;connhost=$filers[2];password=$filers[7]}") ); push( @hparams, ("conn ssh {conntype=ssh-persist;connhost=$filers[2];username=admin;password=$filers[7]}") ); my $filename = $DbDir . '/' . $filers[1]; #my $filename; if ( $FILER_TYPE eq "IC" ) { if ( $filename !~ /_IC$/ ) { $filers[1] =~ s/_IC$//; $filename = $DbDir . '/' . $filers[1] . "_IC"; } } else { if ( $option_TYPE == '7_mode' ) { if ( $filename !~ /_BR$/ ) { $filers[1] =~ s/_BR$//; $filename = $DbDir . '/' . $filers[1] . "_BR"; } } else { if ( $filename !~ /_C$/ ) { $filers[1] =~ s/_C$//; $filename = $DbDir . '/' . $filers[1] . "_C"; } } } my $filer_name_file = substr( $filename, 0, -3 ); if ( $filers[0] == 1 ) { $filer_model = "FAS2000"; } elsif ( $filers[0] == 2 ) { $filer_model = "FAS3000"; } elsif ( $filers[0] == 3 ) { $filer_model = "FAS6000"; } elsif ( ( $filers[0] == 4 ) && ( $fc_bm_option == 1 ) ) { $filer_model = "FAS960"; } else { ; } push( @hparams, make_param( 'MODEL', $filer_model ) ); if ( ( length( $filers[8] ) ) && ( $filers[8] ne "NULL" ) ) { push( @hparams, make_param( 'MASK', $filers[8] ) ); } if ( ( length( $filers[9] ) ) && ( $filers[9] ne "NULL" ) ) { push( @hparams, make_param( 'DNS_ip', $filers[9] ) ); } my $host_result = `host $filers[2]`; if ( $host_result =~ /domain name/ ) { if ( $host_result =~ /\.*\s+domain\s+name\s+\w+\s+[a-zA-Z0-9-]*\.(.*)./ ) { $dname = $1; } } if ( $dname ne "" ) { push( @hparams, make_param( 'domain_name', $dname ) ); } if ( $filers[0] < 4 ) { push( @hparams, make_param( 'IFC', $filers[11] ) ); } else { push( @hparams, make_param( 'IFC', "e0" ) ); push( @hparams, make_param( 'bootimage', $bootimage ) ) if ( $fc_bm_option == 1 ); # For B.R. NETBOOT is always 0. #push(@hparams, make_param('NETBOOT', 0)); #push(@hparams, make_param('VERSION', $version)) if ($fc_bm_option == 2); } my $p_passwd = "$filers[7]}"; push( @hparams, make_param( 'conn 7-system {prompt_password', $p_passwd ) ); if ( $fc_bm_option == 1 ) { print BOLD, GREEN, "\nThe filer config file will be written with the following user inputs:\n", BOLD, CYAN, "-----------------------------------------------------------------------\n", "Filer MODEL : $filer_model \n", "FILER name : $filers[1] \n", "Filer IP : $filers[2] \n", "Terminal server IP : $filers[3] \n", "Port no : $filers[4] \n", "Gateway IP address : $filers[5] \n", "TFTP IP address : $filers[6] \n", "KERNEL file : $filers[7] \n", "PartnerHost : $filers[8] \n", "-----------------------------------------------------------------------\n", RESET; } ## end if ($fc_bm_option == 1) if ( $fc_bm_option == 2 ) { print BOLD, GREEN, "\nThe filer config file will be written with the following user inputs:\n", BOLD, CYAN, "-----------------------------------------------------------------------\n", "Filer MODEL : $filer_model \n", "FILER name : $filers[1] \n", "Filer IP : $filers[2] \n", "Terminal server IP : $filers[3] \n", "Port no : $filers[4] \n", "Gateway IP address : $filers[5] \n", "Version : $filers[6] \n"; if ( $filers[8] ne "NULL" ) { if ( $filers[8] =~ /\d+\.\d+\.\d+\.\d/ ) { print "MASK : $filers[8]\n"; } else { print "MASK : 255.255.0.0\n"; } } if ( $filers[9] ne "NULL" ) { print "DNS IP : $filers[9] \n"; } if ( $filers[10] ne "NULL" ) { print "PartnerHost : $filers[10] \n"; } else { print "PartnerHost : $filers[1] \n"; } print "-----------------------------------------------------------------------\n", RESET; } ## end if ($fc_bm_option == 2) my $doit = ""; my $fh; my $fh_filer; if ( -e $filename ) { print "\n"; while (1) { $doit = getchompstrip( "Overwrite?y/n", "Filer config file \"$filename\" exists\n\n", "" ); alarm $ALARM; $doit = trim($doit); if ( ( $doit eq "y" ) || ( $doit eq "Y" ) || ( $doit eq "n" ) || ( $doit eq "N" ) ) { last; } else { oops "Please enter correct value y/n"; } } ## end while (1) if ( $doit =~ /^(y|Y)/ ) { $fh = new FileHandle( $filename, O_WRONLY | O_CREAT | O_TRUNC ) or die "cannot open \"$filename\": $!\n"; print $fh ( join( "\n", @hparams ) . "\n" ) or die "cannot write to \"$filename\": $!\n"; $fh->close() or die "cannot close \"$filename\": $!\n"; undef $fh; $fh_filer = new FileHandle( $filer_name_file, O_WRONLY | O_CREAT | O_TRUNC ) or die "cannot open \"$filer_name_file\": $!\n"; print $fh_filer ( join( "\n", @hparams ) . "\n" ) or die "cannot write to \"$filer_name_file\": $!\n"; $fh_filer->close() or die "cannot close \"$filer_name_file\": $!\n"; undef $fh_filer; print BOLD, GREEN, "\nFiler configuration file overwritten.\n", RESET; } else { print BOLD, MAGENTA, "\nFiler configuration file is not overwritten\n", RESET; sleep 3; next; } } ## end if (-e $filename) if ( !( -e $filename ) ) { print "\n"; while (1) { $doit = getchompstrip( "Create it?y/n", "Filer configuration file \"$filename\" does not exists\n\n", "" ); alarm $ALARM; $doit = trim($doit); if ( ( $doit eq "y" ) || ( $doit eq "Y" ) || ( $doit eq "n" ) || ( $doit eq "N" ) ) { last; } else { oops "Please enter correct value y/n"; } } ## end while (1) if ( $doit =~ /^(y|Y)/ ) { $fh = new FileHandle( $filename, O_WRONLY | O_CREAT | O_TRUNC ) or die "cannot open \"$filename\": $!\n"; print $fh ( join( "\n", @hparams ) . "\n" ) or die "cannot write to \"$filename\": $!\n"; $fh->close() or die "cannot close \"$filename\": $!\n"; undef $fh; $fh_filer = new FileHandle( $filer_name_file, O_WRONLY | O_CREAT | O_TRUNC ) or die "cannot open \"$filer_name_file\": $!\n"; print $fh_filer ( join( "\n", @hparams ) . "\n" ) or die "cannot write to \"$filer_name_file\": $!\n"; $fh_filer->close() or die "cannot close \"$filer_name_file\": $!\n"; undef $fh_filer; print BOLD, GREEN, "\nFiler configuration file $filename created.\n\n", RESET; } else { print BOLD, MAGENTA, "\nFiler configuration file is not created\n\n\n", RESET; next; } $filename = $DbDir . '/' . $filers[1]; } ## end if (!(-e $filename)) } else { print BOLD, RED, "\n\nFiler config parameters are not correct. Please enter correct values\nUser inputs are:\n", RESET; if ( $filers[0] == 1 ) { $filer_model = "FAS2000"; } elsif ( $filers[0] == 2 ) { $filer_model = "FAS3000"; } elsif ( $filers[0] == 3 ) { $filer_model = "FAS6000"; } elsif ( ( $filers[0] == 4 ) && ( $fc_bm_option == 1 ) ) { $filer_model = "FAS960"; } else { ; } if ( $fc_bm_option == 2 ) { print BOLD, MAGENTA, "-----------------------------------------------------------------------\n", "Filer MODEL : $filer_model \n", "FILER name : $filers[1] \n", "Filer IP : $filers[2] \n", "Terminal server IP : $filers[3] \n", "Port no : $filers[4] \n", "Gateway IP address : $filers[5] \n", "Version : $filers[6] \n"; if ( ( length( $filers[8] ) ) && ( $filers[8] ne "NULL" ) ) { print "MASK : $filers[8] \n"; } if ( ( length( $filers[9] ) ) && ( $filers[9] ne "NULL" ) ) { print "DNS IP : $filers[9] \n"; } if ( ( length( $filers[10] ) ) && ( $filers[10] ne "NULL" ) ) { print "PartnerHost : $filers[10] \n"; } elsif ( $filers[10] eq "NULL" ) { print "PartnerHost : $filers[1] \n"; } print "-----------------------------------------------------------------------\n", RESET; } else { print BOLD, MAGENTA, "-----------------------------------------------------------------------\n", "Filer MODEL : $filer_model \n", "FILER name : $filers[1] \n", "Filer IP : $filers[2] \n", "Terminal server IP : $filers[3] \n", "Port no : $filers[4] \n", "Gateway IP address : $filers[5] \n", "TFTP IP address : $filers[6] \n", "KERNEL file : $filers[7] \n"; "PartnerHost : $filers[8] \n"; if ( ( length( $filers[8] ) ) && ( $filers[8] ne "NULL" ) ) { print "PartnerHost : $filers[8] \n"; } elsif ( $filers[8] eq "NULL" ) { print "PartnerHost : $filers[1] \n"; } print "-----------------------------------------------------------------------\n", RESET; } ## end else [ if ($fc_bm_option == 2) print "Press return to continue \n"; getchompstrip( "", "", "" ); next; } ## end else [ if ($valid_in == 0) } ## end if ($filers[0] =~ /^\d+$/) } ## end sub create_hosts_info(@) sub create_hosts_info_C(@) { my $version; my (@filers) = @_; { chdir("$Home/NDATE/FILER_INFO") && last; oops "Not able to change location to directory:$Home/NDATE/FILER_INFO"; } my @hparams; my $DbDir = cwd(); my $valid_in = 0; my $filer_model = "Not defined"; my $dns; my $dname = ""; my $filename; #$image_C = $filers[6]; $filers[0] = trim( $filers[0] ); if ( $filers[0] =~ /^\d+$/ ) { $filers[1] = trim( $filers[1] ); $filers[2] = trim( $filers[2] ); $filers[3] = trim( $filers[3] ); $filers[4] = trim( $filers[4] ); $filers[5] = trim( $filers[5] ); $filers[6] = trim( $filers[6] ); $filers[7] = trim( $filers[7] ); $filers[8] = trim( $filers[8] ); $filers[9] = trim( $filers[9] ); $filers[10] = trim( $filers[10] ); $filers[11] = trim( $filers[11] ); $filers[12] = trim( $filers[12] ); $filers[13] = trim( $filers[13] ); $filers[14] = trim( $filers[14] ); $filers[15] = trim( $filers[15] ); $filers[16] = trim( $filers[16] ); $filers[17] = trim( $filers[17] ); $filers[18] = trim( $filers[18] ); $filers[19] = trim( $filers[19] ); $filers[20] = trim( $filers[20] ); print BOLD, WHITE, "\n"; if ( ( $filers[0] =~ /^\d+$/ ) && ( ( $filers[0] <= 4 ) && ( $filers[0] >= 1 ) ) ) { # If BR filer type 4 is invalid if ( ( $filers[0] == 4 ) && ( $fc_bm_option == 2 ) ) { print " Not a valid filer type enter 1,2 or 3 for Boliermaker \n"; $valid_in = 1; } } else { print " Not a valid filer type enter 1, 2, 3 or 4 \n"; $valid_in = 1; } if ( $filers[1] =~ /[=\$\*,;\#]/ ) { print "\nFiler name:Characters = * , ; \$ # not allowed\n"; $valid_in = 1; } elsif ( !length( $filers[1] ) ) { print "\nFiler name:Please enter non empty host id\n"; $valid_in = 1; } else { } if ( $filers[2] =~ /[=\$\*,;\#]/ ) { print "\nFiler IP: Characters = * , ; \$ # not allowed\n"; $valid_in = 1; } elsif ( !length( $filers[2] ) ) { print "\nFiler IP:Please enter non empty filer ip address\n"; $valid_in = 1; } elsif ( $filers[2] !~ /^([\d]+)\.([\d]+)\.([\d]+)\.([\d]+)$/ ) { print "\nFiler IP: $filers[2] not an valid IP address format\n"; $valid_in = 1; } else { my @ipaddr = `nslookup $filers[2]`; my $ip_found = 1; foreach my $line (@ipaddr) { if ( $line =~ ' server can' ) { $ip_found = 0; if ( ( $ping_host->ping( $filers[2] ) ) ) { $ip_found = 1; $ping_host->close(); } } } ## end foreach my $line (@ipaddr) if ( ( $ip_found == 0 ) && ( $fc_bm_option == 1 ) ) { oops("Filer IP: $filers[2] not accessible"); } } ## end else [ if ($filers[2] =~ /[=\$\*,;\#]/) if ( $filers[6] =~ /[=\$\*,;\#]/ ) { print "\nGateway IP:Characters = \$ * , ; # not allowed\n"; $valid_in = 1; } elsif ( !length( $filers[6] ) ) { print "\nGateway IP:Please enter non empty gateway ip address\n"; $valid_in = 1; } elsif ( $filers[6] !~ /^([\d]+)\.([\d]+)\.([\d]+)\.([\d]+)$/ ) { print "\nGateway IP:$filers[6] not an valid IP address format\n"; $valid_in = 1; } elsif ( !( $ping_host->ping( $filers[6] ) ) ) { oops("Gateway IP: $filers[6] is not accessible"); $ping_host->close(); } else { ; } if ( $filers[11] =~ /[=\$\*,;\#]/ ) { print "\nCluster Gateway IP:Characters = \$ * , ; # not allowed\n"; $valid_in = 1; } elsif ( !length( $filers[11] ) ) { print "\nCluster Gateway IP:Please enter non empty gateway ip address\n"; $valid_in = 1; } elsif ( $filers[11] !~ /^([\d]+)\.([\d]+)\.([\d]+)\.([\d]+)$/ ) { print "\nCluster Gateway IP:$filers[11] not an valid IP address format\n"; $valid_in = 1; } elsif ( !( $ping_host->ping( $filers[11] ) ) ) { oops("Gateway IP: $filers[11] is not accessible"); $ping_host->close(); } else { ; } if ( $filers[14] =~ /[=\$\*,;\#]/ ) { print "\nCluster Mgmt Gateway IP:Characters = \$ * , ; # not allowed\n"; $valid_in = 1; } elsif ( !length( $filers[14] ) ) { print "\nCluster Mgmt Gateway IP:Please enter non empty gateway ip address\n"; $valid_in = 1; } elsif ( $filers[14] !~ /^([\d]+)\.([\d]+)\.([\d]+)\.([\d]+)$/ ) { print "\nCluster Mgmt Gateway IP:$filers[14] not an valid IP address format\n"; $valid_in = 1; } elsif ( !( $ping_host->ping( $filers[14] ) ) ) { oops("Cluster Mgmt Gateway IP: $filers[14] is not accessible"); $ping_host->close(); } else { ; } print BOLD, WHITE, "\n"; if ( $filers[4] =~ /[=\$\*,;\#]/ ) { print "\nTerminal server IP: Characters = \$ * , ; # not allowed\n"; $valid_in = 1; } elsif ( !length( $filers[4] ) ) { print "\nTerminal server IP:Please enter non empty terminal server ip address\n"; $valid_in = 1; } elsif ( $filers[4] !~ /^([\d]+)\.([\d]+)\.([\d]+)\.([\d]+)$/ ) { print "\nTerminal server IP: $filers[4] not an valid IP address format\n"; $valid_in = 1; } elsif ( !( $ping_host->ping( $filers[4] ) ) ) { oops("Terminal server IP: $filers[4] is not accessible"); $ping_host->close(); } elsif ( ( $filers[7] !~ /\w+/ ) && ( $fc_bm_option == 2 ) ) { $valid_in = 1; print "Please provide the correct version of the Boilermaker filer.\n"; } elsif ( $filers[8] =~ /^$/ ) { $valid_in = 1; print "Please provide the default password of the filer. This field is mandatory for all ONTAP types.\n"; } elsif ( $filers[9] =~ /^$/ ) { $valid_in = 1; print "Please provide the Cluster ip1 of the filer. This field is mandatory for all ONTAP types.\n"; } elsif ( $filers[10] =~ /^$/ ) { $valid_in = 1; print "Please provide the Cluster ip1 Port of the filer. This field is mandatory for all ONTAP types.\n"; } elsif ( $filers[12] =~ /^$/ ) { $valid_in = 1; print "Please provide the Cluster mgmt ip of the filer. This field is mandatory for all ONTAP types.\n"; } elsif ( $filers[13] =~ /^$/ ) { $valid_in = 1; print "Please provide the Cluster mgmt ip Port of the filer. This field is mandatory for all ONTAP types.\n"; } elsif ( $filers[15] =~ /^$/ ) { $valid_in = 1; print "Please provide the BASE_LICENSE of the filer. This field is mandatory for all ONTAP types.\n"; } elsif ( $filers[16] =~ /^$/ ) { $valid_in = 1; print "Please provide the SECONDARY_BASE_LICENSE of the filer. Enter 'NULL' for default.\n"; } elsif ( $filers[17] =~ /^$/ ) { $valid_in = 1; print "Please provide the Cluster Name of the filer. This field is mandatory for all ONTAP types.\n"; } elsif ( $filers[18] =~ /^$/ ) { $valid_in = 1; print "Please provide the Net Mask of the filer. Enter 'NULL' for default.\n"; } elsif ( $filers[19] =~ /^$/ ) { $valid_in = 1; print "Please provide the DNS of the filer. Enter 'NULL' for default.\n"; } elsif ( $filers[20] =~ /^$/ ) { $valid_in = 1; print "Please provide the Partner Host of the filer. Enter 'NULL' for default.\n"; } else { ; } if ( $filers[4] =~ /^\d+$/ ) { # print "\nPlease enter numeric value for terminal server port number\n"; # $valid_in = 1; ; } if ( ( length( $filers[18] ) ) && ( $filers[18] eq "NULL" ) ) { $filers[18] = "255.255.0.0"; } if ( $valid_in == 0 ) { my $bootimage = "\'" . '/ethernet:' . $filers[8] . ',' . "$filers[9]" . ',' . $filers[2] . "\'"; push( @hparams, make_param( 'hostname', "\"$filers[1]\"" ) ); # For BR if ( $fc_bm_option == 2 ) { if ( ( $filers[20] ne "" ) && ( $filers[20] ne "NULL" ) ) { push( @hparams, make_param( 'part_host', $filers[20] ) ); } else { push( @hparams, make_param( 'part_host', $filers[1] ) ); } push( @hparams, make_param( 'NETBOOT', 0 ) ); $version = $filers[7]; push( @hparams, make_param( 'VERSION', $version ) ); if ( $filers[0] <= 3 ) { push( @hparams, make_param( 'hosttype', 'filer-ng-cfe' ) ); push( @hparams, make_param( 'SITE', 'svl' ) ); if ( ( $filers[20] ne "" ) && ( $filers[20] ne "NULL" ) ) { push( @hparams, make_param( 'SFOPAIR', "\"$filers[1],$filers[20]\"" ) ); } else { push( @hparams, make_param( 'SFOPAIR', "\"$filers[1],$filers[1]\"" ) ); } push( @hparams, make_param( 'MGMT_IP', $filers[2] ) ); push( @hparams, make_param( 'MGMT_MASK', $filers[18] ) ); push( @hparams, make_param( 'MGMT_PORT', "$filers[3]" ) ); push( @hparams, make_param( 'MGMT_GATEWAY', $filers[6] ) ); push( @hparams, make_param( 'MGMT_MTU', "9000\n" ) ); push( @hparams, make_param( 'CLUSTER_PORT1', $filers[10] ) ); push( @hparams, make_param( 'CLUSTER_IP1', $filers[9] ) ); push( @hparams, make_param( 'CLUSTER_MASK1', $filers[18] ) ); push( @hparams, make_param( 'CLUSTER_GATEWAY1', $filers[11] ) ); push( @hparams, make_param( 'CLUSTER_MTU1', "9000\n" ) ); push( @hparams, make_param( 'CLUSTER_MGMT_PORT', $filers[13] ) ); push( @hparams, make_param( 'CLUSTER_MGMT_IP', $filers[12] ) ); push( @hparams, make_param( 'CLUSTER_MGMT_MASK', $filers[18] ) ); push( @hparams, make_param( 'CLUSTER_MGMT_GATEWAY', "$filers[14]\n" ) ); push( @hparams, make_param( 'BASE_LICENSE', "$filers[15]\n" ) ); push( @hparams, make_param( 'SECONDARY_BASE_LICENSE', "$filers[16]\n" ) ); push( @hparams, make_param( 'CLUSTER_NAME', "$filers[17]\n" ) ); push( @hparams, make_param( 'default_password', $filers[8] ) ); push( @hparams, make_param( 'default_ip', $filers[2] ) ); } } if ( $filers[0] < 4 ) { if ( $fc_bm_option == 2 ) { # For B.R. NETBOOT is always 0. # push(@hparams, make_param('BOOT_IMAGE', $filers[6])); if ( ( length( $filers[19] ) ) && ( $filers[19] ne "NULL" ) ) { push( @hparams, make_param( 'DNS_ip', $filers[19] ) ); } } ## end else [ if ($fc_bm_option == 1) } ## end if ($filers[0] < 4) # For B.R. NETBOOT is always 0. push( @hparams, make_param( 'TIMEZONE', "GMT" ) ); push( @hparams, ("conn pm_cons {conntype=pm_cons}") ); if ( $filers[8] !~ /^$/ ) { push( @hparams, ("conn console {conntype=serial;connhost=$filers[4];connport=$filers[5];password=$filers[8]}") ); } else { push( @hparams, ("conn console {conntype=serial;connhost=$filers[4];connport=$filers[5]}") ); } push( @hparams, ("conn rsh {conntype=rsh-socket;connhost=$filers[2];timeout=3600;password=$filers[8]}") ); push( @hparams, ("conn rsh-socket {conntype=rsh-socket;connhost=$filers[2];timeout=3600;password=$filers[8]}") ); push( @hparams, ("conn ssh {conntype=ssh-persist;connhost=$filers[2];username=admin;password=$filers[8]}") ); push( @hparams, ("conn c-login {conntype=ssh-persist;connhost=$filers[2];username=admin;password=$filers[8]}") ); push( @hparams, ("conn c-system {conntype=ssh-persist;connhost=$filers[2];username=admin;password=$filers[8]}") ); push( @hparams, ("conn c-system {initial_command=\"set -privilege test;systemshell -node local\"}") ); push( @hparams, ("conn c-system {prompt_password=$filers[8]}") ); push( @hparams, ("conn cli {prompt_password=$filers[8]}") ); $filename = $DbDir . '/' . $filers[1]; #my $filename; my $filer_name_file; if ( $filename !~ /_C$/ ) { $filers[1] =~ s/_C$//; $filename = $DbDir . '/' . $filers[1] . "_C"; } $filer_name_file = substr( $filename, 0, -2 ); if ( $filers[0] == 1 ) { $filer_model = "FAS3070"; } elsif ( $filers[0] == 2 ) { $filer_model = "FAS3000"; } elsif ( $filers[0] == 3 ) { $filer_model = "FAS6000"; } else { ; } push( @hparams, make_param( 'MODEL', $filer_model ) ); my $host_result = `host $filers[2]`; if ( $host_result =~ /domain name/ ) { if ( $host_result =~ /\.*\s+domain\s+name\s+\w+\s+[a-zA-Z0-9-]*\.(.*)./ ) { $dname = $1; push( @hparams, make_param( 'TFTPHOST', $dname ) ); } } push( @hparams, make_param( 'CONFIGS', "'$filer_model'" ) ); push( @hparams, make_param( 'IFC', $filers[3] ) ); if ( $fc_bm_option == 2 ) { print BOLD, GREEN, "\nThe filer config file will be written with the following user inputs:\n", BOLD, CYAN, "-----------------------------------------------------------------------\n", "Filer MODEL : $filer_model \n", "FILER name : $filers[1] \n", "Filer IP : $filers[2] \n", "Terminal server IP : $filers[4] \n", "Port no : $filers[5] \n", "Gateway IP address : $filers[6] \n", "Version : $filers[7] \n", "Cluster ip : $filers[9] \n", "Cluster Mgmt ip : $filers[12] \n", "Cluster Name : $filers[17] \n", "BASE_LICENSE : $filers[15] \n", "SECONDARY_BASE_LICENSE : $filers[16] \n"; if ( $filers[18] ne "NULL" ) { if ( $filers[18] =~ /\d+\.\d+\.\d+\.\d/ ) { print "MASK : $filers[18]\n"; } else { print "MASK : 255.255.255.0\n"; } } if ( $filers[19] ne "NULL" ) { print "DNS IP : $filers[19] \n"; } if ( $filers[20] ne "NULL" ) { print "PartnerHost : $filers[20] \n"; } else { print "PartnerHost : $filers[1] \n"; } "-----------------------------------------------------------------------\n", RESET; } ## end if ($fc_bm_option == 2) my $doit = ""; my $fh; my $fh_filer; if ( -e $filename ) { print "\n"; while (1) { $doit = getchompstrip( "Overwrite?y/n", "Filer config file \"$filename\" exists\n\n", "" ); alarm $ALARM; $doit = trim($doit); if ( ( $doit eq "y" ) || ( $doit eq "Y" ) || ( $doit eq "n" ) || ( $doit eq "N" ) ) { last; } else { oops "Please enter correct value y/n"; } } ## end while (1) if ( $doit =~ /^(y|Y)/ ) { $fh = new FileHandle( $filename, O_WRONLY | O_CREAT | O_TRUNC ) or die "cannot open \"$filename\": $!\n"; print $fh ( join( "\n", @hparams ) . "\n" ) or die "cannot write to \"$filename\": $!\n"; $fh->close() or die "cannot close \"$filename\": $!\n"; undef $fh; $fh_filer = new FileHandle( $filer_name_file, O_WRONLY | O_CREAT | O_TRUNC ) or die "cannot open \"$filer_name_file\": $!\n"; print $fh_filer ( join( "\n", @hparams ) . "\n" ) or die "cannot write to \"$filer_name_file\": $!\n"; $fh_filer->close() or die "cannot close \"$filer_name_file\": $!\n"; undef $fh_filer; print BOLD, GREEN, "\nFiler configuration file overwritten.\n", RESET; } else { print BOLD, MAGENTA, "\nFiler configuration file is not overwritten\n", RESET; sleep 3; next; } } ## end if (-e $filename) if ( !( -e $filename ) ) { print "\n"; while (1) { $doit = getchompstrip( "Create it?y/n", "Filer configuration file \"$filename\" does not exists\n\n", "" ); alarm $ALARM; $doit = trim($doit); if ( ( $doit eq "y" ) || ( $doit eq "Y" ) || ( $doit eq "n" ) || ( $doit eq "N" ) ) { last; } else { oops "Please enter correct value y/n"; } } ## end while (1) if ( $doit =~ /^(y|Y)/ ) { $fh = new FileHandle( $filename, O_WRONLY | O_CREAT | O_TRUNC ) or die "cannot open \"$filename\": $!\n"; print $fh ( join( "\n", @hparams ) . "\n" ) or die "cannot write to \"$filename\": $!\n"; $fh->close() or die "cannot close \"$filename\": $!\n"; undef $fh; $fh_filer = new FileHandle( $filer_name_file, O_WRONLY | O_CREAT | O_TRUNC ) or die "cannot open \"$filer_name_file\": $!\n"; print $fh_filer ( join( "\n", @hparams ) . "\n" ) or die "cannot write to \"$filer_name_file\": $!\n"; $fh_filer->close() or die "cannot close \"$filer_name_file\": $!\n"; undef $fh_filer; $fh_filer = new FileHandle( $filer_name_file, O_WRONLY | O_CREAT | O_TRUNC ) or die "cannot open \"$filer_name_file\": $!\n"; print $fh_filer ( join( "\n", @hparams ) . "\n" ) or die "cannot write to \"$filer_name_file\": $!\n"; $fh_filer->close() or die "cannot close \"$filer_name_file\": $!\n"; undef $fh_filer; print BOLD, GREEN, "\nFiler configuration file $filename created.\n\n", RESET; } else { print BOLD, MAGENTA, "\nFiler configuration file is not created\n\n\n", RESET; next; } $filename = $DbDir . '/' . $filers[1]; } ## end if (!(-e $filename)) } else { print BOLD, RED, "\n\nFiler config parameters are not correct. Please enter correct values\nUser inputs are:\n", RESET; if ( $fc_bm_option == 2 ) { print BOLD, MAGENTA, "-----------------------------------------------------------------------\n", "Filer MODEL : $filer_model \n", "FILER name : $filers[1] \n", "Filer IP : $filers[2] \n", "Terminal server IP : $filers[4] \n", "Port no : $filers[5] \n", "Gateway IP address : $filers[6] \n", "Version : $filers[7] \n", "Cluster ip : $filers[9] \n", "Cluster Mgmt ip : $filers[12] \n", "Cluster Name : $filers[17] \n", "BASE_LICENSE : $filers[15] \n", "SECONDARY_BASE_LICENSE : $filers[16] \n"; if ( $filers[18] ne "NULL" ) { if ( $filers[18] =~ /\d+\.\d+\.\d+\.\d/ ) { print "MASK : $filers[18]\n"; } else { print "MASK : 255.255.255.0\n"; } } if ( $filers[19] ne "NULL" ) { print "DNS IP : $filers[19] \n"; } if ( $filers[20] ne "NULL" ) { print "PartnerHost : $filers[20] \n"; } else { print "PartnerHost : $filers[1] \n"; } "-----------------------------------------------------------------------\n", RESET; } ## end else [ if ($fc_bm_option == 2) print "Press return to continue \n"; getchompstrip( "", "", "" ); next; } ## end else [ if ($valid_in == 0) } ## end if ($filers[0] =~ /^\d+$/) } ## end sub create_hosts_info_C(@) sub update_host($) { my ($host_name) = @_; my $host_file = "$Home/NDATE/FILER_INFO/$host_name"; my ( $line, $filer_model, $filer_type, $filer_ip, $tftp_ip, $terminal_ip, $gateway_ip, $terminal_port, $kernel_file, @host_file, $bootimage, $def_pwd, $dns, $mask, $part_host, $cluster_ip1, $cluster_ip1_gateway, $cluster_mgmt, $cluster_mgmt_gateway, $cluster_name, $base_license, $filer_port, $cluster_mgmt_port, $cluster_ip_port, $IFC, $secondary_base_license ); my $filer_config = `cat $host_file`; my $netboot = 0; foreach $line ( split /\n/, $filer_config ) { if ( $line =~ /^\#/ ) { next; # skip overall result report starting with a '#'. } elsif ( $line =~ /^NETBOOT=(.*)/ ) { $netboot = $1; last; } } foreach $line ( split /\n/, $filer_config ) { if ( $line =~ /^\#/ ) { next; # skip overall result report starting with a '#'. } elsif ( $line =~ /(.*)connhost=(.*)\;connport=(.*)\}/ ) { if ( $line !~ /password/ ) { $terminal_ip = $2; $terminal_port = $3; } else { if ( $line =~ /(.*)connhost=(.*)\;connport=(.*)\;password=(.*)\}/ ) { $terminal_ip = $2; $terminal_port = $3; } } } elsif ( $line =~ /^hosttype=(.*)/ ) { if ( $line =~ /^hosttype=filer-cfe/ ) { $filer_type = 1; } else { $filer_type = 3; } } elsif ( ( $line =~ /^GATEWAY=(.*)/ ) || ( $line =~ /^MGMT_GATEWAY=(.*)/ ) ) { $gateway_ip = $1; } elsif ( $line =~ /^MODEL=(.*)/ ) { $filer_model = $1; } elsif ( $line =~ /^DNS_ip=(.*)/ ) { $dns = $1; } elsif ( ( $line =~ /^MASK=(.*)/ ) || ( $line =~ /^*MASK=(.*)/ ) ) { $mask = $1; } elsif ( $line =~ /^part_host=(.*)/ ) { $part_host = $1; } elsif ( $line =~ /^CLUSTER_IP1=(.*)/ ) { $cluster_ip1 = $1; } elsif ( $line =~ /^CLUSTER_PORT1=(.*)/ ) { $cluster_ip_port = $1; } elsif ( $line =~ /^CLUSTER_GATEWAY1=(.*)/ ) { $cluster_ip1_gateway = $1; } elsif ( $line =~ /^BASE_LICENSE=(.*)/ ) { $base_license = $1; } elsif ( $line =~ /^SECONDARY_BASE_LICENSE=(.*)/ ) { $secondary_base_license = $1; } elsif ( $line =~ /^CLUSTER_MGMT_IP=(.*)/ ) { $cluster_mgmt = $1; } elsif ( $line =~ /^CLUSTER_MGMT_PORT=(.*)/ ) { $cluster_mgmt_port = $1; } elsif ( $line =~ /^CLUSTER_MGMT_GATEWAY=(.*)/ ) { $cluster_mgmt_gateway = $1; } elsif ( $line =~ /^MGMT_PORT=(.*)/ ) { $filer_port = $1; } elsif ( $line =~ /^CLUSTER_NAME=(.*)/ ) { $cluster_name = $1; } if ( $dns == "" ) { $dns = 'NULL'; } if ( $mask == "" ) { $mask = 'NULL'; } if ( $fc_bm_option == 1 ) { if ( !( $netboot == 1 ) ) { if ( $line =~ /(.*)ethernet:(.*)\,(.*)\,(.*)\'/ ) { $kernel_file = $3; $tftp_ip = $2; $filer_ip = $4; } } else { if ( $line =~ /^NETBOOT_FILE=(.*)/ ) { $kernel_file = $1; } elsif ( $line =~ /^default_ip=(.*)/ ) { $filer_ip = $1; } elsif ( $line =~ /^TFTPHOST_IP=(.*)/ ) { $tftp_ip = $1; } elsif ( $line =~ /^default_password=(.*)/ ) { $def_pwd = $1; } elsif ( $line =~ /^part_host=(.*)/ ) { $part_host = $1; } } ## end else [ if (!($netboot == 1)) } # end of if ($fc_bm_option == 1) # For BR if ( $fc_bm_option == 2 ) { =head if ($line =~ /^bootimage=\'netboot (.*)\'/) { $bootimage = $1; # For BR only if ($line =~ /http\:/) { $kernel_file = '-'; $tftp_ip = '-'; } } elsif ($line =~ /^NETBOOT_FILE=\'netboot (http\:.*)\'/) { $bootimage = $1; # For BR only if ($line =~ /http\:/) { $kernel_file = '-'; $tftp_ip = '-'; } } elsif ($line =~ /^default_ip=(.*)/) { $filer_ip = $1; } else { ; } =cut if ( $line =~ /^VERSION=(.*)/ ) { $bootimage = $1; $tftp_ip = '-'; #} elsif (($line =~ /^BOOT_IMAGE=(.*)/) || ($line =~ /^IMAGE=(.*)/)) { # $kernel_file = $1; } elsif ( $line =~ /^default_ip=(.*)/ ) { $filer_ip = $1; } elsif ( $line =~ /^default_password=(.*)/ ) { $def_pwd = $1; } elsif ( $line =~ /^DNS_ip=(.*)/ ) { $dns = $1; } elsif ( ( $line =~ /^MASK=(.*)/ ) || ( $line =~ /^*MASK=(.*)/ ) ) { $mask = $1; } elsif ( $line =~ /^part_host=(.*)/ ) { $part_host = $1; } elsif ( $line =~ /^IFC=(.*)/ ) { $IFC = $1; } else { ; } if ( $dns == "" ) { $dns = 'NULL'; } if ( $mask == "" ) { $mask = 'NULL'; } } ## end if ($fc_bm_option == 2) } ## end foreach $line (split /\n/, ... if ( $fc_bm_option == 1 ) { print BOLD, CYAN, "\nFiler configuration for $host_name:\n", BOLD, CYAN, "-----------------------------------------------------------------------\n", "Filer MODEL : $filer_model \n", "FILER name : $host_name \n", "Filer IP : $filer_ip \n", "Terminal server IP : $terminal_ip \n", "Port no : $terminal_port \n", "Gateway IP address : $gateway_ip \n", "TFTP IP address : $tftp_ip \n"; if ( length($part_host) ) { print "PartnerHost : $part_host \n"; } print "-----------------------------------------------------------------------\n", RESET; print BOLD, CYAN, <<'EOD', RESET; Would you like to update the filer configuration shown above? (y/n) EOD } ## End of if ($fc_bm_option == 1) if ( ( $fc_bm_option == 2 ) && ( $tftp_ip eq "-" ) && ( $option_TYPE == '7_mode' ) ) { print BOLD, CYAN, "\nFiler configuration for $host_name:\n", BOLD, CYAN, "-----------------------------------------------------------------------\n", "Filer MODEL : $filer_model \n", "FILER name : $host_name \n", "Filer IP : $filer_ip \n", "Terminal server IP : $terminal_ip \n", "Port no : $terminal_port \n", "Gateway IP address : $gateway_ip \n", "Version : $bootimage \n", "MASK : $mask \n", "DNS IP : $dns \n", "PartnerHost : $part_host \n"; print "-----------------------------------------------------------------------\n", RESET; $tftp_ip = "GARBAGE"; #$kernel_file = "GARBAGE"; print BOLD, CYAN, <<'EOD', RESET; Would you like to update the filer configuration shown above? (y/n) EOD } ## End of if ($fc_bm_option == 2) if ( ( $fc_bm_option == 2 ) && ( $tftp_ip eq "-" ) && ( $option_TYPE == 'C_mode' ) ) { print BOLD, CYAN, "\nFiler configuration for $host_name:\n", BOLD, CYAN, "-----------------------------------------------------------------------\n", "Filer MODEL : $filer_model \n", "FILER name : $host_name \n", "Filer IP : $filer_ip \n", "Terminal server IP : $terminal_ip \n", "Port no : $terminal_port \n", "Gateway IP address : $gateway_ip \n", "Version : $bootimage \n", "Cluster ip1 : $cluster_ip1 \n", "Cluster Mgmt ip : $cluster_mgmt \n", "Cluster Name : $cluster_name \n", "BASE_LICENSE : $base_license \n", "SECONDARY_BASE_LICENSE : $secondary_base_license \n"; if ( $mask ne "NULL" ) { if ( $mask =~ /\d+\.\d+\.\d+\.\d/ ) { print "MASK : $mask\n"; } else { print "MASK : 255.255.255.0\n"; } } if ( $dns ne "NULL" ) { print "DNS IP : $dns \n"; } if ( $part_host ne "NULL" ) { print "PartnerHost : $part_host \n"; } else { print "PartnerHost : $host_name \n"; } print "-----------------------------------------------------------------------\n", RESET; $tftp_ip = "GARBAGE"; #$kernel_file = "GARBAGE"; print BOLD, CYAN, <<'EOD', RESET; Would you like to update the filer configuration shown above? (y/n) EOD } ## End of if ($fc_bm_option == 2) while (1) { $result = getchompstrip( "", "", "" ); $result = trim($result); alarm $ALARM; if ( ( $result eq "y" ) || ( $result eq "Y" ) || ( $result eq "n" ) || ( $result eq "N" ) ) { last; } else { oops "Please enter correct value y/n"; } } ## end while (1) if ( $result =~ /^(Y|y)/ ) { my $cmd_filer_info = ""; my $model_no; my $kernel_file; # $kernel_file = set_kernel_file(); if ($kernel_file) { if ( $filer_model eq "FAS2000" ) { $model_no = '1' } elsif ( $filer_model eq "FAS3000" ) { $model_no = '2' } elsif ( $filer_model eq "FAS6000" ) { $model_no = '3' } elsif ( $filer_model eq "FAS960" ) { $model_no = '4' } else { print BOLD, RED, "Model number cannot be captured, Cannot update kernel file in filer config\n", RESET; } if ( $fc_bm_option == 1 ) { $cmd_filer_info = "$model_no;$host_name;$filer_ip;$terminal_ip;$terminal_port;$gateway_ip;$tftp_ip"; } elsif ( $fc_bm_option == 2 ) { $bootimage = set_kernel_version(); if ( $option_TYPE == '7_mode' ) { $cmd_filer_info = "$model_no;$host_name;$filer_ip;$terminal_ip;$terminal_port;$gateway_ip;$bootimage;$def_pwd;$mask;$dns;$part_host;$IFC"; } else { $cmd_filer_info = "$model_no;$host_name;$filer_ip;$filer_port;$terminal_ip;$terminal_port;$gateway_ip;$bootimage;$def_pwd;$cluster_ip1;$cluster_ip_port;$cluster_ip1_gateway;$cluster_mgmt;$cluster_mgmt_port;$cluster_mgmt_gateway;$base_license;$secondary_base_license;$cluster_name;$mask;$dns;$part_host"; } } else { $cmd_filer_info = ""; } } else { if ( $fc_bm_option == 1 ) { print BOLD, CYAN, <<'EOD', RESET; ------------------------------------------------------------------------------------------------------------------- Please enter the filer information in following order and semicolon (;) as a separator 1 - FAS2000 2 - FAS3000 3 - FAS6000 4 - FAS960 EOD print BOLD, CYAN, <<'EOD', RESET; Filer model Filer id Filer ip Terminal serv ip Port no Gateway ip TFTP serv ip PartnerHost ----------- -------- -------- ---------------- ------- ---------- ------------ ----------- EOD print("Example: 1 ; hdd-115 ; 172.23.8.115 ; 172.23.8.248 ; 6038 ; 172.23.8.1 ; 172.23.8.25 ; hdd-115"); } if ( $fc_bm_option == 2 ) { if ( $option_TYPE == '7_mode' ) { print BOLD, CYAN, <<'EOD', RESET; ------------------------------------------------------------------------------------------------------------------- Please enter the filer information in following order and semicolon (;) as a separator 1 - FAS2000 2 - FAS3000 3 - FAS6000 EOD print BOLD, CYAN, <<'EOD', RESET; Filer model Filer id Filer ip Terminal serv ip Port no Gateway ip Version Password MASK DNS ip PartnerHost IFC ----------- -------- -------- ---------------- ------- ---------- ------- -------- ----- ------ ----------- --- EOD print("Example: 2; hdd-96; 172.23.8.96; 172.23.8.248; 6005; 172.23.8.1; RboilermakerN_100609_0300.5d; netapp1! ; 255.255.255.0 ; 172.19.2.30 ; hdd-96\ne0a\n"); print " 1. NetApp Internal users must create soft link for the desired kernel to netboot before running NDATE3.0 'ln -s /rlse/DOT/\n", RESET; } if ( $enableshell == 2 ) { print BOLD, YELLOW, "*Please note: The maximum size permitted for the log files created for this test will be $tempsize GB To change this size limit, please invoke ndate with -z option. If there is more than one test in sequence or more than one day in ERT test, this value will internally get multplied by number of tests in sequence or number of days in ERT test, respectively. Eg: ./ndate -z =30 \n\n", RESET; print BOLD, YELLOW, "*You can disable this background shell process, using option -h=1. Re-invoke ndate with -h=1 option. Eg: ./ndate -h=1 \n", RESET; } ## end if ($enableshell == 2) print BOLD, CYAN, <<'EOD', RESET; To exit press "control+C" (^C) at any time. Enter 'help' for more information EOD my $result_options; while (1) { $result_options = getchompstrip( "", "", "" ); alarm $ALARM; $result_options = trim($result_options); if ( ( $result_options =~ /(Q|q)/ ) ) { print "Exit from the tool\n"; exit 0; } elsif ( $result_options =~ /(HELP|help)/ ) { print BOLD, YELLOW, <<'EOD', RESET; ------------------------------------------------------------------------------ For the very first time, create filer configuration file, followed by test suite and execute the test suite created. To create a test suite, user needs to create filer configuration file to be included in the test suite. Filer configuration files are used to store relevant characteristics of each filer. In order to run tests we need to describe each filer in filer configuration file. Test suite is a combination of test cases and filers on which test cases to execute. Same test cases can be executed on a single or multiple filers in serial or parallel mode. Update NDATE packages, updates all NDATE package files and does not delete,update rename new files created (host configuration files, test suites, logs etc)after package installation. Please go through the README file or the release note before updating the package and take backup if you like to keep modified existing package files. Option 5 is to execute the tests on the same test environment executed last time and nate options 'l,m,w,T' are not applicable for this option. Option 6 for creating and executing HDD Engineering Reliablity Tests ----------------------------------------------------------------------------- EOD } elsif ( ( $result_options =~ /^\d+$/ ) && ( ( $result_options <= 6 ) && ( $result_options >= 1 ) ) ) { last; } elsif ( $result_options eq '4a' ) { last; } elsif ( $result_options =~ /^(9|9f)$/i ) { last; } elsif ( $result_options == 7 ) { print BOLD, CYAN, "\n\tSelect options from below, NVME-CLI or Standalone script,", RESET; print BOLD, CYAN, "\n\t\t1.NVME-CLI\n\t\t2.Standalone Scripts\n\t\t3.LEMUR Mode\n", RESET; while (1) { my $sel_opt = getchompstrip( "", "", "" ); if ( $sel_opt =~ /^$/ ) { print BOLD, CYAN, "\n\t\tEnter Valid option , 1 or 2 or 3.\n\n", RESET; } elsif ( $sel_opt == 1 ) { print BOLD, CYAN, "\n\t\tSelected NVME-CLI \n\n", RESET; system('clear'); exe_nvme_cli(); last; } elsif ( $sel_opt == 2 ) { print BOLD, CYAN, "\n\t\tSelected Standalone script", RESET; run_stand_alone(); last; } elsif ( $sel_opt == 3 ) { print BOLD, CYAN, "\n\t\tSelected LEMUR mode ", RESET; system('clear'); run_lemur_mode(); last; } else { print BOLD, RED, "Enter Valid option , 1 or 2 \n", RESET; } } } elsif ( $result_options == 8 ) { my $back = 0; if ( $user_type == 2 ) { print BOLD, CYAN, "You are not having permissions to use the option 8\n", RESET; exit(0); } pnate_requirement_info(); if ( ( -e "/usr/PNATE/nate" ) && ( -e "/usr/PNATE/staf" ) && ( -e "/usr/PNATE/pnate" ) ) { my $pnate_upgrade; print BOLD, RED, <<'EOD', RESET; WARNING: 1) This installation option is used to install PNATE package on this server.It will overwrite the existing PNATE if any. 2) Please make sure that no other user is also re-installing the PNATE at the same-time on this server. Please enter y or n? Default value is NO.( To go back to previous options press "b") EOD while (1) { $pnate_upgrade = getchompstrip( "", "", "" ); if ( $pnate_upgrade =~ /^$/ ) { print BOLD, CYAN, "\n You selected the default value of NO.Hence reusing the PNATE installed under /usr\n", RESET; $PNATE_Upgrade = 0; last; } elsif ( ( $pnate_upgrade =~ /^n$/ ) || ( $pnate_upgrade =~ /^N$/ ) || ( $pnate_upgrade =~ /^no$/ ) || ( $pnate_upgrade =~ /^No$/ ) ) { print BOLD, CYAN, "\n You selected the value NO.Hence reusing the PNATE installed under /usr\n", RESET; $PNATE_Upgrade = 0; last; } elsif ( ( $pnate_upgrade =~ /^y$/ ) || ( $pnate_upgrade =~ /^Y$/ ) || ( $pnate_upgrade =~ /^yes$/ ) || ( $pnate_upgrade =~ /^Yes$/ ) ) { $PNATE_Upgrade = 1; last; } elsif ( $pnate_upgrade =~ /^(b|B)$/ ) { $back = 1; last; } else { print BOLD, RED, " Please enter again: ", RESET; } } } else { $PNATE_Upgrade = 1; } if ( $back == 1 ) { $result_option = init_display(); goto TEST_CASE_ADD_ERT; next; } install_pnate_package($result_options); execute_staf(); set_client(); last; } elsif ( $result_options == 10 ) { data_lake_copy(); system("clear"); banner(); goto main_disp; } else { oops "Please enter correct value 1-9/help/q"; } } ## end while (1) return $result_options; } ## end sub init_display() sub banner () { # read the version file my $pkg_ver = 0; my $nate_ui_ver = 0; my $ver_file = "$Home/NDATE_ver"; #my ($NDATE_maj, $NDATE_min, $NDATE_pat, $build_date, $common_lib_ver); my ( $NDATE_maj, $NDATE_min, $NDATE_pat, $NDATE_rels, $build_date, $common_lib_ver ); my ( $patch_flag, $release_flag ); if ( ( -e "$ver_file" ) ) { if ( open( H_VER, "< $ver_file" ) ) { foreach my $line () { if ( $line =~ /^\#/ ) { next; # skip overall result report starting with a '#'. } elsif ( $line =~ /^NDTE_MAJOR_VERSION=(.*)/ ) { $NDATE_maj = $1; } elsif ( $line =~ /^NDTE_MINOR_VERSION=(.*)/ ) { $NDATE_min = $1; } elsif ( $line =~ /^NDTE_PATCH_VERSION=(.*)/ ) { $NDATE_pat = $1; $patch_flag = 1; } elsif ( $line =~ /^NDTE_RELEASE_VERSION=(.*)/ ) { $NDATE_rels = $1; $release_flag = 1 if ( $NDATE_rels ne '' ); } elsif ( $line =~ /^DATE=(.*)/ ) { $build_date = $1; } elsif ( $line =~ /^COMMON_LIB_VER=(.*)/ ) { $common_lib_ver = $1; } } ## end foreach my $line () close H_VER; $pkg_ver = "$NDATE_maj.$NDATE_min"; $pkg_ver = "$NDATE_maj.$NDATE_min.$NDATE_pat" if ($patch_flag); $pkg_ver = "$pkg_ver.$NDATE_rels" if ($release_flag); } else { print BOLD, RED, "Read:Failed opening $ver_file \n", RESET; } } else { print BOLD, RED, "File $ver_file does not exists \n"; } print BOLD, CYAN, "\n #---------------------------------------------------------------#\n", " # #\n", " # Welcome to NetApp Drive Automation Test Environment Tool #\n", " # (NDATE) #\n", " # #\n", " # #\n", " # NDATE ver: $pkg_ver #\n", " # Build Date: $build_date #\n", " # #\n", " #---------------------------------------------------------------#\n", RESET; my $res_c = 0; $res_c = check_file_version; if ( $res_c == 1 ) { print BOLD, RED, " \n Please install the latest NDATE$NDATE_maj.$NDATE_min.$NDATE_pat Package using option 4 from the Menu\n\n", RESET; } ##978677 changes print_perl_mods(); set_client(); } ## end sub banner () sub print_perl_mods { my $Home = $ENV{HOME}; my $user = `whoami`; my $linux = `cat /etc/issue`; my $file = "$Home/NDATE/Installed_Mod"; my $out_file = "$Home/NDATE/INSTALLED_PERL_MOD"; my $perl = `/opt/bin/perl -v`; `sudo touch $file`; `sudo chmod 777 $file`; open( MOD_D, ">>$file" ); print MOD_D "\n####################################################################################\n"; `/opt/bin/perldoc -otext -d $file perllocal`; print MOD_D "\n####################################################################################\n"; print MOD_D "User - $user\n"; print MOD_D "Home Directory - $Home\n"; print MOD_D "Linux - $linux\n"; print MOD_D "Perl installed in /opt/bin - $perl\n"; print MOD_D "####################################################################################\n"; `sudo sed '\/\^\$\/d' $file > $out_file `; `sudo rm -rf $file`; } sub execute_runlist($$$$) { my ( $runlist_file, $logdir, $loglvl, $test_mode ) = @_; if ( !( -e "$Home/NDATE/TEST_LISTS/$runlist_file" ) ) { print BOLD, RED, "\n$runlist_file test suite does not exists\n", RESET; $result_option = 1; return 0; } display_runlist($runlist_file); my @command_r; push( @command_r, "$Home/NDATE/NATE/bin/ntest" ); push( @command_r, "-v none" ); #push(@command_r, "-nolocaldb"); push( @command_r, "GNOTE_LOG_ACTIVE=0" ); push( @command_r, "NATE_CONN_SERVICE=0" ); push( @command_r, "STEST_FILE=$runlist_file" ); push( @command_r, "POSTJOB=$Home/NDATE/SUPPORT_SCRIPTS/post_job.thpl" ); push( @command_r, "LOGLVL=$loglvl" ); push( @command_r, "POWERCYCLE=0" ); push( @command_r, "RUNPYTH=$runpyth" ); if ( $runpyth == 1 ) { push( @command_r, "PYTHPATH=$python_path" ); } if ( $enableshell == 1 ) { push( @command_r, "DISABLESHELL=$enableshell" ); } #push(@command_r, "$Home/NDATE/NATE/stest/stest.thpl"); push( @command_r, "stest/stest.thpl" ); # push(@command_r, "LOGLEVEL=dbg"); # push(@command_r, "STEST_DEBUG=6"); push( @command_r, "FILER=FILER" ); push( @command_r, "RUNID=HDD" ); push( @command_r, "TEST_MODE=$test_mode" ); push( @command_r, "EOE=$terminate_on_error" ); push( @command_r, "TEST_WAIT_TIME=$test_wait_time" ); push( @command_r, "CHECK_FILER_SETUP=$check_filer_setup" ); my $cmd_runlist = ( join( " ", @command_r ) . " " ); if ( $test_mode eq "DEV" ) { print BOLD, CYAN, "Test Mode selected : Development\n", RESET; } else { print BOLD, CYAN, "Test Mode selected : Qualification\n", RESET; } print BOLD, CYAN, "Log level selected : $loglvl \n", RESET; if ( $terminate_on_error == 1 ) { print BOLD, CYAN, "Test Exit Mode selected : INSPECT\n", RESET; } elsif ( $terminate_on_error == 2 ) { print BOLD, CYAN, "Test Exit Mode selected : INSPECT,FATAL\n", RESET; } elsif ( $terminate_on_error == 3 ) { print BOLD, CYAN, "Test Exit Mode selected : INSPECT,FATAL,FAIL\n", RESET; } if ( $test_wait_time != 3 ) { print BOLD, CYAN, "Individual Test Time reduced to : 10% - Applicable only for few tests \n", RESET if ( $test_wait_time == 1 ); print BOLD, CYAN, "Individual Test Time reduced to : 50% - Applicable only for few tests \n", RESET if ( $test_wait_time == 2 ); } ## end if ($test_wait_time !=... print BOLD, CYAN, "Log path set to : $logdir \n", RESET; if ( ( $EMAIL eq 'y' ) || ( $EMAIL eq 'Y' ) ) { print BOLD, CYAN, "Send email set to : $MAIL_TO \n", RESET; print BOLD, CYAN, "Email from set to : $MAIL_FROM \n", RESET; } if ( $runlist =~ /^ERT/ ) { if ( $test_wait_time == 1 ) { print BOLD, RED, "\nERT tests going to take 1 day.\n", RESET; } else { print BOLD, RED, "\nERT tests going to take $TOTAL_ERT_DAYS days.\n", RESET; } } print BOLD, CYAN, "\nCommand: $cmd_runlist \n", RESET; print BOLD, CYAN, <<'EOD', RESET; ------------------------------------------------------------------ Press ENTER to execute the test in BACKGROUND mode OR choose "f" for FOREGROUND run To go back to previous options press "b" ------------------------------------------------------------------ EOD my $state = 0; while (1) { $result = getchompstrip( "", "", "" ); alarm $ALARM; $result = trim($result); if ( $result =~ /(q|Q)/ ) { exit 0; } if ( $result =~ /(help|HELP|Help)/ ) { print BOLD, GREEN, " If the user pressed cntrl+C accidentally on the client console will terminate the test.\n", " This may happen if the client console frozen.\n", " So execute the test in background mode in case the test execution time is more.\n\n", " To terminate the test suite manually, find the process id associate with the test (ps -au |grep ntest).\n", " Kill the process id (kill -9 process_id). \n", RESET; } elsif ( $result =~ /(b|B)/ ) { $state = 1; last; } elsif ( ( $result eq "f" ) || ( $result eq "F" ) || ( $result eq "" ) ) { check_log_size(); last; } else { oops "Please choose correct option\n b - Back\n f - Foreground\n Press ENTER to Background test execution"; } } ## end while (1) if ( $state == 1 ) { { chdir("$Home/NDATE/TEST_LISTS") && last; oops "Not able to change location to directory:$Home/NDATE/TEST_LISTS"; } my @test_plans_l = <*>; $result_option = 1; $result_option = init_display if ( @test_plans_l == 1 ); return; } ## end if ($state == 1) system('clear'); my $background = 1; if ( $result =~ /^(F|f)/ ) { $background = 0; } execute_cmd( $cmd_runlist, $background ); } ## end sub execute_runlist($$$$) sub set_logdir($) { my ($logdir_path) = @_; my $out; if ( !( -d $logdir_path ) ) { $out = system("mkdir $logdir_path"); if ( ( $out == 0 ) ) { $out = system("chmod 777 $logdir_path"); if ( !( $out == 0 ) ) { print BOLD, YELLOW, "Not able to change folder permission to 777, default log path is set", RESET; return 0; } } else { print BOLD, YELLOW, "Not able to create the log folder $logdir_path, default log path set", RESET; return 0; } } else { $out = system("chmod 777 $logdir_path"); if ( ( $out == 0 ) ) { } else { print BOLD, YELLOW, "Not able to change folder permission to 777, default log path set", RESET; return 0; } } ## end else [ if (!(-d $logdir_path)) # Update the .ntest file # my @new_file; my $ntest_path = "$Home/NDATE/.ntest"; system("chmod 764 $ntest_path"); if ( open( H_LOGFILE, "< $ntest_path" ) ) { foreach my $line () { trim($line); if ( ( $line =~ /Default path/ ) || ( $line =~ /LOGDIR=/ ) ) { } else { push( @new_file, "$line" ); } } push( @new_file, "LOGDIR=$logdir_path #Default path\n" ); close H_LOGFILE; } else { print BOLD, RED, "Not able to modify the log directory path in $ntest_path, default path set \n", RESET; return 0; } if ( open( H_LOGFILE, "> $ntest_path" ) ) { foreach my $line (@new_file) { print( H_LOGFILE $line ); } close H_LOGFILE; } else { print BOLD, RED, "Not able to modify the log directory path in $ntest_path, default path set \n", RESET; return 0; } return 1; } ## end sub set_logdir($) sub check_services() { my $all_services_up = 1; my $logname = $ENV{LOGNAME}; # Check for server is connected to the network my $connections = `netstat -an | grep tcp | egrep -i 'established|time_waiti|LISTEN' | wc -l`; if ( $connections < 1 ) { print BOLD, RED, "Server is not connected to the network, exiting from the test\n", RESET; $all_services_up = 0; } # Check for if sudo is installed my $sudo_install = `whereis sudo`; if ( !( $sudo_install =~ /sudo:/ ) ) { print BOLD, RED, "sudo is not installed.\n", RESET; $all_services_up = 0; } # Check for user is sudo user my $sudo_user = `sudo -u $logname date 2> tmp3214`; my $tmp2_l = `cat tmp3214`; if ( $tmp2_l =~ /not in the sudoers file/ ) { print BOLD, RED, "sudo is not enabled for $logname\n", RESET; $all_services_up = 0; } system("rm tmp3214"); # Check for system type my @support_ver_out = `cat /etc/issue`; my $support_ver = $support_ver_out[0]; my $service; if ( ( $support_ver =~ /.*Red Hat Linux/ ) || ( $support_ver =~ /.*Fedora/ ) || ( $support_ver =~ /.*Red Hat Enterprise/ ) ) { # check for .rhosts file if ( !( -e "$Home/.rhosts" ) ) { system("echo + > $Home/.rhosts"); } system("chmod 444 $Home/.rhosts"); # Check for rlogin,ftp,rsh and telnet services are enabled $service = `/sbin/chkconfig --list rlogin`; if ( !( $service =~ /(.*)rlogin(.*)on/ ) ) { print BOLD, RED, " rlogin service not enabled\n", RESET; $all_services_up = 0; } $service = `/sbin/chkconfig --list telnet`; if ( !( $service =~ /(.*)telnet(.*)on/ ) ) { print BOLD, RED, " telnet service not enabled\n", RESET; $all_services_up = 0; } $service = `/sbin/chkconfig --list rsh`; if ( !( $service =~ /(.*)rsh(.*)on/ ) ) { print BOLD, RED, " rsh service not enabled\n", RESET; $all_services_up = 0; } $service = `/sbin/chkconfig --list nfs`; if ( !( $service =~ /(.*)nfs(.*):off/ ) ) { print BOLD, RED, " nfs service not enabled\n", RESET; $all_services_up = 0; } } elsif ( $support_ver =~ /.*Ubuntu/ ) { # Check for rlogin,ftp,rsh and telnet services are enabled # check for .rhosts file if ( !( -e "$Home/.rhosts" ) ) { system("echo ++ > $Home/.rhosts"); } system("chmod 444 $Home/.rhosts"); $service = `dpkg --get-selections | grep telnet`; if ( !( $service =~ /(.*)telnet(.*)install/ ) ) { print BOLD, RED, " telnet service not enabled\n", RESET; $all_services_up = 0; } $service = `dpkg --get-selections | grep rsh`; if ( !( $service =~ /(.*)rsh(.*)install/ ) ) { print BOLD, RED, " rsh service not enabled\n", RESET; $all_services_up = 0; } $service = `dpkg --get-selections | grep nfs`; if ( !( $service =~ /(.*)nfs(.*)install/ ) ) { print BOLD, RED, " nfs service not enabled\n", RESET; $all_services_up = 0; } } ## end elsif ($support_ver =~ /.*Ubuntu/) # Check for rlogin,ftp,rsh and telnet services are running $service = `ps aux | grep telnet |grep telnetd | wc -l`; if ( ( $service < 1 ) ) { print BOLD, RED, " telnet service not running, exiting from the test.\n", " You can disable this check services feature by using -s= ndate option. \n", " ./ndate -s=n \n", RESET; $all_services_up = 0; exit 0; } return $all_services_up; } ## end sub check_services() sub update_runlist() { { chdir("$Home/NDATE/TEST_LISTS") && last; oops "Not able to change location to directory:$Home/NDATE/TEST_LISTS"; } my @runlist = <*>; if ( @runlist < 1 ) { create_runlist(); } else { my $my_runlist; my @filers_ent; my @test_plans = <*>; print BOLD, CYAN, "\n------------------------------------------------------\n\nSelect one of the test suite available for modification\nTo go back to the previous options press 'b'\n-----------------------------------------------------\n"; foreach my $test_plan (@test_plans) { if ( !( $test_plan =~ /^ERT/ ) ) { print BOLD, MAGENTA, "$test_plan \n", RESET; } } my $back_t = 0; while (1) { if ( ( $runlist =~ /(NULL|null)/ ) || ( $runlist =~ /^ERT/ ) ) { $my_runlist = getchompstrip( "", '', "" ); } else { $my_runlist = getchompstrip( "Default ", '', "$runlist" ); } $my_runlist = trim($my_runlist); alarm $ALARM; if ( ( $my_runlist eq "b" ) || ( $my_runlist eq "B" ) ) { $result_option = 2; $back_t = 1; last; } if ( $my_runlist =~ /[=\$\*,\#]/ ) { oops('Characters "=" "$" "*" "," "$" "#" not allowed'); } elsif ( $my_runlist =~ /^ERT/ ) { oops('This option is not supported for ERT test'); } elsif ( !length($my_runlist) ) { oops('runlist must be nonempty'); } elsif ( !( -e $my_runlist ) ) { print BOLD, YELLOW, "\n ******* The test suite $my_runlist does not exists. Please select again *******\n", RESET; } else { display_runlist($my_runlist); last; } } ## end while (1) next if ( $back_t == 1 ); print BOLD, CYAN, <<'EOD', RESET; Please enter the name of the filer you would like to run the test on --------------------------------------------------------------------------- Example : filerA,filerB Enter 'help' for more information EOD { chdir("$Home/NDATE/FILER_INFO") && last; oops "Not able to change location to directory:$Home/NDATE/FILER_INFO"; } my @hostfiles = <*>; my $CLIENT = hostname(); #my @hosts = <*>; my %filer_types = (); # Flush out if any data #my @hostfiles = (); # Distinguish filers basing on the IC/BR %filer_types = display_ir_br_filers(@hostfiles); if ( !(@hostfiles) ) { print BOLD, YELLOW, "\n\n ****** No configuration files detected. Please create at least one host file before creating at suite ******\n", RESET; exit(0); } else { # @hostfiles = sort {$a cmp $b}@hostfiles; printf "\nAvailable filers for CMode:\n"; my %sort; foreach my $filer (@hostfiles) { if ( $filer =~ /(\S+)-(\d+)/ ) { $sort{$filer} = $1; } elsif ( $filer =~ /(^\d+)/ ) { $sort{$1} = "num"; } elsif ( $filer =~ /(\S+)/ ) { $sort{$filer} = $1; } } my @sorted; my $value = "num"; my @keys = grep { $sort{$_} eq $value } keys %sort; @keys = sort { $a <=> $b } @keys; foreach my $key (@keys) { push( @sorted, $key ); } my @keys = grep { $sort{$_} ne $value } keys %sort; my @values = grep { $_ ne $value } values %sort; @values = do { my %seen; grep { !$seen{$_}++ } @values; }; @values = sort (@values); foreach my $val (@values) { my @keys = grep { $sort{$_} eq $val } keys %sort; my @sortdone = sort { my ($aa) = $a =~ /.*-(.+)/; my ($bb) = $b =~ /.*-(.+)/; $aa <=> $bb; } @keys; foreach my $key (@sortdone) { push( @sorted, $key ); } } foreach my $hostfile (@sorted) { if ( $hostfile !~ /_C/ ) { print( BOLD, MAGENTA, "$hostfile \n", RESET ) if ( ( $hostfile ne $CLIENT ) && !( $hostfile =~ /FILERS_LIST/ ) && !( $hostfile =~ /FILERS_LIST_C/ ) && ( $filer_types{$hostfile} eq "BR" ) ); } } } ## end else [ if (!(@hostfiles)) while (1) { my $filers = getchompstrip( "", '', "" ); alarm $ALARM; @filers_ent = split( /,/, $filers ); my $filers_length = @filers_ent; $filers_ent[0] = trim( $filers_ent[0] ); $filers_ent[1] = trim( $filers_ent[1] ); if ( $filers =~ /(help|HELP|Help)/ ) { print BOLD, GREEN, " Example: filerA,filerB \n", " All tests will be executed on filerA and filerB\n", RESET; } elsif ( $filers_length < 2 ) { oops('Needs at least two filers. Please follow the format: filerA,filerB'); } elsif ( $filers =~ /[=\$\*;\#]/ ) { oops('Characters "=" "$" "*" ";" "$" "#" not allowed'); } elsif ( $filers_ent[0] eq $filers_ent[1] ) { oops('Both enterd filers are identical. Follow the format: filerA,filerB'); } elsif ( !length($filers) ) { oops('filer value must be nonempty'); } elsif ( !length( $filers_ent[0] ) ) { oops('One of the filer value is empty. Please follow the format: filerA,filerB'); } elsif ( !length( $filers_ent[1] ) ) { oops('One of the filer value is empty. Please follow the format: filerA,filerB'); } elsif ( ( !( -e "$Home/NDATE/FILER_INFO/$filers_ent[0]" ) ) || ( !( -e "$Home/NDATE/FILER_INFO/$filers_ent[1]" ) ) ) { { chdir("$Home/NDATE/FILER_INFO") && last; oops "Not able to change location to directory:$Home/NDATE/FILER_INFO"; } if ( !( -e "$Home/NDATE/FILER_INFO/$filers_ent[0]" ) ) { print BOLD, RED, "\nFiler config file $filers_ent[0] does not exists\n", RESET; } if ( !( -e "$Home/NDATE/FILER_INFO/$filers_ent[1]" ) ) { print BOLD, RED, "Filer config file $filers_ent[1] does not exists\n", RESET; } } else { last; } } ## end while (1) { chdir("$Home/NDATE/TEST_LISTS") && last; oops "Not able to change location to directory:$Home/NDATE/TEST_LISTS"; } =head my $host_file_1 = "$Home/NDATE/FILER_INFO/$filers_ent[0]"; my $host_file_2 = "$Home/NDATE/FILER_INFO/$filers_ent[1]"; my $filer_h_1 = 1; my $filer_h_2 = 1; open( H_RULLIST_FILE, "< $host_file_1 " ) or die ">>>>> read: Failed opening $host_file_1 <<<<<" if ( -e $host_file_1 ); foreach my $line_f () { if ( $line_f =~ /^MODEL=(.*)/ ) { $filer_h_1 = $1; chomp($filer_h_1); } } open( H_RULLIST_FILE, "< $host_file_2 " ) or die ">>>>> read: Failed opening $host_file_2 <<<<<" if ( -e $host_file_2 ); foreach my $line_f () { if ( $line_f =~ /^MODEL=(.*)/ ) { $filer_h_2 = $1; chomp($filer_h_2); } } if ( $filer_h_1 ne $filer_h_2 ) { print BOLD, YELLOW "\n Selected different FILER MODEL, filer $filers_ent[0] : $filer_h_1 \n $filers_ent[1] : $filer_h_2\n Test suite is not modified. \n\n", RESET; $result_option = 2; next; } =cut my $value = "$Home/NDATE/TEST_LISTS/$my_runlist"; open( H_RULLIST_FILE, "< $value " ) or die ">>>>> read: Failed opening $value <<<<<" if ( -e $value ); my $f_state = 0; my ( $old_name, $name ); foreach my $line_r () { if ( ( $line_r =~ /^\#/ ) ) { next; # skip overall result report starting with a '#' or new line. } elsif ( $line_r =~ /dirname=(\S+)\s+/ ) { $name = $1; next; } elsif ( $line_r =~ /FILER=(\S+)\,(\S+)/ ) { $f_state = 1; $old_name = $2; last; } } ## end foreach my $line_r () if ( $f_state == 1 ) { system("perl -pi -e 's/$name/$filers_ent[0]/' $Home/NDATE/TEST_LISTS/$my_runlist"); system("perl -pi -e 's/$old_name/$filers_ent[1]/' $Home/NDATE/TEST_LISTS/$my_runlist"); print BOLD, GREEN, "\n Test suite $my_runlist modified\n", RESET; display_runlist($my_runlist); $runlist = $my_runlist; } else { print BOLD, YELLOW "\n Test suite does not contain filer entries \n Test suite $my_runlist not modified\n\n", RESET; $result_option = 2; next; } } ## end else [ if (@runlist < 1) } ## end sub update_runlist() sub update_runlist_EOE($) { my ($my_runlist) = @_; { chdir("$Home/NDATE/TEST_LISTS") && last; oops "Not able to change location to directory:$Home/NDATE/TEST_LISTS"; } my $value = "$Home/NDATE/TEST_LISTS/$my_runlist"; open( H_RULLIST_FILE, "< $value " ) or die ">>>>> read: Failed opening $value <<<<<" if ( -e $value ); my @EOE; foreach my $line_r () { if ( $line_r =~ /^(.*)dirname=(.*) exit_on_errors=(.*)/ ) { push( @EOE, " serial dirname=$2 exit_on_errors=\"INSPECT\" {\n" ) if ( $terminate_on_error == 1 ); push( @EOE, " serial dirname=$2 exit_on_errors=\"FATAL|INSPECT\" {\n" ) if ( $terminate_on_error == 2 ); push( @EOE, " serial dirname=$2 exit_on_errors=\"FATAL|FAIL|INSPECT\" {\n" ) if ( $terminate_on_error == 3 ); } elsif ( $line_r =~ /EMAIL/ ) { push( @EOE, " EMAIL=$EMAIL\n" ); } else { push( @EOE, $line_r ); } } ## end foreach my $line_r () close H_RULLIST_FILE; $value = "$Home/NDATE/TEST_LISTS/$my_runlist"; if ( open( H_RULLIST_FILE, ">$value" ) ) { foreach my $line_r (@EOE) { print( H_RULLIST_FILE "$line_r" ); } } close H_RULLIST_FILE; } ## end sub update_runlist_EOE($) sub update_host_vi() { { chdir("$Home/NDATE/FILER_INFO") && last; oops "Not able to change location to directory:$Home/NDATE/FILER_INFO"; } my @hostfiles = <*>; my @hostfiles_C; my @hostfiles_BR; foreach my $host_name ( sort { $a <=> $b } @hostfiles ) { if ( ( $host_name =~ /_C/ ) && ( $host_name !~ /FILERS_LIST/ ) ) { push( @hostfiles_C, $host_name ); } if ( ( $host_name =~ /_BR/ ) && ( $host_name !~ /FILERS_LIST/ ) ) { push( @hostfiles_BR, $host_name ); } } @hostfiles = (); if ( $option_TYPE == 'C_mode' ) { @hostfiles = @hostfiles_C; } if ( $option_TYPE == '7_mode' ) { @hostfiles = @hostfiles_BR; } my $CLIENT = hostname(); if ( !(@hostfiles) ) { print BOLD, YELLOW, "\n\n ****** No configuration files detected. Please create at least one host file before creating a test suite *******\n", RESET; $result_option = 3; next; } my ( $line, $filer_model, $filer_type, $filer_ip, $tftp_ip, $terminal_ip, $gateway_ip, $terminal_port, $kernel_file, @host_file, $bootimage, $def_pwd ); open( H_HOSTFILE, "> $Home\/NDATE\/FILER_INFO\/FILERS_LIST_t" ) or die "write:Failed opening $Home\/NDATE\/FILERS_INFO\/FILER_INFO_t \n"; print( H_HOSTFILE "\# Comented out unwanted host files with a hash(#) at the starting of the line\n" ); if ( $option_TYPE == '7_mode' ) { if ( $fc_bm_option == 1 ) { print( H_HOSTFILE "\# Format:\n" ); print( H_HOSTFILE "\# 1-FAS2000\n" ); print( H_HOSTFILE "\# 2-FAS3000\n" ); print( H_HOSTFILE "\# 3-FAS6000\n" ); print( H_HOSTFILE "\# 4-FAS960\n" ); print( H_HOSTFILE "\# Filer model Filer id Filer ip Terminal serv ip Port no Gateway ip TFTP serv ip PartnerHost\n" ); print( H_HOSTFILE "\#------------ -------- ----------- ---------------- ------- ---------- ------------ ------------\n" ); } ## end if ($fc_bm_option == 1) if ( $fc_bm_option == 2 ) { print( H_HOSTFILE "\# Format:\n" ); print( H_HOSTFILE "\# 1-FAS2000\n" ); print( H_HOSTFILE "\# 2-FAS3000\n" ); print( H_HOSTFILE "\# 3-FAS6000\n" ); print H_HOSTFILE "\n# 1. NetApp Internal users must create soft link for the desired kernel to netboot before running NDATE3.0 'ln -s /rlse/DOT/>>>> read: Failed opening $filer_list_file <<<<<"; my $line = ""; my $filer_no = 0; my $filer_model_f = ""; foreach $line () { if ( $line =~ /^\#/ ) { next; # ignore comments } my @filers = split( " ", $line ); $filer_no++; my $DbDir = cwd(); print "Validating Filer - $filer_no inputs \n"; if ( $option_TYPE == '7_mode' ) { create_hosts_info(@filers); } else { create_hosts_info_C(@filers); } } ## end foreach $line () system("rm $filer_list_file"); } ## end sub update_host_vi() sub usage_ndate() { print BOLD, YELLOW, "\nndate usage:\n ./ndate without any option\n", " ./ndate -e=arg1 -d=arg2 -m=arg4 -T=arg5 -t=arg6 -s=arg7 -z=arg8 with one or multiple options\n", "\n Details of the options available:", "\n----------------------------------------------------------------------------------\n", " -b= option for setting boot option\n", " ./ndate -b=7 skips the check filer setup\n", " For Fullsteam:", " ./ndate -b=4d - Boot the filer in option 4d\n\n", " -d= option for setting log path\n", " ./ndate -d=/home/user/logs sets the log path\n", " -d=NULL sets the log path to default path\n\n", " -e= option for one step execution, without asking any user inputs\n", " ./ndate -e=test_me test_me is the name of the test suite\n\n", " -E= Send email to users enable\n", " ./ndate -E=y Send email message enable an the test of the test suite\n", " -ETO=u1\@net.com,u2\@net.com Sets destination email ids \n", " -EFROM=u6\@net.com Sets source email id \n", " -EMSG='U:Testing Burt no 2' Extra message (Optional)\n\n", " e.g. ./ndate -E=y -ETO=u1\@net.com,u2\@.net.com -EFROM=u6\2net.com -EMSG='Performance test on FILERA'\n", " ./ndate -E=n Disables NDATE email service(In this case Email will be sent always when the Test result is FATAL/INSPECT)\n\n", " ./ndate -E=d Completely disables NDATE email service(In this case no mail will be sent when test result is PASS/FAIL/FATAL/INSPECT)\n\n", " -t= option sets the ndate UI time out\n", " range (31-3600) seconds \n\n", " -u= option to delete debug message from the log file\n", " default option : debug messages will not shown\n", " ./ndate -u=1 debug message's will not shown on the log file\n\n", " -w= option sets the percentage (%) of the wait time inside the test script\n", " ./ndate -w=1 sets the wait time percentage to 10% \n", " 1 - 10% \n", " 2 - 50% \n", " 3 - 100% (default) \n", " 4 - 95% \n\n", " -z= option sets size limit of the log files created for a particular test. The value entered for this function\n", " will be considered in GB. Upon reaching this specified limit the test running in particular terminal will\n", " get terminated.If there is more than one test in sequence or more than one day in ERT test, this value will\n", " internally get multplied by number of tests in sequence or number of days in ERT test, respectively.\n", " Please specify value in numeric only\n", " ./ndate -z=10 sets log directiory size limit to 10GB\n\n", " -g= option is used to execute an additional python script at the end of the test, only when applicable test is selected.\n", " This new script will serve as a plotting tool and will help to graph the results using the console or log files.\n", " ./ndate -g=2 sets the user choice\n", " 1 (default) will invoke the additional python script at the end\n", " 2 - will not invoke the additional python script\n\n", " -h= option is used to DISABLE background shell process to check log directory size .\n", " ./ndate -h=1 Disables background shell process which checks for log dirctory size\n", " 1 - Disable shell process\n", " 2 (default) - Shell process to check log directory size is enabled\n\n", " To make options '-b=', '-d=, -e=, -E=, -t= , -u= ,-w=, -z= , -g= and -h=' effective, user needs to pass these parameter value every time\n", " invoke the NDATE tool. These parameter values are not set permanently as other options.\n", "----------------------------------------------------------------------------------\n", RESET; exit 0; } ## end sub usage_ndate() sub delete_runlist() { { chdir("$Home/NDATE/TEST_LISTS") && last; oops "Not able to change location to directory:$Home/NDATE/TEST_LISTS"; } my @runlist = <*>; if ( @runlist < 1 ) { create_runlist(); } else { my $my_runlist; my @filers_ent; my @test_plans = <*>; print BOLD, CYAN "\n---------------------------------------------\n\nSelect one of the test suite available\nTo go back to the previous options press 'b' \n---------------------------------------------\n"; foreach my $test_plan (@test_plans) { print BOLD, MAGENTA, "$test_plan \n", RESET; } while (1) { if ( $runlist =~ /(NULL|null)/ ) { $my_runlist = getchompstrip( "", '', "" ); } else { $my_runlist = getchompstrip( "Default ", '', "$runlist" ); } $my_runlist = trim($my_runlist); alarm $ALARM; if ( ( $my_runlist eq "b" ) || ( $my_runlist eq "B" ) ) { $result_option = 2; return 3; } if ( $my_runlist =~ /[=\$\*,\#]/ ) { oops('Characters "=" "$" "*" "," "$" "#" not allowed'); } elsif ( !length($my_runlist) ) { oops('runlist must be nonempty'); } elsif ( !( -e $my_runlist ) ) { oops('runlist must be nonempty'); } elsif ( !( -e $my_runlist ) ) { print BOLD, YELLOW, "\n ******* The test suite $my_runlist does not exists. Please select again *******\n", RESET; } else { #display_runlist($my_runlist); last; } } ## end while (1) print BOLD, RED, <<'EOD', RESET; Would you like to delete the test suite selected ? (y/n) .............................................................. EOD my $flag; while (1) { $flag = getchompstrip( "", "", "" ); alarm $ALARM; if ( ( $flag eq "y" ) || ( $flag eq "Y" ) || ( $flag eq "n" ) || ( $flag eq "N" ) ) { last; } else { oops "Please enter correct value y/n"; } } ## end while (1) if ( $flag =~ /^(Y|y)/ ) { system("rm $Home/NDATE/TEST_LISTS/$my_runlist"); print BOLD, GREEN, "\nTest suite $my_runlist deleted \n", RESET; my @def_settings = `cat $Home/NDATE/default_params`; my $found = 0; foreach my $def (@def_settings) { if ( $def =~ $my_runlist ) { $found = 1; last; } } if ( $found == 1 ) { my $defailt_vals = "$Home/NDATE/default_params"; $runlist = "NULL"; $execmd = "NULL"; if ( ( -e "$defailt_vals" ) ) { if ( open( H_LOGFILE, ">$defailt_vals" ) ) { print( H_LOGFILE "RUNLIST=$runlist\n" ); print( H_LOGFILE "LOGLVL=$loglvl\n" ); print( H_LOGFILE "TEST_MODE=$test_mode\n" ); print( H_LOGFILE "EOE=$terminate_on_error\n" ); print( H_LOGFILE "LOGDIR=$Home/NDATE/TEST_LOGS\n" ); print( H_LOGFILE "EXECMD=$execmd\n" ); print( H_LOGFILE "EMAIL=$EMAIL\n" ); print( H_LOGFILE "EMAIL_TO=$MAIL_TO\n" ); print( H_LOGFILE "EMAIL_MSG=$EMSG\n" ); print( H_LOGFILE "EMAIL_FROM=$MAIL_FROM\n" ); if ( $logsize == 0 ) { $logsize = 10485760; } print( H_LOGFILE "LOGDIRSIZE=$logsize\n" ); print( H_LOGFILE "PYTHPATH=$python_path\n" ); close H_LOGFILE; } else { print BOLD, RED, "write:Failed opening $defailt_vals \n", RESET; } } ## end if ((-e "$defailt_vals"... } ## end if ($found == 1) $result_option = 2; return 1; } else { $result_option = 2; return 0; } } ## end else [ if (@runlist < 1) } ## end sub delete_runlist() sub create_ERT_runlist() { my @hparams_ert; my $runlist_ert; my $host_select_all = 0; my $select = 0; my ( $option, $fc_br_option ); my ( %filer_types, @hosts ); my (%filer_exits); { chdir("$Home/NDATE/TEST_SCRIPTS/ERT") && last; oops "Not able to change location to directory:$Home/NDATE/TEST_SCRIPTS/ERT"; exit 0; } my @test_ert_scripts = <*.thpl>; my @host_arr6; if ( !( ( -e "$Home/NDATE/TEST_SCRIPTS/ERT/NADQ02_ERT_Maint.thpl" ) || ( -e "$Home/NDATE/TEST_SCRIPTS/ERT/NADQ02_ERT_Fsys.thpl" ) || ( -e "$Home/NDATE/TEST_SCRIPTS/ERT/NADQ02_ERT_Fsys_Reconstruction.thpl" ) ) ) { print BOLD, RED, " One of the ERT scripts is missing\n", RESET; print " Expected scripts are \n"; print BOLD, CYAN, " NADQ02_ERT_Maint.thpl,\n NADQ02_ERT_Fsys.thpl\n NADQ02_ERT_Fsys_Reconstruction.thpl\n ", RESET; if ( @test_ert_scripts > 0 ) { print " Available test scripts:\n"; foreach my $tc_ert (@test_ert_scripts) { print BOLD, GREEN, " $tc_ert\n", RESET; } } else { print BOLD, RED, " No ERT test script is available", RESET; } print BOLD, RED, "\n *** Exiting from NDATE tool *** \n\n", RESET; exit 0; } else { option_6_name: if ( !( -e "$Home/NDATE/TEST_LISTS" ) ) { system('cd ~/NDATE && mkdir TEST_LISTS'); } { chdir("$Home/NDATE/TEST_LISTS") && last; oops "Not able to change location to directory:$Home/NDATE/TEST_LISTS"; } print BOLD, CYAN, <<'EOD', RESET; Enter the name of the ERT test suite to create. The test suite name will be prefixed by ERT. To go back to previous options press b Enter 'help' for more information --------------------------------------------------------------- EOD my $back_t = 0; while (1) { my $runlist_c = getchompstrip( "", '', "" ); alarm $ALARM; $runlist_c = trim($runlist_c); if ( ( $runlist_c eq "b" ) || ( $runlist_c eq "B" ) ) { $result_option = 6; $back_t = 1; last; } $runlist = $runlist_c; if ( $runlist =~ /(help|HELP|Help)/ ) { print "If you enter test suite name as default_suite, \nthe actual test suite name will be ERT_default_suite"; } elsif ( $runlist =~ /[=\$\*,;\#]/ ) { oops('Characters "=" "$" "*" "," ";" "$" "#" not allowed'); } elsif ( !length($runlist) ) { oops('runlist must be nonempty'); } else { last; } } ## end while (1) $runlist = "ERT_" . $runlist; next if ( $back_t == 1 ); $log_dir = ""; $log_dir = $runlist; system('clear'); my $test_list = {}; my $file = ""; my $flag_test1 = 0; push( @hparams_ert, @ADD_TEST_CASES ) if $ADD_TEST_CASES; push( @hparams_ert, "parallel dirname=$log_dir \{\n" ); my $flag = 0; # my $option; #$C_7_option = 1; $C_7_option = 2; =head while (1) { print BOLD, BLUE, <<'EOD', RESET; -------------------------------------------------------------- Which type of setup would you like to be execute. Select one of the options to continue 1 > 7 mode. 2 > C mode. Note: Default option is 7 mode. -------------------------------------------------------------- EOD while (1) { $option = getchompstrip( "", "", "" ); $option = trim($option); alarm $ALARM; if ( ( $option =~ /\d/ ) && ( $option <= 2 ) && ( $option >= 1 ) ) { $flag = 1; last; } elsif ( $option eq '' ) { $flag = 1; $option = 1; print BOLD, WHITE, "\nYou selected 7 mode.\n\n", RESET; last; } else { oops "Please enter correct value 1/2"; } } ## end while (1) if ( $flag == 1 ) { last; } } ## end while (1) =cut option_6_kernel: $option_TYPE = 'C_mode'; # Set Type of the Filer if ( $C_7_option == 2 ) { my $flag_k = 0; while (1) { print BOLD, CYAN, <<'EOD', RESET; -------------------------------------------------------------- Which type of Kernel image would you like to be boot. Select one of the options to continue 1 > Fullsteam. 2 > Longboard/Kalyaniblack/Harpoon/VR Note: Default option is 1> Fullsteam. To go back to previous options press 'b' -------------------------------------------------------------- EOD while (1) { $option_k = getchompstrip( "", "", "" ); $option_k = trim($option_k); alarm $ALARM; if ( ( $option_k =~ /\d/ ) && ( $option_k <= 2 ) && ( $option_k >= 1 ) ) { if ( $option_k == 1 ) { $kernel = "FS"; } elsif ( $option_k == 2 ) { $kernel = "VR"; } $flag_k = 1; last; } elsif ( $option_k eq '' ) { $flag_k = 1; $option_k = 1; print BOLD, WHITE, "\nYou selected Fullsteam.\n\n", RESET; last; } elsif ( $option_k =~ /^(b|B)$/ ) { $flag_k = 2; last; } else { oops "Please enter correct value 1/2"; } } ## end while (1) if ( $flag_k == 1 ) { last; } if ( $flag_k == 2 ) { goto option_6_name; last; } } ## end while (1) } $fc_br_option = $C_7_option; # Set Type of the Filer if ( $fc_br_option == 1 ) { $select = 1; $FILER_TYPE = 'BR'; } if ( $fc_br_option == 2 ) { $FILER_TYPE = 'BR'; $type_of_test = 2; $config = 2; } while (1) { my $host_select_all = 0; my $hostname; my @final_TC; my $custom_TC = 0; my $test_dir = ""; system('clear'); option_6_types: if ( $fc_br_option == 1 ) { print BOLD, CYAN, <<'EOD', RESET; ----------------------------------------------------------------------- Select one of the following test types 1 > Enter '1' for SAS Shelf - SAS HDD test 2 > Enter '2' for SAS Shelf - SATA HDD test To go back press 'b' Enter 'help' for more information ----------------------------------------------------------------------- EOD } else { print BOLD, CYAN, <<'EOD', RESET; ----------------------------------------------------------------------- Select one of the following test types 1 > Enter '1' for SAS Shelf - SAS HDD test 2 > Enter '2' for SAS Shelf - SATA HDD test Enter 'help' for more information To go back to the previous options press 'b' ----------------------------------------------------------------------- EOD } ## end else [ if ($fc_br_option == 1) $SATA_SETUP = "N"; my $type_of_test = 0; while (1) { $type_of_test = getchompstrip( "", "", "" ); if ( $fc_br_option == 1 ) { $type_of_test = 2 + $type_of_test; } elsif ( $type_of_test =~ /(b|B)/ ) { goto option_6_kernel; next; } elsif ( $type_of_test =~ /(help|HELP|Help)/ ) { print BOLD, GREEN, " Select type of test cases, it is not possible to execute different\n", " type of tests on a same filer. You can execute different type of tests on different filers\n", RESET; } else { $type_of_test = 1 + $type_of_test; } alarm $ALARM; if ( ( $type_of_test <= 4 ) && ( $type_of_test >= 3 ) && ( $fc_br_option == 1 ) ) { last; } elsif ( ( $type_of_test <= 3 ) && ( $type_of_test >= 2 ) && ( $fc_br_option == 2 ) ) { last; } elsif ( $type_of_test =~ /(help|HELP|Help)/ ) { redo; } else { if ( $fc_br_option == 1 ) { print BOLD, CYAN, "Note: For RollingRock or SierraNevada select between 1-2\n", RESET; oops "Please enter correct value 1/2"; } else { print BOLD, CYAN, " For Fullsteam or SierraNevada select between 1-2\n", RESET; oops "Please enter correct value 1/2"; } } } ## end while (1) if ( $fc_br_option == 1 ) { if ( $type_of_test == 1 ) { $test_type = "FC"; } elsif ( $type_of_test == 2 ) { $SATA_SETUP = "Y"; $test_type = "FC"; } elsif ( $type_of_test == 3 ) { $test_type = "SAS"; } elsif ( $type_of_test == 4 ) { $SATA_SETUP = "Y"; $test_type = "SAS"; } else { } } ## end if ($fc_br_option == 1) # For BR if ( $fc_br_option == 2 ) { if ( $type_of_test == 1 ) { $SATA_SETUP = "Y"; $test_type = "FC"; } elsif ( $type_of_test == 2 ) { $test_type = "SAS"; } elsif ( $type_of_test == 3 ) { $SATA_SETUP = "Y"; $test_type = "SAS"; } else { } } ## end if ($fc_br_option == 2) $runlist_ert = $runlist; { chdir("$Home/NDATE/FILER_INFO") && last; oops "Not able to change location to directory:$Home/NDATE/FILER_INFO"; } my $CLIENT = hostname(); my @clienta = split( /\./, $CLIENT ); $CLIENT = $clienta[0]; =head my $flag = 0; if ($select == 0) { $fc_br_option = 1; $FILER_TYPE = "IC"; while(1) { print BOLD, BLUE, <<'EOD', RESET; -------------------------------------------------------------- Select Data ONTAP to continue 1 > For Ironcity. 2 > For Boilermaker or RollingRock. Note: Default option is IC(Ironcity). Note: Please ensure that if the password option is enabled on the filer ONTAP, please ensure that the filer configuration file is updated with the default password. EOD print BOLD, RED, " --------------------------------------------------------------- WARNING: 1. Do not add the different types of filers(IC/BR) to the test cases. For example: In case if you select the IC add the IC filers only. ---------------------------------------------------------------", RESET; while (1) { $option = getchompstrip("", "", ""); $option = trim($option); alarm $ALARM; if (($option =~ /\d/) && ($option <= 2) && ($option >= 1)) { $flag = 1; last; } else { oops "Please enter correct value 1/2"; } } ## end while (1) if ($flag == 1) { last; } } ## end while (1) $fc_br_option = $option; $select = 1; } # Set Type of the Filer if ($fc_br_option == 2) { $FILER_TYPE = 'BR'; } =cut @hosts = <*>; my @hostfiles = (); # Distingish filers basing on the IC/BR %filer_types = display_ir_br_filers(@hosts); foreach $_ ( sort { $a <=> $b } keys %filer_types ) { if ( $filer_types{$_} eq $FILER_TYPE ) { # Creating the hash to verify the filers $filer_exits{$_} = $_; push( @hostfiles, $_ ); } } #my @hostfiles = <*>; #@hostfiles = <*>; if ( @hostfiles < 1 ) { print BOLD, YELLOW, "\n\n ****** No configuration files detected. Please create at least one host file before creating a test suite*******\n", RESET; exit(0); } else { if ( $option_TYPE == '7_mode' ) { print "Available filers for $FILER_TYPE:\n"; } else { print "Available filers for CMode:\n"; } # my @sorted = sort {$a cmp $b} @hostfiles; my %sort; foreach my $filer (@hostfiles) { if ( $filer =~ /(\S+)-(\d+)/ ) { $sort{$filer} = $1; } elsif ( $filer =~ /(^\d+)/ ) { $sort{$1} = "num"; } elsif ( $filer =~ /(\S+)/ ) { $sort{$filer} = $1; } } my @sorted; my $value = "num"; my @keys = grep { $sort{$_} eq $value } keys %sort; @keys = sort { $a <=> $b } @keys; foreach my $key (@keys) { push( @sorted, $key ); } my @keys = grep { $sort{$_} ne $value } keys %sort; my @values = grep { $_ ne $value } values %sort; @values = do { my %seen; grep { !$seen{$_}++ } @values; }; @values = sort (@values); foreach my $val (@values) { my @keys = grep { $sort{$_} eq $val } keys %sort; my @sortdone = sort { my ($aa) = $a =~ /.*-(.+)/; my ($bb) = $b =~ /.*-(.+)/; $aa <=> $bb; } @keys; foreach my $key (@sortdone) { push( @sorted, $key ); } } foreach my $hostfile (@sorted) { if ( ( $hostfile !~ /_IC/ ) && ( $hostfile !~ /_BR/ ) && ( $hostfile !~ /_C/ ) ) { print( BOLD, MAGENTA, "$hostfile \n", RESET ) if ( ( $hostfile ne $CLIENT ) && !( $hostfile =~ /FILERS_LIST/ ) ); } } } ## end else [ if (@hostfiles < 1) if ( $option_TYPE == '7_mode' ) { @host_arr6 = (); print <<"EOD"; ................................................................................ Select one or more filers, OR enter "all" to select all filers for the test Example : FILERA, FILERB, FILERC : all ................................................................................. EOD my $select_filers = 0; while (1) { my $host_list = getchompstrip( "", '', "" ); alarm $ALARM; my @host_arr2 = (); @host_arr2 = split( /,/, $host_list ); if ( $host_list =~ /^(b|B)$/ ) { goto option_6_types; next; } my $all_hosts = ""; my @unique = _unique(@host_arr2); my @diff = _array_diff( @host_arr2, @unique ); if (@diff) { print BOLD, RED, "you have entered the duplicate entries i,e @diff, Please re-enter again", RESET; next; } $all_hosts = $host_arr2[0]; trim($all_hosts); if ( ( $all_hosts eq "ALL" ) || ( $all_hosts eq "all" ) || ( $all_hosts eq "All" ) ) { print "All Filers are selected \n"; foreach my $hostfile (@hostfiles) { push( @host_arr6, $hostfile ) if ( ( $hostfile ne $CLIENT ) && !( $hostfile =~ /FILERS_LIST/ ) ); $host_select_all = 1; $select_filers = 1; } } else { my ( %host, $flag ); @host{@final_list} = 1; foreach (@host_arr2) { if ( exists( $host{$_} ) ) { print BOLD, RED, "You have already entered the filer name $_, Please choose the different filer****** \n", RESET; $flag = 1; } } if ( $flag == 1 ) { next; } foreach my $host_no (@host_arr2) { $host_no = trim($host_no); if ( $host_no =~ /[=\$\*,;\#]/ ) { oops('Characters "=" "$" "*" "," ";" "$" "#" not allowed'); } elsif ( !length($host_no) ) { oops('filer name must be nonempty'); } elsif ( !( -e $host_no ) ) { print BOLD, YELLOW, "******* filer file $host_no does not exists ****** \n", RESET; } elsif ( !( exists( $filer_exits{$host_no} ) ) ) { print BOLD, YELLOW, "******* filer file $host_no does not exists ****** \n", RESET; print BOLD, YELLOW, "******* Incorrect filer type(Ironcity/Boilermaker) ****** \n", RESET; } else { push( @host_arr6, $host_no ); push( @final_list, $host_no ); $select_filers++; print BOLD, GREEN, " Filer selected and verified for ERT testing $host_no \n", RESET; } } ## end foreach my $host_no (@host_arr2) } ## end else [ if (($all_hosts eq "ALL"... last if ( $select_filers >= 1 ); } ## end while (1) } else { print BOLD, GREEN, <<'EOD', RESET; ................................................................................ Select name of the filers, seperated by 'comma', on which you would like to execute the test The selected filers should part of the C-Mode setup Example : FILERA, FILERB, FILERC (To go back press 'b') ................................................................................. EOD $Primary_Flag = 1; print BOLD, GREEN, <<'EOD', RESET; Important: The first node selected will be assumed as the PRIMARY NODE for test execution. So, please enter the filer names seperated by comma accordingly Example: If the selection is: FilerA,FilerB : then the PRIMARY NODE will be assumed as:FilerA EOD my $select_filers = 0; while (1) { my $filer_same = 0; my $flag = 0; my $host_list = getchompstrip( "", '', "" ); alarm $ALARM; my @host_arr1 = (); my @host_arr2 = split( /,/, $host_list ); $ert_host_list = $host_list; if ( $host_list =~ /^(b|B)$/ ) { goto option_6_types; next; } if ( $Primary_Flag == 1 ) { $Primary_Node = $host_arr2[0]; print BOLD, CYAN, "\n PRIMARY NODE selected by the user is : $Primary_Node\n\n", RESET; } my ( %host, $fla ); @host{@final_list} = 1; foreach (@host_arr2) { if ( exists( $host{$_} ) ) { print BOLD, RED, "You have already entered the filer name $_, Please choose the different filer****** \n", RESET; $fla = 1; } } if ( $fla == 1 ) { next; } my $no_host_arr2 = @host_arr2; my @host_arr_uniq = keys %{ { map { $_ => undef } @host_arr2 } }; my $no_host_arr_uniq = @host_arr_uniq; if ( $no_host_arr2 != $no_host_arr_uniq ) { $filer_same = 1; } foreach my $host_no (@host_arr2) { $host_no = trim($host_no); if ( $host_no =~ /[=\$\*,;\#]/ ) { oops('Characters "=" "$" "*" "," ";" "$" "#" not allowed'); last; } elsif ( !length($host_no) ) { oops('filer name must be nonempty'); } elsif ( !( -e $host_no ) ) { print BOLD, YELLOW, "******* filer file $host_no does not exists ****** \n", RESET; $flag = 1; } elsif ( !( exists( $filer_exits{$host_no} ) ) ) { print "******* filer file $host_no does not exists ****** \n"; print "******* filer you selected is different type(Ironcity/Boilermaker) ****** \n"; $flag = 1; } if ( $filer_same == 1 ) { oops('Both filers are same'); last; } else { push( @host_arr1, $host_no ); #push(@host_arr6, $host_no); #push(@final_list,$host_no); $select_filers++; } } ## end foreach my $host_no (@host_arr2) my $host_arr1 = @host_arr1; if ( $host_arr1 le 1 ) { print BOLD, CYAN, "For Cluster Setup You have to select more than 1 filer \n", RESET; print BOLD, RED, "Example : FILERA, FILERB\n\n", RESET; @host_arr1 = (); } elsif ( ( $flag eq 1 ) && ( $host_arr1 gt 1 ) ) { print BOLD, RED, "The filer selected does not have a filer config file. Either re-initiate ndate and create the filer config file for the desired filer, OR Please select from the above list of available filers \n", RESET; @host_arr1 = (); } else { print BOLD, GREEN, " Filer selected and verified @host_arr2 \n\n", RESET; push( @final_list, @host_arr2 ); @node = @host_arr1; last if ( $select_filers >= 1 ); } } ## end while (1) @host_arr6 = (); push( @host_arr6, $Primary_Node ); } foreach my $hostname (@host_arr6) { my $run_id_ert; push( @hparams_ert, " serial dirname=$hostname exit_on_errors=\"INSPECT\" \{\n" ); if ( $option_TYPE == '7_mode' ) { push( @hparams_ert, " TEST_CONFIG=D" ); } else { push( @hparams_ert, " TEST_CONFIG=E" ); } push( @hparams_ert, " ERT=$ERT" ); if ( $addparser eq "1" ) { push( @hparams_ert, " TEST_SUITE_NAME=$runlist\n" ); } $temp_parse_id = "check_filer_setup"; push( @hparams_ert, " KERNEL=$kernel\n" ); if ( length($Primary_Node) ) { push( @hparams_ert, " Primary_Node=$Primary_Node\n" ); } push( @hparams_ert, " SETUP_TYPE=C\n" ); push( @hparams_ert, " SATA_SETUP=Y\n" ) if ( $SATA_SETUP eq 'Y' ); push( @hparams_ert, " TEST_SETUP=$test_type" ); push( @hparams_ert, " ARMADILLO=$armadillo\n" ); if ( $option_TYPE == '7_mode' ) { push( @hparams_ert, " FILER=$hostname\n" ); my $temp_parse_id = "check_filer_setup"; push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=$temp_parse_id" ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams_ert, " PARSE_ID=$temp_parse_id " ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); } else { push( @hparams_ert, " FILER=$ert_host_list\n" ); } my $ert_maint = "NADQ02_ERT_Maint.thpl"; my $ert_fsys_1 = "NADQ02_ERT_Fsys.thpl"; my $ert_fsys_2 = "NADQ02_ERT_Fsys_Reconstruction.thpl"; my $ert_fsys; my $ert_vol; if ( $test_type eq "SAS" ) { print BOLD, CYAN, <<'EOD', RESET; ------------------------------------------------------------------------ Enter the test days for the test suite using 'comma' as a separator OR all for all days Example : 33,43 - Two days test (33 and 43) : 33-43 - All days from day 33 till day 43 i.e (33,34,35..43) : 23 - Only for 23rd day test : all - For all 43 days test Range: 0 - 23, 33-42, 43 Note : Do not select as 43,43 Note : ERT test should be selected between days 0 to 4 or 7 to 23 or 33 to 42 or 43 ------------------------------------------------------------------------ EOD } else { print BOLD, CYAN, <<'EOD', RESET; ------------------------------------------------------------------------ Enter the START day and END day for the test suite using 'comma' as a separator OR All for all days Example : 33,42 - Two days test (33 and 42) : 33-42 - All days from day 33 till day 43 i.e (33,34,35..42) : 23 - Only for 23rd day test : all - For all 42 days test Range: 0 - 23, 33-42 Note : Do not select as 42,42 ------------------------------------------------------------------------ EOD } ## end else [ if ($test_type eq "SAS") my @arr1; my @new_arr; my $temp_list; my @days; my $total_tests = 0; my $test_33 = 0; my $valid_test = 0; while (1) { AGAIN: #$temp_list = getchompstrip("", '', ""); ##This subroutine is not used because it will not allow to select only day0 print " >"; $temp_list = ; alarm $ALARM; $temp_list = trim($temp_list); @days = split( /,/, $temp_list ); my @sort_day = @days; @sort_day = sort @sort_day; my @days_not_exist = (); foreach my $day (@sort_day) { if ( ( $day == 5 ) || ( $day == 6 ) || ( $day == 24 ) || ( $day == 25 ) || ( $day == 26 ) || ( $day == 27 ) || ( $day == 28 ) || ( $day == 29 ) || ( $day == 30 ) || ( $day == 31 ) || ( $day == 32 ) ) { push( @days_not_exist, $day ); } } if (@days_not_exist) { my $not_exist = join( ",", @days_not_exist ); oops "Selected days $not_exist is not available, Please select other days"; goto AGAIN; } #$days[0] = trim($days[0]); #$days[1] = trim($days[1]); if ( $temp_list =~ /(ALL|all|All)/i ) { my @maint_days = ( 0 .. 4 ); my @maint_days1 = ( 7 .. 23 ); push @maint_days, @maint_days1; my @fs_days = ( 33 .. 43 ); push @maint_days, @fs_days; my @dys; push @days, @maint_days; shift @days; oops "All ERT days has been selected for execution"; $total_tests = 43; gettotaldates($total_tests); $valid_test = 1; # last; } #Adding the check if user selects only - or , enter if ( ( @days == 1 ) && ( $days[0] =~ /^\-$/ ) ) { oops "Plese enter the days, do not enter only '-' or ','"; @days = (); next; } if ( $days[0] =~ /^\s*$/ ) { oops "Plese enter the days, do not enter empty"; @days = (); next; } if ( $days[0] =~ "-" ) { my @all_days = split( "-", $days[0] ); @days = (); my $st_in = $all_days[0]; while ( $st_in <= $all_days[1] ) { push( @days, $st_in ); $st_in++; } } ## end if ($days[0] =~ "-") my $flag_day = 0; foreach (@days) { trim($_); if ( ( $_ < 0 ) || ( $_ > 43 ) ) { oops "The ERT test should be selected between days 0 to 4 or 7 to 23 or 33 to 42 or 43 So Please verify your input "; $flag_day = 1; last; =head }elsif (( $_ > 23)&&($_ < 33)){ oops "The ERT test should be selected between days 0 to 23 or 33 to 42 or 43 So Please verify your input "; $flag_day = 1; last; =cut } elsif ( $_ !~ /\d+/ ) { $flag_day = 1; oops "Enter the correct value between 0 to 23 or 33 to 42 or 43"; last; } $total_tests++; } if ( $flag_day == 1 ) { @days = (); next; } =head if ($temp_list =~ /(ALL|all|All)/ ){ my @maint_days = (0 .. 4); my @maint_days1 = (7 .. 23); push @maint_days, @maint_days1; my @fs_days = (33 .. 43); push @maint_days, @fs_days; my @dys; push @days, @maint_days; shift @days; oops "All ERT days has been selected for execution"; $total_tests = 43; gettotaldates($total_tests); $valid_test = 1; last; } =cut my @arr_user; my @arr_maint; my @arr_file; foreach (@days) { trim($_); if ( ( $_ >= 0 ) && ( $_ <= 23 ) ) { push( @arr_maint, $_ ); } else { push( @arr_file, $_ ); } } @arr_file = (@arr_file); @arr_maint = (@arr_maint); if ( ( @arr_maint > 0 ) && ( @arr_file > 0 ) ) { print BOLD, CYAN, <<'EOD', RESET; Select order of testing 1 - Execute all Maintenance tests first then File System tests 2 - Execute all File System tests first then Maintenance tests 3 - User selected order Enter 'help' for more information EOD my $test_order = 0; while (1) { $test_order = getchompstrip( "Default ", "", "3" ); alarm $ALARM; if ( $test_order =~ /(help|HELP|Help)/ ) { print("Efficient way to execute the test suite\n"); } elsif ( ( $test_order <= 3 ) && ( $test_order >= 1 ) ) { last; } else { oops "Please enter correct value 1-3/help"; } } ## end while (1) if ( $test_order == 1 ) { @arr1 = ( @arr_maint, @arr_file ); } elsif ( $test_order == 2 ) { @arr1 = ( @arr_file, @arr_maint ); } else { @arr1 = (@days); } } else { @arr1 = (@days); } =head if ( $temp_list =~ /(ALL|all|All)/ ) { print BOLD, GREEN, "\n 42 days test selected \n\n", RESET; #$days[0] = 0; #$days[1] = 42; @days = ( 0 .. 42 ); $total_tests = 43; gettotaldates($total_tests); $valid_test = 1; last; } elsif (( $temp_list =~ /(ALL|all|All)/ ) && ( $test_type eq "SAS" ) ) { print BOLD, GREEN, "\n 43 days test selected \n\n", RESET; #$days[0] = 0; #$days[1] = 43; @days = ( 0 .. 43 ); $total_tests = 44; gettotaldates($total_tests); $valid_test = 1; last; } =cut #elsif (($total_tests > 1) && ($days[1] < $days[0])) { #oops "Please enter values in correct order"; # } if ( ( $total_tests > 1 ) && ( $days[1] == $days[0] ) ) { oops "Please don't enter same values"; @days = (); next; } # elsif ( (($days[0] >= 0) && ($days[0] <= 42)) # && (($days[1] >= 0) && ($days[1] <= 42)) # && ( $test_type eq "FC")) { # print BOLD, GREEN, "\n Test from $days[0] to $days[1] selected\n\n", # RESET; # gettotaldates($days[0],$days[1]); # last; #} elsif ( (($days[0] >= 0) && ($days[0] <= 43)) # && (($days[1] >= 0) && ($days[1] <= 43)) # && ($test_type eq "SAS")) # print BOLD, GREEN, "\n Test from $days[0] to $days[1] selected\n\n", # RESET; # gettotaldates($days[0],$days[1]); # last; else { $total_tests = @days; gettotaldates($total_tests); $valid_test = 1; } print BOLD, GREEN, "\n Total number of days selected for ERT test = $total_tests\n"; #if ($test_type eq "SAS") { # oops "Plese enter correct value, 0-43"; #} elsif ($test_type eq "FC") { # oops "Plese enter correct value, 0-42"; #} if ( $test_type eq "FC" ) { foreach (@days) { if ( ( $_ < 0 ) && ( $_ > 42 ) ) { $valid_test = 0; oops "Plese enter values in correct order. For FC Configuration the days selected can be between 0-42"; } } } elsif ( $test_type eq "SAS" ) { foreach (@days) { if ( ( $_ < 0 ) && ( $_ > 43 ) ) { $valid_test = 0; oops "Plese enter values in correct order. For SAS Configuration the days selected can be between 0-43"; } } } if ( $valid_test == 1 ) { #print BOLD, GREEN, "\n Test are selected", RESET; last; } } ## end while (1) print BOLD, GREEN, "\n ERT Test selected are: "; my $test_day; my $select_43 = 0; foreach $test_day (@arr1) { if ( $test_day >= 33 ) { $test_33++; } if ( ( $test_day == 5 ) || ( $test_day == 6 ) ) { next; } if ( ( $test_day >= 24 ) && ( $test_day < 33 ) ) { next; } print "$test_day "; #ERT PYTHON if ( $test_day == 43 ) { $select_43 = 1; } } ## end foreach $test_day (@arr1) print "\n"; if ( ( $runpyth == 1 ) && ($select_43) ) { set_python_path(); } #if (($days[0] > 32) || ($days[1] > 32)) { if ( $test_33 > 0 ) { print BOLD, CYAN, <<'EOD', RESET; ----------------------------------------------------------------------- Select one of the following ERT test for execution 1 > Enter '1' for Single Volume Test (ERT-1) 2 > Enter '2' for 12 Volumes Test (ERT-2) 3 > Enter '3' for 24 Volumes Test (ERT-3) ----------------------------------------------------------------------- EOD my $vol_test = 0; my $cluster_config = 0; while (1) { $vol_test = getchompstrip( "", "", "" ); alarm $ALARM; if ( $vol_test =~ /(help1|HELP1|Help1)/ ) { print BOLD, GREEN, " Start test suite with ERT maintenance test and \n followed by three file system tests \n", RESET; } elsif ( ( $vol_test <= 3 ) && ( $vol_test >= 1 ) ) { last; } else { oops "Please enter correct value 1-3/help"; } } ## end while (1) if ( $vol_test == 1 ) { $ert_vol = "1"; } elsif ( $vol_test == 2 ) { $ert_vol = "12"; } elsif ( $vol_test == 3 ) { $ert_vol = "24"; } } ## end if ($test_33 > 0) my $reset_input = 0; my $adap_reset_input = 0; if ( ( $select_43 == 1 ) && ( $ert_vol > 1 ) ) { ##The following inputs are requested from user in case of multi-volume test for day43 to reduce the test-execution time my ( $max_fail_drive, $max_scrub_oper, $max_fail_data_drive ); print BOLD, YELLOW, "\nPlease enter the number of parity drives to be failed for the ERT day 43.Default value is 5.", RESET; while (1) { alarm $ALARM; $max_fail_drive = getchompstrip( "", '', "" ); $max_fail_drive = trim($max_fail_drive); if ( $max_fail_drive =~ /^$/ ) { $MAX_DRIVES_TO_FAIL = 5; print BOLD, CYAN, "\nDefault selected. Maximum number of parity drives to be failed = 5\n\n", RESET; last; } elsif ( $max_fail_drive !~ /^\d+$/ ) { print BOLD, RED, "Please enter only numbers", RESET; } elsif ( $max_fail_drive =~ /^\d+$/ ) { if ( $max_fail_drive > 5 ) { print BOLD, WHITE, "\nMaximum value is 5.The value to be entered should not be greater than 5 - Try again.", RESET; } else { $MAX_DRIVES_TO_FAIL = $max_fail_drive; print BOLD, WHITE, "\nThe number of parity drives to be failed is $MAX_DRIVES_TO_FAIL.\n", RESET; last; } } ##end if } ## end while (1) print BOLD, YELLOW, "\nPlease enter the number of Data drives to be failed for the ERT day 43.Default value is 3.", RESET; while (1) { alarm $ALARM; $max_fail_data_drive = getchompstrip( "", '', "" ); $max_fail_data_drive = trim($max_fail_data_drive); if ( $max_fail_data_drive =~ /^$/ ) { $MAX_DATA_DRIVES_TO_FAIL = 3; print BOLD, CYAN, "\nDefault selected. Maximum number of Data drives to be failed = 3\n\n", RESET; last; } elsif ( $max_fail_data_drive !~ /^\d+$/ ) { print BOLD, RED, "Please enter only numbers", RESET; } elsif ( $max_fail_data_drive =~ /^\d+$/ ) { if ( $max_fail_data_drive > 3 ) { print BOLD, WHITE, "\nMaximum value is 3.The value to be entered should not be greater than 3 - Try again.", RESET; } else { $MAX_DATA_DRIVES_TO_FAIL = $max_fail_data_drive; print BOLD, WHITE, "\nThe number of data drives to be failed is $MAX_DATA_DRIVES_TO_FAIL.\n", RESET; last; } } ##end if } ## end while (1) print BOLD, YELLOW, "\nPlease enter the number of scrub operations to be performed for the ERT day 43.Default value is 1.", RESET; while (1) { alarm $ALARM; $max_scrub_oper = getchompstrip( "", '', "" ); $max_scrub_oper = trim($max_scrub_oper); if ( $max_scrub_oper =~ /^$/ ) { $MAX_SCRUB_OPERATIONS = 1; print BOLD, CYAN, "\nDefault selected. Number of scrub operations to be performed = 1\n\n", RESET; last; } elsif ( $max_scrub_oper !~ /^\d+$/ ) { print BOLD, RED, "Please enter only numbers", RESET; } elsif ( $max_scrub_oper =~ /^\d+$/ ) { if ( $max_scrub_oper > $ert_vol ) { print BOLD, WHITE, "\nMaximum value is $ert_vol.The value to be entered should not be greater than the number of volumes - Try again.", RESET; } else { $MAX_SCRUB_OPERATIONS = $max_scrub_oper; print BOLD, WHITE, "\nThe number of scrub operations to be performed is $MAX_SCRUB_OPERATIONS.\n\n", RESET; last; } } ##end if } ## end while (1) my $Drive_require = ( $MAX_DRIVES_TO_FAIL + $MAX_DATA_DRIVES_TO_FAIL + 5 ); my $Total_Drive_require = ( ( $ert_vol * 3 ) + $MAX_DRIVES_TO_FAIL + $MAX_DATA_DRIVES_TO_FAIL + 5 ); print BOLD, YELLOW, "\n NOTE: For ERT day 43, there must be minimum number of drives require are $Total_Drive_require\n\n", RESET; push( @hparams_ert, " MAX_DRIVES_TO_FAIL=$MAX_DRIVES_TO_FAIL" ); push( @hparams_ert, " MAX_SCRUB_OPERATIONS=$MAX_SCRUB_OPERATIONS" ); push( @hparams_ert, " MAX_DATA_DRIVES_TO_FAIL=$MAX_DATA_DRIVES_TO_FAIL" ); push( @hparams_ert, " Drive_require=$Drive_require" ); } else { my $Total_Drive_require = ( ( $ert_vol * 3 ) + 5 ); print BOLD, YELLOW, "\n NOTE: For ERT day $test_day, there must be minimum number of drives require are $Total_Drive_require\n\n", RESET; } foreach my $res (@days) { if ( ( $test_type eq "SAS" ) || ( $test_type eq "SSD" ) ) { if ( ( $res >= 36 ) && ( $res <= 38 ) ) { if ( $reset_input == 0 ) { print BOLD, YELLOW, "\n -----------------------------------------------------------------------", RESET; print BOLD, YELLOW, "\n Please provide the device reset values (60 to 360) Default value is 120", RESET; print BOLD, YELLOW, "\n The value selected will reflect in all selected ERT test days (Day: 36 to 38) ", RESET; while (1) { alarm $ALARM; $reset_input = getchompstrip( "", '', "" ); $reset_input = trim($reset_input); if ( $reset_input =~ /^$/ ) { $ert_reset_value = 120; print BOLD, CYAN, "\n Default selected. Device reset value = 120\n", RESET; last; } elsif ( $reset_input !~ /^\d+$/ ) { print BOLD, RED, " Please enter only numbers", RESET; } elsif ( $reset_input =~ /^\d+$/ ) { $ert_reset_value = $reset_input; if ( ( $ert_reset_value < 60 ) || ( $ert_reset_value > 360 ) ) { print BOLD, WHITE, "\nInvalid entry - Try again.", RESET; print BOLD, WHITE, "Select (default=120, min=60, max=360)seconds\n", RESET; } else { print BOLD, WHITE, "\nSelected device reset values is $ert_reset_value.\n", RESET; last; } } ##end if ($reset_input } ## end while (1) } ##end if ($reset_input == 0) { } ##end if (($res >= 36) && ($res < 43)) { if ( ( $res >= 39 ) && ( $res <= 42 ) ) { if ( $adap_reset_input == 0 ) { print BOLD, GREEN, "\n -----------------------------------------------------------------------", RESET; print BOLD, GREEN, "\n Please provide the adapter reset values (60 to 360) Default value is 120", RESET; print BOLD, GREEN, "\n The value selected will reflect in all selected ERT test days (Day: 36 to 42) ", RESET; while (1) { alarm $ALARM; $adap_reset_input = getchompstrip( "", '', "" ); $adap_reset_input = trim($adap_reset_input); if ( $adap_reset_input =~ /^$/ ) { $ert_adap_reset_value = 120; print BOLD, CYAN, "\n Default selected. Adapter reset value = 120\n\n", RESET; last; } elsif ( $adap_reset_input !~ /^\d+$/ ) { print BOLD, RED, " Please enter only numbers", RESET; } elsif ( $adap_reset_input =~ /^\d+$/ ) { $ert_adap_reset_value = $adap_reset_input; if ( ( $ert_adap_reset_value < 60 ) || ( $ert_adap_reset_value > 360 ) ) { print BOLD, WHITE, "\nInvalid entry - Try again.", RESET; print BOLD, WHITE, "Select (default=120, min=60, max=360)seconds\n", RESET; } else { print BOLD, WHITE, "\nSelected Adapter reset values is $ert_adap_reset_value.\n", RESET; last; } } ##end if ($adap_reset_input =~ /^$/) { } ## end while (1) } ##end if ($adap_reset_input == 0) last; } ## end if (($res >= 39) && ($res... } ##end if (($test_type eq "SAS") || ($test_type eq "SSD")) } ## end foreach my $res (@days) my $index = $days[0]; #$TOTAL_ERT_DAYS = ($days[1] - $days[0]) + 1; $TOTAL_ERT_DAYS = @days; $ERT_START_DAY = $days[0]; #$ERT_END_DAY = $days[1]; $ERT_END_DAY = $days[-1]; print BOLD, MAGENTA, " FILER: $hostname selected for the for the following tests\n", RESET; # Display the filer type #display_filertype($hostname); print BOLD, CYAN, "\n Test starts from day $ERT_START_DAY\n", RESET; my $len_ert = rindex $ert_maint, '.thpl'; my $runid_ert = substr( $ert_maint, 0, $len_ert ); my $exe_days = 0; $index = $days[0]; foreach my $index (@days) { if ( ( $index >= 0 ) && ( $index < 24 ) ) { if ( $ert_maint =~ /ERT_Maint/ ) { push( @hparams_ert, " Filer_mode=M" ); my $ert_maintfile = $ert_maint; $ert_maintfile =~ s/.thpl//g; push( @hparams_ert, " GROUP_NO=$ert_maintfile", "\n", "KERNEL_TYPE=$KERNEL_TYPE" ) if ( $ERT =~ /Y/i ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams_ert, " PARSE_ID=check_filer_setup " ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); last; } } } #if ($index < 33) { #while ($index <= $days[1]) { foreach my $index (@days) { if ( ( $index < 0 ) || ( $index > 23 ) || ( $index == 5 ) || ( $index == 6 ) ) { next; } my $runid_ert_t = $runid_ert . "_$index"; # if ($option_TYPE eq 'C_mode') { =head if ( $ert_maint =~ /ERT_Fsys/ ) { push( @hparams_ert, " Filer_mode=F" ); if ($FIXED_MODE_TEST) { if ( ( !$flag_set ) || ( $mode_flag !~ /F/i ) ) { push( @hparams_ert, " GROUP_NO=$GROUP_NO", "\n", "KERNEL_TYPE=$KERNEL_TYPE" ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams_ert, " PARSE_ID=check_filer_setup " ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); $flag_set = 1; $mode_flag = 'F'; } } else { push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams_ert, " PARSE_ID=check_filer_setup " ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); } } else { push( @hparams_ert, " Filer_mode=M" ); if ($FIXED_MODE_TEST) { if ( ( !$flag_set ) || ( $mode_flag !~ /M/i ) ) { push( @hparams_ert, " GROUP_NO=$GROUP_NO", "\n", "KERNEL_TYPE=$KERNEL_TYPE" ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams_ert, " PARSE_ID=check_filer_setup " ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); $flag_set = 1; $mode_flag = 'M'; } } else { push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams_ert, " PARSE_ID=check_filer_setup " ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); } } =cut my $temp_parse_id = "check_filer_setup"; push( @hparams_ert, " ERT_TEST_ID=$index" ); push( @hparams_ert, " $Home/NDATE/TEST_SCRIPTS/ERT/$ert_maint RUNID=$runid_ert_t TEST_CONFIG=E " ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams_ert, " PARSE_ID=$runid_ert_t " ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl" ); if ( $addparser eq "1" ) { push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/nate_logpar_r41e.thpl \n" ); } #if($ALM_PUSH=~/y/i) { my @ALM = ALM_push($runid_ert_t); push( @hparams_ert, @ALM ); } #push(@hparams_ert, # " $Home/NDATE/SUPPORT_SCRIPTS/ert_send_result.thpl RUNID=ert_send_result.thpl \n" # ); #$index++; $exe_days++; #last if ($index > 32); #} ## end while ($index <= $days[1]) } ## end foreach my $index (@days) print BOLD, CYAN, " User selected NADQ02_ERT_Maint.thpl for $exe_days days\n", RESET if ( $exe_days > 0 ); #} ## end if ($index < 33) my $ert_fsys_test = "NADQ02_ERT_Fsys.thpl"; $len_ert = rindex $ert_fsys_test, '.thpl'; $runid_ert = substr( $ert_fsys_test, 0, $len_ert ); $exe_days = 0; foreach my $index (@days) { if ( ( $index >= 33 ) && ( $index <= 42 ) ) { if ( $ert_fsys_1 =~ /ERT_Fsys/ ) { push( @hparams_ert, " Filer_mode=F" ); my $ert_fsys = $ert_fsys_1; $ert_fsys =~ s/.thpl//g; push( @hparams_ert, " GROUP_NO=$ert_fsys", "\n", "KERNEL_TYPE=$KERNEL_TYPE" ) if ( $ERT =~ /Y/i ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams_ert, " PARSE_ID=check_filer_setup " ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); last; } } } #if ($index < 43) { #while ($index <= $days[1]) { foreach my $index (@days) { if ( ( $index < 33 ) || ( $index > 42 ) ) { next; } $ERT_SP_DAY = 33 if ( $index == 33 ); if ( $index >= 36 ) { push( @hparams_ert, " RESETVALUE=$ert_reset_value" ); push( @hparams_ert, " ADAPRESETVALUE=$ert_adap_reset_value" ); } ## if ($index >= 36) my $runid_ert_t = $runid_ert . "_$index"; push( @hparams_ert, " ERT_TEST_ID=$index" ); =head # if ($option_TYPE eq 'C_mode') { if ( $ert_fsys_1 =~ /ERT_Fsys/ ) { push( @hparams_ert, " Filer_mode=F" ); if ($FIXED_MODE_TEST) { if ( ( !$flag_set ) || ( $mode_flag !~ /F/i ) ) { push( @hparams_ert, " GROUP_NO=$GROUP_NO", "\n", "KERNEL_TYPE=$KERNEL_TYPE" ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams_ert, " PARSE_ID=check_filer_setup " ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); $flag_set = 1; $mode_flag = 'F'; } } else { push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams_ert, " PARSE_ID=check_filer_setup " ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); } } else { push( @hparams_ert, " Filer_mode=M" ); if ($FIXED_MODE_TEST) { if ( ( !$flag_set ) || ( $mode_flag !~ /M/i ) ) { push( @hparams_ert, " GROUP_NO=$GROUP_NO", "\n", "KERNEL_TYPE=$KERNEL_TYPE" ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams_ert, " PARSE_ID=check_filer_setup " ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); $flag_set = 1; $mode_flag = 'M'; } } else { push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams_ert, " PARSE_ID=check_filer_setup " ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); } } =cut # my $temp_parse_id = "check_filer_setup"; # push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); push( @hparams_ert, " $Home/NDATE/TEST_SCRIPTS/ERT/$ert_fsys_1 RUNID=$runid_ert_t ERT_VOL=$ert_vol" ); # } else { # push(@hparams_ert, # " $Home/NDATE/TEST_SCRIPTS/ERT/$ert_fsys_1 RUNID=$runid_ert_t TEST_CONFIG=D ERT_VOL=$ert_vol" # ); # } push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams_ert, " PARSE_ID=$runid_ert_t " ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl" ); if ( $addparser eq "1" ) { push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/nate_logpar_r41e.thpl \n" ); } #if($ALM_PUSH=~/y/i) { my @ALM = ALM_push($runid_ert_t); push( @hparams_ert, @ALM ); } $ems_parser_exec = 1; #push(@hparams_ert, # " $Home/NDATE/SUPPORT_SCRIPTS/ert_send_result.thpl RUNID=ert_send_result.thpl \n" # ); #$index++; $exe_days++; #last if ($index > 42); #} ## end while ($index <= $days[1]) } ## end foreach my $index (@days) print BOLD, CYAN, " User selected NADQ02_ERT_Fsys.thpl for $exe_days days\n", RESET if ( $exe_days > 0 ); #} ## end if ($index < 43) my $ert_fsys_test = "NADQ02_ERT_Fsys_Reconstruction.thpl"; $len_ert = rindex $ert_fsys_test, '.thpl'; $runid_ert = substr( $ert_fsys_test, 0, $len_ert ); $exe_days = 0; # ERTPYTH #if ($ert_fsys_test =~ /_ERT_Fsys_Reconstruction\.thpl/) { # while (1) { # alarm $ALARM; # if ($runpyth == 1) { # set_python_path(); # } # last; # } #} #if ($index <= 43) { # while ($index <= $days[1]) { foreach my $index (@days) { if ( $index == 43 ) { if ( $ert_fsys_2 =~ /ERT_Fsys_Rec/ ) { push( @hparams_ert, " Filer_mode=F" ); my $ert_fsys_re = $ert_fsys_2; $ert_fsys_re =~ s/.thpl//g; push( @hparams_ert, " GROUP_NO=$ert_fsys_re", "\n", "KERNEL_TYPE=$KERNEL_TYPE" ) if ( $ERT =~ /Y/i ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams_ert, " PARSE_ID=check_filer_setup " ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); last; } } } foreach my $index (@days) { next if ( $index ne 43 ); $ERT_SP_DAY = 43 if ( $index == 43 ); my $runid_ert_t = $runid_ert . "_$index"; push( @hparams_ert, " ERT_TEST_ID=$index" ); # if ($option_TYPE eq 'C_mode') { =head if ( $ert_fsys_2 =~ /ERT_Fsys_Rec/ ) { push( @hparams_ert, " Filer_mode=F" ); if ($FIXED_MODE_TEST) { if ( ( !$flag_set ) || ( $mode_flag !~ /F/i ) ) { push( @hparams_ert, " GROUP_NO=$GROUP_NO", "\n", "KERNEL_TYPE=$KERNEL_TYPE" ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams_ert, " PARSE_ID=check_filer_setup " ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); $flag_set = 1; $mode_flag = 'F'; } } else { push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams_ert, " PARSE_ID=check_filer_setup " ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); } } else { push( @hparams_ert, " Filer_mode=M" ); if ($FIXED_MODE_TEST) { if ( ( !$flag_set ) || ( $mode_flag !~ /M/i ) ) { push( @hparams_ert, " GROUP_NO=$GROUP_NO", "\n", "KERNEL_TYPE=$KERNEL_TYPE" ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams_ert, " PARSE_ID=check_filer_setup " ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); $flag_set = 1; $mode_flag = 'M'; } } else { push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/check_filer_setup.thpl RUNID=check_filer_setup" ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams_ert, " PARSE_ID=check_filer_setup " ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl \n" ); } } =cut my $temp_parse_id = "check_filer_setup"; push( @hparams_ert, " $Home/NDATE/TEST_SCRIPTS/ERT/$ert_fsys_2 RUNID=$runid_ert_t ERT_VOL=$ert_vol" ); # } else { # push(@hparams_ert, # " $Home/NDATE/TEST_SCRIPTS/ERT/$ert_fsys_2 RUNID=$runid_ert_t TEST_CONFIG=D ERT_VOL=$ert_vol" # ); # } push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/log_cleanup.thpl \n" ); push( @hparams_ert, " PARSE_ID=$runid_ert_t " ); push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/parser.thpl" ); if ( $addparser eq "1" ) { push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/nate_logpar_r41e.thpl \n" ); } #if($ALM_PUSH=~/y/i) { my @ALM = ALM_push($runid_ert_t); push( @hparams_ert, @ALM ); } $ems_parser_exec = 1; #push(@hparams_ert, # " $Home/NDATE/SUPPORT_SCRIPTS/ert_send_result.thpl RUNID=ert_send_result.thpl \n" # ); $index++; $exe_days++; #last if ($index > 43); #} ## end while ($index <= $days[1]) } ## end foreach my $index (@days) print BOLD, CYAN, " User selected NADQ02_ERT_Fsys_Reconstruction.thpl for $exe_days days\n", RESET if ( $exe_days > 0 ); #} ## end if ($index <= 43) if ( $ems_parser_exec == 1 ) { push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/ems_par_r2.thpl \n" ); } push( @hparams_ert, " $Home/NDATE/SUPPORT_SCRIPTS/ert_send_result.thpl RUNID=ert_send_result.thpl \n" ); if ( $test_wait_time == 1 ) { my $total_ert_time = ( $TOTAL_ERT_DAYS * 24 ) / 10; $total_ert_time = ( $total_ert_time + 5 ) if ( $ERT_SP_DAY == 33 ); print BOLD, RED, "\n Test execution time set to 10%. \n ERT tests is going to take approximately $total_ert_time Hrs.\n", RESET; } elsif ( $test_wait_time == 2 ) { my $new_days = ( $TOTAL_ERT_DAYS / 2 ); print BOLD, RED, "\n Test execution time set to 50%. \n ERT tests is going to take approximately $new_days days.\n", RESET; } else { print BOLD, BLUE, "\n ERT tests is going to take approximately $TOTAL_ERT_DAYS days.\n", RESET; } print BOLD, CYAN, "\n The above calculated time is the minimum time to execute the test. The actual test execution time is dependent upon the total no. of drives and the capacity of all drives.\n", RESET; push( @hparams_ert, " \}\n" ); } ## end foreach my $hostname (@host_arr6) last if ( $host_select_all == 1 ); last if ( $ADD_TEST_CASES == 1 ); # print "\n\n"; =head print BOLD, CYAN, <<'EOD', RESET; Would you like to continue to add test cases to the test suite ? (y/n) Enter 'help' for more information ..................................................... EOD =cut my $runlist_flag = "n"; =head while (1) { $runlist_flag = getchompstrip( "", "", "" ); alarm $ALARM; if ( $runlist_flag =~ /(help|HELP|Help)/ ) { print BOLD, GREEN, " Enter 'y' for executing different set of tests on different filer\n", " Make sure that the filer is not selected for any other tests in the same test suite\n", " All tests will be executed in parallel mode\n"; RESET; } elsif (( $runlist_flag eq "y" ) || ( $runlist_flag eq "Y" ) || ( $runlist_flag eq "n" ) || ( $runlist_flag eq "N" ) ) { last; } else { oops "Please enter correct value y/n/help"; } } ## end while (1) =cut last if ( $runlist_flag =~ /^(N|n)/ ) } ## end while (1) } ## end else [ if (!((-e "$Home/NDATE/TEST_SCRIPTS/ERT/NADQ02_ERT_Maint.thpl"... push( @hparams_ert, "\}\n" ); { chdir("$Home/NDATE/TEST_LISTS") && last; oops "Not able to change location to directory:$Home/NDATE/TEST_LISTS"; } foreach (@hparams_ert) { if ( ( ( $_ =~ /=hdd-/ ) || ( $_ =~ /=bb12-/ ) ) && ( ( $_ =~ /_IC/ ) || ( $_ =~ /_BR/ ) || ( $_ =~ /_C/ ) ) && ( $_ !~ /FILERS_LIST/ ) ) { #Rename the filer name my @name_arr = split( $_, "_" ); $_ = $name_arr[0]; } } my $fh = new FileHandle( $runlist_ert, O_WRONLY | O_CREAT | O_TRUNC ) or die "cannot open \"$runlist_ert\": $!\n"; print $fh ( join( "\n", @hparams_ert ) . "\n" ) or die "cannot write to \"$runlist_ert\": $!\n"; $fh->close() or die "cannot close \"$runlist_ert\": $!\n"; undef $fh; print BOLD, GREEN, "\n-------------------------------------------------------------------\n"; print " Test suite file $Home/NDATE/TEST_LISTS/$runlist_ert created"; print "\n-------------------------------------------------------------------\n", RESET; return $runlist_ert; } ## end sub create_ERT_runlist() sub check_file_version() { my $ret = 0; my $defailt_vals = "$Home/NDATE_ver"; open( H_LOGFILE, "< $defailt_vals" ) or print "Failed opening $defailt_vals for checking latest package\n"; foreach my $line () { if ( $line =~ /^\#/ ) { next; # skip overall result report starting with a '#'. } if ( $line =~ /(.*)_ver=(.*)/ ) { my $test_script = $1; my $test_ver = $2; if ( $test_script =~ /NADQ02_FC/ ) { $test_script = "$Home/NDATE/TEST_SCRIPTS/FC/$test_script" . ".thpl"; my $e_ver = `cat $test_script | grep '\$Id' | cut -d'#' -f3 | cut -d' ' -f1`; if ( $e_ver < $test_ver ) { print BOLD, RED, " Update the script: $test_script \n Latest version: $test_ver \n Installed version:$e_ver \n", RESET; $ret = 1; } } elsif ( $test_script =~ /NADQ02_SATA/ ) { $test_script = "$Home/NDATE/TEST_SCRIPTS/SAS/$test_script" . ".thpl"; my $e_ver = `cat $test_script | grep '\$Id' | cut -d'#' -f3 | cut -d' ' -f1`; if ( $e_ver < $test_ver ) { print BOLD, RED, " Old version exists for script $test_script \n Latest version: $test_ver \n Installed version:$e_ver \n",, RESET; $ret = 1; } } elsif ( $test_script =~ /NADQ02_SSD/ ) { $test_script = "$Home/NDATE/TEST_SCRIPTS/SSD/$test_script" . ".thpl"; my $e_ver = `cat $test_script | grep '\$Id' | cut -d'#' -f3 | cut -d' ' -f1`; if ( $e_ver < $test_ver ) { print BOLD, RED, " Old version exists for script $test_script \n Latest version: $test_ver \n Installed version:$e_ver \n", RESET; $ret = 1; } } elsif ( $test_script =~ /Common/ ) { $test_script = "$Home/NDATE/HDD_LIBS/Storage/$test_script" . ".pm"; my $e_ver = `cat $test_script | grep '\$Id' | cut -d'#' -f3 | cut -d' ' -f1`; if ( $e_ver < $test_ver ) { print BOLD, RED, " Old version exists for script $test_script \n Latest version: $test_ver \n Installed version:$e_ver \n", RESET; $ret = 1; } } ## end elsif ($test_script =~ /Common/) } ## end if ($line =~ /(.*)_ver=(.*)/) } ## end foreach my $line () close H_LOGFILE; return $ret; } ## end sub check_file_version() sub verify_jobs() { my ( $tty, $ps, $flag, $choice ); $flag = 0; $tty = `tty`; $tty =~ s/^ //; $tty =~ s/\s$//; # List the process ids $ps = `ps -t $tty`; if ( $ps =~ /ntest/g ) { $flag = 1; print BOLD, RED, "NDATE is running in background of the present terminal....\n", RESET; #$ps = sprintf("%9s\n", $ps); print "$ps\n"; } else { return; } while ( (1) && ( $flag == 1 ) ) { print BOLD, RED, "Enter 'y' to kill the background NDATE and continue the present NDATE. 'n' to exit from the present NDATE.\n", RESET; print BOLD, RED, "\nNote: If you select 'y' it kills only the NDATE which is running in the background mode of the" . "\npresent terminal.\n", RESET; $choice = getchompstrip( "", "", "" ); alarm $ALARM; $choice = trim($choice); last if ( $choice =~ /y|n/i ); print "Wrong choice try again\n"; } ## end while ((1) && ($flag == 1... if ( ( $choice =~ /y/i ) && ( $flag == 1 ) ) { foreach $_ ( split( /\n/, $ps ) ) { if ( $_ =~ /\s*(\d+)(.*)ntest/ ) { system("kill -9 $1"); print BOLD, RED, sprintf( "%20s", "Killed Background Job: $_\n" ), RESET; } } } else { print BOLD, CYAN, "Exiting from the present NDATE\n", RESET; exit(0); } } ## end sub verify_jobs() # This filer displays the type of the filer reading from the NDATE/FILER_INFO folder sub display_filertype($) { my (@filers) = @_; my ( $line, $prin_form ); my %filer_type; chdir("$Home/NDATE/FILER_INFO") || oops "Not able to change location to directory:$Home/NDATE/FILER_INFO"; foreach $_ (@filers) { open( FILER, "$_" ); #|| die "Not able to open $_ at $Home/NDATE/TEST_LISTS"; while ( $line = ) { if ( $line =~ /VERSION=.*/ ) { # Option 3 - Boot the filer in option 4a if ( $command_option eq "3" ) { print BOLD, MAGENTA, "\n\nOption 3(Boot the filer in option 4a) does not support for the Boilermaker\n", RESET; print BOLD, MAGENTA, "Please refer ./ndate help...Exiting from the ndate\n\n", RESET; exit(0); } $filer_type{$_} = 'BR'; $prin_form = sprintf( "%8s", "\n FILER: $_ of type Boilermaker\n" ); print BOLD, MAGENTA, $prin_form; # Set the Filer type $FILER_TYPE = 'BR'; close FILER; # Exit from the loop immediately last; } elsif ( $line =~ /NETBOOT_FILE=.*/ ) { $filer_type{$_} = 'IC'; $prin_form = sprintf( "%8s", "\n FILER: $_ of type Ironcity\n" ); print BOLD, MAGENTA, $prin_form; # Set the Filer type $FILER_TYPE = 'IC'; close FILER; # Exit from the loop immediately last; } elsif ( $line =~ /bootimage=.*/ ) { $filer_type{$_} = 'IC'; print BOLD, MAGENTA, "\n FILER: $_ type Ironcity\n", RESET; # Set the Filer type $FILER_TYPE = 'IC'; close FILER; # Exit from the loop immediately last; } else { ; } } ## end while ($line = ) } ## end foreach $_ (@filers) return %filer_type; } ## end sub display_filertype($) ## This function returns the IR and BR files by reading the Host files. sub display_ir_br_filers(@) { my (@filers) = @_; my $line; my %filer_type; my $filer_id; #my $dir = "$Home/NDATE/FILER_INFO"; #opendir DIR, $dir or die "cannot open dir $dir: $!"; #my @file= readdir DIR; #closedir DIR; chdir("$Home/NDATE/FILER_INFO") || oops "Not able to change location to directory:$Home/NDATE/FILER_INFO"; if ( $FILER_TYPE eq "IC" ) { #renaming all the files from _IC foreach my $filername (@filers) { $filername = trim($filername); if ( $filername =~ /_IC$/ ) { #Caturing the hostname #my @filer_id = split(/_/, $filername); $filer_id = $filername; $filer_id =~ s/_IC$//; system("sudo cp $filername $filer_id"); } } ## end foreach my $filername (@filers) } else { if ( $option_TYPE == '7_mode' ) { #renaming all the files from _BR foreach my $filername (@filers) { $filername = trim($filername); if ( $filername =~ /_BR$/ ) { #Caturing the hostname #my @filer_id = split(/_/, $filername); $filer_id = $filername; $filer_id =~ s/_BR$//; system("sudo cp $filername $filer_id"); } } ## end foreach my $filername (@filers) } if ( $option_TYPE == 'C_mode' ) { #renaming all the files from _C foreach my $filername (@filers) { $filername = trim($filername); if ( ( $filername =~ /_C$/ ) && ( $filername !~ /FILERS_LIST/ ) ) { #Caturing the hostname #my @filer_id = split(/_/, $filername); $filer_id = $filername; $filer_id =~ s/_C$//; system("sudo cp $filername $filer_id"); } } ## end foreach my $filername (@filers) } } @filers = <*>; my @hostfiles_C = (); my @hostfiles_BR = (); foreach my $host_name ( sort { $a <=> $b } @filers ) { if ( ( $host_name =~ /\S+_C$/ ) && ( $host_name !~ /FILERS_LIST/ ) ) { $host_name =~ s/_C//; push( @hostfiles_C, $host_name ); } if ( ( $host_name =~ /\S+_BR$/ ) && ( $host_name !~ /FILERS_LIST/ ) ) { $host_name =~ s/_BR//; push( @hostfiles_BR, $host_name ); } } if ( $option_TYPE == '7_mode' ) { @filers = @hostfiles_BR; foreach $_ (@filers) { next if ( $_ =~ /_IC$|_BR$/ ); open( FILER, "$_" ); #|| die "Not able to open $_ at $Home/NDATE/TEST_LISTS"; while ( $line = ) { if ( $line =~ /VERSION=.*/ ) { $filer_type{$_} = 'BR'; close FILER; # Exit from the loop immediately last; } elsif ( $line =~ /NETBOOT_FILE=.*/ ) { $filer_type{$_} = 'IC'; close FILER; # Exit from the loop immediately last; } elsif ( $line =~ /bootimage=.*/ ) { $filer_type{$_} = 'IC'; close FILER; # Exit from the loop immediately last; } else { ; } } ## end while ($line = ) } ## end foreach $_ (@filers) } else { @filers = @hostfiles_C; foreach $_ (@filers) { next if ( $_ =~ /_C$/ ); open( FILER, "$_" ); #|| die "Not able to open $_ at $Home/NDATE/TEST_LISTS"; while ( $line = ) { if ( $line =~ /CLUSTER_NAME=.*/ ) { $filer_type{$_} = 'BR'; close FILER; # Exit from the loop immediately last; } else { ; } } ## end while ($line = ) } ## end foreach $_ (@filers) } return %filer_type; } ## end sub display_ir_br_filers(@) #============================= Install STAF ================================= sub install_STAF() { my $STAFProc = "$STAF_staf_a/startSTAFProc.sh"; my $STAFenv = "$STAF_staf_a/STAFEnv.sh"; my $startSTAF = "$STAF_staf_a/start_STAF.pl"; if ( !( -d "/usr/software/test/staf/staf-3.4.1a" ) ) { my @support_ver_out = `cat /etc/issue`; my $support_ver = $support_ver_out[0]; my $oldStafPath; if ( ( $support_ver =~ /.*Red Hat Linux/ ) || ( $support_ver =~ /.*Fedora/ ) || ( $support_ver =~ /.*Red Hat Enterprise/ ) ) { my $unix_ver_cmd = `uname -m`; my $unix_ver_data = 0; my $unix_distribution = `cat /proc/version`; my $rel_ver = 0; # $STAF_Path = $STAF_Path."/staf-3.4.1a"; # if (-e $STAF_Path) { # system("sudo rm -rf $STAF_Path"); # } # system("sudo mkdir $STAF_Path"); my $STAF_test = "/usr/software/test"; if ( !( -e $STAF_test ) ) { system("sudo mkdir $STAF_test"); } my $STAF_staf = "/usr/software/test/staf"; if ( !( -e $STAF_staf ) ) { system("sudo mkdir $STAF_staf"); } if ( !( -e $STAF_staf_a ) ) { system("sudo mkdir $STAF_staf_a"); } if ( ( $unix_ver_cmd =~ /.*i686/ ) && ( ( ( $unix_distribution =~ /.*Red Hat 4/ ) && ( $support_ver =~ /.*Fedora release (2|3|4|5|6|7|8|9|10|15)/ ) ) || ( $support_ver =~ /.*Red Hat Enterprise Linux Server release 4/ ) || ( $support_ver =~ /.*Red Hat Enterprise Linux 4/ ) ) ) { system("cd $Home/NDATE/STAF;sudo tar -xf i386-redhat-rhel5.tar;sudo cp -rf $Home/NDATE/STAF/x/eng/localtest/arch/i386-redhat-rhel5/staf/staf-3.4.1a/* $STAF_staf_a;sudo cp -rf $Home/NDATE/STAF/x/eng/localtest/noarch/bin/* $STAF_staf_a;sudo rm -rf $Home/NDATE/STAF/x"); $oldStafPath = "/x/eng/localtest/arch/i386-redhat-rhel5/staf/staf-3.4.1a"; } elsif ( ( $unix_ver_cmd =~ /.*i686/ ) && ( ( ( $unix_distribution =~ /.*Red Hat 5/ ) && ( $support_ver =~ /.*Fedora release (2|3|4|5|6|7|8|9|10|15)/ ) ) || ( $support_ver =~ /.*Red Hat Enterprise Linux Server release 5/ ) || ( $support_ver =~ /.*Red Hat Enterprise Linux 5/ ) ) ) { system("cd $Home/NDATE/STAF;sudo tar -xf i386-redhat-rhel5.tar;sudo cp -rf $Home/NDATE/STAF/x/eng/localtest/arch/i386-redhat-rhel5/staf/staf-3.4.1a/* $STAF_staf_a;sudo cp -rf $Home/NDATE/STAF/x/eng/localtest/noarch/bin/* $STAF_staf_a;sudo rm -rf $Home/NDATE/STAF/x"); $oldStafPath = "/x/eng/localtest/arch/i386-redhat-rhel5/staf/staf-3.4.1a"; } elsif ( ( $unix_ver_cmd =~ /.*i686/ ) && ( ( $unix_distribution =~ /.*Red Hat Linux (8|9)/ ) || ( $unix_distribution =~ /.*Fedora release 1/ ) || ( $support_ver =~ /.*Red Hat Enterprise Linux Server release 3/ ) || ( $support_ver =~ /.*Red Hat Enterprise Linux 3/ ) ) ) { system("cd $Home/NDATE/STAF;sudo tar -xf i386-redhat-linux7.tar;sudo cp -rf $Home/NDATE/STAF/x/eng/localtest/arch/i386-redhat-linux7/staf/staf-3.4.1a/* $STAF_staf_a;sudo cp -rf $Home/NDATE/STAF/x/eng/localtest/noarch/bin/* $STAF_staf_a;sudo rm -rf $Home/NDATE/STAF/x"); $oldStafPath = "/x/eng/localtest/arch/i386-redhat-linux7/staf/staf-3.4.1a"; } elsif ( ( $unix_ver_cmd =~ /.*x86_64/ ) && ( ( $unix_distribution =~ /.*Red Hat 4/ ) || ( $unix_distribution =~ /.*Red Hat 5/ ) ) ) { system("cd $Home/NDATE/STAF;sudo tar -xf x86_64-redhat-rhel5.tar;sudo cp -rf $Home/NDATE/STAF/x/eng/localtest/arch/x86_64-redhat-rhel5/staf/staf-3.4.1a/* $STAF_staf_a;sudo cp -rf $Home/NDATE/STAF/x/eng/localtest/noarch/bin/* $STAF_staf_a;sudo rm -rf $Home/NDATE/STAF/x"); $oldStafPath = "/x/eng/localtest/arch/x86_64-redhat-rhel5/staf/staf-3.4.1a"; } ## end elsif (($unix_ver_cmd =~ ... } else { print BOLD, RED, "Unsupported system. It supports only i686 and x86_64. STAF object could not be initialized. \n", RESET; exit 0; } #Give read-write permissions to the files system("sudo chmod 777 $STAFProc"); system("sudo chmod 777 $STAFenv"); system("sudo chmod 777 $startSTAF"); #Set the env variables my ( @newStafProcFile, @newStafFile, @newStafStartFile ); if ( open( STAFProc, "$STAFProc" ) ) { while () { trim($_); if ( $_ =~ /$oldStafPath/ ) { $_ =~ s/$oldStafPath/$STAF_staf_a/g; } my $env_path = "$oldStafPath/bin"; if ( $_ =~ "$env_path/STAFEnv.sh" ) { $_ =~ s/$env_path/$STAF_staf_a/g; } push( @newStafProcFile, "$_" ); } ## end while () close STAFProc; } else { print BOLD, RED, "Not able to modify the STAF file : $STAFProc \n", RESET; return 0; } if ( open( STAFENV, "$STAFenv" ) ) { while () { trim($_); if ( $_ =~ /$oldStafPath/ ) { $_ =~ s/$oldStafPath/$STAF_staf_a/g; } push( @newStafFile, "$_" ); } close STAFENV; } else { print BOLD, RED, "Not able to modify the STAF file : $STAFenv \n", RESET; return 0; } my $old_path = "/usr/software/test/staf/current"; if ( open( STAFSTART, "$startSTAF" ) ) { while () { trim($_); if ( $_ =~ /$old_path/ ) { $_ =~ s/$old_path/$STAF_staf_a/g; } push( @newStafStartFile, "$_" ); } close STAFSTART; } else { print BOLD, RED, "Not able to modify the STAF file : $startSTAF \n", RESET; return 0; } if ( open( STAFProc, ">$STAFProc" ) ) { foreach my $line (@newStafProcFile) { print( STAFProc $line ); } close STAFProc; } else { print BOLD, RED, "Not able to modify the STAF file : $STAFProc \n", RESET; return 0; } if ( open( STAFENV, ">$STAFenv" ) ) { foreach my $line (@newStafFile) { print( STAFENV $line ); } close STAFENV; } else { print BOLD, RED, "Not able to modify the STAF file : $STAFenv \n", RESET; return 0; } if ( open( STAFSTART, ">$startSTAF" ) ) { foreach my $line (@newStafStartFile) { print( STAFSTART $line ); } close STAFSTART; } else { print BOLD, RED, "Not able to modify the STAF file : $startSTAF \n", RESET; return 0; } #Removing soft links from the files system("cd $STAF_staf_a/bin;sudo rm -rf staf;sudo cp -rf STAF staf"); system("cd $STAF_staf_a/bin;sudo rm -rf fmtlog;sudo cp -rf FmtLog fmtlog"); system("cd $STAF_staf_a/lib;sudo rm -rf libPLSTAF.so;sudo cp -rf perl58/libPLSTAF.so ."); if ( -d "$STAF_staf_a/lib/IPv6" ) { system("cd $STAF_staf_a/lib;sudo rm -rf libSTAF.so;sudo cp -rf IPv6/libSTAF.so ."); system("cd $STAF_staf_a/lib;sudo rm -rf libSTAFTCP.so;sudo cp -rf IPv6/libSTAFTCP.so ."); } else { system("cd $STAF_staf_a/lib;sudo rm -rf libSTAF.so;sudo cp -rf IPv4/libSTAF.so ."); system("cd $STAF_staf_a/lib;sudo rm -rf libSTAFTCP.so;sudo cp -rf IPv4/libSTAFTCP.so ."); } system("cd $STAF_staf_a/lib;sudo rm -rf PYSTAF.so;sudo cp -rf python25/PYSTAF.so ."); } ## end if (!(-d "/usr/software/test/staf/staf-3.4.1a"... if ( !( -e $startSTAF ) ) { $startSTAF = "$STAF_staf_a/../pnate/bin/start_STAF.pl"; } system("sudo $startSTAF"); my $cmd = "\. $STAFProc"; my $res = `$cmd;echo PATH=\$PATH;echo STAF_INSTANCE_NAME=\$STAF_INSTANCE_NAME;echo CLASSPATH=\$CLASSPATH;echo LD_LIBRARY_PATH=\$LD_LIBRARY_PATH;echo STAFCONVDIR=\$STAFCONVDIR;echo ---- ; echo `; my @arr = split( /\n/, $res ); foreach my $val (@arr) { if ( $val =~ /(\S+)=(\S+)/ ) { my $var = $1; my $path = $2; $path =~ s/\,//g; $ENV{$var} = $path; } } system("sudo $startSTAF"); # system("sudo rm -rf $Home/startSTAFProc.sh;sudo rm -rf $Home/STAFEnv.sh;sudo rm -rf $Home/start_STAF.pl"); # Update the .ntest file # my @new_file; my $ntest_path = "$Home/NDATE/.ntest"; system("chmod 764 $ntest_path"); my $staf_lib = "$STAF_staf_a/lib"; my $staf_bin = "$STAF_staf_a/bin"; if ( open( H_LOGFILE, "< $ntest_path" ) ) { foreach my $line () { trim($line); if ( ( $line =~ /STAFCONVDIR/ ) || ( $line =~ /STAF_DIR_UNIX/ ) || ( $line =~ "$staf_bin" ) || ( $line =~ "$staf_lib" ) ) { } else { push( @new_file, "$line" ); } } ## end foreach my $line () push( @new_file, "STAFCONVDIR=$STAF_staf_a/codepage\n" ); push( @new_file, "STAF_DIR_UNIX=$STAF_staf_a\n" ); push( @new_file, "NATE_LIB+=$staf_bin\n" ); push( @new_file, "NATE_LIB+=$staf_lib\n" ); close H_LOGFILE; } else { print BOLD, RED, "Not able to modify the log directory path in $ntest_path, default path set \n", RESET; return 0; } if ( open( H_LOGFILE, "> $ntest_path" ) ) { foreach my $line (@new_file) { print( H_LOGFILE $line ); } close H_LOGFILE; } else { print BOLD, RED, "Not able to modify the log directory path in $ntest_path, default path set \n", RESET; return 0; } if ( ($logdir) && !( $logdir =~ /(NULL|null)/ ) ) { my $ret_val = set_logdir($logdir); $logdir = "$Home/NDATE/TEST_LOGS" if ( $ret_val == 0 ); } else { $logdir = "$Home/NDATE/TEST_LOGS"; set_logdir("$Home/NDATE/TEST_LOGS"); } #use Data::Dumper; #print Dumper \%ENV; } ## end sub install_STAF() # Sub get total number of test sub gettestcount( $ ) { my $count = $_[0]; if ( $count > 1 ) { $logsize = $logsize * $count; } else { $logsize = $logsize; } } # Sub to get total ERT dates sub gettotaldates( $ ) { my $totaldays = $_[0]; if ( $totaldays > 1 ) { $logsize = $logsize * $totaldays; } else { $logsize = $logsize; } } # Sub to set python path for plotting sub set_python_path() { my $py_path; if ( $python_path eq '' ) { while (1) { alarm $ALARM; print BOLD, YELLOW, "\n\nNote: This test has capability to plot graph for generated data, ", RESET; #Open default parms and read python path open( F_defaul_parm, "$Home/NDATE/default_params" ); my @defl_parm = ; my $def_pyth_path; foreach my $line (@defl_parm) { if ( $line =~ /PYTHPATH=(.*)/ ) { $def_pyth_path = $1; } } print BOLD, YELLOW, " This feature requires python 2.4 installed on user machine with matplotlib\nand numpy module\n", RESET; print BOLD, CYAN, "\nPlease, provide path where python with required modules are installed, Press Enter to select default path \n", RESET; print BOLD, RED, "\n Press Enter to select default : /usr/software/bin/python.", RESET; if ( ( $def_pyth_path ne "/usr/software/bin/python" ) && ( $def_pyth_path ne "" ) ) { print BOLD, RED, "\n Press '1' to select previous execution path : $def_pyth_path", RESET; } print BOLD, RED, "\n Press '2' to enter new python path", RESET; $py_path = getchompstrip( "", '', "" ); $py_path = trim($py_path); if ( $py_path =~ /^$/ ) { print BOLD, RED, " \n Default path has been set.\n", RESET; print BOLD, RED, " If the above path does not contain the required python modules, the script may not plot the graph.\n", RESET; $python_path = "/usr/software/bin/python"; last; } elsif ( $py_path =~ /1/ ) { print BOLD, RED, " Default path of previous execution will be set - $def_pyth_path\n"; $python_path = $def_pyth_path; last; } elsif ( $py_path =~ /2/ ) { print BOLD, RED, " Enter python path where required modules are installed\n"; $py_path = getchompstrip( "", '', "" ); $py_path = trim($py_path); if ( $py_path =~ /^\// ) { $python_path = $py_path; last; } else { print BOLD, RED, " Please enter valid python path, path should start with '/' \n"; } } else { print BOLD, RED, " Please enter valid python path, path should start with '/' \n"; } } ## end while (1) } print BOLD, CYAN, "PYTHON PATH = $python_path\n"; } ## end sub set_python_path() # Sub to set Perl path for PNATE sub set_perl_path() { my $perl_path; while (1) { alarm $ALARM; print BOLD, GREEN, "\nPNATE will be installed in directory /usr. Please ensure that the user has sufficient permissions and memory to this directory.\n"; print BOLD, CYAN, "\nPlease, provide path where perl with required modules are installed, Press Enter to select default path \n", RESET; print BOLD, RED, "\nPress Enter to select default : /usr/software/bin.", RESET; $perl_path = getchompstrip( "", '', "" ); $perl_path = trim($perl_path); if ( $perl_path =~ /^$/ ) { print BOLD, RED, "\nDefault path has been set.\n", RESET; print BOLD, RED, "If the above path does not contain the required perl modules, the script may not install PNATE.\n", RESET; $PERL_PATH = "/usr/software/bin"; last; } elsif ( $perl_path !~ /^\// ) { print BOLD, RED, " Please enter valid path"; } elsif ( $perl_path =~ /^\// ) { $PERL_PATH = $perl_path; last; } else { print BOLD, RED, " Please enter valid perl path. \n"; } } ## end while (1) print BOLD, CYAN, "\n\nPERL PATH = $PERL_PATH \n"; } ## end sub set_perl_path() #Sub to check log directory size sub check_log_size() { if ( $enableshell == 2 ) { print BOLD, GREEN, "Starting Log size check process \n", RESET; $shell_dum_file = "$Home/NDATE/shell_$runlist" . "\.txt"; system("sh $Home/NDATE/SUPPORT_SCRIPTS/check.sh $shell_dum_file $MAIL_TO &"); } } #Function to check shell process running in present terminal sub check_shell_process() { my ( $tty, $ps, $user ); $tty = `tty`; $tty =~ s/^ //; $tty =~ s/\s$//; $tty =~ s/\/dev\///; $user = `whoami`; $ps = `ps -ef | grep check.sh | grep $tty | grep /NDATE/SUPPORT_SCRIPTS/ | grep $user`; if ( $ps =~ /sh/g ) { foreach $_ ( split( /\n/, $ps ) ) { if ( $_ =~ /\s+(\d+)\s+(.*)\/check.sh/ ) { system("kill -9 $1 2>/dev/null"); } } } #check for previous shell script exist check_shell_process_terminal(); } ## end sub check_shell_process() sub check_shell_process_terminal() { my ( $ps, $tty_own, $ps1, $process_kill ); $ps = `ps -ef | grep /NDATE/SUPPORT_SCRIPTS/check.sh | grep pts | grep $user`; my @array_ps = (); foreach my $process_IDS ( split( /\n/, $ps ) ) { if ( $process_IDS =~ /\s+(pts\/\d+)\s+/ ) { my $ps_IDS = $1; push( @array_ps, $ps_IDS ); } } #my @array_ps = split(/\n/, $ps); #Removing duplicate terminal ids my %test_hash; my @temp_arr; foreach (@array_ps) { if ( $test_hash{$_} ) { next; } else { $test_hash{$_} = 1; push( @temp_arr, $_ ); } } $tty_own = `tty`; $tty_own =~ s/^ //; $tty_own =~ s/\s$//; $tty_own =~ s/\/dev\///; foreach my $ty (@temp_arr) { if ( $ty =~ /$tty_own/ ) { next; } $ps1 = `ps -ef | grep $ty | grep ntest | grep $user`; foreach my $out ( split( /\n/, $ps1 ) ) { if ( $out =~ /NDATE\/NATE\/bin\/ntest/ ) { # print "This terminal id $ty has a ntest process running\n"; last; } else { $process_kill = `ps -ef | grep $ty | grep $user`; if ( $process_kill =~ /\/NDATE\/SUPPORT_SCRIPTS\/check.sh/ ) { foreach $_ ( split( /\n/, $process_kill ) ) { if ( $_ =~ /\s+(\d+)\s+(.*)\/check.sh/ ) { system("kill -9 $1 2>/dev/null"); # print "DEBUG3: Process ids to be killed are $1\n"; last; } } } ## end if ($process_kill =~ ... } ## end else [ if ($out =~ /NDATE\/NATE\/bin\/ntest/) } ## end foreach my $out (split(/\n/... } ## end foreach my $ty (@temp_arr) terminatezomprocess(); } ## end sub check_shell_process_terminal() # Sub to terminate zombie process of check.sh. sub terminatezomprocess() { my $cmd = "ps -ef | grep check | grep \"?\" | grep $user"; my $check_ps = `$cmd`; my $cmd_ntest = "ps -ef | grep ntest | grep $user"; my $ntest_ps = `$cmd_ntest`; #Capturing the individual ntest processes my @ntest_arr = split( "\n", $ntest_ps ); my @up_ntest_arr; foreach my $pro (@ntest_arr) { if ( $pro !~ /grep ntest/ ) { push( @up_ntest_arr, $pro ); } } if ( !(@up_ntest_arr) ) { my @check_arr = split( "\n", $check_ps ); foreach my $pro_ch (@check_arr) { if ( $pro_ch !~ /grep check/ ) { $pro_ch =~ /\s+(\d+)\s+/; system("kill -9 $1 2>/dev/null"); } } } terminate_other_zom_ps(); } ## end sub terminatezomprocess() sub terminate_other_zom_ps() { my $cmd = "ps -ef | grep check.sh"; my $check_ps = `$cmd`; my @up_ntest_arr; my @ntest_arr = split( "\n", $check_ps ); my $test_suit; foreach my $pro_ch (@ntest_arr) { if ( $pro_ch !~ /grep check/ ) { if ( $pro_ch =~ /(\S+)\s+.*\/check.sh\s+(\S+)\s+/ ) { my $user = $1; if ( $2 =~ /shell_(\S+)\.txt/ ) { $test_suit = $1; } my $cm = "ps -ef | grep $user | grep $test_suit"; my $exe = `$cm`; if ( $exe !~ /STEST_FILE/ ) { if ( $exe =~ /(\S+)\s+(\S+)\s+/ ) { system("sudo kill -9 $2 2>/dev/null"); } } } } } } ## function will check if firware files are present or not sub add_fw_files($) { my $path = shift; print BOLD, YELLOW, "\n Enter to continue after adding the firmware files \n", RESET; while (1) { my $confirm = getchompstrip( "", '', "" ); $confirm = trim($confirm); if ( $confirm =~ /^$/ ) { print BOLD, GREEN, "\n Checking again the firmware files.\n", RESET; sleep 2; if ( !( -e $path ) ) { `mkdir $path`; } my @firmware = `cd $path;ls *.LOD 2>/dev/null`; if ( @firmware < 1 ) { print BOLD, RED, "\nFirmware files are still not present in $path location\n", RESET; print BOLD, RED, "\nPlease copy relevant firmware files to $path directory before running the test case\n", RESET; exit(0); } else { print BOLD, CYAN, "\nNow following firmware files are available in the directory $path\n", RESET; $" = "\t"; print BOLD, CYAN "\n ========================================================================== \n\n"; print BOLD, CYAN, "\t@firmware\n\n"; disply_duplicates( [@firmware], "$path" ); # print BOLD, CYAN, "Enter to continue", RESET; # getchompstrip("", '', ""); alarm $ALARM; last; } ## end else [ if (@firmware < 1) } else { print BOLD, RED, " Please press the enter button after adding the firmware files \n", RESET; } } } #Function reads the array dispays the dupilcates sub disply_duplicates($$) { # my (@firmwares,$path) = (@_); my @firmwares = @{ $_[0] }; my $path = $_[1]; my $file; #Burt1037194 nmamatha grep { $file .= $_ } @FINAL_TC_Exe; invalid_dup: while (1) { my ( $flag, $def_val ); my ( @prod_ids, @dup_ids, @invalid_dup ); my ( %prod_hash, %prod_fw ); $flag = 0; foreach $_ (@firmwares) { $_ =~ s/\s+//g; my $fw = $_; { #Burt1037194 nmamatha if ( ( $file =~ /PwrCyc_FW_DL|NSSR_FW_DL/i ) || ( $file =~ /Disk_FW_DL_/i ) || ( $file =~ /Disk_FW_FSys_IO_PwrCyc/i ) ) { if ( ( $fw =~ /(\S+)\.(NA|NQ)\d\d\.LOD$/ ) ) { my $fw1 = $1; my $fw2 = $2; push( @{ $prod_fw{$fw1} }, $fw2 ); my @values = (); push( @values, @{ $prod_fw{$fw1} } ); if ( scalar @values > 1 ) { push( @invalid_dup, $fw ); } } elsif ( $fw !~ /NA|NQ/ ) { push( @invalid_dup, $fw ); } } else { if ( ( $fw =~ /\.NA\d\d\.LOD$/ ) || ( $fw =~ /\.NQ\d\d\.LOD$/ ) || ( $fw =~ /\.NT\d\d\.LOD$/ ) || ( $fw =~ /\.NE\d\d\.LOD$/ ) || ( $fw =~ /\.NX\d\d\.LOD$/ ) ) { } else { push( @invalid_dup, $fw ); } } } $fw =~ s/\.\w+\.\w+//; push( @prod_ids, $fw ); } if (@invalid_dup) { print BOLD, MAGENTA "\n\nInvalid firmware files are present ... \n\n"; grep { print "\n $_\n\n" } @invalid_dup; my $dup_files = join( ", ", @invalid_dup ); #$dup_files=~s/\.\w+\.LOD//g; print BOLD, YELLOW, "Please open another session and delete the Invalid firmware files for the Product ID's $dup_files from $path\n\n", RESET; print BOLD, CYAN, "\n Enter to continue after deleting the Invalid firmware files for the Product ID's $dup_files \n", RESET; while (1) { my $confirm = getchompstrip( "", '', "" ); $confirm = trim($confirm); if ( $confirm =~ /^$/ ) { print BOLD, GREEN, "\n Checking again the firmware files.\n", RESET; sleep 2; @firmwares = (); @firmwares = `cd $path;ls *.LOD`; goto invalid_dup; } else { print BOLD, RED, " Please press the enter button after deleting the firmware files \n", RESET; } } } print BOLD, CYAN "Validating the firmware files copied by the user"; foreach $_ (@prod_ids) { if ( ( $prod_hash{$_}++ ) && ( $prod_hash{$_}++ > 1 ) ) { push( @dup_ids, $_ ); $flag = 1; } } if ( $flag != 1 ) { print BOLD, CYAN "\nUser has copied only one firmware file for each product ID\n"; last; } else { print BOLD, RED "\n\nMore than one firmware file corresponding to a Product ID found.\nKindly copy only 1 firmware file for the following product id's... \n\n"; #$" = "\t\n"; grep { print "\n $_\n\n" } @dup_ids; my $dup_files = join( ", ", @dup_ids ); print BOLD, YELLOW, "Please open another session and delete the duplicate firmware files for the Product ID's $dup_files from $path\n\n", RESET; print BOLD, CYAN, "\n Enter to continue after deleting the duplicate firmware files for the Product ID's $dup_files \n", RESET; while (1) { my $confirm = getchompstrip( "", '', "" ); $confirm = trim($confirm); if ( $confirm =~ /^$/ ) { print BOLD, GREEN, "\n Checking again the firmware files.\n", RESET; sleep 2; last; } else { print BOLD, RED, " Please press the enter button after deleting the firmware files \n", RESET; } } # print "\n*** Exiting the ndate ****\n", RESET; # exit(0); @firmwares = (); @firmwares = `cd $path;ls *.LOD`; } } } #end of disply_duplicates #============================= Install nate package from pNate =========================== sub install_pnate_package_old_pnate_install() { $Term::ANSIColor::AUTORESET = 1; my ( $pnate_pkg, $pnate_mainfest_txt, $found, $perl588_sta ); my ( $stafconvdir, $ld_library_path, $i, $osversion, $flag ); my ( @ntest, @staf, @pnates, @staf_dir ); my @pnate_files; # set the perl 5.8.8 path my $path; # open pnate_ndate_debug file only # This will be read again to get the information about pNate open( PNATE, ">$Home/.pnate_ndate_debug" ) || warn "Not able to create pNate debug file"; opendir( DIR, "$Home" ); @pnate_files = readdir(DIR); foreach $_ (@pnate_files) { $_ =~ trim($_); if ( $_ =~ /^pnate_\d+(.*)\.zip/ ) { push( @pnates, $_ ); } } print PNATE "\n ****** PNATE DIRS START ************ \n"; print PNATE "\nPNATE DIRS: @pnates\n"; if ( @pnates > 1 ) { #Delete old pNates @pnates = sort { $b cmp $a } @pnates; #print "SRT: @pnates\n"; for ( $i = 1 ; $i < @pnates ; $i += 1 ) { system("rm -rf $Home/$pnates[$i]"); print PNATE "\nPNATE DIRS DELETED: $pnates[$i]\n"; } } ## end if (@pnates > 1) print PNATE "\n ****** PNATE DIRS END************ \n\n"; print PNATE "SELECTED=2\n"; $path = $ENV{PATH}; $path = "/usr/bin:" . $ENV{PATH}; $ENV{PATH} = $path; print PNATE "\nSet of paths:$ENV{PATH}\n"; my $ver = `which perl `; print PNATE "\nRunning perl version:$ver\n"; print PNATE "\nRunning present perl version:$]\n"; print BOLD, CYAN, "\nInstalling NDATE package under $Home/NDATE folder\n\n", RESET; # Search for the pnate_<>.zip #chdir("$Home"); #@pnate_files = <*>; print PNATE "\n**** Operating pNATE File Start****\n"; print PNATE "Operating on $pnates[0]\n"; print PNATE "\n**** Operating on pNATE File End****\n"; $pnate_pkg = ''; $found = ''; foreach $_ (@pnates) { $_ =~ trim($_); if ( $_ =~ /^pnate_\d+(.*)\.zip/ ) { $pnate_pkg = $_; $found = 0; last; } } ## end foreach $_ (@pnates) if ( $pnate_pkg eq '' ) { chdir("$Home/pkg"); print BOLD, CYAN "\nKindly copy pNate zip file into the home directry\n\n"; @pnate_files = (); @pnate_files = <*>; $\ = "\n"; foreach $_ (@pnate_files) { $_ =~ trim($_); if ( $_ =~ /^pnate_\d+(.*)\.zip/ ) { print PNATE "\n**** pnate package found at ", cwd(), "\n"; #print "pnate build found at $_\n"; #printf("PKG PWD: %s\n", cwd()); $pnate_pkg = $_; $found = 1; last; } ## end if ($_ =~ /^pnate_\d+(.*)\.zip/) } ## end foreach $_ (@pnate_files) } ## end if ($pnate_pkg eq '') if ( $pnate_pkg eq '' ) { print "Failed to found pNate files."; print "Please copy relavent pNate files into the home directry."; print "Kindly Re-execute again.."; $\ = ""; return 0; } if ( -e "$Home/archives" ) { system("rm -rf $Home/archives"); } if ( -e "$Home/install_pnate" ) { system("rm -f $Home/install_pnate"); } #Unzip if ( $found == 0 ) { eval { system("unzip -o $Home/$pnate_pkg"); }; #system("cp -f $Home/tests.zip $Home/archives"); if ($@) { print BOLD, RED, "Not able to unzip $!\n", RESET; print BOLD, RED, "Try from the option 4\n", RESET; clean_up_pnate(); $! = ''; return 0; } } else { chdir("$Home"); eval { system("unzip -o $Home/pkg/$pnate_pkg "); }; #system("cp -f $Home/pkg/tests.zip $Home/archives"); if ($@) { print BOLD, RED, "Not able to unzip $!\n", RESET; print BOLD, RED, "Try from the option 4\n", RESET; clean_up_pnate(); $! = ''; return 0; } } ## end else [ if ($found == 0) if ( !( -e "$Home/NDATE.tar.gz" ) ) { print BOLD, RED, "NDATE.tar.gz package file does not exist \n", RESET; oops("Kindly copy NDATE.tar.gz into $Home directry, try again.."); clean_up_pnate(); exit 0; } if ( ( -e "$Home/NDATE/HDD_LIBS" ) ) { system('cd ~/NDATE && rm -rf ./HDD_LIBS'); } if ( -d "$Home/NDATE/TEST_SCRIPTS" ) { system("sudo rm -rf $Home/NDATE/TEST_SCRIPTS/"); } system('cd $Home && tar -xzf NDATE.tar.gz'); ## Install perl packages if not exist then quit if ( !( -e "/usr/software/bin/perl5.8.8" ) ) { install_perl_package(); $perl588_sta = -e "/usr/software/bin/perl5.8.8"; print PNATE "\nPERL 5.8.8 status After: $perl588_sta\n"; print BOLD, CYAN, <<'EOD', RESET; ------------------------------------------------------------------------------ Perl modules installed under /usr/software EOD } ## end if (!(-e "/usr/software/bin/perl5.8.8"... exit if ( !( -e "/usr/software/bin/perl5.8.8" ) ); chdir("$Home/NDATE/HDD_LIBS"); if ( !( -e "$Home/NDATE/FILER_INFO" ) ) { system('cd ~/NDATE && mkdir FILER_INFO'); } if ( !( -e "$Home/NDATE/TEST_LISTS" ) ) { system('cd ~/NDATE && mkdir TEST_LISTS'); } if ( !( -e "$Home/NDATE/NATE/recover" ) ) { system('cd ~/NDATE/NATE && mkdir recover'); } # if exists then remove if ( ( -e "$Home/NDATE/NATE" ) ) { #system('cd ~/NDATE/NATE && rm -rfv ./bin ./html ./lib ./thpl ./validate ./cgi-bin ./Changes ./doc ./GNUmakefile'); system('cd ~/NDATE/NATE && rm -rf *'); } ################################## =head $flag = 0; # Create the dir to install the STAFF open(PNATE_CONF, "$Home/pnate_conf_ndate") || die ("Fail to open the file pnate_conf_ndate"); while ($_ = ) { if ($_ =~ /\_Staf\_Destination\s*\=\s*\{/) { $flag = 1; }elsif (($_ =~ /\s*(\#*)\"(\S+)\"\s*\=\>\s*\"/) && ($flag == 1)){ print "Got: $1 - $2\n"; print "uncomm got: $2\n" if ($1 =~ //); }elsif (($_ =~ /^\}\;$/) && ($flag == 1)) { close($_); last; } } if ($flag == 0) { close($_); oops("Problem of finding the _Staf_Destination.."); oops("Refer the pnate_conf_ndate file"); exit(0); } =cut ################################## #print PNATE "\n\n**** Operating on $Home/archives start****\n"; =head ########################################## if (-d "$Home/archives") { print PNATE "\n\n**** Operating on $Home/archives start****\n"; opendir(STF, "$Home/archives"); @staf_dir = readdir(STF); foreach $_ (@staf_dir) { $_ = trim ($_); if ($_ =~ /^staf\-(.*)\.zip/){ $! = ''; system("cd ~/NDATE && mkdir -p pSTAF/$1"); #mkdir("$Home/NDATE/pSTAF/$1", 0774); if ($!) { oops("Directry $Home/pSTAF/$osversion failed to create($?).."); } } } closedir(STF); } else { die "Directry $Home/archives not found"; } =cut ########################################## print PNATE `ls -l ~/NDATE`, "\n"; #print PNATE "\n**** Operating on $Home/archives end ****\n\n"; # if exists then remove if ( ( -e "$Home/NDATE/HDD_LIBS" ) ) { # Uncomment it later #system('cd ~/NDATE && rm -rf HDD_LIBS'); } # if exists then remove if ( ( -e "$Home/NDATE/STAF" ) ) { system('cd ~/NDATE/ && rm -rf ./STAF'); } print PNATE "\n**** pNATE Capturing the Enviromental variables Start****\n"; foreach $_ ( keys %ENV ) { print PNATE "$_ = $ENV{$_}\n"; } print PNATE "\n**** pNATE Capturing the Enviromental variables End ****\n"; chdir("$Home"); if ( -e "$Home/pnate_conf_ndate" ) { system('cp -f ~/pnate_conf_ndate ~/.pnate_conf.pl'); switch_off_valid(); } else { print BOLD, RED, "ERROR: Not able to install - Kindly copy the file 'pnate_conf_ndate' from directry pkg to home directry.", RESET; oops("\UTry immediately option 4 from main menu then select option 1 or 2"); clean_up_pnate(); return 0; } ## end else [ if (-e "$Home/pnate_conf_ndate") # Invoking the install_pnate eval { $? = ''; system("$Home/install_pnate --upgrade"); if ($?) { print BOLD, RED, "ERROR: Not able to install - '$!'", RESET; oops("Try immediately option 4 from main menu then select 1 - Installing NDATE package with NATE libraries"); clean_up_pnate(); return 0; } }; if ($@) { print BOLD, RED, "Not able to install, '$@'\n", RESET; oops("Try immediately option 4 from main menu then select 1 - Installing NDATE package with NATE libraries"); clean_up_pnate(); return (0); } # Invoking the install_pnate #system("$Home/install_pnate --upgrade"); ####################################################### =head # Set the /home/user/.ntest file if (-e "$Home/.ntest") { # REad the file #open (NTEST, "$Home/.ntest") || die "Not able to open $Home"; open (NTEST, "$Home/.ntest"); @ntest = ; $ntest[0] .= "\n\n #Set the ntest path\n -s $Home/NDATE/.ntest\n\n"; close(NTEST); # Write the file open (NTEST, ">$Home/.ntest") || die "Not able to open $Home"; print NTEST @ntest; close(NTEST); } =cut ####################################################### # Copy the pnate .ntest file my $cp = copy( "$Home/ntest_pnate", "$Home/NDATE/.ntest" ); if ( $cp == 1 ) { print PNATE "\nCopied From $Home/ntest_pnate to $Home/NDATE/.ntest\n"; } else { print PNATE "\nNDATE_PNATE_INSTAL=FAIL\n"; #IMP do not modify this close(PNATE); oops("Try again, Fail to copy startup file .ntest"); die "Oops, Fail to copy"; } print PNATE "\nNDATE_PNATE_INSTAL=SUCCESS\n"; #IMP do not modify this close(PNATE); $\ = ""; print BOLD, CYAN, <<'EOD', RESET; ------------------------------------------------------------------------------ NDATE package installed EOD sleep 3; $Term::ANSIColor::AUTORESET = 0; print BOLD, CYAN, "", RESET; #} ## end sub install_pnate_package() } ## end sub install_pnate_package_old_pnate_install() sub install_pnate_package(;$) { $Term::ANSIColor::AUTORESET = 1; my ( $pnate_pkg, $pnate_mainfest_txt, $found, $perl588_sta ); my ( $stafconvdir, $ld_library_path, $i, $osversion, $flag ); my ( @ntest, @staf, @pnates, @staf_dir, @npm ); my @pnate_files; my ($main_menu_option) = (@_); my $path; ##Check for the existence of the PNATE on the machine.This check is not required if user select the option 8(PNATE upgradation) if ( ( $main_menu_option != 8 ) && ( ( -e "/usr/PNATE/nate" ) && ( -e "/usr/PNATE/staf" ) && ( -e "/usr/PNATE/pnate" ) ) ) { print BOLD, CYAN, "PNATE is already installed\n To re-install PNATE, exit NDATE(by pressing CTRL-C) and select option '8' from the main \n"; $PNATE_Upgrade = 0; } ##If the PNATE package is not installed or user selected the upgradation of PNATE option ##untar the PNATE.tar.gz file if ( $PNATE_Upgrade == 1 ) { set_perl_path(); print BOLD, CYAN, "NDATE is working on PNATE files.It will takes nearly 3 minutes of time.\n\n", RESET; system('cd $Home && tar -xzf PNATE.tar.gz && chmod -R 755 PNATE'); system('cd $Home && mv PNATE/* . && rm -rf PNATE'); # open pnate_ndate_debug file only # This will be read again to get the information about pNate open( PNATE, ">$Home/.pnate_ndate_debug" ) || warn "Not able to create pNate debug file"; opendir( DIR, "$Home" ); @pnate_files = readdir(DIR); ##Getting the files required for PNATE foreach $_ (@pnate_files) { $_ =~ trim($_); if ( $_ =~ /^.*_pnate-\d+(.*)\.npm/ ) { # if ($_ =~ /NDATE-2.0.npm/) { push( @pnates, $_ ); } if ( $_ =~ /^npm\-.*\.zip/ ) { push( @npm, $_ ); } } ## end foreach $_ (@pnate_files) print PNATE "\n ****** PNATE DIRS START ************ \n"; print PNATE "\nPNATE DIRS: @pnates\n"; print PNATE "\nNPM DIRS: @npm\n"; my ( %pnate_ver, @sort ); if ( @pnates > 1 ) { #Delete old pNates foreach (@pnates) { my ($x) = $_ =~ /.*-(\S+).npm/; my $rem; ( $rem = $x ) =~ s/\.//g; $pnate_ver{$rem} = $_; push( @sort, $rem ); } @sort = sort { $b <=> $a } @sort; #@pnates = sort { $b cmp $a } @pnates; my @del_pnate; print PNATE "\nInstalling npm is $pnate_ver{$sort[0]}\n"; for ( @sort[ 1 .. $#sort ] ) { push( @del_pnate, $pnate_ver{$_} ); } @pnates = (); push( @pnates, $pnate_ver{ $sort[0] }, @del_pnate ); #total pnates list for ( $i = 0 ; $i < @del_pnate ; $i += 1 ) { system("rm -rf $Home/$del_pnate[$i]"); print PNATE "\nPNATE DIRS DELETED: $del_pnate[$i]\n"; } } ## end if (@pnates > 1) if ( @npm > 1 ) { @npm = sort { $b cmp $a } @npm; for ( $i = 1 ; $i < @npm ; $i += 1 ) { system("rm -rfv $Home/$npm[$i]"); print PNATE "\nNPM DIRS DELETED: $npm[$i]\n"; } } print PNATE "\n ****** PNATE DIRS END************ \n\n"; ##Creating the .pnate_conf file, which contains the perl path open CONF, ">$Home/.pnate_conf"; print CONF "#!/bin/bash\n"; print CONF "_PERL=$PERL_PATH/perl"; close(CONF); print PNATE "SELECTED=2\n"; $path = $ENV{PATH}; $path = $PERL_PATH . ":" . $ENV{PATH}; $ENV{PATH} = $path; print PNATE "\nSet of paths:$ENV{PATH}\n"; my $ver = `which perl `; print PNATE "\nRunning perl version:$ver\n"; print PNATE "\nRunning present perl version:$]\n"; #npm unzipping if the npm is not already installed on the machine because npm installation is also server-wide(loc:/usr/pNPM) if ( !-e "/usr/pNPM/bin/npm" ) { if ( @npm >= 1 ) { my $unzip_status = system("cd $Home;unzip -o $npm[0]"); if ( $unzip_status == 0 ) { print PNATE "\nUnzipped $npm[0] successfully\n"; } else { $unzip_status = system("unzip -o $npm[0] -d $Home"); print PNATE "\nUnzip status for 2nd time is $unzip_status\n"; } print PNATE "\nUnzipped file of npm: $npm[0]\n"; print pNATE "\nTotal files in npm: @npm\n"; } else { clean_up_pnate(); oops("\U npm-X.X.X.zip missing in home dir. Copy the PNATE.tar.gz from pkg folder and try again."); print PNATE "\nFAILED to copy the npm-.zip files at home directry. @npm\n"; print pNATE "\nTotal files in npm: @npm\n"; return 0; } ## end else [ if (@npm >= 1) } print PNATE "\n**** Operating pNATE File Start****\n"; print PNATE "Operating on $pnates[0]\n"; $pnate_pkg = ''; $found = ''; foreach $_ (@pnates) { $_ =~ trim($_); if ( $_ =~ /^.*_pnate-\d+(.*)\.npm/ ) { # if ($_ =~ /NDATE-2.0.npm/) { $pnate_pkg = $_; $found = 1; last; } } ## end foreach $_ (@pnates) if ( $pnate_pkg eq '' ) { print "Failed to found pNate files."; print BOLD, CYAN "\nKindly copy PNATE.tar.gz file from pkg directory into the $Home directry\n\n"; print "Kindly Re-execute again.."; $\ = ""; return 0; } else { chdir("$Home"); } ## Install the npm in pNPM print PNATE "\n\U**** Install the pNPM Start****\n"; chdir("$Home"); $path = $ENV{PATH}; if ( !-e "/usr/pNPM/bin/npm" ) { if ( -e "$Home/install_npm" ) { ##Install the npm if it is not installed #Change the setup setup_npm(); system("cp -f $Home/psetup $Home/bin/setup"); system("chmod 777 $Home/bin/setup"); system("$Home/bin/setup"); print PNATE "npm installed successfully\n"; } else { oops("\UTry immediately option 4 from main menu (or) else if you want to upgrade PNATE, then try option 8"); oops("\U No directry called ~/install_npm present.Kindly copy PNATE.tar.gz file to $Home directory and reexecute again"); clean_up_pnate(); print PNATE "\n\U**** No dir called $Home/bin/build_npm.pl present ***\n"; close(PNATE); return 0; } ## end else [ if (-e "$Home/install_npm") } else { print PNATE "\n**** npm is already installed ****\n"; } $path = "/usr/pNPM/bin:" . $ENV{PATH}; $ENV{PATH} = $path; print PNATE "\n**** Env of the npm is $ENV{PATH} ****\n"; #print `npm version` . "\n"; print PNATE "\n\U**** Install the pNPM End****\n"; print PNATE "\n**** pNATE Capturing the Enviromental variables Start****\n"; foreach $_ ( keys %ENV ) { print PNATE "$_ = $ENV{$_}\n"; } print PNATE "\n**** pNATE Capturing the Enviromental variables End ****\n"; print PNATE "\n**** Operating on pNATE File End****\n"; } print BOLD, CYAN, "\nInstalling NDATE package under $Home/NDATE folder\n\n", RESET; # if NATE exists then remove if ( ( -e "$Home/NDATE/NATE" ) ) { system('cd ~/NDATE/ && sudo rm -rf ./NATE'); } # if NACL exists then remove if ( ( -e "$Home/NDATE/HDD_LIBS/lib/NACL" ) ) { system('cd ~/NDATE/HDD_LIBS/lib/ && sudo rm -rf ./NACL'); } if ( !( -e "$Home/NDATE.tar.gz" ) ) { print BOLD, RED, "NDATE.tar.gz package file does not exist \n", RESET; oops("Kindly copy NDATE.tar.gz into $Home directry, try again.."); clean_up_pnate(); exit 0; } if ( ( -e "$Home/NDATE/HDD_LIBS" ) ) { system('cd ~/NDATE && rm -rf ./HDD_LIBS'); } if ( -d "$Home/NDATE/TEST_SCRIPTS" ) { system("sudo rm -rf $Home/NDATE/TEST_SCRIPTS/"); } print BOLD, CYAN, <<'EOD', RESET; ---------------------------------------------------------------- Would you like to Update the ERT_CONFIG file (Default Y)(y/n/help) : EOD my $result; while (1) { $result = getchompstrip( "", "", "" ); alarm $ALARM; $result = trim($result); if ( ( $result eq "y" ) || ( $result eq "Y" ) || ( $result eq "n" ) || ( $result eq "N" ) ) { last; } elsif ( $result =~ /(help|HELP|Help)/ ) { print BOLD, GREEN, <<'EOD', RESET; It will update ERT_CONFIG files . EOD } elsif ( $result =~ /^$/ ) { $result = "Y"; print BOLD, GREEN, "Default option Y is selected\nUpdating the ERT_CONFIG file\n", RESET; last; } else { oops "Please enter correct value y/n/help"; } } my $flag_ert = 0; if ( $result =~ /^(N|n)/ ) { if ( -e "$Home/NDATE/ERT_CONFIG" ) { $flag_ert = 1; # print " copying the ERT_CONFIG file to home \n"; system("cd ~/NDATE && sudo cp -rf ./ERT_CONFIG $Home"); } } system('cd $Home && tar -xzf NDATE.tar.gz'); if ( $flag_ert == 1 ) { system("cd ~/NDATE && sudo mv -f $Home/ERT_CONFIG ."); } if ( !( -e "$Home/NDATE/FILER_INFO" ) ) { system('cd ~/NDATE && mkdir FILER_INFO'); } if ( !( -e "$Home/NDATE/TEST_LISTS" ) ) { system('cd ~/NDATE && mkdir TEST_LISTS'); } # if exists then remove if ( ( -e "$Home/NDATE/NATE" ) ) { #system('cd ~/NDATE/NATE && rm -rfv ./bin ./html ./lib ./thpl ./validate ./cgi-bin ./Changes ./doc ./GNUmakefile'); system('cd ~/NDATE/ && sudo rm -rf ./NATE'); } # if exists then remove if ( ( -e "$Home/NDATE/HDD_LIBS/lib/NACL" ) ) { system('cd ~/NDATE/HDD_LIBS/lib/ && sudo rm -rf ./NACL'); } print PNATE `ls -l ~/NDATE`, "\n"; #print PNATE "\n**** Operating on $Home/archives end ****\n\n"; # if exists then remove if ( ( -e "$Home/NDATE/HDD_LIBS" ) ) { # Uncomment it later #system('cd ~/NDATE && rm -rf HDD_LIBS'); } # if exists then remove if ( ( -e "$Home/NDATE/STAF" ) ) { system('cd ~/NDATE/ && sudo rm -rf ./STAF'); } ## Create the dirs in NDATE for pNATE #$! = ''; if ( !( -e "$Home/NDATE/pnate" ) ) { mkdir("$Home/NDATE/pnate"); mkdir("$Home/NDATE/pSTAF"); } if ( !( -e "$Home/NDATE/NATE" ) ) { mkdir("$Home/NDATE/NATE"); } if ( !( -e "$Home/NDATE/HDD_LIBS/lib/NACL" ) ) { mkdir("$Home/NDATE/HDD_LIBS/lib/NACL"); } #mkdir("$Home/NDATE/pSTB"); $! = ''; =head if ($!) { print BOLD, RED "Not able create the dirs pnate and pstaf at $Home/NDATE, check permissions", RESET; print BOLD, RED "Error code: $!", RESET; clean_up_pnate(); oops("\UTry immediately option 4 from main menu.Still if you are facing issues kindly try the option 8 from main-menu"); return 0; } =cut chdir("$Home"); # Invoking the install_pnate eval { $? = ''; if ( $PNATE_Upgrade == 1 ) { ##Setting the paths once again $path = "/usr/pNPM/bin:" . $ENV{PATH}; $path = $PERL_PATH . ":" . $path; $ENV{PATH} = $path; uninstall_pnate(); print BOLD, CYAN, "\nInstallation of PNATE is under progress.It will takes nearly 5 minutes of time.\nIf the installation process prompts for user-inputs, press return to continue.\n\n", RESET; system("sudo chmod 777 /usr"); system("npm install -force -nointeractive -prefix=/usr/PNATE $pnate_pkg"); system("sudo chmod 777 /usr/PNATE"); } ##copy the files system("sudo cp -rf /usr/PNATE/staf/* $Home/NDATE/pSTAF"); system("sudo cp -rf /usr/PNATE/nate/* $Home/NDATE/NATE"); system("sudo cp -rf /usr/PNATE/pnate/* $Home/NDATE/pnate"); #system("sudo cp -rf /usr/PNATE/nacl_lib/NACL/* $Home/NDATE/HDD_LIBS/lib/NACL"); #system("sudo cp -rf /usr/PNATE/NACL/NACL/* $Home/NDATE/HDD_LIBS/lib/NACL"); #system("sudo chown -R $user $Home/NDATE/pSTAF $Home/NDATE/NATE $Home/NDATE/pnate"); system("sudo chmod 755 -R $Home/NDATE/pSTAF $Home/NDATE/NATE $Home/NDATE/pnate"); if ($?) { print BOLD, RED, "ERROR: Not able to install NDATE properly- '$!'", RESET; oops("Try immediately option 4 from main menu.Still if you are facing issues kindly try the option 8 from main-menu"); clean_up_pnate(); return 0; } }; if ($@) { print BOLD, RED, "Not able to install NDATE properly, '$@'\n", RESET; oops("Try immediately option 4 from main menu.Still if you are facing issues kindly try the option 8 from main-menu"); clean_up_pnate(); return (0); } ####################################################### =head # Set the /home/user/.ntest file if (-e "$Home/.ntest") { # REad the file #open (NTEST, "$Home/.ntest") || die "Not able to open $Home"; open (NTEST, "$Home/.ntest"); @ntest = ; $ntest[0] .= "\n\n #Set the ntest path\n -s $Home/NDATE/.ntest\n\n"; close(NTEST); # Write the file open (NTEST, ">$Home/.ntest") || die "Not able to open $Home"; print NTEST @ntest; close(NTEST); } ####################################################### # Copy the pnate .ntest file my $cp = copy("$Home/ntest_pnate", "$Home/NDATE/.ntest"); if ($cp == 1) { print PNATE "\nCopied From $Home/ntest_pnate to $Home/NDATE/.ntest\n"; } else { print PNATE "\nNDATE_PNATE_INSTAL=FAIL\n"; #IMP do not modify this close(PNATE); oops("Try again, Fail to copy startup file .ntest"); die "Oops, Fail to copy"; } =cut system("sudo chmod -R 777 $Home/NDATE/NATE"); print PNATE "\nNATE libs has given full permissions\n"; print PNATE "#################################NDATE PERMISS START#####\n"; print PNATE `ls -l $Home/NDATE`; print PNATE "#################################NDATE PERMISS END#####\n"; print PNATE "\n"; print PNATE "\nNDATE_PNATE_INSTAL=SUCCESS\n"; #IMP do not modify this close(PNATE); $\ = ""; #dashboard(); if ( ( -e "$Home/NDATE/NATE/bin" ) && ( -e "$Home/NDATE/pnate/bin" ) && ( -e "$Home/NDATE/pSTAF/bin" ) ) { print BOLD, CYAN, <<'EOD', RESET; NDATE package installed EOD sleep 3; } else { print BOLD, RED, "Not able to install, '$@'\n", RESET; oops("Try immediately option 4 from main menu.Still if you are facing issues kindly try the option 8 from main-menu"); clean_up_pnate(); return (0); } $Term::ANSIColor::AUTORESET = 0; print BOLD, CYAN, "", RESET; } ## end sub install_pnate_package() #This function shows the pNate screen to select the old NDATE or pNate sub pnate_banner() { system("clear"); print BOLD, CYAN, "\n #---------------------------------------------------------------#\n", " # #\n", " # Welcome to NetApp Drive Installation Test Environment Tool #\n", " # #\n", " # #\n", " #---------------------------------------------------------------#\n", RESET; print BOLD, CYAN, <<'EOD', RESET; Select one of the options to continue 1 - Installing NDATE package with NATE libraries 2 - Installing NDATE package using pNate To exit press "control+C" (^C) at any time. Enter 'help' for more information EOD my $result_options = ''; while (1) { $result_options = getchompstrip( "", "", "" ); alarm $ALARM; $result_options = trim($result_options); if ( ( $result_options =~ /(Q|q)/ ) ) { print "Exit from the tool\n"; exit 0; } elsif ( $result_options =~ /(HELP|help)/ ) { print BOLD, YELLOW, <<'EOD', RESET; ------------------------------------------------------------------------------ This screen allows the user to select the build using the tradional build like old and new method using pNate(Portable NetApp Test Environment). You want to build using the pNate method select the desired option. In case you want to select tradional build select the options 1. IMP: If you face any problem in the pNate build you can reselect the option 4 and select the option 1(1 - Installing NDATE package with NATE libraries) in the sub menu and continue. Or take the backup of the NDATE package and re-install and select the option 1. For the very first time, create filer configuration file, followed by test suite and execute the test suite created. To create a test suite, user needs to create filer configuration file to be included in the test suite. Filer configuration files are used to store relevant characteristics of each filer. In order to run tests we need to describe each filer in filer configuration file. Test suite is a combination of test cases and filers on which test cases to execute. Same test cases can be executed on a single or multiple filers in serial or parallel mode. Update NDATE packages, updates all NDATE package files and does not delete,update rename new files created (host configuration files, test suites, logs etc)after package installation. Please go through the README file or the release note before updating the package and take backup if you like to keep modified existing package files. Option 1 is to create the NDATE package. This creates NDATE package which is similar to old method and nate options 'l,m,w,T' are not applicable for this option. Make sure all the files NDATE_ver, NDATE.tar.gz and README present in the home directry. Option 2 is to create NDATE package using Portable Netapp Test Environment. This similar to NDATE installation. Make sure Perl 5.14* with the specified modules installed on your system.Default perl path is (/usr/software/bin). Make sure all the files NDATE_ver, NDATE.tar.gz,README and PNATE.tar.gz present in the home directry. ----------------------------------------------------------------------------- EOD } elsif ( ( $result_options =~ /^\d+$/ ) && ( ( $result_options <= 2 ) && ( $result_options >= 1 ) ) ) { last; } else { oops "Please enter correct value 1-2/help/q"; } } ## end while (1) return $result_options; } ##end of sub pnate_banner() # Execute the staff sub execute_staf() { my ( $stafconvdir, $ld_library_path, $osversion ); my ( $path, $flag ); my ( @staf, @start_up ); # Read the .ntest open( STAR, "$Home/NDATE/.ntest" ) || die "Not able to read the startup file at $Home/NDATE/.ntest"; @start_up = ; close(STAR); #if (-d "$Home/archives/install/bin") { ##old pnate support if ( -d "$Home/NDATE/pnate/bin" ) { $osversion = `$Home/NDATE/pnate/bin/sfwmnt`; $osversion = trim($osversion); =head if ($osversion =~ /Unrecognized OS/i) { oops("Not able to install NDATE completely..!!"); oops($osversion); oops("Contact: enghelp\@netapp.com"); oops( "\UPlease try from the option '4 - Update NDATE package' immeadiately." ); clean_up_pnate(); return 0; } ## end if ($osversion =~ /Unrecognized OS/i) =cut } else { #oops("Directry $Home/archives/install/bin missing .."); oops("Directry $Home/NDATE/pnate/bin missing .."); #oops( # "Please provide the pnate path as $Home/NDATE/pnate while installing." #); oops("Please try from the option '4 - Update NDATE package' immediately.Still if you are unable to install please try option 8 from main-menu"); clean_up_pnate(); return 0; } ## end else [ if (-d "$Home/NDATE/pnate/bin") # Req for old pNATE installation #opendir(READDIR, "$Home/NDATE/pSTAF/$osversion") || die "Not able to open the directry $Home/NDATE/pSTAF/$osversion"; opendir( READDIR, "$Home/NDATE/pSTAF" ) || die "Not able to open the directry $Home/NDATE/pSTAF"; @staf = readdir(READDIR); foreach $_ (@staf) { $_ = trim($_); #if ($_ =~ /staf\-/){ # Req for old pnate install if ( $_ =~ /startST/ ) { #$path = "$Home/NDATE/pSTAF/" ."$_";# Req for old pnate install #$path = "$Home/NDATE/pSTAF"; $path = "/usr/PNATE/staf"; $stafconvdir = "$path/codepage"; $ld_library_path = "$path/lib"; #echo("STAFCONVDIR=$stafconvdir"); #echo("LD_LIBRARY_PATH=$ld_library_path"); #`export STAFCONVDIR=$stafconvdir`; #`export LD_LIBRARY_PATH=$ld_library_path`; $ENV{STAFCONVDIR} = $stafconvdir; $ENV{LD_LIBRARY_PATH} = $ld_library_path; #chmod (0711, "$Home/NDATE/NATE/start_STAF.pl"); $! = ''; system("sudo $Home/NDATE/pnate/bin/start_STAF.pl --path $path"); closedir(READDIR); if ($!) { oops(" '$!' - Not able to run the STAFF, please install from NDATE try again"); oops("Kindly select option '1 - Installing NDATE package with NATE libraries' after selecting the option 4 from main menu."); clean_up_pnate(); return 0; } ## end if ($!) last; } ## end if ($_ =~ /startST/) } ## end foreach $_ (@staf) closedir(READDIR); $flag = 0; if ( defined($stafconvdir) && defined($path) ) { foreach $_ (@start_up) { next if ( $_ =~ /^\#/ ); if ( $_ =~ /STAF_DIR_UNIX/ ) { $_ = "STAF_DIR_UNIX=$path\n"; $flag++; next; } if ( $_ =~ /STAFCONVDIR/ ) { $_ = "STAFCONVDIR=$stafconvdir\n"; $flag++; next; } last if ( $flag == 2 ); } ## end foreach $_ (@start_up) if ( $flag == 2 ) { open( STAR, ">$Home/NDATE/.ntest" ); print STAR @start_up; close STAR; } else { oops("File $Home/NDATE/.ntest not able to modify"); oops("Fail to set the STAF path -- Please provide the correct path while installing the pnate."); oops("Kindly select option '1 - Installing NDATE package with NATE libraries' after selecting the option 4 from main menu."); clean_up_pnate(); return 0; #exit(0); } ## end else [ if ($flag == 2) } else { oops("File $Home/NDATE/.ntest not able to modify"); oops("Kindly select option '1 - Installing NDATE package with NATE libraries' after selecting the option 4 from main menu."); clean_up_pnate(); return 0; #exit(0); } ## end else [ if (defined($stafconvdir... $flag = ''; } ## end sub execute_staf() #This function cleans all the pNATE files if pNATE fails to install. sub clean_up_pnate() { copy( "$Home/.pnate_ndate_debug", ".refer_pnate_ndate_debug" ); system("rm -rf $Home/bin"); system("rm -rf $Home/lib"); system("rm -rf $Home/control"); system("rm -rf $Home/NPM_Dependencies.data"); system("rm -rf $Home/NPM_Dependencies.data.log"); system("rm -rf $Home/project.info"); system("rm -rf $Home/psetup"); system("rm -rf $Home/requires"); system("rm -rf $Home/SharedTestBed-1567963"); $! = ''; unlink("$Home/.pnate_ndate_debug"); #npm system("sudo rm -rf $Home/pNPM"); system("sudo rm -rf $Home/install_npm"); system("sudo rm -rf $Home/NDATE/pSTAF"); system("sudo rm -rf $Home/NDATE/pnate"); system("sudo rm -rf $Home/NDATE/NATE"); ##PNATE files system("sudo rm -rf $Home/ndate_pnate-1.3.npm"); #system("sudo rm -rf $Home/NDATE-2.0.npm"); system("sudo rm -rf $Home/npm-1.0.2.zip"); system("sudo rm -rf $Home/All_Dependencies.data"); system("sudo rm -rf $Home/Tests_Dependencies.data"); system("sudo rm -rf $Home/.pnate_conf"); system("sudo rm -rf $Home/.pnate_conf.pl"); system("sudo rm -rf $Home/Extra_Mods_pnate_203.data"); } ##end of sub clean_up_pnate() # This function switch offs the validation of pNATE messages sub switch_off_valid() { my $perlpath; open( WRT, ">$Home/.pnate_conf" ) || warn("Not able to open the file"); print WRT "#!/bin/bash # Copyright (c) 2009-2010 NetApp, Inc., All Rights Reserved. # Any use, modification, or distribution is prohibited # without prior written consent from NetApp, Inc.\n\n"; $perlpath = `which perl`; $perlpath = trim($perlpath); print WRT "_PERL='$perlpath'\n"; print WRT "_Validate_prompt='n'\n"; close(WRT); # Change the permissions chmod( 0711, "$Home/.pnate_conf" ); return 0; } ## end sub switch_off_valid() sub run_stand_alone() { my ( @command, $parameter, $rand_script, $fragment, $cmdd, $suitename, $last_ch ); my $back = 0; opendir( RDOMLIST, "$Home/NDATE/TEST_LISTS" ); my @RDOM_LIST = readdir(RDOMLIST); close(RDOMLIST); my @prerandsuites = (); foreach my $file (@RDOM_LIST) { if ( $file =~ /^RANDOM_/ ) { push( @prerandsuites, $file ); } } if ( $#prerandsuites != -1 ) { print BOLD, CYAN, "\n Following tests are available, created from stand-alone scripts which are not part of NDATE:\n", RESET; foreach (@prerandsuites) { print BOLD, GREEN, " $_\n", RESET; } print BOLD, CYAN, "\n Would you like to execute any of the above tests. Enter y/n : ", BOLD, "\( To go back press 'b' \)", RESET; print BOLD, CYAN, "\n Default is 'y'", RESET; while (1) { $last_ch = getchompstrip( "", "", "" ); chomp($last_ch); if ( $last_ch eq '' ) { $last_ch = 'y'; } if ( ( $last_ch ne "yes" ) && ( $last_ch ne "no" ) && ( $last_ch ne "y" ) && ( $last_ch ne "Y" ) && ( $last_ch ne "n" ) && ( $last_ch ne "N" ) && ( $last_ch ne /^$/ ) ) { print BOLD, RED, "\n Incorrect entry. Please enter y/n: ", RESET; } elsif ( $last_ch =~ /^(b|B)$/ ) { $back = 1; next; } else { stand_alone_name: my $select_test; my $found = 0; if ( ( $last_ch eq "y" ) || ( $last_ch eq "yes" ) ) { print BOLD, CYAN, "\n Enter the name of the test suite you would like to execute: ", RESET; $select_test = getchompstrip( "", "", "" ); chomp($select_test); while (1) { foreach (@prerandsuites) { if ( $_ eq "$select_test" ) { $found = 1; last; } } if ( $found == 0 ) { print BOLD, RED, "\n ERROR: Test Suite not found in the list. Please enter again: ", RESET; goto stand_alone_name; } else { last; } } ## end while (1) open( TESTCM, "$Home/NDATE/TEST_LISTS/$select_test" ); my @arr_file_ran = (); $cmdd = $arr_file_ran[0]; close(TESTCM); } ## end if (($last_ch eq "y") ... last; } ## end else [ if (($last_ch ne "yes"... } ## end while (1) } ## end if ($#prerandsuites !=... if ( ( $#prerandsuites == -1 ) || ( $last_ch eq "n" ) || ( $last_ch eq "N" ) || ( $last_ch eq "no" ) || ( $last_ch =~ /^$/ ) ) { print BOLD, CYAN, "\n Enter the name of the test suite you would like to create and execute:", YELLOW, BOLD, "\n\t\(To go back press 'b'\)", RESET; $suitename = getchompstrip( "", "", "" ); chomp($suitename); if ( $suitename =~ /^(b|B)$/ ) { $back = 1; last; } print BOLD, CYAN, "\n Enter the script which you would like to execute. Please enter the absolute path.", RESET; print "\n For example: /u/vickie/dev/vespa/expander_reboot_loops/cli_expander_reboot.thpl."; print "\n"; while (1) { $rand_script = getchompstrip( "", "", "" ); chomp($rand_script); if ( -e "$rand_script" ) { #Reading the script to fetch the parameters push( @command, "$Home/NDATE/NATE/bin/ntest" ); push( @command, "-hw -console" ); last; } else { print BOLD, RED, "\n Cannot open the above script. Please verify and enter again:\n ", RESET; } } ## end while (1) open( SCRIPT, "$rand_script" ) || die "Cannot open the file $rand_script: $!"; my @script_contents = (