mcis

package
v0.5.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2022 License: Apache-2.0 Imports: 32 Imported by: 1

Documentation

Overview

Package mcis is to manage multi-cloud infra service

Package mcis is to manage multi-cloud infra service

Package mcis is to manage multi-cloud infra service

Package mcis is to manage multi-cloud infra service

Package mcis is to manage multi-cloud infra service

Package mcis is to manage multi-cloud infra service

Package mcis is to manage multi-cloud infra service

Package mcis is to manage multi-cloud infra service

Package mcis is to manage multi-cloud infra service

Package mcis is to manage multi-cloud infra service

Index

Constants

View Source
const (
	// AutoStatusReady is const for "Ready" status.
	AutoStatusReady string = "Ready"

	// AutoStatusChecking is const for "Checking" status.
	AutoStatusChecking string = "Checking"

	// AutoStatusDetected is const for "Detected" status.
	AutoStatusDetected string = "Detected"

	// AutoStatusOperating is const for "Operating" status.
	AutoStatusOperating string = "Operating"

	// AutoStatusStabilizing is const for "Stabilizing" status.
	AutoStatusStabilizing string = "Stabilizing"

	// AutoStatusTimeout is const for "Timeout" status.
	AutoStatusTimeout string = "Timeout"

	// AutoStatusError is const for "Failed" status.
	AutoStatusError string = "Failed"

	// AutoStatusSuspended is const for "Suspended" status.
	AutoStatusSuspended string = "Suspended"
)

Status for mcis automation

View Source
const (
	// AutoActionScaleOut is const for "ScaleOut" action.
	AutoActionScaleOut string = "ScaleOut"

	// AutoActionScaleIn is const for "ScaleIn" action.
	AutoActionScaleIn string = "ScaleIn"
)

Action for mcis automation

View Source
const (
	// ActionCreate is const for Create
	ActionCreate string = "Create"

	// ActionTerminate is const for Terminate
	ActionTerminate string = "Terminate"

	// ActionSuspend is const for Suspend
	ActionSuspend string = "Suspend"

	// ActionResume is const for Resume
	ActionResume string = "Resume"

	// ActionReboot is const for Reboot
	ActionReboot string = "Reboot"

	// ActionRefine is const for Refine
	ActionRefine string = "Refine"

	// ActionComplete is const for Complete
	ActionComplete string = "None"
)
View Source
const (
	// StatusRunning is const for Running
	StatusRunning string = "Running"

	// StatusSuspended is const for Suspended
	StatusSuspended string = "Suspended"

	// StatusFailed is const for Failed
	StatusFailed string = "Failed"

	// StatusTerminated is const for Terminated
	StatusTerminated string = "Terminated"

	// StatusCreating is const for Creating
	StatusCreating string = "Creating"

	// StatusSuspending is const for Suspending
	StatusSuspending string = "Suspending"

	// StatusResuming is const for Resuming
	StatusResuming string = "Resuming"

	// StatusRebooting is const for Rebooting
	StatusRebooting string = "Rebooting"

	// StatusTerminating is const for Terminating
	StatusTerminating string = "Terminating"

	// StatusUndefined is const for Undefined
	StatusUndefined string = "Undefined"

	// StatusComplete is const for Complete
	StatusComplete string = "None"
)
View Source
const DefaultSystemLabel string = "Managed by CB-Tumblebug"

DefaultSystemLabel is const for string to specify the Default System Label

Variables

This section is empty.

Functions

func AddVmToMcis

func AddVmToMcis(wg *sync.WaitGroup, nsId string, mcisId string, vmInfoData *TbVmInfo, option string) error

AddVmToMcis is func to add VM to MCIS

func CallGetMonitoringAsync

func CallGetMonitoringAsync(wg *sync.WaitGroup, nsID string, mcisID string, vmID string, vmIP string, method string, metric string, cmd string, returnResult *[]MonResultSimple)

func CallMilkyway

func CallMilkyway(wg *sync.WaitGroup, vmList []string, nsId string, mcisId string, vmId string, vmIp string, action string, option string, results *BenchmarkInfoArray)

CallMilkyway is func to call milkyway agents

func CallMonitoringAsync

func CallMonitoringAsync(wg *sync.WaitGroup, nsID string, mcisID string, mcisServiceType string, vmID string, givenUserName string, method string, cmd string, returnResult *[]SshCmdResult)

CallMonitoringAsync is func to call CB-Dragonfly monitoring framework

func CheckAllowedTransition

func CheckAllowedTransition(nsId string, mcisId string, action string) error

CheckAllowedTransition is func to check status transition is acceptable

func CheckConnectivity added in v0.3.5

func CheckConnectivity(host string, port string) error

CheckConnectivity func checks if given port is open and ready

func CheckDragonflyEndpoint

func CheckDragonflyEndpoint() error

Module for checking CB-Dragonfly endpoint (call get config)

func CheckMcis added in v0.3.1

func CheckMcis(nsId string, mcisId string) (bool, error)

func CheckMcisPolicy added in v0.3.1

func CheckMcisPolicy(nsId string, mcisId string) (bool, error)

func CheckVm added in v0.3.1

func CheckVm(nsId string, mcisId string, vmId string) (bool, error)

func ControlMcis

func ControlMcis(nsId string, mcisId string, action string) error

ControlMcis is func to control MCIS

func ControlMcisAsync

func ControlMcisAsync(nsId string, mcisId string, action string) error

ControlMcisAsync is func to control MCIS async

func ControlVm

func ControlVm(nsId string, mcisId string, vmId string, action string) error

ControlVm is func to control VM

func ControlVmAsync

func ControlVmAsync(wg *sync.WaitGroup, nsId string, mcisId string, vmId string, action string, results *ControlVmResultWrapper) error

ControlVmAsync is func to control VM async

func CoreDelAllMcis

func CoreDelAllMcis(nsId string, option string) (string, error)

CoreDelAllMcis is func to delete all MCIS objects

func CoreGetMcisVmAction

func CoreGetMcisVmAction(nsId string, mcisId string, vmId string, action string) (string, error)

CoreGetMcisVmAction is func to Get McisVm Action

func CreateVm

