summaryrefslogtreecommitdiffstats
path: root/binapi/dhcp
diff options
context:
space:
mode:
authorOndrej Fabry <ofabry@cisco.com>2020-10-02 16:36:32 +0200
committerOndrej Fabry <ofabry@cisco.com>2020-10-02 16:36:32 +0200
commitc2456559a66107441addb96f673191bde09d6977 (patch)
tree30020a936849f78f432cf5b6fe0bbb0489e485b6 /binapi/dhcp
parentf751f3f845ef56bbcdb873d81a1c6edbc5a87853 (diff)
Check retval value and convert to error in generated RPC client code
Change-Id: I816b4802cb5fc46239f6db0480fa4cf3645fe2f0 Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
Diffstat (limited to 'binapi/dhcp')
-rw-r--r--binapi/dhcp/dhcp.ba.go4
-rw-r--r--binapi/dhcp/dhcp_rest.ba.go249
-rw-r--r--binapi/dhcp/dhcp_rpc.ba.go22
3 files changed, 13 insertions, 262 deletions
diff --git a/binapi/dhcp/dhcp.ba.go b/binapi/dhcp/dhcp.ba.go
index 4adc88b..db84847 100644
--- a/binapi/dhcp/dhcp.ba.go
+++ b/binapi/dhcp/dhcp.ba.go
@@ -1,7 +1,7 @@
// Code generated by GoVPP's binapi-generator. DO NOT EDIT.
// versions:
-// binapi-generator: v0.4.0-dev
-// VPP: 20.05-release
+// binapi-generator: v0.4.0
+// VPP: 20.05.1-release
// source: /usr/share/vpp/api/plugins/dhcp.api.json
// Package dhcp contains generated bindings for API file dhcp.api.
diff --git a/binapi/dhcp/dhcp_rest.ba.go b/binapi/dhcp/dhcp_rest.ba.go
deleted file mode 100644
index 4a4d9d1..0000000
--- a/binapi/dhcp/dhcp_rest.ba.go
+++ /dev/null
@@ -1,249 +0,0 @@
-// Code generated by GoVPP's binapi-generator. DO NOT EDIT.
-
-package dhcp
-
-import (
- "encoding/json"
- "io/ioutil"
- "net/http"
-)
-
-func RESTHandler(rpc RPCService) http.Handler {
- mux := http.NewServeMux()
- mux.HandleFunc("/dhcp6_clients_enable_disable", func(w http.ResponseWriter, req *http.Request) {
- var request = new(DHCP6ClientsEnableDisable)
- b, err := ioutil.ReadAll(req.Body)
- if err != nil {
- http.Error(w, "read body failed", http.StatusBadRequest)
- return
- }
- if err := json.Unmarshal(b, request); err != nil {
- http.Error(w, "unmarshal data failed", http.StatusBadRequest)
- return
- }
- reply, err := rpc.DHCP6ClientsEnableDisable(req.Context(), request)
- if err != nil {
- http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
- return
- }
- rep, err := json.MarshalIndent(reply, "", " ")
- if err != nil {
- http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
- return
- }
- w.Write(rep)
- })
- mux.HandleFunc("/dhcp6_duid_ll_set", func(w http.ResponseWriter, req *http.Request) {
- var request = new(DHCP6DuidLlSet)
- b, err := ioutil.ReadAll(req.Body)
- if err != nil {
- http.Error(w, "read body failed", http.StatusBadRequest)
- return
- }
- if err := json.Unmarshal(b, request); err != nil {
- http.Error(w, "unmarshal data failed", http.StatusBadRequest)
- return
- }
- reply, err := rpc.DHCP6DuidLlSet(req.Context(), request)
- if err != nil {
- http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
- return
- }
- rep, err := json.MarshalIndent(reply, "", " ")
- if err != nil {
- http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
- return
- }
- w.Write(rep)
- })
- mux.HandleFunc("/dhcp6_pd_send_client_message", func(w http.ResponseWriter, req *http.Request) {
- var request = new(DHCP6PdSendClientMessage)
- b, err := ioutil.ReadAll(req.Body)
- if err != nil {
- http.Error(w, "read body failed", http.StatusBadRequest)
- return
- }
- if err := json.Unmarshal(b, request); err != nil {
- http.Error(w, "unmarshal data failed", http.StatusBadRequest)
- return
- }
- reply, err := rpc.DHCP6PdSendClientMessage(req.Context(), request)
- if err != nil {
- http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
- return
- }
- rep, err := json.MarshalIndent(reply, "", " ")
- if err != nil {
- http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
- return
- }
- w.Write(rep)
- })
- mux.HandleFunc("/dhcp6_send_client_message", func(w http.ResponseWriter, req *http.Request) {
- var request = new(DHCP6SendClientMessage)
- b, err := ioutil.ReadAll(req.Body)
- if err != nil {
- http.Error(w, "read body failed", http.StatusBadRequest)
- return
- }
- if err := json.Unmarshal(b, request); err != nil {
- http.Error(w, "unmarshal data failed", http.StatusBadRequest)
- return
- }
- reply, err := rpc.DHCP6SendClientMessage(req.Context(), request)
- if err != nil {
- http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
- return
- }
- rep, err := json.MarshalIndent(reply, "", " ")
- if err != nil {
- http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
- return
- }
- w.Write(rep)
- })
- mux.HandleFunc("/dhcp_client_config", func(w http.ResponseWriter, req *http.Request) {
- var request = new(DHCPClientConfig)
- b, err := ioutil.ReadAll(req.Body)
- if err != nil {
- http.Error(w, "read body failed", http.StatusBadRequest)
- return
- }
- if err := json.Unmarshal(b, request); err != nil {
- http.Error(w, "unmarshal data failed", http.StatusBadRequest)
- return
- }
- reply, err := rpc.DHCPClientConfig(req.Context(), request)
- if err != nil {
- http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
- return
- }
- rep, err := json.MarshalIndent(reply, "", " ")
- if err != nil {
- http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
- return
- }
- w.Write(rep)
- })
- mux.HandleFunc("/dhcp_plugin_control_ping", func(w http.ResponseWriter, req *http.Request) {
- var request = new(DHCPPluginControlPing)
- reply, err := rpc.DHCPPluginControlPing(req.Context(), request)
- if err != nil {
- http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
- return
- }
- rep, err := json.MarshalIndent(reply, "", " ")
- if err != nil {
- http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
- return
- }
- w.Write(rep)
- })
- mux.HandleFunc("/dhcp_plugin_get_version", func(w http.ResponseWriter, req *http.Request) {
- var request = new(DHCPPluginGetVersion)
- reply, err := rpc.DHCPPluginGetVersion(req.Context(), request)
- if err != nil {
- http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
- return
- }
- rep, err := json.MarshalIndent(reply, "", " ")
- if err != nil {
- http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
- return
- }
- w.Write(rep)
- })
- mux.HandleFunc("/dhcp_proxy_config", func(w http.ResponseWriter, req *http.Request) {
- var request = new(DHCPProxyConfig)
- b, err := ioutil.ReadAll(req.Body)
- if err != nil {
- http.Error(w, "read body failed", http.StatusBadRequest)
- return
- }
- if err := json.Unmarshal(b, request); err != nil {
- http.Error(w, "unmarshal data failed", http.StatusBadRequest)
- return
- }
- reply, err := rpc.DHCPProxyConfig(req.Context(), request)
- if err != nil {
- http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
- return
- }
- rep, err := json.MarshalIndent(reply, "", " ")
- if err != nil {
- http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
- return
- }
- w.Write(rep)
- })
- mux.HandleFunc("/dhcp_proxy_set_vss", func(w http.ResponseWriter, req *http.Request) {
- var request = new(DHCPProxySetVss)
- b, err := ioutil.ReadAll(req.Body)
- if err != nil {
- http.Error(w, "read body failed", http.StatusBadRequest)
- return
- }
- if err := json.Unmarshal(b, request); err != nil {
- http.Error(w, "unmarshal data failed", http.StatusBadRequest)
- return
- }
- reply, err := rpc.DHCPProxySetVss(req.Context(), request)
- if err != nil {
- http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
- return
- }
- rep, err := json.MarshalIndent(reply, "", " ")
- if err != nil {
- http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
- return
- }
- w.Write(rep)
- })
- mux.HandleFunc("/want_dhcp6_pd_reply_events", func(w http.ResponseWriter, req *http.Request) {
- var request = new(WantDHCP6PdReplyEvents)
- b, err := ioutil.ReadAll(req.Body)
- if err != nil {
- http.Error(w, "read body failed", http.StatusBadRequest)
- return
- }
- if err := json.Unmarshal(b, request); err != nil {
- http.Error(w, "unmarshal data failed", http.StatusBadRequest)
- return
- }
- reply, err := rpc.WantDHCP6PdReplyEvents(req.Context(), request)
- if err != nil {
- http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
- return
- }
- rep, err := json.MarshalIndent(reply, "", " ")
- if err != nil {
- http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
- return
- }
- w.Write(rep)
- })
- mux.HandleFunc("/want_dhcp6_reply_events", func(w http.ResponseWriter, req *http.Request) {
- var request = new(WantDHCP6ReplyEvents)
- b, err := ioutil.ReadAll(req.Body)
- if err != nil {
- http.Error(w, "read body failed", http.StatusBadRequest)
- return
- }
- if err := json.Unmarshal(b, request); err != nil {
- http.Error(w, "unmarshal data failed", http.StatusBadRequest)
- return
- }
- reply, err := rpc.WantDHCP6ReplyEvents(req.Context(), request)
- if err != nil {
- http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
- return
- }
- rep, err := json.MarshalIndent(reply, "", " ")
- if err != nil {
- http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
- return
- }
- w.Write(rep)
- })
- return http.HandlerFunc(mux.ServeHTTP)
-}
diff --git a/binapi/dhcp/dhcp_rpc.ba.go b/binapi/dhcp/dhcp_rpc.ba.go
index 384fc9a..6309d8e 100644
--- a/binapi/dhcp/dhcp_rpc.ba.go
+++ b/binapi/dhcp/dhcp_rpc.ba.go
@@ -11,7 +11,7 @@ import (
vpe "git.fd.io/govpp.git/binapi/vpe"
)
-// RPCService defines RPC service dhcp.
+// RPCService defines RPC service dhcp.
type RPCService interface {
DHCP6ClientsEnableDisable(ctx context.Context, in *DHCP6ClientsEnableDisable) (*DHCP6ClientsEnableDisableReply, error)
DHCP6DuidLlSet(ctx context.Context, in *DHCP6DuidLlSet) (*DHCP6DuidLlSetReply, error)
@@ -42,7 +42,7 @@ func (c *serviceClient) DHCP6ClientsEnableDisable(ctx context.Context, in *DHCP6
if err != nil {
return nil, err
}
- return out, nil
+ return out, api.RetvalToVPPApiError(out.Retval)
}
func (c *serviceClient) DHCP6DuidLlSet(ctx context.Context, in *DHCP6DuidLlSet) (*DHCP6DuidLlSetReply, error) {
@@ -51,7 +51,7 @@ func (c *serviceClient) DHCP6DuidLlSet(ctx context.Context, in *DHCP6DuidLlSet)
if err != nil {
return nil, err
}
- return out, nil
+ return out, api.RetvalToVPPApiError(out.Retval)
}
func (c *serviceClient) DHCP6PdSendClientMessage(ctx context.Context, in *DHCP6PdSendClientMessage) (*DHCP6PdSendClientMessageReply, error) {
@@ -60,7 +60,7 @@ func (c *serviceClient) DHCP6PdSendClientMessage(ctx context.Context, in *DHCP6P
if err != nil {
return nil, err
}
- return out, nil
+ return out, api.RetvalToVPPApiError(out.Retval)
}
func (c *serviceClient) DHCP6SendClientMessage(ctx context.Context, in *DHCP6SendClientMessage) (*DHCP6SendClientMessageReply, error) {
@@ -69,7 +69,7 @@ func (c *serviceClient) DHCP6SendClientMessage(ctx context.Context, in *DHCP6Sen
if err != nil {
return nil, err
}
- return out, nil
+ return out, api.RetvalToVPPApiError(out.Retval)
}
func (c *serviceClient) DHCPClientConfig(ctx context.Context, in *DHCPClientConfig) (*DHCPClientConfigReply, error) {
@@ -78,7 +78,7 @@ func (c *serviceClient) DHCPClientConfig(ctx context.Context, in *DHCPClientConf
if err != nil {
return nil, err
}
- return out, nil
+ return out, api.RetvalToVPPApiError(out.Retval)
}
func (c *serviceClient) DHCPClientDump(ctx context.Context, in *DHCPClientDump) (RPCService_DHCPClientDumpClient, error) {
@@ -126,7 +126,7 @@ func (c *serviceClient) DHCPPluginControlPing(ctx context.Context, in *DHCPPlugi
if err != nil {
return nil, err
}
- return out, nil
+ return out, api.RetvalToVPPApiError(out.Retval)
}
func (c *serviceClient) DHCPPluginGetVersion(ctx context.Context, in *DHCPPluginGetVersion) (*DHCPPluginGetVersionReply, error) {
@@ -144,7 +144,7 @@ func (c *serviceClient) DHCPProxyConfig(ctx context.Context, in *DHCPProxyConfig
if err != nil {
return nil, err
}
- return out, nil
+ return out, api.RetvalToVPPApiError(out.Retval)
}
func (c *serviceClient) DHCPProxyDump(ctx context.Context, in *DHCPProxyDump) (RPCService_DHCPProxyDumpClient, error) {
@@ -192,7 +192,7 @@ func (c *serviceClient) DHCPProxySetVss(ctx context.Context, in *DHCPProxySetVss
if err != nil {
return nil, err
}
- return out, nil
+ return out, api.RetvalToVPPApiError(out.Retval)
}
func (c *serviceClient) WantDHCP6PdReplyEvents(ctx context.Context, in *WantDHCP6PdReplyEvents) (*WantDHCP6PdReplyEventsReply, error) {
@@ -201,7 +201,7 @@ func (c *serviceClient) WantDHCP6PdReplyEvents(ctx context.Context, in *WantDHCP
if err != nil {
return nil, err
}
- return out, nil
+ return out, api.RetvalToVPPApiError(out.Retval)
}
func (c *serviceClient) WantDHCP6ReplyEvents(ctx context.Context, in *WantDHCP6ReplyEvents) (*WantDHCP6ReplyEventsReply, error) {
@@ -210,5 +210,5 @@ func (c *serviceClient) WantDHCP6ReplyEvents(ctx context.Context, in *WantDHCP6R
if err != nil {
return nil, err
}
- return out, nil
+ return out, api.RetvalToVPPApiError(out.Retval)
}