Skip to content

Commit

Permalink
Add 6 CSP Test Scenarios for the Certification Test
Browse files Browse the repository at this point in the history
  • Loading branch information
powerkimhub committed Nov 25, 2024
1 parent 59f5efc commit f8e8d05
Show file tree
Hide file tree
Showing 37 changed files with 1,345 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,11 @@ cloud-control-manager/cloud-driver/drivers/ncp/main/config/config.yaml
cloud-control-manager/cloud-driver/drivers/ncpvpc/main/config/config.yaml
cloud-control-manager/cloud-driver/drivers/nhncloud/main/conf/config.yaml
cloud-control-manager/cloud-driver/drivers/ktcloud/main/config/config.yaml

test/vm-cb-user-validation-cli/2.6-csp-test/connection/.aws-credential
test/vm-cb-user-validation-cli/2.6-csp-test/connection/.azure-credential
test/vm-cb-user-validation-cli/2.6-csp-test/connection/.gcp-credential
test/vm-cb-user-validation-cli/2.6-csp-test/connection/.azure-credential
test/vm-cb-user-validation-cli/2.6-csp-test/connection/.alibaba-credential
test/vm-cb-user-validation-cli/2.6-csp-test/connection/.tencent-credential
test/vm-cb-user-validation-cli/2.6-csp-test/connection/.openstack-credential
23 changes: 23 additions & 0 deletions test/vm-cb-user-validation-cli/2.6-csp-test/00.prepare-00.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

if [ "$1" = "" ]; then
echo
echo -e 'usage: '$0' mock|aws|azure|gcp|alibaba|tencent|ibm|openstack|ncp|ncpvpc|nhncloud'
echo -e '\n\tex) '$0' aws'
echo
exit 0;
fi

echo -e "###########################################################"
echo -e "# 1.create: VPC/Subnet => SG01 => Keypair(save private key)"
echo -e "###########################################################"

source ../common/setup.env $1
source setup.env $1


### 1.create: VPC/Subnet => SG01 => Keypair(save private key)
../common/1.prepare-resources.sh $1

echo -e "\n\n"

Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

if [ "$1" = "" ]; then
echo
echo -e 'usage: '$0' mock|aws|azure|gcp|alibaba|tencent|ibm|openstack|cloudit|ncp|ncpvpc|nhncloud number'
echo -e '\n\tex) '$0' aws 5'
echo
exit 0;
fi

if [ "$2" = "" ]; then
echo
echo -e 'usage: '$0' mock|aws|azure|gcp|alibaba|tencent|ibm|openstack|cloudit|ncp|ncpvpc|nhncloud number'
echo -e '\n\tex) '$0' aws 5'
echo
exit 0;
fi

source ../common/setup.env $1
source setup.env $1

rm -f $RESULT_FNAME
rm -f $TERMINATED_FNAME

echo -e "\n\n"
echo -e "###########################################################"
echo -e "# Try to create $1 VMs: $2"
echo -e "###########################################################"
echo -e "\n\n"


for (( num=1; num <= $2; num++ ))
do
# ex) ./vm-ssh-test.sh aws 1
./vm-ssh-test.sh $1 $num &
if [ `expr $num % 10` = 0 ]; then # tencent RequestLimitExceeded = 10/sec
sleep 3
fi
echo -e "\n\n"
done

echo -e "\n\n"

23 changes: 23 additions & 0 deletions test/vm-cb-user-validation-cli/2.6-csp-test/02.disk-01.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

if [ "$1" = "" ]; then
echo
echo -e 'usage: '$0' mock|aws|azure|gcp|alibaba|tencent|ibm|openstack|ncp|ncpvpc|nhncloud'
echo -e '\n\tex) '$0' aws'
echo
exit 0;
fi

echo -e "###########################################################"
echo -e "# 1.create: Disk"
echo -e "###########################################################"

source ../common/setup.env $1
source setup.env $1


### 1.create: Disk
../common/11.disk-create.sh $1