func CreateVm(nsId string, mcisId string, vmInfoData *TbVmInfo, option string) error

CreateVm is func to create VM (option = "register" for register existing VM)

func DFMonAgentInstallReqStructLevelValidation added in v0.4.7

func DFMonAgentInstallReqStructLevelValidation(sl validator.StructLevel)

func DelAllMcisPolicy added in v0.2.8

func DelAllMcisPolicy(nsId string) (string, error)

DelAllMcisPolicy deletes all McisPolicyInfo objects.

func DelMcis

func DelMcis(nsId string, mcisId string, option string) error

DelMcis is func to delete MCIS object

func DelMcisPolicy added in v0.2.8

func DelMcisPolicy(nsId string, mcisId string) error

DelMcisPolicy deletes McisPolicyInfo object by mcisId.

func DelMcisVm

func DelMcisVm(nsId string, mcisId string, vmId string, option string) error

DelMcisVm is func to delete VM object

func GetVmIp

func GetVmIp(nsId string, mcisId string, vmId string) (string, string)

GetVmIp is func to get VM IP

func GetVmListByLabel added in v0.2.8

func GetVmListByLabel(nsId string, mcisId string, label string) ([]string, error)

GetVmListByLabel is func to list VM by label

func GetVmSpecId

func GetVmSpecId(nsId string, mcisId string, vmId string) string

GetVmSpecId is func to get VM SpecId

func GetVmSshKey

func GetVmSshKey(nsId string, mcisId string, vmId string) (string, string, string)

GetVmSshKey is func to get VM SShKey

func GetVmStatusAsync added in v0.3.5

func GetVmStatusAsync(wg *sync.WaitGroup, nsId string, mcisId string, vmId string, results *McisStatusInfo) error

GetVmStatusAsync is func to get VM status async

func HandleMcisAction added in v0.3.8

func HandleMcisAction(nsId string, mcisId string, action string) (string, error)

HandleMcisAction is func to handle actions to MCIS

func ListMcisId

func ListMcisId(nsId string) ([]string, error)

ListMcisId is func to list MCIS ID

func ListMcisPolicyId added in v0.2.8

func ListMcisPolicyId(nsId string) []string

ListMcisPolicyId returns a list of Ids for all McisPolicyInfo objects .

func ListVmGroupId added in v0.3.3

func ListVmGroupId(nsId string, mcisId string) ([]string, error)

ListVmGroupId is func to return list of VmGroups in a given MCIS

func ListVmId

func ListVmId(nsId string, mcisId string) ([]string, error)

ListVmId is func to list VM IDs

func OrchestrationController added in v0.2.8

func OrchestrationController()

OrchestrationController is responsible for executing MCIS automation policy. OrchestrationController will be periodically involked by a time.NewTicker in main.go.

func RecommendVm added in v0.3.7

func RecommendVm(nsId string, plan DeploymentPlan) ([]mcir.TbSpecInfo, error)

// Info manage for MCIS recommendation

func RecommendVmCost added in v0.4.9

func RecommendVmCost(nsId string, specList *[]mcir.TbSpecInfo) ([]mcir.TbSpecInfo, error)

RecommendVmCost func prioritize specs based on given Cost

func RecommendVmLocation added in v0.3.7

func RecommendVmLocation(nsId string, specList *[]mcir.TbSpecInfo, param *[]ParameterKeyVal) ([]mcir.TbSpecInfo, error)

RecommendVmLocation func prioritize specs based on given location

func RecommendVmPerformance added in v0.4.17

func RecommendVmPerformance(nsId string, specList *[]mcir.TbSpecInfo) ([]mcir.TbSpecInfo, error)

RecommendVmPerformance func prioritize specs based on given Performance condition

func RemoteCommandToMcisVm added in v0.4.8

func RemoteCommandToMcisVm(nsId string, mcisId string, vmId string, req *McisCmdReq) (string, error)

RemoteCommandToMcisVm is func to command to a VM in MCIS by SSH

func RunRemoteCommand added in v0.4.8

func RunRemoteCommand(vmIP string, sshPort string, userName string, privateKey string, cmd string) (*string, error)

RunRemoteCommand is func to execute a SSH command to a VM (sync call)

func RunRemoteCommandAsync added in v0.4.8

func RunRemoteCommandAsync(wg *sync.WaitGroup, vmID string, vmIP string, sshPort string, userName string, privateKey string, cmd string, returnResult *[]SshCmdResult)

RunRemoteCommandAsync is func to execute a SSH command to a VM (async call)

func TbMcisCmdReqStructLevelValidation added in v0.4.7

func TbMcisCmdReqStructLevelValidation(sl validator.StructLevel)

TbMcisCmdReqStructLevelValidation is func to validate fields in McisCmdReq

func TbMcisReqStructLevelValidation added in v0.4.7

func TbMcisReqStructLevelValidation(sl validator.StructLevel)

TbMcisReqStructLevelValidation is func to validate fields in TbMcisReqStruct

func TbVmReqStructLevelValidation added in v0.4.7

func TbVmReqStructLevelValidation(sl validator.StructLevel)

TbVmReqStructLevelValidation is func to validate fields in TbVmReqStruct

func TrimIP added in v0.3.4

func TrimIP(sshAccessPoint string) (string, error)

func UpdateMcisInfo

func UpdateMcisInfo(nsId string, mcisInfoData TbMcisInfo)

UpdateMcisInfo is func to update MCIS Info (without VM info in MCIS)

func UpdateMcisPolicyInfo added in v0.2.8

func UpdateMcisPolicyInfo(nsId string, mcisPolicyInfoData McisPolicyInfo)

UpdateMcisPolicyInfo updates McisPolicyInfo object in DB.

func UpdateVmInfo

func UpdateVmInfo(nsId string, mcisId string, vmInfoData TbVmInfo)

UpdateVmInfo is func to update VM Info

func UpdateVmPublicIp

func UpdateVmPublicIp(nsId string, mcisId string, vmInfoData TbVmInfo) error

UpdateVmPublicIp is func to update VM public IP

func UpdateVmSshKey added in v0.3.4

func UpdateVmSshKey(nsId string, mcisId string, vmId string, verifiedUserName string) error

