Commit 211c54e7 authored by U-PALLAS\theron's avatar U-PALLAS\theron
Browse files

Version avec separation des traitements

parent 053c4f40
#!/bin/sh
## Apple de l'API VITAM ingest par un GET
#### Exemple de identifiants qui marchent "
## aeeaaaaaacfdatmhaaiaoalzbzcdiryaaaaq
## aeeaaaaaacfdatmhaaiaoalzckt3rtaaaaaq
### Lancement: GET.sh [RequestId] [objet]
## Exemple: GET.sh aeeaaaaaacfdatmhaaiaoalzbzcdiryaaaaq archivetransferreply
## Exemple: GET.sh aeeaaaaaacfdatmhaaiaoalzbzcdiryaaaaq manifests
# *************** VARIABLES *********************
# path des commandes curl POST et GET
path_curl="."; #echo "$path_curl";
# path_curl="/home/theron"
# path_curl="/home/atheron/VITAM" (path sur pctadad admin)
# url des API Vitam:
# url="https://10.6.10.34:8443"
# url="https://pp-vit-acc-1-1.cines.fr:8444"
#Fichier pem du certificat:
# certificat=`cat cines_certificat.pem`
# certificat=`cat ./cert/cines_certificat.prod.pem`
# certificat=`cat uga_certificat_prod.pem`
# *************** VARIABLES *********************
#curl -X GET -k -H 'X-Tenant-Id: 0' -H 'Content-Type: application/octet-stream' -H 'X-Access-Contract-Id: CE-000000' -H 'X-Context-Id: DEFAULT_WORKFLOW' -H 'X-Action: RESUME' -H 'X-SSL-CLIENT-CERT: -----BEGIN CERTIFICATE----- '$1' -----END CERTIFICATE-----' -H 'Accept: */*' -i ''$2'/ingest-external/v1/ingests/'$3'/'$4''
curl -X GET -k -H 'X-Tenant-Id: 0' -H 'Content-Type: application/octet-stream' -H 'X-Access-Contract-Id: CE-000000' -H 'X-Context-Id: DEFAULT_WORKFLOW' -H 'X-Action: RESUME' -H 'X-SSL-CLIENT-CERT: -----BEGIN CERTIFICATE----- '$1' -----END CERTIFICATE-----' -H 'Accept: */*' -i ''$2'/admin-external/v1/operations/'$3''
##echo " curl -X GET -k -H 'X-Tenant-Id: 0' -H 'Content-Type: application/octet-stream' -H 'X-Access-Contract-Id: CE-000000' -H 'X-Context-Id: DEFAULT_WORKFLOW' -H 'X-Action: RESUME' -H 'X-SSL-CLIENT-CERT: -----BEGIN CERTIFICATE----- '$1' -----END CERTIFICATE-----' -H 'Accept: */*' -i ''$2'/admin-external/v1/operations/'$3'/'$4''"
......
#!/bin/sh
## curl -X POST -k -H 'X-Tenant-Id: 0' -H 'Content-Type: application/octet-stream' -H 'X-Access-Contract-Id: IN-ABES-0' -H 'X-Context-Id: DEFAULT_WORKFLOW' -H 'X-Action: RESUME' -H 'X-SSL-CLIENT-CERT: -----BEGIN CERTIFICATE----- '$1' -----END CERTIFICATE-----' -H 'Accept: */*' -i ''$3'/ingest-external/v1/ingests' --data-binary @$2 > POST-$2.out
curl -X POST -k -H 'X-Tenant-Id: 0' -H 'Content-Type: application/octet-stream' -H 'X-Access-Contract-Id: CE-000000' -H 'X-Context-Id: DEFAULT_WORKFLOW' -H 'X-Action: RESUME' -H 'X-SSL-CLIENT-CERT: -----BEGIN CERTIFICATE----- '$1' -----END CERTIFICATE-----' -H 'Accept: */*' -i ''$4'/ingest-external/v1/ingests' --data-binary @$2/$3 > POST-$3.out
curl -X POST -k -H 'X-Tenant-Id: 0' -H 'Content-Type: application/octet-stream' -H 'X-Access-Contract-Id: CE-000000' -H 'X-Context-Id: DEFAULT_WORKFLOW' -H 'X-Action: RESUME' -H 'X-SSL-CLIENT-CERT: -----BEGIN CERTIFICATE----- '$1' -----END CERTIFICATE-----' -H 'Accept: */*' -i ''$3'/ingest-external/v1/ingests' --data-binary @$2 > POST-$2.out
###curl -X POST -k -H 'X-Tenant-Id: 0' -H 'Content-Type: application/octet-stream' -H 'X-Access-Contract-Id: IN-ABES-0' -H 'X-Context-Id: DEFAULT_WORKFLOW' -H 'X-Action: RESUME' -H 'X-SSL-CLIENT-CERT: -----BEGIN CERTIFICATE----- MIIFrTCCA5WgAwIBAgIBKDANBgkqhkiG9w0BAQsFADBgMQswCQYDVQQGEwJmcjEP MA0GA1UECBMGZnJhbmNlMRQwEgYDVQQHEwttb250cGVsbGllcjE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jARBglghkgBhvhCAQEEBAMCAAcwHgYJYIZIAYb4QgENBBEWD3hj YSBjZXJ0aWZpY2F0ZTANBgkqhkiG9w0BAQsFAAOCAgEAK/XunOyQh2crn8bTk2mE Zw8Z4mUOEQF2I3WvV9oJF2EDv0eooWRr+sCpi2VF7AbuBOhfrrtg5qJHA5C1/pnd Z6oJMOqu2wZsa8C1D4fYeJSaDsXmjEMeArfMW4OFDNihOH+bGySNiEaAAsPcIQQE QnEj0zjWQfA5bgEbiEixSWAs1tMpCYL1korznwUXo/rGVKgcSdFE5rSVMm2cbqx2 4oRO2zUS6RXgw078jLL0qc3bGS6DbvJKdedda+R3M3O5OhXnzoG+M6ctWDs1kz+7 5byVaJcuIlWY/1TAjvp/ExApadFhEqbYcZxAUME5lD5u1VQZankMIlNcjSaOBpTH znEJNcPubIQLMNFvVzfQ08lH1K8IJnPu6fHufmGAjcMb2AOvlrHUQewznh0NHMTC 0JCNUbMsa7jXyBRJw5qo6PTKq0NKJqmv9M/iBs2yBxgkkLXVUw8odb0DksZJKMVO O7C1JKbLkzApxAU5noLRuxcTyARW5VgWO6g+11BvC/9zgKbTepsonTYzjd8wTJMf m+kB4UNSVxijiaGpxefZyYA18jcUp3Ng6Sm6MrE+sqKyMps4uPHybZmQnuxgN5Mb US4asQKMm0YON5Ds9a3WO9ut9Sm9mILlEVrRXhNgYq7lf0fohfRwSQ9nq6g4y9KN M040HIG25l7t3LdjkgckiSs= -----END CERTIFICATE-----' -H 'Accept: */*' -i ''$2'/ingest-external/v1/ingests' --data-binary @$1 > POST-$1.out
......@@ -9,9 +9,9 @@
# path_curl="/home/atheron/VITAM" (path sur pctadad admin)
# url des API Vitam:
# url="https://10.6.10.34:"
url="https://10.6.10.34:"
#url="https://prep-vit-acc-1-1.cines.fr:"
url="https://vitam.cines.fr:"
# url="https://vitam.cines.fr:"
# ports des API
ing_ext_port="8443";
......@@ -19,8 +19,9 @@
#Fichier pem du certificat:
# certificat=`cat ./cert/cines_certificat.pem`
certificat=`cat ./cert/cines_certificat.prod.pem`
certificat=`cat ./cert/cines_certificat.pem`
# certificat=`cat ./cert/cines_certificat.prod.pem`
# certificat=`cat ./cert/certificat_faux.pem`
# certificat=`cat uga_certificat.pem`
# *************** VARIABLES *********************
......@@ -96,7 +97,8 @@ fi
# Lancement du POST (la sortie est dans "POST-$1.out")
echo "#########################################################"
echo "Versement de $sip dans VITAM ... : $sip $url$ing_ext_port"
$path_curl/curl_POST.sh $certificat $sip $url$ing_ext_port
#$path_curl/curl_POST.sh $certificat $sip $url$ing_ext_port
$path_curl/curl_POST.sh $certificat $path_sip $sip $url$ing_ext_port
#sleep 4
......@@ -115,7 +117,7 @@ if grep " 202 Accepted" POST-$1.out 1>/dev/null 2>&1 # Si le retour du POST co
# Lancement recupération du statut du POST
echo "";
echo "Lancement de la récupération du statut du POST";
# recup_statut $ReqId;
recup_statut $ReqId;
mv $ReqId-$report.out ./out # deplacement du fichier report dans .out
echo "";
......@@ -123,18 +125,18 @@ if grep " 202 Accepted" POST-$1.out 1>/dev/null 2>&1 # Si le retour du POST co
echo "Lancement de la récupération de l'accusé de réception ..."
report="ATR" # type du report (ATR= archivetransferrreply)
sleep 2 # wait de 20 sec
# recup_ATR $ReqId;
recup_ATR $ReqId;
# Parsing du content de <ReplyCode> dans l'accuse de reception:
# AR=`cat $ReqId-$report.xml`
# motif="<ReplyCode>"; motif2="</ReplyCode>"
# code=${AR#*${motif}}
# code=${code%${motif2}*}
# echo "Resultat final du dépot : ReplyCode = $code ";
# mv $ReqId-$report.xml ./out # deplacement du fichier report dans .out
# ARxml="${report}_$ReqId.xml" # construction du fichier XML de l'archivetransferreply
# more $ReqId-$report.out | tail -1 > $ARxml
AR=`cat $ReqId-$report.xml`
motif="<ReplyCode>"; motif2="</ReplyCode>"
code=${AR#*${motif}}
code=${code%${motif2}*}
echo "Resultat final du dépot : ReplyCode = $code ";
mv $ReqId-$report.xml ./out # deplacement du fichier report dans .out
## ARxml="${report}_$ReqId.xml" # construction du fichier XML de l'archivetransferreply
## more $ReqId-$report.out | tail -1 > $ARxml
else
echo "La transaction a été refusée"; # Le retour du POST ne contient pas Accepted
......
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