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 [[ $curr_status != "Running" ]]; do
43 new_status=$(kubectl get pods | grep bpa-api-deployment | awk '{print $3}')
44 if [[ $new_status != $curr_status ]]; then
45 echo "$(date +%H:%M:%S) - BPA-RESTful-API Pod status: $new_status"
46 curr_status=$new_status
47 if [[ $new_status == "Running" ]]; then
51 if [[ $new_status == "Err"* ]]; then
59 IP=$(kubectl get services | grep bpa-api-service | awk '{print $3}')
61 call_api -i -F "metadata=</tmp/sample.json;type=application/json" -F \
62 file=@/tmp/sample.json -X POST \
63 http://$IP:9015/v1/baremetalcluster/alpha/beta/container_images
66 http://$IP:9015/v1/baremetalcluster/alpha/beta/container_images/qwerty123
68 call_api --request PATCH --data-binary "@/tmp/sample_image" \
69 http://$IP:9015/v1/baremetalcluster/alpha/beta/container_images/qwerty123 \
70 --header "Upload-Offset: 0" --header "Expect:" -i
72 call_api -i -X DELETE \
73 http://$IP:9015/v1/baremetalcluster/alpha/beta/container_images/qwerty123