UpdateVmSshKey is func to update VM SShKey

func VerifySshUserName

func VerifySshUserName(nsId string, mcisId string, vmId string, vmIp string, sshPort string, givenUserName string) (string, string, error)

VerifySshUserName is func to verify SSH username

Types

type AgentInstallContent

type AgentInstallContent struct {
	McisId string `json:"mcisId"`
	VmId   string `json:"vmId"`
	VmIp   string `json:"vmIp"`
	Result string `json:"result"`
}

AgentInstallContent ...

type AgentInstallContentWrapper

type AgentInstallContentWrapper struct {
	ResultArray []AgentInstallContent `json:"resultArray"`
}

AgentInstallContentWrapper ...

func ConfigureCloudAdaptiveNetwork added in v0.5.1

func ConfigureCloudAdaptiveNetwork(nsId string, mcisId string, netReq *NetworkReq) (AgentInstallContentWrapper, error)

ConfigureCloudAdaptiveNetwork configures a cloud adaptive network to VMs in an MCIS

func InjectCloudInformationForCloudAdaptiveNetwork added in v0.5.4

func InjectCloudInformationForCloudAdaptiveNetwork(nsId string, mcisId string, netReq *NetworkReq) (AgentInstallContentWrapper, error)

InjectCloudInformationForCloudAdaptiveNetwork injects cloud information for a cloud adaptive network

func InstallMonitorAgentToMcis

func InstallMonitorAgentToMcis(nsId string, mcisId string, mcisServiceType string, req *McisCmdReq) (AgentInstallContentWrapper, error)

type AutoAction added in v0.2.8

type AutoAction struct {
	ActionType    string     `json:"actionType"`
	Vm            TbVmInfo   `json:"vm"`
	PostCommand   McisCmdReq `json:"postCommand"`
	PlacementAlgo string     `json:"placementAlgo"`
}

AutoAction is struct for MCIS auto-control action.

type AutoCondition added in v0.2.8

type AutoCondition struct {
	Metric           string   `json:"metric"`
	Operator         string   `json:"operator"`         // <, <=, >, >=, ...
	Operand          string   `json:"operand"`          // 10, 70, 80, 98, ...
	EvaluationPeriod string   `json:"evaluationPeriod"` // evaluationPeriod
	EvaluationValue  []string `json:"evaluationValue"`
}

AutoCondition is struct for MCIS auto-control condition.

type BenchmarkInfo

type BenchmarkInfo struct {
	Result      string          `json:"result"`
	Unit        string          `json:"unit"`
	Desc        string          `json:"desc"`
	Elapsed     string          `json:"elapsed"`
	SpecId      string          `json:"specid"`
	ResultArray []BenchmarkInfo `json:"resultarray"` // struct-element cycle ?
}

BenchmarkInfo is struct for BenchmarkInfo

type BenchmarkInfoArray

type BenchmarkInfoArray struct {
	ResultArray []BenchmarkInfo `json:"resultarray"`
}

BenchmarkInfoArray is struct for BenchmarkInfoArray

func BenchmarkAction

func BenchmarkAction(nsId string, mcisId string, action string, option string) (BenchmarkInfoArray, error)

BenchmarkAction is func to action Benchmark

func CoreGetBenchmark

func CoreGetBenchmark(nsId string, mcisId string, action string, host string) (*BenchmarkInfoArray, error)

CoreGetBenchmark is func to get Benchmark

func RunAllBenchmarks added in v0.4.11

func RunAllBenchmarks(nsId string, mcisId string, host string) (*BenchmarkInfoArray, error)

RunAllBenchmarks is func to get all Benchmarks

type BenchmarkReq

type BenchmarkReq struct {
	Host string `json:"host"`
	Spec string `json:"spec"`
}

BenchmarkReq is struct for BenchmarkReq

type CheckMcisDynamicReqInfo added in v0.5.3

type CheckMcisDynamicReqInfo struct {
	ReqCheck []CheckVmDynamicReqInfo `json:"reqCheck" validate:"required"`
}

CheckMcisDynamicReqInfo is struct to check requirements to create a new MCIS instance dynamically (with default resource option)

func CheckMcisDynamicReq added in v0.5.3

CheckMcisDynamicReq is func to check request info to create MCIS obeject and deploy requested VMs in a dynamic way

type CheckVmDynamicReqInfo added in v0.5.3

type CheckVmDynamicReqInfo struct {

	// ConnectionConfigCandidates will provide ConnectionConfig options
	ConnectionConfigCandidates []string `json:"connectionConfigCandidates" default:""`

	VmSpec mcir.TbSpecInfo `json:"vmSpec" default:""`
	Region common.Region   `json:"region" default:""`

	// Latest system message such as error message
	SystemMessage string `json:"systemMessage" example:"Failed because ..." default:""` // systeam-given string message

}

CheckVmDynamicReqInfo is struct to check requirements to create a new server instance dynamically (with default resource option)

type ControlVmResult

type ControlVmResult struct {
	VmId   string `json:"vmId"`
	Status string `json:"Status"`
	Error  error  `json:"Error"`
}

ControlVmResult is struct for result of VM control

type ControlVmResultWrapper

type ControlVmResultWrapper struct {
	ResultArray []ControlVmResult `json:"resultarray"`
}

ControlVmResultWrapper is struct for array of results of VM control

type DeploymentPlan added in v0.3.7

type DeploymentPlan struct {
	Filter   FilterInfo   `json:"filter"`
	Priority PriorityInfo `json:"priority"`
	Limit    string       `json:"limit" example:"5" enums:"1,2,...,30,..."`
}

DeploymentPlan is struct for .

type FilterCondition added in v0.3.7

type FilterCondition struct {
	Metric    string      `json:"metric" example:"cpu" enums:"cpu,memory,cost"`
	Condition []Operation `json:"condition"`
}

FilterCondition is struct for .

type FilterInfo added in v0.3.7

type FilterInfo struct {
	Policy []FilterCondition `json:"policy"`
}

FilterInfo is struct for .

type InspectResource added in v0.5.3

