summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsrc/dcm/test/dcm_call_api.sh69
1 files changed, 39 insertions, 30 deletions
diff --git a/src/dcm/test/dcm_call_api.sh b/src/dcm/test/dcm_call_api.sh
index 33fbf314..e25a4b6f 100755
--- a/src/dcm/test/dcm_call_api.sh
+++ b/src/dcm/test/dcm_call_api.sh
@@ -26,7 +26,7 @@ user="user-1"
permission="permission-1"
cluster_provider_name="cp-1"
cluster_1_name="c1"
-cluster_1_name="c2"
+cluster_2_name="c2"
lc_cluster_1_name="lc-cl-1"
lc_cluster_2_name="lc-cl-2"
quota_name="quota-1"
@@ -134,37 +134,12 @@ quota_data="$(cat << EOF
EOF
)"
-# Create logical cloud
-printf "\n\nCreating logical cloud data\n\n"
-curl -d "${logical_cloud_data}" -X POST ${logical_cloud_url}
-
-# Associate two clusters with the logical cloud
-printf "\n\nAdding two clusters to logical cloud\n\n"
-curl -d "${cluster_1_data}" -X POST ${cluster_url}
-curl -d "${cluster_2_data}" -X POST ${cluster_url}
-
-# Add resource quota for the logical cloud
-printf "\n\nAdding resource quota for the logical cloud\n\n"
-curl -d "${quota_data}" -X POST ${quota_url}
-
-# Get logical cloud data
-printf "\n\nGetting logical cloud\n\n"
-curl -X GET "${logical_cloud_url}/${logical_cloud_name}"
-
-printf "\n\nGetting clusters info for logical cloud\n\n"
-curl -X GET ${cluster_url}
-
-printf "\n\nGetting first cluster of logical cloud\n"
-curl -X GET ${cluster_url}/${lc_cluster_1_name}
-
-printf "\n\nGetting second cluster of logical cloud\n"
-curl -X GET ${cluster_url}/${lc_cluster_2_name}
-
-printf "\n\nGetting Quota info for the logical cloud\n\n"
-curl -X GET "${quota_url}/${quota_name}"
-
# Cleanup (delete created resources)
if [ "$1" == "clean" ]; then
+ printf "\n\nTerminating logical cloud...\n\n"
+ curl -X POST "${logical_cloud_url}/${logical_cloud_name}/terminate"
+ sleep 10
+
printf "\n\nDeleting Quota info for the logical cloud\n\n"
curl -X DELETE "${quota_url}/${quota_name}"
@@ -174,4 +149,38 @@ if [ "$1" == "clean" ]; then
printf "\n\nDeleting logical cloud data\n\n"
curl -X DELETE ${logical_cloud_url}/${logical_cloud_name}
+elif [ "$1" == "kube" ]; then
+ printf "\n\nFetching kubeconfig for cluster 1:\n\n"
+ curl -X GET "${logical_cloud_url}/${logical_cloud_name}/cluster-references/${lc_cluster_1_name}/kubeconfig" > kubeconfig-${lc_cluster_1_name}
+
+ printf "\n\nFetching kubeconfig for cluster 2:\n\n"
+ curl -X GET "${logical_cloud_url}/${logical_cloud_name}/cluster-references/${lc_cluster_2_name}/kubeconfig" > kubeconfig-${lc_cluster_2_name}
+else
+ printf "\n\nCreating logical cloud data\n\n"
+ curl -d "${logical_cloud_data}" -X POST ${logical_cloud_url}
+
+ printf "\n\nAdding two clusters to logical cloud\n\n"
+ curl -d "${cluster_1_data}" -X POST ${cluster_url}
+ curl -d "${cluster_2_data}" -X POST ${cluster_url}
+
+ printf "\n\nAdding resource quota for the logical cloud\n\n"
+ curl -d "${quota_data}" -X POST ${quota_url}
+
+ printf "\n\nGetting logical cloud\n\n"
+ curl -X GET "${logical_cloud_url}/${logical_cloud_name}"
+
+ printf "\n\nGetting clusters info for logical cloud\n\n"
+ curl -X GET ${cluster_url}
+
+ printf "\n\nGetting first cluster of logical cloud\n"
+ curl -X GET ${cluster_url}/${lc_cluster_1_name}
+
+ printf "\n\nGetting second cluster of logical cloud\n"
+ curl -X GET ${cluster_url}/${lc_cluster_2_name}
+
+ printf "\n\nGetting Quota info for the logical cloud\n\n"
+ curl -X GET "${quota_url}/${quota_name}"
+
+ printf "\n\nApplying logical cloud...\n\n"
+ curl -X POST "${logical_cloud_url}/${logical_cloud_name}/apply"
fi