Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
powerkimhub committed Sep 18, 2023
2 parents 939a7d7 + c64470c commit 3e928a5
Show file tree
Hide file tree
Showing 12 changed files with 502 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
RESTSERVER=localhost

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

# for Cloud Credential Info
# $$$ Need to append '/v3/' to identity_endpoint URL
curl -X POST http://$RESTSERVER:1024/spider/credential -H 'Content-Type: application/json' -d '{
"CredentialName":"ktcloudvpc-credential01",
"ProviderName":"KTCLOUDVPC",
"KeyValueInfoList": [
{"Key":"IdentityEndpoint", "Value":"https://api.ucloudbiz.olleh.com/d1/identity/v3/"},
{"Key":"Username", "Value":"~~~@~~~.com"},
{"Key":"Password", "Value":"XXXXXXXXXX"},
{"Key":"DomainName", "Value":"default"},
{"Key":"ProjectID", "Value":"XXXXXXXXXX"}
]}'

# for Cloud Region Info
curl -X POST http://$RESTSERVER:1024/spider/region -H 'Content-Type: application/json' -d '{"RegionName":"ktcloudvpc-DX-M1-zone","ProviderName":"KTCLOUDVPC","KeyValueInfoList": [{"Key":"Zone", "Value":"DX-M1"}]}'

# for Cloud Connection Config Info
curl -X POST http://$RESTSERVER:1024/spider/connectionconfig -H 'Content-Type: application/json' -d '{"ConfigName":"ktcloudvpc-config01","ProviderName":"KTCLOUDVPC", "DriverName":"ktcloudvpc-driver01", "CredentialName":"ktcloudvpc-credential01", "RegionName":"ktcloudvpc-DX-M1-zone"}'
12 changes: 12 additions & 0 deletions api-runtime/rest-runtime/test/full-test/11.ktcloud-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Image Guest OS : Ubuntu Linux 18.04 기준
# VM Spec : vCPU: 4, Mem: 8GB

export CONN_CONFIG=ktcloud-korea-cheonan2-config
export IMAGE_NAME=97ef0091-fdf7-44e9-be79-c99dc9b1a0ad
export SPEC_NAME=d3530ad2-462b-43ad-97d5-e1087b952b7d!87c0a6f6-c684-4fbe-a393-d8412bcf788d_disk100GB

# Seoul2
# export IMAGE_NAME=63de6d04-7f1b-4924-8e95-1acd6581ca0c
# export SPEC_NAME=3842610a-8b04-4796-a7cd-4ee3706a4666

./ktcloud-full_test.sh
9 changes: 9 additions & 0 deletions api-runtime/rest-runtime/test/full-test/15.ktvpc-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export CONN_CONFIG=ktcloudvpc-config01

# Ubuntu 18.04 image(for DX-M1 zone)
export IMAGE_NAME=d3f14f02-15b8-445e-9fb6-4cbd3f3c3387

# vCPU: 2, Mem: 8GB
export SPEC_NAME=2x8.itl

./ktvpc-full_test.sh
183 changes: 183 additions & 0 deletions api-runtime/rest-runtime/test/full-test/ktcloud-full_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
echo "#### Full Test Process - Start ###"

sleep 1

echo "####################################################################"
echo "## Full Test Scripts for CB-Spider IID Working Version - 2020.04.22."
echo "## 0. VM Image: List"
echo "## 0. VM Spec: List"
echo "## 1. VPC: Create -> List -> Get"
echo "## 2. SecurityGroup: Create -> List -> Get"
echo "## 3. KeyPair: Create -> List -> Get"
echo "## 4. VM: StartVM -> List -> Get -> ListStatus -> GetStatus -> Suspend -> Resume -> Reboot"
echo "## ---------------------------------"
echo "## 4. VM: Terminate(Delete)"
echo "## 3. KeyPair: Delete"
echo "## 2. SecurityGroup: Delete"
echo "## 1. VPC: Delete"
echo "####################################################################"

sleep 2

echo "## 0. VM Image: List"
curl -sX GET http://localhost:1024/spider/vmimage -H 'Content-Type: application/json' -d '{ "ConnectionName": "'${CONN_CONFIG}'"}' |json_pp

sleep 5

echo "## 0. VM Image: Get"
curl -sX GET http://localhost:1024/spider/vmimage/${IMAGE_NAME} -H 'Content-Type: application/json' -d '{ "ConnectionName": "'${CONN_CONFIG}'"}' |json_pp

sleep 5

echo "## 0. VM Spec: List"
curl -sX GET http://localhost:1024/spider/vmspec -H 'Content-Type: application/json' -d '{ "ConnectionName": "'${CONN_CONFIG}'"}' |json_pp

sleep 5