type InspectResource struct {
	ConnectionName   string                `json:"connectionName"`
	ResourceType     string                `json:"resourceType"`
	SystemMessage    string                `json:"systemMessage"`
	ResourceOverview resourceCountOverview `json:"resourceOverview"`
	Resources        resourcesByManageType `json:"resources"`
}

InspectResource is struct for InspectResource per Cloud Connection

func InspectResources added in v0.5.3

func InspectResources(connConfig string, resourceType string) (InspectResource, error)

InspectResources returns the state list of TB MCIR objects of given connConfig and resourceType

type InspectResourceAllResult added in v0.5.4

type InspectResourceAllResult struct {
	ElapsedTime          int                     `json:"elapsedTime"`
	RegisteredConnection int                     `json:"registeredConnection"`
	AvailableConnection  int                     `json:"availableConnection"`
	TumblebugOverview    inspectOverview         `json:"tumblebugOverview"`
	CspOnlyOverview      inspectOverview         `json:"cspOnlyOverview"`
	InspectResult        []InspectResourceResult `json:"inspectResult"`
}

InspectResourceAllResult is struct for Inspect Resource Result for All Clouds

func InspectResourcesOverview added in v0.5.4

func InspectResourcesOverview() (InspectResourceAllResult, error)

InspectResourcesOverview func is to check all resources in CB-TB and CSPs

type InspectResourceResult added in v0.5.4

type InspectResourceResult struct {
	ConnectionName    string          `json:"connectionName"`
	SystemMessage     string          `json:"systemMessage"`
	ElapsedTime       int             `json:"elapsedTime"`
	TumblebugOverview inspectOverview `json:"tumblebugOverview"`
	CspOnlyOverview   inspectOverview `json:"cspOnlyOverview"`
}

InspectResourceResult is struct for Inspect Resource Result

type McisCmdReq

type McisCmdReq struct {
	UserName string `json:"userName" example:"cb-user" default:""`
	Command  string `json:"command" validate:"required" example:"sudo apt-get install ..."`
}

McisCmdReq is struct for remote command

type McisConnectionConfigCandidatesReq added in v0.5.3

type McisConnectionConfigCandidatesReq struct {
	// CommonSpec is field for id of a spec in common namespace
	CommonSpecs []string `json:"commonSpec" validate:"required" example:"aws-ap-northeast-2-t2-small,gcp-us-west1-g1-small"`
}

McisConnectionConfigCandidatesReq is struct for a request to check requirements to create a new MCIS instance dynamically (with default resource option)

type McisPolicyInfo added in v0.2.8

type McisPolicyInfo struct {
	Name   string   `json:"Name"` //MCIS Name (for request)
	Id     string   `json:"Id"`   //MCIS Id (generated ID by the Name)
	Policy []Policy `json:"policy"`

	ActionLog   string `json:"actionLog"`
	Description string `json:"description"`
}

McisPolicyInfo is struct for MCIS auto-control Policy object.

func CreateMcisPolicy added in v0.2.8

func CreateMcisPolicy(nsId string, mcisId string, u *McisPolicyInfo) (McisPolicyInfo, error)

CreateMcisPolicy create McisPolicyInfo object in DB according to user's requirements.

func GetAllMcisPolicyObject added in v0.2.8

func GetAllMcisPolicyObject(nsId string) ([]McisPolicyInfo, error)

GetAllMcisPolicyObject returns all McisPolicyInfo objects.

func GetMcisPolicyObject added in v0.2.8

func GetMcisPolicyObject(nsId string, mcisId string) (McisPolicyInfo, error)

GetMcisPolicyObject returns McisPolicyInfo object.

type McisRecommendReq

type McisRecommendReq struct {
	VmReq          []TbVmRecommendReq `json:"vmReq"`
	PlacementAlgo  string             `json:"placementAlgo"`
	PlacementParam []common.KeyValue  `json:"placementParam"`
	MaxResultNum   string             `json:"maxResultNum"`
}

McisRecommendReq is struct for McisRecommendReq

type McisStatusInfo

type McisStatusInfo struct {
	Id   string `json:"id"`
	Name string `json:"name"`

	Status       string          `json:"status"`
	StatusCount  StatusCountInfo `json:"statusCount"`
	TargetStatus string          `json:"targetStatus"`
	TargetAction string          `json:"targetAction"`

	// InstallMonAgent Option for CB-Dragonfly agent installation ([yes/no] default:yes)
	InstallMonAgent string `json:"installMonAgent" example:"[yes, no]"` // yes or no

	MasterVmId    string `json:"masterVmId" example:"vm-asiaeast1-cb-01"`
	MasterIp      string `json:"masterIp" example:"32.201.134.113"`
	MasterSSHPort string `json:"masterSSHPort"`

	// Label is for describing the mcis in a keyword (any string can be used)
	Label string `json:"label" example:"User custom label"`

	// SystemLabel is for describing the mcis in a keyword (any string can be used) for special System purpose
	SystemLabel string `json:"systemLabel" example:"Managed by CB-Tumblebug" default:""`

	Vm []TbVmStatusInfo `json:"vm"`
}

McisStatusInfo is struct to define simple information of MCIS with updated status of all VMs

func GetMcisStatus

func GetMcisStatus(nsId string, mcisId string) (*McisStatusInfo, error)

GetMcisStatus is func to Get Mcis Status

func GetMcisStatusAll added in v0.2.8

func GetMcisStatusAll(nsId string) ([]McisStatusInfo, error)

GetMcisStatusAll is func to get MCIS status all

type MonAgentInstallReq

type MonAgentInstallReq struct {
	NsId     string `json:"nsId,omitempty"`
	McisId   string `json:"mcisId,omitempty"`
	VmId     string `json:"vmId,omitempty"`
	PublicIp string `json:"publicIp,omitempty"`
	Port     string `json:"port,omitempty"`
	UserName string `json:"userName,omitempty"`
	SshKey   string `json:"sshKey,omitempty"`
	CspType  string `json:"cspType,omitempty"`
}

MonAgentInstallReq struct

type MonResultSimple added in v0.2.8

type MonResultSimple struct {
	Metric string `json:"metric"`
	VmId   string `json:"vmId"`
	Value  string `json:"value"`
	Err    string `json:"err"`
}

