3 ICN_DIR=$(dirname "$(dirname "$PWD")")
5 source "$ICN_DIR/env/lib/common.sh"
9 cat <<- EOF > /tmp/sample_image
10 This is a dummy file for testing.
14 IMAGE_SIZE=$(ls -al /tmp/sample_image | awk '{print $5}')
17 cat <<- EOF > /tmp/sample.json
20 "cluster_name": "beta",
22 "image_name": "qwerty123",
23 "image_length": $IMAGE_SIZE,
25 "upload_complete": false,
29 "image_record_name": "iuysdi1234",
41 while [[ $cur_status != "Running" ]]; do
43 cur_status=$(kubectl get pods | grep bpa-api-deployment | awk '{print $3}')
44 if [[ $cur_status != "Running" ]]; then
45 echo "$(date +%H:%M:%S) - BPA-RESTful-API Pod status: $cur_status"
50 if [[ $cur_status == "Err"* ]]; then
58 IP=$(kubectl get services | grep bpa-api-service | awk '{print $3}')
60 call_api -i -F "metadata=</tmp/sample.json;type=application/json" -F \
61 file=@/tmp/sample.json -X POST \
62 http://$IP:9015/v1/baremetalcluster/alpha/beta/container_images
65 http://$IP:9015/v1/baremetalcluster/alpha/beta/container_images/qwerty123
67 call_api --request PATCH --data-binary "@/tmp/sample_image" \
68 http://$IP:9015/v1/baremetalcluster/alpha/beta/container_images/qwerty123 \
69 --header "Upload-Offset: 0" --header "Expect:" -i
71 call_api -i -X DELETE \
72 http://$IP:9015/v1/baremetalcluster/alpha/beta/container_images/qwerty123