aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIgor D.C <igor.duarte.cardoso@intel.com>2020-10-01 23:44:46 +0000
committerIgor D.C <igor.duarte.cardoso@intel.com>2020-10-02 21:22:52 +0000
commit44c33f538cf03455c3fd32f837f56f31957bb4a0 (patch)
tree8572bcec2445890cc11eadd462cd098ecc65a0dc /src
parentb05bad813b236d627c83688eeef128fe7126dfae (diff)
Improve DCM test script: apply, term, kubeconfig
Adds apply and terminate operations, while decoupling them in two different script branches. Add kubeconfig test into a third script branch. Also, $cluster_2_name wasn't defined, so this fixes that. Issue-ID: MULTICLOUD-1143 Change-Id: I574934078644ec83224bcac74b5b17783330aaaa Signed-off-by: Igor D.C <igor.duarte.cardoso@intel.com>
Diffstat (limited to 'src')
-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