MonResultSimple struct is for containing vm monitoring results

type MonResultSimpleResponse added in v0.2.8

type MonResultSimpleResponse struct {
	NsId           string            `json:"nsId"`
	McisId         string            `json:"mcisId"`
	McisMonitoring []MonResultSimple `json:"mcisMonitoring"`
}

MonResultSimpleResponse struct is for containing Mcis monitoring results

func GetMonitoringData

func GetMonitoringData(nsId string, mcisId string, metric string) (MonResultSimpleResponse, error)

GetMonitoringData func retrieves monitoring data from cb-dragonfly

type MultihostBenchmarkReq

type MultihostBenchmarkReq struct {
	Multihost []BenchmarkReq `json:"multihost"`
}

MultihostBenchmarkReq is struct for MultihostBenchmarkReq

type NetworkReq added in v0.5.1

type NetworkReq struct {
	ServiceEndpoint string   `json:"serviceEndpoint" example:"localhost:8053" default:""`
	EtcdEndpoints   []string `json:"etcdEndpoints" example:"PUBLIC_IP_1:2379,PUBLIC_IP_2:2379,..." default:""`
}

NetworkReq is a struct for a request to configure Cloud Adaptive Network

type Operation added in v0.3.7

type Operation struct {
	Operator string `json:"operator" example:"<=" enums:">=,<=,=="` // >=, <=, ==
	Operand  string `json:"operand" example:"4" enums:"4,8,.."`     // 10, 70, 80, 98, ...
}

Operation is struct for .

type ParameterKeyVal added in v0.3.7

type ParameterKeyVal struct {
	Key string   `json:"key" example:"coordinateClose" enums:"coordinateClose,coordinateWithin,coordinateFair"` // coordinate
	Val []string `json:"val" example:"44.146838/-116.411403"`                                                   // ["Latitude,Longitude","12,543",..,"31,433"]
}

Operation is struct for .

type Policy added in v0.2.8

type Policy struct {
	AutoCondition AutoCondition `json:"autoCondition"`
	AutoAction    AutoAction    `json:"autoAction"`
	Status        string        `json:"status"`
}

Policy is struct for MCIS auto-control Policy request that includes AutoCondition, AutoAction, Status.

type PriorityCondition added in v0.3.7

type PriorityCondition struct {
	Metric    string            `json:"metric" example:"location" enums:"location,cost,latency"` // location,cost,latency
	Weight    string            `json:"weight" example:"0.3" enums:"0.1,0.2,..."`                // 0.3
	Parameter []ParameterKeyVal `json:"parameter,omitempty"`
}

FilterCondition is struct for .

type PriorityInfo added in v0.3.7

type PriorityInfo struct {
	Policy []PriorityCondition `json:"policy"`
}

PriorityInfo is struct for .

type RegionInfo

type RegionInfo struct {
	Region string
	Zone   string
}

RegionInfo is struct for region information

type RegisterResourceAllResult added in v0.5.3

type RegisterResourceAllResult struct {
	ElapsedTime           int                      `json:"elapsedTime"`
	RegisteredConnection  int                      `json:"registeredConnection"`
	AvailableConnection   int                      `json:"availableConnection"`
	RegisterationOverview registerationOverview    `json:"registerationOverview"`
	RegisterationResult   []RegisterResourceResult `json:"registerationResult"`
}

RegisterResourceAllResult is struct for Register Csp Native Resource Result for All Clouds

func RegisterCspNativeResourcesAll added in v0.5.3

func RegisterCspNativeResourcesAll(nsId string, mcisId string, option string) (RegisterResourceAllResult, error)

RegisterCspNativeResourcesAll func registers all CSP-native resources into CB-TB

type RegisterResourceResult added in v0.5.3

type RegisterResourceResult struct {
	ConnectionName        string                `json:"connectionName"`
	SystemMessage         string                `json:"systemMessage"`
	ElapsedTime           int                   `json:"elapsedTime"`
	RegisterationOverview registerationOverview `json:"registerationOverview"`
	RegisterationOutputs  common.IdList         `json:"registerationOutputs"`
}

RegisterResourceResult is struct for Register Csp Native Resource Result

func RegisterCspNativeResources added in v0.5.3

func RegisterCspNativeResources(nsId string, connConfig string, mcisId string, option string) (RegisterResourceResult, error)

RegisterCspNativeResources func registers all CSP-native resources into CB-TB

type SpecBenchmarkInfo

type SpecBenchmarkInfo struct {
	SpecId     string `json:"specid"`
	Cpus       string `json:"cpus"`
	Cpum       string `json:"cpum"`
	MemR       string `json:"memR"`
	MemW       string `json:"memW"`
	FioR       string `json:"fioR"`
	FioW       string `json:"fioW"`
	DbR        string `json:"dbR"`
	DbW        string `json:"dbW"`
	Rtt        string `json:"rtt"`
	EvaledTime string `json:"evaledTime"`
}

SpecBenchmarkInfo is struct for SpecBenchmarkInfo

type SpiderAllList added in v0.3.6

type SpiderAllList struct {
	MappedList     []SpiderNameIdSystemId
	OnlySpiderList []SpiderNameIdSystemId
	OnlyCSPList    []SpiderNameIdSystemId
}

type SpiderAllListWrapper added in v0.3.6

type SpiderAllListWrapper struct {
	AllList SpiderAllList
}

type SpiderNameIdSystemId added in v0.3.6

type SpiderNameIdSystemId struct {
	NameId   string
	SystemId string
}

type SpiderVMInfo

