Updated changelog for v0.4.0
[govpp.git] / binapi / one / one_rest.ba.go
1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2
3 package one
4
5 import (
6         "encoding/json"
7         "io/ioutil"
8         "net/http"
9 )
10
11 func RESTHandler(rpc RPCService) http.Handler {
12         mux := http.NewServeMux()
13         mux.HandleFunc("/one_add_del_adjacency", func(w http.ResponseWriter, req *http.Request) {
14                 var request = new(OneAddDelAdjacency)
15                 b, err := ioutil.ReadAll(req.Body)
16                 if err != nil {
17                         http.Error(w, "read body failed", http.StatusBadRequest)
18                         return
19                 }
20                 if err := json.Unmarshal(b, request); err != nil {
21                         http.Error(w, "unmarshal data failed", http.StatusBadRequest)
22                         return
23                 }
24                 reply, err := rpc.OneAddDelAdjacency(req.Context(), request)
25                 if err != nil {
26                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
27                         return
28                 }
29                 rep, err := json.MarshalIndent(reply, "", "  ")
30                 if err != nil {
31                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
32                         return
33                 }
34                 w.Write(rep)
35         })
36         mux.HandleFunc("/one_add_del_l2_arp_entry", func(w http.ResponseWriter, req *http.Request) {
37                 var request = new(OneAddDelL2ArpEntry)
38                 b, err := ioutil.ReadAll(req.Body)
39                 if err != nil {
40                         http.Error(w, "read body failed", http.StatusBadRequest)
41                         return
42                 }
43                 if err := json.Unmarshal(b, request); err != nil {
44                         http.Error(w, "unmarshal data failed", http.StatusBadRequest)
45                         return
46                 }
47                 reply, err := rpc.OneAddDelL2ArpEntry(req.Context(), request)
48                 if err != nil {
49                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
50                         return
51                 }
52                 rep, err := json.MarshalIndent(reply, "", "  ")
53                 if err != nil {
54                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
55                         return
56                 }
57                 w.Write(rep)
58         })
59         mux.HandleFunc("/one_add_del_local_eid", func(w http.ResponseWriter, req *http.Request) {
60                 var request = new(OneAddDelLocalEid)
61                 b, err := ioutil.ReadAll(req.Body)
62                 if err != nil {
63                         http.Error(w, "read body failed", http.StatusBadRequest)
64                         return
65                 }
66                 if err := json.Unmarshal(b, request); err != nil {
67                         http.Error(w, "unmarshal data failed", http.StatusBadRequest)
68                         return
69                 }
70                 reply, err := rpc.OneAddDelLocalEid(req.Context(), request)
71                 if err != nil {
72                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
73                         return
74                 }
75                 rep, err := json.MarshalIndent(reply, "", "  ")
76                 if err != nil {
77                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
78                         return
79                 }
80                 w.Write(rep)
81         })
82         mux.HandleFunc("/one_add_del_locator", func(w http.ResponseWriter, req *http.Request) {
83                 var request = new(OneAddDelLocator)
84                 b, err := ioutil.ReadAll(req.Body)
85                 if err != nil {
86                         http.Error(w, "read body failed", http.StatusBadRequest)
87                         return
88                 }
89                 if err := json.Unmarshal(b, request); err != nil {
90                         http.Error(w, "unmarshal data failed", http.StatusBadRequest)
91                         return
92                 }
93                 reply, err := rpc.OneAddDelLocator(req.Context(), request)
94                 if err != nil {
95                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
96                         return
97                 }
98                 rep, err := json.MarshalIndent(reply, "", "  ")
99                 if err != nil {
100                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
101                         return
102                 }
103                 w.Write(rep)
104         })
105         mux.HandleFunc("/one_add_del_locator_set", func(w http.ResponseWriter, req *http.Request) {
106                 var request = new(OneAddDelLocatorSet)
107                 b, err := ioutil.ReadAll(req.Body)
108                 if err != nil {
109                         http.Error(w, "read body failed", http.StatusBadRequest)
110                         return
111                 }
112                 if err := json.Unmarshal(b, request); err != nil {
113                         http.Error(w, "unmarshal data failed", http.StatusBadRequest)
114                         return
115                 }
116                 reply, err := rpc.OneAddDelLocatorSet(req.Context(), request)
117                 if err != nil {
118                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
119                         return
120                 }
121                 rep, err := json.MarshalIndent(reply, "", "  ")
122                 if err != nil {
123                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
124                         return
125                 }
126                 w.Write(rep)
127         })
128         mux.HandleFunc("/one_add_del_map_request_itr_rlocs", func(w http.ResponseWriter, req *http.Request) {
129                 var request = new(OneAddDelMapRequestItrRlocs)
130                 b, err := ioutil.ReadAll(req.Body)
131                 if err != nil {
132                         http.Error(w, "read body failed", http.StatusBadRequest)
133                         return
134                 }
135                 if err := json.Unmarshal(b, request); err != nil {
136                         http.Error(w, "unmarshal data failed", http.StatusBadRequest)
137                         return
138                 }
139                 reply, err := rpc.OneAddDelMapRequestItrRlocs(req.Context(), request)
140                 if err != nil {
141                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
142                         return
143                 }
144                 rep, err := json.MarshalIndent(reply, "", "  ")
145                 if err != nil {
146                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
147                         return
148                 }
149                 w.Write(rep)
150         })
151         mux.HandleFunc("/one_add_del_map_resolver", func(w http.ResponseWriter, req *http.Request) {
152                 var request = new(OneAddDelMapResolver)
153                 b, err := ioutil.ReadAll(req.Body)
154                 if err != nil {
155                         http.Error(w, "read body failed", http.StatusBadRequest)
156                         return
157                 }
158                 if err := json.Unmarshal(b, request); err != nil {
159                         http.Error(w, "unmarshal data failed", http.StatusBadRequest)
160                         return
161                 }
162                 reply, err := rpc.OneAddDelMapResolver(req.Context(), request)
163                 if err != nil {
164                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
165                         return
166                 }
167                 rep, err := json.MarshalIndent(reply, "", "  ")
168                 if err != nil {
169                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
170                         return
171                 }
172                 w.Write(rep)
173         })
174         mux.HandleFunc("/one_add_del_map_server", func(w http.ResponseWriter, req *http.Request) {
175                 var request = new(OneAddDelMapServer)
176                 b, err := ioutil.ReadAll(req.Body)
177                 if err != nil {
178                         http.Error(w, "read body failed", http.StatusBadRequest)
179                         return
180                 }
181                 if err := json.Unmarshal(b, request); err != nil {
182                         http.Error(w, "unmarshal data failed", http.StatusBadRequest)
183                         return
184                 }
185                 reply, err := rpc.OneAddDelMapServer(req.Context(), request)
186                 if err != nil {
187                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
188                         return
189                 }
190                 rep, err := json.MarshalIndent(reply, "", "  ")
191                 if err != nil {
192                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
193                         return
194                 }
195                 w.Write(rep)
196         })
197         mux.HandleFunc("/one_add_del_ndp_entry", func(w http.ResponseWriter, req *http.Request) {
198                 var request = new(OneAddDelNdpEntry)
199                 b, err := ioutil.ReadAll(req.Body)
200                 if err != nil {
201                         http.Error(w, "read body failed", http.StatusBadRequest)
202                         return
203                 }
204                 if err := json.Unmarshal(b, request); err != nil {
205                         http.Error(w, "unmarshal data failed", http.StatusBadRequest)
206                         return
207                 }
208                 reply, err := rpc.OneAddDelNdpEntry(req.Context(), request)
209                 if err != nil {
210                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
211                         return
212                 }
213                 rep, err := json.MarshalIndent(reply, "", "  ")
214                 if err != nil {
215                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
216                         return
217                 }
218                 w.Write(rep)
219         })
220         mux.HandleFunc("/one_add_del_remote_mapping", func(w http.ResponseWriter, req *http.Request) {
221                 var request = new(OneAddDelRemoteMapping)
222                 b, err := ioutil.ReadAll(req.Body)
223                 if err != nil {
224                         http.Error(w, "read body failed", http.StatusBadRequest)
225                         return
226                 }
227                 if err := json.Unmarshal(b, request); err != nil {
228                         http.Error(w, "unmarshal data failed", http.StatusBadRequest)
229                         return
230                 }
231                 reply, err := rpc.OneAddDelRemoteMapping(req.Context(), request)
232                 if err != nil {
233                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
234                         return
235                 }
236                 rep, err := json.MarshalIndent(reply, "", "  ")
237                 if err != nil {
238                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
239                         return
240                 }
241                 w.Write(rep)
242         })
243         mux.HandleFunc("/one_adjacencies_get", func(w http.ResponseWriter, req *http.Request) {
244                 var request = new(OneAdjacenciesGet)
245                 b, err := ioutil.ReadAll(req.Body)
246                 if err != nil {
247                         http.Error(w, "read body failed", http.StatusBadRequest)
248                         return
249                 }
250                 if err := json.Unmarshal(b, request); err != nil {
251                         http.Error(w, "unmarshal data failed", http.StatusBadRequest)
252                         return
253                 }
254                 reply, err := rpc.OneAdjacenciesGet(req.Context(), request)
255                 if err != nil {
256                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
257                         return
258                 }
259                 rep, err := json.MarshalIndent(reply, "", "  ")
260                 if err != nil {
261                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
262                         return
263                 }
264                 w.Write(rep)
265         })
266         mux.HandleFunc("/one_eid_table_add_del_map", func(w http.ResponseWriter, req *http.Request) {
267                 var request = new(OneEidTableAddDelMap)
268                 b, err := ioutil.ReadAll(req.Body)
269                 if err != nil {
270                         http.Error(w, "read body failed", http.StatusBadRequest)
271                         return
272                 }
273                 if err := json.Unmarshal(b, request); err != nil {
274                         http.Error(w, "unmarshal data failed", http.StatusBadRequest)
275                         return
276                 }
277                 reply, err := rpc.OneEidTableAddDelMap(req.Context(), request)
278                 if err != nil {
279                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
280                         return
281                 }
282                 rep, err := json.MarshalIndent(reply, "", "  ")
283                 if err != nil {
284                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
285                         return
286                 }
287                 w.Write(rep)
288         })
289         mux.HandleFunc("/one_enable_disable", func(w http.ResponseWriter, req *http.Request) {
290                 var request = new(OneEnableDisable)
291                 b, err := ioutil.ReadAll(req.Body)
292                 if err != nil {
293                         http.Error(w, "read body failed", http.StatusBadRequest)
294                         return
295                 }
296                 if err := json.Unmarshal(b, request); err != nil {
297                         http.Error(w, "unmarshal data failed", http.StatusBadRequest)
298                         return
299                 }
300                 reply, err := rpc.OneEnableDisable(req.Context(), request)
301                 if err != nil {
302                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
303                         return
304                 }
305                 rep, err := json.MarshalIndent(reply, "", "  ")
306                 if err != nil {
307                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
308                         return
309                 }
310                 w.Write(rep)
311         })
312         mux.HandleFunc("/one_enable_disable_petr_mode", func(w http.ResponseWriter, req *http.Request) {
313                 var request = new(OneEnableDisablePetrMode)
314                 b, err := ioutil.ReadAll(req.Body)
315                 if err != nil {
316                         http.Error(w, "read body failed", http.StatusBadRequest)
317                         return
318                 }
319                 if err := json.Unmarshal(b, request); err != nil {
320                         http.Error(w, "unmarshal data failed", http.StatusBadRequest)
321                         return
322                 }
323                 reply, err := rpc.OneEnableDisablePetrMode(req.Context(), request)
324                 if err != nil {
325                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
326                         return
327                 }
328                 rep, err := json.MarshalIndent(reply, "", "  ")
329                 if err != nil {
330                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
331                         return
332                 }
333                 w.Write(rep)
334         })
335         mux.HandleFunc("/one_enable_disable_pitr_mode", func(w http.ResponseWriter, req *http.Request) {
336                 var request = new(OneEnableDisablePitrMode)
337                 b, err := ioutil.ReadAll(req.Body)
338                 if err != nil {
339                         http.Error(w, "read body failed", http.StatusBadRequest)
340                         return
341                 }
342                 if err := json.Unmarshal(b, request); err != nil {
343                         http.Error(w, "unmarshal data failed", http.StatusBadRequest)
344                         return
345                 }
346                 reply, err := rpc.OneEnableDisablePitrMode(req.Context(), request)
347                 if err != nil {
348                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
349                         return
350                 }
351                 rep, err := json.MarshalIndent(reply, "", "  ")
352                 if err != nil {
353                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
354                         return
355                 }
356                 w.Write(rep)
357         })
358         mux.HandleFunc("/one_enable_disable_xtr_mode", func(w http.ResponseWriter, req *http.Request) {
359                 var request = new(OneEnableDisableXtrMode)
360                 b, err := ioutil.ReadAll(req.Body)
361                 if err != nil {
362                         http.Error(w, "read body failed", http.StatusBadRequest)
363                         return
364                 }
365                 if err := json.Unmarshal(b, request); err != nil {
366                         http.Error(w, "unmarshal data failed", http.StatusBadRequest)
367                         return
368                 }
369                 reply, err := rpc.OneEnableDisableXtrMode(req.Context(), request)
370                 if err != nil {
371                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
372                         return
373                 }
374                 rep, err := json.MarshalIndent(reply, "", "  ")
375                 if err != nil {
376                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
377                         return
378                 }
379                 w.Write(rep)
380         })
381         mux.HandleFunc("/one_get_map_request_itr_rlocs", func(w http.ResponseWriter, req *http.Request) {
382                 var request = new(OneGetMapRequestItrRlocs)
383                 reply, err := rpc.OneGetMapRequestItrRlocs(req.Context(), request)
384                 if err != nil {
385                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
386                         return
387                 }
388                 rep, err := json.MarshalIndent(reply, "", "  ")
389                 if err != nil {
390                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
391                         return
392                 }
393                 w.Write(rep)
394         })
395         mux.HandleFunc("/one_get_transport_protocol", func(w http.ResponseWriter, req *http.Request) {
396                 var request = new(OneGetTransportProtocol)
397                 reply, err := rpc.OneGetTransportProtocol(req.Context(), request)
398                 if err != nil {
399                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
400                         return
401                 }
402                 rep, err := json.MarshalIndent(reply, "", "  ")
403                 if err != nil {
404                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
405                         return
406                 }
407                 w.Write(rep)
408         })
409         mux.HandleFunc("/one_l2_arp_bd_get", func(w http.ResponseWriter, req *http.Request) {
410                 var request = new(OneL2ArpBdGet)
411                 reply, err := rpc.OneL2ArpBdGet(req.Context(), request)
412                 if err != nil {
413                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
414                         return
415                 }
416                 rep, err := json.MarshalIndent(reply, "", "  ")
417                 if err != nil {
418                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
419                         return
420                 }
421                 w.Write(rep)
422         })
423         mux.HandleFunc("/one_l2_arp_entries_get", func(w http.ResponseWriter, req *http.Request) {
424                 var request = new(OneL2ArpEntriesGet)
425                 b, err := ioutil.ReadAll(req.Body)
426                 if err != nil {
427                         http.Error(w, "read body failed", http.StatusBadRequest)
428                         return
429                 }
430                 if err := json.Unmarshal(b, request); err != nil {
431                         http.Error(w, "unmarshal data failed", http.StatusBadRequest)
432                         return
433                 }
434                 reply, err := rpc.OneL2ArpEntriesGet(req.Context(), request)
435                 if err != nil {
436                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
437                         return
438                 }
439                 rep, err := json.MarshalIndent(reply, "", "  ")
440                 if err != nil {
441                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
442                         return
443                 }
444                 w.Write(rep)
445         })
446         mux.HandleFunc("/one_map_register_enable_disable", func(w http.ResponseWriter, req *http.Request) {
447                 var request = new(OneMapRegisterEnableDisable)
448                 b, err := ioutil.ReadAll(req.Body)
449                 if err != nil {
450                         http.Error(w, "read body failed", http.StatusBadRequest)
451                         return
452                 }
453                 if err := json.Unmarshal(b, request); err != nil {
454                         http.Error(w, "unmarshal data failed", http.StatusBadRequest)
455                         return
456                 }
457                 reply, err := rpc.OneMapRegisterEnableDisable(req.Context(), request)
458                 if err != nil {
459                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
460                         return
461                 }
462                 rep, err := json.MarshalIndent(reply, "", "  ")
463                 if err != nil {
464                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
465                         return
466                 }
467                 w.Write(rep)
468         })
469         mux.HandleFunc("/one_map_register_fallback_threshold", func(w http.ResponseWriter, req *http.Request) {
470                 var request = new(OneMapRegisterFallbackThreshold)
471                 b, err := ioutil.ReadAll(req.Body)
472                 if err != nil {
473                         http.Error(w, "read body failed", http.StatusBadRequest)
474                         return
475                 }
476                 if err := json.Unmarshal(b, request); err != nil {
477                         http.Error(w, "unmarshal data failed", http.StatusBadRequest)
478                         return
479                 }
480                 reply, err := rpc.OneMapRegisterFallbackThreshold(req.Context(), request)
481                 if err != nil {
482                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
483                         return
484                 }
485                 rep, err := json.MarshalIndent(reply, "", "  ")
486                 if err != nil {
487                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
488                         return
489                 }
490                 w.Write(rep)
491         })
492         mux.HandleFunc("/one_map_register_set_ttl", func(w http.ResponseWriter, req *http.Request) {
493                 var request = new(OneMapRegisterSetTTL)
494                 b, err := ioutil.ReadAll(req.Body)
495                 if err != nil {
496                         http.Error(w, "read body failed", http.StatusBadRequest)
497                         return
498                 }
499                 if err := json.Unmarshal(b, request); err != nil {
500                         http.Error(w, "unmarshal data failed", http.StatusBadRequest)
501                         return
502                 }
503                 reply, err := rpc.OneMapRegisterSetTTL(req.Context(), request)
504                 if err != nil {
505                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
506                         return
507                 }
508                 rep, err := json.MarshalIndent(reply, "", "  ")
509                 if err != nil {
510                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
511                         return
512                 }
513                 w.Write(rep)
514         })
515         mux.HandleFunc("/one_map_request_mode", func(w http.ResponseWriter, req *http.Request) {
516                 var request = new(OneMapRequestMode)
517                 b, err := ioutil.ReadAll(req.Body)
518                 if err != nil {
519                         http.Error(w, "read body failed", http.StatusBadRequest)
520                         return
521                 }
522                 if err := json.Unmarshal(b, request); err != nil {
523                         http.Error(w, "unmarshal data failed", http.StatusBadRequest)
524                         return
525                 }
526                 reply, err := rpc.OneMapRequestMode(req.Context(), request)
527                 if err != nil {
528                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
529                         return
530                 }
531                 rep, err := json.MarshalIndent(reply, "", "  ")
532                 if err != nil {
533                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
534                         return
535                 }
536                 w.Write(rep)
537         })
538         mux.HandleFunc("/one_ndp_bd_get", func(w http.ResponseWriter, req *http.Request) {
539                 var request = new(OneNdpBdGet)
540                 reply, err := rpc.OneNdpBdGet(req.Context(), request)
541                 if err != nil {
542                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
543                         return
544                 }
545                 rep, err := json.MarshalIndent(reply, "", "  ")
546                 if err != nil {
547                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
548                         return
549                 }
550                 w.Write(rep)
551         })
552         mux.HandleFunc("/one_ndp_entries_get", func(w http.ResponseWriter, req *http.Request) {
553                 var request = new(OneNdpEntriesGet)
554                 b, err := ioutil.ReadAll(req.Body)
555                 if err != nil {
556                         http.Error(w, "read body failed", http.StatusBadRequest)
557                         return
558                 }
559                 if err := json.Unmarshal(b, request); err != nil {
560                         http.Error(w, "unmarshal data failed", http.StatusBadRequest)
561                         return
562                 }
563                 reply, err := rpc.OneNdpEntriesGet(req.Context(), request)
564                 if err != nil {
565                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
566                         return
567                 }
568                 rep, err := json.MarshalIndent(reply, "", "  ")
569                 if err != nil {
570                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
571                         return
572                 }
573                 w.Write(rep)
574         })
575         mux.HandleFunc("/one_nsh_set_locator_set", func(w http.ResponseWriter, req *http.Request) {
576                 var request = new(OneNshSetLocatorSet)
577                 b, err := ioutil.ReadAll(req.Body)
578                 if err != nil {
579                         http.Error(w, "read body failed", http.StatusBadRequest)
580                         return
581                 }
582                 if err := json.Unmarshal(b, request); err != nil {
583                         http.Error(w, "unmarshal data failed", http.StatusBadRequest)
584                         return
585                 }
586                 reply, err := rpc.OneNshSetLocatorSet(req.Context(), request)
587                 if err != nil {
588                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
589                         return
590                 }
591                 rep, err := json.MarshalIndent(reply, "", "  ")
592                 if err != nil {
593                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
594                         return
595                 }
596                 w.Write(rep)
597         })
598         mux.HandleFunc("/one_pitr_set_locator_set", func(w http.ResponseWriter, req *http.Request) {
599                 var request = new(OnePitrSetLocatorSet)
600                 b, err := ioutil.ReadAll(req.Body)
601                 if err != nil {
602                         http.Error(w, "read body failed", http.StatusBadRequest)
603                         return
604                 }
605                 if err := json.Unmarshal(b, request); err != nil {
606                         http.Error(w, "unmarshal data failed", http.StatusBadRequest)
607                         return
608                 }
609                 reply, err := rpc.OnePitrSetLocatorSet(req.Context(), request)
610                 if err != nil {
611                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
612                         return
613                 }
614                 rep, err := json.MarshalIndent(reply, "", "  ")
615                 if err != nil {
616                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
617                         return
618                 }
619                 w.Write(rep)
620         })
621         mux.HandleFunc("/one_rloc_probe_enable_disable", func(w http.ResponseWriter, req *http.Request) {
622                 var request = new(OneRlocProbeEnableDisable)
623                 b, err := ioutil.ReadAll(req.Body)
624                 if err != nil {
625                         http.Error(w, "read body failed", http.StatusBadRequest)
626                         return
627                 }
628                 if err := json.Unmarshal(b, request); err != nil {
629                         http.Error(w, "unmarshal data failed", http.StatusBadRequest)
630                         return
631                 }
632                 reply, err := rpc.OneRlocProbeEnableDisable(req.Context(), request)
633                 if err != nil {
634                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
635                         return
636                 }
637                 rep, err := json.MarshalIndent(reply, "", "  ")
638                 if err != nil {
639                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
640                         return
641                 }
642                 w.Write(rep)
643         })
644         mux.HandleFunc("/one_set_transport_protocol", func(w http.ResponseWriter, req *http.Request) {
645                 var request = new(OneSetTransportProtocol)
646                 b, err := ioutil.ReadAll(req.Body)
647                 if err != nil {
648                         http.Error(w, "read body failed", http.StatusBadRequest)
649                         return
650                 }
651                 if err := json.Unmarshal(b, request); err != nil {
652                         http.Error(w, "unmarshal data failed", http.StatusBadRequest)
653                         return
654                 }
655                 reply, err := rpc.OneSetTransportProtocol(req.Context(), request)
656                 if err != nil {
657                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
658                         return
659                 }
660                 rep, err := json.MarshalIndent(reply, "", "  ")
661                 if err != nil {
662                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
663                         return
664                 }
665                 w.Write(rep)
666         })
667         mux.HandleFunc("/one_show_petr_mode", func(w http.ResponseWriter, req *http.Request) {
668                 var request = new(OneShowPetrMode)
669                 reply, err := rpc.OneShowPetrMode(req.Context(), request)
670                 if err != nil {
671                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
672                         return
673                 }
674                 rep, err := json.MarshalIndent(reply, "", "  ")
675                 if err != nil {
676                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
677                         return
678                 }
679                 w.Write(rep)
680         })
681         mux.HandleFunc("/one_show_pitr_mode", func(w http.ResponseWriter, req *http.Request) {
682                 var request = new(OneShowPitrMode)
683                 reply, err := rpc.OneShowPitrMode(req.Context(), request)
684                 if err != nil {
685                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
686                         return
687                 }
688                 rep, err := json.MarshalIndent(reply, "", "  ")
689                 if err != nil {
690                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
691                         return
692                 }
693                 w.Write(rep)
694         })
695         mux.HandleFunc("/one_show_xtr_mode", func(w http.ResponseWriter, req *http.Request) {
696                 var request = new(OneShowXtrMode)
697                 reply, err := rpc.OneShowXtrMode(req.Context(), request)
698                 if err != nil {
699                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
700                         return
701                 }
702                 rep, err := json.MarshalIndent(reply, "", "  ")
703                 if err != nil {
704                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
705                         return
706                 }
707                 w.Write(rep)
708         })
709         mux.HandleFunc("/one_stats_enable_disable", func(w http.ResponseWriter, req *http.Request) {
710                 var request = new(OneStatsEnableDisable)
711                 b, err := ioutil.ReadAll(req.Body)
712                 if err != nil {
713                         http.Error(w, "read body failed", http.StatusBadRequest)
714                         return
715                 }
716                 if err := json.Unmarshal(b, request); err != nil {
717                         http.Error(w, "unmarshal data failed", http.StatusBadRequest)
718                         return
719                 }
720                 reply, err := rpc.OneStatsEnableDisable(req.Context(), request)
721                 if err != nil {
722                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
723                         return
724                 }
725                 rep, err := json.MarshalIndent(reply, "", "  ")
726                 if err != nil {
727                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
728                         return
729                 }
730                 w.Write(rep)
731         })
732         mux.HandleFunc("/one_stats_flush", func(w http.ResponseWriter, req *http.Request) {
733                 var request = new(OneStatsFlush)
734                 reply, err := rpc.OneStatsFlush(req.Context(), request)
735                 if err != nil {
736                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
737                         return
738                 }
739                 rep, err := json.MarshalIndent(reply, "", "  ")
740                 if err != nil {
741                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
742                         return
743                 }
744                 w.Write(rep)
745         })
746         mux.HandleFunc("/one_use_petr", func(w http.ResponseWriter, req *http.Request) {
747                 var request = new(OneUsePetr)
748                 b, err := ioutil.ReadAll(req.Body)
749                 if err != nil {
750                         http.Error(w, "read body failed", http.StatusBadRequest)
751                         return
752                 }
753                 if err := json.Unmarshal(b, request); err != nil {
754                         http.Error(w, "unmarshal data failed", http.StatusBadRequest)
755                         return
756                 }
757                 reply, err := rpc.OneUsePetr(req.Context(), request)
758                 if err != nil {
759                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
760                         return
761                 }
762                 rep, err := json.MarshalIndent(reply, "", "  ")
763                 if err != nil {
764                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
765                         return
766                 }
767                 w.Write(rep)
768         })
769         mux.HandleFunc("/show_one_map_register_fallback_threshold", func(w http.ResponseWriter, req *http.Request) {
770                 var request = new(ShowOneMapRegisterFallbackThreshold)
771                 reply, err := rpc.ShowOneMapRegisterFallbackThreshold(req.Context(), request)
772                 if err != nil {
773                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
774                         return
775                 }
776                 rep, err := json.MarshalIndent(reply, "", "  ")
777                 if err != nil {
778                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
779                         return
780                 }
781                 w.Write(rep)
782         })
783         mux.HandleFunc("/show_one_map_register_state", func(w http.ResponseWriter, req *http.Request) {
784                 var request = new(ShowOneMapRegisterState)
785                 reply, err := rpc.ShowOneMapRegisterState(req.Context(), request)
786                 if err != nil {
787                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
788                         return
789                 }
790                 rep, err := json.MarshalIndent(reply, "", "  ")
791                 if err != nil {
792                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
793                         return
794                 }
795                 w.Write(rep)
796         })
797         mux.HandleFunc("/show_one_map_register_ttl", func(w http.ResponseWriter, req *http.Request) {
798                 var request = new(ShowOneMapRegisterTTL)
799                 reply, err := rpc.ShowOneMapRegisterTTL(req.Context(), request)
800                 if err != nil {
801                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
802                         return
803                 }
804                 rep, err := json.MarshalIndent(reply, "", "  ")
805                 if err != nil {
806                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
807                         return
808                 }
809                 w.Write(rep)
810         })
811         mux.HandleFunc("/show_one_map_request_mode", func(w http.ResponseWriter, req *http.Request) {
812                 var request = new(ShowOneMapRequestMode)
813                 reply, err := rpc.ShowOneMapRequestMode(req.Context(), request)
814                 if err != nil {
815                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
816                         return
817                 }
818                 rep, err := json.MarshalIndent(reply, "", "  ")
819                 if err != nil {
820                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
821                         return
822                 }
823                 w.Write(rep)
824         })
825         mux.HandleFunc("/show_one_nsh_mapping", func(w http.ResponseWriter, req *http.Request) {
826                 var request = new(ShowOneNshMapping)
827                 reply, err := rpc.ShowOneNshMapping(req.Context(), request)
828                 if err != nil {
829                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
830                         return
831                 }
832                 rep, err := json.MarshalIndent(reply, "", "  ")
833                 if err != nil {
834                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
835                         return
836                 }
837                 w.Write(rep)
838         })
839         mux.HandleFunc("/show_one_pitr", func(w http.ResponseWriter, req *http.Request) {
840                 var request = new(ShowOnePitr)
841                 reply, err := rpc.ShowOnePitr(req.Context(), request)
842                 if err != nil {
843                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
844                         return
845                 }
846                 rep, err := json.MarshalIndent(reply, "", "  ")
847                 if err != nil {
848                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
849                         return
850                 }
851                 w.Write(rep)
852         })
853         mux.HandleFunc("/show_one_rloc_probe_state", func(w http.ResponseWriter, req *http.Request) {
854                 var request = new(ShowOneRlocProbeState)
855                 reply, err := rpc.ShowOneRlocProbeState(req.Context(), request)
856                 if err != nil {
857                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
858                         return
859                 }
860                 rep, err := json.MarshalIndent(reply, "", "  ")
861                 if err != nil {
862                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
863                         return
864                 }
865                 w.Write(rep)
866         })
867         mux.HandleFunc("/show_one_stats_enable_disable", func(w http.ResponseWriter, req *http.Request) {
868                 var request = new(ShowOneStatsEnableDisable)
869                 reply, err := rpc.ShowOneStatsEnableDisable(req.Context(), request)
870                 if err != nil {
871                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
872                         return
873                 }
874                 rep, err := json.MarshalIndent(reply, "", "  ")
875                 if err != nil {
876                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
877                         return
878                 }
879                 w.Write(rep)
880         })
881         mux.HandleFunc("/show_one_status", func(w http.ResponseWriter, req *http.Request) {
882                 var request = new(ShowOneStatus)
883                 reply, err := rpc.ShowOneStatus(req.Context(), request)
884                 if err != nil {
885                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
886                         return
887                 }
888                 rep, err := json.MarshalIndent(reply, "", "  ")
889                 if err != nil {
890                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
891                         return
892                 }
893                 w.Write(rep)
894         })
895         mux.HandleFunc("/show_one_use_petr", func(w http.ResponseWriter, req *http.Request) {
896                 var request = new(ShowOneUsePetr)
897                 reply, err := rpc.ShowOneUsePetr(req.Context(), request)
898                 if err != nil {
899                         http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
900                         return
901                 }
902                 rep, err := json.MarshalIndent(reply, "", "  ")
903                 if err != nil {
904                         http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
905                         return
906                 }
907                 w.Write(rep)
908         })
909         return http.HandlerFunc(mux.ServeHTTP)
910 }