echo "## 0. VM Spec: Get"
curl -sX GET http://localhost:1024/spider/vmspec/${SPEC_NAME} -H 'Content-Type: application/json' -d '{ "ConnectionName": "'${CONN_CONFIG}'"}' |json_pp
echo "#-----------------------------"

sleep 5

echo "####################################################################"
echo "## 1. VPC: Create -> List -> Get"
echo "####################################################################"
sleep 1
echo "## 1. VPC: Create"
curl -sX POST http://localhost:1024/spider/vpc -H 'Content-Type: application/json' -d '{ "ConnectionName": "'${CONN_CONFIG}'", "ReqInfo": { "Name": "ktcloud-vpc-01", "IPv4_CIDR": "10.240.0.0/16", "SubnetInfoList": [ { "Name": "ktcloud-subnet-01", "IPv4_CIDR": "10.240.0.0/24"}, { "Name": "ktcloud-subnet-02", "IPv4_CIDR": "10.240.1.0/24"} ] } }' |json_pp

sleep 5
echo "## 1. VPC: List"
curl -sX GET http://localhost:1024/spider/vpc -H 'Content-Type: application/json' -d '{ "ConnectionName": "'${CONN_CONFIG}'"}' |json_pp

sleep 5
echo "## 1. VPC: Get"
curl -sX GET http://localhost:1024/spider/vpc/ktcloud-vpc-01 -H 'Content-Type: application/json' -d '{ "ConnectionName": "'${CONN_CONFIG}'"}' |json_pp
echo "#-----------------------------"

echo "####################################################################"
echo "## 2. SecurityGroup: Create -> List -> Get"
echo "####################################################################"

sleep 1
echo "## 2. SecurityGroup: Create"
curl -sX POST http://localhost:1024/spider/securitygroup -H 'Content-Type: application/json' -d '{ "ConnectionName": "'${CONN_CONFIG}'", "ReqInfo": { "Name": "ktcloud-sg-01", "VPCName": "ktcloud-vpc-01", "SecurityRules": [ {"FromPort": "22", "ToPort" : "22", "IPProtocol" : "tcp", "Direction" : "inbound", "CIDR": "0.0.0.0/0"} ] } }' |json_pp

# Or
## 위와 Security Rule 겹치지 않도록 주의 필요!! (KT Cloud driver에서는...)

curl -sX POST http://localhost:1024/spider/securitygroup -H 'Content-Type: application/json' -d '{ "ConnectionName": "'${CONN_CONFIG}'", "ReqInfo": { "Name": "ktcloud-sg-02", "VPCName": "ktcloud-vpc-01", "SecurityRules": [ {"FromPort": "1", "ToPort" : "65535", "IPProtocol" : "tcp", "Direction" : "inbound", "CIDR": "0.0.0.0/0"}, {"FromPort": "5555", "ToPort" : "5555", "IPProtocol" : "udp", "Direction" : "inbound", "CIDR": "0.0.0.0/0"}, {"FromPort": "-1", "ToPort" : "-1", "IPProtocol" : "icmp", "Direction" : "inbound", "CIDR": "0.0.0.0/0"} ] } }' |json_pp

sleep 5
echo "## 2. SecurityGroup: List"

curl -sX GET http://localhost:1024/spider/securitygroup -H 'Content-Type: application/json' -d '{ "ConnectionName": "'${CONN_CONFIG}'"}' |json_pp

sleep 5
echo "## 2. SecurityGroup: Get"

curl -sX GET http://localhost:1024/spider/securitygroup/ktcloud-sg-01 -H 'Content-Type: application/json' -d '{ "ConnectionName": "'${CONN_CONFIG}'"}' |json_pp
echo "#-----------------------------"

echo "####################################################################"
echo "## 3. KeyPair: Create -> List -> Get"
echo "####################################################################"

sleep 1
echo "## 3. KeyPair: Create"
curl -sX POST http://localhost:1024/spider/keypair -H 'Content-Type: application/json' -d '{ "ConnectionName": "'${CONN_CONFIG}'", "ReqInfo": { "Name": "ktcloud-key-01" } }' |json_pp

sleep 5
echo "## 3. KeyPair: List"
curl -sX GET http://localhost:1024/spider/keypair -H 'Content-Type: application/json' -d '{ "ConnectionName": "'${CONN_CONFIG}'"}' |json_pp

sleep 5
echo "## 3. KeyPair: Get"
curl -sX GET http://localhost:1024/spider/keypair/ktcloud-key-01 -H 'Content-Type: application/json' -d '{ "ConnectionName": "'${CONN_CONFIG}'"}' |json_pp
echo "#-----------------------------"

echo "####################################################################"
echo "## 4. VM: StartVM -> List -> Get -> ListStatus -> GetStatus -> Suspend -> Resume -> Reboot"
echo "####################################################################"