type SpiderVMInfo struct {
	// Fields for request
	Name               string
	ImageName          string
	VPCName            string
	SubnetName         string
	SecurityGroupNames []string
	KeyPairName        string
	CSPid              string // VM ID given by CSP (required for registering VM)

	// Fields for both request and response
	VMSpecName   string // instance type or flavour, etc... ex) t2.micro or f1.micro
	VMUserId     string // ex) user1
	VMUserPasswd string
	RootDiskType string // "SSD(gp2)", "Premium SSD", ...
	RootDiskSize string // "default", "50", "1000" (GB)

	// Fields for response
	IId               common.IID // {NameId, SystemId}
	ImageIId          common.IID
	VpcIID            common.IID
	SubnetIID         common.IID   // AWS, ex) subnet-8c4a53e4
	SecurityGroupIIds []common.IID // AWS, ex) sg-0b7452563e1121bb6
	KeyPairIId        common.IID
	StartTime         time.Time  // Timezone: based on cloud-barista server location.
	Region            RegionInfo //  ex) {us-east1, us-east1-c} or {ap-northeast-2}
	NetworkInterface  string     // ex) eth0
	PublicIP          string
	PublicDNS         string
	PrivateIP         string
	PrivateDNS        string
	RootDeviceName    string // "/dev/sda1", ...
	VMBootDisk        string // Deprecated soon // ex) /dev/sda1
	VMBlockDisk       string // ex)
	SSHAccessPoint    string
	KeyValueList      []common.KeyValue
}

SpiderVMInfo is struct from CB-Spider for VM information

type SpiderVMReqInfoWrapper

type SpiderVMReqInfoWrapper struct {
	ConnectionName string
	ReqInfo        SpiderVMInfo
}

SpiderVMReqInfoWrapper is struct from CB-Spider (VMHandler.go) for wrapping SpiderVMInfo

type SshCmdResult

type SshCmdResult struct {
	McisId string `json:"mcisId"`
	VmId   string `json:"vmId"`
	VmIp   string `json:"vmIp"`
	Result string `json:"result"`
	Err    error  `json:"err"`
}

SshCmdResult is struct for SshCmd Result

func InstallBenchmarkAgentToMcis added in v0.4.9

func InstallBenchmarkAgentToMcis(nsId string, mcisId string, req *McisCmdReq) ([]SshCmdResult, error)

InstallBenchmarkAgentToMcis is func to install milkyway agents in MCIS

func RemoteCommandToMcis added in v0.4.8

func RemoteCommandToMcis(nsId string, mcisId string, req *McisCmdReq) ([]SshCmdResult, error)

RemoteCommandToMcis is func to command to all VMs in MCIS by SSH

type StatusCountInfo added in v0.4.7

type StatusCountInfo struct {

	// CountTotal is for Total VMs
	CountTotal int `json:"countTotal"`

	// CountCreating is for counting Creating
	CountCreating int `json:"countCreating"`

	// CountRunning is for counting Running
	CountRunning int `json:"countRunning"`

	// CountFailed is for counting Failed
	CountFailed int `json:"countFailed"`

	// CountSuspended is for counting Suspended
	CountSuspended int `json:"countSuspended"`

	// CountRebooting is for counting Rebooting
	CountRebooting int `json:"countRebooting"`

	// CountTerminated is for counting Terminated
	CountTerminated int `json:"countTerminated"`

	// CountSuspending is for counting Suspending
	CountSuspending int `json:"countSuspending"`

	// CountResuming is for counting Resuming
	CountResuming int `json:"countResuming"`

	// CountTerminating is for counting Terminating
	CountTerminating int `json:"countTerminating"`

	// CountUndefined is for counting Undefined
	CountUndefined int `json:"countUndefined"`
}

StatusCountInfo is struct to count the number of VMs in each status. ex: Running=4, Suspended=8.

type TbInspectResourcesResponse added in v0.3.6

type TbInspectResourcesResponse struct {
	InspectResources []InspectResource `json:"inspectResources"`
}

TbInspectResourcesResponse is struct for response of InspectResources request

type TbMcisDynamicReq added in v0.4.10

type TbMcisDynamicReq struct {
	Name string `json:"name" validate:"required" example:"mcis01"`

	// InstallMonAgent Option for CB-Dragonfly agent installation ([yes/no] default:yes)
	InstallMonAgent string `json:"installMonAgent" example:"no" default:"yes" enums:"yes,no"` // yes or no

	// Label is for describing the mcis in a keyword (any string can be used)
	Label string `json:"label" example:"DynamicVM" default:""`

	// SystemLabel is for describing the mcis in a keyword (any string can be used) for special System purpose
	SystemLabel string `json:"systemLabel" example:"" default:""`

	Description string `json:"description" example:"Made in CB-TB"`

	Vm []TbVmDynamicReq `json:"vm" validate:"required"`
}

TbMcisDynamicReq is sturct for requirements to create MCIS dynamically (with default resource option)

type TbMcisInfo

type TbMcisInfo struct {
	Id           string          `json:"id"`
	Name         string          `json:"name"`
	Status       string          `json:"status"`
	StatusCount  StatusCountInfo `json:"statusCount"`
	TargetStatus string          `json:"targetStatus"`
	TargetAction string          `json:"targetAction"`

	// InstallMonAgent Option for CB-Dragonfly agent installation ([yes/no] default:yes)
	InstallMonAgent string `json:"installMonAgent" example:"yes" default:"yes" enums:"yes,no"` // yes or no

	// ConfigureCloudAdaptiveNetwork is an option to configure Cloud Adaptive Network (CLADNet) ([yes/no] default:yes)
	ConfigureCloudAdaptiveNetwork string `json:"configureCloudAdaptiveNetwork" example:"yes" default:"no" enums:"yes,no"` // yes or no

	// Label is for describing the mcis in a keyword (any string can be used)
	Label string `json:"label" example:"User custom label"`

	// SystemLabel is for describing the mcis in a keyword (any string can be used) for special System purpose
	SystemLabel string `json:"systemLabel" example:"Managed by CB-Tumblebug" default:""`

	PlacementAlgo string     `json:"placementAlgo,omitempty"`
	Description   string     `json:"description"`
	Vm            []TbVmInfo `json:"vm"`
}

TbMcisInfo is struct for MCIS info

func CoreGetAllMcis

func CoreGetAllMcis(nsId string, option string) ([]TbMcisInfo, error)

CoreGetAllMcis is func to get all MCIS objects

func CreateMcis

func CreateMcis(nsId string, req *TbMcisReq, option string) (*TbMcisInfo, error)

CreateMcis is func to create MCIS obeject and deploy requested VMs (register CSP native VM with option=register)

func CreateMcisDynamic added in v0.4.10

