Skip to content

Commit

Permalink
Merge branch 'cloud-barista:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
MZC-CSC authored Nov 29, 2024
2 parents 8fe40f3 + a381749 commit a1303a1
Show file tree
Hide file tree
Showing 69 changed files with 2,498 additions and 624 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
3 changes: 2 additions & 1 deletion api-runtime/rest-runtime/admin-web/html/cluster.html
Original file line number Diff line number Diff line change
Expand Up @@ -1325,6 +1325,7 @@ <h2>System ID (Managed by CSP)</h2>
rootDiskTypeInput.value = 'cloud_ssd';
break;
case 'TENCENT':
versionInput.value = '1.28.3';
vmSpecInput.value = 'S5.MEDIUM4';
break;
case 'GCP':
Expand Down Expand Up @@ -2082,4 +2083,4 @@ <h2>System ID (Managed by CSP)</h2>
</script>

</body>
</html>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,11 @@ func (myImageHandler AlibabaMyImageHandler) DeleteMyImage(myImageIID irs.IID) (b
}

curRetryCnt++
cblogger.Errorf(" will check the status of MyImage after waiting for 1 second. What is the current status?[%s]", aliImageState)
cblogger.Infof(" will check the status of MyImage after waiting for 1 second. What is the current status?[%s]", aliImageState)
time.Sleep(time.Second * 1)
if curRetryCnt > maxRetryCnt {
cblogger.Debugf("I waited for a long time (%d seconds), but the Status value of MyImage still... [%s]으로 변경되지 않아서 강제로 중단합니다.", maxRetryCnt)
return false, errors.New("I waited for a long time, but the status of the created MyImage is still...[" + string(aliImageState) + "]으로 바뀌지 않아서 중단 합니다.")
cblogger.Debugf("I waited for a long time (%d seconds), but the Status value of MyImage still hasn't changed to [%s], so I'm forcibly stopping.", maxRetryCnt)
return false, errors.New("I waited for a long time, but the status of the created MyImage still hasn't changed to [" + string(aliImageState) + "], so I'm stopping forcibly.")
}
}
cblogger.Info("MyImage deleted. requestId =" + response.RequestId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
// This is a Cloud Driver Tester Example.
//
// by ETRI, 2023.07.
// Updated by ETRI, 2024.11.

package main

Expand Down Expand Up @@ -55,14 +55,15 @@ func handleDisk() {
cblogger.Info("5. ChangeDiskSize()")
cblogger.Info("6. AttachDisk()")
cblogger.Info("7. DetachDisk()")
cblogger.Info("8. ListIID()")
cblogger.Info("0. Exit")
fmt.Println("\n Select a number above!! : ")
fmt.Println("============================================================================================")

var commandNum int

diskIId := irs.IID{
SystemId: "19308647",
SystemId: "26845333",
}

createReqInfo := irs.DiskInfo{
Expand All @@ -77,7 +78,7 @@ func handleDisk() {
}

vmIId := irs.IID{ // To attach disk
SystemId: "19313606",
SystemId: "26844996",
}

newDiskSize := "5"
Expand All @@ -97,7 +98,7 @@ func handleDisk() {
cblogger.Error(err)
} else {
spew.Dump(listResult)
cblogger.Info("# 출력 결과 수 : ", len(listResult))
cblogger.Info("# Total disk list count : ", len(listResult))
}
cblogger.Info("Finish ListDisk()")
case 2:
Expand Down Expand Up @@ -147,8 +148,20 @@ func handleDisk() {
} else {
spew.Dump(result)
}
cblogger.Info("Finish DetachDisk()")
}
cblogger.Info("Finish DetachDisk()")
case 8:
cblogger.Info("Start ListIID() ...")
result, err := diskHandler.ListIID()
if err != nil {
cblogger.Error("Failed to Get Disk IID list : ", err)
} else {
cblogger.Info("Succeeded in Getting Disk IID list!!")
spew.Dump(result)
cblogger.Debug(result)
cblogger.Infof("Total IID list count : [%d]", len(result))
}
cblogger.Info("\nListIID() Test Finished")
}
}
}
}
Expand All @@ -163,8 +176,8 @@ func main() {
handleDisk()
}