sleep 1
echo "## 4. VM: StartVM"
curl -sX POST http://localhost:1024/spider/vm -H 'Content-Type: application/json' -d '{ "ConnectionName": "'${CONN_CONFIG}'", "ReqInfo": { "Name": "ktcloud-vm-01", "ImageName": "'${IMAGE_NAME}'", "VPCName": "ktcloud-vpc-01", "SubnetName": "ktcloud-subnet-01", "SecurityGroupNames": [ "ktcloud-sg-02" ], "VMSpecName": "'${SPEC_NAME}'", "KeyPairName": "ktcloud-key-01"} }' |json_pp

echo "============== sleep 50sec after start VM"
sleep 50

echo "## 4. VM: List"
curl -sX GET http://localhost:1024/spider/vm -H 'Content-Type: application/json' -d '{ "ConnectionName": "'${CONN_CONFIG}'"}' |json_pp

echo "============== sleep 10sec after List VM"
sleep 10
echo "## 4. VM: Get"
curl -sX GET http://localhost:1024/spider/vm/ktcloud-vm-01 -H 'Content-Type: application/json' -d '{ "ConnectionName": "'${CONN_CONFIG}'"}' |json_pp

echo "============== sleep 10sec after Get VM"
sleep 10
echo "## 4. VM: ListStatus"
curl -sX GET http://localhost:1024/spider/vmstatus -H 'Content-Type: application/json' -d '{ "ConnectionName": "'${CONN_CONFIG}'"}' |json_pp

echo "============== sleep 2sec after List VM Status"
sleep 2
echo "## 4. VM: GetStatus"
curl -sX GET http://localhost:1024/spider/vmstatus/ktcloud-vm-01 -H 'Content-Type: application/json' -d '{ "ConnectionName": "'${CONN_CONFIG}'"}' |json_pp

echo "============== sleep 10sec after Get VM Status"
sleep 10
echo "## 4. VM: Suspend"
curl -sX GET http://localhost:1024/spider/controlvm/ktcloud-vm-01?action=suspend -H 'Content-Type: application/json' -d '{ "ConnectionName": "'${CONN_CONFIG}'"}' |json_pp

echo "============== sleep 40sec after suspend VM"
sleep 40
echo "## 4. VM: Resume"
curl -sX GET http://localhost:1024/spider/controlvm/ktcloud-vm-01?action=resume -H 'Content-Type: application/json' -d '{ "ConnectionName": "'${CONN_CONFIG}'"}' |json_pp

echo "============== sleep 10sec after resume VM"
sleep 10
echo "## 4. VM: Reboot"
curl -sX GET http://localhost:1024/spider/controlvm/ktcloud-vm-01?action=reboot -H 'Content-Type: application/json' -d '{ "ConnectionName": "'${CONN_CONFIG}'"}' |json_pp

echo "============== sleep 70sec after reboot VM"
sleep 70
echo "#-----------------------------"

echo "####################################################################"
echo "####################################################################"
echo "####################################################################"

echo "####################################################################"
echo "## 4. VM: Terminate(Delete) "
echo "####################################################################"
curl -sX DELETE http://localhost:1024/spider/vm/ktcloud-vm-01 -H 'Content-Type: application/json' -d '{ "ConnectionName": "'${CONN_CONFIG}'"}' |json_pp

echo "============== sleep 40sec after terminate VM"
sleep 40

echo "####################################################################"
echo "## 3. KeyPair: Delete"
echo "####################################################################"
curl -sX DELETE http://localhost:1024/spider/keypair/ktcloud-key-01 -H 'Content-Type: application/json' -d '{ "ConnectionName": "'${CONN_CONFIG}'"}' |json_pp

sleep 5

echo "####################################################################"
echo "## 2. SecurityGroup: Delete"
echo "####################################################################"
curl -sX DELETE http://localhost:1024/spider/securitygroup/ktcloud-sg-01 -H 'Content-Type: application/json' -d '{ "ConnectionName": "'${CONN_CONFIG}'"}' |json_pp

echo "####################################################################"
curl -sX DELETE http://localhost:1024/spider/securitygroup/ktcloud-sg-02 -H 'Content-Type: application/json' -d '{ "ConnectionName": "'${CONN_CONFIG}'"}' |json_pp


sleep 5

echo "####################################################################"
echo "## 1. VPC: Delete"
echo "####################################################################"
curl -sX DELETE http://localhost:1024/spider/vpc/ktcloud-vpc-02 -H 'Content-Type: application/json' -d '{ "ConnectionName": "'${CONN_CONFIG}'"}' |json_pp

echo "#### Full Test Process - Finished ###"
Loading

0 comments on commit 3e928a5

Please sign in to comment.