func CreateMcisDynamic(nsId string, req *TbMcisDynamicReq) (*TbMcisInfo, error)

CreateMcisDynamic is func to create MCIS obeject and deploy requested VMs in a dynamic way

func CreateMcisGroupVm added in v0.3.4

func CreateMcisGroupVm(nsId string, mcisId string, vmRequest *TbVmReq) (*TbMcisInfo, error)

CreateMcisGroupVm is func to create MCIS groupVM

func GetMcisInfo added in v0.3.5

func GetMcisInfo(nsId string, mcisId string) (*TbMcisInfo, error)

GetMcisInfo is func to return MCIS information with the current status update

func GetMcisObject

func GetMcisObject(nsId string, mcisId string) (TbMcisInfo, error)

GetMcisObject is func to retrieve MCIS object from database (no current status update)

type TbMcisReq

type TbMcisReq struct {
	Name string `json:"name" validate:"required" example:"mcis01"`

	// InstallMonAgent Option for CB-Dragonfly agent installation ([yes/no] default:yes)
	InstallMonAgent string `json:"installMonAgent" example:"no" default:"yes" enums:"yes,no"` // yes or no

	// Label is for describing the mcis in a keyword (any string can be used)
	Label string `json:"label" example:"custom tag" default:""`

	// SystemLabel is for describing the mcis in a keyword (any string can be used) for special System purpose
	SystemLabel string `json:"systemLabel" example:"" default:""`

	PlacementAlgo string `json:"placementAlgo,omitempty"`
	Description   string `json:"description" example:"Made in CB-TB"`

	Vm []TbVmReq `json:"vm" validate:"required"`
}

TbMcisReq is sturct for requirements to create MCIS

type TbVmDynamicReq added in v0.4.10

type TbVmDynamicReq struct {
	// VM name or VM group name if is (not empty) && (> 0). If it is a group, actual VM name will be generated with -N postfix.
	Name string `json:"name" example:"vm01"`

	// if vmGroupSize is (not empty) && (> 0), VM group will be gernetad. VMs will be created accordingly.
	VmGroupSize string `json:"vmGroupSize" example:"3" default:""`

	Label string `json:"label" example:"DynamicVM"`

	Description string `json:"description" example:"Description"`

	// CommonSpec is field for id of a spec in common namespace
	CommonSpec string `json:"commonSpec" validate:"required" example:"aws-ap-northeast-2-t2-small"`
	// CommonImage is field for id of a image in common namespace
	CommonImage string `json:"commonImage" validate:"required" example:"ubuntu18.04"`

	RootDiskType string `json:"rootDiskType,omitempty" example:"default, TYPE1, ..."`  // "", "default", "TYPE1", AWS: ["standard", "gp2", "gp3"], Azure: ["PremiumSSD", "StandardSSD", "StandardHHD"], GCP: ["pd-standard", "pd-balanced", "pd-ssd", "pd-extreme"], ALIBABA: ["cloud_efficiency", "cloud", "cloud_essd"], TENCENT: ["CLOUD_PREMIUM", "CLOUD_SSD"]
	RootDiskSize string `json:"rootDiskSize,omitempty" example:"default, 30, 42, ..."` // "default", Integer (GB): ["50", ..., "1000"]

	// if ConnectionName is given, the VM tries to use associtated credential.
	// if not, it will use predefined ConnectionName in Spec objects
	ConnectionName string `json:"connectionName,omitempty" default:""`
}

TbVmDynamicReq is struct to get requirements to create a new server instance dynamically (with default resource option)

type TbVmGroupInfo added in v0.3.3

type TbVmGroupInfo struct {
	Id          string   `json:"id"`
	Name        string   `json:"name"`
	VmId        []string `json:"vmId"`
	VmGroupSize string   `json:"vmGroupSize"`
}

TbVmGroupInfo is struct to define an object that includes homogeneous VMs

type TbVmInfo

type TbVmInfo struct {
	Id      string `json:"id"`
	Name    string `json:"name"`
	IdByCSP string `json:"idByCSP"` // CSP managed ID or Name

	// defined if the VM is in a group
	VmGroupId string `json:"vmGroupId"`

	Location common.GeoLocation `json:"location"`

	// Required by CB-Tumblebug
	Status       string `json:"status"`
	TargetStatus string `json:"targetStatus"`
	TargetAction string `json:"targetAction"`

	// Montoring agent status
	MonAgentStatus string `json:"monAgentStatus" example:"[installed, notInstalled, failed]"` // yes or no// installed, notInstalled, failed

	// NetworkAgent status
	NetworkAgentStatus string `json:"networkAgentStatus" example:"[notInstalled, installing, installed, failed]"` // notInstalled, installing, installed, failed

	// Latest system message such as error message
	SystemMessage string `json:"systemMessage" example:"Failed because ..." default:""` // systeam-given string message

	// Created time
	CreatedTime string `json:"createdTime" example:"2022-11-10 23:00:00" default:""`

	Label       string `json:"label"`
	Description string `json:"description"`

	Region         RegionInfo `json:"region"` // AWS, ex) {us-east1, us-east1-c} or {ap-northeast-2}
	PublicIP       string     `json:"publicIP"`
	SSHPort        string     `json:"sshPort"`
	PublicDNS      string     `json:"publicDNS"`
	PrivateIP      string     `json:"privateIP"`
	PrivateDNS     string     `json:"privateDNS"`
	RootDiskType   string     `json:"rootDiskType"`
	RootDiskSize   string     `json:"rootDiskSize"`
	RootDeviceName string     `json:"rootDeviceName"`
	VMBootDisk     string     `json:"vmBootDisk"` // ex) /dev/sda1
	VMBlockDisk    string     `json:"vmBlockDisk"`

	ConnectionName   string   `json:"connectionName"`
	SpecId           string   `json:"specId"`
	ImageId          string   `json:"imageId"`
	VNetId           string   `json:"vNetId"`
	SubnetId         string   `json:"subnetId"`
	SecurityGroupIds []string `json:"securityGroupIds"`
	SshKeyId         string   `json:"sshKeyId"`
	VmUserAccount    string   `json:"vmUserAccount,omitempty"`
	VmUserPassword   string   `json:"vmUserPassword,omitempty"`

	CspViewVmDetail SpiderVMInfo `json:"cspViewVmDetail,omitempty"`
}

