diff --git a/src/api/rest/docs/docs.go b/src/api/rest/docs/docs.go index ff9524cc5..a6c4d618d 100644 --- a/src/api/rest/docs/docs.go +++ b/src/api/rest/docs/docs.go @@ -8693,6 +8693,9 @@ const docTemplate = `{ "mcisId": { "type": "string" }, + "mcisNlbListener": { + "$ref": "#/definitions/mcis.McisAccessInfo" + }, "mcisSubGroupAccessInfo": { "type": "array", "items": { diff --git a/src/api/rest/docs/swagger.json b/src/api/rest/docs/swagger.json index f6c21046e..ccfb82479 100644 --- a/src/api/rest/docs/swagger.json +++ b/src/api/rest/docs/swagger.json @@ -8685,6 +8685,9 @@ "mcisId": { "type": "string" }, + "mcisNlbListener": { + "$ref": "#/definitions/mcis.McisAccessInfo" + }, "mcisSubGroupAccessInfo": { "type": "array", "items": { diff --git a/src/api/rest/docs/swagger.yaml b/src/api/rest/docs/swagger.yaml index f575b5f9a..232258e32 100644 --- a/src/api/rest/docs/swagger.yaml +++ b/src/api/rest/docs/swagger.yaml @@ -1179,6 +1179,8 @@ definitions: properties: mcisId: type: string + mcisNlbListener: + $ref: '#/definitions/mcis.McisAccessInfo' mcisSubGroupAccessInfo: items: $ref: '#/definitions/mcis.McisSubGroupAccessInfo' diff --git a/src/core/mcis/manageInfo.go b/src/core/mcis/manageInfo.go index 536e064b8..712efdb76 100644 --- a/src/core/mcis/manageInfo.go +++ b/src/core/mcis/manageInfo.go @@ -348,11 +348,18 @@ func GetMcisAccessInfo(nsId string, mcisId string, option string) (*McisAccessIn } output.McisId = mcisId + + mcNlbAccess, err := GetMcNlbAccess(nsId, mcisId) + if err == nil { + output.McisNlbListener = mcNlbAccess + } + subGroupList, err := ListSubGroupId(nsId, mcisId) if err != nil { common.CBLog.Error(err) return temp, err } + // TODO: make in parallel for _, groupId := range subGroupList { subGroupAccessInfo := McisSubGroupAccessInfo{} subGroupAccessInfo.SubGroupId = groupId diff --git a/src/core/mcis/nlb.go b/src/core/mcis/nlb.go index 1db6d671b..71b2fc9e6 100644 --- a/src/core/mcis/nlb.go +++ b/src/core/mcis/nlb.go @@ -30,6 +30,8 @@ import ( "github.com/go-resty/resty/v2" ) +const nlbPostfix = "-nlb" + // 2022-07-15 https://github.com/cloud-barista/cb-spider/blob/master/cloud-control-manager/cloud-driver/interfaces/resources/NLBHandler.go // SpiderNLBReqInfoWrapper is a wrapper struct to create JSON body of 'Create NLB request' @@ -288,7 +290,6 @@ func CreateMcSwNlb(nsId string, mcisId string, req *TbNLBReq, option string) (Tb return emptyObj, err } - nlbPostfix := "-nlb" nlbMcisId := mcisId + nlbPostfix // create a special MCIS for (SW)NLB @@ -780,6 +781,12 @@ func GetNLB(nsId string, mcisId string, resourceId string) (TbNLBInfo, error) { return res, err } +// GetMcNlbAccess returns the requested TB G-NLB access info (currenly MCIS) +func GetMcNlbAccess(nsId string, mcisId string) (*McisAccessInfo, error) { + nlbMcisId := mcisId + nlbPostfix + return GetMcisAccessInfo(nsId, nlbMcisId, "") +} + // CheckNLB returns the existence of the TB NLB object in bool form. func CheckNLB(nsId string, mcisId string, resourceId string) (bool, error) { diff --git a/src/core/mcis/provisioning.go b/src/core/mcis/provisioning.go index 763866706..517b77c71 100644 --- a/src/core/mcis/provisioning.go +++ b/src/core/mcis/provisioning.go @@ -414,6 +414,7 @@ type TbVmInfo struct { // McisAccessInfo is struct to retrieve overall access information of a MCIS type McisAccessInfo struct { McisId string + McisNlbListener *McisAccessInfo `json:"mcisNlbListener,omitempty"` McisSubGroupAccessInfo []McisSubGroupAccessInfo }