//handlerType : resources폴더의 xxxHandler.go에서 Handler이전까지의 문자열
//(예) ImageHandler.go -> "Image"
// handlerType: The string before "Handler" in the xxxHandler.go file in the resources folder
// (e.g.) ImageHandler.go -> "Image"
func getResourceHandler(handlerType string) (interface{}, error) {
var cloudDriver idrv.CloudDriver
cloudDriver = new(ncpdrv.NcpDriver)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func init() {
func testErr() error {
//return awserr.Error("")
return errors.New("")
// return ncloud.New("504", "찾을 수 없음", nil)
// return ncloud.New("504", "Not found", nil)
}

// Test KeyPair
Expand All @@ -54,15 +54,16 @@ func handleKeyPair() {
keyPairHandler := ResourceHandler.(irs.KeyPairHandler)

for {
fmt.Println("\n============================================================================================")
fmt.Println("[ KeyPair Management Test ]")
fmt.Println("1. List KeyPair")
fmt.Println("2. Create KeyPair")
fmt.Println("3. Get KeyPair")
fmt.Println("4. Delete KeyPair")
fmt.Println("0. Quit")
fmt.Println("\n Select a number above!! : ")
fmt.Println("============================================================================================")
cblogger.Info("\n============================================================================================")
cblogger.Info("[ KeyPair Management Test ]")
cblogger.Info("1. List KeyPair")
cblogger.Info("2. Create KeyPair")
cblogger.Info("3. Get KeyPair")
cblogger.Info("4. Delete KeyPair")
cblogger.Info("5. List IID")
cblogger.Info("0. Quit")
cblogger.Info("\n Select a number above!! : ")
cblogger.Info("============================================================================================")

//keyPairName := config.Ncp.KeyName
keyPairName := "NCP-keypair-06"
Expand All @@ -76,61 +77,69 @@ func handleKeyPair() {
if inputCnt == 1 {
switch commandNum {
case 0:
cblogger.Infof("Exit")
return

case 1:
result, err := keyPairHandler.ListKey()
if err != nil {
cblogger.Infof("KeyPair list 조회 실패 : ", err)
cblogger.Infof("Failed to retrieve KeyPair list: ", err)
} else {
cblogger.Info("KeyPair list 조회 결과")
//cblogger.Info(result)
cblogger.Info("KeyPair list retrieval result: ")
spew.Dump(result)

cblogger.Infof("=========== KeyPair list : [%d] ================", len(result))
cblogger.Infof("=========== KeyPair list count : [%d] ================", len(result))
}

cblogger.Info("\nListKey Test Finished")

case 2:
cblogger.Infof("[%s] KeyPair 생성 테스트", keyPairName)
cblogger.Infof("[%s] KeyPair Creation Test", keyPairName)
keyPairReqInfo := irs.KeyPairReqInfo{
IId: irs.IID{NameId: keyPairName},
//Name: keyPairName,
}
result, err := keyPairHandler.CreateKey(keyPairReqInfo)
if err != nil {
cblogger.Infof(keyPairName, " KeyPair 생성 실패 : ", err)
cblogger.Infof(keyPairName, "Failed to Create KeyPair : ", err)
} else {
cblogger.Infof("[%s] KeyPair 생성 결과 : \n[%s]", keyPairName, result)
//spew.Dump(result)
cblogger.Infof("[%s] KeyPair creation result : \n", keyPairName)
spew.Dump(result)
}

cblogger.Info("\nCreateKey Test Finished")

case 3:
cblogger.Infof("[%s] KeyPair 조회 테스트", keyPairName)
cblogger.Infof("[%s] KeyPair retrieval test", keyPairName)
result, err := keyPairHandler.GetKey(irs.IID{NameId: keyPairName})
if err != nil {
cblogger.Infof(keyPairName, " KeyPair 조회 실패 : ", err)
cblogger.Infof("Failed to retrieve KeyPair [%s]: %v", keyPairName, err)
} else {
cblogger.Infof("[%s] KeyPair 조회 결과 : \n[%s]", keyPairName, result)
//spew.Dump(result)
cblogger.Infof("[%s] KeyPair retrieval result : \n", keyPairName)
spew.Dump(result)
}

cblogger.Info("\nGetKey Test Finished")

case 4:
cblogger.Infof("[%s] KeyPair 삭제 테스트", keyPairName)
cblogger.Infof("[%s] KeyPair deletion test", keyPairName)
result, err := keyPairHandler.DeleteKey(irs.IID{NameId: keyPairName})
if err != nil {
cblogger.Infof(keyPairName, " KeyPair 삭제 실패 : ", err)
cblogger.Infof(keyPairName, "Failed to Delete the KeyPair : ", err)
} else {
cblogger.Infof("[%s] KeyPair 삭제 결과 : [%s]", keyPairName, result)
cblogger.Infof("[%s] KeyPair deletion result : ", keyPairName)
spew.Dump(result)
}

cblogger.Info("\nDeleteKey Test Finished")

case 5:
cblogger.Info("Start ListIID() ...")
result, err := keyPairHandler.ListIID()
if err != nil {
cblogger.Error("Failed to Get KeyPair IID list : ", err)
} else {
cblogger.Info("Succeeded in Getting KeyPair IID list!!")
spew.Dump(result)
cblogger.Debug(result)
cblogger.Infof("Total IID list count : [%d]", len(result))
}
cblogger.Info("\nListIID() Test Finished")
}
}
}
Expand All @@ -142,8 +151,8 @@ func main() {
handleKeyPair()
}

//handlerType : resources폴더의 xxxHandler.go에서 Handler이전까지의 문자열
//(예) ImageHandler.go -> "Image"
// handlerType: The string before "Handler" in the xxxHandler.go file in the resources folder
// (e.g.) ImageHandler.go -> "Image"
func getResourceHandler(handlerType string) (interface{}, error) {
var cloudDriver idrv.CloudDriver
cloudDriver = new(ncpdrv.NcpDriver)
Expand Down Expand Up @@ -193,16 +202,16 @@ func getResourceHandler(handlerType string) (interface{}, error) {
return resourceHandler, nil
}

// Region : 사용할 리전명 (ex) ap-northeast-2
// ImageID : VM 생성에 사용할 AMI ID (ex) ami-047f7b46bd6dd5d84
// BaseName : 다중 VM 생성 시 사용할 Prefix이름 ("BaseName" + "_" + "숫자" 형식으로 VM을 생성 함.) (ex) mcloud-barista
// VmID : 라이프 사이트클을 테스트할 EC2 인스턴스ID
// InstanceType : VM 생성시 사용할 인스턴스 타입 (ex) t2.micro
// KeyName : VM 생성시 사용할 키페어 이름 (ex) mcloud-barista-keypair
// MinCount :
// MaxCount :
// SubnetId : VM이 생성될 VPC의 SubnetId (ex) subnet-cf9ccf83
// SecurityGroupID : 생성할 VM에 적용할 보안그룹 ID (ex) sg-0df1c209ea1915e4b
// Region: The name of the region to use (e.g., ap-northeast-2)
// ImageID: The AMI ID to use for creating the VM (e.g., ami-047f7b46bd6dd5d84)
// BaseName: The prefix name to use when creating multiple VMs (VMs will be created in the format "BaseName" + "_" + "number") (e.g., mcloud-barista)
// VmID: The EC2 instance ID to test the lifecycle
// InstanceType: The instance type to use when creating the VM (e.g., t2.micro)
// KeyName: The key pair name to use when creating the VM (e.g., mcloud-barista-keypair)
// MinCount: The minimum number of instances to create
// MaxCount: The maximum number of instances to create
// SubnetId: The SubnetId of the VPC where the VM will be created (e.g., subnet-cf9ccf83)
// SecurityGroupID: The security group ID to apply to the created VM (e.g., sg-0df1c209ea1915e4b)
type Config struct {
Ncp struct {
NcpAccessKeyID string `yaml:"ncp_access_key_id"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
// This is a Cloud Driver Tester Example.
//
// by ETRI, 2023.08.
// Updated by ETRI, 2024.11.

package main

Expand Down Expand Up @@ -42,7 +42,7 @@ func handleMyImage() {
cblogger.Error(err)
return
}
diskHandler := resourceHandler.(irs.MyImageHandler)
myImageHandler := resourceHandler.(irs.MyImageHandler)
//config := readConfigFile()

for {
Expand All @@ -53,6 +53,7 @@ func handleMyImage() {
cblogger.Info("3. SnapshotVM()")
cblogger.Info("4. CheckWindowsImage()")
cblogger.Info("5. DeleteMyImage()")
cblogger.Info("6. ListIID()")
cblogger.Info("0. Exit")
fmt.Println("\n Select a number above!! : ")
fmt.Println("============================================================================================")
Expand Down Expand Up @@ -82,48 +83,61 @@ func handleMyImage() {
if inputCnt == 1 {
switch commandNum {
case 0:
cblogger.Infof("Exit")
return
case 1:
cblogger.Info("Start ListMyImage() ...")
if listResult, err := diskHandler.ListMyImage(); err != nil {
if listResult, err := myImageHandler.ListMyImage(); err != nil {
cblogger.Error(err)
} else {
spew.Dump(listResult)
cblogger.Info("# 출력 결과 수 : ", len(listResult))
cblogger.Info("# Total MyImage list count : ", len(listResult))
}
cblogger.Info("Finish ListMyImage()")
case 2:
cblogger.Info("Start GetMyImage() ...")
if diskInfo, err := diskHandler.GetMyImage(myImageIId); err != nil {
if diskInfo, err := myImageHandler.GetMyImage(myImageIId); err != nil {
cblogger.Error(err)
} else {
spew.Dump(diskInfo)
}
cblogger.Info("Finish GetMyImage()")
case 3:
cblogger.Info("Start SnapshotVM() ...")
if diskInfo, err := diskHandler.SnapshotVM(snapshotReqInfo); err != nil {
if diskInfo, err := myImageHandler.SnapshotVM(snapshotReqInfo); err != nil {
cblogger.Error(err)
} else {
spew.Dump(diskInfo)
}
cblogger.Info("Finish SnapshotVM()")
case 4:
cblogger.Info("Start CheckWindowsImage() ...")
if checkresult, err := diskHandler.CheckWindowsImage(myImageIId); err != nil {
if checkresult, err := myImageHandler.CheckWindowsImage(myImageIId); err != nil {
cblogger.Error(err)
} else {
spew.Dump(checkresult)
}
cblogger.Info("Finish CheckWindowsImage()")
case 5:
cblogger.Info("Start DeleteMyImage() ...")
if delResult, err := diskHandler.DeleteMyImage(myImageIId); err != nil {
if delResult, err := myImageHandler.DeleteMyImage(myImageIId); err != nil {
cblogger.Error(err)
} else {
spew.Dump(delResult)
}
cblogger.Info("Finish DeleteMyImage()")
cblogger.Info("Finish DeleteMyImage()")
case 6:
cblogger.Info("Start ListIID() ...")
result, err := myImageHandler.ListIID()
if err != nil {
cblogger.Error("Failed to Get MyImage IID list : ", err)
} else {
cblogger.Info("Succeeded in Getting MyImage IID list!!")
spew.Dump(result)
cblogger.Debug(result)
cblogger.Infof("Total IID list count : [%d]", len(result))
}
cblogger.Info("\nListIID() Test Finished")
}
}
}
Expand Down
Loading

0 comments on commit a1303a1

Please sign in to comment.