Skip to content

Commit

Permalink
Merge pull request #1100 from yunkon-kim/add-and-update-API
Browse files Browse the repository at this point in the history
Add and update cb-network APIs
  • Loading branch information
seokho-son authored May 10, 2022
2 parents bf7229a + c709369 commit fa25285
Show file tree
Hide file tree
Showing 5 changed files with 336 additions and 46 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ replace (
require (
github.com/bramvdbogaerde/go-scp v1.0.0
github.com/cloud-barista/cb-dragonfly v0.4.4
github.com/cloud-barista/cb-larva v0.0.13
github.com/cloud-barista/cb-larva v0.0.14
github.com/cloud-barista/cb-log v0.5.0
github.com/cloud-barista/cb-spider v0.4.19
github.com/cloud-barista/cb-store v0.5.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ github.com/cloud-barista/cb-larva v0.0.10 h1:twi6txmAhXpsji4bCrzVKgGi1x0gwr1q8wj
github.com/cloud-barista/cb-larva v0.0.10/go.mod h1:Awo2l9VpeTfzjx6GhnAthtEMBEmhFZYvmN/GXpEuMK0=
github.com/cloud-barista/cb-larva v0.0.13 h1:AObvwtK+IY6U2mhZrDs6zhYP9c2I6ciTIqMXhQPmJt4=
github.com/cloud-barista/cb-larva v0.0.13/go.mod h1:5vFk/GaTodU5rLsN92syam+YXT5IBdowgvG3UjsyFAQ=
github.com/cloud-barista/cb-larva v0.0.14 h1:F6uyBrZH98pPMUGx7dwiCsbAVIwnnnEdc1rXrw3u99w=
github.com/cloud-barista/cb-larva v0.0.14/go.mod h1:5vFk/GaTodU5rLsN92syam+YXT5IBdowgvG3UjsyFAQ=
github.com/cloud-barista/cb-log v0.3.1/go.mod h1:C0KNV97sw8IoLSlNuSiCGDQIuS/wXJaZWV/6MOwc20c=
github.com/cloud-barista/cb-log v0.4.0/go.mod h1:C0KNV97sw8IoLSlNuSiCGDQIuS/wXJaZWV/6MOwc20c=
github.com/cloud-barista/cb-log v0.5.0 h1:WoUnXtNNNTA7wRgQa6sFNs57O3mLAOrh4aDHC4cU0CI=
Expand Down
36 changes: 14 additions & 22 deletions src/api/rest/server/mcis/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,47 +53,39 @@ func RestPostConfigureCloudAdaptiveNetworkToMcis(c echo.Context) error {

}

// mcisTmpSystemLabel := mcis.DefaultSystemLabel
// content, err := mcis.InstallMonitorAgentToMcis(nsId, mcisId, mcisTmpSystemLabel, req)
// if err != nil {
// common.CBLog.Error(err)
// return err
// }

return c.JSON(http.StatusOK, contents)
}

/*
// RestGetMonitorData godoc
// @Summary Get monitoring data of specified MCIS for specified monitoring metric (cpu, memory, disk, network)
// @Description Get monitoring data of specified MCIS for specified monitoring metric (cpu, memory, disk, network)
// @Tags [Infra service] MCIS Resource monitor (for developer)
// RestPutInjectCloudInformationForCloudAdaptiveNetwork godoc
// @Summary Inject Cloud Information For Cloud Adaptive Network
// @Description Inject Cloud Information For Cloud Adaptive Network
// @Tags [Infra service] MCIS Cloud Adaptive Network (for developer)
// @Accept json
// @Produce json
// @Param nsId path string true "Namespace ID" default(ns01)
// @Param mcisId path string true "MCIS ID" default(mcis01)
// @Param metric path string true "Metric type: cpu, memory, disk, network"
// @Success 200 {object} mcis.MonResultSimpleResponse
// @Param networkReq body mcis.NetworkReq true "Details for the network request body"
// @Success 200 {object} mcis.AgentInstallContentWrapper
// @Failure 404 {object} common.SimpleMsg
// @Failure 500 {object} common.SimpleMsg
// @Router /ns/{nsId}/monitoring/mcis/{mcisId}/metric/{metric} [get]
func RestGetMonitorData(c echo.Context) error {
// @Router /ns/{nsId}/network/mcis/{mcisId} [put]
func RestPutInjectCloudInformationForCloudAdaptiveNetwork(c echo.Context) error {

nsId := c.Param("nsId")
mcisId := c.Param("mcisId")
metric := c.Param("metric")

req := &mcis.McisCmdReq{}
if err := c.Bind(req); err != nil {
netReq := &mcis.NetworkReq{}
if err := c.Bind(netReq); err != nil {
return err
}

content, err := mcis.GetMonitoringData(nsId, mcisId, metric)
contents, err := mcis.InjectCloudInformationForCloudAdaptiveNetwork(nsId, mcisId, netReq)

if err != nil {
common.CBLog.Error(err)
return err

}

return c.JSON(http.StatusOK, content)
return c.JSON(http.StatusOK, contents)
}
*/
1 change: 1 addition & 0 deletions src/api/rest/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ func RunServer(port string) {

// MCIS Cloud Adaptive Network (for developer)
g.POST("/:nsId/network/mcis/:mcisId", rest_mcis.RestPostConfigureCloudAdaptiveNetworkToMcis)
g.PUT("/:nsId/network/mcis/:mcisId", rest_mcis.RestPutInjectCloudInformationForCloudAdaptiveNetwork)

//MCIR Management
g.POST("/:nsId/resources/image", rest_mcir.RestPostImage)
Expand Down
Loading

0 comments on commit fa25285

Please sign in to comment.