#!/bin/bash echo "
" echo "PYTHONPATH=$PYTHONPATH" echo "" echo "
" echo "" if [ $EXIT_STATUS -ne 0 ]; then echo "ERROR: LfnToPfnFromTfc.py script failed: $EXIT_STATUS" export X509_USER_PROXY=$savedProxy exit $SAME_ERROR else if [ -f $SAME_SENSOR_WORK/nodes/$nodeName/$pfnFilename ]; then if [ ! -f $SAME_SENSOR_WORK/nodes/$nodeName/list_$pfnFilename ]; then echo "" echo "USER/WHOAMI?:" $USER/`whoami` echo "USER ID:" $uid echo "X509_USER_PROXY:" $X509_USER_PROXY voms-proxy-info -debug -all env|grep -i proxy env|grep /tmp echo "
" echo echo " temporarly remove lcgadim role" tproxy=`mktemp` ls -l $tproxy echo X509_USER_PROXY=$X509_USER_PROXY savedProxy=$X509_USER_PROXY echo savedProxy=$savedProxy which voms-proxy-init echo "seem I cannot do: voms-proxy-init -voms cms -cert $X509_USER_PROXY -out $tproxy" cp -v $$X509_USER_PROXY $tproxy ls -l $tproxy voms-proxy-info -all -path $tproxy export X509_USER_PROXY=$tproxy voms-proxy-info -all -path exit $SAME_INFO echo "===========================================================" nodeName=$1 testLFN="/store/temp/user/test" pfnFilename="userpfn.txt" cd $SAME_SENSOR_HOME/tests if [ $? -ne 0 ]; then echo "ERROR: Could not access the tests directory" exit $SAME_ERROR else chmod u+x LfnToPfnFromTfc.py ./LfnToPfnFromTfc.py $nodeName $testLFN $pfnFilename | tee $SAME_SENSOR_WORK/nodes/$nodeName/LfnToPfnFromTfc.out EXIT_STATUS=$? fi echo "
" echo "WARNING: Retrieval of PFN from TFC webservice failed; cached PFN will be used" echo "" fi echo "
" echo "TFC Test successful" echo "" grep -w $nodeName $SAME_SENSOR_WORK/nodes/$nodeName/$pfnFilename > /dev/null MATCH_RESULT=$? if [ $MATCH_RESULT -ne 0 ]; then echo "
" echo "SRM endpoint in TFC does not match $nodeName" echo "" fi cat $SAME_SENSOR_WORK/nodes/$nodeName/$pfnFilename | cut -d "?" -f1 > $SAME_SENSOR_WORK/nodes/$nodeName/endpoint.txt storagepath=`cat $SAME_SENSOR_WORK/nodes/$nodeName/$pfnFilename | cut -d= -f2- | cut -d " " -f1` token=`cat $SAME_SENSOR_WORK/nodes/$nodeName/$pfnFilename | cut -d " " -f3` echo $storagepath > $SAME_SENSOR_WORK/nodes/$nodeName/userpath.txt echo "GlueVOInfoPath: "$storagepath" GlueVOInfoTag: "$token" GlueChunkKey: usertokenfromtfc" > $SAME_SENSOR_WORK/nodes/$nodeName/usertoken.txt else echo "
" echo "TFC not found or rule for SRM non found in TFC" echo "
" export X509_USER_PROXY=$savedProxy exit $SAME_ERROR fi fi # loading lcg_util164 libraries #LD_LIBRARY_PATH=$HOME/bin/external/usr/lib:$HOME/bin/lcg_utils164+gfal1105/lib:$LD_LIBRARY_PATH cdate=`date '+%Y%m%d-%H%M%S'` if [ ! -f $SAME_SENSOR_WORK/nodes/$nodeName/endpoint.txt ] ; then echo "" echo "Full SRMv2 endpoint not provided" echo "
" export X509_USER_PROXY=$savedProxy exit $SAME_WARNING else echo "Testing SRMv2 endpoint " srmv2=`cat $SAME_SENSOR_WORK/nodes/$nodeName/endpoint.txt` echo $srmv2 fi echo "" echo "Using lcg-utils version:" echo "
" echo "
" set -x which lcg-cp lcg-cp --version set +x echo "" VO=$SAME_VO echo "
" echo "Testing storage space in path:" echo "
" echo "" echo $line echo "" SURL=$srmv2?SFN=$line/lcg-util/testfile-user-${cdate}.txt #SURL=$srmv2?SFN=$line/oneEvt.root echo "
" echo "The SURL used for testing will be:" echo "
" echo "" echo $SURL echo "" echo "
" echo "
" set -x lcg-cp -b --vo ${VO} -D srmv2 -U srmv2 -v file:$SAME_SENSOR_WORK/testFile.txt ${SURL} 1>$SAME_SENSOR_WORK/nodes/$nodeName/SRMv2-lcg-user-put-output 2>$SAME_SENSOR_WORK/nodes/$nodeName/SRMv2-lcg-user-put-stderr #copyresult=${PIPESTATUS[0]} copyresult=$? set +x cat $SAME_SENSOR_WORK/nodes/$nodeName/SRMv2-lcg-user-put-output | sed 's/\&/\&/g' | sed 's/\</g' | sed 's/>/\>/g' cat $SAME_SENSOR_WORK/nodes/$nodeName/SRMv2-lcg-user-put-stderr | sed 's/\&/\&/g' | sed 's/\</g' | sed 's/>/\>/g' #lcg-cp -b --vo ${VO} -D srmv2 -U srmv2 -v file:/afs/cern.ch/user/b/belforte/scratch0/oneEvt.root ${SURL} result=$copyresult set +x echo "" if [ $result -ne 0 ] ; then echo "
" echo "ERROR: File ${SURL} not copied" echo "
" else echo "" echo "File ${SURL} copied successfully" echo "
" echo "" set -x lcg-del -v -b -l -D srmv2 -T srmv2 --vo ${VO} ${SURL} dresult=$? set +x echo "" if [ $dresult != 0 ] ; then echo "
" echo "ERROR: File ${SURL} not deleted" echo "
" echo "" echo "Exit status: $dresult" echo "
" else echo "" echo "File ${SURL} deleted successfully" echo "
" fi fi if [ $result != 0 ] || [ $dresult != 0 ] ; then echo 1 > $SAME_SENSOR_WORK/nodes/$nodeName/SRM-user.error else echo "" echo "Default path " echo $line echo " tested successfully" echo "
" fi done else echo "" echo "WARNING: Default path not defined" echo "
" echo 1 > $SAME_SENSOR_WORK/nodes/$nodeName/SRM-user.error fi export X509_USER_PROXY=$savedProxy if [ -f $SAME_SENSOR_WORK/nodes/$nodeName/SRM-user.error ] ; then # exit $SAME_ERROR exit $SAME_WARNING elif [ -f $SAME_SENSOR_WORK/nodes/$nodeName/SRM-user.error ] ; then exit $SAME_OK else exit $SAME_OK fi