echo -e "\n\n"

23 changes: 23 additions & 0 deletions test/vm-cb-user-validation-cli/2.6-csp-test/03.myimage-01.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

if [ "$1" = "" ]; then
echo
echo -e 'usage: '$0' mock|aws|azure|gcp|alibaba|tencent|ibm|openstack|ncp|ncpvpc|nhncloud'
echo -e '\n\tex) '$0' aws'
echo
exit 0;
fi

echo -e "###########################################################"
echo -e "# 1.create: MyImage"
echo -e "###########################################################"

source ../common/setup.env $1
source setup.env $1


### 1.create: MyImage
../common/12.myimage-create.sh $1

echo -e "\n\n"

23 changes: 23 additions & 0 deletions test/vm-cb-user-validation-cli/2.6-csp-test/04.nlb-01.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

if [ "$1" = "" ]; then
echo
echo -e 'usage: '$0' mock|aws|azure|gcp|alibaba|tencent|ibm|openstack|ncp|ncpvpc|nhncloud'
echo -e '\n\tex) '$0' aws'
echo
exit 0;
fi

echo -e "###########################################################"
echo -e "# 1.create: NLB"
echo -e "###########################################################"

source ../common/setup.env $1
source setup.env $1


### 1.create: NLB
../common/13.nlb-create.sh $1

echo -e "\n\n"

21 changes: 21 additions & 0 deletions test/vm-cb-user-validation-cli/2.6-csp-test/10.destroy_all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

if [ "$1" = "" ]; then
echo
echo -e 'usage: '$0' mock|aws|azure|gcp|alibaba|tencent|ibm|openstack|ncp|ncpvpc|nhncloud'
echo -e '\n\tex) '$0' aws'
echo
exit 0;
fi

echo -e "###########################################################"
echo -e "# 1.destroy: All Resources in Connection "
echo -e "###########################################################"

source ../common/setup.env $1
source setup.env $1

../common/10.destroy.sh $1

echo -e "\n\n"

19 changes: 19 additions & 0 deletions test/vm-cb-user-validation-cli/2.6-csp-test/all_create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

CSPLIST=( aws azure gcp alibaba tencent openstack )

function run() {
param=$1
num=0
for CSP in "${CSPLIST[@]}"
do
echo "============ test ${CSP} ... ============"

./one_csp_run.sh ${CSP} ${param} &

echo -e "\n\n"
done
}

run "$@"

17 changes: 17 additions & 0 deletions test/vm-cb-user-validation-cli/2.6-csp-test/all_destroy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

CSPLIST=( aws azure gcp alibaba tencent openstack )

function run() {
param=$1
for CSP in "${CSPLIST[@]}"
do
echo "============ test ${CSP} ... ============"

./10.destroy_all.sh ${CSP} &

echo -e "\n\n"
done
}

run "$@"
19 changes: 19 additions & 0 deletions test/vm-cb-user-validation-cli/2.6-csp-test/all_snapshot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

CSPLIST=( aws azure gcp alibaba tencent openstack )

function run() {
param=$1
num=0
for CSP in "${CSPLIST[@]}"
do
echo "============ test ${CSP} ... ============"

./one_csp_snapshot.sh ${CSP} ${param} &

echo -e "\n\n"
done
}

