Skip to content

Commit

Permalink
Merge pull request #148 from seokho-son/dev
Browse files Browse the repository at this point in the history
Add get mcis list with current status
  • Loading branch information
seokho-son committed May 17, 2020
2 parents eb28ad6 + 3404ea4 commit 336eb14
Showing 1 changed file with 27 additions and 5 deletions.
32 changes: 27 additions & 5 deletions src/mcis/control.go
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,8 @@ func RestGetMcis(c echo.Context) error {
func RestGetAllMcis(c echo.Context) error {

nsId := c.Param("nsId")
option := c.QueryParam("option")
fmt.Println("[Get MCIS List requested with option: " + option)

var content struct {
//Name string `json:"name"`
Expand All @@ -557,12 +559,19 @@ func RestGetAllMcis(c echo.Context) error {
mcisId := v
mcisTmp.Id = mcisId

mcisStatus, err := getMcisStatus(nsId, mcisId)
if err != nil {
cblog.Error(err)
return err

if option == "status" {
//get current mcis status
mcisStatus, err := getMcisStatus(nsId, mcisId)
if err != nil {
cblog.Error(err)
return err
}
mcisTmp.Status = mcisStatus.Status
} else {
//Set current mcis status with NullStr
mcisTmp.Status = ""
}
mcisTmp.Status = mcisStatus.Status

vmList, err := getVmList(nsId, mcisId)
if err != nil {
Expand All @@ -582,6 +591,19 @@ func RestGetAllMcis(c echo.Context) error {
vmTmp := vmOverview{}
json.Unmarshal([]byte(vmKeyValue.Value), &vmTmp)
vmTmp.Id = v1

if option == "status" {
//get current vm status
vmStatusInfoTmp, err := getVmStatus(nsId, mcisId, v1)
if err != nil {
cblog.Error(err)
}
vmTmp.Status = vmStatusInfoTmp.Status
} else {
//Set current vm status with NullStr
vmTmp.Status = ""
}

mcisTmp.Vm = append(mcisTmp.Vm, vmTmp)
}

Expand Down

0 comments on commit 336eb14

Please sign in to comment.