From 766c22fd0534ff8b8e6d97e5bd7edcd5d8a2bc0f Mon Sep 17 00:00:00 2001 From: manjunath-batakurki Date: Fri, 16 Feb 2024 04:44:44 -0800 Subject: [PATCH 1/3] Refresh NSX Network integration --- pkg/client/router.go | 21 +++++++++++++++++++++ pkg/common/constants.go | 1 + 2 files changed, 22 insertions(+) diff --git a/pkg/client/router.go b/pkg/client/router.go index 6a6fe35..37a290f 100644 --- a/pkg/client/router.go +++ b/pkg/client/router.go @@ -156,6 +156,27 @@ func (r *RouterAPIService) GetNetworkServices( return routerResp, err } +func (r *RouterAPIService) RefreshNetworkServices( + ctx context.Context, + serverID int, + queryParams map[string]string, +) (models.SuccessOrErrorMessage, error) { + serverResp := models.SuccessOrErrorMessage{} + serverAPI := &api{ + compatibleVersion: "6.0.5", + method: "POST", + path: fmt.Sprintf("%s/%s/%d/%s", consts.NetworksPath, + consts.NetworkServicePath, serverID, consts.RefreshPath), + client: r.Client, + jsonParser: func(body []byte) error { + return json.Unmarshal(body, &serverResp) + }, + } + err := serverAPI.do(ctx, nil, queryParams) + + return serverResp, err +} + func (r *RouterAPIService) CreateRouterNat( ctx context.Context, routerID int, diff --git a/pkg/common/constants.go b/pkg/common/constants.go index fe28a7d..fe0fc67 100644 --- a/pkg/common/constants.go +++ b/pkg/common/constants.go @@ -57,6 +57,7 @@ const ( RouterBgpNeighborPath = "bgp-neighbors" NetworkEdgeClusterPath = "edge-clusters" DhcpServerPath = "dhcp-servers" + RefreshPath = "refresh" // Whoami Path WhoamiPath = "whoami" LBSSLCertificatesPath = "certificates" From 2d91386aad411740d3f020d29d255b3771274f2e Mon Sep 17 00:00:00 2001 From: manjunath-batakurki Date: Fri, 16 Feb 2024 09:56:30 -0800 Subject: [PATCH 2/3] Refresh NSX Network integration --- pkg/client/router.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/client/router.go b/pkg/client/router.go index 37a290f..ff83b7d 100644 --- a/pkg/client/router.go +++ b/pkg/client/router.go @@ -166,7 +166,7 @@ func (r *RouterAPIService) RefreshNetworkServices( compatibleVersion: "6.0.5", method: "POST", path: fmt.Sprintf("%s/%s/%d/%s", consts.NetworksPath, - consts.NetworkServicePath, serverID, consts.RefreshPath), + consts.ServerPath, serverID, consts.RefreshPath), client: r.Client, jsonParser: func(body []byte) error { return json.Unmarshal(body, &serverResp) From d3fd34534f59f4020c498b56d7cc8f1cc86d6c4e Mon Sep 17 00:00:00 2001 From: manjunath-batakurki Date: Fri, 23 Feb 2024 00:46:52 -0800 Subject: [PATCH 3/3] address comments --- pkg/client/router.go | 2 +- pkg/common/constants.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/client/router.go b/pkg/client/router.go index ff83b7d..3265d5c 100644 --- a/pkg/client/router.go +++ b/pkg/client/router.go @@ -163,7 +163,7 @@ func (r *RouterAPIService) RefreshNetworkServices( ) (models.SuccessOrErrorMessage, error) { serverResp := models.SuccessOrErrorMessage{} serverAPI := &api{ - compatibleVersion: "6.0.5", + compatibleVersion: consts.CMPSixZeroFiveVersion, method: "POST", path: fmt.Sprintf("%s/%s/%d/%s", consts.NetworksPath, consts.ServerPath, serverID, consts.RefreshPath), diff --git a/pkg/common/constants.go b/pkg/common/constants.go index fe0fc67..f19e26b 100644 --- a/pkg/common/constants.go +++ b/pkg/common/constants.go @@ -64,4 +64,7 @@ const ( // headers ContentType = "application/json" + + // Morpheus version + CMPSixZeroFiveVersion = "6.0.5" )