Skip to content

Commit

Permalink
Merge pull request #574 from nik-netlox/main
Browse files Browse the repository at this point in the history
BFD session add/del support added
  • Loading branch information
UltraInstinct14 authored Mar 5, 2024
2 parents aecb214 + 6c6143b commit dc45f71
Show file tree
Hide file tree
Showing 18 changed files with 1,552 additions and 29 deletions.
1 change: 1 addition & 0 deletions api/restapi/configure_loxilb_rest_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ func configureAPI(api *operations.LoxilbRestAPIAPI) http.Handler {
// BFD
api.GetConfigBfdAllHandler = operations.GetConfigBfdAllHandlerFunc(handler.ConfigGetBFDSession)
api.PostConfigBfdHandler = operations.PostConfigBfdHandlerFunc(handler.ConfigPostBFDSession)
api.DeleteConfigBfdRemoteIPRemoteIPHandler = operations.DeleteConfigBfdRemoteIPRemoteIPHandlerFunc(handler.ConfigDeleteBFDSession)

// Firewall
api.GetConfigFirewallAllHandler = operations.GetConfigFirewallAllHandlerFunc(handler.ConfigGetFW)
Expand Down
136 changes: 136 additions & 0 deletions api/restapi/embedded_spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 23 additions & 1 deletion api/restapi/handler/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func ConfigPostBFDSession(params operations.PostConfigBfdParams) middleware.Resp
bfdMod.Interval = params.Attr.Interval
bfdMod.RetryCount = params.Attr.RetryCount

tk.LogIt(tk.LogDebug, "[API] Instance %s BFD session update : %s, Interval: %d, RetryCount: %d\n",
tk.LogIt(tk.LogDebug, "[API] Instance %s BFD session add : %s, Interval: %d, RetryCount: %d\n",
bfdMod.Instance, bfdMod.RemoteIP, bfdMod.Interval, bfdMod.RetryCount)
_, err := ApiHooks.NetBFDAdd(&bfdMod)
if err != nil {
Expand All @@ -109,3 +109,25 @@ func ConfigPostBFDSession(params operations.PostConfigBfdParams) middleware.Resp
}
return &ResultResponse{Result: "Success"}
}

func ConfigDeleteBFDSession(params operations.DeleteConfigBfdRemoteIPRemoteIPParams) middleware.Responder {
tk.LogIt(tk.LogDebug, "[API] HA %s API called. url : %s\n", params.HTTPRequest.Method, params.HTTPRequest.URL)

var bfdMod cmn.BFDMod

// Delete BFD Session
if params.Instance != nil {
bfdMod.Instance = *params.Instance
}

bfdMod.RemoteIP = net.ParseIP(params.RemoteIP)

tk.LogIt(tk.LogDebug, "[API] Instance %s BFD session delete : %s\n",
bfdMod.Instance, bfdMod.RemoteIP)
_, err := ApiHooks.NetBFDDel(&bfdMod)
if err != nil {
tk.LogIt(tk.LogDebug, "[API] Error occur : %v\n", err)
return &ResultResponse{Result: err.Error()}
}
return &ResultResponse{Result: "Success"}
}
58 changes: 58 additions & 0 deletions api/restapi/operations/delete_config_bfd_remote_ip.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

101 changes: 101 additions & 0 deletions api/restapi/operations/delete_config_bfd_remote_ip_parameters.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit dc45f71

Please sign in to comment.