run "$@"

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
alibaba_client_id="YOUR_ALIBABA_CLIENT_ID"
alibaba_client_secret="YOUR_ALIBABA_CLIENT_SECRET"
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
aws_access_key_id="YOUR_AWS_ACCESS_KEY_ID"
aws_secret_access_key="YOUR_AWS_SECRET_ACCESS_KEY"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
azure_client_id="YOUR_AZURE_CLIENT_ID"
azure_client_secret="YOUR_AZURE_CLIENT_SECRET"
azure_tenant_id="YOUR_AZURE_TENANT_ID"
azure_subscription_id="YOUR_AZURE_SUBSCRIPTION_ID"
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
gcp_private_key="YOUR_GCP_PRIVATE_KEY"
gcp_project_id="YOUR_GCP_PROJECT_ID"
gcp_client_email="YOUR_GCP_CLIENT_EMAIL"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
openstack_identity_endpoint="YOUR_OPENSTACK_IDENTITY_ENDPOINT"
openstack_username="YOUR_OPENSTACK_USERNAME"
openstack_password="YOUR_OPENSTACK_PASSWORD"
openstack_domain_name="YOUR_OPENSTACK_DOMAIN_NAME"
openstack_project_id="YOUR_OPENSTACK_PROJECT_ID"
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tencent_secret_id="YOUR_TENCENT_SECRET_ID"
tencent_secret_key="YOUR_TENCENT_SECRET_KEY"
88 changes: 88 additions & 0 deletions test/vm-cb-user-validation-cli/2.6-csp-test/connection/1.aws.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
echo "####################################################################"
echo "## Cloud Driver Info"
echo "####################################################################"

# Load sensitive information from .aws-credential
AWS_CREDENTIAL_FILE="./.aws-credential"
if [[ -f $AWS_CREDENTIAL_FILE ]]; then
source $AWS_CREDENTIAL_FILE
else
echo "Error: Credential file not found at $AWS_CREDENTIAL_FILE"
exit 1
fi

if [[ -z "$aws_access_key_id" || -z "$aws_secret_access_key" ]]; then
echo "Error: Missing aws_access_key_id or aws_secret_access_key in credential file."
exit 1
fi

# Cloud Driver Info
curl -X POST http://$RESTSERVER:1024/spider/driver \
-H 'Content-Type: application/json' \
-d '{
"DriverName": "aws-driver01",
"ProviderName": "AWS",
"DriverLibFileName": "aws-driver-v1.0.so"
}'

echo "####################################################################"
echo "## Cloud Credential Info"
echo "####################################################################"

# Cloud Credential Info
curl -X POST http://$RESTSERVER:1024/spider/credential \
-H 'Content-Type: application/json' \
-d '{
"CredentialName": "aws-credential01",
"ProviderName": "AWS",
"KeyValueInfoList": [
{"Key": "aws_access_key_id", "Value": "'"$aws_access_key_id"'"},
{"Key": "aws_secret_access_key", "Value": "'"$aws_secret_access_key"'"}
]
}'

echo "####################################################################"
echo "## Cloud Region Info"
echo "####################################################################"

# Cloud Region Info
regions=("aws-ohio:us-east-2:us-east-2a"
"aws-oregon:us-west-2:us-west-2a"
"aws-singapore:ap-southeast-1:ap-southeast-1a"
"aws-paris:eu-west-3:eu-west-3a"
"aws-saopaulo:sa-east-1:sa-east-1a"
"aws-tokyo:ap-northeast-1:ap-northeast-1a")

for region in "${regions[@]}"; do
IFS=":" read -r RegionName Region Zone <<< "$region"
curl -X POST http://$RESTSERVER:1024/spider/region \
-H 'Content-Type: application/json' \
-d '{
"RegionName": "'$RegionName'",
"ProviderName": "AWS",
"KeyValueInfoList": [
{"Key": "Region", "Value": "'$Region'"},
{"Key": "Zone", "Value": "'$Zone'"}
]
}'
done

echo "####################################################################"
echo "## Cloud Connection Config Info"
echo "####################################################################"

# Cloud Connection Config Info
configs=("aws-config01:aws-ohio")

for config in "${configs[@]}"; do
IFS=":" read -r ConfigName RegionName <<< "$config"
curl -X POST http://$RESTSERVER:1024/spider/connectionconfig \
-H 'Content-Type: application/json' \
-d '{
"ConfigName": "'$ConfigName'",
"ProviderName": "AWS",
"DriverName": "aws-driver01",
"CredentialName": "aws-credential01",
"RegionName": "'$RegionName'"
}'
done
Loading

0 comments on commit f8e8d05

Please sign in to comment.