Certification Job template

From EGIWiki
Jump to: navigation, search
Main EGI.eu operations services Support Documentation Tools Activities Performance Technology Catch-all Services Resource Allocation Security


Documentation menu: Home Manuals Procedures Training Other Contact For: VO managers Administrators


Certification Job

cert_job.jdl

 Executable="cert_job.sh";
 
 ## Please put your VO as Argument
 Arguments="dteam";
 
 StdOutput="report.txt";
 StdError="report.txt";
 
 InputSandbox={"cert_job.sh"};
 OutputSandbox={"report.txt"};
 RetryCount = 0;

cert_job.sh

 #!/bin/bash
 # 2005-04-26 created by Paolo Veronesi
 # 2010-11-03 modified by Alessandro Paolini
 SE_REP1=sunstorm.cnaf.infn.it
 SE_REP2=prod-se-01.pd.infn.it
 #SE_REP3=castorgrid.cern.ch
 
 #Certification BDII
 BDII=gridit-bdii-01.cnaf.infn.it:2170
 #Production BDII
 BDII2=egee-bdii.cnaf.infn.it:2170
 #####################################################################################################################
 ## CHECK ARGUMENT
 #####################################################################################################################
 if [ -z $1 ] ; then
         VO=infngrid
 else
         VO=$1
 fi
 export LFC_HOME=/grid/$VO 
 #####################################################################################################################
 ## LOCAL FUNCTIONS
 #####################################################################################################################
 new_date () 
 {
 
    YEAR=`date +%Y`
    MONTH=`date +%m`
    DAY=`date +%d`
    HOUR=`date +%H:%M`
 }
 ##############################
 
 start_report ()
 {
 new_date
 DATE=$YEAR-$MONTH-$DAY_$HOUR
 WNNAME=`hostname`
 USER=`whoami`
 
 echo "Site test report" 
 echo "WN: $HOSTNAME" 
 echo "Date: $DATE" 
 echo "Remote account: $USER"
 echo "VO: $VO" 
 echo "SE1 for Replica: $SE_REP1" 
 echo "SE2 for Replica: $SE_REP2" 
 echo "BDII for test: $BDII"
 }
 ###############################
 
 end_report ()
 {
 new_date
 DATE=$YEAR-$MONTH-$DAY_$HOUR
 TEST="Ended to run the certification on site: $1 at date $DATE"
 echo "$TEST"
 }
 ################################
 
 visual ()
 {
 if [ $STATUS -ne 0 ]; then
 	if [[ $TEST == *$SE_REP1 ]]; then
 		STATO=WARNING
 	else
 		STATO=ERROR
 	fi
 else
 	STATO=OK
 fi
 echo "*"
 echo "* TEST=$TEST, STATUS=$STATO"
 echo "*"
 }
 ################################################
 
 list_LCG_replica ()
 {
 echo "----------------------------------------"
 echo "LCG List Replica for $1"
 echo ""
 lcg-lr --vo $VO lfn:$1
 STATUS=$?
 echo "----------------------------------------"
 echo ""
 }
 #####################################################################################################################
 
 ##############################################################################################################################
 ## BASE TEST
 ##############################################################################################################################
 
 base()
 
 {
 TEST=BASE
 CONTINUE=1
 echo "******************************************************************************************"
 echo "* Check services used during the test *"
 echo "******************************************************************************************"
 echo
 echo "------------------------------------------------------------------------------------------"
 echo "Default BDII= $LCG_GFAL_INFOSYS"
 
 
 case "$LCG_GFAL_INFOSYS" in
         "egee-bdii-01.cnaf.infn.it:2170" | "gridit-bdii-01.cnaf.infn.it:2170" ) 
                 echo "TEST ERROR: LCG_GFAL_INFOSYS should be egee-bdii.cnaf.infn.it. Other values are possible, but not egee-bdii-01 or gridit-bdii-01";;
          egee-bdii.cnaf.infn.it:2170 )
                 echo "TEST OK: LCG_GFAL_INFOSYS=$LCG_GFAL_INFOSYS";;
           *   ) 
 		echo "TEST WARNING: LCG_GFAL_INFOSYS=$LCG_GFAL_INFOSYS, why not egee-bdii.cnaf.infn.it ?";;
 esac
 
 
 
 echo "Can we see the default information system?"
 
 set -x
 lcg-infosites --vo $VO all
 STATUS=$?
 set +x
 
 if [ $STATUS == 0 ]; then
 	CONTINUE=0
 else
     CONTINUE=1
 fi
 
 visual
 echo
 echo "------------------------------------------------------------------------------------------"
 echo "Can we see the SE=$SE_REP1?"
 set -x
 #/opt/edg/bin/edg-gridftp-ls --verbose gsiftp://$SE_REP1/ > /dev/null
 #/opt/lcg/bin/rfdir $SE_REP1:/ > /dev/null
 /opt/globus/bin/uberftp $SE_REP1 > /dev/null
 STATUS=$?
 set +x
 
 if [ $STATUS == 0 ]; then
 	GOODSE=$SE_REP1    
      echo "STATUS=OK, GOODSE=$GOODSE"
 else
     echo "WARNING: Can not see the SE=$SE_REP1, try to see SE=SE_REP2" 
     set -x
     #/opt/edg/bin/edg-gridftp-ls --verbose gsiftp://$SE_REP2/ > /dev/null
     #/opt/lcg/bin/rfdir $SE_REP2:/ > /dev/null
     /opt/globus/bin/uberftp $SE_REP2 > /dev/null
     STATUS=$?
     set +x
     if [ $STATUS == 0 ]; then
 	GOODSE=$SE_REP2    
         echo "STATUS=OK, GOODSE=$GOODSE"
     else
         echo "ERROR: Can not see the SE=$SE_REP2, DATA MANAGEMENT TEST will be skipped!" 
         GOODSE=NONE
         CONTINUE=1
     fi
 fi
 
 if [ $CONTINUE == 1 ]; then
      echo "******************************************************************************************"
      echo "* ERROR: Base test fails, certification aborted! *"
      echo "******************************************************************************************"
 else
      echo "******************************************************************************************"
      echo "* Base test passed succesfully! *"
      echo "******************************************************************************************"
 fi
 }
 
 check_rpm ()
 {
 echo "******************************************************************************************"
 echo "* RPMs and CA list *"
 echo "******************************************************************************************"
 echo
 echo "------------------------------------------------------------------------------------------"
 TEST="Check RPMs"
 
 set -x
 rpm -qa|sort 
 STATUS=$?
 set +x
 visual 
 
 TEST="CA rpm list - check the current on http://lcgdeploy.cvs.cern.ch/cgi-bin/lcgdeploy.cgi/lcg2/rpmlist/security-rpm.h "
 set -x
 rpm -qa|grep "^ca" |sort
 STATUS=$?
 set +x
 visual
 
 }
 ##################################################
 
 check_bash ()
 {
 echo "******************************************************************************************"
 echo "* Check BASH env *"
 echo "******************************************************************************************"
 echo
 echo "------------------------------------------------------------------------------------------"
 TEST="Check BASH"
 
 set -x
 env |sort
 STATUS=$?
 set +x
 
 visual
 
 echo
 echo "------------------------------------------------------------------------------------------"
 TEST="Check software paths for the experiments"
 echo "$TEST"  
 echo
 echo "------------------------------------------------------------------------------------------"
 set -x
 env|sort |grep _SW_DIR 
 STATUS=$?
 set +x
 visual 
 
 echo
 echo "------------------------------------------------------------------------------------------"
 TEST="Setting CLOSE_SE for VO=$VO"
 echo "$TEST"
 echo
 echo "------------------------------------------------------------------------------------------"
 set -x
 CLOSE_SE=`env |grep -i  $VO |grep _DEFAULT_SE | head -1 |awk -F= '{print $2}'`
 STATUS=$?
 set +x
 echo "===> CLOSE_SE=$CLOSE_SE"
 
 
 if [ $CLOSE_SE == $GOODSE ]; then
         GOODSE=grid2.fe.infn.it
         echo "===> GOODESE changed to $GOODSE"
 fi
 
  
 visual
 
 
 }
 ###################################################
 
 check_mount ()
 {
 echo "******************************************************************************************"
 echo "* Check mountpoints on WN *"
 echo "******************************************************************************************"
 echo
 echo "------------------------------------------------------------------------------------------"
 
 TEST="Check mountpoints on WN"
 echo "$TEST"
 set -x
 mount 
 STATUS=$?
 set +x
 
 visual
 echo
 echo "------------------------------------------------------------------------------------------"
 
 TEST="Check disk status"
 echo "$TEST"
 set -x
 df -m 
 STATUS=$?
 set +x
 visual
 
 }
 
 ############################################################
 #	DATA MANAGEMENT USING LCG COMMAND		   #
 ############################################################
 
 list_LCG_replica ()
 {
 echo "--------------------------------------"
 echo "LCG List Replica for file=$1"
 echo "--------------------------------------"
 
 set -x
 lcg-lr --vo $VO lfn:$1 
 STATUS=$?
 set +x
 
 if [[ $TEST == *entries ]]; then
         if [ $STATUS -ne 0 ]; then
                 STATUS=0
         else
                 STATUS=1
         fi
 fi
 
 visual
 echo ""
 echo "--------------------------------------"
 echo ""
 }
 ###########################################################
 
 lcg_set_bdii ()
 {
 echo "******************************************************************************************"
 echo "* Setting default BDII=$BDII *"
 echo "******************************************************************************************"
 echo
 echo "------------------------------------------------------------------------------------------"
 set -x
 export LCG_GFAL_INFOSYS=$BDII
 STATUS=$?
 env |grep LCG_GFAL_INFOSYS
 set +x
 visual
 echo
 echo "------------------------------------------------------------------------------------------"
 }
 
 #check removed
 lcg_check_SE ()
 {
 echo "******************************************************************************************"
 echo "* LCG - Can we see the default VO=$VO SE=$CLOSE_SE ?*"
 echo "******************************************************************************************"
 echo
 echo "------------------------------------------------------------------------------------------"
 
 echo "------------------------------------------------------------------------------------------"
 echo "Can we see the SE=$CLOSE_SE?"
 set -x
 edg-gridftp-ls --verbose gsiftp://$CLOSE_SE/ > /dev/null
 STATUS=$?
 set +x
 
 visual
 if [ $STATUS != 0 ]; then
         echo "ERROR: Can not see the SE=$CLOSE_SE, DATA MANAGEMENT TEST will be skipped!"
         end_report
         exit
 fi
 
 
 }
 
 
 lcg_cr ()
 {
 echo "******************************************************************************************"
 echo "* LCG Copy and Register LFC version!*"
 echo "******************************************************************************************"
 echo
 echo "------------------------------------------------------------------------------------------"
 
 echo ""
 TEST="LCG STEP 1 - Copy and Register"
 echo "$TEST"
 FILE1=lcg1_$HOSTNAME_$YEAR$MONTH$DAY-$RANDOM
 FILE2=lcg2_$HOSTNAME_$YEAR$MONTH$DAY-$RANDOM
 
 echo
 echo "------------------------------------------------------------------------------------------"
 TEST="LCG Creating file=$FILE1"
 echo "$TEST"
 echo
 echo "------------------------------------------------------------------------------------------"
 set -x
 uname -a >$FILE1
 STATUS=$?
 set +x
 
 visual $FILE1
 echo ""
 
 echo
 echo "------------------------------------------------------------------------------------------"
 TEST="LCG Creating file=$FILE2"
 echo "$TEST"
 echo
 echo "------------------------------------------------------------------------------------------"
 set -x
 uname -a >$FILE2
 STATUS=$?
 set +x
 
 visual $FILE2
 echo ""
 
 echo
 echo "------------------------------------------------------------------------------------------"
 TEST="LCG Copy & Register file=$FILE1 to CLOSE_SE=$CLOSE_SE"
 echo "$TEST"
 echo
 echo "------------------------------------------------------------------------------------------"
 set -x
 lcg-cr -v --vo $VO -d $CLOSE_SE -l lfn:$FILE1 file://`pwd`/$FILE1 
 STATUS=$?
 set +x
 visual
 echo ""
 
 echo
 echo "------------------------------------------------------------------------------------------"
 TEST="LCG Copy & Register file=$FILE2 to GOODSE=$GOODSE"
 echo "$TEST"
 echo
 echo "------------------------------------------------------------------------------------------"
 set -x
 lcg-cr -v --vo $VO -d $GOODSE -l lfn:$FILE2 file://`pwd`/$FILE2 
 STATUS=$?
 set +x
 
 visual
 
 list_LCG_replica $FILE1
 list_LCG_replica $FILE2
 }
 ############################################################
 
 lcg_rep ()
 {
 echo "******************************************************************************************"
 echo "* LCG Replicate files *"
 echo "******************************************************************************************"
 echo
 echo "------------------------------------------------------------------------------------------"
 
 echo
 echo "------------------------------------------------------------------------------------------"
 TEST="LCG Replicate file $FILE1 from CLOSE_SE=$CLOSE_SE to GOODSE=$GOODSE"
 echo "$TEST"
 set -x
 lcg-rep -v --vo $VO -d $GOODSE lfn:$FILE1 
 STATUS=$?
 set +x
 
 visual
 list_LCG_replica $FILE1
 echo ""
 
 echo
 echo "------------------------------------------------------------------------------------------"
 TEST="LCG Replicate files $FILE2 from GOODSE=$GOODSE to CLOSE_SE=$CLOSE_SE"
 echo "$TEST"
 echo
 echo "------------------------------------------------------------------------------------------"
 set -x
 lcg-rep -v --vo $VO -d $CLOSE_SE lfn:$FILE2 
 STATUS=$?
 set +x
 visual
 
 list_LCG_replica $FILE2
 echo ""
 }
 ##############################################################
 
 lcg_del ()
 {
 
 echo "******************************************************************************************"
 echo "* LCG Delete files *"
 echo "******************************************************************************************"
 echo
 echo "------------------------------------------------------------------------------------------"
 
 
 echo
 echo "------------------------------------------------------------------------------------------"
 TEST="LCG Delete and unregister file=$FILE1 from CLOSE_SE=$CLOSE_SE"
 echo "$TEST"
 echo
 echo "------------------------------------------------------------------------------------------"
 set -x
 lcg-del -v --vo $VO -s $CLOSE_SE lfn:$FILE1
 STATUS=$?
 set +x
 
 visual
 list_LCG_replica $FILE1
 
 echo
 echo "------------------------------------------------------------------------------------------"
 TEST="LCG Delete and unregister file=$FILE2 from GOODSE=$GOODSE"
 echo "$TEST"
 echo
 echo "------------------------------------------------------------------------------------------"
 set -x
 lcg-del -v --vo $VO -s $GOODSE lfn:$FILE2 
 STATUS=$?
 set +x
 visual
 list_LCG_replica $FILE2
 }
 ################################################################
 
 lcg_copyBack ()
 {
 echo "******************************************************************************************"
 echo "* LCG Copy back replicated files *"
 echo "******************************************************************************************"
 echo
 echo "------------------------------------------------------------------------------------------"
 
 echo
 echo "------------------------------------------------------------------------------------------"
 TEST="LCG Copy replica for file=$FILE1 from GOODSE=$GOODSE"
 echo "$TEST"
 echo
 echo "------------------------------------------------------------------------------------------"
 set -x
 lcg-cp -v --vo $VO lfn:$FILE1 file://`pwd`/$FILE1.rep 
 STATUS=$?
 set +x
 visual
 
 echo
 echo "------------------------------------------------------------------------------------------"
 TEST="LCG Copy replica for file=$FILE2 from CLOSE_SE=$CLOSE_SE"
 echo "$TEST"
 set -x
 lcg-cp -v --vo $VO lfn:$FILE2 file://`pwd`/$FILE2.rep 
 STATUS=$?
 set +x
 
 visual
 
 echo
 echo "------------------------------------------------------------------------------------------"
 TEST="File in current directory"
 echo "$TEST"
 set -x
 pwd 
 ls -ltr 
 STATUS=$?
 set +x
 visual
 }
 ##################################################################
 
 lcg_delete_all ()
 {
 echo "******************************************************************************************"
 echo "* LCG Delete and unregister all files *"
 echo "******************************************************************************************"
 echo
 echo "------------------------------------------------------------------------------------------"
 
 echo
 echo "------------------------------------------------------------------------------------------"
 TEST="LCG Delete and unregister all $FILE1 entries"
 echo "$TEST"
 echo
 echo "------------------------------------------------------------------------------------------"
 set -x
 lcg-del -v --vo $VO -a lfn:$FILE1
 STATUS=$?
 set +x
 visual
 
 list_LCG_replica $FILE1
 echo ""
 
 
 echo
 echo "------------------------------------------------------------------------------------------"
 TEST="LCG Delete and unregister all $FILE2 entries"
 echo "$TEST"
 echo
 echo "------------------------------------------------------------------------------------------"
 set -x
 lcg-del -v --vo $VO -a lfn:$FILE2 
 STATUS=$?
 set +x
 visual
 
 list_LCG_replica $FILE2
 echo ""
 }
 
 rgma_test ()
 {
 
 echo "******************************************************************************************"
 echo "* RGMA client test *"
 echo "******************************************************************************************"
 echo
 echo "------------------------------------------------------------------------------------------"
 TEST="RGMA client test for release 2_6_0"
 echo
 echo "------------------------------------------------------------------------------------------"
 
 set -x
 /opt/glite/bin/rgma-client-check
 STATUS=$?
 set +x
 visual
 echo
 echo "------------------------------------------------------------------------------------------"
 }
 
 
 ############################################################
 #       OTHER TEST                  #
 ############################################################
 
 #NOTE: rfdir command no more present on UI
 
 rfiod_test ()
 {
 echo "******************************************************************************************"
 echo "* RFIOD deamon test for SE *"
 echo "******************************************************************************************"
 echo
 echo "------------------------------------------------------------------------------------------"
 
 echo
 echo "------------------------------------------------------------------------------------------"
 TEST="Checking if CLOSE_SE=$CLOSE_SE is publishing rfio protocol"
 echo "$TEST"
 echo
 echo "------------------------------------------------------------------------------------------"
 set -x
 RFIO=`/opt/globus/bin/ldapsearch -x -H ldap://$CLOSE_SE:2170 -b mds-vo-name=resource,o=grid |grep GlueSEAccessProtocolType |grep rfio|awk  '{print $2}'`
 set +x
 
 if [ $RFIO == rfio ]; then
         echo "CLOSE_SE=$CLOSE_SE is publishing rfio as protocol"
 	echo
 	echo "------------------------------------------------------------------------------------------"
 	TEST="RFDIR test from WN=$WNNAME to CLOSE_SE=$CLOSE_SE"
 	echo "$TEST"
 	echo
 	echo "------------------------------------------------------------------------------------------"
 	set -x
 	/usr/bin/rfdir $CLOSE_SE:/
 	STATUS=$?
 	set +x
 	visual
 	echo ""
 else echo "CLOSE_SE=$CLOSE_SE is not publishing rfio as protocol, RFIDR test skipped!"
 fi
 }
 
 ##############################################################################################################
 ##############################################################################################################
 ## HIGH LEVEL FUNCTIONS
 ##############################################################################################################
 
 base_test ()
 {
 echo "******************************************************" 
 echo "**BASE TESTs                                        **" 
 echo "******************************************************"
 base
 check_rpm
 check_bash
 check_mount
 }
 
 lcg_data_test ()
 {
 echo "******************************************************" 
 echo "**DATA MANAGEMENT USING lcg COMMAND                 **" 
 echo "******************************************************" 
 lcg_set_bdii
 lcg_cr
 lcg_rep
 lcg_del
 lcg_copyBack
 lcg_delete_all
 }
 
 other_test ()
 {
 echo "******************************************************"
 echo "**OTHER TESTS                                       **" 
 echo "******************************************************" 
 rfiod_test
 }
 
 #############################################################################################################
 #############################################################################################################
 ##BODY
 ############################################################################################################
 start_report
 base_test
 
 if [ $CONTINUE == 0 ]; then
         lcg_data_test
 else
     end_report
     exit
 fi
 
 #rgma_test
 #other_test
 end_report