1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
11 func RESTHandler(rpc RPCService) http.Handler {
12 mux := http.NewServeMux()
13 mux.HandleFunc("/bd_ip_mac_add_del", func(w http.ResponseWriter, req *http.Request) {
14 var request = new(BdIPMacAddDel)
15 b, err := ioutil.ReadAll(req.Body)
17 http.Error(w, "read body failed", http.StatusBadRequest)
20 if err := json.Unmarshal(b, request); err != nil {
21 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
24 reply, err := rpc.BdIPMacAddDel(req.Context(), request)
26 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
29 rep, err := json.MarshalIndent(reply, "", " ")
31 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
36 mux.HandleFunc("/bd_ip_mac_flush", func(w http.ResponseWriter, req *http.Request) {
37 var request = new(BdIPMacFlush)
38 b, err := ioutil.ReadAll(req.Body)
40 http.Error(w, "read body failed", http.StatusBadRequest)
43 if err := json.Unmarshal(b, request); err != nil {
44 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
47 reply, err := rpc.BdIPMacFlush(req.Context(), request)
49 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
52 rep, err := json.MarshalIndent(reply, "", " ")
54 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
59 mux.HandleFunc("/bridge_domain_add_del", func(w http.ResponseWriter, req *http.Request) {
60 var request = new(BridgeDomainAddDel)
61 b, err := ioutil.ReadAll(req.Body)
63 http.Error(w, "read body failed", http.StatusBadRequest)
66 if err := json.Unmarshal(b, request); err != nil {
67 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
70 reply, err := rpc.BridgeDomainAddDel(req.Context(), request)
72 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
75 rep, err := json.MarshalIndent(reply, "", " ")
77 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
82 mux.HandleFunc("/bridge_domain_set_mac_age", func(w http.ResponseWriter, req *http.Request) {
83 var request = new(BridgeDomainSetMacAge)
84 b, err := ioutil.ReadAll(req.Body)
86 http.Error(w, "read body failed", http.StatusBadRequest)
89 if err := json.Unmarshal(b, request); err != nil {
90 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
93 reply, err := rpc.BridgeDomainSetMacAge(req.Context(), request)
95 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
98 rep, err := json.MarshalIndent(reply, "", " ")
100 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
105 mux.HandleFunc("/bridge_flags", func(w http.ResponseWriter, req *http.Request) {
106 var request = new(BridgeFlags)
107 b, err := ioutil.ReadAll(req.Body)
109 http.Error(w, "read body failed", http.StatusBadRequest)
112 if err := json.Unmarshal(b, request); err != nil {
113 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
116 reply, err := rpc.BridgeFlags(req.Context(), request)
118 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
121 rep, err := json.MarshalIndent(reply, "", " ")
123 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
128 mux.HandleFunc("/bvi_create", func(w http.ResponseWriter, req *http.Request) {
129 var request = new(BviCreate)
130 b, err := ioutil.ReadAll(req.Body)
132 http.Error(w, "read body failed", http.StatusBadRequest)
135 if err := json.Unmarshal(b, request); err != nil {
136 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
139 reply, err := rpc.BviCreate(req.Context(), request)
141 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
144 rep, err := json.MarshalIndent(reply, "", " ")
146 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
151 mux.HandleFunc("/bvi_delete", func(w http.ResponseWriter, req *http.Request) {
152 var request = new(BviDelete)
153 b, err := ioutil.ReadAll(req.Body)
155 http.Error(w, "read body failed", http.StatusBadRequest)
158 if err := json.Unmarshal(b, request); err != nil {
159 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
162 reply, err := rpc.BviDelete(req.Context(), request)
164 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
167 rep, err := json.MarshalIndent(reply, "", " ")
169 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
174 mux.HandleFunc("/l2_fib_clear_table", func(w http.ResponseWriter, req *http.Request) {
175 var request = new(L2FibClearTable)
176 reply, err := rpc.L2FibClearTable(req.Context(), request)
178 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
181 rep, err := json.MarshalIndent(reply, "", " ")
183 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
188 mux.HandleFunc("/l2_flags", func(w http.ResponseWriter, req *http.Request) {
189 var request = new(L2Flags)
190 b, err := ioutil.ReadAll(req.Body)
192 http.Error(w, "read body failed", http.StatusBadRequest)
195 if err := json.Unmarshal(b, request); err != nil {
196 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
199 reply, err := rpc.L2Flags(req.Context(), request)
201 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
204 rep, err := json.MarshalIndent(reply, "", " ")
206 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
211 mux.HandleFunc("/l2_interface_efp_filter", func(w http.ResponseWriter, req *http.Request) {
212 var request = new(L2InterfaceEfpFilter)
213 b, err := ioutil.ReadAll(req.Body)
215 http.Error(w, "read body failed", http.StatusBadRequest)
218 if err := json.Unmarshal(b, request); err != nil {
219 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
222 reply, err := rpc.L2InterfaceEfpFilter(req.Context(), request)
224 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
227 rep, err := json.MarshalIndent(reply, "", " ")
229 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
234 mux.HandleFunc("/l2_interface_pbb_tag_rewrite", func(w http.ResponseWriter, req *http.Request) {
235 var request = new(L2InterfacePbbTagRewrite)
236 b, err := ioutil.ReadAll(req.Body)
238 http.Error(w, "read body failed", http.StatusBadRequest)
241 if err := json.Unmarshal(b, request); err != nil {
242 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
245 reply, err := rpc.L2InterfacePbbTagRewrite(req.Context(), request)
247 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
250 rep, err := json.MarshalIndent(reply, "", " ")
252 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
257 mux.HandleFunc("/l2_interface_vlan_tag_rewrite", func(w http.ResponseWriter, req *http.Request) {
258 var request = new(L2InterfaceVlanTagRewrite)
259 b, err := ioutil.ReadAll(req.Body)
261 http.Error(w, "read body failed", http.StatusBadRequest)
264 if err := json.Unmarshal(b, request); err != nil {
265 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
268 reply, err := rpc.L2InterfaceVlanTagRewrite(req.Context(), request)
270 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
273 rep, err := json.MarshalIndent(reply, "", " ")
275 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
280 mux.HandleFunc("/l2_patch_add_del", func(w http.ResponseWriter, req *http.Request) {
281 var request = new(L2PatchAddDel)
282 b, err := ioutil.ReadAll(req.Body)
284 http.Error(w, "read body failed", http.StatusBadRequest)
287 if err := json.Unmarshal(b, request); err != nil {
288 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
291 reply, err := rpc.L2PatchAddDel(req.Context(), request)
293 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
296 rep, err := json.MarshalIndent(reply, "", " ")
298 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
303 mux.HandleFunc("/l2fib_add_del", func(w http.ResponseWriter, req *http.Request) {
304 var request = new(L2fibAddDel)
305 b, err := ioutil.ReadAll(req.Body)
307 http.Error(w, "read body failed", http.StatusBadRequest)
310 if err := json.Unmarshal(b, request); err != nil {
311 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
314 reply, err := rpc.L2fibAddDel(req.Context(), request)
316 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
319 rep, err := json.MarshalIndent(reply, "", " ")
321 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
326 mux.HandleFunc("/l2fib_flush_all", func(w http.ResponseWriter, req *http.Request) {
327 var request = new(L2fibFlushAll)
328 reply, err := rpc.L2fibFlushAll(req.Context(), request)
330 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
333 rep, err := json.MarshalIndent(reply, "", " ")
335 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
340 mux.HandleFunc("/l2fib_flush_bd", func(w http.ResponseWriter, req *http.Request) {
341 var request = new(L2fibFlushBd)
342 b, err := ioutil.ReadAll(req.Body)
344 http.Error(w, "read body failed", http.StatusBadRequest)
347 if err := json.Unmarshal(b, request); err != nil {
348 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
351 reply, err := rpc.L2fibFlushBd(req.Context(), request)
353 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
356 rep, err := json.MarshalIndent(reply, "", " ")
358 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
363 mux.HandleFunc("/l2fib_flush_int", func(w http.ResponseWriter, req *http.Request) {
364 var request = new(L2fibFlushInt)
365 b, err := ioutil.ReadAll(req.Body)
367 http.Error(w, "read body failed", http.StatusBadRequest)
370 if err := json.Unmarshal(b, request); err != nil {
371 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
374 reply, err := rpc.L2fibFlushInt(req.Context(), request)
376 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
379 rep, err := json.MarshalIndent(reply, "", " ")
381 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
386 mux.HandleFunc("/sw_interface_set_l2_bridge", func(w http.ResponseWriter, req *http.Request) {
387 var request = new(SwInterfaceSetL2Bridge)
388 b, err := ioutil.ReadAll(req.Body)
390 http.Error(w, "read body failed", http.StatusBadRequest)
393 if err := json.Unmarshal(b, request); err != nil {
394 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
397 reply, err := rpc.SwInterfaceSetL2Bridge(req.Context(), request)
399 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
402 rep, err := json.MarshalIndent(reply, "", " ")
404 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
409 mux.HandleFunc("/sw_interface_set_l2_xconnect", func(w http.ResponseWriter, req *http.Request) {
410 var request = new(SwInterfaceSetL2Xconnect)
411 b, err := ioutil.ReadAll(req.Body)
413 http.Error(w, "read body failed", http.StatusBadRequest)
416 if err := json.Unmarshal(b, request); err != nil {
417 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
420 reply, err := rpc.SwInterfaceSetL2Xconnect(req.Context(), request)
422 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
425 rep, err := json.MarshalIndent(reply, "", " ")
427 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
432 mux.HandleFunc("/sw_interface_set_vpath", func(w http.ResponseWriter, req *http.Request) {
433 var request = new(SwInterfaceSetVpath)
434 b, err := ioutil.ReadAll(req.Body)
436 http.Error(w, "read body failed", http.StatusBadRequest)
439 if err := json.Unmarshal(b, request); err != nil {
440 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
443 reply, err := rpc.SwInterfaceSetVpath(req.Context(), request)
445 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
448 rep, err := json.MarshalIndent(reply, "", " ")
450 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
455 mux.HandleFunc("/want_l2_arp_term_events", func(w http.ResponseWriter, req *http.Request) {
456 var request = new(WantL2ArpTermEvents)
457 b, err := ioutil.ReadAll(req.Body)
459 http.Error(w, "read body failed", http.StatusBadRequest)
462 if err := json.Unmarshal(b, request); err != nil {
463 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
466 reply, err := rpc.WantL2ArpTermEvents(req.Context(), request)
468 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
471 rep, err := json.MarshalIndent(reply, "", " ")
473 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
478 mux.HandleFunc("/want_l2_macs_events", func(w http.ResponseWriter, req *http.Request) {
479 var request = new(WantL2MacsEvents)
480 b, err := ioutil.ReadAll(req.Body)
482 http.Error(w, "read body failed", http.StatusBadRequest)
485 if err := json.Unmarshal(b, request); err != nil {
486 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
489 reply, err := rpc.WantL2MacsEvents(req.Context(), request)
491 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
494 rep, err := json.MarshalIndent(reply, "", " ")
496 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
501 return http.HandlerFunc(mux.ServeHTTP)