TbVmInfo is struct to define a server instance object

func CoreGetMcisVmInfo

func CoreGetMcisVmInfo(nsId string, mcisId string, vmId string) (*TbVmInfo, error)

CoreGetMcisVmInfo is func to Get McisVm Info

func CorePostMcisVm

func CorePostMcisVm(nsId string, mcisId string, vmInfoData *TbVmInfo) (*TbVmInfo, error)

CorePostMcisVm is func to post (create) McisVm

func GetVmObject

func GetVmObject(nsId string, mcisId string, vmId string) (TbVmInfo, error)

GetVmObject is func to get VM object

func GetVmTemplate added in v0.2.8

func GetVmTemplate(nsId string, mcisId string, algo string) (TbVmInfo, error)

GetVmTemplate is func to get VM template

type TbVmPriority

type TbVmPriority struct {
	Priority string          `json:"priority"`
	VmSpec   mcir.TbSpecInfo `json:"vmSpec"`
}

TbVmPriority is struct for TbVmPriority

func GetRecommendList

func GetRecommendList(nsId string, cpuSize string, memSize string, diskSize string) ([]TbVmPriority, error)

GetRecommendList is func to get recommendation list

type TbVmRecommendInfo

type TbVmRecommendInfo struct {
	VmReq          TbVmRecommendReq  `json:"vmReq"`
	VmPriority     []TbVmPriority    `json:"vmPriority"`
	PlacementAlgo  string            `json:"placementAlgo"`
	PlacementParam []common.KeyValue `json:"placementParam"`
}

TbVmRecommendInfo is struct for TbVmRecommendInfo

func CorePostMcisRecommend added in v0.3.8

func CorePostMcisRecommend(nsId string, req *McisRecommendReq) ([]TbVmRecommendInfo, error)

CorePostMcisRecommend is func to command to all VMs in MCIS with SSH

type TbVmRecommendReq

type TbVmRecommendReq struct {
	RequestName  string `json:"requestName"`
	MaxResultNum string `json:"maxResultNum"`

	VcpuSize   string `json:"vcpuSize"`
	MemorySize string `json:"memorySize"`
	DiskSize   string `json:"diskSize"`

	PlacementAlgo  string            `json:"placementAlgo"`
	PlacementParam []common.KeyValue `json:"placementParam"`
}

TbVmRecommendReq is struct for TbVmRecommendReq

type TbVmReq

type TbVmReq struct {
	// VM name or VM group name if is (not empty) && (> 0). If it is a group, actual VM name will be generated with -N postfix.
	Name string `json:"name" validate:"required" example:"vm01"`

	// CSP managed ID or Name (required for option=register)
	IdByCSP string `json:"idByCsp,omitempty" example:"i-014fa6ede6ada0b2c"`

	// if vmGroupSize is (not empty) && (> 0), VM group will be gernetad. VMs will be created accordingly.
	VmGroupSize string `json:"vmGroupSize" example:"3" default:""`

	Label string `json:"label"`

	Description string `json:"description" example:"Description"`

	ConnectionName   string   `json:"connectionName" validate:"required" example:"testcloud01-seoul"`
	SpecId           string   `json:"specId" validate:"required"`
	ImageId          string   `json:"imageId" validate:"required"`
	VNetId           string   `json:"vNetId" validate:"required"`
	SubnetId         string   `json:"subnetId" validate:"required"`
	SecurityGroupIds []string `json:"securityGroupIds" validate:"required"`
	SshKeyId         string   `json:"sshKeyId" validate:"required"`
	VmUserAccount    string   `json:"vmUserAccount,omitempty"`
	VmUserPassword   string   `json:"vmUserPassword,omitempty"`
	RootDiskType     string   `json:"rootDiskType,omitempty" example:"default, TYPE1, ..."`  // "", "default", "TYPE1", AWS: ["standard", "gp2", "gp3"], Azure: ["PremiumSSD", "StandardSSD", "StandardHHD"], GCP: ["pd-standard", "pd-balanced", "pd-ssd", "pd-extreme"], ALIBABA: ["cloud_efficiency", "cloud", "cloud_ssd"], TENCENT: ["CLOUD_PREMIUM", "CLOUD_SSD"]
	RootDiskSize     string   `json:"rootDiskSize,omitempty" example:"default, 30, 42, ..."` // "default", Integer (GB): ["50", ..., "1000"]
}

TbVmReq is struct to get requirements to create a new server instance

type TbVmStatusInfo

type TbVmStatusInfo struct {
	Id      string `json:"id"`
	Name    string `json:"name"`
	CspVmId string `json:"cspVmId"`

	Status       string `json:"status"`
	TargetStatus string `json:"targetStatus"`
	TargetAction string `json:"targetAction"`
	NativeStatus string `json:"nativeStatus"`

	// Montoring agent status
	MonAgentStatus string `json:"monAgentStatus" example:"[installed, notInstalled, failed]"` // yes or no// installed, notInstalled, failed

	// Latest system message such as error message
	SystemMessage string `json:"systemMessage" example:"Failed because ..." default:""` // systeam-given string message

	// Created time
	CreatedTime string `json:"createdTime" example:"2022-11-10 23:00:00" default:""`

	PublicIp  string `json:"publicIp"`
	PrivateIp string `json:"privateIp"`
	SSHPort   string `json:"sshPort"`

	Location common.GeoLocation `json:"location"`
}

TbVmStatusInfo is to define simple information of VM with updated status

func CoreGetMcisVmStatus

func CoreGetMcisVmStatus(nsId string, mcisId string, vmId string) (*TbVmStatusInfo, error)

CoreGetMcisVmStatus is func to Get McisVm Status

func GetVmCurrentPublicIp

func GetVmCurrentPublicIp(nsId string, mcisId string, vmId string) (TbVmStatusInfo, error)

GetVmCurrentPublicIp is func to get VM public IP

func GetVmStatus

func GetVmStatus(nsId string, mcisId string, vmId string) (TbVmStatusInfo, error)

GetVmStatus is func to get VM status

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL