Commit b649029b authored by Nicolo Magini's avatar Nicolo Magini
Browse files

Adding SRMv2-user test

parent 7015e69e
#!/bin/bash
echo "<h2>Checking if TFC is available for SRMv2 endpoint and using it to perform lfn to pfn matching</h2>"
echo "<h3>Checking PYTHONPATH</h3>"
echo "<pre>"
echo "PYTHONPATH=$PYTHONPATH"
echo "</pre>"
echo "<h3>Invoking site test</h3>"
echo "<pre>"
echo "<h5>"
echo "USER/WHOAMI?:" $USER/`whoami`
echo "USER ID:" $uid
voms-proxy-info -all
echo "</h5>"
nodeName=$1
testLFN="/store/user/magini"
pfnFilename="userpfn.txt"
cd $SAME_HOME/sensors/SRM/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 "</pre>"
if [ $EXIT_STATUS -ne 0 ]; then
echo "ERROR: LfnToPfnFromTfc.py script failed: $EXIT_STATUS"
exit $SAME_ERROR
else
if [ -f $SAME_SENSOR_WORK/nodes/$nodeName/$pfnFilename ]; then
if [ ! -f $SAME_SENSOR_WORK/nodes/$nodeName/list_$pfnFilename ]; then
echo "<pre>"
echo "WARNING: Retrieval of PFN from TFC webservice failed; cached PFN will be used"
echo "</pre>"
fi
echo "<pre>"
echo "TFC Test successful"
echo "</pre>"
grep -w $nodeName $SAME_SENSOR_WORK/nodes/$nodeName/$pfnFilename > /dev/null
MATCH_RESULT=$?
if [ $MATCH_RESULT -ne 0 ]; then
echo "<pre>"
echo "SRM endpoint in TFC does not match $nodeName"
echo "</pre>"
fi
cat $SAME_SENSOR_WORK/nodes/$nodeName/$pfnFilename | cut -d/ -f1-3 > $SAME_SENSOR_WORK/nodes/$nodeName/endpoint.txt
storagepath=`cat $SAME_SENSOR_WORK/nodes/$nodeName/$pfnFilename | cut -d= -f2-`
token=CMS_DEFAULT
echo $storagepath > $SAME_SENSOR_WORK/nodes/$nodeName/userpath.txt
echo "GlueVOInfoPath: "$storagepath" GlueVOInfoTag: "$token" GlueChunkKey: cmsdefaultspacetoken" > $SAME_SENSOR_WORK/nodes/$nodeName/usertoken.txt
else
echo "<p>"
echo "TFC not found or rule for SRM non found in TFC"
echo "</p>"
exit $SAME_ERROR
fi
fi
# loading lcg_util164 libraries
LD_LIBRARY_PATH=$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 "<p>"
echo "Full SRMv2 endpoint not provided"
echo "</p>"
exit $SAME_WARNING
else
echo "Testing SRMv2 endpoint "
port=`cat $SAME_SENSOR_WORK/nodes/$nodeName/endpoint.txt | cut -d : -f3 | cut -d / -f1`
srmv2=srm://$nodeName:$port/srm/managerv2
echo $srmv2
fi
VO=$SAME_VO
echo "<h2>"
echo "Testing storage area without specifying space tokens"
echo "</h2>"
if [ -f $SAME_SENSOR_WORK/nodes/$nodeName/userpath.txt ] ; then
cat $SAME_SENSOR_WORK/nodes/$nodeName/userpath.txt | while read line
do
echo "<p>"
echo "Testing storage space in path:"
echo "</p>"
echo "<pre>"
echo $line
echo "</pre>"
SURL=$srmv2?SFN=$line/lcg-util/testfile-user-${cdate}.txt
#SURL=$srmv2?SFN=$line/oneEvt.root
echo "<p>"
echo "The SURL used for testing will be:"
echo "</p>"
echo "<pre>"
echo $SURL
echo "</pre>"
echo "<p>"
echo "<pre>"
set -x
$HOME/bin/lcg_utils164+gfal1105/bin/lcg-cp -b --vo ${VO} -D srmv2 -U srmv2 -v file:$SAME_SENSOR_WORK/testFile.txt ${SURL}
#$HOME/bin/lcg_utils164+gfal1105/bin/lcg-cp -b --vo ${VO} -D srmv2 -U srmv2 -v file:/afs/cern.ch/user/b/belforte/scratch0/oneEvt.root ${SURL}
result=$?
set +x
echo "</pre>"
if [ $result -ne 0 ] ; then
echo "<p>"
echo "ERROR: File ${SURL} not copied"
echo "</p>"
else
echo "<p>"
echo "File ${SURL} copied successfully"
echo "</p>"
echo "<pre>"
set -x
$HOME/bin/lcg_utils164+gfal1105/bin/lcg-del -v -b -D srmv2 -T srmv2 --vo ${VO} ${SURL}
dresult=$?
set +x
echo "</pre>"
if [ $dresult != 0 ] ; then
echo "<p>"
echo "ERROR: File ${SURL} not deleted"
echo "</p>"
echo "<p>"
echo "Exit status: $dresult"
echo "</p>"
else
echo "<p>"
echo "File ${SURL} deleted successfully"
echo "</p>"
fi
fi
if [ $result != 0 ] || [ $dresult != 0 ] ; then
echo 1 > $SAME_SENSOR_WORK/nodes/$nodeName/SRM-user.error
else
echo "<p>"
echo "Default path "
echo $line
echo " tested successfully"
echo "</p>"
fi
done
else
echo "<p>"
echo "WARNING: Default path not defined"
echo "</p>"
echo 1 > $SAME_SENSOR_WORK/nodes/$nodeName/SRM-user.error
fi
if [ -f $SAME_SENSOR_WORK/nodes/$nodeName/SRM-user.error ] ; then
exit $SAME_ERROR
elif [ -f $SAME_SENSOR_WORK/nodes/$nodeName/SRM-user.error ] ; then
exit $SAME_OK
else
exit $SAME_OK
fi
\ No newline at end of file
testName: SRMv2-user
testAbbr: user
testTitle: This test copies a local file to the SRM in the user storage area
testHelp: https://twiki.cern.ch/twiki/bin/view/CMS/SAMSRMv2User
EOT
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment