From c2456559a66107441addb96f673191bde09d6977 Mon Sep 17 00:00:00 2001 From: Ondrej Fabry Date: Fri, 2 Oct 2020 16:36:32 +0200 Subject: [PATCH] Check retval value and convert to error in generated RPC client code Change-Id: I816b4802cb5fc46239f6db0480fa4cf3645fe2f0 Signed-off-by: Ondrej Fabry --- Makefile | 67 +- binapi/abf/abf.ba.go | 4 +- binapi/abf/abf_rest.ba.go | 74 -- binapi/abf/abf_rpc.ba.go | 6 +- binapi/acl/acl.ba.go | 4 +- binapi/acl/acl_rest.ba.go | 300 ------- binapi/acl/acl_rpc.ba.go | 24 +- binapi/acl_types/acl_types.ba.go | 4 +- binapi/af_packet/af_packet.ba.go | 4 +- binapi/af_packet/af_packet_rest.ba.go | 83 -- binapi/af_packet/af_packet_rpc.ba.go | 8 +- binapi/arp/arp.ba.go | 4 +- binapi/arp/arp_rest.ba.go | 60 -- binapi/arp/arp_rpc.ba.go | 6 +- binapi/avf/avf.ba.go | 4 +- binapi/avf/avf_rest.ba.go | 60 -- binapi/avf/avf_rpc.ba.go | 6 +- binapi/bfd/bfd.ba.go | 4 +- binapi/bfd/bfd_rest.ba.go | 272 ------ binapi/bfd/bfd_rpc.ba.go | 26 +- binapi/bier/bier.ba.go | 4 +- binapi/bier/bier_rest.ba.go | 152 ---- binapi/bier/bier_rpc.ba.go | 14 +- binapi/bond/bond.ba.go | 4 +- binapi/bond/bond_rest.ba.go | 129 --- binapi/bond/bond_rpc.ba.go | 12 +- binapi/builtinurl/builtinurl.ba.go | 4 +- binapi/builtinurl/builtinurl_rest.ba.go | 27 - binapi/builtinurl/builtinurl_rpc.ba.go | 4 +- binapi/cdp/cdp.ba.go | 4 +- binapi/cdp/cdp_rest.ba.go | 37 - binapi/cdp/cdp_rpc.ba.go | 4 +- binapi/classify/classify.ba.go | 4 +- binapi/classify/classify_rest.ba.go | 258 ------ binapi/classify/classify_rpc.ba.go | 24 +- binapi/cop/cop.ba.go | 4 +- binapi/cop/cop_rest.ba.go | 60 -- binapi/cop/cop_rpc.ba.go | 6 +- binapi/ct6/ct6.ba.go | 4 +- binapi/ct6/ct6_rest.ba.go | 37 - binapi/ct6/ct6_rpc.ba.go | 4 +- binapi/dhcp/dhcp.ba.go | 4 +- binapi/dhcp/dhcp_rest.ba.go | 249 ------ binapi/dhcp/dhcp_rpc.ba.go | 22 +- .../dhcp6_ia_na_client_cp.ba.go | 4 +- .../dhcp6_ia_na_client_cp_rest.ba.go | 37 - .../dhcp6_ia_na_client_cp_rpc.ba.go | 4 +- binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp.ba.go | 4 +- .../dhcp6_pd_client_cp_rest.ba.go | 60 -- .../dhcp6_pd_client_cp_rpc.ba.go | 6 +- binapi/dns/dns.ba.go | 4 +- binapi/dns/dns_rest.ba.go | 106 --- binapi/dns/dns_rpc.ba.go | 10 +- binapi/dslite/dslite.ba.go | 4 +- binapi/dslite/dslite_rest.ba.go | 111 --- binapi/dslite/dslite_rpc.ba.go | 12 +- binapi/ethernet_types/ethernet_types.ba.go | 4 +- binapi/feature/feature.ba.go | 4 +- binapi/feature/feature_rest.ba.go | 37 - binapi/feature/feature_rpc.ba.go | 4 +- binapi/fib_types/fib_types.ba.go | 4 +- binapi/flowprobe/flowprobe.ba.go | 4 +- binapi/flowprobe/flowprobe_rest.ba.go | 60 -- binapi/flowprobe/flowprobe_rpc.ba.go | 6 +- binapi/gbp/gbp.ba.go | 4 +- binapi/gbp/gbp_rest.ba.go | 336 -------- binapi/gbp/gbp_rpc.ba.go | 30 +- binapi/gen.go | 2 +- binapi/geneve/geneve.ba.go | 4 +- binapi/geneve/geneve_rest.ba.go | 60 -- binapi/geneve/geneve_rpc.ba.go | 6 +- binapi/gre/gre.ba.go | 4 +- binapi/gre/gre_rest.ba.go | 37 - binapi/gre/gre_rpc.ba.go | 4 +- binapi/gso/gso.ba.go | 4 +- binapi/gso/gso_rest.ba.go | 37 - binapi/gso/gso_rpc.ba.go | 4 +- binapi/gtpu/gtpu.ba.go | 4 +- binapi/gtpu/gtpu_rest.ba.go | 83 -- binapi/gtpu/gtpu_rpc.ba.go | 8 +- binapi/http_static/http_static.ba.go | 4 +- binapi/http_static/http_static_rest.ba.go | 37 - binapi/http_static/http_static_rpc.ba.go | 4 +- binapi/igmp/igmp.ba.go | 4 +- binapi/igmp/igmp_rest.ba.go | 175 ---- binapi/igmp/igmp_rpc.ba.go | 16 +- binapi/ikev2/ikev2.ba.go | 4 +- binapi/ikev2/ikev2_rest.ba.go | 419 ---------- binapi/ikev2/ikev2_rpc.ba.go | 36 +- binapi/interface/interface.ba.go | 4 +- binapi/interface/interface_rest.ba.go | 594 -------------- binapi/interface/interface_rpc.ba.go | 54 +- binapi/interface_types/interface_types.ba.go | 4 +- binapi/ioam_cache/ioam_cache.ba.go | 4 +- binapi/ioam_cache/ioam_cache_rest.ba.go | 37 - binapi/ioam_cache/ioam_cache_rpc.ba.go | 4 +- binapi/ioam_export/ioam_export.ba.go | 4 +- binapi/ioam_export/ioam_export_rest.ba.go | 37 - binapi/ioam_export/ioam_export_rpc.ba.go | 4 +- binapi/ioam_vxlan_gpe/ioam_vxlan_gpe.ba.go | 4 +- binapi/ioam_vxlan_gpe/ioam_vxlan_gpe_rest.ba.go | 152 ---- binapi/ioam_vxlan_gpe/ioam_vxlan_gpe_rpc.ba.go | 14 +- binapi/ip/ip.ba.go | 4 +- binapi/ip/ip_rest.ba.go | 474 ----------- binapi/ip/ip_rpc.ba.go | 42 +- binapi/ip6_nd/ip6_nd.ba.go | 4 +- binapi/ip6_nd/ip6_nd_rest.ba.go | 129 --- binapi/ip6_nd/ip6_nd_rpc.ba.go | 12 +- binapi/ip_neighbor/ip_neighbor.ba.go | 4 +- binapi/ip_neighbor/ip_neighbor_rest.ba.go | 134 --- binapi/ip_neighbor/ip_neighbor_rpc.ba.go | 14 +- binapi/ip_types/ip_types.ba.go | 4 +- binapi/ipfix_export/ipfix_export.ba.go | 4 +- binapi/ipfix_export/ipfix_export_rest.ba.go | 97 --- binapi/ipfix_export/ipfix_export_rpc.ba.go | 10 +- binapi/ipip/ipip.ba.go | 4 +- binapi/ipip/ipip_rest.ba.go | 106 --- binapi/ipip/ipip_rpc.ba.go | 10 +- binapi/ipsec/ipsec.ba.go | 4 +- binapi/ipsec/ipsec_rest.ba.go | 221 ----- binapi/ipsec/ipsec_rpc.ba.go | 20 +- binapi/ipsec_types/ipsec_types.ba.go | 4 +- binapi/l2/l2.ba.go | 4 +- binapi/l2/l2_rest.ba.go | 502 ----------- binapi/l2/l2_rpc.ba.go | 46 +- binapi/l2e/l2e.ba.go | 4 +- binapi/l2e/l2e_rest.ba.go | 37 - binapi/l2e/l2e_rpc.ba.go | 4 +- binapi/l2tp/l2tp.ba.go | 4 +- binapi/l2tp/l2tp_rest.ba.go | 106 --- binapi/l2tp/l2tp_rpc.ba.go | 10 +- binapi/l3xc/l3xc.ba.go | 4 +- binapi/l3xc/l3xc_rest.ba.go | 74 -- binapi/l3xc/l3xc_rpc.ba.go | 6 +- binapi/lacp/lacp.ba.go | 4 +- binapi/lacp/lacp_rest.ba.go | 12 - binapi/lacp/lacp_rpc.ba.go | 2 +- binapi/lb/lb.ba.go | 4 +- binapi/lb/lb_rest.ba.go | 152 ---- binapi/lb/lb_rpc.ba.go | 14 +- binapi/lb_types/lb_types.ba.go | 4 +- binapi/lisp/lisp.ba.go | 4 +- binapi/lisp/lisp_rest.ba.go | 480 ----------- binapi/lisp/lisp_rpc.ba.go | 48 +- binapi/lisp_gpe/lisp_gpe.ba.go | 4 +- binapi/lisp_gpe/lisp_gpe_rest.ba.go | 203 ----- binapi/lisp_gpe/lisp_gpe_rpc.ba.go | 20 +- binapi/lisp_types/lisp_types.ba.go | 4 +- binapi/lldp/lldp.ba.go | 4 +- binapi/lldp/lldp_rest.ba.go | 60 -- binapi/lldp/lldp_rpc.ba.go | 6 +- binapi/mactime/mactime.ba.go | 4 +- binapi/mactime/mactime_rest.ba.go | 60 -- binapi/mactime/mactime_rpc.ba.go | 6 +- binapi/map/map.ba.go | 4 +- binapi/map/map_rest.ba.go | 295 ------- binapi/map/map_rpc.ba.go | 28 +- binapi/mdata/mdata.ba.go | 4 +- binapi/mdata/mdata_rest.ba.go | 37 - binapi/mdata/mdata_rpc.ba.go | 4 +- binapi/memclnt/memclnt.ba.go | 4 +- binapi/memclnt/memclnt_rest.ba.go | 203 ----- binapi/memclnt/memclnt_rpc.ba.go | 12 +- binapi/memif/memif.ba.go | 4 +- binapi/memif/memif_rest.ba.go | 83 -- binapi/memif/memif_rpc.ba.go | 8 +- binapi/mfib_types/mfib_types.ba.go | 4 +- binapi/mpls/mpls.ba.go | 4 +- binapi/mpls/mpls_rest.ba.go | 129 --- binapi/mpls/mpls_rpc.ba.go | 12 +- binapi/nat/nat.ba.go | 4 +- binapi/nat/nat_rest.ba.go | 913 --------------------- binapi/nat/nat_rpc.ba.go | 86 +- binapi/nsh/nsh.ba.go | 4 +- binapi/nsh/nsh_rest.ba.go | 60 -- binapi/nsh/nsh_rpc.ba.go | 6 +- binapi/nsim/nsim.ba.go | 4 +- binapi/nsim/nsim_rest.ba.go | 83 -- binapi/nsim/nsim_rpc.ba.go | 8 +- binapi/oddbuf/oddbuf.ba.go | 4 +- binapi/oddbuf/oddbuf_rest.ba.go | 37 - binapi/oddbuf/oddbuf_rpc.ba.go | 4 +- binapi/one/one.ba.go | 4 +- binapi/one/one_rest.ba.go | 910 -------------------- binapi/one/one_rpc.ba.go | 94 +-- binapi/p2p_ethernet/p2p_ethernet.ba.go | 4 +- binapi/p2p_ethernet/p2p_ethernet_rest.ba.go | 60 -- binapi/p2p_ethernet/p2p_ethernet_rpc.ba.go | 6 +- binapi/pci_types/pci_types.ba.go | 4 +- binapi/pg/pg.ba.go | 4 +- binapi/pg/pg_rest.ba.go | 83 -- binapi/pg/pg_rpc.ba.go | 8 +- binapi/pipe/pipe.ba.go | 4 +- binapi/pipe/pipe_rest.ba.go | 60 -- binapi/pipe/pipe_rpc.ba.go | 6 +- binapi/policer/policer.ba.go | 4 +- binapi/policer/policer_rest.ba.go | 37 - binapi/policer/policer_rpc.ba.go | 4 +- binapi/policer_types/policer_types.ba.go | 4 +- binapi/pot/pot.ba.go | 4 +- binapi/pot/pot_rest.ba.go | 83 -- binapi/pot/pot_rpc.ba.go | 8 +- binapi/pppoe/pppoe.ba.go | 4 +- binapi/pppoe/pppoe_rest.ba.go | 37 - binapi/pppoe/pppoe_rpc.ba.go | 4 +- binapi/punt/punt.ba.go | 4 +- binapi/punt/punt_rest.ba.go | 83 -- binapi/punt/punt_rpc.ba.go | 8 +- binapi/qos/qos.ba.go | 4 +- binapi/qos/qos_rest.ba.go | 129 --- binapi/qos/qos_rpc.ba.go | 12 +- binapi/rd_cp/rd_cp.ba.go | 4 +- binapi/rd_cp/rd_cp_rest.ba.go | 37 - binapi/rd_cp/rd_cp_rpc.ba.go | 4 +- binapi/rdma/rdma.ba.go | 4 +- binapi/rdma/rdma_rest.ba.go | 60 -- binapi/rdma/rdma_rpc.ba.go | 6 +- binapi/session/session.ba.go | 4 +- binapi/session/session_rest.ba.go | 235 ------ binapi/session/session_rpc.ba.go | 22 +- binapi/span/span.ba.go | 4 +- binapi/span/span_rest.ba.go | 37 - binapi/span/span_rpc.ba.go | 4 +- binapi/sr/sr.ba.go | 4 +- binapi/sr/sr_rest.ba.go | 175 ---- binapi/sr/sr_rpc.ba.go | 16 +- binapi/sr_mpls/sr_mpls.ba.go | 4 +- binapi/sr_mpls/sr_mpls_rest.ba.go | 129 --- binapi/sr_mpls/sr_mpls_rpc.ba.go | 12 +- binapi/sr_types/sr_types.ba.go | 4 +- binapi/stn/stn.ba.go | 4 +- binapi/stn/stn_rest.ba.go | 37 - binapi/stn/stn_rpc.ba.go | 4 +- binapi/svs/svs.ba.go | 4 +- binapi/svs/svs_rest.ba.go | 97 --- binapi/svs/svs_rpc.ba.go | 8 +- binapi/syslog/syslog.ba.go | 4 +- binapi/syslog/syslog_rest.ba.go | 88 -- binapi/syslog/syslog_rpc.ba.go | 10 +- binapi/tapv2/tapv2.ba.go | 4 +- binapi/tapv2/tapv2_rest.ba.go | 60 -- binapi/tapv2/tapv2_rpc.ba.go | 6 +- binapi/tcp/tcp.ba.go | 4 +- binapi/tcp/tcp_rest.ba.go | 37 - binapi/tcp/tcp_rpc.ba.go | 4 +- binapi/teib/teib.ba.go | 4 +- binapi/teib/teib_rest.ba.go | 37 - binapi/teib/teib_rpc.ba.go | 4 +- binapi/tls_openssl/tls_openssl.ba.go | 4 +- binapi/tls_openssl/tls_openssl_rest.ba.go | 37 - binapi/tls_openssl/tls_openssl_rpc.ba.go | 4 +- binapi/trace/trace.ba.go | 4 +- binapi/trace/trace_rest.ba.go | 65 -- binapi/trace/trace_rpc.ba.go | 8 +- binapi/tunnel_types/tunnel_types.ba.go | 4 +- binapi/udp/udp.ba.go | 4 +- binapi/udp/udp_rest.ba.go | 60 -- binapi/udp/udp_rpc.ba.go | 6 +- binapi/udp_ping/udp_ping.ba.go | 4 +- binapi/udp_ping/udp_ping_rest.ba.go | 60 -- binapi/udp_ping/udp_ping_rpc.ba.go | 6 +- binapi/urpf/urpf.ba.go | 4 +- binapi/urpf/urpf_rest.ba.go | 37 - binapi/urpf/urpf_rpc.ba.go | 4 +- binapi/vhost_user/vhost_user.ba.go | 4 +- binapi/vhost_user/vhost_user_rest.ba.go | 83 -- binapi/vhost_user/vhost_user_rpc.ba.go | 8 +- binapi/virtio/virtio.ba.go | 4 +- binapi/virtio/virtio_rest.ba.go | 60 -- binapi/virtio/virtio_rpc.ba.go | 6 +- binapi/virtio_types/virtio_types.ba.go | 4 +- binapi/vmxnet3/vmxnet3.ba.go | 4 +- binapi/vmxnet3/vmxnet3_rest.ba.go | 60 -- binapi/vmxnet3/vmxnet3_rpc.ba.go | 6 +- binapi/vpe/vpe.ba.go | 4 +- binapi/vpe/vpe_rest.ba.go | 245 ------ binapi/vpe/vpe_rpc.ba.go | 26 +- binapi/vpe_types/vpe_types.ba.go | 4 +- binapi/vrrp/vrrp.ba.go | 4 +- binapi/vrrp/vrrp_rest.ba.go | 106 --- binapi/vrrp/vrrp_rpc.ba.go | 10 +- binapi/vxlan/vxlan.ba.go | 4 +- binapi/vxlan/vxlan_rest.ba.go | 83 -- binapi/vxlan/vxlan_rpc.ba.go | 8 +- binapi/vxlan_gbp/vxlan_gbp.ba.go | 4 +- binapi/vxlan_gbp/vxlan_gbp_rest.ba.go | 60 -- binapi/vxlan_gbp/vxlan_gbp_rpc.ba.go | 6 +- binapi/vxlan_gpe/vxlan_gpe.ba.go | 4 +- binapi/vxlan_gpe/vxlan_gpe_rest.ba.go | 60 -- binapi/vxlan_gpe/vxlan_gpe_rpc.ba.go | 6 +- .../vxlan_gpe_ioam_export.ba.go | 4 +- .../vxlan_gpe_ioam_export_rest.ba.go | 37 - .../vxlan_gpe_ioam_export_rpc.ba.go | 4 +- binapigen/binapigen.go | 28 +- binapigen/{gen_rest.go => gen_http.go} | 14 +- binapigen/gen_rpc.go | 12 +- binapigen/run.go | 3 +- go.mod | 4 +- go.sum | 9 +- 299 files changed, 882 insertions(+), 13337 deletions(-) delete mode 100644 binapi/abf/abf_rest.ba.go delete mode 100644 binapi/acl/acl_rest.ba.go delete mode 100644 binapi/af_packet/af_packet_rest.ba.go delete mode 100644 binapi/arp/arp_rest.ba.go delete mode 100644 binapi/avf/avf_rest.ba.go delete mode 100644 binapi/bfd/bfd_rest.ba.go delete mode 100644 binapi/bier/bier_rest.ba.go delete mode 100644 binapi/bond/bond_rest.ba.go delete mode 100644 binapi/builtinurl/builtinurl_rest.ba.go delete mode 100644 binapi/cdp/cdp_rest.ba.go delete mode 100644 binapi/classify/classify_rest.ba.go delete mode 100644 binapi/cop/cop_rest.ba.go delete mode 100644 binapi/ct6/ct6_rest.ba.go delete mode 100644 binapi/dhcp/dhcp_rest.ba.go delete mode 100644 binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp_rest.ba.go delete mode 100644 binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp_rest.ba.go delete mode 100644 binapi/dns/dns_rest.ba.go delete mode 100644 binapi/dslite/dslite_rest.ba.go delete mode 100644 binapi/feature/feature_rest.ba.go delete mode 100644 binapi/flowprobe/flowprobe_rest.ba.go delete mode 100644 binapi/gbp/gbp_rest.ba.go delete mode 100644 binapi/geneve/geneve_rest.ba.go delete mode 100644 binapi/gre/gre_rest.ba.go delete mode 100644 binapi/gso/gso_rest.ba.go delete mode 100644 binapi/gtpu/gtpu_rest.ba.go delete mode 100644 binapi/http_static/http_static_rest.ba.go delete mode 100644 binapi/igmp/igmp_rest.ba.go delete mode 100644 binapi/ikev2/ikev2_rest.ba.go delete mode 100644 binapi/interface/interface_rest.ba.go delete mode 100644 binapi/ioam_cache/ioam_cache_rest.ba.go delete mode 100644 binapi/ioam_export/ioam_export_rest.ba.go delete mode 100644 binapi/ioam_vxlan_gpe/ioam_vxlan_gpe_rest.ba.go delete mode 100644 binapi/ip/ip_rest.ba.go delete mode 100644 binapi/ip6_nd/ip6_nd_rest.ba.go delete mode 100644 binapi/ip_neighbor/ip_neighbor_rest.ba.go delete mode 100644 binapi/ipfix_export/ipfix_export_rest.ba.go delete mode 100644 binapi/ipip/ipip_rest.ba.go delete mode 100644 binapi/ipsec/ipsec_rest.ba.go delete mode 100644 binapi/l2/l2_rest.ba.go delete mode 100644 binapi/l2e/l2e_rest.ba.go delete mode 100644 binapi/l2tp/l2tp_rest.ba.go delete mode 100644 binapi/l3xc/l3xc_rest.ba.go delete mode 100644 binapi/lacp/lacp_rest.ba.go delete mode 100644 binapi/lb/lb_rest.ba.go delete mode 100644 binapi/lisp/lisp_rest.ba.go delete mode 100644 binapi/lisp_gpe/lisp_gpe_rest.ba.go delete mode 100644 binapi/lldp/lldp_rest.ba.go delete mode 100644 binapi/mactime/mactime_rest.ba.go delete mode 100644 binapi/map/map_rest.ba.go delete mode 100644 binapi/mdata/mdata_rest.ba.go delete mode 100644 binapi/memclnt/memclnt_rest.ba.go delete mode 100644 binapi/memif/memif_rest.ba.go delete mode 100644 binapi/mpls/mpls_rest.ba.go delete mode 100644 binapi/nat/nat_rest.ba.go delete mode 100644 binapi/nsh/nsh_rest.ba.go delete mode 100644 binapi/nsim/nsim_rest.ba.go delete mode 100644 binapi/oddbuf/oddbuf_rest.ba.go delete mode 100644 binapi/one/one_rest.ba.go delete mode 100644 binapi/p2p_ethernet/p2p_ethernet_rest.ba.go delete mode 100644 binapi/pg/pg_rest.ba.go delete mode 100644 binapi/pipe/pipe_rest.ba.go delete mode 100644 binapi/policer/policer_rest.ba.go delete mode 100644 binapi/pot/pot_rest.ba.go delete mode 100644 binapi/pppoe/pppoe_rest.ba.go delete mode 100644 binapi/punt/punt_rest.ba.go delete mode 100644 binapi/qos/qos_rest.ba.go delete mode 100644 binapi/rd_cp/rd_cp_rest.ba.go delete mode 100644 binapi/rdma/rdma_rest.ba.go delete mode 100644 binapi/session/session_rest.ba.go delete mode 100644 binapi/span/span_rest.ba.go delete mode 100644 binapi/sr/sr_rest.ba.go delete mode 100644 binapi/sr_mpls/sr_mpls_rest.ba.go delete mode 100644 binapi/stn/stn_rest.ba.go delete mode 100644 binapi/svs/svs_rest.ba.go delete mode 100644 binapi/syslog/syslog_rest.ba.go delete mode 100644 binapi/tapv2/tapv2_rest.ba.go delete mode 100644 binapi/tcp/tcp_rest.ba.go delete mode 100644 binapi/teib/teib_rest.ba.go delete mode 100644 binapi/tls_openssl/tls_openssl_rest.ba.go delete mode 100644 binapi/trace/trace_rest.ba.go delete mode 100644 binapi/udp/udp_rest.ba.go delete mode 100644 binapi/udp_ping/udp_ping_rest.ba.go delete mode 100644 binapi/urpf/urpf_rest.ba.go delete mode 100644 binapi/vhost_user/vhost_user_rest.ba.go delete mode 100644 binapi/virtio/virtio_rest.ba.go delete mode 100644 binapi/vmxnet3/vmxnet3_rest.ba.go delete mode 100644 binapi/vpe/vpe_rest.ba.go delete mode 100644 binapi/vrrp/vrrp_rest.ba.go delete mode 100644 binapi/vxlan/vxlan_rest.ba.go delete mode 100644 binapi/vxlan_gbp/vxlan_gbp_rest.ba.go delete mode 100644 binapi/vxlan_gpe/vxlan_gpe_rest.ba.go delete mode 100644 binapi/vxlan_gpe_ioam_export/vxlan_gpe_ioam_export_rest.ba.go rename binapigen/{gen_rest.go => gen_http.go} (88%) diff --git a/Makefile b/Makefile index 0ae100b..46e04ec 100644 --- a/Makefile +++ b/Makefile @@ -1,23 +1,26 @@ SHELL := /usr/bin/env bash -o pipefail -VERSION ?= $(shell git describe --always --tags --dirty) -COMMIT ?= $(shell git rev-parse HEAD) -BUILD_STAMP ?= $(shell git log -1 --format='%ct') +PROJECT := govpp + +VERSION ?= $(shell git describe --always --tags --dirty) +COMMIT ?= $(shell git rev-parse HEAD) +BUILD_STAMP ?= $(shell git log -1 --format='%ct') BUILD_BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD) BUILD_HOST ?= $(shell hostname) BUILD_USER ?= $(shell id -un) -GO ?= go - GOVPP_PKG := git.fd.io/govpp.git + +VERSION_PKG := $(GOVPP_PKG)/internal/version LDFLAGS = \ - -X ${GOVPP_PKG}/version.version=$(VERSION) \ - -X ${GOVPP_PKG}/version.commitHash=$(COMMIT) \ - -X ${GOVPP_PKG}/version.buildStamp=$(BUILD_STAMP) \ - -X ${GOVPP_PKG}/version.buildBranch=$(BUILD_BRANCH) \ - -X ${GOVPP_PKG}/version.buildUser=$(BUILD_USER) \ - -X ${GOVPP_PKG}/version.buildHost=$(BUILD_HOST) + -X $(VERSION_PKG).version=$(VERSION) \ + -X $(VERSION_PKG).commitHash=$(COMMIT) \ + -X $(VERSION_PKG).buildStamp=$(BUILD_STAMP) \ + -X $(VERSION_PKG).buildBranch=$(BUILD_BRANCH) \ + -X $(VERSION_PKG).buildUser=$(BUILD_USER) \ + -X $(VERSION_PKG).buildHost=$(BUILD_HOST) + ifeq ($(NOSTRIP),) LDFLAGS += -w -s endif @@ -35,8 +38,6 @@ ifeq ($(V),1) GO_BUILD_ARGS += -v endif -VPP_VERSION ?= $(shell dpkg-query -f '\${Version}' -W vpp) - # VPP Docker image to use for api generation (gen-binapi-docker) VPP_IMG ?= ligato/vpp-base:latest # Local VPP directory used for binary api generation (gen-binapi-from-code) @@ -46,34 +47,28 @@ BINAPI_DIR ?= ./binapi # Binapi generator path BINAPI_GENERATOR = ./bin/binapi-generator +.DEFAULT_GOAL = help + bin: mkdir -p bin build: ## Build all @echo "# building ${VERSION}" - $(GO) build ${GO_BUILD_ARGS} ./... - -cmd-binapi-generator: bin ## Build commands - $(GO) build ${GO_BUILD_ARGS} -o bin ./cmd/binapi-generator + go build ${GO_BUILD_ARGS} ./... cmd: bin ## Build commands - $(GO) build ${GO_BUILD_ARGS} -o bin ./cmd/... + go build ${GO_BUILD_ARGS} -o bin ./cmd/... examples: bin ## Build examples - $(GO) build ${GO_BUILD_ARGS} -o bin ./examples/... - -clean: ## Clean all - @echo "# cleaning" - $(GO) clean -v ./... + go build ${GO_BUILD_ARGS} -o bin ./examples/... test: ## Run unit tests - $(GO) version @echo "# running tests" - $(GO) test -tags="${GO_BUILD_TAGS}" ./... + go test -tags="${GO_BUILD_TAGS}" ./... -integration: ## Run integration tests +test-integration: ## Run integration tests @echo "# running integration tests" - $(GO) test -tags="integration ${GO_BUILD_TAGS}" ./test/integration + go test -tags="integration ${GO_BUILD_TAGS}" ./test/integration lint: ## Run code linter @echo "# running linter" @@ -83,19 +78,17 @@ install: install-generator install-proxy ## Install all install-generator: ## Install binapi-generator @echo "# installing binapi-generator ${VERSION}" - @$(GO) install ${GO_BUILD_ARGS} ./cmd/binapi-generator + @go install ${GO_BUILD_ARGS} ./cmd/binapi-generator install-proxy: ## Install vpp-proxy @echo "# installing vpp-proxy ${VERSION}" - $(GO) install ${GO_BUILD_ARGS} ./cmd/vpp-proxy + go install ${GO_BUILD_ARGS} ./cmd/vpp-proxy -generate: ## Generate all - @echo "# generating code" - $(GO) generate -x ./... +generate: generate-binapi ## Generate all generate-binapi: install-generator ## Generate binapi code - @echo "# generating binapi VPP $(VPP_VERSION)" - $(GO) generate -x "$(BINAPI_DIR)" + @echo "# generating binapi" + go generate -x "$(BINAPI_DIR)" gen-binapi-from-code: cmd-binapi-generator $(eval VPP_API_DIR := ${VPP_DIR}/build-root/install-vpp-native/vpp/share/vpp/api/) @@ -122,15 +115,9 @@ gen-binapi-docker: install-generator ## Generate binapi code (using Docker) "${VPP_IMG}" \ sh -ec "cd $(BINAPI_DIR) && $(cmds)" -extras: - @make -C extras - help: - @echo "List of make targets:" @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' -.DEFAULT_GOAL = help - .PHONY: help \ build cmd examples clean \ lint test integration \ diff --git a/binapi/abf/abf.ba.go b/binapi/abf/abf.ba.go index 2b28afe..fc4351b 100644 --- a/binapi/abf/abf.ba.go +++ b/binapi/abf/abf.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/abf.api.json // Package abf contains generated bindings for API file abf.api. diff --git a/binapi/abf/abf_rest.ba.go b/binapi/abf/abf_rest.ba.go deleted file mode 100644 index e05e834..0000000 --- a/binapi/abf/abf_rest.ba.go +++ /dev/null @@ -1,74 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package abf - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/abf_itf_attach_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(AbfItfAttachAddDel) - 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.AbfItfAttachAddDel(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("/abf_plugin_get_version", func(w http.ResponseWriter, req *http.Request) { - var request = new(AbfPluginGetVersion) - reply, err := rpc.AbfPluginGetVersion(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("/abf_policy_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(AbfPolicyAddDel) - 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.AbfPolicyAddDel(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/abf/abf_rpc.ba.go b/binapi/abf/abf_rpc.ba.go index 9498ff6..5b2f825 100644 --- a/binapi/abf/abf_rpc.ba.go +++ b/binapi/abf/abf_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service abf. +// RPCService defines RPC service abf. type RPCService interface { AbfItfAttachAddDel(ctx context.Context, in *AbfItfAttachAddDel) (*AbfItfAttachAddDelReply, error) AbfItfAttachDump(ctx context.Context, in *AbfItfAttachDump) (RPCService_AbfItfAttachDumpClient, error) @@ -34,7 +34,7 @@ func (c *serviceClient) AbfItfAttachAddDel(ctx context.Context, in *AbfItfAttach if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) AbfItfAttachDump(ctx context.Context, in *AbfItfAttachDump) (RPCService_AbfItfAttachDumpClient, error) { @@ -91,7 +91,7 @@ func (c *serviceClient) AbfPolicyAddDel(ctx context.Context, in *AbfPolicyAddDel if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) AbfPolicyDump(ctx context.Context, in *AbfPolicyDump) (RPCService_AbfPolicyDumpClient, error) { diff --git a/binapi/acl/acl.ba.go b/binapi/acl/acl.ba.go index 1f47a01..c1114f1 100644 --- a/binapi/acl/acl.ba.go +++ b/binapi/acl/acl.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/acl.api.json // Package acl contains generated bindings for API file acl.api. diff --git a/binapi/acl/acl_rest.ba.go b/binapi/acl/acl_rest.ba.go deleted file mode 100644 index 0dd8c94..0000000 --- a/binapi/acl/acl_rest.ba.go +++ /dev/null @@ -1,300 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package acl - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/acl_add_replace", func(w http.ResponseWriter, req *http.Request) { - var request = new(ACLAddReplace) - 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.ACLAddReplace(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("/acl_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(ACLDel) - 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.ACLDel(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("/acl_interface_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(ACLInterfaceAddDel) - 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.ACLInterfaceAddDel(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("/acl_interface_set_acl_list", func(w http.ResponseWriter, req *http.Request) { - var request = new(ACLInterfaceSetACLList) - 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.ACLInterfaceSetACLList(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("/acl_interface_set_etype_whitelist", func(w http.ResponseWriter, req *http.Request) { - var request = new(ACLInterfaceSetEtypeWhitelist) - 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.ACLInterfaceSetEtypeWhitelist(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("/acl_plugin_control_ping", func(w http.ResponseWriter, req *http.Request) { - var request = new(ACLPluginControlPing) - reply, err := rpc.ACLPluginControlPing(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("/acl_plugin_get_conn_table_max_entries", func(w http.ResponseWriter, req *http.Request) { - var request = new(ACLPluginGetConnTableMaxEntries) - reply, err := rpc.ACLPluginGetConnTableMaxEntries(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("/acl_plugin_get_version", func(w http.ResponseWriter, req *http.Request) { - var request = new(ACLPluginGetVersion) - reply, err := rpc.ACLPluginGetVersion(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("/acl_stats_intf_counters_enable", func(w http.ResponseWriter, req *http.Request) { - var request = new(ACLStatsIntfCountersEnable) - 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.ACLStatsIntfCountersEnable(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("/macip_acl_add", func(w http.ResponseWriter, req *http.Request) { - var request = new(MacipACLAdd) - 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.MacipACLAdd(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("/macip_acl_add_replace", func(w http.ResponseWriter, req *http.Request) { - var request = new(MacipACLAddReplace) - 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.MacipACLAddReplace(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("/macip_acl_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(MacipACLDel) - 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.MacipACLDel(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("/macip_acl_interface_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(MacipACLInterfaceAddDel) - 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.MacipACLInterfaceAddDel(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("/macip_acl_interface_get", func(w http.ResponseWriter, req *http.Request) { - var request = new(MacipACLInterfaceGet) - reply, err := rpc.MacipACLInterfaceGet(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/acl/acl_rpc.ba.go b/binapi/acl/acl_rpc.ba.go index d1d2220..da1ecca 100644 --- a/binapi/acl/acl_rpc.ba.go +++ b/binapi/acl/acl_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service acl. +// RPCService defines RPC service acl. type RPCService interface { ACLAddReplace(ctx context.Context, in *ACLAddReplace) (*ACLAddReplaceReply, error) ACLDel(ctx context.Context, in *ACLDel) (*ACLDelReply, error) @@ -48,7 +48,7 @@ func (c *serviceClient) ACLAddReplace(ctx context.Context, in *ACLAddReplace) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ACLDel(ctx context.Context, in *ACLDel) (*ACLDelReply, error) { @@ -57,7 +57,7 @@ func (c *serviceClient) ACLDel(ctx context.Context, in *ACLDel) (*ACLDelReply, e if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ACLDump(ctx context.Context, in *ACLDump) (RPCService_ACLDumpClient, error) { @@ -105,7 +105,7 @@ func (c *serviceClient) ACLInterfaceAddDel(ctx context.Context, in *ACLInterface if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ACLInterfaceEtypeWhitelistDump(ctx context.Context, in *ACLInterfaceEtypeWhitelistDump) (RPCService_ACLInterfaceEtypeWhitelistDumpClient, error) { @@ -192,7 +192,7 @@ func (c *serviceClient) ACLInterfaceSetACLList(ctx context.Context, in *ACLInter if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ACLInterfaceSetEtypeWhitelist(ctx context.Context, in *ACLInterfaceSetEtypeWhitelist) (*ACLInterfaceSetEtypeWhitelistReply, error) { @@ -201,7 +201,7 @@ func (c *serviceClient) ACLInterfaceSetEtypeWhitelist(ctx context.Context, in *A if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ACLPluginControlPing(ctx context.Context, in *ACLPluginControlPing) (*ACLPluginControlPingReply, error) { @@ -210,7 +210,7 @@ func (c *serviceClient) ACLPluginControlPing(ctx context.Context, in *ACLPluginC if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ACLPluginGetConnTableMaxEntries(ctx context.Context, in *ACLPluginGetConnTableMaxEntries) (*ACLPluginGetConnTableMaxEntriesReply, error) { @@ -237,7 +237,7 @@ func (c *serviceClient) ACLStatsIntfCountersEnable(ctx context.Context, in *ACLS if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MacipACLAdd(ctx context.Context, in *MacipACLAdd) (*MacipACLAddReply, error) { @@ -246,7 +246,7 @@ func (c *serviceClient) MacipACLAdd(ctx context.Context, in *MacipACLAdd) (*Maci if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MacipACLAddReplace(ctx context.Context, in *MacipACLAddReplace) (*MacipACLAddReplaceReply, error) { @@ -255,7 +255,7 @@ func (c *serviceClient) MacipACLAddReplace(ctx context.Context, in *MacipACLAddR if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MacipACLDel(ctx context.Context, in *MacipACLDel) (*MacipACLDelReply, error) { @@ -264,7 +264,7 @@ func (c *serviceClient) MacipACLDel(ctx context.Context, in *MacipACLDel) (*Maci if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MacipACLDump(ctx context.Context, in *MacipACLDump) (RPCService_MacipACLDumpClient, error) { @@ -312,7 +312,7 @@ func (c *serviceClient) MacipACLInterfaceAddDel(ctx context.Context, in *MacipAC if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MacipACLInterfaceGet(ctx context.Context, in *MacipACLInterfaceGet) (*MacipACLInterfaceGetReply, error) { diff --git a/binapi/acl_types/acl_types.ba.go b/binapi/acl_types/acl_types.ba.go index 0c8efc2..27f951f 100644 --- a/binapi/acl_types/acl_types.ba.go +++ b/binapi/acl_types/acl_types.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/acl_types.api.json // Package acl_types contains generated bindings for API file acl_types.api. diff --git a/binapi/af_packet/af_packet.ba.go b/binapi/af_packet/af_packet.ba.go index 750e2ce..9cde877 100644 --- a/binapi/af_packet/af_packet.ba.go +++ b/binapi/af_packet/af_packet.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/core/af_packet.api.json // Package af_packet contains generated bindings for API file af_packet.api. diff --git a/binapi/af_packet/af_packet_rest.ba.go b/binapi/af_packet/af_packet_rest.ba.go deleted file mode 100644 index e6c498c..0000000 --- a/binapi/af_packet/af_packet_rest.ba.go +++ /dev/null @@ -1,83 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package af_packet - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/af_packet_create", func(w http.ResponseWriter, req *http.Request) { - var request = new(AfPacketCreate) - 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.AfPacketCreate(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("/af_packet_delete", func(w http.ResponseWriter, req *http.Request) { - var request = new(AfPacketDelete) - 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.AfPacketDelete(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("/af_packet_set_l4_cksum_offload", func(w http.ResponseWriter, req *http.Request) { - var request = new(AfPacketSetL4CksumOffload) - 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.AfPacketSetL4CksumOffload(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/af_packet/af_packet_rpc.ba.go b/binapi/af_packet/af_packet_rpc.ba.go index 0603e3b..f8c3732 100644 --- a/binapi/af_packet/af_packet_rpc.ba.go +++ b/binapi/af_packet/af_packet_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service af_packet. +// RPCService defines RPC service af_packet. type RPCService interface { AfPacketCreate(ctx context.Context, in *AfPacketCreate) (*AfPacketCreateReply, error) AfPacketDelete(ctx context.Context, in *AfPacketDelete) (*AfPacketDeleteReply, error) @@ -33,7 +33,7 @@ func (c *serviceClient) AfPacketCreate(ctx context.Context, in *AfPacketCreate) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) AfPacketDelete(ctx context.Context, in *AfPacketDelete) (*AfPacketDeleteReply, error) { @@ -42,7 +42,7 @@ func (c *serviceClient) AfPacketDelete(ctx context.Context, in *AfPacketDelete) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) AfPacketDump(ctx context.Context, in *AfPacketDump) (RPCService_AfPacketDumpClient, error) { @@ -90,5 +90,5 @@ func (c *serviceClient) AfPacketSetL4CksumOffload(ctx context.Context, in *AfPac if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/arp/arp.ba.go b/binapi/arp/arp.ba.go index 90ff55b..e36c837 100644 --- a/binapi/arp/arp.ba.go +++ b/binapi/arp/arp.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/core/arp.api.json // Package arp contains generated bindings for API file arp.api. diff --git a/binapi/arp/arp_rest.ba.go b/binapi/arp/arp_rest.ba.go deleted file mode 100644 index 71a07d9..0000000 --- a/binapi/arp/arp_rest.ba.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package arp - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/proxy_arp_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(ProxyArpAddDel) - 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.ProxyArpAddDel(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("/proxy_arp_intfc_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(ProxyArpIntfcEnableDisable) - 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.ProxyArpIntfcEnableDisable(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/arp/arp_rpc.ba.go b/binapi/arp/arp_rpc.ba.go index 8bb64ce..6e60bf3 100644 --- a/binapi/arp/arp_rpc.ba.go +++ b/binapi/arp/arp_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service arp. +// RPCService defines RPC service arp. type RPCService interface { ProxyArpAddDel(ctx context.Context, in *ProxyArpAddDel) (*ProxyArpAddDelReply, error) ProxyArpDump(ctx context.Context, in *ProxyArpDump) (RPCService_ProxyArpDumpClient, error) @@ -33,7 +33,7 @@ func (c *serviceClient) ProxyArpAddDel(ctx context.Context, in *ProxyArpAddDel) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ProxyArpDump(ctx context.Context, in *ProxyArpDump) (RPCService_ProxyArpDumpClient, error) { @@ -120,5 +120,5 @@ func (c *serviceClient) ProxyArpIntfcEnableDisable(ctx context.Context, in *Prox if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/avf/avf.ba.go b/binapi/avf/avf.ba.go index edfa26e..0dc1ac0 100644 --- a/binapi/avf/avf.ba.go +++ b/binapi/avf/avf.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/avf.api.json // Package avf contains generated bindings for API file avf.api. diff --git a/binapi/avf/avf_rest.ba.go b/binapi/avf/avf_rest.ba.go deleted file mode 100644 index 1a9d7f3..0000000 --- a/binapi/avf/avf_rest.ba.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package avf - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/avf_create", func(w http.ResponseWriter, req *http.Request) { - var request = new(AvfCreate) - 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.AvfCreate(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("/avf_delete", func(w http.ResponseWriter, req *http.Request) { - var request = new(AvfDelete) - 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.AvfDelete(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/avf/avf_rpc.ba.go b/binapi/avf/avf_rpc.ba.go index 46aa77c..5747834 100644 --- a/binapi/avf/avf_rpc.ba.go +++ b/binapi/avf/avf_rpc.ba.go @@ -8,7 +8,7 @@ import ( api "git.fd.io/govpp.git/api" ) -// RPCService defines RPC service avf. +// RPCService defines RPC service avf. type RPCService interface { AvfCreate(ctx context.Context, in *AvfCreate) (*AvfCreateReply, error) AvfDelete(ctx context.Context, in *AvfDelete) (*AvfDeleteReply, error) @@ -28,7 +28,7 @@ func (c *serviceClient) AvfCreate(ctx context.Context, in *AvfCreate) (*AvfCreat if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) AvfDelete(ctx context.Context, in *AvfDelete) (*AvfDeleteReply, error) { @@ -37,5 +37,5 @@ func (c *serviceClient) AvfDelete(ctx context.Context, in *AvfDelete) (*AvfDelet if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/bfd/bfd.ba.go b/binapi/bfd/bfd.ba.go index 65b828f..624bc22 100644 --- a/binapi/bfd/bfd.ba.go +++ b/binapi/bfd/bfd.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/core/bfd.api.json // Package bfd contains generated bindings for API file bfd.api. diff --git a/binapi/bfd/bfd_rest.ba.go b/binapi/bfd/bfd_rest.ba.go deleted file mode 100644 index 2f25f8b..0000000 --- a/binapi/bfd/bfd_rest.ba.go +++ /dev/null @@ -1,272 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package bfd - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/bfd_auth_del_key", func(w http.ResponseWriter, req *http.Request) { - var request = new(BfdAuthDelKey) - 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.BfdAuthDelKey(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("/bfd_auth_set_key", func(w http.ResponseWriter, req *http.Request) { - var request = new(BfdAuthSetKey) - 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.BfdAuthSetKey(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("/bfd_udp_add", func(w http.ResponseWriter, req *http.Request) { - var request = new(BfdUDPAdd) - 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.BfdUDPAdd(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("/bfd_udp_auth_activate", func(w http.ResponseWriter, req *http.Request) { - var request = new(BfdUDPAuthActivate) - 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.BfdUDPAuthActivate(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("/bfd_udp_auth_deactivate", func(w http.ResponseWriter, req *http.Request) { - var request = new(BfdUDPAuthDeactivate) - 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.BfdUDPAuthDeactivate(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("/bfd_udp_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(BfdUDPDel) - 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.BfdUDPDel(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("/bfd_udp_del_echo_source", func(w http.ResponseWriter, req *http.Request) { - var request = new(BfdUDPDelEchoSource) - reply, err := rpc.BfdUDPDelEchoSource(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("/bfd_udp_get_echo_source", func(w http.ResponseWriter, req *http.Request) { - var request = new(BfdUDPGetEchoSource) - reply, err := rpc.BfdUDPGetEchoSource(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("/bfd_udp_mod", func(w http.ResponseWriter, req *http.Request) { - var request = new(BfdUDPMod) - 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.BfdUDPMod(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("/bfd_udp_session_set_flags", func(w http.ResponseWriter, req *http.Request) { - var request = new(BfdUDPSessionSetFlags) - 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.BfdUDPSessionSetFlags(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("/bfd_udp_set_echo_source", func(w http.ResponseWriter, req *http.Request) { - var request = new(BfdUDPSetEchoSource) - 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.BfdUDPSetEchoSource(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_bfd_events", func(w http.ResponseWriter, req *http.Request) { - var request = new(WantBfdEvents) - 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.WantBfdEvents(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/bfd/bfd_rpc.ba.go b/binapi/bfd/bfd_rpc.ba.go index 68a9893..a2e5c5c 100644 --- a/binapi/bfd/bfd_rpc.ba.go +++ b/binapi/bfd/bfd_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service bfd. +// RPCService defines RPC service bfd. type RPCService interface { BfdAuthDelKey(ctx context.Context, in *BfdAuthDelKey) (*BfdAuthDelKeyReply, error) BfdAuthKeysDump(ctx context.Context, in *BfdAuthKeysDump) (RPCService_BfdAuthKeysDumpClient, error) @@ -43,7 +43,7 @@ func (c *serviceClient) BfdAuthDelKey(ctx context.Context, in *BfdAuthDelKey) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BfdAuthKeysDump(ctx context.Context, in *BfdAuthKeysDump) (RPCService_BfdAuthKeysDumpClient, error) { @@ -91,7 +91,7 @@ func (c *serviceClient) BfdAuthSetKey(ctx context.Context, in *BfdAuthSetKey) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BfdUDPAdd(ctx context.Context, in *BfdUDPAdd) (*BfdUDPAddReply, error) { @@ -100,7 +100,7 @@ func (c *serviceClient) BfdUDPAdd(ctx context.Context, in *BfdUDPAdd) (*BfdUDPAd if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BfdUDPAuthActivate(ctx context.Context, in *BfdUDPAuthActivate) (*BfdUDPAuthActivateReply, error) { @@ -109,7 +109,7 @@ func (c *serviceClient) BfdUDPAuthActivate(ctx context.Context, in *BfdUDPAuthAc if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BfdUDPAuthDeactivate(ctx context.Context, in *BfdUDPAuthDeactivate) (*BfdUDPAuthDeactivateReply, error) { @@ -118,7 +118,7 @@ func (c *serviceClient) BfdUDPAuthDeactivate(ctx context.Context, in *BfdUDPAuth if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BfdUDPDel(ctx context.Context, in *BfdUDPDel) (*BfdUDPDelReply, error) { @@ -127,7 +127,7 @@ func (c *serviceClient) BfdUDPDel(ctx context.Context, in *BfdUDPDel) (*BfdUDPDe if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BfdUDPDelEchoSource(ctx context.Context, in *BfdUDPDelEchoSource) (*BfdUDPDelEchoSourceReply, error) { @@ -136,7 +136,7 @@ func (c *serviceClient) BfdUDPDelEchoSource(ctx context.Context, in *BfdUDPDelEc if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BfdUDPGetEchoSource(ctx context.Context, in *BfdUDPGetEchoSource) (*BfdUDPGetEchoSourceReply, error) { @@ -145,7 +145,7 @@ func (c *serviceClient) BfdUDPGetEchoSource(ctx context.Context, in *BfdUDPGetEc if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BfdUDPMod(ctx context.Context, in *BfdUDPMod) (*BfdUDPModReply, error) { @@ -154,7 +154,7 @@ func (c *serviceClient) BfdUDPMod(ctx context.Context, in *BfdUDPMod) (*BfdUDPMo if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BfdUDPSessionDump(ctx context.Context, in *BfdUDPSessionDump) (RPCService_BfdUDPSessionDumpClient, error) { @@ -202,7 +202,7 @@ func (c *serviceClient) BfdUDPSessionSetFlags(ctx context.Context, in *BfdUDPSes if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BfdUDPSetEchoSource(ctx context.Context, in *BfdUDPSetEchoSource) (*BfdUDPSetEchoSourceReply, error) { @@ -211,7 +211,7 @@ func (c *serviceClient) BfdUDPSetEchoSource(ctx context.Context, in *BfdUDPSetEc if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) WantBfdEvents(ctx context.Context, in *WantBfdEvents) (*WantBfdEventsReply, error) { @@ -220,5 +220,5 @@ func (c *serviceClient) WantBfdEvents(ctx context.Context, in *WantBfdEvents) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/bier/bier.ba.go b/binapi/bier/bier.ba.go index f024d80..76b1c77 100644 --- a/binapi/bier/bier.ba.go +++ b/binapi/bier/bier.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/core/bier.api.json // Package bier contains generated bindings for API file bier.api. diff --git a/binapi/bier/bier_rest.ba.go b/binapi/bier/bier_rest.ba.go deleted file mode 100644 index f65f8f3..0000000 --- a/binapi/bier/bier_rest.ba.go +++ /dev/null @@ -1,152 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package bier - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/bier_disp_entry_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(BierDispEntryAddDel) - 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.BierDispEntryAddDel(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("/bier_disp_table_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(BierDispTableAddDel) - 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.BierDispTableAddDel(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("/bier_imp_add", func(w http.ResponseWriter, req *http.Request) { - var request = new(BierImpAdd) - 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.BierImpAdd(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("/bier_imp_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(BierImpDel) - 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.BierImpDel(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("/bier_route_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(BierRouteAddDel) - 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.BierRouteAddDel(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("/bier_table_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(BierTableAddDel) - 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.BierTableAddDel(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/bier/bier_rpc.ba.go b/binapi/bier/bier_rpc.ba.go index f2e44c6..56b027c 100644 --- a/binapi/bier/bier_rpc.ba.go +++ b/binapi/bier/bier_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service bier. +// RPCService defines RPC service bier. type RPCService interface { BierDispEntryAddDel(ctx context.Context, in *BierDispEntryAddDel) (*BierDispEntryAddDelReply, error) BierDispEntryDump(ctx context.Context, in *BierDispEntryDump) (RPCService_BierDispEntryDumpClient, error) @@ -40,7 +40,7 @@ func (c *serviceClient) BierDispEntryAddDel(ctx context.Context, in *BierDispEnt if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BierDispEntryDump(ctx context.Context, in *BierDispEntryDump) (RPCService_BierDispEntryDumpClient, error) { @@ -88,7 +88,7 @@ func (c *serviceClient) BierDispTableAddDel(ctx context.Context, in *BierDispTab if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BierDispTableDump(ctx context.Context, in *BierDispTableDump) (RPCService_BierDispTableDumpClient, error) { @@ -136,7 +136,7 @@ func (c *serviceClient) BierImpAdd(ctx context.Context, in *BierImpAdd) (*BierIm if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BierImpDel(ctx context.Context, in *BierImpDel) (*BierImpDelReply, error) { @@ -145,7 +145,7 @@ func (c *serviceClient) BierImpDel(ctx context.Context, in *BierImpDel) (*BierIm if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BierImpDump(ctx context.Context, in *BierImpDump) (RPCService_BierImpDumpClient, error) { @@ -193,7 +193,7 @@ func (c *serviceClient) BierRouteAddDel(ctx context.Context, in *BierRouteAddDel if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BierRouteDump(ctx context.Context, in *BierRouteDump) (RPCService_BierRouteDumpClient, error) { @@ -241,7 +241,7 @@ func (c *serviceClient) BierTableAddDel(ctx context.Context, in *BierTableAddDel if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BierTableDump(ctx context.Context, in *BierTableDump) (RPCService_BierTableDumpClient, error) { diff --git a/binapi/bond/bond.ba.go b/binapi/bond/bond.ba.go index c9e7027..61aafc7 100644 --- a/binapi/bond/bond.ba.go +++ b/binapi/bond/bond.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/core/bond.api.json // Package bond contains generated bindings for API file bond.api. diff --git a/binapi/bond/bond_rest.ba.go b/binapi/bond/bond_rest.ba.go deleted file mode 100644 index c1893d5..0000000 --- a/binapi/bond/bond_rest.ba.go +++ /dev/null @@ -1,129 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package bond - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/bond_create", func(w http.ResponseWriter, req *http.Request) { - var request = new(BondCreate) - 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.BondCreate(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("/bond_delete", func(w http.ResponseWriter, req *http.Request) { - var request = new(BondDelete) - 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.BondDelete(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("/bond_detach_slave", func(w http.ResponseWriter, req *http.Request) { - var request = new(BondDetachSlave) - 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.BondDetachSlave(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("/bond_enslave", func(w http.ResponseWriter, req *http.Request) { - var request = new(BondEnslave) - 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.BondEnslave(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("/sw_interface_set_bond_weight", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceSetBondWeight) - 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.SwInterfaceSetBondWeight(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/bond/bond_rpc.ba.go b/binapi/bond/bond_rpc.ba.go index 8e3b254..67fc538 100644 --- a/binapi/bond/bond_rpc.ba.go +++ b/binapi/bond/bond_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service bond. +// RPCService defines RPC service bond. type RPCService interface { BondCreate(ctx context.Context, in *BondCreate) (*BondCreateReply, error) BondDelete(ctx context.Context, in *BondDelete) (*BondDeleteReply, error) @@ -36,7 +36,7 @@ func (c *serviceClient) BondCreate(ctx context.Context, in *BondCreate) (*BondCr if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BondDelete(ctx context.Context, in *BondDelete) (*BondDeleteReply, error) { @@ -45,7 +45,7 @@ func (c *serviceClient) BondDelete(ctx context.Context, in *BondDelete) (*BondDe if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BondDetachSlave(ctx context.Context, in *BondDetachSlave) (*BondDetachSlaveReply, error) { @@ -54,7 +54,7 @@ func (c *serviceClient) BondDetachSlave(ctx context.Context, in *BondDetachSlave if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BondEnslave(ctx context.Context, in *BondEnslave) (*BondEnslaveReply, error) { @@ -63,7 +63,7 @@ func (c *serviceClient) BondEnslave(ctx context.Context, in *BondEnslave) (*Bond if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceBondDump(ctx context.Context, in *SwInterfaceBondDump) (RPCService_SwInterfaceBondDumpClient, error) { @@ -111,7 +111,7 @@ func (c *serviceClient) SwInterfaceSetBondWeight(ctx context.Context, in *SwInte if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceSlaveDump(ctx context.Context, in *SwInterfaceSlaveDump) (RPCService_SwInterfaceSlaveDumpClient, error) { diff --git a/binapi/builtinurl/builtinurl.ba.go b/binapi/builtinurl/builtinurl.ba.go index 6b0350d..2c3ccf2 100644 --- a/binapi/builtinurl/builtinurl.ba.go +++ b/binapi/builtinurl/builtinurl.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/builtinurl.api.json // Package builtinurl contains generated bindings for API file builtinurl.api. diff --git a/binapi/builtinurl/builtinurl_rest.ba.go b/binapi/builtinurl/builtinurl_rest.ba.go deleted file mode 100644 index a4373f1..0000000 --- a/binapi/builtinurl/builtinurl_rest.ba.go +++ /dev/null @@ -1,27 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package builtinurl - -import ( - "encoding/json" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/builtinurl_enable", func(w http.ResponseWriter, req *http.Request) { - var request = new(BuiltinurlEnable) - reply, err := rpc.BuiltinurlEnable(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/builtinurl/builtinurl_rpc.ba.go b/binapi/builtinurl/builtinurl_rpc.ba.go index 2edf7d5..f44e843 100644 --- a/binapi/builtinurl/builtinurl_rpc.ba.go +++ b/binapi/builtinurl/builtinurl_rpc.ba.go @@ -8,7 +8,7 @@ import ( api "git.fd.io/govpp.git/api" ) -// RPCService defines RPC service builtinurl. +// RPCService defines RPC service builtinurl. type RPCService interface { BuiltinurlEnable(ctx context.Context, in *BuiltinurlEnable) (*BuiltinurlEnableReply, error) } @@ -27,5 +27,5 @@ func (c *serviceClient) BuiltinurlEnable(ctx context.Context, in *BuiltinurlEnab if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/cdp/cdp.ba.go b/binapi/cdp/cdp.ba.go index 5430d74..dbee58e 100644 --- a/binapi/cdp/cdp.ba.go +++ b/binapi/cdp/cdp.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/cdp.api.json // Package cdp contains generated bindings for API file cdp.api. diff --git a/binapi/cdp/cdp_rest.ba.go b/binapi/cdp/cdp_rest.ba.go deleted file mode 100644 index b414757..0000000 --- a/binapi/cdp/cdp_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package cdp - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/cdp_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(CdpEnableDisable) - 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.CdpEnableDisable(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/cdp/cdp_rpc.ba.go b/binapi/cdp/cdp_rpc.ba.go index 1933d2f..8eac86c 100644 --- a/binapi/cdp/cdp_rpc.ba.go +++ b/binapi/cdp/cdp_rpc.ba.go @@ -8,7 +8,7 @@ import ( api "git.fd.io/govpp.git/api" ) -// RPCService defines RPC service cdp. +// RPCService defines RPC service cdp. type RPCService interface { CdpEnableDisable(ctx context.Context, in *CdpEnableDisable) (*CdpEnableDisableReply, error) } @@ -27,5 +27,5 @@ func (c *serviceClient) CdpEnableDisable(ctx context.Context, in *CdpEnableDisab if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/classify/classify.ba.go b/binapi/classify/classify.ba.go index 16bc4b8..89be260 100644 --- a/binapi/classify/classify.ba.go +++ b/binapi/classify/classify.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/core/classify.api.json // Package classify contains generated bindings for API file classify.api. diff --git a/binapi/classify/classify_rest.ba.go b/binapi/classify/classify_rest.ba.go deleted file mode 100644 index f50fefd..0000000 --- a/binapi/classify/classify_rest.ba.go +++ /dev/null @@ -1,258 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package classify - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/classify_add_del_session", func(w http.ResponseWriter, req *http.Request) { - var request = new(ClassifyAddDelSession) - 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.ClassifyAddDelSession(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("/classify_add_del_table", func(w http.ResponseWriter, req *http.Request) { - var request = new(ClassifyAddDelTable) - 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.ClassifyAddDelTable(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("/classify_set_interface_ip_table", func(w http.ResponseWriter, req *http.Request) { - var request = new(ClassifySetInterfaceIPTable) - 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.ClassifySetInterfaceIPTable(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("/classify_set_interface_l2_tables", func(w http.ResponseWriter, req *http.Request) { - var request = new(ClassifySetInterfaceL2Tables) - 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.ClassifySetInterfaceL2Tables(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("/classify_table_by_interface", func(w http.ResponseWriter, req *http.Request) { - var request = new(ClassifyTableByInterface) - 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.ClassifyTableByInterface(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("/classify_table_ids", func(w http.ResponseWriter, req *http.Request) { - var request = new(ClassifyTableIds) - reply, err := rpc.ClassifyTableIds(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("/classify_table_info", func(w http.ResponseWriter, req *http.Request) { - var request = new(ClassifyTableInfo) - 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.ClassifyTableInfo(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("/flow_classify_set_interface", func(w http.ResponseWriter, req *http.Request) { - var request = new(FlowClassifySetInterface) - 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.FlowClassifySetInterface(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("/input_acl_set_interface", func(w http.ResponseWriter, req *http.Request) { - var request = new(InputACLSetInterface) - 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.InputACLSetInterface(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("/output_acl_set_interface", func(w http.ResponseWriter, req *http.Request) { - var request = new(OutputACLSetInterface) - 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.OutputACLSetInterface(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("/policer_classify_set_interface", func(w http.ResponseWriter, req *http.Request) { - var request = new(PolicerClassifySetInterface) - 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.PolicerClassifySetInterface(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/classify/classify_rpc.ba.go b/binapi/classify/classify_rpc.ba.go index de29fa5..5bbb43b 100644 --- a/binapi/classify/classify_rpc.ba.go +++ b/binapi/classify/classify_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service classify. +// RPCService defines RPC service classify. type RPCService interface { ClassifyAddDelSession(ctx context.Context, in *ClassifyAddDelSession) (*ClassifyAddDelSessionReply, error) ClassifyAddDelTable(ctx context.Context, in *ClassifyAddDelTable) (*ClassifyAddDelTableReply, error) @@ -43,7 +43,7 @@ func (c *serviceClient) ClassifyAddDelSession(ctx context.Context, in *ClassifyA if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ClassifyAddDelTable(ctx context.Context, in *ClassifyAddDelTable) (*ClassifyAddDelTableReply, error) { @@ -52,7 +52,7 @@ func (c *serviceClient) ClassifyAddDelTable(ctx context.Context, in *ClassifyAdd if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ClassifySessionDump(ctx context.Context, in *ClassifySessionDump) (RPCService_ClassifySessionDumpClient, error) { @@ -100,7 +100,7 @@ func (c *serviceClient) ClassifySetInterfaceIPTable(ctx context.Context, in *Cla if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ClassifySetInterfaceL2Tables(ctx context.Context, in *ClassifySetInterfaceL2Tables) (*ClassifySetInterfaceL2TablesReply, error) { @@ -109,7 +109,7 @@ func (c *serviceClient) ClassifySetInterfaceL2Tables(ctx context.Context, in *Cl if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ClassifyTableByInterface(ctx context.Context, in *ClassifyTableByInterface) (*ClassifyTableByInterfaceReply, error) { @@ -118,7 +118,7 @@ func (c *serviceClient) ClassifyTableByInterface(ctx context.Context, in *Classi if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ClassifyTableIds(ctx context.Context, in *ClassifyTableIds) (*ClassifyTableIdsReply, error) { @@ -127,7 +127,7 @@ func (c *serviceClient) ClassifyTableIds(ctx context.Context, in *ClassifyTableI if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ClassifyTableInfo(ctx context.Context, in *ClassifyTableInfo) (*ClassifyTableInfoReply, error) { @@ -136,7 +136,7 @@ func (c *serviceClient) ClassifyTableInfo(ctx context.Context, in *ClassifyTable if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) FlowClassifyDump(ctx context.Context, in *FlowClassifyDump) (RPCService_FlowClassifyDumpClient, error) { @@ -184,7 +184,7 @@ func (c *serviceClient) FlowClassifySetInterface(ctx context.Context, in *FlowCl if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) InputACLSetInterface(ctx context.Context, in *InputACLSetInterface) (*InputACLSetInterfaceReply, error) { @@ -193,7 +193,7 @@ func (c *serviceClient) InputACLSetInterface(ctx context.Context, in *InputACLSe if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OutputACLSetInterface(ctx context.Context, in *OutputACLSetInterface) (*OutputACLSetInterfaceReply, error) { @@ -202,7 +202,7 @@ func (c *serviceClient) OutputACLSetInterface(ctx context.Context, in *OutputACL if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) PolicerClassifyDump(ctx context.Context, in *PolicerClassifyDump) (RPCService_PolicerClassifyDumpClient, error) { @@ -250,5 +250,5 @@ func (c *serviceClient) PolicerClassifySetInterface(ctx context.Context, in *Pol if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/cop/cop.ba.go b/binapi/cop/cop.ba.go index 14f0b11..6159982 100644 --- a/binapi/cop/cop.ba.go +++ b/binapi/cop/cop.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/core/cop.api.json // Package cop contains generated bindings for API file cop.api. diff --git a/binapi/cop/cop_rest.ba.go b/binapi/cop/cop_rest.ba.go deleted file mode 100644 index d9ed487..0000000 --- a/binapi/cop/cop_rest.ba.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package cop - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/cop_interface_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(CopInterfaceEnableDisable) - 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.CopInterfaceEnableDisable(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("/cop_whitelist_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(CopWhitelistEnableDisable) - 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.CopWhitelistEnableDisable(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/cop/cop_rpc.ba.go b/binapi/cop/cop_rpc.ba.go index 2768c23..120613d 100644 --- a/binapi/cop/cop_rpc.ba.go +++ b/binapi/cop/cop_rpc.ba.go @@ -8,7 +8,7 @@ import ( api "git.fd.io/govpp.git/api" ) -// RPCService defines RPC service cop. +// RPCService defines RPC service cop. type RPCService interface { CopInterfaceEnableDisable(ctx context.Context, in *CopInterfaceEnableDisable) (*CopInterfaceEnableDisableReply, error) CopWhitelistEnableDisable(ctx context.Context, in *CopWhitelistEnableDisable) (*CopWhitelistEnableDisableReply, error) @@ -28,7 +28,7 @@ func (c *serviceClient) CopInterfaceEnableDisable(ctx context.Context, in *CopIn if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) CopWhitelistEnableDisable(ctx context.Context, in *CopWhitelistEnableDisable) (*CopWhitelistEnableDisableReply, error) { @@ -37,5 +37,5 @@ func (c *serviceClient) CopWhitelistEnableDisable(ctx context.Context, in *CopWh if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/ct6/ct6.ba.go b/binapi/ct6/ct6.ba.go index 5dc6097..40394db 100644 --- a/binapi/ct6/ct6.ba.go +++ b/binapi/ct6/ct6.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/ct6.api.json // Package ct6 contains generated bindings for API file ct6.api. diff --git a/binapi/ct6/ct6_rest.ba.go b/binapi/ct6/ct6_rest.ba.go deleted file mode 100644 index a3ffcde..0000000 --- a/binapi/ct6/ct6_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package ct6 - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/ct6_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(Ct6EnableDisable) - 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.Ct6EnableDisable(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/ct6/ct6_rpc.ba.go b/binapi/ct6/ct6_rpc.ba.go index d165339..fcae22d 100644 --- a/binapi/ct6/ct6_rpc.ba.go +++ b/binapi/ct6/ct6_rpc.ba.go @@ -8,7 +8,7 @@ import ( api "git.fd.io/govpp.git/api" ) -// RPCService defines RPC service ct6. +// RPCService defines RPC service ct6. type RPCService interface { Ct6EnableDisable(ctx context.Context, in *Ct6EnableDisable) (*Ct6EnableDisableReply, error) } @@ -27,5 +27,5 @@ func (c *serviceClient) Ct6EnableDisable(ctx context.Context, in *Ct6EnableDisab if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } 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) } diff --git a/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp.ba.go b/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp.ba.go index 4fcb012..ca4f01d 100644 --- a/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp.ba.go +++ b/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp.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/dhcp6_ia_na_client_cp.api.json // Package dhcp6_ia_na_client_cp contains generated bindings for API file dhcp6_ia_na_client_cp.api. diff --git a/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp_rest.ba.go b/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp_rest.ba.go deleted file mode 100644 index 0fd5ce2..0000000 --- a/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package dhcp6_ia_na_client_cp - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/dhcp6_client_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(DHCP6ClientEnableDisable) - 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.DHCP6ClientEnableDisable(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/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp_rpc.ba.go b/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp_rpc.ba.go index 1083167..3fbf238 100644 --- a/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp_rpc.ba.go +++ b/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp_rpc.ba.go @@ -8,7 +8,7 @@ import ( api "git.fd.io/govpp.git/api" ) -// RPCService defines RPC service dhcp6_ia_na_client_cp. +// RPCService defines RPC service dhcp6_ia_na_client_cp. type RPCService interface { DHCP6ClientEnableDisable(ctx context.Context, in *DHCP6ClientEnableDisable) (*DHCP6ClientEnableDisableReply, error) } @@ -27,5 +27,5 @@ func (c *serviceClient) DHCP6ClientEnableDisable(ctx context.Context, in *DHCP6C if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp.ba.go b/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp.ba.go index 7e4e2bb..f5690d1 100644 --- a/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp.ba.go +++ b/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp.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/dhcp6_pd_client_cp.api.json // Package dhcp6_pd_client_cp contains generated bindings for API file dhcp6_pd_client_cp.api. diff --git a/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp_rest.ba.go b/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp_rest.ba.go deleted file mode 100644 index fa76aa8..0000000 --- a/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp_rest.ba.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package dhcp6_pd_client_cp - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/dhcp6_pd_client_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(DHCP6PdClientEnableDisable) - 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.DHCP6PdClientEnableDisable(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("/ip6_add_del_address_using_prefix", func(w http.ResponseWriter, req *http.Request) { - var request = new(IP6AddDelAddressUsingPrefix) - 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.IP6AddDelAddressUsingPrefix(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/dhcp6_pd_client_cp/dhcp6_pd_client_cp_rpc.ba.go b/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp_rpc.ba.go index 670e012..f531408 100644 --- a/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp_rpc.ba.go +++ b/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp_rpc.ba.go @@ -8,7 +8,7 @@ import ( api "git.fd.io/govpp.git/api" ) -// RPCService defines RPC service dhcp6_pd_client_cp. +// RPCService defines RPC service dhcp6_pd_client_cp. type RPCService interface { DHCP6PdClientEnableDisable(ctx context.Context, in *DHCP6PdClientEnableDisable) (*DHCP6PdClientEnableDisableReply, error) IP6AddDelAddressUsingPrefix(ctx context.Context, in *IP6AddDelAddressUsingPrefix) (*IP6AddDelAddressUsingPrefixReply, error) @@ -28,7 +28,7 @@ func (c *serviceClient) DHCP6PdClientEnableDisable(ctx context.Context, in *DHCP if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IP6AddDelAddressUsingPrefix(ctx context.Context, in *IP6AddDelAddressUsingPrefix) (*IP6AddDelAddressUsingPrefixReply, error) { @@ -37,5 +37,5 @@ func (c *serviceClient) IP6AddDelAddressUsingPrefix(ctx context.Context, in *IP6 if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/dns/dns.ba.go b/binapi/dns/dns.ba.go index fc2324c..8ebb3bf 100644 --- a/binapi/dns/dns.ba.go +++ b/binapi/dns/dns.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/dns.api.json // Package dns contains generated bindings for API file dns.api. diff --git a/binapi/dns/dns_rest.ba.go b/binapi/dns/dns_rest.ba.go deleted file mode 100644 index e67d971..0000000 --- a/binapi/dns/dns_rest.ba.go +++ /dev/null @@ -1,106 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package dns - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/dns_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(DNSEnableDisable) - 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.DNSEnableDisable(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("/dns_name_server_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(DNSNameServerAddDel) - 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.DNSNameServerAddDel(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("/dns_resolve_ip", func(w http.ResponseWriter, req *http.Request) { - var request = new(DNSResolveIP) - 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.DNSResolveIP(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("/dns_resolve_name", func(w http.ResponseWriter, req *http.Request) { - var request = new(DNSResolveName) - 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.DNSResolveName(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/dns/dns_rpc.ba.go b/binapi/dns/dns_rpc.ba.go index 6bf3622..deb5be8 100644 --- a/binapi/dns/dns_rpc.ba.go +++ b/binapi/dns/dns_rpc.ba.go @@ -8,7 +8,7 @@ import ( api "git.fd.io/govpp.git/api" ) -// RPCService defines RPC service dns. +// RPCService defines RPC service dns. type RPCService interface { DNSEnableDisable(ctx context.Context, in *DNSEnableDisable) (*DNSEnableDisableReply, error) DNSNameServerAddDel(ctx context.Context, in *DNSNameServerAddDel) (*DNSNameServerAddDelReply, error) @@ -30,7 +30,7 @@ func (c *serviceClient) DNSEnableDisable(ctx context.Context, in *DNSEnableDisab if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) DNSNameServerAddDel(ctx context.Context, in *DNSNameServerAddDel) (*DNSNameServerAddDelReply, error) { @@ -39,7 +39,7 @@ func (c *serviceClient) DNSNameServerAddDel(ctx context.Context, in *DNSNameServ if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) DNSResolveIP(ctx context.Context, in *DNSResolveIP) (*DNSResolveIPReply, error) { @@ -48,7 +48,7 @@ func (c *serviceClient) DNSResolveIP(ctx context.Context, in *DNSResolveIP) (*DN if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) DNSResolveName(ctx context.Context, in *DNSResolveName) (*DNSResolveNameReply, error) { @@ -57,5 +57,5 @@ func (c *serviceClient) DNSResolveName(ctx context.Context, in *DNSResolveName) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/dslite/dslite.ba.go b/binapi/dslite/dslite.ba.go index efcf240..0837892 100644 --- a/binapi/dslite/dslite.ba.go +++ b/binapi/dslite/dslite.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/dslite.api.json // Package dslite contains generated bindings for API file dslite.api. diff --git a/binapi/dslite/dslite_rest.ba.go b/binapi/dslite/dslite_rest.ba.go deleted file mode 100644 index eba86b0..0000000 --- a/binapi/dslite/dslite_rest.ba.go +++ /dev/null @@ -1,111 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package dslite - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/dslite_add_del_pool_addr_range", func(w http.ResponseWriter, req *http.Request) { - var request = new(DsliteAddDelPoolAddrRange) - 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.DsliteAddDelPoolAddrRange(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("/dslite_get_aftr_addr", func(w http.ResponseWriter, req *http.Request) { - var request = new(DsliteGetAftrAddr) - reply, err := rpc.DsliteGetAftrAddr(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("/dslite_get_b4_addr", func(w http.ResponseWriter, req *http.Request) { - var request = new(DsliteGetB4Addr) - reply, err := rpc.DsliteGetB4Addr(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("/dslite_set_aftr_addr", func(w http.ResponseWriter, req *http.Request) { - var request = new(DsliteSetAftrAddr) - 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.DsliteSetAftrAddr(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("/dslite_set_b4_addr", func(w http.ResponseWriter, req *http.Request) { - var request = new(DsliteSetB4Addr) - 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.DsliteSetB4Addr(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/dslite/dslite_rpc.ba.go b/binapi/dslite/dslite_rpc.ba.go index 6314fd2..5847cf6 100644 --- a/binapi/dslite/dslite_rpc.ba.go +++ b/binapi/dslite/dslite_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service dslite. +// RPCService defines RPC service dslite. type RPCService interface { DsliteAddDelPoolAddrRange(ctx context.Context, in *DsliteAddDelPoolAddrRange) (*DsliteAddDelPoolAddrRangeReply, error) DsliteAddressDump(ctx context.Context, in *DsliteAddressDump) (RPCService_DsliteAddressDumpClient, error) @@ -35,7 +35,7 @@ func (c *serviceClient) DsliteAddDelPoolAddrRange(ctx context.Context, in *Dslit if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) DsliteAddressDump(ctx context.Context, in *DsliteAddressDump) (RPCService_DsliteAddressDumpClient, error) { @@ -83,7 +83,7 @@ func (c *serviceClient) DsliteGetAftrAddr(ctx context.Context, in *DsliteGetAftr if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) DsliteGetB4Addr(ctx context.Context, in *DsliteGetB4Addr) (*DsliteGetB4AddrReply, error) { @@ -92,7 +92,7 @@ func (c *serviceClient) DsliteGetB4Addr(ctx context.Context, in *DsliteGetB4Addr if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) DsliteSetAftrAddr(ctx context.Context, in *DsliteSetAftrAddr) (*DsliteSetAftrAddrReply, error) { @@ -101,7 +101,7 @@ func (c *serviceClient) DsliteSetAftrAddr(ctx context.Context, in *DsliteSetAftr if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) DsliteSetB4Addr(ctx context.Context, in *DsliteSetB4Addr) (*DsliteSetB4AddrReply, error) { @@ -110,5 +110,5 @@ func (c *serviceClient) DsliteSetB4Addr(ctx context.Context, in *DsliteSetB4Addr if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/ethernet_types/ethernet_types.ba.go b/binapi/ethernet_types/ethernet_types.ba.go index 63b1034..5956376 100644 --- a/binapi/ethernet_types/ethernet_types.ba.go +++ b/binapi/ethernet_types/ethernet_types.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/core/ethernet_types.api.json // Package ethernet_types contains generated bindings for API file ethernet_types.api. diff --git a/binapi/feature/feature.ba.go b/binapi/feature/feature.ba.go index cc54364..db5cafc 100644 --- a/binapi/feature/feature.ba.go +++ b/binapi/feature/feature.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/core/feature.api.json // Package feature contains generated bindings for API file feature.api. diff --git a/binapi/feature/feature_rest.ba.go b/binapi/feature/feature_rest.ba.go deleted file mode 100644 index a1b0604..0000000 --- a/binapi/feature/feature_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package feature - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/feature_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(FeatureEnableDisable) - 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.FeatureEnableDisable(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/feature/feature_rpc.ba.go b/binapi/feature/feature_rpc.ba.go index 6c42e4f..811934b 100644 --- a/binapi/feature/feature_rpc.ba.go +++ b/binapi/feature/feature_rpc.ba.go @@ -8,7 +8,7 @@ import ( api "git.fd.io/govpp.git/api" ) -// RPCService defines RPC service feature. +// RPCService defines RPC service feature. type RPCService interface { FeatureEnableDisable(ctx context.Context, in *FeatureEnableDisable) (*FeatureEnableDisableReply, error) } @@ -27,5 +27,5 @@ func (c *serviceClient) FeatureEnableDisable(ctx context.Context, in *FeatureEna if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/fib_types/fib_types.ba.go b/binapi/fib_types/fib_types.ba.go index 3194edf..1fcf29e 100644 --- a/binapi/fib_types/fib_types.ba.go +++ b/binapi/fib_types/fib_types.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/core/fib_types.api.json // Package fib_types contains generated bindings for API file fib_types.api. diff --git a/binapi/flowprobe/flowprobe.ba.go b/binapi/flowprobe/flowprobe.ba.go index b158c6d..3082b52 100644 --- a/binapi/flowprobe/flowprobe.ba.go +++ b/binapi/flowprobe/flowprobe.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/flowprobe.api.json // Package flowprobe contains generated bindings for API file flowprobe.api. diff --git a/binapi/flowprobe/flowprobe_rest.ba.go b/binapi/flowprobe/flowprobe_rest.ba.go deleted file mode 100644 index 3de76b9..0000000 --- a/binapi/flowprobe/flowprobe_rest.ba.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package flowprobe - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/flowprobe_params", func(w http.ResponseWriter, req *http.Request) { - var request = new(FlowprobeParams) - 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.FlowprobeParams(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("/flowprobe_tx_interface_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(FlowprobeTxInterfaceAddDel) - 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.FlowprobeTxInterfaceAddDel(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/flowprobe/flowprobe_rpc.ba.go b/binapi/flowprobe/flowprobe_rpc.ba.go index 97520fd..3b0178d 100644 --- a/binapi/flowprobe/flowprobe_rpc.ba.go +++ b/binapi/flowprobe/flowprobe_rpc.ba.go @@ -8,7 +8,7 @@ import ( api "git.fd.io/govpp.git/api" ) -// RPCService defines RPC service flowprobe. +// RPCService defines RPC service flowprobe. type RPCService interface { FlowprobeParams(ctx context.Context, in *FlowprobeParams) (*FlowprobeParamsReply, error) FlowprobeTxInterfaceAddDel(ctx context.Context, in *FlowprobeTxInterfaceAddDel) (*FlowprobeTxInterfaceAddDelReply, error) @@ -28,7 +28,7 @@ func (c *serviceClient) FlowprobeParams(ctx context.Context, in *FlowprobeParams if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) FlowprobeTxInterfaceAddDel(ctx context.Context, in *FlowprobeTxInterfaceAddDel) (*FlowprobeTxInterfaceAddDelReply, error) { @@ -37,5 +37,5 @@ func (c *serviceClient) FlowprobeTxInterfaceAddDel(ctx context.Context, in *Flow if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/gbp/gbp.ba.go b/binapi/gbp/gbp.ba.go index 066371a..efa1bbc 100644 --- a/binapi/gbp/gbp.ba.go +++ b/binapi/gbp/gbp.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/gbp.api.json // Package gbp contains generated bindings for API file gbp.api. diff --git a/binapi/gbp/gbp_rest.ba.go b/binapi/gbp/gbp_rest.ba.go deleted file mode 100644 index 9999a07..0000000 --- a/binapi/gbp/gbp_rest.ba.go +++ /dev/null @@ -1,336 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package gbp - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/gbp_bridge_domain_add", func(w http.ResponseWriter, req *http.Request) { - var request = new(GbpBridgeDomainAdd) - 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.GbpBridgeDomainAdd(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("/gbp_bridge_domain_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(GbpBridgeDomainDel) - 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.GbpBridgeDomainDel(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("/gbp_contract_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(GbpContractAddDel) - 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.GbpContractAddDel(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("/gbp_endpoint_add", func(w http.ResponseWriter, req *http.Request) { - var request = new(GbpEndpointAdd) - 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.GbpEndpointAdd(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("/gbp_endpoint_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(GbpEndpointDel) - 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.GbpEndpointDel(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("/gbp_endpoint_group_add", func(w http.ResponseWriter, req *http.Request) { - var request = new(GbpEndpointGroupAdd) - 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.GbpEndpointGroupAdd(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("/gbp_endpoint_group_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(GbpEndpointGroupDel) - 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.GbpEndpointGroupDel(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("/gbp_ext_itf_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(GbpExtItfAddDel) - 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.GbpExtItfAddDel(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("/gbp_recirc_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(GbpRecircAddDel) - 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.GbpRecircAddDel(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("/gbp_route_domain_add", func(w http.ResponseWriter, req *http.Request) { - var request = new(GbpRouteDomainAdd) - 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.GbpRouteDomainAdd(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("/gbp_route_domain_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(GbpRouteDomainDel) - 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.GbpRouteDomainDel(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("/gbp_subnet_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(GbpSubnetAddDel) - 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.GbpSubnetAddDel(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("/gbp_vxlan_tunnel_add", func(w http.ResponseWriter, req *http.Request) { - var request = new(GbpVxlanTunnelAdd) - 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.GbpVxlanTunnelAdd(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("/gbp_vxlan_tunnel_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(GbpVxlanTunnelDel) - 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.GbpVxlanTunnelDel(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/gbp/gbp_rpc.ba.go b/binapi/gbp/gbp_rpc.ba.go index 635394e..4b45ea7 100644 --- a/binapi/gbp/gbp_rpc.ba.go +++ b/binapi/gbp/gbp_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service gbp. +// RPCService defines RPC service gbp. type RPCService interface { GbpBridgeDomainAdd(ctx context.Context, in *GbpBridgeDomainAdd) (*GbpBridgeDomainAddReply, error) GbpBridgeDomainDel(ctx context.Context, in *GbpBridgeDomainDel) (*GbpBridgeDomainDelReply, error) @@ -52,7 +52,7 @@ func (c *serviceClient) GbpBridgeDomainAdd(ctx context.Context, in *GbpBridgeDom if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GbpBridgeDomainDel(ctx context.Context, in *GbpBridgeDomainDel) (*GbpBridgeDomainDelReply, error) { @@ -61,7 +61,7 @@ func (c *serviceClient) GbpBridgeDomainDel(ctx context.Context, in *GbpBridgeDom if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GbpBridgeDomainDump(ctx context.Context, in *GbpBridgeDomainDump) (RPCService_GbpBridgeDomainDumpClient, error) { @@ -109,7 +109,7 @@ func (c *serviceClient) GbpContractAddDel(ctx context.Context, in *GbpContractAd if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GbpContractDump(ctx context.Context, in *GbpContractDump) (RPCService_GbpContractDumpClient, error) { @@ -157,7 +157,7 @@ func (c *serviceClient) GbpEndpointAdd(ctx context.Context, in *GbpEndpointAdd) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GbpEndpointDel(ctx context.Context, in *GbpEndpointDel) (*GbpEndpointDelReply, error) { @@ -166,7 +166,7 @@ func (c *serviceClient) GbpEndpointDel(ctx context.Context, in *GbpEndpointDel) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GbpEndpointDump(ctx context.Context, in *GbpEndpointDump) (RPCService_GbpEndpointDumpClient, error) { @@ -214,7 +214,7 @@ func (c *serviceClient) GbpEndpointGroupAdd(ctx context.Context, in *GbpEndpoint if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GbpEndpointGroupDel(ctx context.Context, in *GbpEndpointGroupDel) (*GbpEndpointGroupDelReply, error) { @@ -223,7 +223,7 @@ func (c *serviceClient) GbpEndpointGroupDel(ctx context.Context, in *GbpEndpoint if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GbpEndpointGroupDump(ctx context.Context, in *GbpEndpointGroupDump) (RPCService_GbpEndpointGroupDumpClient, error) { @@ -271,7 +271,7 @@ func (c *serviceClient) GbpExtItfAddDel(ctx context.Context, in *GbpExtItfAddDel if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GbpExtItfDump(ctx context.Context, in *GbpExtItfDump) (RPCService_GbpExtItfDumpClient, error) { @@ -319,7 +319,7 @@ func (c *serviceClient) GbpRecircAddDel(ctx context.Context, in *GbpRecircAddDel if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GbpRecircDump(ctx context.Context, in *GbpRecircDump) (RPCService_GbpRecircDumpClient, error) { @@ -367,7 +367,7 @@ func (c *serviceClient) GbpRouteDomainAdd(ctx context.Context, in *GbpRouteDomai if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GbpRouteDomainDel(ctx context.Context, in *GbpRouteDomainDel) (*GbpRouteDomainDelReply, error) { @@ -376,7 +376,7 @@ func (c *serviceClient) GbpRouteDomainDel(ctx context.Context, in *GbpRouteDomai if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GbpRouteDomainDump(ctx context.Context, in *GbpRouteDomainDump) (RPCService_GbpRouteDomainDumpClient, error) { @@ -424,7 +424,7 @@ func (c *serviceClient) GbpSubnetAddDel(ctx context.Context, in *GbpSubnetAddDel if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GbpSubnetDump(ctx context.Context, in *GbpSubnetDump) (RPCService_GbpSubnetDumpClient, error) { @@ -472,7 +472,7 @@ func (c *serviceClient) GbpVxlanTunnelAdd(ctx context.Context, in *GbpVxlanTunne if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GbpVxlanTunnelDel(ctx context.Context, in *GbpVxlanTunnelDel) (*GbpVxlanTunnelDelReply, error) { @@ -481,7 +481,7 @@ func (c *serviceClient) GbpVxlanTunnelDel(ctx context.Context, in *GbpVxlanTunne if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GbpVxlanTunnelDump(ctx context.Context, in *GbpVxlanTunnelDump) (RPCService_GbpVxlanTunnelDumpClient, error) { diff --git a/binapi/gen.go b/binapi/gen.go index aefde2b..eec87da 100644 --- a/binapi/gen.go +++ b/binapi/gen.go @@ -18,4 +18,4 @@ package binapi // // go generate ./binapi // -//go:generate binapi-generator -input-dir=/usr/share/vpp/api -output-dir=. -gen=rpc,rest +//go:generate binapi-generator -input-dir=/usr/share/vpp/api -output-dir=. -gen=rpc diff --git a/binapi/geneve/geneve.ba.go b/binapi/geneve/geneve.ba.go index fcd512d..58c5988 100644 --- a/binapi/geneve/geneve.ba.go +++ b/binapi/geneve/geneve.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/core/geneve.api.json // Package geneve contains generated bindings for API file geneve.api. diff --git a/binapi/geneve/geneve_rest.ba.go b/binapi/geneve/geneve_rest.ba.go deleted file mode 100644 index 4987b1d..0000000 --- a/binapi/geneve/geneve_rest.ba.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package geneve - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/geneve_add_del_tunnel", func(w http.ResponseWriter, req *http.Request) { - var request = new(GeneveAddDelTunnel) - 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.GeneveAddDelTunnel(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("/sw_interface_set_geneve_bypass", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceSetGeneveBypass) - 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.SwInterfaceSetGeneveBypass(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/geneve/geneve_rpc.ba.go b/binapi/geneve/geneve_rpc.ba.go index 88f7aac..f2dacb8 100644 --- a/binapi/geneve/geneve_rpc.ba.go +++ b/binapi/geneve/geneve_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service geneve. +// RPCService defines RPC service geneve. type RPCService interface { GeneveAddDelTunnel(ctx context.Context, in *GeneveAddDelTunnel) (*GeneveAddDelTunnelReply, error) GeneveTunnelDump(ctx context.Context, in *GeneveTunnelDump) (RPCService_GeneveTunnelDumpClient, error) @@ -32,7 +32,7 @@ func (c *serviceClient) GeneveAddDelTunnel(ctx context.Context, in *GeneveAddDel if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GeneveTunnelDump(ctx context.Context, in *GeneveTunnelDump) (RPCService_GeneveTunnelDumpClient, error) { @@ -80,5 +80,5 @@ func (c *serviceClient) SwInterfaceSetGeneveBypass(ctx context.Context, in *SwIn if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/gre/gre.ba.go b/binapi/gre/gre.ba.go index 9fa68cb..4c0b9c0 100644 --- a/binapi/gre/gre.ba.go +++ b/binapi/gre/gre.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/core/gre.api.json // Package gre contains generated bindings for API file gre.api. diff --git a/binapi/gre/gre_rest.ba.go b/binapi/gre/gre_rest.ba.go deleted file mode 100644 index d344aa8..0000000 --- a/binapi/gre/gre_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package gre - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/gre_tunnel_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(GreTunnelAddDel) - 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.GreTunnelAddDel(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/gre/gre_rpc.ba.go b/binapi/gre/gre_rpc.ba.go index 670aeec..f68ef46 100644 --- a/binapi/gre/gre_rpc.ba.go +++ b/binapi/gre/gre_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service gre. +// RPCService defines RPC service gre. type RPCService interface { GreTunnelAddDel(ctx context.Context, in *GreTunnelAddDel) (*GreTunnelAddDelReply, error) GreTunnelDump(ctx context.Context, in *GreTunnelDump) (RPCService_GreTunnelDumpClient, error) @@ -31,7 +31,7 @@ func (c *serviceClient) GreTunnelAddDel(ctx context.Context, in *GreTunnelAddDel if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GreTunnelDump(ctx context.Context, in *GreTunnelDump) (RPCService_GreTunnelDumpClient, error) { diff --git a/binapi/gso/gso.ba.go b/binapi/gso/gso.ba.go index 78e7536..f243772 100644 --- a/binapi/gso/gso.ba.go +++ b/binapi/gso/gso.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/core/gso.api.json // Package gso contains generated bindings for API file gso.api. diff --git a/binapi/gso/gso_rest.ba.go b/binapi/gso/gso_rest.ba.go deleted file mode 100644 index d04c3bd..0000000 --- a/binapi/gso/gso_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package gso - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/feature_gso_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(FeatureGsoEnableDisable) - 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.FeatureGsoEnableDisable(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/gso/gso_rpc.ba.go b/binapi/gso/gso_rpc.ba.go index 42bb837..0d3ed10 100644 --- a/binapi/gso/gso_rpc.ba.go +++ b/binapi/gso/gso_rpc.ba.go @@ -8,7 +8,7 @@ import ( api "git.fd.io/govpp.git/api" ) -// RPCService defines RPC service gso. +// RPCService defines RPC service gso. type RPCService interface { FeatureGsoEnableDisable(ctx context.Context, in *FeatureGsoEnableDisable) (*FeatureGsoEnableDisableReply, error) } @@ -27,5 +27,5 @@ func (c *serviceClient) FeatureGsoEnableDisable(ctx context.Context, in *Feature if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/gtpu/gtpu.ba.go b/binapi/gtpu/gtpu.ba.go index 96ae51f..5d2a038 100644 --- a/binapi/gtpu/gtpu.ba.go +++ b/binapi/gtpu/gtpu.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/gtpu.api.json // Package gtpu contains generated bindings for API file gtpu.api. diff --git a/binapi/gtpu/gtpu_rest.ba.go b/binapi/gtpu/gtpu_rest.ba.go deleted file mode 100644 index 6631cd8..0000000 --- a/binapi/gtpu/gtpu_rest.ba.go +++ /dev/null @@ -1,83 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package gtpu - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/gtpu_add_del_tunnel", func(w http.ResponseWriter, req *http.Request) { - var request = new(GtpuAddDelTunnel) - 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.GtpuAddDelTunnel(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("/gtpu_offload_rx", func(w http.ResponseWriter, req *http.Request) { - var request = new(GtpuOffloadRx) - 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.GtpuOffloadRx(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("/sw_interface_set_gtpu_bypass", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceSetGtpuBypass) - 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.SwInterfaceSetGtpuBypass(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/gtpu/gtpu_rpc.ba.go b/binapi/gtpu/gtpu_rpc.ba.go index d5f3263..46a7e7d 100644 --- a/binapi/gtpu/gtpu_rpc.ba.go +++ b/binapi/gtpu/gtpu_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service gtpu. +// RPCService defines RPC service gtpu. type RPCService interface { GtpuAddDelTunnel(ctx context.Context, in *GtpuAddDelTunnel) (*GtpuAddDelTunnelReply, error) GtpuOffloadRx(ctx context.Context, in *GtpuOffloadRx) (*GtpuOffloadRxReply, error) @@ -33,7 +33,7 @@ func (c *serviceClient) GtpuAddDelTunnel(ctx context.Context, in *GtpuAddDelTunn if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GtpuOffloadRx(ctx context.Context, in *GtpuOffloadRx) (*GtpuOffloadRxReply, error) { @@ -42,7 +42,7 @@ func (c *serviceClient) GtpuOffloadRx(ctx context.Context, in *GtpuOffloadRx) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GtpuTunnelDump(ctx context.Context, in *GtpuTunnelDump) (RPCService_GtpuTunnelDumpClient, error) { @@ -90,5 +90,5 @@ func (c *serviceClient) SwInterfaceSetGtpuBypass(ctx context.Context, in *SwInte if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/http_static/http_static.ba.go b/binapi/http_static/http_static.ba.go index 2116a8b..811bb0d 100644 --- a/binapi/http_static/http_static.ba.go +++ b/binapi/http_static/http_static.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/http_static.api.json // Package http_static contains generated bindings for API file http_static.api. diff --git a/binapi/http_static/http_static_rest.ba.go b/binapi/http_static/http_static_rest.ba.go deleted file mode 100644 index f488f5a..0000000 --- a/binapi/http_static/http_static_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package http_static - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/http_static_enable", func(w http.ResponseWriter, req *http.Request) { - var request = new(HTTPStaticEnable) - 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.HTTPStaticEnable(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/http_static/http_static_rpc.ba.go b/binapi/http_static/http_static_rpc.ba.go index 67329dd..12bd4c1 100644 --- a/binapi/http_static/http_static_rpc.ba.go +++ b/binapi/http_static/http_static_rpc.ba.go @@ -8,7 +8,7 @@ import ( api "git.fd.io/govpp.git/api" ) -// RPCService defines RPC service http_static. +// RPCService defines RPC service http_static. type RPCService interface { HTTPStaticEnable(ctx context.Context, in *HTTPStaticEnable) (*HTTPStaticEnableReply, error) } @@ -27,5 +27,5 @@ func (c *serviceClient) HTTPStaticEnable(ctx context.Context, in *HTTPStaticEnab if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/igmp/igmp.ba.go b/binapi/igmp/igmp.ba.go index a43b599..2bbe575 100644 --- a/binapi/igmp/igmp.ba.go +++ b/binapi/igmp/igmp.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/igmp.api.json // Package igmp contains generated bindings for API file igmp.api. diff --git a/binapi/igmp/igmp_rest.ba.go b/binapi/igmp/igmp_rest.ba.go deleted file mode 100644 index c3869ff..0000000 --- a/binapi/igmp/igmp_rest.ba.go +++ /dev/null @@ -1,175 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package igmp - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/igmp_clear_interface", func(w http.ResponseWriter, req *http.Request) { - var request = new(IgmpClearInterface) - 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.IgmpClearInterface(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("/igmp_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(IgmpEnableDisable) - 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.IgmpEnableDisable(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("/igmp_group_prefix_set", func(w http.ResponseWriter, req *http.Request) { - var request = new(IgmpGroupPrefixSet) - 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.IgmpGroupPrefixSet(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("/igmp_listen", func(w http.ResponseWriter, req *http.Request) { - var request = new(IgmpListen) - 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.IgmpListen(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("/igmp_proxy_device_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(IgmpProxyDeviceAddDel) - 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.IgmpProxyDeviceAddDel(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("/igmp_proxy_device_add_del_interface", func(w http.ResponseWriter, req *http.Request) { - var request = new(IgmpProxyDeviceAddDelInterface) - 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.IgmpProxyDeviceAddDelInterface(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_igmp_events", func(w http.ResponseWriter, req *http.Request) { - var request = new(WantIgmpEvents) - 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.WantIgmpEvents(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/igmp/igmp_rpc.ba.go b/binapi/igmp/igmp_rpc.ba.go index c1ef9e5..3cda04c 100644 --- a/binapi/igmp/igmp_rpc.ba.go +++ b/binapi/igmp/igmp_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service igmp. +// RPCService defines RPC service igmp. type RPCService interface { IgmpClearInterface(ctx context.Context, in *IgmpClearInterface) (*IgmpClearInterfaceReply, error) IgmpDump(ctx context.Context, in *IgmpDump) (RPCService_IgmpDumpClient, error) @@ -38,7 +38,7 @@ func (c *serviceClient) IgmpClearInterface(ctx context.Context, in *IgmpClearInt if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IgmpDump(ctx context.Context, in *IgmpDump) (RPCService_IgmpDumpClient, error) { @@ -86,7 +86,7 @@ func (c *serviceClient) IgmpEnableDisable(ctx context.Context, in *IgmpEnableDis if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IgmpGroupPrefixDump(ctx context.Context, in *IgmpGroupPrefixDump) (RPCService_IgmpGroupPrefixDumpClient, error) { @@ -134,7 +134,7 @@ func (c *serviceClient) IgmpGroupPrefixSet(ctx context.Context, in *IgmpGroupPre if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IgmpListen(ctx context.Context, in *IgmpListen) (*IgmpListenReply, error) { @@ -143,7 +143,7 @@ func (c *serviceClient) IgmpListen(ctx context.Context, in *IgmpListen) (*IgmpLi if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IgmpProxyDeviceAddDel(ctx context.Context, in *IgmpProxyDeviceAddDel) (*IgmpProxyDeviceAddDelReply, error) { @@ -152,7 +152,7 @@ func (c *serviceClient) IgmpProxyDeviceAddDel(ctx context.Context, in *IgmpProxy if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IgmpProxyDeviceAddDelInterface(ctx context.Context, in *IgmpProxyDeviceAddDelInterface) (*IgmpProxyDeviceAddDelInterfaceReply, error) { @@ -161,7 +161,7 @@ func (c *serviceClient) IgmpProxyDeviceAddDelInterface(ctx context.Context, in * if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) WantIgmpEvents(ctx context.Context, in *WantIgmpEvents) (*WantIgmpEventsReply, error) { @@ -170,5 +170,5 @@ func (c *serviceClient) WantIgmpEvents(ctx context.Context, in *WantIgmpEvents) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/ikev2/ikev2.ba.go b/binapi/ikev2/ikev2.ba.go index 5fc68c3..8313ece 100644 --- a/binapi/ikev2/ikev2.ba.go +++ b/binapi/ikev2/ikev2.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/ikev2.api.json // Package ikev2 contains generated bindings for API file ikev2.api. diff --git a/binapi/ikev2/ikev2_rest.ba.go b/binapi/ikev2/ikev2_rest.ba.go deleted file mode 100644 index 9ffdffa..0000000 --- a/binapi/ikev2/ikev2_rest.ba.go +++ /dev/null @@ -1,419 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package ikev2 - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/ikev2_initiate_del_child_sa", func(w http.ResponseWriter, req *http.Request) { - var request = new(Ikev2InitiateDelChildSa) - 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.Ikev2InitiateDelChildSa(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("/ikev2_initiate_del_ike_sa", func(w http.ResponseWriter, req *http.Request) { - var request = new(Ikev2InitiateDelIkeSa) - 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.Ikev2InitiateDelIkeSa(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("/ikev2_initiate_rekey_child_sa", func(w http.ResponseWriter, req *http.Request) { - var request = new(Ikev2InitiateRekeyChildSa) - 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.Ikev2InitiateRekeyChildSa(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("/ikev2_initiate_sa_init", func(w http.ResponseWriter, req *http.Request) { - var request = new(Ikev2InitiateSaInit) - 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.Ikev2InitiateSaInit(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("/ikev2_plugin_get_version", func(w http.ResponseWriter, req *http.Request) { - var request = new(Ikev2PluginGetVersion) - reply, err := rpc.Ikev2PluginGetVersion(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("/ikev2_profile_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(Ikev2ProfileAddDel) - 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.Ikev2ProfileAddDel(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("/ikev2_profile_set_auth", func(w http.ResponseWriter, req *http.Request) { - var request = new(Ikev2ProfileSetAuth) - 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.Ikev2ProfileSetAuth(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("/ikev2_profile_set_id", func(w http.ResponseWriter, req *http.Request) { - var request = new(Ikev2ProfileSetID) - 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.Ikev2ProfileSetID(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("/ikev2_profile_set_ipsec_udp_port", func(w http.ResponseWriter, req *http.Request) { - var request = new(Ikev2ProfileSetIpsecUDPPort) - 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.Ikev2ProfileSetIpsecUDPPort(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("/ikev2_profile_set_liveness", func(w http.ResponseWriter, req *http.Request) { - var request = new(Ikev2ProfileSetLiveness) - 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.Ikev2ProfileSetLiveness(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("/ikev2_profile_set_ts", func(w http.ResponseWriter, req *http.Request) { - var request = new(Ikev2ProfileSetTs) - 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.Ikev2ProfileSetTs(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("/ikev2_profile_set_udp_encap", func(w http.ResponseWriter, req *http.Request) { - var request = new(Ikev2ProfileSetUDPEncap) - 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.Ikev2ProfileSetUDPEncap(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("/ikev2_set_esp_transforms", func(w http.ResponseWriter, req *http.Request) { - var request = new(Ikev2SetEspTransforms) - 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.Ikev2SetEspTransforms(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("/ikev2_set_ike_transforms", func(w http.ResponseWriter, req *http.Request) { - var request = new(Ikev2SetIkeTransforms) - 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.Ikev2SetIkeTransforms(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("/ikev2_set_local_key", func(w http.ResponseWriter, req *http.Request) { - var request = new(Ikev2SetLocalKey) - 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.Ikev2SetLocalKey(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("/ikev2_set_responder", func(w http.ResponseWriter, req *http.Request) { - var request = new(Ikev2SetResponder) - 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.Ikev2SetResponder(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("/ikev2_set_sa_lifetime", func(w http.ResponseWriter, req *http.Request) { - var request = new(Ikev2SetSaLifetime) - 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.Ikev2SetSaLifetime(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("/ikev2_set_tunnel_interface", func(w http.ResponseWriter, req *http.Request) { - var request = new(Ikev2SetTunnelInterface) - 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.Ikev2SetTunnelInterface(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/ikev2/ikev2_rpc.ba.go b/binapi/ikev2/ikev2_rpc.ba.go index 3491c54..955c440 100644 --- a/binapi/ikev2/ikev2_rpc.ba.go +++ b/binapi/ikev2/ikev2_rpc.ba.go @@ -8,7 +8,7 @@ import ( api "git.fd.io/govpp.git/api" ) -// RPCService defines RPC service ikev2. +// RPCService defines RPC service ikev2. type RPCService interface { Ikev2InitiateDelChildSa(ctx context.Context, in *Ikev2InitiateDelChildSa) (*Ikev2InitiateDelChildSaReply, error) Ikev2InitiateDelIkeSa(ctx context.Context, in *Ikev2InitiateDelIkeSa) (*Ikev2InitiateDelIkeSaReply, error) @@ -44,7 +44,7 @@ func (c *serviceClient) Ikev2InitiateDelChildSa(ctx context.Context, in *Ikev2In if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Ikev2InitiateDelIkeSa(ctx context.Context, in *Ikev2InitiateDelIkeSa) (*Ikev2InitiateDelIkeSaReply, error) { @@ -53,7 +53,7 @@ func (c *serviceClient) Ikev2InitiateDelIkeSa(ctx context.Context, in *Ikev2Init if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Ikev2InitiateRekeyChildSa(ctx context.Context, in *Ikev2InitiateRekeyChildSa) (*Ikev2InitiateRekeyChildSaReply, error) { @@ -62,7 +62,7 @@ func (c *serviceClient) Ikev2InitiateRekeyChildSa(ctx context.Context, in *Ikev2 if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Ikev2InitiateSaInit(ctx context.Context, in *Ikev2InitiateSaInit) (*Ikev2InitiateSaInitReply, error) { @@ -71,7 +71,7 @@ func (c *serviceClient) Ikev2InitiateSaInit(ctx context.Context, in *Ikev2Initia if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Ikev2PluginGetVersion(ctx context.Context, in *Ikev2PluginGetVersion) (*Ikev2PluginGetVersionReply, error) { @@ -89,7 +89,7 @@ func (c *serviceClient) Ikev2ProfileAddDel(ctx context.Context, in *Ikev2Profile if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Ikev2ProfileSetAuth(ctx context.Context, in *Ikev2ProfileSetAuth) (*Ikev2ProfileSetAuthReply, error) { @@ -98,7 +98,7 @@ func (c *serviceClient) Ikev2ProfileSetAuth(ctx context.Context, in *Ikev2Profil if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Ikev2ProfileSetID(ctx context.Context, in *Ikev2ProfileSetID) (*Ikev2ProfileSetIDReply, error) { @@ -107,7 +107,7 @@ func (c *serviceClient) Ikev2ProfileSetID(ctx context.Context, in *Ikev2ProfileS if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Ikev2ProfileSetIpsecUDPPort(ctx context.Context, in *Ikev2ProfileSetIpsecUDPPort) (*Ikev2ProfileSetIpsecUDPPortReply, error) { @@ -116,7 +116,7 @@ func (c *serviceClient) Ikev2ProfileSetIpsecUDPPort(ctx context.Context, in *Ike if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Ikev2ProfileSetLiveness(ctx context.Context, in *Ikev2ProfileSetLiveness) (*Ikev2ProfileSetLivenessReply, error) { @@ -125,7 +125,7 @@ func (c *serviceClient) Ikev2ProfileSetLiveness(ctx context.Context, in *Ikev2Pr if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Ikev2ProfileSetTs(ctx context.Context, in *Ikev2ProfileSetTs) (*Ikev2ProfileSetTsReply, error) { @@ -134,7 +134,7 @@ func (c *serviceClient) Ikev2ProfileSetTs(ctx context.Context, in *Ikev2ProfileS if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Ikev2ProfileSetUDPEncap(ctx context.Context, in *Ikev2ProfileSetUDPEncap) (*Ikev2ProfileSetUDPEncapReply, error) { @@ -143,7 +143,7 @@ func (c *serviceClient) Ikev2ProfileSetUDPEncap(ctx context.Context, in *Ikev2Pr if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Ikev2SetEspTransforms(ctx context.Context, in *Ikev2SetEspTransforms) (*Ikev2SetEspTransformsReply, error) { @@ -152,7 +152,7 @@ func (c *serviceClient) Ikev2SetEspTransforms(ctx context.Context, in *Ikev2SetE if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Ikev2SetIkeTransforms(ctx context.Context, in *Ikev2SetIkeTransforms) (*Ikev2SetIkeTransformsReply, error) { @@ -161,7 +161,7 @@ func (c *serviceClient) Ikev2SetIkeTransforms(ctx context.Context, in *Ikev2SetI if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Ikev2SetLocalKey(ctx context.Context, in *Ikev2SetLocalKey) (*Ikev2SetLocalKeyReply, error) { @@ -170,7 +170,7 @@ func (c *serviceClient) Ikev2SetLocalKey(ctx context.Context, in *Ikev2SetLocalK if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Ikev2SetResponder(ctx context.Context, in *Ikev2SetResponder) (*Ikev2SetResponderReply, error) { @@ -179,7 +179,7 @@ func (c *serviceClient) Ikev2SetResponder(ctx context.Context, in *Ikev2SetRespo if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Ikev2SetSaLifetime(ctx context.Context, in *Ikev2SetSaLifetime) (*Ikev2SetSaLifetimeReply, error) { @@ -188,7 +188,7 @@ func (c *serviceClient) Ikev2SetSaLifetime(ctx context.Context, in *Ikev2SetSaLi if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Ikev2SetTunnelInterface(ctx context.Context, in *Ikev2SetTunnelInterface) (*Ikev2SetTunnelInterfaceReply, error) { @@ -197,5 +197,5 @@ func (c *serviceClient) Ikev2SetTunnelInterface(ctx context.Context, in *Ikev2Se if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/interface/interface.ba.go b/binapi/interface/interface.ba.go index 822c325..cef8994 100644 --- a/binapi/interface/interface.ba.go +++ b/binapi/interface/interface.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/core/interface.api.json // Package interfaces contains generated bindings for API file interface.api. diff --git a/binapi/interface/interface_rest.ba.go b/binapi/interface/interface_rest.ba.go deleted file mode 100644 index da5b899..0000000 --- a/binapi/interface/interface_rest.ba.go +++ /dev/null @@ -1,594 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package interfaces - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/collect_detailed_interface_stats", func(w http.ResponseWriter, req *http.Request) { - var request = new(CollectDetailedInterfaceStats) - 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.CollectDetailedInterfaceStats(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("/create_loopback", func(w http.ResponseWriter, req *http.Request) { - var request = new(CreateLoopback) - 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.CreateLoopback(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("/create_loopback_instance", func(w http.ResponseWriter, req *http.Request) { - var request = new(CreateLoopbackInstance) - 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.CreateLoopbackInstance(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("/create_subif", func(w http.ResponseWriter, req *http.Request) { - var request = new(CreateSubif) - 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.CreateSubif(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("/create_vlan_subif", func(w http.ResponseWriter, req *http.Request) { - var request = new(CreateVlanSubif) - 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.CreateVlanSubif(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("/delete_loopback", func(w http.ResponseWriter, req *http.Request) { - var request = new(DeleteLoopback) - 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.DeleteLoopback(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("/delete_subif", func(w http.ResponseWriter, req *http.Request) { - var request = new(DeleteSubif) - 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.DeleteSubif(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("/hw_interface_set_mtu", func(w http.ResponseWriter, req *http.Request) { - var request = new(HwInterfaceSetMtu) - 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.HwInterfaceSetMtu(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("/interface_name_renumber", func(w http.ResponseWriter, req *http.Request) { - var request = new(InterfaceNameRenumber) - 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.InterfaceNameRenumber(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("/sw_interface_add_del_address", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceAddDelAddress) - 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.SwInterfaceAddDelAddress(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("/sw_interface_add_del_mac_address", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceAddDelMacAddress) - 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.SwInterfaceAddDelMacAddress(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("/sw_interface_address_replace_begin", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceAddressReplaceBegin) - reply, err := rpc.SwInterfaceAddressReplaceBegin(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("/sw_interface_address_replace_end", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceAddressReplaceEnd) - reply, err := rpc.SwInterfaceAddressReplaceEnd(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("/sw_interface_clear_stats", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceClearStats) - 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.SwInterfaceClearStats(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("/sw_interface_get_mac_address", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceGetMacAddress) - 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.SwInterfaceGetMacAddress(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("/sw_interface_get_table", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceGetTable) - 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.SwInterfaceGetTable(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("/sw_interface_set_flags", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceSetFlags) - 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.SwInterfaceSetFlags(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("/sw_interface_set_ip_directed_broadcast", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceSetIPDirectedBroadcast) - 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.SwInterfaceSetIPDirectedBroadcast(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("/sw_interface_set_mac_address", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceSetMacAddress) - 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.SwInterfaceSetMacAddress(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("/sw_interface_set_mtu", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceSetMtu) - 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.SwInterfaceSetMtu(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("/sw_interface_set_rx_mode", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceSetRxMode) - 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.SwInterfaceSetRxMode(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("/sw_interface_set_rx_placement", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceSetRxPlacement) - 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.SwInterfaceSetRxPlacement(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("/sw_interface_set_table", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceSetTable) - 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.SwInterfaceSetTable(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("/sw_interface_set_unnumbered", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceSetUnnumbered) - 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.SwInterfaceSetUnnumbered(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("/sw_interface_tag_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceTagAddDel) - 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.SwInterfaceTagAddDel(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_interface_events", func(w http.ResponseWriter, req *http.Request) { - var request = new(WantInterfaceEvents) - 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.WantInterfaceEvents(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/interface/interface_rpc.ba.go b/binapi/interface/interface_rpc.ba.go index 94d89ec..f797346 100644 --- a/binapi/interface/interface_rpc.ba.go +++ b/binapi/interface/interface_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service interface. +// RPCService defines RPC service interface. type RPCService interface { CollectDetailedInterfaceStats(ctx context.Context, in *CollectDetailedInterfaceStats) (*CollectDetailedInterfaceStatsReply, error) CreateLoopback(ctx context.Context, in *CreateLoopback) (*CreateLoopbackReply, error) @@ -57,7 +57,7 @@ func (c *serviceClient) CollectDetailedInterfaceStats(ctx context.Context, in *C if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) CreateLoopback(ctx context.Context, in *CreateLoopback) (*CreateLoopbackReply, error) { @@ -66,7 +66,7 @@ func (c *serviceClient) CreateLoopback(ctx context.Context, in *CreateLoopback) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) CreateLoopbackInstance(ctx context.Context, in *CreateLoopbackInstance) (*CreateLoopbackInstanceReply, error) { @@ -75,7 +75,7 @@ func (c *serviceClient) CreateLoopbackInstance(ctx context.Context, in *CreateLo if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) CreateSubif(ctx context.Context, in *CreateSubif) (*CreateSubifReply, error) { @@ -84,7 +84,7 @@ func (c *serviceClient) CreateSubif(ctx context.Context, in *CreateSubif) (*Crea if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) CreateVlanSubif(ctx context.Context, in *CreateVlanSubif) (*CreateVlanSubifReply, error) { @@ -93,7 +93,7 @@ func (c *serviceClient) CreateVlanSubif(ctx context.Context, in *CreateVlanSubif if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) DeleteLoopback(ctx context.Context, in *DeleteLoopback) (*DeleteLoopbackReply, error) { @@ -102,7 +102,7 @@ func (c *serviceClient) DeleteLoopback(ctx context.Context, in *DeleteLoopback) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) DeleteSubif(ctx context.Context, in *DeleteSubif) (*DeleteSubifReply, error) { @@ -111,7 +111,7 @@ func (c *serviceClient) DeleteSubif(ctx context.Context, in *DeleteSubif) (*Dele if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) HwInterfaceSetMtu(ctx context.Context, in *HwInterfaceSetMtu) (*HwInterfaceSetMtuReply, error) { @@ -120,7 +120,7 @@ func (c *serviceClient) HwInterfaceSetMtu(ctx context.Context, in *HwInterfaceSe if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) InterfaceNameRenumber(ctx context.Context, in *InterfaceNameRenumber) (*InterfaceNameRenumberReply, error) { @@ -129,7 +129,7 @@ func (c *serviceClient) InterfaceNameRenumber(ctx context.Context, in *Interface if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceAddDelAddress(ctx context.Context, in *SwInterfaceAddDelAddress) (*SwInterfaceAddDelAddressReply, error) { @@ -138,7 +138,7 @@ func (c *serviceClient) SwInterfaceAddDelAddress(ctx context.Context, in *SwInte if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceAddDelMacAddress(ctx context.Context, in *SwInterfaceAddDelMacAddress) (*SwInterfaceAddDelMacAddressReply, error) { @@ -147,7 +147,7 @@ func (c *serviceClient) SwInterfaceAddDelMacAddress(ctx context.Context, in *SwI if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceAddressReplaceBegin(ctx context.Context, in *SwInterfaceAddressReplaceBegin) (*SwInterfaceAddressReplaceBeginReply, error) { @@ -156,7 +156,7 @@ func (c *serviceClient) SwInterfaceAddressReplaceBegin(ctx context.Context, in * if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceAddressReplaceEnd(ctx context.Context, in *SwInterfaceAddressReplaceEnd) (*SwInterfaceAddressReplaceEndReply, error) { @@ -165,7 +165,7 @@ func (c *serviceClient) SwInterfaceAddressReplaceEnd(ctx context.Context, in *Sw if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceClearStats(ctx context.Context, in *SwInterfaceClearStats) (*SwInterfaceClearStatsReply, error) { @@ -174,7 +174,7 @@ func (c *serviceClient) SwInterfaceClearStats(ctx context.Context, in *SwInterfa if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceDump(ctx context.Context, in *SwInterfaceDump) (RPCService_SwInterfaceDumpClient, error) { @@ -222,7 +222,7 @@ func (c *serviceClient) SwInterfaceGetMacAddress(ctx context.Context, in *SwInte if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceGetTable(ctx context.Context, in *SwInterfaceGetTable) (*SwInterfaceGetTableReply, error) { @@ -231,7 +231,7 @@ func (c *serviceClient) SwInterfaceGetTable(ctx context.Context, in *SwInterface if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceRxPlacementDump(ctx context.Context, in *SwInterfaceRxPlacementDump) (RPCService_SwInterfaceRxPlacementDumpClient, error) { @@ -279,7 +279,7 @@ func (c *serviceClient) SwInterfaceSetFlags(ctx context.Context, in *SwInterface if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceSetIPDirectedBroadcast(ctx context.Context, in *SwInterfaceSetIPDirectedBroadcast) (*SwInterfaceSetIPDirectedBroadcastReply, error) { @@ -288,7 +288,7 @@ func (c *serviceClient) SwInterfaceSetIPDirectedBroadcast(ctx context.Context, i if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceSetMacAddress(ctx context.Context, in *SwInterfaceSetMacAddress) (*SwInterfaceSetMacAddressReply, error) { @@ -297,7 +297,7 @@ func (c *serviceClient) SwInterfaceSetMacAddress(ctx context.Context, in *SwInte if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceSetMtu(ctx context.Context, in *SwInterfaceSetMtu) (*SwInterfaceSetMtuReply, error) { @@ -306,7 +306,7 @@ func (c *serviceClient) SwInterfaceSetMtu(ctx context.Context, in *SwInterfaceSe if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceSetRxMode(ctx context.Context, in *SwInterfaceSetRxMode) (*SwInterfaceSetRxModeReply, error) { @@ -315,7 +315,7 @@ func (c *serviceClient) SwInterfaceSetRxMode(ctx context.Context, in *SwInterfac if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceSetRxPlacement(ctx context.Context, in *SwInterfaceSetRxPlacement) (*SwInterfaceSetRxPlacementReply, error) { @@ -324,7 +324,7 @@ func (c *serviceClient) SwInterfaceSetRxPlacement(ctx context.Context, in *SwInt if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceSetTable(ctx context.Context, in *SwInterfaceSetTable) (*SwInterfaceSetTableReply, error) { @@ -333,7 +333,7 @@ func (c *serviceClient) SwInterfaceSetTable(ctx context.Context, in *SwInterface if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceSetUnnumbered(ctx context.Context, in *SwInterfaceSetUnnumbered) (*SwInterfaceSetUnnumberedReply, error) { @@ -342,7 +342,7 @@ func (c *serviceClient) SwInterfaceSetUnnumbered(ctx context.Context, in *SwInte if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceTagAddDel(ctx context.Context, in *SwInterfaceTagAddDel) (*SwInterfaceTagAddDelReply, error) { @@ -351,7 +351,7 @@ func (c *serviceClient) SwInterfaceTagAddDel(ctx context.Context, in *SwInterfac if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) WantInterfaceEvents(ctx context.Context, in *WantInterfaceEvents) (*WantInterfaceEventsReply, error) { @@ -360,5 +360,5 @@ func (c *serviceClient) WantInterfaceEvents(ctx context.Context, in *WantInterfa if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/interface_types/interface_types.ba.go b/binapi/interface_types/interface_types.ba.go index f7f8c2e..d2a848a 100644 --- a/binapi/interface_types/interface_types.ba.go +++ b/binapi/interface_types/interface_types.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/core/interface_types.api.json // Package interface_types contains generated bindings for API file interface_types.api. diff --git a/binapi/ioam_cache/ioam_cache.ba.go b/binapi/ioam_cache/ioam_cache.ba.go index 2f9f0ef..1bae621 100644 --- a/binapi/ioam_cache/ioam_cache.ba.go +++ b/binapi/ioam_cache/ioam_cache.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/ioam_cache.api.json // Package ioam_cache contains generated bindings for API file ioam_cache.api. diff --git a/binapi/ioam_cache/ioam_cache_rest.ba.go b/binapi/ioam_cache/ioam_cache_rest.ba.go deleted file mode 100644 index 4090307..0000000 --- a/binapi/ioam_cache/ioam_cache_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package ioam_cache - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/ioam_cache_ip6_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(IoamCacheIP6EnableDisable) - 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.IoamCacheIP6EnableDisable(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/ioam_cache/ioam_cache_rpc.ba.go b/binapi/ioam_cache/ioam_cache_rpc.ba.go index 0705965..9847365 100644 --- a/binapi/ioam_cache/ioam_cache_rpc.ba.go +++ b/binapi/ioam_cache/ioam_cache_rpc.ba.go @@ -8,7 +8,7 @@ import ( api "git.fd.io/govpp.git/api" ) -// RPCService defines RPC service ioam_cache. +// RPCService defines RPC service ioam_cache. type RPCService interface { IoamCacheIP6EnableDisable(ctx context.Context, in *IoamCacheIP6EnableDisable) (*IoamCacheIP6EnableDisableReply, error) } @@ -27,5 +27,5 @@ func (c *serviceClient) IoamCacheIP6EnableDisable(ctx context.Context, in *IoamC if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/ioam_export/ioam_export.ba.go b/binapi/ioam_export/ioam_export.ba.go index 47dd4e2..b272777 100644 --- a/binapi/ioam_export/ioam_export.ba.go +++ b/binapi/ioam_export/ioam_export.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/ioam_export.api.json // Package ioam_export contains generated bindings for API file ioam_export.api. diff --git a/binapi/ioam_export/ioam_export_rest.ba.go b/binapi/ioam_export/ioam_export_rest.ba.go deleted file mode 100644 index 06ee0bc..0000000 --- a/binapi/ioam_export/ioam_export_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package ioam_export - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/ioam_export_ip6_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(IoamExportIP6EnableDisable) - 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.IoamExportIP6EnableDisable(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/ioam_export/ioam_export_rpc.ba.go b/binapi/ioam_export/ioam_export_rpc.ba.go index 9cf5396..0e0da2e 100644 --- a/binapi/ioam_export/ioam_export_rpc.ba.go +++ b/binapi/ioam_export/ioam_export_rpc.ba.go @@ -8,7 +8,7 @@ import ( api "git.fd.io/govpp.git/api" ) -// RPCService defines RPC service ioam_export. +// RPCService defines RPC service ioam_export. type RPCService interface { IoamExportIP6EnableDisable(ctx context.Context, in *IoamExportIP6EnableDisable) (*IoamExportIP6EnableDisableReply, error) } @@ -27,5 +27,5 @@ func (c *serviceClient) IoamExportIP6EnableDisable(ctx context.Context, in *Ioam if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/ioam_vxlan_gpe/ioam_vxlan_gpe.ba.go b/binapi/ioam_vxlan_gpe/ioam_vxlan_gpe.ba.go index 7d1bb35..226071f 100644 --- a/binapi/ioam_vxlan_gpe/ioam_vxlan_gpe.ba.go +++ b/binapi/ioam_vxlan_gpe/ioam_vxlan_gpe.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/ioam_vxlan_gpe.api.json // Package ioam_vxlan_gpe contains generated bindings for API file ioam_vxlan_gpe.api. diff --git a/binapi/ioam_vxlan_gpe/ioam_vxlan_gpe_rest.ba.go b/binapi/ioam_vxlan_gpe/ioam_vxlan_gpe_rest.ba.go deleted file mode 100644 index bc34d36..0000000 --- a/binapi/ioam_vxlan_gpe/ioam_vxlan_gpe_rest.ba.go +++ /dev/null @@ -1,152 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package ioam_vxlan_gpe - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/vxlan_gpe_ioam_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(VxlanGpeIoamDisable) - 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.VxlanGpeIoamDisable(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("/vxlan_gpe_ioam_enable", func(w http.ResponseWriter, req *http.Request) { - var request = new(VxlanGpeIoamEnable) - 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.VxlanGpeIoamEnable(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("/vxlan_gpe_ioam_transit_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(VxlanGpeIoamTransitDisable) - 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.VxlanGpeIoamTransitDisable(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("/vxlan_gpe_ioam_transit_enable", func(w http.ResponseWriter, req *http.Request) { - var request = new(VxlanGpeIoamTransitEnable) - 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.VxlanGpeIoamTransitEnable(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("/vxlan_gpe_ioam_vni_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(VxlanGpeIoamVniDisable) - 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.VxlanGpeIoamVniDisable(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("/vxlan_gpe_ioam_vni_enable", func(w http.ResponseWriter, req *http.Request) { - var request = new(VxlanGpeIoamVniEnable) - 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.VxlanGpeIoamVniEnable(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/ioam_vxlan_gpe/ioam_vxlan_gpe_rpc.ba.go b/binapi/ioam_vxlan_gpe/ioam_vxlan_gpe_rpc.ba.go index eca5d4c..19bdbb2 100644 --- a/binapi/ioam_vxlan_gpe/ioam_vxlan_gpe_rpc.ba.go +++ b/binapi/ioam_vxlan_gpe/ioam_vxlan_gpe_rpc.ba.go @@ -8,7 +8,7 @@ import ( api "git.fd.io/govpp.git/api" ) -// RPCService defines RPC service ioam_vxlan_gpe. +// RPCService defines RPC service ioam_vxlan_gpe. type RPCService interface { VxlanGpeIoamDisable(ctx context.Context, in *VxlanGpeIoamDisable) (*VxlanGpeIoamDisableReply, error) VxlanGpeIoamEnable(ctx context.Context, in *VxlanGpeIoamEnable) (*VxlanGpeIoamEnableReply, error) @@ -32,7 +32,7 @@ func (c *serviceClient) VxlanGpeIoamDisable(ctx context.Context, in *VxlanGpeIoa if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) VxlanGpeIoamEnable(ctx context.Context, in *VxlanGpeIoamEnable) (*VxlanGpeIoamEnableReply, error) { @@ -41,7 +41,7 @@ func (c *serviceClient) VxlanGpeIoamEnable(ctx context.Context, in *VxlanGpeIoam if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) VxlanGpeIoamTransitDisable(ctx context.Context, in *VxlanGpeIoamTransitDisable) (*VxlanGpeIoamTransitDisableReply, error) { @@ -50,7 +50,7 @@ func (c *serviceClient) VxlanGpeIoamTransitDisable(ctx context.Context, in *Vxla if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) VxlanGpeIoamTransitEnable(ctx context.Context, in *VxlanGpeIoamTransitEnable) (*VxlanGpeIoamTransitEnableReply, error) { @@ -59,7 +59,7 @@ func (c *serviceClient) VxlanGpeIoamTransitEnable(ctx context.Context, in *Vxlan if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) VxlanGpeIoamVniDisable(ctx context.Context, in *VxlanGpeIoamVniDisable) (*VxlanGpeIoamVniDisableReply, error) { @@ -68,7 +68,7 @@ func (c *serviceClient) VxlanGpeIoamVniDisable(ctx context.Context, in *VxlanGpe if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) VxlanGpeIoamVniEnable(ctx context.Context, in *VxlanGpeIoamVniEnable) (*VxlanGpeIoamVniEnableReply, error) { @@ -77,5 +77,5 @@ func (c *serviceClient) VxlanGpeIoamVniEnable(ctx context.Context, in *VxlanGpeI if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/ip/ip.ba.go b/binapi/ip/ip.ba.go index b036e9c..ce8278c 100644 --- a/binapi/ip/ip.ba.go +++ b/binapi/ip/ip.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/core/ip.api.json // Package ip contains generated bindings for API file ip.api. diff --git a/binapi/ip/ip_rest.ba.go b/binapi/ip/ip_rest.ba.go deleted file mode 100644 index 245ffed..0000000 --- a/binapi/ip/ip_rest.ba.go +++ /dev/null @@ -1,474 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package ip - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/ioam_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(IoamDisable) - 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.IoamDisable(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("/ioam_enable", func(w http.ResponseWriter, req *http.Request) { - var request = new(IoamEnable) - 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.IoamEnable(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("/ip_container_proxy_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(IPContainerProxyAddDel) - 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.IPContainerProxyAddDel(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("/ip_mroute_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(IPMrouteAddDel) - 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.IPMrouteAddDel(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("/ip_punt_police", func(w http.ResponseWriter, req *http.Request) { - var request = new(IPPuntPolice) - 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.IPPuntPolice(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("/ip_punt_redirect", func(w http.ResponseWriter, req *http.Request) { - var request = new(IPPuntRedirect) - 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.IPPuntRedirect(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("/ip_reassembly_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(IPReassemblyEnableDisable) - 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.IPReassemblyEnableDisable(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("/ip_reassembly_get", func(w http.ResponseWriter, req *http.Request) { - var request = new(IPReassemblyGet) - 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.IPReassemblyGet(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("/ip_reassembly_set", func(w http.ResponseWriter, req *http.Request) { - var request = new(IPReassemblySet) - 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.IPReassemblySet(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("/ip_route_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(IPRouteAddDel) - 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.IPRouteAddDel(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("/ip_route_lookup", func(w http.ResponseWriter, req *http.Request) { - var request = new(IPRouteLookup) - 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.IPRouteLookup(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("/ip_source_and_port_range_check_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(IPSourceAndPortRangeCheckAddDel) - 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.IPSourceAndPortRangeCheckAddDel(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("/ip_source_and_port_range_check_interface_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(IPSourceAndPortRangeCheckInterfaceAddDel) - 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.IPSourceAndPortRangeCheckInterfaceAddDel(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("/ip_table_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(IPTableAddDel) - 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.IPTableAddDel(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("/ip_table_flush", func(w http.ResponseWriter, req *http.Request) { - var request = new(IPTableFlush) - 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.IPTableFlush(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("/ip_table_replace_begin", func(w http.ResponseWriter, req *http.Request) { - var request = new(IPTableReplaceBegin) - 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.IPTableReplaceBegin(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("/ip_table_replace_end", func(w http.ResponseWriter, req *http.Request) { - var request = new(IPTableReplaceEnd) - 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.IPTableReplaceEnd(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("/set_ip_flow_hash", func(w http.ResponseWriter, req *http.Request) { - var request = new(SetIPFlowHash) - 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.SetIPFlowHash(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("/sw_interface_ip6_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceIP6EnableDisable) - 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.SwInterfaceIP6EnableDisable(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("/sw_interface_ip6_set_link_local_address", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceIP6SetLinkLocalAddress) - 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.SwInterfaceIP6SetLinkLocalAddress(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/ip/ip_rpc.ba.go b/binapi/ip/ip_rpc.ba.go index a27c082..32ea1b5 100644 --- a/binapi/ip/ip_rpc.ba.go +++ b/binapi/ip/ip_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service ip. +// RPCService defines RPC service ip. type RPCService interface { IoamDisable(ctx context.Context, in *IoamDisable) (*IoamDisableReply, error) IoamEnable(ctx context.Context, in *IoamEnable) (*IoamEnableReply, error) @@ -59,7 +59,7 @@ func (c *serviceClient) IoamDisable(ctx context.Context, in *IoamDisable) (*Ioam if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IoamEnable(ctx context.Context, in *IoamEnable) (*IoamEnableReply, error) { @@ -68,7 +68,7 @@ func (c *serviceClient) IoamEnable(ctx context.Context, in *IoamEnable) (*IoamEn if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IPAddressDump(ctx context.Context, in *IPAddressDump) (RPCService_IPAddressDumpClient, error) { @@ -116,7 +116,7 @@ func (c *serviceClient) IPContainerProxyAddDel(ctx context.Context, in *IPContai if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IPContainerProxyDump(ctx context.Context, in *IPContainerProxyDump) (RPCService_IPContainerProxyDumpClient, error) { @@ -203,7 +203,7 @@ func (c *serviceClient) IPMrouteAddDel(ctx context.Context, in *IPMrouteAddDel) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IPMrouteDump(ctx context.Context, in *IPMrouteDump) (RPCService_IPMrouteDumpClient, error) { @@ -290,7 +290,7 @@ func (c *serviceClient) IPPuntPolice(ctx context.Context, in *IPPuntPolice) (*IP if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IPPuntRedirect(ctx context.Context, in *IPPuntRedirect) (*IPPuntRedirectReply, error) { @@ -299,7 +299,7 @@ func (c *serviceClient) IPPuntRedirect(ctx context.Context, in *IPPuntRedirect) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IPPuntRedirectDump(ctx context.Context, in *IPPuntRedirectDump) (RPCService_IPPuntRedirectDumpClient, error) { @@ -347,7 +347,7 @@ func (c *serviceClient) IPReassemblyEnableDisable(ctx context.Context, in *IPRea if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IPReassemblyGet(ctx context.Context, in *IPReassemblyGet) (*IPReassemblyGetReply, error) { @@ -356,7 +356,7 @@ func (c *serviceClient) IPReassemblyGet(ctx context.Context, in *IPReassemblyGet if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IPReassemblySet(ctx context.Context, in *IPReassemblySet) (*IPReassemblySetReply, error) { @@ -365,7 +365,7 @@ func (c *serviceClient) IPReassemblySet(ctx context.Context, in *IPReassemblySet if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IPRouteAddDel(ctx context.Context, in *IPRouteAddDel) (*IPRouteAddDelReply, error) { @@ -374,7 +374,7 @@ func (c *serviceClient) IPRouteAddDel(ctx context.Context, in *IPRouteAddDel) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IPRouteDump(ctx context.Context, in *IPRouteDump) (RPCService_IPRouteDumpClient, error) { @@ -422,7 +422,7 @@ func (c *serviceClient) IPRouteLookup(ctx context.Context, in *IPRouteLookup) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IPSourceAndPortRangeCheckAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckAddDel) (*IPSourceAndPortRangeCheckAddDelReply, error) { @@ -431,7 +431,7 @@ func (c *serviceClient) IPSourceAndPortRangeCheckAddDel(ctx context.Context, in if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IPSourceAndPortRangeCheckInterfaceAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckInterfaceAddDel) (*IPSourceAndPortRangeCheckInterfaceAddDelReply, error) { @@ -440,7 +440,7 @@ func (c *serviceClient) IPSourceAndPortRangeCheckInterfaceAddDel(ctx context.Con if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IPTableAddDel(ctx context.Context, in *IPTableAddDel) (*IPTableAddDelReply, error) { @@ -449,7 +449,7 @@ func (c *serviceClient) IPTableAddDel(ctx context.Context, in *IPTableAddDel) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IPTableDump(ctx context.Context, in *IPTableDump) (RPCService_IPTableDumpClient, error) { @@ -497,7 +497,7 @@ func (c *serviceClient) IPTableFlush(ctx context.Context, in *IPTableFlush) (*IP if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IPTableReplaceBegin(ctx context.Context, in *IPTableReplaceBegin) (*IPTableReplaceBeginReply, error) { @@ -506,7 +506,7 @@ func (c *serviceClient) IPTableReplaceBegin(ctx context.Context, in *IPTableRepl if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IPTableReplaceEnd(ctx context.Context, in *IPTableReplaceEnd) (*IPTableReplaceEndReply, error) { @@ -515,7 +515,7 @@ func (c *serviceClient) IPTableReplaceEnd(ctx context.Context, in *IPTableReplac if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IPUnnumberedDump(ctx context.Context, in *IPUnnumberedDump) (RPCService_IPUnnumberedDumpClient, error) { @@ -602,7 +602,7 @@ func (c *serviceClient) SetIPFlowHash(ctx context.Context, in *SetIPFlowHash) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceIP6EnableDisable(ctx context.Context, in *SwInterfaceIP6EnableDisable) (*SwInterfaceIP6EnableDisableReply, error) { @@ -611,7 +611,7 @@ func (c *serviceClient) SwInterfaceIP6EnableDisable(ctx context.Context, in *SwI if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceIP6SetLinkLocalAddress(ctx context.Context, in *SwInterfaceIP6SetLinkLocalAddress) (*SwInterfaceIP6SetLinkLocalAddressReply, error) { @@ -620,5 +620,5 @@ func (c *serviceClient) SwInterfaceIP6SetLinkLocalAddress(ctx context.Context, i if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/ip6_nd/ip6_nd.ba.go b/binapi/ip6_nd/ip6_nd.ba.go index a5f308e..9149861 100644 --- a/binapi/ip6_nd/ip6_nd.ba.go +++ b/binapi/ip6_nd/ip6_nd.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/core/ip6_nd.api.json // Package ip6_nd contains generated bindings for API file ip6_nd.api. diff --git a/binapi/ip6_nd/ip6_nd_rest.ba.go b/binapi/ip6_nd/ip6_nd_rest.ba.go deleted file mode 100644 index 2bd060d..0000000 --- a/binapi/ip6_nd/ip6_nd_rest.ba.go +++ /dev/null @@ -1,129 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package ip6_nd - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/ip6nd_proxy_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(IP6ndProxyAddDel) - 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.IP6ndProxyAddDel(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("/ip6nd_send_router_solicitation", func(w http.ResponseWriter, req *http.Request) { - var request = new(IP6ndSendRouterSolicitation) - 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.IP6ndSendRouterSolicitation(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("/sw_interface_ip6nd_ra_config", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceIP6ndRaConfig) - 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.SwInterfaceIP6ndRaConfig(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("/sw_interface_ip6nd_ra_prefix", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceIP6ndRaPrefix) - 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.SwInterfaceIP6ndRaPrefix(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_ip6_ra_events", func(w http.ResponseWriter, req *http.Request) { - var request = new(WantIP6RaEvents) - 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.WantIP6RaEvents(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/ip6_nd/ip6_nd_rpc.ba.go b/binapi/ip6_nd/ip6_nd_rpc.ba.go index 49e75cc..24e345f 100644 --- a/binapi/ip6_nd/ip6_nd_rpc.ba.go +++ b/binapi/ip6_nd/ip6_nd_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service ip6_nd. +// RPCService defines RPC service ip6_nd. type RPCService interface { IP6ndProxyAddDel(ctx context.Context, in *IP6ndProxyAddDel) (*IP6ndProxyAddDelReply, error) IP6ndProxyDump(ctx context.Context, in *IP6ndProxyDump) (RPCService_IP6ndProxyDumpClient, error) @@ -35,7 +35,7 @@ func (c *serviceClient) IP6ndProxyAddDel(ctx context.Context, in *IP6ndProxyAddD if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IP6ndProxyDump(ctx context.Context, in *IP6ndProxyDump) (RPCService_IP6ndProxyDumpClient, error) { @@ -83,7 +83,7 @@ func (c *serviceClient) IP6ndSendRouterSolicitation(ctx context.Context, in *IP6 if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceIP6ndRaConfig(ctx context.Context, in *SwInterfaceIP6ndRaConfig) (*SwInterfaceIP6ndRaConfigReply, error) { @@ -92,7 +92,7 @@ func (c *serviceClient) SwInterfaceIP6ndRaConfig(ctx context.Context, in *SwInte if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceIP6ndRaPrefix(ctx context.Context, in *SwInterfaceIP6ndRaPrefix) (*SwInterfaceIP6ndRaPrefixReply, error) { @@ -101,7 +101,7 @@ func (c *serviceClient) SwInterfaceIP6ndRaPrefix(ctx context.Context, in *SwInte if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) WantIP6RaEvents(ctx context.Context, in *WantIP6RaEvents) (*WantIP6RaEventsReply, error) { @@ -110,5 +110,5 @@ func (c *serviceClient) WantIP6RaEvents(ctx context.Context, in *WantIP6RaEvents if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/ip_neighbor/ip_neighbor.ba.go b/binapi/ip_neighbor/ip_neighbor.ba.go index 3215f5d..ec5b5ed 100644 --- a/binapi/ip_neighbor/ip_neighbor.ba.go +++ b/binapi/ip_neighbor/ip_neighbor.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/core/ip_neighbor.api.json // Package ip_neighbor contains generated bindings for API file ip_neighbor.api. diff --git a/binapi/ip_neighbor/ip_neighbor_rest.ba.go b/binapi/ip_neighbor/ip_neighbor_rest.ba.go deleted file mode 100644 index 7db4694..0000000 --- a/binapi/ip_neighbor/ip_neighbor_rest.ba.go +++ /dev/null @@ -1,134 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package ip_neighbor - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/ip_neighbor_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(IPNeighborAddDel) - 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.IPNeighborAddDel(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("/ip_neighbor_config", func(w http.ResponseWriter, req *http.Request) { - var request = new(IPNeighborConfig) - 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.IPNeighborConfig(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("/ip_neighbor_flush", func(w http.ResponseWriter, req *http.Request) { - var request = new(IPNeighborFlush) - 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.IPNeighborFlush(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("/ip_neighbor_replace_begin", func(w http.ResponseWriter, req *http.Request) { - var request = new(IPNeighborReplaceBegin) - reply, err := rpc.IPNeighborReplaceBegin(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("/ip_neighbor_replace_end", func(w http.ResponseWriter, req *http.Request) { - var request = new(IPNeighborReplaceEnd) - reply, err := rpc.IPNeighborReplaceEnd(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_ip_neighbor_events", func(w http.ResponseWriter, req *http.Request) { - var request = new(WantIPNeighborEvents) - 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.WantIPNeighborEvents(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/ip_neighbor/ip_neighbor_rpc.ba.go b/binapi/ip_neighbor/ip_neighbor_rpc.ba.go index 1d34965..94b2060 100644 --- a/binapi/ip_neighbor/ip_neighbor_rpc.ba.go +++ b/binapi/ip_neighbor/ip_neighbor_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service ip_neighbor. +// RPCService defines RPC service ip_neighbor. type RPCService interface { IPNeighborAddDel(ctx context.Context, in *IPNeighborAddDel) (*IPNeighborAddDelReply, error) IPNeighborConfig(ctx context.Context, in *IPNeighborConfig) (*IPNeighborConfigReply, error) @@ -36,7 +36,7 @@ func (c *serviceClient) IPNeighborAddDel(ctx context.Context, in *IPNeighborAddD if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IPNeighborConfig(ctx context.Context, in *IPNeighborConfig) (*IPNeighborConfigReply, error) { @@ -45,7 +45,7 @@ func (c *serviceClient) IPNeighborConfig(ctx context.Context, in *IPNeighborConf if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IPNeighborDump(ctx context.Context, in *IPNeighborDump) (RPCService_IPNeighborDumpClient, error) { @@ -93,7 +93,7 @@ func (c *serviceClient) IPNeighborFlush(ctx context.Context, in *IPNeighborFlush if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IPNeighborReplaceBegin(ctx context.Context, in *IPNeighborReplaceBegin) (*IPNeighborReplaceBeginReply, error) { @@ -102,7 +102,7 @@ func (c *serviceClient) IPNeighborReplaceBegin(ctx context.Context, in *IPNeighb if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IPNeighborReplaceEnd(ctx context.Context, in *IPNeighborReplaceEnd) (*IPNeighborReplaceEndReply, error) { @@ -111,7 +111,7 @@ func (c *serviceClient) IPNeighborReplaceEnd(ctx context.Context, in *IPNeighbor if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) WantIPNeighborEvents(ctx context.Context, in *WantIPNeighborEvents) (*WantIPNeighborEventsReply, error) { @@ -120,5 +120,5 @@ func (c *serviceClient) WantIPNeighborEvents(ctx context.Context, in *WantIPNeig if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/ip_types/ip_types.ba.go b/binapi/ip_types/ip_types.ba.go index 90363f8..3350fab 100644 --- a/binapi/ip_types/ip_types.ba.go +++ b/binapi/ip_types/ip_types.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/core/ip_types.api.json // Package ip_types contains generated bindings for API file ip_types.api. diff --git a/binapi/ipfix_export/ipfix_export.ba.go b/binapi/ipfix_export/ipfix_export.ba.go index e173058..e74441c 100644 --- a/binapi/ipfix_export/ipfix_export.ba.go +++ b/binapi/ipfix_export/ipfix_export.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/core/ipfix_export.api.json // Package ipfix_export contains generated bindings for API file ipfix_export.api. diff --git a/binapi/ipfix_export/ipfix_export_rest.ba.go b/binapi/ipfix_export/ipfix_export_rest.ba.go deleted file mode 100644 index 65407bf..0000000 --- a/binapi/ipfix_export/ipfix_export_rest.ba.go +++ /dev/null @@ -1,97 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package ipfix_export - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/ipfix_classify_table_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(IpfixClassifyTableAddDel) - 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.IpfixClassifyTableAddDel(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("/ipfix_flush", func(w http.ResponseWriter, req *http.Request) { - var request = new(IpfixFlush) - reply, err := rpc.IpfixFlush(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("/set_ipfix_classify_stream", func(w http.ResponseWriter, req *http.Request) { - var request = new(SetIpfixClassifyStream) - 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.SetIpfixClassifyStream(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("/set_ipfix_exporter", func(w http.ResponseWriter, req *http.Request) { - var request = new(SetIpfixExporter) - 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.SetIpfixExporter(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/ipfix_export/ipfix_export_rpc.ba.go b/binapi/ipfix_export/ipfix_export_rpc.ba.go index e65fa47..d577393 100644 --- a/binapi/ipfix_export/ipfix_export_rpc.ba.go +++ b/binapi/ipfix_export/ipfix_export_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service ipfix_export. +// RPCService defines RPC service ipfix_export. type RPCService interface { IpfixClassifyStreamDump(ctx context.Context, in *IpfixClassifyStreamDump) (RPCService_IpfixClassifyStreamDumpClient, error) IpfixClassifyTableAddDel(ctx context.Context, in *IpfixClassifyTableAddDel) (*IpfixClassifyTableAddDelReply, error) @@ -75,7 +75,7 @@ func (c *serviceClient) IpfixClassifyTableAddDel(ctx context.Context, in *IpfixC if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IpfixClassifyTableDump(ctx context.Context, in *IpfixClassifyTableDump) (RPCService_IpfixClassifyTableDumpClient, error) { @@ -162,7 +162,7 @@ func (c *serviceClient) IpfixFlush(ctx context.Context, in *IpfixFlush) (*IpfixF if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SetIpfixClassifyStream(ctx context.Context, in *SetIpfixClassifyStream) (*SetIpfixClassifyStreamReply, error) { @@ -171,7 +171,7 @@ func (c *serviceClient) SetIpfixClassifyStream(ctx context.Context, in *SetIpfix if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SetIpfixExporter(ctx context.Context, in *SetIpfixExporter) (*SetIpfixExporterReply, error) { @@ -180,5 +180,5 @@ func (c *serviceClient) SetIpfixExporter(ctx context.Context, in *SetIpfixExport if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/ipip/ipip.ba.go b/binapi/ipip/ipip.ba.go index 05821cb..48f9df2 100644 --- a/binapi/ipip/ipip.ba.go +++ b/binapi/ipip/ipip.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/core/ipip.api.json // Package ipip contains generated bindings for API file ipip.api. diff --git a/binapi/ipip/ipip_rest.ba.go b/binapi/ipip/ipip_rest.ba.go deleted file mode 100644 index 63fe220..0000000 --- a/binapi/ipip/ipip_rest.ba.go +++ /dev/null @@ -1,106 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package ipip - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/ipip_6rd_add_tunnel", func(w http.ResponseWriter, req *http.Request) { - var request = new(Ipip6rdAddTunnel) - 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.Ipip6rdAddTunnel(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("/ipip_6rd_del_tunnel", func(w http.ResponseWriter, req *http.Request) { - var request = new(Ipip6rdDelTunnel) - 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.Ipip6rdDelTunnel(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("/ipip_add_tunnel", func(w http.ResponseWriter, req *http.Request) { - var request = new(IpipAddTunnel) - 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.IpipAddTunnel(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("/ipip_del_tunnel", func(w http.ResponseWriter, req *http.Request) { - var request = new(IpipDelTunnel) - 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.IpipDelTunnel(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/ipip/ipip_rpc.ba.go b/binapi/ipip/ipip_rpc.ba.go index a3e4cc7..37b8821 100644 --- a/binapi/ipip/ipip_rpc.ba.go +++ b/binapi/ipip/ipip_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service ipip. +// RPCService defines RPC service ipip. type RPCService interface { Ipip6rdAddTunnel(ctx context.Context, in *Ipip6rdAddTunnel) (*Ipip6rdAddTunnelReply, error) Ipip6rdDelTunnel(ctx context.Context, in *Ipip6rdDelTunnel) (*Ipip6rdDelTunnelReply, error) @@ -34,7 +34,7 @@ func (c *serviceClient) Ipip6rdAddTunnel(ctx context.Context, in *Ipip6rdAddTunn if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Ipip6rdDelTunnel(ctx context.Context, in *Ipip6rdDelTunnel) (*Ipip6rdDelTunnelReply, error) { @@ -43,7 +43,7 @@ func (c *serviceClient) Ipip6rdDelTunnel(ctx context.Context, in *Ipip6rdDelTunn if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IpipAddTunnel(ctx context.Context, in *IpipAddTunnel) (*IpipAddTunnelReply, error) { @@ -52,7 +52,7 @@ func (c *serviceClient) IpipAddTunnel(ctx context.Context, in *IpipAddTunnel) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IpipDelTunnel(ctx context.Context, in *IpipDelTunnel) (*IpipDelTunnelReply, error) { @@ -61,7 +61,7 @@ func (c *serviceClient) IpipDelTunnel(ctx context.Context, in *IpipDelTunnel) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IpipTunnelDump(ctx context.Context, in *IpipTunnelDump) (RPCService_IpipTunnelDumpClient, error) { diff --git a/binapi/ipsec/ipsec.ba.go b/binapi/ipsec/ipsec.ba.go index b777353..0ed6714 100644 --- a/binapi/ipsec/ipsec.ba.go +++ b/binapi/ipsec/ipsec.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/core/ipsec.api.json // Package ipsec contains generated bindings for API file ipsec.api. diff --git a/binapi/ipsec/ipsec_rest.ba.go b/binapi/ipsec/ipsec_rest.ba.go deleted file mode 100644 index 166ebcd..0000000 --- a/binapi/ipsec/ipsec_rest.ba.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package ipsec - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/ipsec_interface_add_del_spd", func(w http.ResponseWriter, req *http.Request) { - var request = new(IpsecInterfaceAddDelSpd) - 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.IpsecInterfaceAddDelSpd(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("/ipsec_sad_entry_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(IpsecSadEntryAddDel) - 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.IpsecSadEntryAddDel(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("/ipsec_select_backend", func(w http.ResponseWriter, req *http.Request) { - var request = new(IpsecSelectBackend) - 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.IpsecSelectBackend(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("/ipsec_spd_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(IpsecSpdAddDel) - 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.IpsecSpdAddDel(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("/ipsec_spd_entry_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(IpsecSpdEntryAddDel) - 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.IpsecSpdEntryAddDel(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("/ipsec_tunnel_if_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(IpsecTunnelIfAddDel) - 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.IpsecTunnelIfAddDel(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("/ipsec_tunnel_if_set_sa", func(w http.ResponseWriter, req *http.Request) { - var request = new(IpsecTunnelIfSetSa) - 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.IpsecTunnelIfSetSa(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("/ipsec_tunnel_protect_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(IpsecTunnelProtectDel) - 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.IpsecTunnelProtectDel(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("/ipsec_tunnel_protect_update", func(w http.ResponseWriter, req *http.Request) { - var request = new(IpsecTunnelProtectUpdate) - 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.IpsecTunnelProtectUpdate(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/ipsec/ipsec_rpc.ba.go b/binapi/ipsec/ipsec_rpc.ba.go index 953c1a0..1e6b81d 100644 --- a/binapi/ipsec/ipsec_rpc.ba.go +++ b/binapi/ipsec/ipsec_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service ipsec. +// RPCService defines RPC service ipsec. type RPCService interface { IpsecBackendDump(ctx context.Context, in *IpsecBackendDump) (RPCService_IpsecBackendDumpClient, error) IpsecInterfaceAddDelSpd(ctx context.Context, in *IpsecInterfaceAddDelSpd) (*IpsecInterfaceAddDelSpdReply, error) @@ -83,7 +83,7 @@ func (c *serviceClient) IpsecInterfaceAddDelSpd(ctx context.Context, in *IpsecIn if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IpsecSaDump(ctx context.Context, in *IpsecSaDump) (RPCService_IpsecSaDumpClient, error) { @@ -131,7 +131,7 @@ func (c *serviceClient) IpsecSadEntryAddDel(ctx context.Context, in *IpsecSadEnt if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IpsecSelectBackend(ctx context.Context, in *IpsecSelectBackend) (*IpsecSelectBackendReply, error) { @@ -140,7 +140,7 @@ func (c *serviceClient) IpsecSelectBackend(ctx context.Context, in *IpsecSelectB if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IpsecSpdAddDel(ctx context.Context, in *IpsecSpdAddDel) (*IpsecSpdAddDelReply, error) { @@ -149,7 +149,7 @@ func (c *serviceClient) IpsecSpdAddDel(ctx context.Context, in *IpsecSpdAddDel) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IpsecSpdDump(ctx context.Context, in *IpsecSpdDump) (RPCService_IpsecSpdDumpClient, error) { @@ -197,7 +197,7 @@ func (c *serviceClient) IpsecSpdEntryAddDel(ctx context.Context, in *IpsecSpdEnt if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IpsecSpdInterfaceDump(ctx context.Context, in *IpsecSpdInterfaceDump) (RPCService_IpsecSpdInterfaceDumpClient, error) { @@ -284,7 +284,7 @@ func (c *serviceClient) IpsecTunnelIfAddDel(ctx context.Context, in *IpsecTunnel if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IpsecTunnelIfSetSa(ctx context.Context, in *IpsecTunnelIfSetSa) (*IpsecTunnelIfSetSaReply, error) { @@ -293,7 +293,7 @@ func (c *serviceClient) IpsecTunnelIfSetSa(ctx context.Context, in *IpsecTunnelI if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IpsecTunnelProtectDel(ctx context.Context, in *IpsecTunnelProtectDel) (*IpsecTunnelProtectDelReply, error) { @@ -302,7 +302,7 @@ func (c *serviceClient) IpsecTunnelProtectDel(ctx context.Context, in *IpsecTunn if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) IpsecTunnelProtectDump(ctx context.Context, in *IpsecTunnelProtectDump) (RPCService_IpsecTunnelProtectDumpClient, error) { @@ -350,5 +350,5 @@ func (c *serviceClient) IpsecTunnelProtectUpdate(ctx context.Context, in *IpsecT if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/ipsec_types/ipsec_types.ba.go b/binapi/ipsec_types/ipsec_types.ba.go index 4e7e29e..aa83d09 100644 --- a/binapi/ipsec_types/ipsec_types.ba.go +++ b/binapi/ipsec_types/ipsec_types.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/core/ipsec_types.api.json // Package ipsec_types contains generated bindings for API file ipsec_types.api. diff --git a/binapi/l2/l2.ba.go b/binapi/l2/l2.ba.go index d924837..745157e 100644 --- a/binapi/l2/l2.ba.go +++ b/binapi/l2/l2.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/core/l2.api.json // Package l2 contains generated bindings for API file l2.api. diff --git a/binapi/l2/l2_rest.ba.go b/binapi/l2/l2_rest.ba.go deleted file mode 100644 index f12ab06..0000000 --- a/binapi/l2/l2_rest.ba.go +++ /dev/null @@ -1,502 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package l2 - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/bd_ip_mac_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(BdIPMacAddDel) - 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.BdIPMacAddDel(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("/bd_ip_mac_flush", func(w http.ResponseWriter, req *http.Request) { - var request = new(BdIPMacFlush) - 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.BdIPMacFlush(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("/bridge_domain_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(BridgeDomainAddDel) - 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.BridgeDomainAddDel(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("/bridge_domain_set_mac_age", func(w http.ResponseWriter, req *http.Request) { - var request = new(BridgeDomainSetMacAge) - 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.BridgeDomainSetMacAge(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("/bridge_flags", func(w http.ResponseWriter, req *http.Request) { - var request = new(BridgeFlags) - 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.BridgeFlags(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("/bvi_create", func(w http.ResponseWriter, req *http.Request) { - var request = new(BviCreate) - 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.BviCreate(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("/bvi_delete", func(w http.ResponseWriter, req *http.Request) { - var request = new(BviDelete) - 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.BviDelete(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("/l2_fib_clear_table", func(w http.ResponseWriter, req *http.Request) { - var request = new(L2FibClearTable) - reply, err := rpc.L2FibClearTable(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("/l2_flags", func(w http.ResponseWriter, req *http.Request) { - var request = new(L2Flags) - 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.L2Flags(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("/l2_interface_efp_filter", func(w http.ResponseWriter, req *http.Request) { - var request = new(L2InterfaceEfpFilter) - 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.L2InterfaceEfpFilter(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("/l2_interface_pbb_tag_rewrite", func(w http.ResponseWriter, req *http.Request) { - var request = new(L2InterfacePbbTagRewrite) - 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.L2InterfacePbbTagRewrite(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("/l2_interface_vlan_tag_rewrite", func(w http.ResponseWriter, req *http.Request) { - var request = new(L2InterfaceVlanTagRewrite) - 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.L2InterfaceVlanTagRewrite(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("/l2_patch_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(L2PatchAddDel) - 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.L2PatchAddDel(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("/l2fib_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(L2fibAddDel) - 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.L2fibAddDel(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("/l2fib_flush_all", func(w http.ResponseWriter, req *http.Request) { - var request = new(L2fibFlushAll) - reply, err := rpc.L2fibFlushAll(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("/l2fib_flush_bd", func(w http.ResponseWriter, req *http.Request) { - var request = new(L2fibFlushBd) - 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.L2fibFlushBd(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("/l2fib_flush_int", func(w http.ResponseWriter, req *http.Request) { - var request = new(L2fibFlushInt) - 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.L2fibFlushInt(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("/sw_interface_set_l2_bridge", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceSetL2Bridge) - 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.SwInterfaceSetL2Bridge(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("/sw_interface_set_l2_xconnect", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceSetL2Xconnect) - 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.SwInterfaceSetL2Xconnect(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("/sw_interface_set_vpath", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceSetVpath) - 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.SwInterfaceSetVpath(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_l2_arp_term_events", func(w http.ResponseWriter, req *http.Request) { - var request = new(WantL2ArpTermEvents) - 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.WantL2ArpTermEvents(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_l2_macs_events", func(w http.ResponseWriter, req *http.Request) { - var request = new(WantL2MacsEvents) - 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.WantL2MacsEvents(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/l2/l2_rpc.ba.go b/binapi/l2/l2_rpc.ba.go index 9e4489a..bf097ee 100644 --- a/binapi/l2/l2_rpc.ba.go +++ b/binapi/l2/l2_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service l2. +// RPCService defines RPC service l2. type RPCService interface { BdIPMacAddDel(ctx context.Context, in *BdIPMacAddDel) (*BdIPMacAddDelReply, error) BdIPMacDump(ctx context.Context, in *BdIPMacDump) (RPCService_BdIPMacDumpClient, error) @@ -55,7 +55,7 @@ func (c *serviceClient) BdIPMacAddDel(ctx context.Context, in *BdIPMacAddDel) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BdIPMacDump(ctx context.Context, in *BdIPMacDump) (RPCService_BdIPMacDumpClient, error) { @@ -103,7 +103,7 @@ func (c *serviceClient) BdIPMacFlush(ctx context.Context, in *BdIPMacFlush) (*Bd if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BridgeDomainAddDel(ctx context.Context, in *BridgeDomainAddDel) (*BridgeDomainAddDelReply, error) { @@ -112,7 +112,7 @@ func (c *serviceClient) BridgeDomainAddDel(ctx context.Context, in *BridgeDomain if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BridgeDomainDump(ctx context.Context, in *BridgeDomainDump) (RPCService_BridgeDomainDumpClient, error) { @@ -160,7 +160,7 @@ func (c *serviceClient) BridgeDomainSetMacAge(ctx context.Context, in *BridgeDom if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BridgeFlags(ctx context.Context, in *BridgeFlags) (*BridgeFlagsReply, error) { @@ -169,7 +169,7 @@ func (c *serviceClient) BridgeFlags(ctx context.Context, in *BridgeFlags) (*Brid if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BviCreate(ctx context.Context, in *BviCreate) (*BviCreateReply, error) { @@ -178,7 +178,7 @@ func (c *serviceClient) BviCreate(ctx context.Context, in *BviCreate) (*BviCreat if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) BviDelete(ctx context.Context, in *BviDelete) (*BviDeleteReply, error) { @@ -187,7 +187,7 @@ func (c *serviceClient) BviDelete(ctx context.Context, in *BviDelete) (*BviDelet if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) L2FibClearTable(ctx context.Context, in *L2FibClearTable) (*L2FibClearTableReply, error) { @@ -196,7 +196,7 @@ func (c *serviceClient) L2FibClearTable(ctx context.Context, in *L2FibClearTable if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) L2FibTableDump(ctx context.Context, in *L2FibTableDump) (RPCService_L2FibTableDumpClient, error) { @@ -244,7 +244,7 @@ func (c *serviceClient) L2Flags(ctx context.Context, in *L2Flags) (*L2FlagsReply if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) L2InterfaceEfpFilter(ctx context.Context, in *L2InterfaceEfpFilter) (*L2InterfaceEfpFilterReply, error) { @@ -253,7 +253,7 @@ func (c *serviceClient) L2InterfaceEfpFilter(ctx context.Context, in *L2Interfac if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) L2InterfacePbbTagRewrite(ctx context.Context, in *L2InterfacePbbTagRewrite) (*L2InterfacePbbTagRewriteReply, error) { @@ -262,7 +262,7 @@ func (c *serviceClient) L2InterfacePbbTagRewrite(ctx context.Context, in *L2Inte if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) L2InterfaceVlanTagRewrite(ctx context.Context, in *L2InterfaceVlanTagRewrite) (*L2InterfaceVlanTagRewriteReply, error) { @@ -271,7 +271,7 @@ func (c *serviceClient) L2InterfaceVlanTagRewrite(ctx context.Context, in *L2Int if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) L2PatchAddDel(ctx context.Context, in *L2PatchAddDel) (*L2PatchAddDelReply, error) { @@ -280,7 +280,7 @@ func (c *serviceClient) L2PatchAddDel(ctx context.Context, in *L2PatchAddDel) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) L2XconnectDump(ctx context.Context, in *L2XconnectDump) (RPCService_L2XconnectDumpClient, error) { @@ -328,7 +328,7 @@ func (c *serviceClient) L2fibAddDel(ctx context.Context, in *L2fibAddDel) (*L2fi if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) L2fibFlushAll(ctx context.Context, in *L2fibFlushAll) (*L2fibFlushAllReply, error) { @@ -337,7 +337,7 @@ func (c *serviceClient) L2fibFlushAll(ctx context.Context, in *L2fibFlushAll) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) L2fibFlushBd(ctx context.Context, in *L2fibFlushBd) (*L2fibFlushBdReply, error) { @@ -346,7 +346,7 @@ func (c *serviceClient) L2fibFlushBd(ctx context.Context, in *L2fibFlushBd) (*L2 if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) L2fibFlushInt(ctx context.Context, in *L2fibFlushInt) (*L2fibFlushIntReply, error) { @@ -355,7 +355,7 @@ func (c *serviceClient) L2fibFlushInt(ctx context.Context, in *L2fibFlushInt) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceSetL2Bridge(ctx context.Context, in *SwInterfaceSetL2Bridge) (*SwInterfaceSetL2BridgeReply, error) { @@ -364,7 +364,7 @@ func (c *serviceClient) SwInterfaceSetL2Bridge(ctx context.Context, in *SwInterf if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceSetL2Xconnect(ctx context.Context, in *SwInterfaceSetL2Xconnect) (*SwInterfaceSetL2XconnectReply, error) { @@ -373,7 +373,7 @@ func (c *serviceClient) SwInterfaceSetL2Xconnect(ctx context.Context, in *SwInte if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceSetVpath(ctx context.Context, in *SwInterfaceSetVpath) (*SwInterfaceSetVpathReply, error) { @@ -382,7 +382,7 @@ func (c *serviceClient) SwInterfaceSetVpath(ctx context.Context, in *SwInterface if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) WantL2ArpTermEvents(ctx context.Context, in *WantL2ArpTermEvents) (*WantL2ArpTermEventsReply, error) { @@ -391,7 +391,7 @@ func (c *serviceClient) WantL2ArpTermEvents(ctx context.Context, in *WantL2ArpTe if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) WantL2MacsEvents(ctx context.Context, in *WantL2MacsEvents) (*WantL2MacsEventsReply, error) { @@ -400,5 +400,5 @@ func (c *serviceClient) WantL2MacsEvents(ctx context.Context, in *WantL2MacsEven if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/l2e/l2e.ba.go b/binapi/l2e/l2e.ba.go index c1b2a76..7bf5186 100644 --- a/binapi/l2e/l2e.ba.go +++ b/binapi/l2e/l2e.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/l2e.api.json // Package l2e contains generated bindings for API file l2e.api. diff --git a/binapi/l2e/l2e_rest.ba.go b/binapi/l2e/l2e_rest.ba.go deleted file mode 100644 index 23bc249..0000000 --- a/binapi/l2e/l2e_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package l2e - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/l2_emulation", func(w http.ResponseWriter, req *http.Request) { - var request = new(L2Emulation) - 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.L2Emulation(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/l2e/l2e_rpc.ba.go b/binapi/l2e/l2e_rpc.ba.go index 8f85177..277e04e 100644 --- a/binapi/l2e/l2e_rpc.ba.go +++ b/binapi/l2e/l2e_rpc.ba.go @@ -8,7 +8,7 @@ import ( api "git.fd.io/govpp.git/api" ) -// RPCService defines RPC service l2e. +// RPCService defines RPC service l2e. type RPCService interface { L2Emulation(ctx context.Context, in *L2Emulation) (*L2EmulationReply, error) } @@ -27,5 +27,5 @@ func (c *serviceClient) L2Emulation(ctx context.Context, in *L2Emulation) (*L2Em if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/l2tp/l2tp.ba.go b/binapi/l2tp/l2tp.ba.go index 574598e..cf93f79 100644 --- a/binapi/l2tp/l2tp.ba.go +++ b/binapi/l2tp/l2tp.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/core/l2tp.api.json // Package l2tp contains generated bindings for API file l2tp.api. diff --git a/binapi/l2tp/l2tp_rest.ba.go b/binapi/l2tp/l2tp_rest.ba.go deleted file mode 100644 index ac1119f..0000000 --- a/binapi/l2tp/l2tp_rest.ba.go +++ /dev/null @@ -1,106 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package l2tp - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/l2tpv3_create_tunnel", func(w http.ResponseWriter, req *http.Request) { - var request = new(L2tpv3CreateTunnel) - 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.L2tpv3CreateTunnel(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("/l2tpv3_interface_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(L2tpv3InterfaceEnableDisable) - 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.L2tpv3InterfaceEnableDisable(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("/l2tpv3_set_lookup_key", func(w http.ResponseWriter, req *http.Request) { - var request = new(L2tpv3SetLookupKey) - 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.L2tpv3SetLookupKey(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("/l2tpv3_set_tunnel_cookies", func(w http.ResponseWriter, req *http.Request) { - var request = new(L2tpv3SetTunnelCookies) - 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.L2tpv3SetTunnelCookies(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/l2tp/l2tp_rpc.ba.go b/binapi/l2tp/l2tp_rpc.ba.go index 24e62bc..e82ae3d 100644 --- a/binapi/l2tp/l2tp_rpc.ba.go +++ b/binapi/l2tp/l2tp_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service l2tp. +// RPCService defines RPC service l2tp. type RPCService interface { L2tpv3CreateTunnel(ctx context.Context, in *L2tpv3CreateTunnel) (*L2tpv3CreateTunnelReply, error) L2tpv3InterfaceEnableDisable(ctx context.Context, in *L2tpv3InterfaceEnableDisable) (*L2tpv3InterfaceEnableDisableReply, error) @@ -34,7 +34,7 @@ func (c *serviceClient) L2tpv3CreateTunnel(ctx context.Context, in *L2tpv3Create if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) L2tpv3InterfaceEnableDisable(ctx context.Context, in *L2tpv3InterfaceEnableDisable) (*L2tpv3InterfaceEnableDisableReply, error) { @@ -43,7 +43,7 @@ func (c *serviceClient) L2tpv3InterfaceEnableDisable(ctx context.Context, in *L2 if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) L2tpv3SetLookupKey(ctx context.Context, in *L2tpv3SetLookupKey) (*L2tpv3SetLookupKeyReply, error) { @@ -52,7 +52,7 @@ func (c *serviceClient) L2tpv3SetLookupKey(ctx context.Context, in *L2tpv3SetLoo if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) L2tpv3SetTunnelCookies(ctx context.Context, in *L2tpv3SetTunnelCookies) (*L2tpv3SetTunnelCookiesReply, error) { @@ -61,7 +61,7 @@ func (c *serviceClient) L2tpv3SetTunnelCookies(ctx context.Context, in *L2tpv3Se if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwIfL2tpv3TunnelDump(ctx context.Context, in *SwIfL2tpv3TunnelDump) (RPCService_SwIfL2tpv3TunnelDumpClient, error) { diff --git a/binapi/l3xc/l3xc.ba.go b/binapi/l3xc/l3xc.ba.go index 3dbcfba..ac35157 100644 --- a/binapi/l3xc/l3xc.ba.go +++ b/binapi/l3xc/l3xc.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/l3xc.api.json // Package l3xc contains generated bindings for API file l3xc.api. diff --git a/binapi/l3xc/l3xc_rest.ba.go b/binapi/l3xc/l3xc_rest.ba.go deleted file mode 100644 index 2b2c9ba..0000000 --- a/binapi/l3xc/l3xc_rest.ba.go +++ /dev/null @@ -1,74 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package l3xc - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/l3xc_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(L3xcDel) - 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.L3xcDel(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("/l3xc_plugin_get_version", func(w http.ResponseWriter, req *http.Request) { - var request = new(L3xcPluginGetVersion) - reply, err := rpc.L3xcPluginGetVersion(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("/l3xc_update", func(w http.ResponseWriter, req *http.Request) { - var request = new(L3xcUpdate) - 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.L3xcUpdate(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/l3xc/l3xc_rpc.ba.go b/binapi/l3xc/l3xc_rpc.ba.go index ffd0ff8..d463513 100644 --- a/binapi/l3xc/l3xc_rpc.ba.go +++ b/binapi/l3xc/l3xc_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service l3xc. +// RPCService defines RPC service l3xc. type RPCService interface { L3xcDel(ctx context.Context, in *L3xcDel) (*L3xcDelReply, error) L3xcDump(ctx context.Context, in *L3xcDump) (RPCService_L3xcDumpClient, error) @@ -33,7 +33,7 @@ func (c *serviceClient) L3xcDel(ctx context.Context, in *L3xcDel) (*L3xcDelReply if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) L3xcDump(ctx context.Context, in *L3xcDump) (RPCService_L3xcDumpClient, error) { @@ -90,5 +90,5 @@ func (c *serviceClient) L3xcUpdate(ctx context.Context, in *L3xcUpdate) (*L3xcUp if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/lacp/lacp.ba.go b/binapi/lacp/lacp.ba.go index f1a9457..29ad103 100644 --- a/binapi/lacp/lacp.ba.go +++ b/binapi/lacp/lacp.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/lacp.api.json // Package lacp contains generated bindings for API file lacp.api. diff --git a/binapi/lacp/lacp_rest.ba.go b/binapi/lacp/lacp_rest.ba.go deleted file mode 100644 index 3512a0d..0000000 --- a/binapi/lacp/lacp_rest.ba.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package lacp - -import ( - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/lacp/lacp_rpc.ba.go b/binapi/lacp/lacp_rpc.ba.go index e342a2c..8a288f2 100644 --- a/binapi/lacp/lacp_rpc.ba.go +++ b/binapi/lacp/lacp_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service lacp. +// RPCService defines RPC service lacp. type RPCService interface { SwInterfaceLacpDump(ctx context.Context, in *SwInterfaceLacpDump) (RPCService_SwInterfaceLacpDumpClient, error) } diff --git a/binapi/lb/lb.ba.go b/binapi/lb/lb.ba.go index 9fdfc7f..0349d86 100644 --- a/binapi/lb/lb.ba.go +++ b/binapi/lb/lb.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/lb.api.json // Package lb contains generated bindings for API file lb.api. diff --git a/binapi/lb/lb_rest.ba.go b/binapi/lb/lb_rest.ba.go deleted file mode 100644 index ea7fad8..0000000 --- a/binapi/lb/lb_rest.ba.go +++ /dev/null @@ -1,152 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package lb - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/lb_add_del_as", func(w http.ResponseWriter, req *http.Request) { - var request = new(LbAddDelAs) - 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.LbAddDelAs(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("/lb_add_del_intf_nat4", func(w http.ResponseWriter, req *http.Request) { - var request = new(LbAddDelIntfNat4) - 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.LbAddDelIntfNat4(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("/lb_add_del_intf_nat6", func(w http.ResponseWriter, req *http.Request) { - var request = new(LbAddDelIntfNat6) - 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.LbAddDelIntfNat6(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("/lb_add_del_vip", func(w http.ResponseWriter, req *http.Request) { - var request = new(LbAddDelVip) - 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.LbAddDelVip(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("/lb_conf", func(w http.ResponseWriter, req *http.Request) { - var request = new(LbConf) - 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.LbConf(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("/lb_flush_vip", func(w http.ResponseWriter, req *http.Request) { - var request = new(LbFlushVip) - 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.LbFlushVip(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/lb/lb_rpc.ba.go b/binapi/lb/lb_rpc.ba.go index 72b027a..fe0dd7b 100644 --- a/binapi/lb/lb_rpc.ba.go +++ b/binapi/lb/lb_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service lb. +// RPCService defines RPC service lb. type RPCService interface { LbAddDelAs(ctx context.Context, in *LbAddDelAs) (*LbAddDelAsReply, error) LbAddDelIntfNat4(ctx context.Context, in *LbAddDelIntfNat4) (*LbAddDelIntfNat4Reply, error) @@ -37,7 +37,7 @@ func (c *serviceClient) LbAddDelAs(ctx context.Context, in *LbAddDelAs) (*LbAddD if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LbAddDelIntfNat4(ctx context.Context, in *LbAddDelIntfNat4) (*LbAddDelIntfNat4Reply, error) { @@ -46,7 +46,7 @@ func (c *serviceClient) LbAddDelIntfNat4(ctx context.Context, in *LbAddDelIntfNa if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LbAddDelIntfNat6(ctx context.Context, in *LbAddDelIntfNat6) (*LbAddDelIntfNat6Reply, error) { @@ -55,7 +55,7 @@ func (c *serviceClient) LbAddDelIntfNat6(ctx context.Context, in *LbAddDelIntfNa if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LbAddDelVip(ctx context.Context, in *LbAddDelVip) (*LbAddDelVipReply, error) { @@ -64,7 +64,7 @@ func (c *serviceClient) LbAddDelVip(ctx context.Context, in *LbAddDelVip) (*LbAd if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LbAsDump(ctx context.Context, in *LbAsDump) (RPCService_LbAsDumpClient, error) { @@ -112,7 +112,7 @@ func (c *serviceClient) LbConf(ctx context.Context, in *LbConf) (*LbConfReply, e if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LbFlushVip(ctx context.Context, in *LbFlushVip) (*LbFlushVipReply, error) { @@ -121,7 +121,7 @@ func (c *serviceClient) LbFlushVip(ctx context.Context, in *LbFlushVip) (*LbFlus if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LbVipDump(ctx context.Context, in *LbVipDump) (RPCService_LbVipDumpClient, error) { diff --git a/binapi/lb_types/lb_types.ba.go b/binapi/lb_types/lb_types.ba.go index 7e41146..6b91100 100644 --- a/binapi/lb_types/lb_types.ba.go +++ b/binapi/lb_types/lb_types.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/lb_types.api.json // Package lb_types contains generated bindings for API file lb_types.api. diff --git a/binapi/lisp/lisp.ba.go b/binapi/lisp/lisp.ba.go index 7be6cca..c6e2246 100644 --- a/binapi/lisp/lisp.ba.go +++ b/binapi/lisp/lisp.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/core/lisp.api.json // Package lisp contains generated bindings for API file lisp.api. diff --git a/binapi/lisp/lisp_rest.ba.go b/binapi/lisp/lisp_rest.ba.go deleted file mode 100644 index 024d6f5..0000000 --- a/binapi/lisp/lisp_rest.ba.go +++ /dev/null @@ -1,480 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package lisp - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/lisp_add_del_adjacency", func(w http.ResponseWriter, req *http.Request) { - var request = new(LispAddDelAdjacency) - 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.LispAddDelAdjacency(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("/lisp_add_del_local_eid", func(w http.ResponseWriter, req *http.Request) { - var request = new(LispAddDelLocalEid) - 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.LispAddDelLocalEid(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("/lisp_add_del_locator", func(w http.ResponseWriter, req *http.Request) { - var request = new(LispAddDelLocator) - 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.LispAddDelLocator(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("/lisp_add_del_locator_set", func(w http.ResponseWriter, req *http.Request) { - var request = new(LispAddDelLocatorSet) - 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.LispAddDelLocatorSet(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("/lisp_add_del_map_request_itr_rlocs", func(w http.ResponseWriter, req *http.Request) { - var request = new(LispAddDelMapRequestItrRlocs) - 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.LispAddDelMapRequestItrRlocs(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("/lisp_add_del_map_resolver", func(w http.ResponseWriter, req *http.Request) { - var request = new(LispAddDelMapResolver) - 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.LispAddDelMapResolver(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("/lisp_add_del_map_server", func(w http.ResponseWriter, req *http.Request) { - var request = new(LispAddDelMapServer) - 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.LispAddDelMapServer(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("/lisp_add_del_remote_mapping", func(w http.ResponseWriter, req *http.Request) { - var request = new(LispAddDelRemoteMapping) - 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.LispAddDelRemoteMapping(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("/lisp_adjacencies_get", func(w http.ResponseWriter, req *http.Request) { - var request = new(LispAdjacenciesGet) - 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.LispAdjacenciesGet(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("/lisp_eid_table_add_del_map", func(w http.ResponseWriter, req *http.Request) { - var request = new(LispEidTableAddDelMap) - 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.LispEidTableAddDelMap(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("/lisp_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(LispEnableDisable) - 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.LispEnableDisable(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("/lisp_get_map_request_itr_rlocs", func(w http.ResponseWriter, req *http.Request) { - var request = new(LispGetMapRequestItrRlocs) - reply, err := rpc.LispGetMapRequestItrRlocs(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("/lisp_map_register_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(LispMapRegisterEnableDisable) - 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.LispMapRegisterEnableDisable(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("/lisp_map_request_mode", func(w http.ResponseWriter, req *http.Request) { - var request = new(LispMapRequestMode) - 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.LispMapRequestMode(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("/lisp_pitr_set_locator_set", func(w http.ResponseWriter, req *http.Request) { - var request = new(LispPitrSetLocatorSet) - 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.LispPitrSetLocatorSet(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("/lisp_rloc_probe_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(LispRlocProbeEnableDisable) - 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.LispRlocProbeEnableDisable(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("/lisp_use_petr", func(w http.ResponseWriter, req *http.Request) { - var request = new(LispUsePetr) - 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.LispUsePetr(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("/show_lisp_map_register_state", func(w http.ResponseWriter, req *http.Request) { - var request = new(ShowLispMapRegisterState) - reply, err := rpc.ShowLispMapRegisterState(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("/show_lisp_map_request_mode", func(w http.ResponseWriter, req *http.Request) { - var request = new(ShowLispMapRequestMode) - reply, err := rpc.ShowLispMapRequestMode(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("/show_lisp_pitr", func(w http.ResponseWriter, req *http.Request) { - var request = new(ShowLispPitr) - reply, err := rpc.ShowLispPitr(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("/show_lisp_rloc_probe_state", func(w http.ResponseWriter, req *http.Request) { - var request = new(ShowLispRlocProbeState) - reply, err := rpc.ShowLispRlocProbeState(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("/show_lisp_status", func(w http.ResponseWriter, req *http.Request) { - var request = new(ShowLispStatus) - reply, err := rpc.ShowLispStatus(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("/show_lisp_use_petr", func(w http.ResponseWriter, req *http.Request) { - var request = new(ShowLispUsePetr) - reply, err := rpc.ShowLispUsePetr(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/lisp/lisp_rpc.ba.go b/binapi/lisp/lisp_rpc.ba.go index 58962d4..511de34 100644 --- a/binapi/lisp/lisp_rpc.ba.go +++ b/binapi/lisp/lisp_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service lisp. +// RPCService defines RPC service lisp. type RPCService interface { LispAddDelAdjacency(ctx context.Context, in *LispAddDelAdjacency) (*LispAddDelAdjacencyReply, error) LispAddDelLocalEid(ctx context.Context, in *LispAddDelLocalEid) (*LispAddDelLocalEidReply, error) @@ -59,7 +59,7 @@ func (c *serviceClient) LispAddDelAdjacency(ctx context.Context, in *LispAddDelA if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LispAddDelLocalEid(ctx context.Context, in *LispAddDelLocalEid) (*LispAddDelLocalEidReply, error) { @@ -68,7 +68,7 @@ func (c *serviceClient) LispAddDelLocalEid(ctx context.Context, in *LispAddDelLo if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LispAddDelLocator(ctx context.Context, in *LispAddDelLocator) (*LispAddDelLocatorReply, error) { @@ -77,7 +77,7 @@ func (c *serviceClient) LispAddDelLocator(ctx context.Context, in *LispAddDelLoc if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LispAddDelLocatorSet(ctx context.Context, in *LispAddDelLocatorSet) (*LispAddDelLocatorSetReply, error) { @@ -86,7 +86,7 @@ func (c *serviceClient) LispAddDelLocatorSet(ctx context.Context, in *LispAddDel if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LispAddDelMapRequestItrRlocs(ctx context.Context, in *LispAddDelMapRequestItrRlocs) (*LispAddDelMapRequestItrRlocsReply, error) { @@ -95,7 +95,7 @@ func (c *serviceClient) LispAddDelMapRequestItrRlocs(ctx context.Context, in *Li if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LispAddDelMapResolver(ctx context.Context, in *LispAddDelMapResolver) (*LispAddDelMapResolverReply, error) { @@ -104,7 +104,7 @@ func (c *serviceClient) LispAddDelMapResolver(ctx context.Context, in *LispAddDe if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LispAddDelMapServer(ctx context.Context, in *LispAddDelMapServer) (*LispAddDelMapServerReply, error) { @@ -113,7 +113,7 @@ func (c *serviceClient) LispAddDelMapServer(ctx context.Context, in *LispAddDelM if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LispAddDelRemoteMapping(ctx context.Context, in *LispAddDelRemoteMapping) (*LispAddDelRemoteMappingReply, error) { @@ -122,7 +122,7 @@ func (c *serviceClient) LispAddDelRemoteMapping(ctx context.Context, in *LispAdd if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LispAdjacenciesGet(ctx context.Context, in *LispAdjacenciesGet) (*LispAdjacenciesGetReply, error) { @@ -131,7 +131,7 @@ func (c *serviceClient) LispAdjacenciesGet(ctx context.Context, in *LispAdjacenc if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LispEidTableAddDelMap(ctx context.Context, in *LispEidTableAddDelMap) (*LispEidTableAddDelMapReply, error) { @@ -140,7 +140,7 @@ func (c *serviceClient) LispEidTableAddDelMap(ctx context.Context, in *LispEidTa if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LispEidTableDump(ctx context.Context, in *LispEidTableDump) (RPCService_LispEidTableDumpClient, error) { @@ -266,7 +266,7 @@ func (c *serviceClient) LispEnableDisable(ctx context.Context, in *LispEnableDis if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LispGetMapRequestItrRlocs(ctx context.Context, in *LispGetMapRequestItrRlocs) (*LispGetMapRequestItrRlocsReply, error) { @@ -275,7 +275,7 @@ func (c *serviceClient) LispGetMapRequestItrRlocs(ctx context.Context, in *LispG if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LispLocatorDump(ctx context.Context, in *LispLocatorDump) (RPCService_LispLocatorDumpClient, error) { @@ -362,7 +362,7 @@ func (c *serviceClient) LispMapRegisterEnableDisable(ctx context.Context, in *Li if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LispMapRequestMode(ctx context.Context, in *LispMapRequestMode) (*LispMapRequestModeReply, error) { @@ -371,7 +371,7 @@ func (c *serviceClient) LispMapRequestMode(ctx context.Context, in *LispMapReque if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LispMapResolverDump(ctx context.Context, in *LispMapResolverDump) (RPCService_LispMapResolverDumpClient, error) { @@ -458,7 +458,7 @@ func (c *serviceClient) LispPitrSetLocatorSet(ctx context.Context, in *LispPitrS if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LispRlocProbeEnableDisable(ctx context.Context, in *LispRlocProbeEnableDisable) (*LispRlocProbeEnableDisableReply, error) { @@ -467,7 +467,7 @@ func (c *serviceClient) LispRlocProbeEnableDisable(ctx context.Context, in *Lisp if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LispUsePetr(ctx context.Context, in *LispUsePetr) (*LispUsePetrReply, error) { @@ -476,7 +476,7 @@ func (c *serviceClient) LispUsePetr(ctx context.Context, in *LispUsePetr) (*Lisp if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ShowLispMapRegisterState(ctx context.Context, in *ShowLispMapRegisterState) (*ShowLispMapRegisterStateReply, error) { @@ -485,7 +485,7 @@ func (c *serviceClient) ShowLispMapRegisterState(ctx context.Context, in *ShowLi if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ShowLispMapRequestMode(ctx context.Context, in *ShowLispMapRequestMode) (*ShowLispMapRequestModeReply, error) { @@ -494,7 +494,7 @@ func (c *serviceClient) ShowLispMapRequestMode(ctx context.Context, in *ShowLisp if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ShowLispPitr(ctx context.Context, in *ShowLispPitr) (*ShowLispPitrReply, error) { @@ -503,7 +503,7 @@ func (c *serviceClient) ShowLispPitr(ctx context.Context, in *ShowLispPitr) (*Sh if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ShowLispRlocProbeState(ctx context.Context, in *ShowLispRlocProbeState) (*ShowLispRlocProbeStateReply, error) { @@ -512,7 +512,7 @@ func (c *serviceClient) ShowLispRlocProbeState(ctx context.Context, in *ShowLisp if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ShowLispStatus(ctx context.Context, in *ShowLispStatus) (*ShowLispStatusReply, error) { @@ -521,7 +521,7 @@ func (c *serviceClient) ShowLispStatus(ctx context.Context, in *ShowLispStatus) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ShowLispUsePetr(ctx context.Context, in *ShowLispUsePetr) (*ShowLispUsePetrReply, error) { @@ -530,5 +530,5 @@ func (c *serviceClient) ShowLispUsePetr(ctx context.Context, in *ShowLispUsePetr if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/lisp_gpe/lisp_gpe.ba.go b/binapi/lisp_gpe/lisp_gpe.ba.go index 5106c84..91cb715 100644 --- a/binapi/lisp_gpe/lisp_gpe.ba.go +++ b/binapi/lisp_gpe/lisp_gpe.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/core/lisp_gpe.api.json // Package lisp_gpe contains generated bindings for API file lisp_gpe.api. diff --git a/binapi/lisp_gpe/lisp_gpe_rest.ba.go b/binapi/lisp_gpe/lisp_gpe_rest.ba.go deleted file mode 100644 index 498b211..0000000 --- a/binapi/lisp_gpe/lisp_gpe_rest.ba.go +++ /dev/null @@ -1,203 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package lisp_gpe - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/gpe_add_del_fwd_entry", func(w http.ResponseWriter, req *http.Request) { - var request = new(GpeAddDelFwdEntry) - 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.GpeAddDelFwdEntry(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("/gpe_add_del_iface", func(w http.ResponseWriter, req *http.Request) { - var request = new(GpeAddDelIface) - 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.GpeAddDelIface(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("/gpe_add_del_native_fwd_rpath", func(w http.ResponseWriter, req *http.Request) { - var request = new(GpeAddDelNativeFwdRpath) - 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.GpeAddDelNativeFwdRpath(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("/gpe_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(GpeEnableDisable) - 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.GpeEnableDisable(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("/gpe_fwd_entries_get", func(w http.ResponseWriter, req *http.Request) { - var request = new(GpeFwdEntriesGet) - 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.GpeFwdEntriesGet(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("/gpe_fwd_entry_vnis_get", func(w http.ResponseWriter, req *http.Request) { - var request = new(GpeFwdEntryVnisGet) - reply, err := rpc.GpeFwdEntryVnisGet(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("/gpe_get_encap_mode", func(w http.ResponseWriter, req *http.Request) { - var request = new(GpeGetEncapMode) - reply, err := rpc.GpeGetEncapMode(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("/gpe_native_fwd_rpaths_get", func(w http.ResponseWriter, req *http.Request) { - var request = new(GpeNativeFwdRpathsGet) - 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.GpeNativeFwdRpathsGet(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("/gpe_set_encap_mode", func(w http.ResponseWriter, req *http.Request) { - var request = new(GpeSetEncapMode) - 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.GpeSetEncapMode(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/lisp_gpe/lisp_gpe_rpc.ba.go b/binapi/lisp_gpe/lisp_gpe_rpc.ba.go index 5f33358..872c8cd 100644 --- a/binapi/lisp_gpe/lisp_gpe_rpc.ba.go +++ b/binapi/lisp_gpe/lisp_gpe_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service lisp_gpe. +// RPCService defines RPC service lisp_gpe. type RPCService interface { GpeAddDelFwdEntry(ctx context.Context, in *GpeAddDelFwdEntry) (*GpeAddDelFwdEntryReply, error) GpeAddDelIface(ctx context.Context, in *GpeAddDelIface) (*GpeAddDelIfaceReply, error) @@ -39,7 +39,7 @@ func (c *serviceClient) GpeAddDelFwdEntry(ctx context.Context, in *GpeAddDelFwdE if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GpeAddDelIface(ctx context.Context, in *GpeAddDelIface) (*GpeAddDelIfaceReply, error) { @@ -48,7 +48,7 @@ func (c *serviceClient) GpeAddDelIface(ctx context.Context, in *GpeAddDelIface) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GpeAddDelNativeFwdRpath(ctx context.Context, in *GpeAddDelNativeFwdRpath) (*GpeAddDelNativeFwdRpathReply, error) { @@ -57,7 +57,7 @@ func (c *serviceClient) GpeAddDelNativeFwdRpath(ctx context.Context, in *GpeAddD if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GpeEnableDisable(ctx context.Context, in *GpeEnableDisable) (*GpeEnableDisableReply, error) { @@ -66,7 +66,7 @@ func (c *serviceClient) GpeEnableDisable(ctx context.Context, in *GpeEnableDisab if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GpeFwdEntriesGet(ctx context.Context, in *GpeFwdEntriesGet) (*GpeFwdEntriesGetReply, error) { @@ -75,7 +75,7 @@ func (c *serviceClient) GpeFwdEntriesGet(ctx context.Context, in *GpeFwdEntriesG if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GpeFwdEntryPathDump(ctx context.Context, in *GpeFwdEntryPathDump) (RPCService_GpeFwdEntryPathDumpClient, error) { @@ -123,7 +123,7 @@ func (c *serviceClient) GpeFwdEntryVnisGet(ctx context.Context, in *GpeFwdEntryV if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GpeGetEncapMode(ctx context.Context, in *GpeGetEncapMode) (*GpeGetEncapModeReply, error) { @@ -132,7 +132,7 @@ func (c *serviceClient) GpeGetEncapMode(ctx context.Context, in *GpeGetEncapMode if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GpeNativeFwdRpathsGet(ctx context.Context, in *GpeNativeFwdRpathsGet) (*GpeNativeFwdRpathsGetReply, error) { @@ -141,7 +141,7 @@ func (c *serviceClient) GpeNativeFwdRpathsGet(ctx context.Context, in *GpeNative if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GpeSetEncapMode(ctx context.Context, in *GpeSetEncapMode) (*GpeSetEncapModeReply, error) { @@ -150,5 +150,5 @@ func (c *serviceClient) GpeSetEncapMode(ctx context.Context, in *GpeSetEncapMode if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/lisp_types/lisp_types.ba.go b/binapi/lisp_types/lisp_types.ba.go index a7302f2..1af3a26 100644 --- a/binapi/lisp_types/lisp_types.ba.go +++ b/binapi/lisp_types/lisp_types.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/core/lisp_types.api.json // Package lisp_types contains generated bindings for API file lisp_types.api. diff --git a/binapi/lldp/lldp.ba.go b/binapi/lldp/lldp.ba.go index a8769b5..6ae1ae7 100644 --- a/binapi/lldp/lldp.ba.go +++ b/binapi/lldp/lldp.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/core/lldp.api.json // Package lldp contains generated bindings for API file lldp.api. diff --git a/binapi/lldp/lldp_rest.ba.go b/binapi/lldp/lldp_rest.ba.go deleted file mode 100644 index 807ef94..0000000 --- a/binapi/lldp/lldp_rest.ba.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package lldp - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/lldp_config", func(w http.ResponseWriter, req *http.Request) { - var request = new(LldpConfig) - 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.LldpConfig(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("/sw_interface_set_lldp", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceSetLldp) - 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.SwInterfaceSetLldp(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/lldp/lldp_rpc.ba.go b/binapi/lldp/lldp_rpc.ba.go index 359039f..d9fdbc5 100644 --- a/binapi/lldp/lldp_rpc.ba.go +++ b/binapi/lldp/lldp_rpc.ba.go @@ -8,7 +8,7 @@ import ( api "git.fd.io/govpp.git/api" ) -// RPCService defines RPC service lldp. +// RPCService defines RPC service lldp. type RPCService interface { LldpConfig(ctx context.Context, in *LldpConfig) (*LldpConfigReply, error) SwInterfaceSetLldp(ctx context.Context, in *SwInterfaceSetLldp) (*SwInterfaceSetLldpReply, error) @@ -28,7 +28,7 @@ func (c *serviceClient) LldpConfig(ctx context.Context, in *LldpConfig) (*LldpCo if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceSetLldp(ctx context.Context, in *SwInterfaceSetLldp) (*SwInterfaceSetLldpReply, error) { @@ -37,5 +37,5 @@ func (c *serviceClient) SwInterfaceSetLldp(ctx context.Context, in *SwInterfaceS if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/mactime/mactime.ba.go b/binapi/mactime/mactime.ba.go index deb7472..4c95735 100644 --- a/binapi/mactime/mactime.ba.go +++ b/binapi/mactime/mactime.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/mactime.api.json // Package mactime contains generated bindings for API file mactime.api. diff --git a/binapi/mactime/mactime_rest.ba.go b/binapi/mactime/mactime_rest.ba.go deleted file mode 100644 index 4318dbc..0000000 --- a/binapi/mactime/mactime_rest.ba.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package mactime - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/mactime_add_del_range", func(w http.ResponseWriter, req *http.Request) { - var request = new(MactimeAddDelRange) - 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.MactimeAddDelRange(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("/mactime_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(MactimeEnableDisable) - 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.MactimeEnableDisable(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/mactime/mactime_rpc.ba.go b/binapi/mactime/mactime_rpc.ba.go index 0273feb..ddde52b 100644 --- a/binapi/mactime/mactime_rpc.ba.go +++ b/binapi/mactime/mactime_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service mactime. +// RPCService defines RPC service mactime. type RPCService interface { MactimeAddDelRange(ctx context.Context, in *MactimeAddDelRange) (*MactimeAddDelRangeReply, error) MactimeDump(ctx context.Context, in *MactimeDump) (RPCService_MactimeDumpClient, error) @@ -32,7 +32,7 @@ func (c *serviceClient) MactimeAddDelRange(ctx context.Context, in *MactimeAddDe if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MactimeDump(ctx context.Context, in *MactimeDump) (RPCService_MactimeDumpClient, error) { @@ -80,5 +80,5 @@ func (c *serviceClient) MactimeEnableDisable(ctx context.Context, in *MactimeEna if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/map/map.ba.go b/binapi/map/map.ba.go index b906284..aeb8cf7 100644 --- a/binapi/map/map.ba.go +++ b/binapi/map/map.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/map.api.json // Package maps contains generated bindings for API file map.api. diff --git a/binapi/map/map_rest.ba.go b/binapi/map/map_rest.ba.go deleted file mode 100644 index 922acb5..0000000 --- a/binapi/map/map_rest.ba.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package maps - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/map_add_del_rule", func(w http.ResponseWriter, req *http.Request) { - var request = new(MapAddDelRule) - 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.MapAddDelRule(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("/map_add_domain", func(w http.ResponseWriter, req *http.Request) { - var request = new(MapAddDomain) - 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.MapAddDomain(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("/map_del_domain", func(w http.ResponseWriter, req *http.Request) { - var request = new(MapDelDomain) - 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.MapDelDomain(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("/map_if_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(MapIfEnableDisable) - 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.MapIfEnableDisable(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("/map_param_add_del_pre_resolve", func(w http.ResponseWriter, req *http.Request) { - var request = new(MapParamAddDelPreResolve) - 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.MapParamAddDelPreResolve(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("/map_param_get", func(w http.ResponseWriter, req *http.Request) { - var request = new(MapParamGet) - reply, err := rpc.MapParamGet(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("/map_param_set_fragmentation", func(w http.ResponseWriter, req *http.Request) { - var request = new(MapParamSetFragmentation) - 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.MapParamSetFragmentation(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("/map_param_set_icmp", func(w http.ResponseWriter, req *http.Request) { - var request = new(MapParamSetICMP) - 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.MapParamSetICMP(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("/map_param_set_icmp6", func(w http.ResponseWriter, req *http.Request) { - var request = new(MapParamSetICMP6) - 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.MapParamSetICMP6(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("/map_param_set_security_check", func(w http.ResponseWriter, req *http.Request) { - var request = new(MapParamSetSecurityCheck) - 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.MapParamSetSecurityCheck(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("/map_param_set_tcp", func(w http.ResponseWriter, req *http.Request) { - var request = new(MapParamSetTCP) - 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.MapParamSetTCP(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("/map_param_set_traffic_class", func(w http.ResponseWriter, req *http.Request) { - var request = new(MapParamSetTrafficClass) - 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.MapParamSetTrafficClass(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("/map_summary_stats", func(w http.ResponseWriter, req *http.Request) { - var request = new(MapSummaryStats) - reply, err := rpc.MapSummaryStats(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/map/map_rpc.ba.go b/binapi/map/map_rpc.ba.go index f45dbe5..8c20779 100644 --- a/binapi/map/map_rpc.ba.go +++ b/binapi/map/map_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service map. +// RPCService defines RPC service map. type RPCService interface { MapAddDelRule(ctx context.Context, in *MapAddDelRule) (*MapAddDelRuleReply, error) MapAddDomain(ctx context.Context, in *MapAddDomain) (*MapAddDomainReply, error) @@ -44,7 +44,7 @@ func (c *serviceClient) MapAddDelRule(ctx context.Context, in *MapAddDelRule) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MapAddDomain(ctx context.Context, in *MapAddDomain) (*MapAddDomainReply, error) { @@ -53,7 +53,7 @@ func (c *serviceClient) MapAddDomain(ctx context.Context, in *MapAddDomain) (*Ma if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MapDelDomain(ctx context.Context, in *MapDelDomain) (*MapDelDomainReply, error) { @@ -62,7 +62,7 @@ func (c *serviceClient) MapDelDomain(ctx context.Context, in *MapDelDomain) (*Ma if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MapDomainDump(ctx context.Context, in *MapDomainDump) (RPCService_MapDomainDumpClient, error) { @@ -110,7 +110,7 @@ func (c *serviceClient) MapIfEnableDisable(ctx context.Context, in *MapIfEnableD if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MapParamAddDelPreResolve(ctx context.Context, in *MapParamAddDelPreResolve) (*MapParamAddDelPreResolveReply, error) { @@ -119,7 +119,7 @@ func (c *serviceClient) MapParamAddDelPreResolve(ctx context.Context, in *MapPar if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MapParamGet(ctx context.Context, in *MapParamGet) (*MapParamGetReply, error) { @@ -128,7 +128,7 @@ func (c *serviceClient) MapParamGet(ctx context.Context, in *MapParamGet) (*MapP if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MapParamSetFragmentation(ctx context.Context, in *MapParamSetFragmentation) (*MapParamSetFragmentationReply, error) { @@ -137,7 +137,7 @@ func (c *serviceClient) MapParamSetFragmentation(ctx context.Context, in *MapPar if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MapParamSetICMP(ctx context.Context, in *MapParamSetICMP) (*MapParamSetICMPReply, error) { @@ -146,7 +146,7 @@ func (c *serviceClient) MapParamSetICMP(ctx context.Context, in *MapParamSetICMP if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MapParamSetICMP6(ctx context.Context, in *MapParamSetICMP6) (*MapParamSetICMP6Reply, error) { @@ -155,7 +155,7 @@ func (c *serviceClient) MapParamSetICMP6(ctx context.Context, in *MapParamSetICM if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MapParamSetSecurityCheck(ctx context.Context, in *MapParamSetSecurityCheck) (*MapParamSetSecurityCheckReply, error) { @@ -164,7 +164,7 @@ func (c *serviceClient) MapParamSetSecurityCheck(ctx context.Context, in *MapPar if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MapParamSetTCP(ctx context.Context, in *MapParamSetTCP) (*MapParamSetTCPReply, error) { @@ -173,7 +173,7 @@ func (c *serviceClient) MapParamSetTCP(ctx context.Context, in *MapParamSetTCP) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MapParamSetTrafficClass(ctx context.Context, in *MapParamSetTrafficClass) (*MapParamSetTrafficClassReply, error) { @@ -182,7 +182,7 @@ func (c *serviceClient) MapParamSetTrafficClass(ctx context.Context, in *MapPara if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MapRuleDump(ctx context.Context, in *MapRuleDump) (RPCService_MapRuleDumpClient, error) { @@ -230,5 +230,5 @@ func (c *serviceClient) MapSummaryStats(ctx context.Context, in *MapSummaryStats if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/mdata/mdata.ba.go b/binapi/mdata/mdata.ba.go index d4715f7..a218692 100644 --- a/binapi/mdata/mdata.ba.go +++ b/binapi/mdata/mdata.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/mdata.api.json // Package mdata contains generated bindings for API file mdata.api. diff --git a/binapi/mdata/mdata_rest.ba.go b/binapi/mdata/mdata_rest.ba.go deleted file mode 100644 index 12b22e7..0000000 --- a/binapi/mdata/mdata_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package mdata - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/mdata_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(MdataEnableDisable) - 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.MdataEnableDisable(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/mdata/mdata_rpc.ba.go b/binapi/mdata/mdata_rpc.ba.go index 28b2589..8ae8748 100644 --- a/binapi/mdata/mdata_rpc.ba.go +++ b/binapi/mdata/mdata_rpc.ba.go @@ -8,7 +8,7 @@ import ( api "git.fd.io/govpp.git/api" ) -// RPCService defines RPC service mdata. +// RPCService defines RPC service mdata. type RPCService interface { MdataEnableDisable(ctx context.Context, in *MdataEnableDisable) (*MdataEnableDisableReply, error) } @@ -27,5 +27,5 @@ func (c *serviceClient) MdataEnableDisable(ctx context.Context, in *MdataEnableD if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/memclnt/memclnt.ba.go b/binapi/memclnt/memclnt.ba.go index 3bbf88d..0dac33f 100644 --- a/binapi/memclnt/memclnt.ba.go +++ b/binapi/memclnt/memclnt.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/core/memclnt.api.json // Package memclnt contains generated bindings for API file memclnt.api. diff --git a/binapi/memclnt/memclnt_rest.ba.go b/binapi/memclnt/memclnt_rest.ba.go deleted file mode 100644 index bb409da..0000000 --- a/binapi/memclnt/memclnt_rest.ba.go +++ /dev/null @@ -1,203 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package memclnt - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/api_versions", func(w http.ResponseWriter, req *http.Request) { - var request = new(APIVersions) - reply, err := rpc.APIVersions(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("/get_first_msg_id", func(w http.ResponseWriter, req *http.Request) { - var request = new(GetFirstMsgID) - 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.GetFirstMsgID(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("/memclnt_create", func(w http.ResponseWriter, req *http.Request) { - var request = new(MemclntCreate) - 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.MemclntCreate(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("/memclnt_delete", func(w http.ResponseWriter, req *http.Request) { - var request = new(MemclntDelete) - 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.MemclntDelete(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("/memclnt_keepalive", func(w http.ResponseWriter, req *http.Request) { - var request = new(MemclntKeepalive) - reply, err := rpc.MemclntKeepalive(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("/rpc_call", func(w http.ResponseWriter, req *http.Request) { - var request = new(RPCCall) - 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.RPCCall(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("/sock_init_shm", func(w http.ResponseWriter, req *http.Request) { - var request = new(SockInitShm) - 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.SockInitShm(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("/sockclnt_create", func(w http.ResponseWriter, req *http.Request) { - var request = new(SockclntCreate) - 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.SockclntCreate(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("/sockclnt_delete", func(w http.ResponseWriter, req *http.Request) { - var request = new(SockclntDelete) - 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.SockclntDelete(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/memclnt/memclnt_rpc.ba.go b/binapi/memclnt/memclnt_rpc.ba.go index ae75a36..ef4a1a4 100644 --- a/binapi/memclnt/memclnt_rpc.ba.go +++ b/binapi/memclnt/memclnt_rpc.ba.go @@ -8,7 +8,7 @@ import ( api "git.fd.io/govpp.git/api" ) -// RPCService defines RPC service memclnt. +// RPCService defines RPC service memclnt. type RPCService interface { APIVersions(ctx context.Context, in *APIVersions) (*APIVersionsReply, error) GetFirstMsgID(ctx context.Context, in *GetFirstMsgID) (*GetFirstMsgIDReply, error) @@ -39,7 +39,7 @@ func (c *serviceClient) APIVersions(ctx context.Context, in *APIVersions) (*APIV if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GetFirstMsgID(ctx context.Context, in *GetFirstMsgID) (*GetFirstMsgIDReply, error) { @@ -48,7 +48,7 @@ func (c *serviceClient) GetFirstMsgID(ctx context.Context, in *GetFirstMsgID) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MemclntCreate(ctx context.Context, in *MemclntCreate) (*MemclntCreateReply, error) { @@ -75,7 +75,7 @@ func (c *serviceClient) MemclntKeepalive(ctx context.Context, in *MemclntKeepali if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MemclntReadTimeout(ctx context.Context, in *MemclntReadTimeout) error { @@ -108,7 +108,7 @@ func (c *serviceClient) RPCCall(ctx context.Context, in *RPCCall) (*RPCCallReply if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) RxThreadExit(ctx context.Context, in *RxThreadExit) error { @@ -129,7 +129,7 @@ func (c *serviceClient) SockInitShm(ctx context.Context, in *SockInitShm) (*Sock if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SockclntCreate(ctx context.Context, in *SockclntCreate) (*SockclntCreateReply, error) { diff --git a/binapi/memif/memif.ba.go b/binapi/memif/memif.ba.go index fddd0ab..8a7140b 100644 --- a/binapi/memif/memif.ba.go +++ b/binapi/memif/memif.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/memif.api.json // Package memif contains generated bindings for API file memif.api. diff --git a/binapi/memif/memif_rest.ba.go b/binapi/memif/memif_rest.ba.go deleted file mode 100644 index 726824f..0000000 --- a/binapi/memif/memif_rest.ba.go +++ /dev/null @@ -1,83 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package memif - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/memif_create", func(w http.ResponseWriter, req *http.Request) { - var request = new(MemifCreate) - 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.MemifCreate(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("/memif_delete", func(w http.ResponseWriter, req *http.Request) { - var request = new(MemifDelete) - 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.MemifDelete(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("/memif_socket_filename_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(MemifSocketFilenameAddDel) - 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.MemifSocketFilenameAddDel(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/memif/memif_rpc.ba.go b/binapi/memif/memif_rpc.ba.go index b11f07f..bc1c0e4 100644 --- a/binapi/memif/memif_rpc.ba.go +++ b/binapi/memif/memif_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service memif. +// RPCService defines RPC service memif. type RPCService interface { MemifCreate(ctx context.Context, in *MemifCreate) (*MemifCreateReply, error) MemifDelete(ctx context.Context, in *MemifDelete) (*MemifDeleteReply, error) @@ -34,7 +34,7 @@ func (c *serviceClient) MemifCreate(ctx context.Context, in *MemifCreate) (*Memi if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MemifDelete(ctx context.Context, in *MemifDelete) (*MemifDeleteReply, error) { @@ -43,7 +43,7 @@ func (c *serviceClient) MemifDelete(ctx context.Context, in *MemifDelete) (*Memi if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MemifDump(ctx context.Context, in *MemifDump) (RPCService_MemifDumpClient, error) { @@ -91,7 +91,7 @@ func (c *serviceClient) MemifSocketFilenameAddDel(ctx context.Context, in *Memif if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MemifSocketFilenameDump(ctx context.Context, in *MemifSocketFilenameDump) (RPCService_MemifSocketFilenameDumpClient, error) { diff --git a/binapi/mfib_types/mfib_types.ba.go b/binapi/mfib_types/mfib_types.ba.go index 1d6ddef..41c2434 100644 --- a/binapi/mfib_types/mfib_types.ba.go +++ b/binapi/mfib_types/mfib_types.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/core/mfib_types.api.json // Package mfib_types contains generated bindings for API file mfib_types.api. diff --git a/binapi/mpls/mpls.ba.go b/binapi/mpls/mpls.ba.go index 9443728..799ae69 100644 --- a/binapi/mpls/mpls.ba.go +++ b/binapi/mpls/mpls.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/core/mpls.api.json // Package mpls contains generated bindings for API file mpls.api. diff --git a/binapi/mpls/mpls_rest.ba.go b/binapi/mpls/mpls_rest.ba.go deleted file mode 100644 index 9cac11b..0000000 --- a/binapi/mpls/mpls_rest.ba.go +++ /dev/null @@ -1,129 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package mpls - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/mpls_ip_bind_unbind", func(w http.ResponseWriter, req *http.Request) { - var request = new(MplsIPBindUnbind) - 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.MplsIPBindUnbind(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("/mpls_route_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(MplsRouteAddDel) - 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.MplsRouteAddDel(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("/mpls_table_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(MplsTableAddDel) - 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.MplsTableAddDel(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("/mpls_tunnel_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(MplsTunnelAddDel) - 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.MplsTunnelAddDel(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("/sw_interface_set_mpls_enable", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceSetMplsEnable) - 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.SwInterfaceSetMplsEnable(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/mpls/mpls_rpc.ba.go b/binapi/mpls/mpls_rpc.ba.go index 258af4a..bfd6559 100644 --- a/binapi/mpls/mpls_rpc.ba.go +++ b/binapi/mpls/mpls_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service mpls. +// RPCService defines RPC service mpls. type RPCService interface { MplsIPBindUnbind(ctx context.Context, in *MplsIPBindUnbind) (*MplsIPBindUnbindReply, error) MplsRouteAddDel(ctx context.Context, in *MplsRouteAddDel) (*MplsRouteAddDelReply, error) @@ -37,7 +37,7 @@ func (c *serviceClient) MplsIPBindUnbind(ctx context.Context, in *MplsIPBindUnbi if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MplsRouteAddDel(ctx context.Context, in *MplsRouteAddDel) (*MplsRouteAddDelReply, error) { @@ -46,7 +46,7 @@ func (c *serviceClient) MplsRouteAddDel(ctx context.Context, in *MplsRouteAddDel if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MplsRouteDump(ctx context.Context, in *MplsRouteDump) (RPCService_MplsRouteDumpClient, error) { @@ -94,7 +94,7 @@ func (c *serviceClient) MplsTableAddDel(ctx context.Context, in *MplsTableAddDel if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MplsTableDump(ctx context.Context, in *MplsTableDump) (RPCService_MplsTableDumpClient, error) { @@ -142,7 +142,7 @@ func (c *serviceClient) MplsTunnelAddDel(ctx context.Context, in *MplsTunnelAddD if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) MplsTunnelDump(ctx context.Context, in *MplsTunnelDump) (RPCService_MplsTunnelDumpClient, error) { @@ -190,5 +190,5 @@ func (c *serviceClient) SwInterfaceSetMplsEnable(ctx context.Context, in *SwInte if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/nat/nat.ba.go b/binapi/nat/nat.ba.go index c21307f..ac65413 100644 --- a/binapi/nat/nat.ba.go +++ b/binapi/nat/nat.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/nat.api.json // Package nat contains generated bindings for API file nat.api. diff --git a/binapi/nat/nat_rest.ba.go b/binapi/nat/nat_rest.ba.go deleted file mode 100644 index 7740ea1..0000000 --- a/binapi/nat/nat_rest.ba.go +++ /dev/null @@ -1,913 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package nat - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/nat44_add_del_address_range", func(w http.ResponseWriter, req *http.Request) { - var request = new(Nat44AddDelAddressRange) - 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.Nat44AddDelAddressRange(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("/nat44_add_del_identity_mapping", func(w http.ResponseWriter, req *http.Request) { - var request = new(Nat44AddDelIdentityMapping) - 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.Nat44AddDelIdentityMapping(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("/nat44_add_del_interface_addr", func(w http.ResponseWriter, req *http.Request) { - var request = new(Nat44AddDelInterfaceAddr) - 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.Nat44AddDelInterfaceAddr(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("/nat44_add_del_lb_static_mapping", func(w http.ResponseWriter, req *http.Request) { - var request = new(Nat44AddDelLbStaticMapping) - 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.Nat44AddDelLbStaticMapping(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("/nat44_add_del_static_mapping", func(w http.ResponseWriter, req *http.Request) { - var request = new(Nat44AddDelStaticMapping) - 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.Nat44AddDelStaticMapping(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("/nat44_del_session", func(w http.ResponseWriter, req *http.Request) { - var request = new(Nat44DelSession) - 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.Nat44DelSession(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("/nat44_del_user", func(w http.ResponseWriter, req *http.Request) { - var request = new(Nat44DelUser) - 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.Nat44DelUser(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("/nat44_forwarding_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(Nat44ForwardingEnableDisable) - 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.Nat44ForwardingEnableDisable(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("/nat44_forwarding_is_enabled", func(w http.ResponseWriter, req *http.Request) { - var request = new(Nat44ForwardingIsEnabled) - reply, err := rpc.Nat44ForwardingIsEnabled(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("/nat44_interface_add_del_feature", func(w http.ResponseWriter, req *http.Request) { - var request = new(Nat44InterfaceAddDelFeature) - 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.Nat44InterfaceAddDelFeature(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("/nat44_interface_add_del_output_feature", func(w http.ResponseWriter, req *http.Request) { - var request = new(Nat44InterfaceAddDelOutputFeature) - 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.Nat44InterfaceAddDelOutputFeature(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("/nat44_lb_static_mapping_add_del_local", func(w http.ResponseWriter, req *http.Request) { - var request = new(Nat44LbStaticMappingAddDelLocal) - 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.Nat44LbStaticMappingAddDelLocal(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("/nat44_session_cleanup", func(w http.ResponseWriter, req *http.Request) { - var request = new(Nat44SessionCleanup) - reply, err := rpc.Nat44SessionCleanup(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("/nat44_set_session_limit", func(w http.ResponseWriter, req *http.Request) { - var request = new(Nat44SetSessionLimit) - 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.Nat44SetSessionLimit(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("/nat64_add_del_interface", func(w http.ResponseWriter, req *http.Request) { - var request = new(Nat64AddDelInterface) - 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.Nat64AddDelInterface(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("/nat64_add_del_interface_addr", func(w http.ResponseWriter, req *http.Request) { - var request = new(Nat64AddDelInterfaceAddr) - 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.Nat64AddDelInterfaceAddr(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("/nat64_add_del_pool_addr_range", func(w http.ResponseWriter, req *http.Request) { - var request = new(Nat64AddDelPoolAddrRange) - 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.Nat64AddDelPoolAddrRange(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("/nat64_add_del_prefix", func(w http.ResponseWriter, req *http.Request) { - var request = new(Nat64AddDelPrefix) - 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.Nat64AddDelPrefix(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("/nat64_add_del_static_bib", func(w http.ResponseWriter, req *http.Request) { - var request = new(Nat64AddDelStaticBib) - 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.Nat64AddDelStaticBib(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("/nat66_add_del_interface", func(w http.ResponseWriter, req *http.Request) { - var request = new(Nat66AddDelInterface) - 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.Nat66AddDelInterface(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("/nat66_add_del_static_mapping", func(w http.ResponseWriter, req *http.Request) { - var request = new(Nat66AddDelStaticMapping) - 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.Nat66AddDelStaticMapping(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("/nat_control_ping", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatControlPing) - reply, err := rpc.NatControlPing(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("/nat_det_add_del_map", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatDetAddDelMap) - 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.NatDetAddDelMap(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("/nat_det_close_session_in", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatDetCloseSessionIn) - 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.NatDetCloseSessionIn(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("/nat_det_close_session_out", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatDetCloseSessionOut) - 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.NatDetCloseSessionOut(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("/nat_det_forward", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatDetForward) - 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.NatDetForward(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("/nat_det_reverse", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatDetReverse) - 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.NatDetReverse(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("/nat_get_addr_and_port_alloc_alg", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatGetAddrAndPortAllocAlg) - reply, err := rpc.NatGetAddrAndPortAllocAlg(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("/nat_get_mss_clamping", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatGetMssClamping) - reply, err := rpc.NatGetMssClamping(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("/nat_get_timeouts", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatGetTimeouts) - reply, err := rpc.NatGetTimeouts(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("/nat_ha_flush", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatHaFlush) - reply, err := rpc.NatHaFlush(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("/nat_ha_get_failover", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatHaGetFailover) - reply, err := rpc.NatHaGetFailover(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("/nat_ha_get_listener", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatHaGetListener) - reply, err := rpc.NatHaGetListener(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("/nat_ha_resync", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatHaResync) - 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.NatHaResync(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("/nat_ha_set_failover", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatHaSetFailover) - 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.NatHaSetFailover(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("/nat_ha_set_listener", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatHaSetListener) - 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.NatHaSetListener(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("/nat_ipfix_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatIpfixEnableDisable) - 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.NatIpfixEnableDisable(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("/nat_set_addr_and_port_alloc_alg", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatSetAddrAndPortAllocAlg) - 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.NatSetAddrAndPortAllocAlg(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("/nat_set_log_level", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatSetLogLevel) - 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.NatSetLogLevel(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("/nat_set_mss_clamping", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatSetMssClamping) - 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.NatSetMssClamping(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("/nat_set_timeouts", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatSetTimeouts) - 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.NatSetTimeouts(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("/nat_set_workers", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatSetWorkers) - 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.NatSetWorkers(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("/nat_show_config", func(w http.ResponseWriter, req *http.Request) { - var request = new(NatShowConfig) - reply, err := rpc.NatShowConfig(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/nat/nat_rpc.ba.go b/binapi/nat/nat_rpc.ba.go index bd07910..9da5e09 100644 --- a/binapi/nat/nat_rpc.ba.go +++ b/binapi/nat/nat_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service nat. +// RPCService defines RPC service nat. type RPCService interface { Nat44AddDelAddressRange(ctx context.Context, in *Nat44AddDelAddressRange) (*Nat44AddDelAddressRangeReply, error) Nat44AddDelIdentityMapping(ctx context.Context, in *Nat44AddDelIdentityMapping) (*Nat44AddDelIdentityMappingReply, error) @@ -91,7 +91,7 @@ func (c *serviceClient) Nat44AddDelAddressRange(ctx context.Context, in *Nat44Ad if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Nat44AddDelIdentityMapping(ctx context.Context, in *Nat44AddDelIdentityMapping) (*Nat44AddDelIdentityMappingReply, error) { @@ -100,7 +100,7 @@ func (c *serviceClient) Nat44AddDelIdentityMapping(ctx context.Context, in *Nat4 if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Nat44AddDelInterfaceAddr(ctx context.Context, in *Nat44AddDelInterfaceAddr) (*Nat44AddDelInterfaceAddrReply, error) { @@ -109,7 +109,7 @@ func (c *serviceClient) Nat44AddDelInterfaceAddr(ctx context.Context, in *Nat44A if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Nat44AddDelLbStaticMapping(ctx context.Context, in *Nat44AddDelLbStaticMapping) (*Nat44AddDelLbStaticMappingReply, error) { @@ -118,7 +118,7 @@ func (c *serviceClient) Nat44AddDelLbStaticMapping(ctx context.Context, in *Nat4 if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Nat44AddDelStaticMapping(ctx context.Context, in *Nat44AddDelStaticMapping) (*Nat44AddDelStaticMappingReply, error) { @@ -127,7 +127,7 @@ func (c *serviceClient) Nat44AddDelStaticMapping(ctx context.Context, in *Nat44A if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Nat44AddressDump(ctx context.Context, in *Nat44AddressDump) (RPCService_Nat44AddressDumpClient, error) { @@ -175,7 +175,7 @@ func (c *serviceClient) Nat44DelSession(ctx context.Context, in *Nat44DelSession if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Nat44DelUser(ctx context.Context, in *Nat44DelUser) (*Nat44DelUserReply, error) { @@ -184,7 +184,7 @@ func (c *serviceClient) Nat44DelUser(ctx context.Context, in *Nat44DelUser) (*Na if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Nat44ForwardingEnableDisable(ctx context.Context, in *Nat44ForwardingEnableDisable) (*Nat44ForwardingEnableDisableReply, error) { @@ -193,7 +193,7 @@ func (c *serviceClient) Nat44ForwardingEnableDisable(ctx context.Context, in *Na if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Nat44ForwardingIsEnabled(ctx context.Context, in *Nat44ForwardingIsEnabled) (*Nat44ForwardingIsEnabledReply, error) { @@ -250,7 +250,7 @@ func (c *serviceClient) Nat44InterfaceAddDelFeature(ctx context.Context, in *Nat if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Nat44InterfaceAddDelOutputFeature(ctx context.Context, in *Nat44InterfaceAddDelOutputFeature) (*Nat44InterfaceAddDelOutputFeatureReply, error) { @@ -259,7 +259,7 @@ func (c *serviceClient) Nat44InterfaceAddDelOutputFeature(ctx context.Context, i if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Nat44InterfaceAddrDump(ctx context.Context, in *Nat44InterfaceAddrDump) (RPCService_Nat44InterfaceAddrDumpClient, error) { @@ -385,7 +385,7 @@ func (c *serviceClient) Nat44LbStaticMappingAddDelLocal(ctx context.Context, in if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Nat44LbStaticMappingDump(ctx context.Context, in *Nat44LbStaticMappingDump) (RPCService_Nat44LbStaticMappingDumpClient, error) { @@ -433,7 +433,7 @@ func (c *serviceClient) Nat44SessionCleanup(ctx context.Context, in *Nat44Sessio if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Nat44SetSessionLimit(ctx context.Context, in *Nat44SetSessionLimit) (*Nat44SetSessionLimitReply, error) { @@ -442,7 +442,7 @@ func (c *serviceClient) Nat44SetSessionLimit(ctx context.Context, in *Nat44SetSe if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Nat44StaticMappingDump(ctx context.Context, in *Nat44StaticMappingDump) (RPCService_Nat44StaticMappingDumpClient, error) { @@ -568,7 +568,7 @@ func (c *serviceClient) Nat64AddDelInterface(ctx context.Context, in *Nat64AddDe if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Nat64AddDelInterfaceAddr(ctx context.Context, in *Nat64AddDelInterfaceAddr) (*Nat64AddDelInterfaceAddrReply, error) { @@ -577,7 +577,7 @@ func (c *serviceClient) Nat64AddDelInterfaceAddr(ctx context.Context, in *Nat64A if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Nat64AddDelPoolAddrRange(ctx context.Context, in *Nat64AddDelPoolAddrRange) (*Nat64AddDelPoolAddrRangeReply, error) { @@ -586,7 +586,7 @@ func (c *serviceClient) Nat64AddDelPoolAddrRange(ctx context.Context, in *Nat64A if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Nat64AddDelPrefix(ctx context.Context, in *Nat64AddDelPrefix) (*Nat64AddDelPrefixReply, error) { @@ -595,7 +595,7 @@ func (c *serviceClient) Nat64AddDelPrefix(ctx context.Context, in *Nat64AddDelPr if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Nat64AddDelStaticBib(ctx context.Context, in *Nat64AddDelStaticBib) (*Nat64AddDelStaticBibReply, error) { @@ -604,7 +604,7 @@ func (c *serviceClient) Nat64AddDelStaticBib(ctx context.Context, in *Nat64AddDe if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Nat64BibDump(ctx context.Context, in *Nat64BibDump) (RPCService_Nat64BibDumpClient, error) { @@ -808,7 +808,7 @@ func (c *serviceClient) Nat66AddDelInterface(ctx context.Context, in *Nat66AddDe if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Nat66AddDelStaticMapping(ctx context.Context, in *Nat66AddDelStaticMapping) (*Nat66AddDelStaticMappingReply, error) { @@ -817,7 +817,7 @@ func (c *serviceClient) Nat66AddDelStaticMapping(ctx context.Context, in *Nat66A if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Nat66InterfaceDump(ctx context.Context, in *Nat66InterfaceDump) (RPCService_Nat66InterfaceDumpClient, error) { @@ -904,7 +904,7 @@ func (c *serviceClient) NatControlPing(ctx context.Context, in *NatControlPing) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NatDetAddDelMap(ctx context.Context, in *NatDetAddDelMap) (*NatDetAddDelMapReply, error) { @@ -913,7 +913,7 @@ func (c *serviceClient) NatDetAddDelMap(ctx context.Context, in *NatDetAddDelMap if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NatDetCloseSessionIn(ctx context.Context, in *NatDetCloseSessionIn) (*NatDetCloseSessionInReply, error) { @@ -922,7 +922,7 @@ func (c *serviceClient) NatDetCloseSessionIn(ctx context.Context, in *NatDetClos if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NatDetCloseSessionOut(ctx context.Context, in *NatDetCloseSessionOut) (*NatDetCloseSessionOutReply, error) { @@ -931,7 +931,7 @@ func (c *serviceClient) NatDetCloseSessionOut(ctx context.Context, in *NatDetClo if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NatDetForward(ctx context.Context, in *NatDetForward) (*NatDetForwardReply, error) { @@ -940,7 +940,7 @@ func (c *serviceClient) NatDetForward(ctx context.Context, in *NatDetForward) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NatDetMapDump(ctx context.Context, in *NatDetMapDump) (RPCService_NatDetMapDumpClient, error) { @@ -988,7 +988,7 @@ func (c *serviceClient) NatDetReverse(ctx context.Context, in *NatDetReverse) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NatDetSessionDump(ctx context.Context, in *NatDetSessionDump) (RPCService_NatDetSessionDumpClient, error) { @@ -1036,7 +1036,7 @@ func (c *serviceClient) NatGetAddrAndPortAllocAlg(ctx context.Context, in *NatGe if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NatGetMssClamping(ctx context.Context, in *NatGetMssClamping) (*NatGetMssClampingReply, error) { @@ -1045,7 +1045,7 @@ func (c *serviceClient) NatGetMssClamping(ctx context.Context, in *NatGetMssClam if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NatGetTimeouts(ctx context.Context, in *NatGetTimeouts) (*NatGetTimeoutsReply, error) { @@ -1054,7 +1054,7 @@ func (c *serviceClient) NatGetTimeouts(ctx context.Context, in *NatGetTimeouts) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NatHaFlush(ctx context.Context, in *NatHaFlush) (*NatHaFlushReply, error) { @@ -1063,7 +1063,7 @@ func (c *serviceClient) NatHaFlush(ctx context.Context, in *NatHaFlush) (*NatHaF if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NatHaGetFailover(ctx context.Context, in *NatHaGetFailover) (*NatHaGetFailoverReply, error) { @@ -1072,7 +1072,7 @@ func (c *serviceClient) NatHaGetFailover(ctx context.Context, in *NatHaGetFailov if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NatHaGetListener(ctx context.Context, in *NatHaGetListener) (*NatHaGetListenerReply, error) { @@ -1081,7 +1081,7 @@ func (c *serviceClient) NatHaGetListener(ctx context.Context, in *NatHaGetListen if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NatHaResync(ctx context.Context, in *NatHaResync) (*NatHaResyncReply, error) { @@ -1090,7 +1090,7 @@ func (c *serviceClient) NatHaResync(ctx context.Context, in *NatHaResync) (*NatH if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NatHaSetFailover(ctx context.Context, in *NatHaSetFailover) (*NatHaSetFailoverReply, error) { @@ -1099,7 +1099,7 @@ func (c *serviceClient) NatHaSetFailover(ctx context.Context, in *NatHaSetFailov if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NatHaSetListener(ctx context.Context, in *NatHaSetListener) (*NatHaSetListenerReply, error) { @@ -1108,7 +1108,7 @@ func (c *serviceClient) NatHaSetListener(ctx context.Context, in *NatHaSetListen if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NatIpfixEnableDisable(ctx context.Context, in *NatIpfixEnableDisable) (*NatIpfixEnableDisableReply, error) { @@ -1117,7 +1117,7 @@ func (c *serviceClient) NatIpfixEnableDisable(ctx context.Context, in *NatIpfixE if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NatSetAddrAndPortAllocAlg(ctx context.Context, in *NatSetAddrAndPortAllocAlg) (*NatSetAddrAndPortAllocAlgReply, error) { @@ -1126,7 +1126,7 @@ func (c *serviceClient) NatSetAddrAndPortAllocAlg(ctx context.Context, in *NatSe if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NatSetLogLevel(ctx context.Context, in *NatSetLogLevel) (*NatSetLogLevelReply, error) { @@ -1135,7 +1135,7 @@ func (c *serviceClient) NatSetLogLevel(ctx context.Context, in *NatSetLogLevel) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NatSetMssClamping(ctx context.Context, in *NatSetMssClamping) (*NatSetMssClampingReply, error) { @@ -1144,7 +1144,7 @@ func (c *serviceClient) NatSetMssClamping(ctx context.Context, in *NatSetMssClam if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NatSetTimeouts(ctx context.Context, in *NatSetTimeouts) (*NatSetTimeoutsReply, error) { @@ -1153,7 +1153,7 @@ func (c *serviceClient) NatSetTimeouts(ctx context.Context, in *NatSetTimeouts) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NatSetWorkers(ctx context.Context, in *NatSetWorkers) (*NatSetWorkersReply, error) { @@ -1162,7 +1162,7 @@ func (c *serviceClient) NatSetWorkers(ctx context.Context, in *NatSetWorkers) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NatShowConfig(ctx context.Context, in *NatShowConfig) (*NatShowConfigReply, error) { @@ -1171,7 +1171,7 @@ func (c *serviceClient) NatShowConfig(ctx context.Context, in *NatShowConfig) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NatWorkerDump(ctx context.Context, in *NatWorkerDump) (RPCService_NatWorkerDumpClient, error) { diff --git a/binapi/nsh/nsh.ba.go b/binapi/nsh/nsh.ba.go index 5897a90..5113a82 100644 --- a/binapi/nsh/nsh.ba.go +++ b/binapi/nsh/nsh.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/nsh.api.json // Package nsh contains generated bindings for API file nsh.api. diff --git a/binapi/nsh/nsh_rest.ba.go b/binapi/nsh/nsh_rest.ba.go deleted file mode 100644 index 87b29e4..0000000 --- a/binapi/nsh/nsh_rest.ba.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package nsh - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/nsh_add_del_entry", func(w http.ResponseWriter, req *http.Request) { - var request = new(NshAddDelEntry) - 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.NshAddDelEntry(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("/nsh_add_del_map", func(w http.ResponseWriter, req *http.Request) { - var request = new(NshAddDelMap) - 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.NshAddDelMap(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/nsh/nsh_rpc.ba.go b/binapi/nsh/nsh_rpc.ba.go index 320aa9f..db79b4f 100644 --- a/binapi/nsh/nsh_rpc.ba.go +++ b/binapi/nsh/nsh_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service nsh. +// RPCService defines RPC service nsh. type RPCService interface { NshAddDelEntry(ctx context.Context, in *NshAddDelEntry) (*NshAddDelEntryReply, error) NshAddDelMap(ctx context.Context, in *NshAddDelMap) (*NshAddDelMapReply, error) @@ -33,7 +33,7 @@ func (c *serviceClient) NshAddDelEntry(ctx context.Context, in *NshAddDelEntry) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NshAddDelMap(ctx context.Context, in *NshAddDelMap) (*NshAddDelMapReply, error) { @@ -42,7 +42,7 @@ func (c *serviceClient) NshAddDelMap(ctx context.Context, in *NshAddDelMap) (*Ns if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NshEntryDump(ctx context.Context, in *NshEntryDump) (RPCService_NshEntryDumpClient, error) { diff --git a/binapi/nsim/nsim.ba.go b/binapi/nsim/nsim.ba.go index fb540ac..1f23c79 100644 --- a/binapi/nsim/nsim.ba.go +++ b/binapi/nsim/nsim.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/nsim.api.json // Package nsim contains generated bindings for API file nsim.api. diff --git a/binapi/nsim/nsim_rest.ba.go b/binapi/nsim/nsim_rest.ba.go deleted file mode 100644 index ba53f21..0000000 --- a/binapi/nsim/nsim_rest.ba.go +++ /dev/null @@ -1,83 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package nsim - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/nsim_configure", func(w http.ResponseWriter, req *http.Request) { - var request = new(NsimConfigure) - 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.NsimConfigure(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("/nsim_cross_connect_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(NsimCrossConnectEnableDisable) - 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.NsimCrossConnectEnableDisable(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("/nsim_output_feature_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(NsimOutputFeatureEnableDisable) - 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.NsimOutputFeatureEnableDisable(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/nsim/nsim_rpc.ba.go b/binapi/nsim/nsim_rpc.ba.go index 863f945..d46b1ef 100644 --- a/binapi/nsim/nsim_rpc.ba.go +++ b/binapi/nsim/nsim_rpc.ba.go @@ -8,7 +8,7 @@ import ( api "git.fd.io/govpp.git/api" ) -// RPCService defines RPC service nsim. +// RPCService defines RPC service nsim. type RPCService interface { NsimConfigure(ctx context.Context, in *NsimConfigure) (*NsimConfigureReply, error) NsimCrossConnectEnableDisable(ctx context.Context, in *NsimCrossConnectEnableDisable) (*NsimCrossConnectEnableDisableReply, error) @@ -29,7 +29,7 @@ func (c *serviceClient) NsimConfigure(ctx context.Context, in *NsimConfigure) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NsimCrossConnectEnableDisable(ctx context.Context, in *NsimCrossConnectEnableDisable) (*NsimCrossConnectEnableDisableReply, error) { @@ -38,7 +38,7 @@ func (c *serviceClient) NsimCrossConnectEnableDisable(ctx context.Context, in *N if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) NsimOutputFeatureEnableDisable(ctx context.Context, in *NsimOutputFeatureEnableDisable) (*NsimOutputFeatureEnableDisableReply, error) { @@ -47,5 +47,5 @@ func (c *serviceClient) NsimOutputFeatureEnableDisable(ctx context.Context, in * if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/oddbuf/oddbuf.ba.go b/binapi/oddbuf/oddbuf.ba.go index c6f3e21..bfea709 100644 --- a/binapi/oddbuf/oddbuf.ba.go +++ b/binapi/oddbuf/oddbuf.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/oddbuf.api.json // Package oddbuf contains generated bindings for API file oddbuf.api. diff --git a/binapi/oddbuf/oddbuf_rest.ba.go b/binapi/oddbuf/oddbuf_rest.ba.go deleted file mode 100644 index b50418c..0000000 --- a/binapi/oddbuf/oddbuf_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package oddbuf - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/oddbuf_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(OddbufEnableDisable) - 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.OddbufEnableDisable(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/oddbuf/oddbuf_rpc.ba.go b/binapi/oddbuf/oddbuf_rpc.ba.go index 93ccf3b..f7c0164 100644 --- a/binapi/oddbuf/oddbuf_rpc.ba.go +++ b/binapi/oddbuf/oddbuf_rpc.ba.go @@ -8,7 +8,7 @@ import ( api "git.fd.io/govpp.git/api" ) -// RPCService defines RPC service oddbuf. +// RPCService defines RPC service oddbuf. type RPCService interface { OddbufEnableDisable(ctx context.Context, in *OddbufEnableDisable) (*OddbufEnableDisableReply, error) } @@ -27,5 +27,5 @@ func (c *serviceClient) OddbufEnableDisable(ctx context.Context, in *OddbufEnabl if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/one/one.ba.go b/binapi/one/one.ba.go index 01a5597..dc9c6ea 100644 --- a/binapi/one/one.ba.go +++ b/binapi/one/one.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/core/one.api.json // Package one contains generated bindings for API file one.api. diff --git a/binapi/one/one_rest.ba.go b/binapi/one/one_rest.ba.go deleted file mode 100644 index 2c3caca..0000000 --- a/binapi/one/one_rest.ba.go +++ /dev/null @@ -1,910 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package one - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/one_add_del_adjacency", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneAddDelAdjacency) - 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.OneAddDelAdjacency(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("/one_add_del_l2_arp_entry", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneAddDelL2ArpEntry) - 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.OneAddDelL2ArpEntry(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("/one_add_del_local_eid", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneAddDelLocalEid) - 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.OneAddDelLocalEid(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("/one_add_del_locator", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneAddDelLocator) - 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.OneAddDelLocator(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("/one_add_del_locator_set", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneAddDelLocatorSet) - 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.OneAddDelLocatorSet(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("/one_add_del_map_request_itr_rlocs", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneAddDelMapRequestItrRlocs) - 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.OneAddDelMapRequestItrRlocs(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("/one_add_del_map_resolver", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneAddDelMapResolver) - 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.OneAddDelMapResolver(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("/one_add_del_map_server", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneAddDelMapServer) - 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.OneAddDelMapServer(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("/one_add_del_ndp_entry", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneAddDelNdpEntry) - 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.OneAddDelNdpEntry(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("/one_add_del_remote_mapping", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneAddDelRemoteMapping) - 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.OneAddDelRemoteMapping(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("/one_adjacencies_get", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneAdjacenciesGet) - 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.OneAdjacenciesGet(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("/one_eid_table_add_del_map", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneEidTableAddDelMap) - 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.OneEidTableAddDelMap(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("/one_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneEnableDisable) - 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.OneEnableDisable(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("/one_enable_disable_petr_mode", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneEnableDisablePetrMode) - 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.OneEnableDisablePetrMode(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("/one_enable_disable_pitr_mode", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneEnableDisablePitrMode) - 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.OneEnableDisablePitrMode(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("/one_enable_disable_xtr_mode", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneEnableDisableXtrMode) - 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.OneEnableDisableXtrMode(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("/one_get_map_request_itr_rlocs", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneGetMapRequestItrRlocs) - reply, err := rpc.OneGetMapRequestItrRlocs(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("/one_get_transport_protocol", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneGetTransportProtocol) - reply, err := rpc.OneGetTransportProtocol(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("/one_l2_arp_bd_get", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneL2ArpBdGet) - reply, err := rpc.OneL2ArpBdGet(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("/one_l2_arp_entries_get", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneL2ArpEntriesGet) - 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.OneL2ArpEntriesGet(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("/one_map_register_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneMapRegisterEnableDisable) - 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.OneMapRegisterEnableDisable(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("/one_map_register_fallback_threshold", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneMapRegisterFallbackThreshold) - 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.OneMapRegisterFallbackThreshold(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("/one_map_register_set_ttl", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneMapRegisterSetTTL) - 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.OneMapRegisterSetTTL(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("/one_map_request_mode", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneMapRequestMode) - 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.OneMapRequestMode(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("/one_ndp_bd_get", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneNdpBdGet) - reply, err := rpc.OneNdpBdGet(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("/one_ndp_entries_get", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneNdpEntriesGet) - 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.OneNdpEntriesGet(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("/one_nsh_set_locator_set", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneNshSetLocatorSet) - 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.OneNshSetLocatorSet(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("/one_pitr_set_locator_set", func(w http.ResponseWriter, req *http.Request) { - var request = new(OnePitrSetLocatorSet) - 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.OnePitrSetLocatorSet(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("/one_rloc_probe_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneRlocProbeEnableDisable) - 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.OneRlocProbeEnableDisable(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("/one_set_transport_protocol", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneSetTransportProtocol) - 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.OneSetTransportProtocol(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("/one_show_petr_mode", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneShowPetrMode) - reply, err := rpc.OneShowPetrMode(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("/one_show_pitr_mode", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneShowPitrMode) - reply, err := rpc.OneShowPitrMode(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("/one_show_xtr_mode", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneShowXtrMode) - reply, err := rpc.OneShowXtrMode(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("/one_stats_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneStatsEnableDisable) - 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.OneStatsEnableDisable(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("/one_stats_flush", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneStatsFlush) - reply, err := rpc.OneStatsFlush(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("/one_use_petr", func(w http.ResponseWriter, req *http.Request) { - var request = new(OneUsePetr) - 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.OneUsePetr(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("/show_one_map_register_fallback_threshold", func(w http.ResponseWriter, req *http.Request) { - var request = new(ShowOneMapRegisterFallbackThreshold) - reply, err := rpc.ShowOneMapRegisterFallbackThreshold(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("/show_one_map_register_state", func(w http.ResponseWriter, req *http.Request) { - var request = new(ShowOneMapRegisterState) - reply, err := rpc.ShowOneMapRegisterState(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("/show_one_map_register_ttl", func(w http.ResponseWriter, req *http.Request) { - var request = new(ShowOneMapRegisterTTL) - reply, err := rpc.ShowOneMapRegisterTTL(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("/show_one_map_request_mode", func(w http.ResponseWriter, req *http.Request) { - var request = new(ShowOneMapRequestMode) - reply, err := rpc.ShowOneMapRequestMode(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("/show_one_nsh_mapping", func(w http.ResponseWriter, req *http.Request) { - var request = new(ShowOneNshMapping) - reply, err := rpc.ShowOneNshMapping(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("/show_one_pitr", func(w http.ResponseWriter, req *http.Request) { - var request = new(ShowOnePitr) - reply, err := rpc.ShowOnePitr(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("/show_one_rloc_probe_state", func(w http.ResponseWriter, req *http.Request) { - var request = new(ShowOneRlocProbeState) - reply, err := rpc.ShowOneRlocProbeState(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("/show_one_stats_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(ShowOneStatsEnableDisable) - reply, err := rpc.ShowOneStatsEnableDisable(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("/show_one_status", func(w http.ResponseWriter, req *http.Request) { - var request = new(ShowOneStatus) - reply, err := rpc.ShowOneStatus(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("/show_one_use_petr", func(w http.ResponseWriter, req *http.Request) { - var request = new(ShowOneUsePetr) - reply, err := rpc.ShowOneUsePetr(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/one/one_rpc.ba.go b/binapi/one/one_rpc.ba.go index b870ba1..2ef9c5e 100644 --- a/binapi/one/one_rpc.ba.go +++ b/binapi/one/one_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service one. +// RPCService defines RPC service one. type RPCService interface { OneAddDelAdjacency(ctx context.Context, in *OneAddDelAdjacency) (*OneAddDelAdjacencyReply, error) OneAddDelL2ArpEntry(ctx context.Context, in *OneAddDelL2ArpEntry) (*OneAddDelL2ArpEntryReply, error) @@ -83,7 +83,7 @@ func (c *serviceClient) OneAddDelAdjacency(ctx context.Context, in *OneAddDelAdj if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneAddDelL2ArpEntry(ctx context.Context, in *OneAddDelL2ArpEntry) (*OneAddDelL2ArpEntryReply, error) { @@ -92,7 +92,7 @@ func (c *serviceClient) OneAddDelL2ArpEntry(ctx context.Context, in *OneAddDelL2 if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneAddDelLocalEid(ctx context.Context, in *OneAddDelLocalEid) (*OneAddDelLocalEidReply, error) { @@ -101,7 +101,7 @@ func (c *serviceClient) OneAddDelLocalEid(ctx context.Context, in *OneAddDelLoca if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneAddDelLocator(ctx context.Context, in *OneAddDelLocator) (*OneAddDelLocatorReply, error) { @@ -110,7 +110,7 @@ func (c *serviceClient) OneAddDelLocator(ctx context.Context, in *OneAddDelLocat if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneAddDelLocatorSet(ctx context.Context, in *OneAddDelLocatorSet) (*OneAddDelLocatorSetReply, error) { @@ -119,7 +119,7 @@ func (c *serviceClient) OneAddDelLocatorSet(ctx context.Context, in *OneAddDelLo if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneAddDelMapRequestItrRlocs(ctx context.Context, in *OneAddDelMapRequestItrRlocs) (*OneAddDelMapRequestItrRlocsReply, error) { @@ -128,7 +128,7 @@ func (c *serviceClient) OneAddDelMapRequestItrRlocs(ctx context.Context, in *One if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneAddDelMapResolver(ctx context.Context, in *OneAddDelMapResolver) (*OneAddDelMapResolverReply, error) { @@ -137,7 +137,7 @@ func (c *serviceClient) OneAddDelMapResolver(ctx context.Context, in *OneAddDelM if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneAddDelMapServer(ctx context.Context, in *OneAddDelMapServer) (*OneAddDelMapServerReply, error) { @@ -146,7 +146,7 @@ func (c *serviceClient) OneAddDelMapServer(ctx context.Context, in *OneAddDelMap if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneAddDelNdpEntry(ctx context.Context, in *OneAddDelNdpEntry) (*OneAddDelNdpEntryReply, error) { @@ -155,7 +155,7 @@ func (c *serviceClient) OneAddDelNdpEntry(ctx context.Context, in *OneAddDelNdpE if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneAddDelRemoteMapping(ctx context.Context, in *OneAddDelRemoteMapping) (*OneAddDelRemoteMappingReply, error) { @@ -164,7 +164,7 @@ func (c *serviceClient) OneAddDelRemoteMapping(ctx context.Context, in *OneAddDe if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneAdjacenciesGet(ctx context.Context, in *OneAdjacenciesGet) (*OneAdjacenciesGetReply, error) { @@ -173,7 +173,7 @@ func (c *serviceClient) OneAdjacenciesGet(ctx context.Context, in *OneAdjacencie if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneEidTableAddDelMap(ctx context.Context, in *OneEidTableAddDelMap) (*OneEidTableAddDelMapReply, error) { @@ -182,7 +182,7 @@ func (c *serviceClient) OneEidTableAddDelMap(ctx context.Context, in *OneEidTabl if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneEidTableDump(ctx context.Context, in *OneEidTableDump) (RPCService_OneEidTableDumpClient, error) { @@ -308,7 +308,7 @@ func (c *serviceClient) OneEnableDisable(ctx context.Context, in *OneEnableDisab if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneEnableDisablePetrMode(ctx context.Context, in *OneEnableDisablePetrMode) (*OneEnableDisablePetrModeReply, error) { @@ -317,7 +317,7 @@ func (c *serviceClient) OneEnableDisablePetrMode(ctx context.Context, in *OneEna if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneEnableDisablePitrMode(ctx context.Context, in *OneEnableDisablePitrMode) (*OneEnableDisablePitrModeReply, error) { @@ -326,7 +326,7 @@ func (c *serviceClient) OneEnableDisablePitrMode(ctx context.Context, in *OneEna if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneEnableDisableXtrMode(ctx context.Context, in *OneEnableDisableXtrMode) (*OneEnableDisableXtrModeReply, error) { @@ -335,7 +335,7 @@ func (c *serviceClient) OneEnableDisableXtrMode(ctx context.Context, in *OneEnab if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneGetMapRequestItrRlocs(ctx context.Context, in *OneGetMapRequestItrRlocs) (*OneGetMapRequestItrRlocsReply, error) { @@ -344,7 +344,7 @@ func (c *serviceClient) OneGetMapRequestItrRlocs(ctx context.Context, in *OneGet if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneGetTransportProtocol(ctx context.Context, in *OneGetTransportProtocol) (*OneGetTransportProtocolReply, error) { @@ -353,7 +353,7 @@ func (c *serviceClient) OneGetTransportProtocol(ctx context.Context, in *OneGetT if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneL2ArpBdGet(ctx context.Context, in *OneL2ArpBdGet) (*OneL2ArpBdGetReply, error) { @@ -362,7 +362,7 @@ func (c *serviceClient) OneL2ArpBdGet(ctx context.Context, in *OneL2ArpBdGet) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneL2ArpEntriesGet(ctx context.Context, in *OneL2ArpEntriesGet) (*OneL2ArpEntriesGetReply, error) { @@ -371,7 +371,7 @@ func (c *serviceClient) OneL2ArpEntriesGet(ctx context.Context, in *OneL2ArpEntr if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneLocatorDump(ctx context.Context, in *OneLocatorDump) (RPCService_OneLocatorDumpClient, error) { @@ -458,7 +458,7 @@ func (c *serviceClient) OneMapRegisterEnableDisable(ctx context.Context, in *One if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneMapRegisterFallbackThreshold(ctx context.Context, in *OneMapRegisterFallbackThreshold) (*OneMapRegisterFallbackThresholdReply, error) { @@ -467,7 +467,7 @@ func (c *serviceClient) OneMapRegisterFallbackThreshold(ctx context.Context, in if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneMapRegisterSetTTL(ctx context.Context, in *OneMapRegisterSetTTL) (*OneMapRegisterSetTTLReply, error) { @@ -476,7 +476,7 @@ func (c *serviceClient) OneMapRegisterSetTTL(ctx context.Context, in *OneMapRegi if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneMapRequestMode(ctx context.Context, in *OneMapRequestMode) (*OneMapRequestModeReply, error) { @@ -485,7 +485,7 @@ func (c *serviceClient) OneMapRequestMode(ctx context.Context, in *OneMapRequest if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneMapResolverDump(ctx context.Context, in *OneMapResolverDump) (RPCService_OneMapResolverDumpClient, error) { @@ -572,7 +572,7 @@ func (c *serviceClient) OneNdpBdGet(ctx context.Context, in *OneNdpBdGet) (*OneN if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneNdpEntriesGet(ctx context.Context, in *OneNdpEntriesGet) (*OneNdpEntriesGetReply, error) { @@ -581,7 +581,7 @@ func (c *serviceClient) OneNdpEntriesGet(ctx context.Context, in *OneNdpEntriesG if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneNshSetLocatorSet(ctx context.Context, in *OneNshSetLocatorSet) (*OneNshSetLocatorSetReply, error) { @@ -590,7 +590,7 @@ func (c *serviceClient) OneNshSetLocatorSet(ctx context.Context, in *OneNshSetLo if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OnePitrSetLocatorSet(ctx context.Context, in *OnePitrSetLocatorSet) (*OnePitrSetLocatorSetReply, error) { @@ -599,7 +599,7 @@ func (c *serviceClient) OnePitrSetLocatorSet(ctx context.Context, in *OnePitrSet if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneRlocProbeEnableDisable(ctx context.Context, in *OneRlocProbeEnableDisable) (*OneRlocProbeEnableDisableReply, error) { @@ -608,7 +608,7 @@ func (c *serviceClient) OneRlocProbeEnableDisable(ctx context.Context, in *OneRl if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneSetTransportProtocol(ctx context.Context, in *OneSetTransportProtocol) (*OneSetTransportProtocolReply, error) { @@ -617,7 +617,7 @@ func (c *serviceClient) OneSetTransportProtocol(ctx context.Context, in *OneSetT if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneShowPetrMode(ctx context.Context, in *OneShowPetrMode) (*OneShowPetrModeReply, error) { @@ -626,7 +626,7 @@ func (c *serviceClient) OneShowPetrMode(ctx context.Context, in *OneShowPetrMode if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneShowPitrMode(ctx context.Context, in *OneShowPitrMode) (*OneShowPitrModeReply, error) { @@ -635,7 +635,7 @@ func (c *serviceClient) OneShowPitrMode(ctx context.Context, in *OneShowPitrMode if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneShowXtrMode(ctx context.Context, in *OneShowXtrMode) (*OneShowXtrModeReply, error) { @@ -644,7 +644,7 @@ func (c *serviceClient) OneShowXtrMode(ctx context.Context, in *OneShowXtrMode) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneStatsDump(ctx context.Context, in *OneStatsDump) (RPCService_OneStatsDumpClient, error) { @@ -692,7 +692,7 @@ func (c *serviceClient) OneStatsEnableDisable(ctx context.Context, in *OneStatsE if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneStatsFlush(ctx context.Context, in *OneStatsFlush) (*OneStatsFlushReply, error) { @@ -701,7 +701,7 @@ func (c *serviceClient) OneStatsFlush(ctx context.Context, in *OneStatsFlush) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) OneUsePetr(ctx context.Context, in *OneUsePetr) (*OneUsePetrReply, error) { @@ -710,7 +710,7 @@ func (c *serviceClient) OneUsePetr(ctx context.Context, in *OneUsePetr) (*OneUse if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ShowOneMapRegisterFallbackThreshold(ctx context.Context, in *ShowOneMapRegisterFallbackThreshold) (*ShowOneMapRegisterFallbackThresholdReply, error) { @@ -719,7 +719,7 @@ func (c *serviceClient) ShowOneMapRegisterFallbackThreshold(ctx context.Context, if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ShowOneMapRegisterState(ctx context.Context, in *ShowOneMapRegisterState) (*ShowOneMapRegisterStateReply, error) { @@ -728,7 +728,7 @@ func (c *serviceClient) ShowOneMapRegisterState(ctx context.Context, in *ShowOne if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ShowOneMapRegisterTTL(ctx context.Context, in *ShowOneMapRegisterTTL) (*ShowOneMapRegisterTTLReply, error) { @@ -737,7 +737,7 @@ func (c *serviceClient) ShowOneMapRegisterTTL(ctx context.Context, in *ShowOneMa if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ShowOneMapRequestMode(ctx context.Context, in *ShowOneMapRequestMode) (*ShowOneMapRequestModeReply, error) { @@ -746,7 +746,7 @@ func (c *serviceClient) ShowOneMapRequestMode(ctx context.Context, in *ShowOneMa if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ShowOneNshMapping(ctx context.Context, in *ShowOneNshMapping) (*ShowOneNshMappingReply, error) { @@ -755,7 +755,7 @@ func (c *serviceClient) ShowOneNshMapping(ctx context.Context, in *ShowOneNshMap if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ShowOnePitr(ctx context.Context, in *ShowOnePitr) (*ShowOnePitrReply, error) { @@ -764,7 +764,7 @@ func (c *serviceClient) ShowOnePitr(ctx context.Context, in *ShowOnePitr) (*Show if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ShowOneRlocProbeState(ctx context.Context, in *ShowOneRlocProbeState) (*ShowOneRlocProbeStateReply, error) { @@ -773,7 +773,7 @@ func (c *serviceClient) ShowOneRlocProbeState(ctx context.Context, in *ShowOneRl if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ShowOneStatsEnableDisable(ctx context.Context, in *ShowOneStatsEnableDisable) (*ShowOneStatsEnableDisableReply, error) { @@ -782,7 +782,7 @@ func (c *serviceClient) ShowOneStatsEnableDisable(ctx context.Context, in *ShowO if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ShowOneStatus(ctx context.Context, in *ShowOneStatus) (*ShowOneStatusReply, error) { @@ -791,7 +791,7 @@ func (c *serviceClient) ShowOneStatus(ctx context.Context, in *ShowOneStatus) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ShowOneUsePetr(ctx context.Context, in *ShowOneUsePetr) (*ShowOneUsePetrReply, error) { @@ -800,5 +800,5 @@ func (c *serviceClient) ShowOneUsePetr(ctx context.Context, in *ShowOneUsePetr) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/p2p_ethernet/p2p_ethernet.ba.go b/binapi/p2p_ethernet/p2p_ethernet.ba.go index 2f76041..d9f9a9c 100644 --- a/binapi/p2p_ethernet/p2p_ethernet.ba.go +++ b/binapi/p2p_ethernet/p2p_ethernet.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/core/p2p_ethernet.api.json // Package p2p_ethernet contains generated bindings for API file p2p_ethernet.api. diff --git a/binapi/p2p_ethernet/p2p_ethernet_rest.ba.go b/binapi/p2p_ethernet/p2p_ethernet_rest.ba.go deleted file mode 100644 index e154276..0000000 --- a/binapi/p2p_ethernet/p2p_ethernet_rest.ba.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package p2p_ethernet - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/p2p_ethernet_add", func(w http.ResponseWriter, req *http.Request) { - var request = new(P2pEthernetAdd) - 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.P2pEthernetAdd(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("/p2p_ethernet_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(P2pEthernetDel) - 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.P2pEthernetDel(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/p2p_ethernet/p2p_ethernet_rpc.ba.go b/binapi/p2p_ethernet/p2p_ethernet_rpc.ba.go index 98cc2e3..c96d6a5 100644 --- a/binapi/p2p_ethernet/p2p_ethernet_rpc.ba.go +++ b/binapi/p2p_ethernet/p2p_ethernet_rpc.ba.go @@ -8,7 +8,7 @@ import ( api "git.fd.io/govpp.git/api" ) -// RPCService defines RPC service p2p_ethernet. +// RPCService defines RPC service p2p_ethernet. type RPCService interface { P2pEthernetAdd(ctx context.Context, in *P2pEthernetAdd) (*P2pEthernetAddReply, error) P2pEthernetDel(ctx context.Context, in *P2pEthernetDel) (*P2pEthernetDelReply, error) @@ -28,7 +28,7 @@ func (c *serviceClient) P2pEthernetAdd(ctx context.Context, in *P2pEthernetAdd) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) P2pEthernetDel(ctx context.Context, in *P2pEthernetDel) (*P2pEthernetDelReply, error) { @@ -37,5 +37,5 @@ func (c *serviceClient) P2pEthernetDel(ctx context.Context, in *P2pEthernetDel) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/pci_types/pci_types.ba.go b/binapi/pci_types/pci_types.ba.go index 7b0d00c..fe12ece 100644 --- a/binapi/pci_types/pci_types.ba.go +++ b/binapi/pci_types/pci_types.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/core/pci_types.api.json // Package pci_types contains generated bindings for API file pci_types.api. diff --git a/binapi/pg/pg.ba.go b/binapi/pg/pg.ba.go index 9a522c2..5fc4efb 100644 --- a/binapi/pg/pg.ba.go +++ b/binapi/pg/pg.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/core/pg.api.json // Package pg contains generated bindings for API file pg.api. diff --git a/binapi/pg/pg_rest.ba.go b/binapi/pg/pg_rest.ba.go deleted file mode 100644 index 6384ac4..0000000 --- a/binapi/pg/pg_rest.ba.go +++ /dev/null @@ -1,83 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package pg - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/pg_capture", func(w http.ResponseWriter, req *http.Request) { - var request = new(PgCapture) - 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.PgCapture(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("/pg_create_interface", func(w http.ResponseWriter, req *http.Request) { - var request = new(PgCreateInterface) - 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.PgCreateInterface(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("/pg_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(PgEnableDisable) - 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.PgEnableDisable(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/pg/pg_rpc.ba.go b/binapi/pg/pg_rpc.ba.go index 28790a8..697f684 100644 --- a/binapi/pg/pg_rpc.ba.go +++ b/binapi/pg/pg_rpc.ba.go @@ -8,7 +8,7 @@ import ( api "git.fd.io/govpp.git/api" ) -// RPCService defines RPC service pg. +// RPCService defines RPC service pg. type RPCService interface { PgCapture(ctx context.Context, in *PgCapture) (*PgCaptureReply, error) PgCreateInterface(ctx context.Context, in *PgCreateInterface) (*PgCreateInterfaceReply, error) @@ -29,7 +29,7 @@ func (c *serviceClient) PgCapture(ctx context.Context, in *PgCapture) (*PgCaptur if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) PgCreateInterface(ctx context.Context, in *PgCreateInterface) (*PgCreateInterfaceReply, error) { @@ -38,7 +38,7 @@ func (c *serviceClient) PgCreateInterface(ctx context.Context, in *PgCreateInter if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) PgEnableDisable(ctx context.Context, in *PgEnableDisable) (*PgEnableDisableReply, error) { @@ -47,5 +47,5 @@ func (c *serviceClient) PgEnableDisable(ctx context.Context, in *PgEnableDisable if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/pipe/pipe.ba.go b/binapi/pipe/pipe.ba.go index 6123059..f50db2a 100644 --- a/binapi/pipe/pipe.ba.go +++ b/binapi/pipe/pipe.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/core/pipe.api.json // Package pipe contains generated bindings for API file pipe.api. diff --git a/binapi/pipe/pipe_rest.ba.go b/binapi/pipe/pipe_rest.ba.go deleted file mode 100644 index 8a2b900..0000000 --- a/binapi/pipe/pipe_rest.ba.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package pipe - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/pipe_create", func(w http.ResponseWriter, req *http.Request) { - var request = new(PipeCreate) - 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.PipeCreate(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("/pipe_delete", func(w http.ResponseWriter, req *http.Request) { - var request = new(PipeDelete) - 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.PipeDelete(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/pipe/pipe_rpc.ba.go b/binapi/pipe/pipe_rpc.ba.go index a084d9f..34fbf54 100644 --- a/binapi/pipe/pipe_rpc.ba.go +++ b/binapi/pipe/pipe_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service pipe. +// RPCService defines RPC service pipe. type RPCService interface { PipeCreate(ctx context.Context, in *PipeCreate) (*PipeCreateReply, error) PipeDelete(ctx context.Context, in *PipeDelete) (*PipeDeleteReply, error) @@ -32,7 +32,7 @@ func (c *serviceClient) PipeCreate(ctx context.Context, in *PipeCreate) (*PipeCr if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) PipeDelete(ctx context.Context, in *PipeDelete) (*PipeDeleteReply, error) { @@ -41,7 +41,7 @@ func (c *serviceClient) PipeDelete(ctx context.Context, in *PipeDelete) (*PipeDe if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) PipeDump(ctx context.Context, in *PipeDump) (RPCService_PipeDumpClient, error) { diff --git a/binapi/policer/policer.ba.go b/binapi/policer/policer.ba.go index 1314dce..525abb8 100644 --- a/binapi/policer/policer.ba.go +++ b/binapi/policer/policer.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/core/policer.api.json // Package policer contains generated bindings for API file policer.api. diff --git a/binapi/policer/policer_rest.ba.go b/binapi/policer/policer_rest.ba.go deleted file mode 100644 index e53e42d..0000000 --- a/binapi/policer/policer_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package policer - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/policer_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(PolicerAddDel) - 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.PolicerAddDel(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/policer/policer_rpc.ba.go b/binapi/policer/policer_rpc.ba.go index 870ba87..85c55ca 100644 --- a/binapi/policer/policer_rpc.ba.go +++ b/binapi/policer/policer_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service policer. +// RPCService defines RPC service policer. type RPCService interface { PolicerAddDel(ctx context.Context, in *PolicerAddDel) (*PolicerAddDelReply, error) PolicerDump(ctx context.Context, in *PolicerDump) (RPCService_PolicerDumpClient, error) @@ -31,7 +31,7 @@ func (c *serviceClient) PolicerAddDel(ctx context.Context, in *PolicerAddDel) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) PolicerDump(ctx context.Context, in *PolicerDump) (RPCService_PolicerDumpClient, error) { diff --git a/binapi/policer_types/policer_types.ba.go b/binapi/policer_types/policer_types.ba.go index bdb259a..24cc191 100644 --- a/binapi/policer_types/policer_types.ba.go +++ b/binapi/policer_types/policer_types.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/core/policer_types.api.json // Package policer_types contains generated bindings for API file policer_types.api. diff --git a/binapi/pot/pot.ba.go b/binapi/pot/pot.ba.go index 2c2d1f4..5edf20f 100644 --- a/binapi/pot/pot.ba.go +++ b/binapi/pot/pot.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/pot.api.json // Package pot contains generated bindings for API file pot.api. diff --git a/binapi/pot/pot_rest.ba.go b/binapi/pot/pot_rest.ba.go deleted file mode 100644 index 0cf6474..0000000 --- a/binapi/pot/pot_rest.ba.go +++ /dev/null @@ -1,83 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package pot - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/pot_profile_activate", func(w http.ResponseWriter, req *http.Request) { - var request = new(PotProfileActivate) - 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.PotProfileActivate(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("/pot_profile_add", func(w http.ResponseWriter, req *http.Request) { - var request = new(PotProfileAdd) - 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.PotProfileAdd(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("/pot_profile_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(PotProfileDel) - 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.PotProfileDel(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/pot/pot_rpc.ba.go b/binapi/pot/pot_rpc.ba.go index 3b43d50..ea975fd 100644 --- a/binapi/pot/pot_rpc.ba.go +++ b/binapi/pot/pot_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service pot. +// RPCService defines RPC service pot. type RPCService interface { PotProfileActivate(ctx context.Context, in *PotProfileActivate) (*PotProfileActivateReply, error) PotProfileAdd(ctx context.Context, in *PotProfileAdd) (*PotProfileAddReply, error) @@ -33,7 +33,7 @@ func (c *serviceClient) PotProfileActivate(ctx context.Context, in *PotProfileAc if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) PotProfileAdd(ctx context.Context, in *PotProfileAdd) (*PotProfileAddReply, error) { @@ -42,7 +42,7 @@ func (c *serviceClient) PotProfileAdd(ctx context.Context, in *PotProfileAdd) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) PotProfileDel(ctx context.Context, in *PotProfileDel) (*PotProfileDelReply, error) { @@ -51,7 +51,7 @@ func (c *serviceClient) PotProfileDel(ctx context.Context, in *PotProfileDel) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) PotProfileShowConfigDump(ctx context.Context, in *PotProfileShowConfigDump) (RPCService_PotProfileShowConfigDumpClient, error) { diff --git a/binapi/pppoe/pppoe.ba.go b/binapi/pppoe/pppoe.ba.go index e01d3b5..277ee86 100644 --- a/binapi/pppoe/pppoe.ba.go +++ b/binapi/pppoe/pppoe.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/pppoe.api.json // Package pppoe contains generated bindings for API file pppoe.api. diff --git a/binapi/pppoe/pppoe_rest.ba.go b/binapi/pppoe/pppoe_rest.ba.go deleted file mode 100644 index 6b01227..0000000 --- a/binapi/pppoe/pppoe_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package pppoe - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/pppoe_add_del_session", func(w http.ResponseWriter, req *http.Request) { - var request = new(PppoeAddDelSession) - 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.PppoeAddDelSession(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/pppoe/pppoe_rpc.ba.go b/binapi/pppoe/pppoe_rpc.ba.go index 6a21a10..075803f 100644 --- a/binapi/pppoe/pppoe_rpc.ba.go +++ b/binapi/pppoe/pppoe_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service pppoe. +// RPCService defines RPC service pppoe. type RPCService interface { PppoeAddDelSession(ctx context.Context, in *PppoeAddDelSession) (*PppoeAddDelSessionReply, error) PppoeSessionDump(ctx context.Context, in *PppoeSessionDump) (RPCService_PppoeSessionDumpClient, error) @@ -31,7 +31,7 @@ func (c *serviceClient) PppoeAddDelSession(ctx context.Context, in *PppoeAddDelS if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) PppoeSessionDump(ctx context.Context, in *PppoeSessionDump) (RPCService_PppoeSessionDumpClient, error) { diff --git a/binapi/punt/punt.ba.go b/binapi/punt/punt.ba.go index 1a84dbf..158672a 100644 --- a/binapi/punt/punt.ba.go +++ b/binapi/punt/punt.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/core/punt.api.json // Package punt contains generated bindings for API file punt.api. diff --git a/binapi/punt/punt_rest.ba.go b/binapi/punt/punt_rest.ba.go deleted file mode 100644 index 5b999b9..0000000 --- a/binapi/punt/punt_rest.ba.go +++ /dev/null @@ -1,83 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package punt - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/punt_socket_deregister", func(w http.ResponseWriter, req *http.Request) { - var request = new(PuntSocketDeregister) - 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.PuntSocketDeregister(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("/punt_socket_register", func(w http.ResponseWriter, req *http.Request) { - var request = new(PuntSocketRegister) - 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.PuntSocketRegister(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("/set_punt", func(w http.ResponseWriter, req *http.Request) { - var request = new(SetPunt) - 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.SetPunt(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/punt/punt_rpc.ba.go b/binapi/punt/punt_rpc.ba.go index 9a058cb..b27fbd4 100644 --- a/binapi/punt/punt_rpc.ba.go +++ b/binapi/punt/punt_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service punt. +// RPCService defines RPC service punt. type RPCService interface { PuntReasonDump(ctx context.Context, in *PuntReasonDump) (RPCService_PuntReasonDumpClient, error) PuntSocketDeregister(ctx context.Context, in *PuntSocketDeregister) (*PuntSocketDeregisterReply, error) @@ -73,7 +73,7 @@ func (c *serviceClient) PuntSocketDeregister(ctx context.Context, in *PuntSocket if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) PuntSocketDump(ctx context.Context, in *PuntSocketDump) (RPCService_PuntSocketDumpClient, error) { @@ -121,7 +121,7 @@ func (c *serviceClient) PuntSocketRegister(ctx context.Context, in *PuntSocketRe if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SetPunt(ctx context.Context, in *SetPunt) (*SetPuntReply, error) { @@ -130,5 +130,5 @@ func (c *serviceClient) SetPunt(ctx context.Context, in *SetPunt) (*SetPuntReply if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/qos/qos.ba.go b/binapi/qos/qos.ba.go index 285e2c8..27aaf6b 100644 --- a/binapi/qos/qos.ba.go +++ b/binapi/qos/qos.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/core/qos.api.json // Package qos contains generated bindings for API file qos.api. diff --git a/binapi/qos/qos_rest.ba.go b/binapi/qos/qos_rest.ba.go deleted file mode 100644 index 2e0e546..0000000 --- a/binapi/qos/qos_rest.ba.go +++ /dev/null @@ -1,129 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package qos - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/qos_egress_map_delete", func(w http.ResponseWriter, req *http.Request) { - var request = new(QosEgressMapDelete) - 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.QosEgressMapDelete(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("/qos_egress_map_update", func(w http.ResponseWriter, req *http.Request) { - var request = new(QosEgressMapUpdate) - 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.QosEgressMapUpdate(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("/qos_mark_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(QosMarkEnableDisable) - 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.QosMarkEnableDisable(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("/qos_record_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(QosRecordEnableDisable) - 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.QosRecordEnableDisable(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("/qos_store_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(QosStoreEnableDisable) - 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.QosStoreEnableDisable(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/qos/qos_rpc.ba.go b/binapi/qos/qos_rpc.ba.go index 50f6427..9ad1b1d 100644 --- a/binapi/qos/qos_rpc.ba.go +++ b/binapi/qos/qos_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service qos. +// RPCService defines RPC service qos. type RPCService interface { QosEgressMapDelete(ctx context.Context, in *QosEgressMapDelete) (*QosEgressMapDeleteReply, error) QosEgressMapDump(ctx context.Context, in *QosEgressMapDump) (RPCService_QosEgressMapDumpClient, error) @@ -38,7 +38,7 @@ func (c *serviceClient) QosEgressMapDelete(ctx context.Context, in *QosEgressMap if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) QosEgressMapDump(ctx context.Context, in *QosEgressMapDump) (RPCService_QosEgressMapDumpClient, error) { @@ -86,7 +86,7 @@ func (c *serviceClient) QosEgressMapUpdate(ctx context.Context, in *QosEgressMap if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) QosMarkDump(ctx context.Context, in *QosMarkDump) (RPCService_QosMarkDumpClient, error) { @@ -134,7 +134,7 @@ func (c *serviceClient) QosMarkEnableDisable(ctx context.Context, in *QosMarkEna if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) QosRecordDump(ctx context.Context, in *QosRecordDump) (RPCService_QosRecordDumpClient, error) { @@ -182,7 +182,7 @@ func (c *serviceClient) QosRecordEnableDisable(ctx context.Context, in *QosRecor if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) QosStoreDump(ctx context.Context, in *QosStoreDump) (RPCService_QosStoreDumpClient, error) { @@ -230,5 +230,5 @@ func (c *serviceClient) QosStoreEnableDisable(ctx context.Context, in *QosStoreE if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/rd_cp/rd_cp.ba.go b/binapi/rd_cp/rd_cp.ba.go index 8cafa0f..5db01b4 100644 --- a/binapi/rd_cp/rd_cp.ba.go +++ b/binapi/rd_cp/rd_cp.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/core/rd_cp.api.json // Package rd_cp contains generated bindings for API file rd_cp.api. diff --git a/binapi/rd_cp/rd_cp_rest.ba.go b/binapi/rd_cp/rd_cp_rest.ba.go deleted file mode 100644 index 75e75a0..0000000 --- a/binapi/rd_cp/rd_cp_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package rd_cp - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/ip6_nd_address_autoconfig", func(w http.ResponseWriter, req *http.Request) { - var request = new(IP6NdAddressAutoconfig) - 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.IP6NdAddressAutoconfig(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/rd_cp/rd_cp_rpc.ba.go b/binapi/rd_cp/rd_cp_rpc.ba.go index 5e7e7fe..56b2c18 100644 --- a/binapi/rd_cp/rd_cp_rpc.ba.go +++ b/binapi/rd_cp/rd_cp_rpc.ba.go @@ -8,7 +8,7 @@ import ( api "git.fd.io/govpp.git/api" ) -// RPCService defines RPC service rd_cp. +// RPCService defines RPC service rd_cp. type RPCService interface { IP6NdAddressAutoconfig(ctx context.Context, in *IP6NdAddressAutoconfig) (*IP6NdAddressAutoconfigReply, error) } @@ -27,5 +27,5 @@ func (c *serviceClient) IP6NdAddressAutoconfig(ctx context.Context, in *IP6NdAdd if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/rdma/rdma.ba.go b/binapi/rdma/rdma.ba.go index f331fc6..cb56007 100644 --- a/binapi/rdma/rdma.ba.go +++ b/binapi/rdma/rdma.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/rdma.api.json // Package rdma contains generated bindings for API file rdma.api. diff --git a/binapi/rdma/rdma_rest.ba.go b/binapi/rdma/rdma_rest.ba.go deleted file mode 100644 index 83346d9..0000000 --- a/binapi/rdma/rdma_rest.ba.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package rdma - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/rdma_create", func(w http.ResponseWriter, req *http.Request) { - var request = new(RdmaCreate) - 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.RdmaCreate(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("/rdma_delete", func(w http.ResponseWriter, req *http.Request) { - var request = new(RdmaDelete) - 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.RdmaDelete(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/rdma/rdma_rpc.ba.go b/binapi/rdma/rdma_rpc.ba.go index 7e9f60d..489297d 100644 --- a/binapi/rdma/rdma_rpc.ba.go +++ b/binapi/rdma/rdma_rpc.ba.go @@ -8,7 +8,7 @@ import ( api "git.fd.io/govpp.git/api" ) -// RPCService defines RPC service rdma. +// RPCService defines RPC service rdma. type RPCService interface { RdmaCreate(ctx context.Context, in *RdmaCreate) (*RdmaCreateReply, error) RdmaDelete(ctx context.Context, in *RdmaDelete) (*RdmaDeleteReply, error) @@ -28,7 +28,7 @@ func (c *serviceClient) RdmaCreate(ctx context.Context, in *RdmaCreate) (*RdmaCr if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) RdmaDelete(ctx context.Context, in *RdmaDelete) (*RdmaDeleteReply, error) { @@ -37,5 +37,5 @@ func (c *serviceClient) RdmaDelete(ctx context.Context, in *RdmaDelete) (*RdmaDe if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/session/session.ba.go b/binapi/session/session.ba.go index 09a67b0..6bb20b8 100644 --- a/binapi/session/session.ba.go +++ b/binapi/session/session.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/core/session.api.json // Package session contains generated bindings for API file session.api. diff --git a/binapi/session/session_rest.ba.go b/binapi/session/session_rest.ba.go deleted file mode 100644 index 1ef2085..0000000 --- a/binapi/session/session_rest.ba.go +++ /dev/null @@ -1,235 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package session - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/app_add_cert_key_pair", func(w http.ResponseWriter, req *http.Request) { - var request = new(AppAddCertKeyPair) - 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.AppAddCertKeyPair(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("/app_attach", func(w http.ResponseWriter, req *http.Request) { - var request = new(AppAttach) - 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.AppAttach(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("/app_del_cert_key_pair", func(w http.ResponseWriter, req *http.Request) { - var request = new(AppDelCertKeyPair) - 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.AppDelCertKeyPair(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("/app_namespace_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(AppNamespaceAddDel) - 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.AppNamespaceAddDel(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("/app_worker_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(AppWorkerAddDel) - 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.AppWorkerAddDel(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("/application_detach", func(w http.ResponseWriter, req *http.Request) { - var request = new(ApplicationDetach) - reply, err := rpc.ApplicationDetach(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("/application_tls_cert_add", func(w http.ResponseWriter, req *http.Request) { - var request = new(ApplicationTLSCertAdd) - 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.ApplicationTLSCertAdd(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("/application_tls_key_add", func(w http.ResponseWriter, req *http.Request) { - var request = new(ApplicationTLSKeyAdd) - 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.ApplicationTLSKeyAdd(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("/session_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(SessionEnableDisable) - 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.SessionEnableDisable(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("/session_rule_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(SessionRuleAddDel) - 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.SessionRuleAddDel(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/session/session_rpc.ba.go b/binapi/session/session_rpc.ba.go index 3868572..58593a0 100644 --- a/binapi/session/session_rpc.ba.go +++ b/binapi/session/session_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service session. +// RPCService defines RPC service session. type RPCService interface { AppAddCertKeyPair(ctx context.Context, in *AppAddCertKeyPair) (*AppAddCertKeyPairReply, error) AppAttach(ctx context.Context, in *AppAttach) (*AppAttachReply, error) @@ -40,7 +40,7 @@ func (c *serviceClient) AppAddCertKeyPair(ctx context.Context, in *AppAddCertKey if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) AppAttach(ctx context.Context, in *AppAttach) (*AppAttachReply, error) { @@ -49,7 +49,7 @@ func (c *serviceClient) AppAttach(ctx context.Context, in *AppAttach) (*AppAttac if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) AppDelCertKeyPair(ctx context.Context, in *AppDelCertKeyPair) (*AppDelCertKeyPairReply, error) { @@ -58,7 +58,7 @@ func (c *serviceClient) AppDelCertKeyPair(ctx context.Context, in *AppDelCertKey if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) AppNamespaceAddDel(ctx context.Context, in *AppNamespaceAddDel) (*AppNamespaceAddDelReply, error) { @@ -67,7 +67,7 @@ func (c *serviceClient) AppNamespaceAddDel(ctx context.Context, in *AppNamespace if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) AppWorkerAddDel(ctx context.Context, in *AppWorkerAddDel) (*AppWorkerAddDelReply, error) { @@ -76,7 +76,7 @@ func (c *serviceClient) AppWorkerAddDel(ctx context.Context, in *AppWorkerAddDel if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ApplicationDetach(ctx context.Context, in *ApplicationDetach) (*ApplicationDetachReply, error) { @@ -85,7 +85,7 @@ func (c *serviceClient) ApplicationDetach(ctx context.Context, in *ApplicationDe if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ApplicationTLSCertAdd(ctx context.Context, in *ApplicationTLSCertAdd) (*ApplicationTLSCertAddReply, error) { @@ -94,7 +94,7 @@ func (c *serviceClient) ApplicationTLSCertAdd(ctx context.Context, in *Applicati if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ApplicationTLSKeyAdd(ctx context.Context, in *ApplicationTLSKeyAdd) (*ApplicationTLSKeyAddReply, error) { @@ -103,7 +103,7 @@ func (c *serviceClient) ApplicationTLSKeyAdd(ctx context.Context, in *Applicatio if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SessionEnableDisable(ctx context.Context, in *SessionEnableDisable) (*SessionEnableDisableReply, error) { @@ -112,7 +112,7 @@ func (c *serviceClient) SessionEnableDisable(ctx context.Context, in *SessionEna if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SessionRuleAddDel(ctx context.Context, in *SessionRuleAddDel) (*SessionRuleAddDelReply, error) { @@ -121,7 +121,7 @@ func (c *serviceClient) SessionRuleAddDel(ctx context.Context, in *SessionRuleAd if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SessionRulesDump(ctx context.Context, in *SessionRulesDump) (RPCService_SessionRulesDumpClient, error) { diff --git a/binapi/span/span.ba.go b/binapi/span/span.ba.go index 74855b1..5cc7fe2 100644 --- a/binapi/span/span.ba.go +++ b/binapi/span/span.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/core/span.api.json // Package span contains generated bindings for API file span.api. diff --git a/binapi/span/span_rest.ba.go b/binapi/span/span_rest.ba.go deleted file mode 100644 index 0c2d959..0000000 --- a/binapi/span/span_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package span - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/sw_interface_span_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceSpanEnableDisable) - 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.SwInterfaceSpanEnableDisable(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/span/span_rpc.ba.go b/binapi/span/span_rpc.ba.go index f9f9538..1452be8 100644 --- a/binapi/span/span_rpc.ba.go +++ b/binapi/span/span_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service span. +// RPCService defines RPC service span. type RPCService interface { SwInterfaceSpanDump(ctx context.Context, in *SwInterfaceSpanDump) (RPCService_SwInterfaceSpanDumpClient, error) SwInterfaceSpanEnableDisable(ctx context.Context, in *SwInterfaceSpanEnableDisable) (*SwInterfaceSpanEnableDisableReply, error) @@ -70,5 +70,5 @@ func (c *serviceClient) SwInterfaceSpanEnableDisable(ctx context.Context, in *Sw if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/sr/sr.ba.go b/binapi/sr/sr.ba.go index 2b98b8a..4b883d2 100644 --- a/binapi/sr/sr.ba.go +++ b/binapi/sr/sr.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/core/sr.api.json // Package sr contains generated bindings for API file sr.api. diff --git a/binapi/sr/sr_rest.ba.go b/binapi/sr/sr_rest.ba.go deleted file mode 100644 index 0d3acfc..0000000 --- a/binapi/sr/sr_rest.ba.go +++ /dev/null @@ -1,175 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package sr - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/sr_localsid_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(SrLocalsidAddDel) - 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.SrLocalsidAddDel(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("/sr_policy_add", func(w http.ResponseWriter, req *http.Request) { - var request = new(SrPolicyAdd) - 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.SrPolicyAdd(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("/sr_policy_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(SrPolicyDel) - 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.SrPolicyDel(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("/sr_policy_mod", func(w http.ResponseWriter, req *http.Request) { - var request = new(SrPolicyMod) - 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.SrPolicyMod(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("/sr_set_encap_hop_limit", func(w http.ResponseWriter, req *http.Request) { - var request = new(SrSetEncapHopLimit) - 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.SrSetEncapHopLimit(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("/sr_set_encap_source", func(w http.ResponseWriter, req *http.Request) { - var request = new(SrSetEncapSource) - 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.SrSetEncapSource(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("/sr_steering_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(SrSteeringAddDel) - 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.SrSteeringAddDel(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/sr/sr_rpc.ba.go b/binapi/sr/sr_rpc.ba.go index 450ced9..7bbfff1 100644 --- a/binapi/sr/sr_rpc.ba.go +++ b/binapi/sr/sr_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service sr. +// RPCService defines RPC service sr. type RPCService interface { SrLocalsidAddDel(ctx context.Context, in *SrLocalsidAddDel) (*SrLocalsidAddDelReply, error) SrLocalsidsDump(ctx context.Context, in *SrLocalsidsDump) (RPCService_SrLocalsidsDumpClient, error) @@ -39,7 +39,7 @@ func (c *serviceClient) SrLocalsidAddDel(ctx context.Context, in *SrLocalsidAddD if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SrLocalsidsDump(ctx context.Context, in *SrLocalsidsDump) (RPCService_SrLocalsidsDumpClient, error) { @@ -126,7 +126,7 @@ func (c *serviceClient) SrPolicyAdd(ctx context.Context, in *SrPolicyAdd) (*SrPo if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SrPolicyDel(ctx context.Context, in *SrPolicyDel) (*SrPolicyDelReply, error) { @@ -135,7 +135,7 @@ func (c *serviceClient) SrPolicyDel(ctx context.Context, in *SrPolicyDel) (*SrPo if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SrPolicyMod(ctx context.Context, in *SrPolicyMod) (*SrPolicyModReply, error) { @@ -144,7 +144,7 @@ func (c *serviceClient) SrPolicyMod(ctx context.Context, in *SrPolicyMod) (*SrPo if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SrSetEncapHopLimit(ctx context.Context, in *SrSetEncapHopLimit) (*SrSetEncapHopLimitReply, error) { @@ -153,7 +153,7 @@ func (c *serviceClient) SrSetEncapHopLimit(ctx context.Context, in *SrSetEncapHo if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SrSetEncapSource(ctx context.Context, in *SrSetEncapSource) (*SrSetEncapSourceReply, error) { @@ -162,7 +162,7 @@ func (c *serviceClient) SrSetEncapSource(ctx context.Context, in *SrSetEncapSour if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SrSteeringAddDel(ctx context.Context, in *SrSteeringAddDel) (*SrSteeringAddDelReply, error) { @@ -171,7 +171,7 @@ func (c *serviceClient) SrSteeringAddDel(ctx context.Context, in *SrSteeringAddD if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SrSteeringPolDump(ctx context.Context, in *SrSteeringPolDump) (RPCService_SrSteeringPolDumpClient, error) { diff --git a/binapi/sr_mpls/sr_mpls.ba.go b/binapi/sr_mpls/sr_mpls.ba.go index e6bd9f0..62ef1a6 100644 --- a/binapi/sr_mpls/sr_mpls.ba.go +++ b/binapi/sr_mpls/sr_mpls.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/core/sr_mpls.api.json // Package sr_mpls contains generated bindings for API file sr_mpls.api. diff --git a/binapi/sr_mpls/sr_mpls_rest.ba.go b/binapi/sr_mpls/sr_mpls_rest.ba.go deleted file mode 100644 index 85edbf0..0000000 --- a/binapi/sr_mpls/sr_mpls_rest.ba.go +++ /dev/null @@ -1,129 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package sr_mpls - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/sr_mpls_policy_add", func(w http.ResponseWriter, req *http.Request) { - var request = new(SrMplsPolicyAdd) - 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.SrMplsPolicyAdd(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("/sr_mpls_policy_assign_endpoint_color", func(w http.ResponseWriter, req *http.Request) { - var request = new(SrMplsPolicyAssignEndpointColor) - 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.SrMplsPolicyAssignEndpointColor(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("/sr_mpls_policy_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(SrMplsPolicyDel) - 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.SrMplsPolicyDel(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("/sr_mpls_policy_mod", func(w http.ResponseWriter, req *http.Request) { - var request = new(SrMplsPolicyMod) - 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.SrMplsPolicyMod(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("/sr_mpls_steering_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(SrMplsSteeringAddDel) - 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.SrMplsSteeringAddDel(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/sr_mpls/sr_mpls_rpc.ba.go b/binapi/sr_mpls/sr_mpls_rpc.ba.go index ec0f46d..556d32e 100644 --- a/binapi/sr_mpls/sr_mpls_rpc.ba.go +++ b/binapi/sr_mpls/sr_mpls_rpc.ba.go @@ -8,7 +8,7 @@ import ( api "git.fd.io/govpp.git/api" ) -// RPCService defines RPC service sr_mpls. +// RPCService defines RPC service sr_mpls. type RPCService interface { SrMplsPolicyAdd(ctx context.Context, in *SrMplsPolicyAdd) (*SrMplsPolicyAddReply, error) SrMplsPolicyAssignEndpointColor(ctx context.Context, in *SrMplsPolicyAssignEndpointColor) (*SrMplsPolicyAssignEndpointColorReply, error) @@ -31,7 +31,7 @@ func (c *serviceClient) SrMplsPolicyAdd(ctx context.Context, in *SrMplsPolicyAdd if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SrMplsPolicyAssignEndpointColor(ctx context.Context, in *SrMplsPolicyAssignEndpointColor) (*SrMplsPolicyAssignEndpointColorReply, error) { @@ -40,7 +40,7 @@ func (c *serviceClient) SrMplsPolicyAssignEndpointColor(ctx context.Context, in if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SrMplsPolicyDel(ctx context.Context, in *SrMplsPolicyDel) (*SrMplsPolicyDelReply, error) { @@ -49,7 +49,7 @@ func (c *serviceClient) SrMplsPolicyDel(ctx context.Context, in *SrMplsPolicyDel if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SrMplsPolicyMod(ctx context.Context, in *SrMplsPolicyMod) (*SrMplsPolicyModReply, error) { @@ -58,7 +58,7 @@ func (c *serviceClient) SrMplsPolicyMod(ctx context.Context, in *SrMplsPolicyMod if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SrMplsSteeringAddDel(ctx context.Context, in *SrMplsSteeringAddDel) (*SrMplsSteeringAddDelReply, error) { @@ -67,5 +67,5 @@ func (c *serviceClient) SrMplsSteeringAddDel(ctx context.Context, in *SrMplsStee if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/sr_types/sr_types.ba.go b/binapi/sr_types/sr_types.ba.go index 7a2007e..1b3ee75 100644 --- a/binapi/sr_types/sr_types.ba.go +++ b/binapi/sr_types/sr_types.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/core/sr_types.api.json // Package sr_types contains generated bindings for API file sr_types.api. diff --git a/binapi/stn/stn.ba.go b/binapi/stn/stn.ba.go index b44adf5..dbdf0ca 100644 --- a/binapi/stn/stn.ba.go +++ b/binapi/stn/stn.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/stn.api.json // Package stn contains generated bindings for API file stn.api. diff --git a/binapi/stn/stn_rest.ba.go b/binapi/stn/stn_rest.ba.go deleted file mode 100644 index 826aee9..0000000 --- a/binapi/stn/stn_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package stn - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/stn_add_del_rule", func(w http.ResponseWriter, req *http.Request) { - var request = new(StnAddDelRule) - 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.StnAddDelRule(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/stn/stn_rpc.ba.go b/binapi/stn/stn_rpc.ba.go index 4cc7087..c3dacf8 100644 --- a/binapi/stn/stn_rpc.ba.go +++ b/binapi/stn/stn_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service stn. +// RPCService defines RPC service stn. type RPCService interface { StnAddDelRule(ctx context.Context, in *StnAddDelRule) (*StnAddDelRuleReply, error) StnRulesDump(ctx context.Context, in *StnRulesDump) (RPCService_StnRulesDumpClient, error) @@ -31,7 +31,7 @@ func (c *serviceClient) StnAddDelRule(ctx context.Context, in *StnAddDelRule) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) StnRulesDump(ctx context.Context, in *StnRulesDump) (RPCService_StnRulesDumpClient, error) { diff --git a/binapi/svs/svs.ba.go b/binapi/svs/svs.ba.go index 911e936..1f65a76 100644 --- a/binapi/svs/svs.ba.go +++ b/binapi/svs/svs.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/svs.api.json // Package svs contains generated bindings for API file svs.api. diff --git a/binapi/svs/svs_rest.ba.go b/binapi/svs/svs_rest.ba.go deleted file mode 100644 index 4293223..0000000 --- a/binapi/svs/svs_rest.ba.go +++ /dev/null @@ -1,97 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package svs - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/svs_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(SvsEnableDisable) - 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.SvsEnableDisable(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("/svs_plugin_get_version", func(w http.ResponseWriter, req *http.Request) { - var request = new(SvsPluginGetVersion) - reply, err := rpc.SvsPluginGetVersion(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("/svs_route_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(SvsRouteAddDel) - 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.SvsRouteAddDel(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("/svs_table_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(SvsTableAddDel) - 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.SvsTableAddDel(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/svs/svs_rpc.ba.go b/binapi/svs/svs_rpc.ba.go index 3de2a03..4d344a1 100644 --- a/binapi/svs/svs_rpc.ba.go +++ b/binapi/svs/svs_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service svs. +// RPCService defines RPC service svs. type RPCService interface { SvsDump(ctx context.Context, in *SvsDump) (RPCService_SvsDumpClient, error) SvsEnableDisable(ctx context.Context, in *SvsEnableDisable) (*SvsEnableDisableReply, error) @@ -73,7 +73,7 @@ func (c *serviceClient) SvsEnableDisable(ctx context.Context, in *SvsEnableDisab if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SvsPluginGetVersion(ctx context.Context, in *SvsPluginGetVersion) (*SvsPluginGetVersionReply, error) { @@ -91,7 +91,7 @@ func (c *serviceClient) SvsRouteAddDel(ctx context.Context, in *SvsRouteAddDel) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SvsTableAddDel(ctx context.Context, in *SvsTableAddDel) (*SvsTableAddDelReply, error) { @@ -100,5 +100,5 @@ func (c *serviceClient) SvsTableAddDel(ctx context.Context, in *SvsTableAddDel) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/syslog/syslog.ba.go b/binapi/syslog/syslog.ba.go index cf8f754..e3b7ef5 100644 --- a/binapi/syslog/syslog.ba.go +++ b/binapi/syslog/syslog.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/core/syslog.api.json // Package syslog contains generated bindings for API file syslog.api. diff --git a/binapi/syslog/syslog_rest.ba.go b/binapi/syslog/syslog_rest.ba.go deleted file mode 100644 index e9098e8..0000000 --- a/binapi/syslog/syslog_rest.ba.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package syslog - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/syslog_get_filter", func(w http.ResponseWriter, req *http.Request) { - var request = new(SyslogGetFilter) - reply, err := rpc.SyslogGetFilter(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("/syslog_get_sender", func(w http.ResponseWriter, req *http.Request) { - var request = new(SyslogGetSender) - reply, err := rpc.SyslogGetSender(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("/syslog_set_filter", func(w http.ResponseWriter, req *http.Request) { - var request = new(SyslogSetFilter) - 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.SyslogSetFilter(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("/syslog_set_sender", func(w http.ResponseWriter, req *http.Request) { - var request = new(SyslogSetSender) - 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.SyslogSetSender(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/syslog/syslog_rpc.ba.go b/binapi/syslog/syslog_rpc.ba.go index 385960f..da005b3 100644 --- a/binapi/syslog/syslog_rpc.ba.go +++ b/binapi/syslog/syslog_rpc.ba.go @@ -8,7 +8,7 @@ import ( api "git.fd.io/govpp.git/api" ) -// RPCService defines RPC service syslog. +// RPCService defines RPC service syslog. type RPCService interface { SyslogGetFilter(ctx context.Context, in *SyslogGetFilter) (*SyslogGetFilterReply, error) SyslogGetSender(ctx context.Context, in *SyslogGetSender) (*SyslogGetSenderReply, error) @@ -30,7 +30,7 @@ func (c *serviceClient) SyslogGetFilter(ctx context.Context, in *SyslogGetFilter if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SyslogGetSender(ctx context.Context, in *SyslogGetSender) (*SyslogGetSenderReply, error) { @@ -39,7 +39,7 @@ func (c *serviceClient) SyslogGetSender(ctx context.Context, in *SyslogGetSender if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SyslogSetFilter(ctx context.Context, in *SyslogSetFilter) (*SyslogSetFilterReply, error) { @@ -48,7 +48,7 @@ func (c *serviceClient) SyslogSetFilter(ctx context.Context, in *SyslogSetFilter if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SyslogSetSender(ctx context.Context, in *SyslogSetSender) (*SyslogSetSenderReply, error) { @@ -57,5 +57,5 @@ func (c *serviceClient) SyslogSetSender(ctx context.Context, in *SyslogSetSender if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/tapv2/tapv2.ba.go b/binapi/tapv2/tapv2.ba.go index 028ff67..db9f4ba 100644 --- a/binapi/tapv2/tapv2.ba.go +++ b/binapi/tapv2/tapv2.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/core/tapv2.api.json // Package tapv2 contains generated bindings for API file tapv2.api. diff --git a/binapi/tapv2/tapv2_rest.ba.go b/binapi/tapv2/tapv2_rest.ba.go deleted file mode 100644 index b1d1111..0000000 --- a/binapi/tapv2/tapv2_rest.ba.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package tapv2 - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/tap_create_v2", func(w http.ResponseWriter, req *http.Request) { - var request = new(TapCreateV2) - 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.TapCreateV2(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("/tap_delete_v2", func(w http.ResponseWriter, req *http.Request) { - var request = new(TapDeleteV2) - 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.TapDeleteV2(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/tapv2/tapv2_rpc.ba.go b/binapi/tapv2/tapv2_rpc.ba.go index 7742fd3..3b58f9d 100644 --- a/binapi/tapv2/tapv2_rpc.ba.go +++ b/binapi/tapv2/tapv2_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service tapv2. +// RPCService defines RPC service tapv2. type RPCService interface { SwInterfaceTapV2Dump(ctx context.Context, in *SwInterfaceTapV2Dump) (RPCService_SwInterfaceTapV2DumpClient, error) TapCreateV2(ctx context.Context, in *TapCreateV2) (*TapCreateV2Reply, error) @@ -71,7 +71,7 @@ func (c *serviceClient) TapCreateV2(ctx context.Context, in *TapCreateV2) (*TapC if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) TapDeleteV2(ctx context.Context, in *TapDeleteV2) (*TapDeleteV2Reply, error) { @@ -80,5 +80,5 @@ func (c *serviceClient) TapDeleteV2(ctx context.Context, in *TapDeleteV2) (*TapD if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/tcp/tcp.ba.go b/binapi/tcp/tcp.ba.go index 7ae3ecc..bfa9df7 100644 --- a/binapi/tcp/tcp.ba.go +++ b/binapi/tcp/tcp.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/core/tcp.api.json // Package tcp contains generated bindings for API file tcp.api. diff --git a/binapi/tcp/tcp_rest.ba.go b/binapi/tcp/tcp_rest.ba.go deleted file mode 100644 index 8fa0b79..0000000 --- a/binapi/tcp/tcp_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package tcp - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/tcp_configure_src_addresses", func(w http.ResponseWriter, req *http.Request) { - var request = new(TCPConfigureSrcAddresses) - 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.TCPConfigureSrcAddresses(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/tcp/tcp_rpc.ba.go b/binapi/tcp/tcp_rpc.ba.go index a87c7e5..2d045f7 100644 --- a/binapi/tcp/tcp_rpc.ba.go +++ b/binapi/tcp/tcp_rpc.ba.go @@ -8,7 +8,7 @@ import ( api "git.fd.io/govpp.git/api" ) -// RPCService defines RPC service tcp. +// RPCService defines RPC service tcp. type RPCService interface { TCPConfigureSrcAddresses(ctx context.Context, in *TCPConfigureSrcAddresses) (*TCPConfigureSrcAddressesReply, error) } @@ -27,5 +27,5 @@ func (c *serviceClient) TCPConfigureSrcAddresses(ctx context.Context, in *TCPCon if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/teib/teib.ba.go b/binapi/teib/teib.ba.go index d37f391..6a10688 100644 --- a/binapi/teib/teib.ba.go +++ b/binapi/teib/teib.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/core/teib.api.json // Package teib contains generated bindings for API file teib.api. diff --git a/binapi/teib/teib_rest.ba.go b/binapi/teib/teib_rest.ba.go deleted file mode 100644 index fb8bc17..0000000 --- a/binapi/teib/teib_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package teib - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/teib_entry_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(TeibEntryAddDel) - 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.TeibEntryAddDel(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/teib/teib_rpc.ba.go b/binapi/teib/teib_rpc.ba.go index 579f9e5..87fcdcd 100644 --- a/binapi/teib/teib_rpc.ba.go +++ b/binapi/teib/teib_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service teib. +// RPCService defines RPC service teib. type RPCService interface { TeibDump(ctx context.Context, in *TeibDump) (RPCService_TeibDumpClient, error) TeibEntryAddDel(ctx context.Context, in *TeibEntryAddDel) (*TeibEntryAddDelReply, error) @@ -70,5 +70,5 @@ func (c *serviceClient) TeibEntryAddDel(ctx context.Context, in *TeibEntryAddDel if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/tls_openssl/tls_openssl.ba.go b/binapi/tls_openssl/tls_openssl.ba.go index 938a9df..5a406b0 100644 --- a/binapi/tls_openssl/tls_openssl.ba.go +++ b/binapi/tls_openssl/tls_openssl.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/tls_openssl.api.json // Package tls_openssl contains generated bindings for API file tls_openssl.api. diff --git a/binapi/tls_openssl/tls_openssl_rest.ba.go b/binapi/tls_openssl/tls_openssl_rest.ba.go deleted file mode 100644 index bfabb43..0000000 --- a/binapi/tls_openssl/tls_openssl_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package tls_openssl - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/tls_openssl_set_engine", func(w http.ResponseWriter, req *http.Request) { - var request = new(TLSOpensslSetEngine) - 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.TLSOpensslSetEngine(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/tls_openssl/tls_openssl_rpc.ba.go b/binapi/tls_openssl/tls_openssl_rpc.ba.go index 69a5de5..57ef26d 100644 --- a/binapi/tls_openssl/tls_openssl_rpc.ba.go +++ b/binapi/tls_openssl/tls_openssl_rpc.ba.go @@ -8,7 +8,7 @@ import ( api "git.fd.io/govpp.git/api" ) -// RPCService defines RPC service tls_openssl. +// RPCService defines RPC service tls_openssl. type RPCService interface { TLSOpensslSetEngine(ctx context.Context, in *TLSOpensslSetEngine) (*TLSOpensslSetEngineReply, error) } @@ -27,5 +27,5 @@ func (c *serviceClient) TLSOpensslSetEngine(ctx context.Context, in *TLSOpensslS if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/trace/trace.ba.go b/binapi/trace/trace.ba.go index 9bc330b..a789b4f 100644 --- a/binapi/trace/trace.ba.go +++ b/binapi/trace/trace.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/trace.api.json // Package trace contains generated bindings for API file trace.api. diff --git a/binapi/trace/trace_rest.ba.go b/binapi/trace/trace_rest.ba.go deleted file mode 100644 index d7d2244..0000000 --- a/binapi/trace/trace_rest.ba.go +++ /dev/null @@ -1,65 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package trace - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/trace_profile_add", func(w http.ResponseWriter, req *http.Request) { - var request = new(TraceProfileAdd) - 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.TraceProfileAdd(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("/trace_profile_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(TraceProfileDel) - reply, err := rpc.TraceProfileDel(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("/trace_profile_show_config", func(w http.ResponseWriter, req *http.Request) { - var request = new(TraceProfileShowConfig) - reply, err := rpc.TraceProfileShowConfig(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/trace/trace_rpc.ba.go b/binapi/trace/trace_rpc.ba.go index 09bf889..e3f1eca 100644 --- a/binapi/trace/trace_rpc.ba.go +++ b/binapi/trace/trace_rpc.ba.go @@ -8,7 +8,7 @@ import ( api "git.fd.io/govpp.git/api" ) -// RPCService defines RPC service trace. +// RPCService defines RPC service trace. type RPCService interface { TraceProfileAdd(ctx context.Context, in *TraceProfileAdd) (*TraceProfileAddReply, error) TraceProfileDel(ctx context.Context, in *TraceProfileDel) (*TraceProfileDelReply, error) @@ -29,7 +29,7 @@ func (c *serviceClient) TraceProfileAdd(ctx context.Context, in *TraceProfileAdd if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) TraceProfileDel(ctx context.Context, in *TraceProfileDel) (*TraceProfileDelReply, error) { @@ -38,7 +38,7 @@ func (c *serviceClient) TraceProfileDel(ctx context.Context, in *TraceProfileDel if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) TraceProfileShowConfig(ctx context.Context, in *TraceProfileShowConfig) (*TraceProfileShowConfigReply, error) { @@ -47,5 +47,5 @@ func (c *serviceClient) TraceProfileShowConfig(ctx context.Context, in *TracePro if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/tunnel_types/tunnel_types.ba.go b/binapi/tunnel_types/tunnel_types.ba.go index a79ee18..3fff34c 100644 --- a/binapi/tunnel_types/tunnel_types.ba.go +++ b/binapi/tunnel_types/tunnel_types.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/core/tunnel_types.api.json // Package tunnel_types contains generated bindings for API file tunnel_types.api. diff --git a/binapi/udp/udp.ba.go b/binapi/udp/udp.ba.go index 7795100..bb2924c 100644 --- a/binapi/udp/udp.ba.go +++ b/binapi/udp/udp.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/core/udp.api.json // Package udp contains generated bindings for API file udp.api. diff --git a/binapi/udp/udp_rest.ba.go b/binapi/udp/udp_rest.ba.go deleted file mode 100644 index fc584bb..0000000 --- a/binapi/udp/udp_rest.ba.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package udp - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/udp_encap_add", func(w http.ResponseWriter, req *http.Request) { - var request = new(UDPEncapAdd) - 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.UDPEncapAdd(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("/udp_encap_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(UDPEncapDel) - 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.UDPEncapDel(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/udp/udp_rpc.ba.go b/binapi/udp/udp_rpc.ba.go index 8d99214..0b17c63 100644 --- a/binapi/udp/udp_rpc.ba.go +++ b/binapi/udp/udp_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service udp. +// RPCService defines RPC service udp. type RPCService interface { UDPEncapAdd(ctx context.Context, in *UDPEncapAdd) (*UDPEncapAddReply, error) UDPEncapDel(ctx context.Context, in *UDPEncapDel) (*UDPEncapDelReply, error) @@ -32,7 +32,7 @@ func (c *serviceClient) UDPEncapAdd(ctx context.Context, in *UDPEncapAdd) (*UDPE if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) UDPEncapDel(ctx context.Context, in *UDPEncapDel) (*UDPEncapDelReply, error) { @@ -41,7 +41,7 @@ func (c *serviceClient) UDPEncapDel(ctx context.Context, in *UDPEncapDel) (*UDPE if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) UDPEncapDump(ctx context.Context, in *UDPEncapDump) (RPCService_UDPEncapDumpClient, error) { diff --git a/binapi/udp_ping/udp_ping.ba.go b/binapi/udp_ping/udp_ping.ba.go index 7247b38..a568fce 100644 --- a/binapi/udp_ping/udp_ping.ba.go +++ b/binapi/udp_ping/udp_ping.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/udp_ping.api.json // Package udp_ping contains generated bindings for API file udp_ping.api. diff --git a/binapi/udp_ping/udp_ping_rest.ba.go b/binapi/udp_ping/udp_ping_rest.ba.go deleted file mode 100644 index 41317c4..0000000 --- a/binapi/udp_ping/udp_ping_rest.ba.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package udp_ping - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/udp_ping_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(UDPPingAddDel) - 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.UDPPingAddDel(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("/udp_ping_export", func(w http.ResponseWriter, req *http.Request) { - var request = new(UDPPingExport) - 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.UDPPingExport(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/udp_ping/udp_ping_rpc.ba.go b/binapi/udp_ping/udp_ping_rpc.ba.go index 4aa51f6..3b01ff7 100644 --- a/binapi/udp_ping/udp_ping_rpc.ba.go +++ b/binapi/udp_ping/udp_ping_rpc.ba.go @@ -8,7 +8,7 @@ import ( api "git.fd.io/govpp.git/api" ) -// RPCService defines RPC service udp_ping. +// RPCService defines RPC service udp_ping. type RPCService interface { UDPPingAddDel(ctx context.Context, in *UDPPingAddDel) (*UDPPingAddDelReply, error) UDPPingExport(ctx context.Context, in *UDPPingExport) (*UDPPingExportReply, error) @@ -28,7 +28,7 @@ func (c *serviceClient) UDPPingAddDel(ctx context.Context, in *UDPPingAddDel) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) UDPPingExport(ctx context.Context, in *UDPPingExport) (*UDPPingExportReply, error) { @@ -37,5 +37,5 @@ func (c *serviceClient) UDPPingExport(ctx context.Context, in *UDPPingExport) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/urpf/urpf.ba.go b/binapi/urpf/urpf.ba.go index e277537..62a335c 100644 --- a/binapi/urpf/urpf.ba.go +++ b/binapi/urpf/urpf.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/urpf.api.json // Package urpf contains generated bindings for API file urpf.api. diff --git a/binapi/urpf/urpf_rest.ba.go b/binapi/urpf/urpf_rest.ba.go deleted file mode 100644 index cbe7875..0000000 --- a/binapi/urpf/urpf_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package urpf - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/urpf_update", func(w http.ResponseWriter, req *http.Request) { - var request = new(UrpfUpdate) - 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.UrpfUpdate(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/urpf/urpf_rpc.ba.go b/binapi/urpf/urpf_rpc.ba.go index 04d4b56..ef10d4b 100644 --- a/binapi/urpf/urpf_rpc.ba.go +++ b/binapi/urpf/urpf_rpc.ba.go @@ -8,7 +8,7 @@ import ( api "git.fd.io/govpp.git/api" ) -// RPCService defines RPC service urpf. +// RPCService defines RPC service urpf. type RPCService interface { UrpfUpdate(ctx context.Context, in *UrpfUpdate) (*UrpfUpdateReply, error) } @@ -27,5 +27,5 @@ func (c *serviceClient) UrpfUpdate(ctx context.Context, in *UrpfUpdate) (*UrpfUp if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/vhost_user/vhost_user.ba.go b/binapi/vhost_user/vhost_user.ba.go index 0ca7119..f5fbdd5 100644 --- a/binapi/vhost_user/vhost_user.ba.go +++ b/binapi/vhost_user/vhost_user.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/core/vhost_user.api.json // Package vhost_user contains generated bindings for API file vhost_user.api. diff --git a/binapi/vhost_user/vhost_user_rest.ba.go b/binapi/vhost_user/vhost_user_rest.ba.go deleted file mode 100644 index c2f687b..0000000 --- a/binapi/vhost_user/vhost_user_rest.ba.go +++ /dev/null @@ -1,83 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package vhost_user - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/create_vhost_user_if", func(w http.ResponseWriter, req *http.Request) { - var request = new(CreateVhostUserIf) - 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.CreateVhostUserIf(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("/delete_vhost_user_if", func(w http.ResponseWriter, req *http.Request) { - var request = new(DeleteVhostUserIf) - 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.DeleteVhostUserIf(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("/modify_vhost_user_if", func(w http.ResponseWriter, req *http.Request) { - var request = new(ModifyVhostUserIf) - 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.ModifyVhostUserIf(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/vhost_user/vhost_user_rpc.ba.go b/binapi/vhost_user/vhost_user_rpc.ba.go index 6e18a51..445e2eb 100644 --- a/binapi/vhost_user/vhost_user_rpc.ba.go +++ b/binapi/vhost_user/vhost_user_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service vhost_user. +// RPCService defines RPC service vhost_user. type RPCService interface { CreateVhostUserIf(ctx context.Context, in *CreateVhostUserIf) (*CreateVhostUserIfReply, error) DeleteVhostUserIf(ctx context.Context, in *DeleteVhostUserIf) (*DeleteVhostUserIfReply, error) @@ -33,7 +33,7 @@ func (c *serviceClient) CreateVhostUserIf(ctx context.Context, in *CreateVhostUs if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) DeleteVhostUserIf(ctx context.Context, in *DeleteVhostUserIf) (*DeleteVhostUserIfReply, error) { @@ -42,7 +42,7 @@ func (c *serviceClient) DeleteVhostUserIf(ctx context.Context, in *DeleteVhostUs if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ModifyVhostUserIf(ctx context.Context, in *ModifyVhostUserIf) (*ModifyVhostUserIfReply, error) { @@ -51,7 +51,7 @@ func (c *serviceClient) ModifyVhostUserIf(ctx context.Context, in *ModifyVhostUs if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) SwInterfaceVhostUserDump(ctx context.Context, in *SwInterfaceVhostUserDump) (RPCService_SwInterfaceVhostUserDumpClient, error) { diff --git a/binapi/virtio/virtio.ba.go b/binapi/virtio/virtio.ba.go index b29b52f..6234a17 100644 --- a/binapi/virtio/virtio.ba.go +++ b/binapi/virtio/virtio.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/core/virtio.api.json // Package virtio contains generated bindings for API file virtio.api. diff --git a/binapi/virtio/virtio_rest.ba.go b/binapi/virtio/virtio_rest.ba.go deleted file mode 100644 index bd97059..0000000 --- a/binapi/virtio/virtio_rest.ba.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package virtio - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/virtio_pci_create", func(w http.ResponseWriter, req *http.Request) { - var request = new(VirtioPciCreate) - 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.VirtioPciCreate(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("/virtio_pci_delete", func(w http.ResponseWriter, req *http.Request) { - var request = new(VirtioPciDelete) - 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.VirtioPciDelete(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/virtio/virtio_rpc.ba.go b/binapi/virtio/virtio_rpc.ba.go index 4fa4bb1..4ee8ff7 100644 --- a/binapi/virtio/virtio_rpc.ba.go +++ b/binapi/virtio/virtio_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service virtio. +// RPCService defines RPC service virtio. type RPCService interface { SwInterfaceVirtioPciDump(ctx context.Context, in *SwInterfaceVirtioPciDump) (RPCService_SwInterfaceVirtioPciDumpClient, error) VirtioPciCreate(ctx context.Context, in *VirtioPciCreate) (*VirtioPciCreateReply, error) @@ -71,7 +71,7 @@ func (c *serviceClient) VirtioPciCreate(ctx context.Context, in *VirtioPciCreate if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) VirtioPciDelete(ctx context.Context, in *VirtioPciDelete) (*VirtioPciDeleteReply, error) { @@ -80,5 +80,5 @@ func (c *serviceClient) VirtioPciDelete(ctx context.Context, in *VirtioPciDelete if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/virtio_types/virtio_types.ba.go b/binapi/virtio_types/virtio_types.ba.go index d78740a..587d7c5 100644 --- a/binapi/virtio_types/virtio_types.ba.go +++ b/binapi/virtio_types/virtio_types.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/core/virtio_types.api.json // Package virtio_types contains generated bindings for API file virtio_types.api. diff --git a/binapi/vmxnet3/vmxnet3.ba.go b/binapi/vmxnet3/vmxnet3.ba.go index 77937fa..5aca3c9 100644 --- a/binapi/vmxnet3/vmxnet3.ba.go +++ b/binapi/vmxnet3/vmxnet3.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/vmxnet3.api.json // Package vmxnet3 contains generated bindings for API file vmxnet3.api. diff --git a/binapi/vmxnet3/vmxnet3_rest.ba.go b/binapi/vmxnet3/vmxnet3_rest.ba.go deleted file mode 100644 index 3280f8c..0000000 --- a/binapi/vmxnet3/vmxnet3_rest.ba.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package vmxnet3 - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/vmxnet3_create", func(w http.ResponseWriter, req *http.Request) { - var request = new(Vmxnet3Create) - 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.Vmxnet3Create(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("/vmxnet3_delete", func(w http.ResponseWriter, req *http.Request) { - var request = new(Vmxnet3Delete) - 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.Vmxnet3Delete(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/vmxnet3/vmxnet3_rpc.ba.go b/binapi/vmxnet3/vmxnet3_rpc.ba.go index facc468..a05819c 100644 --- a/binapi/vmxnet3/vmxnet3_rpc.ba.go +++ b/binapi/vmxnet3/vmxnet3_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service vmxnet3. +// RPCService defines RPC service vmxnet3. type RPCService interface { Vmxnet3Create(ctx context.Context, in *Vmxnet3Create) (*Vmxnet3CreateReply, error) Vmxnet3Delete(ctx context.Context, in *Vmxnet3Delete) (*Vmxnet3DeleteReply, error) @@ -32,7 +32,7 @@ func (c *serviceClient) Vmxnet3Create(ctx context.Context, in *Vmxnet3Create) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Vmxnet3Delete(ctx context.Context, in *Vmxnet3Delete) (*Vmxnet3DeleteReply, error) { @@ -41,7 +41,7 @@ func (c *serviceClient) Vmxnet3Delete(ctx context.Context, in *Vmxnet3Delete) (* if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Vmxnet3Dump(ctx context.Context, in *Vmxnet3Dump) (RPCService_Vmxnet3DumpClient, error) { diff --git a/binapi/vpe/vpe.ba.go b/binapi/vpe/vpe.ba.go index 046bd68..656a68a 100644 --- a/binapi/vpe/vpe.ba.go +++ b/binapi/vpe/vpe.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/core/vpe.api.json // Package vpe contains generated bindings for API file vpe.api. diff --git a/binapi/vpe/vpe_rest.ba.go b/binapi/vpe/vpe_rest.ba.go deleted file mode 100644 index 2f92a62..0000000 --- a/binapi/vpe/vpe_rest.ba.go +++ /dev/null @@ -1,245 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package vpe - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/add_node_next", func(w http.ResponseWriter, req *http.Request) { - var request = new(AddNodeNext) - 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.AddNodeNext(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("/cli", func(w http.ResponseWriter, req *http.Request) { - var request = new(Cli) - 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.Cli(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("/cli_inband", func(w http.ResponseWriter, req *http.Request) { - var request = new(CliInband) - 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.CliInband(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("/control_ping", func(w http.ResponseWriter, req *http.Request) { - var request = new(ControlPing) - reply, err := rpc.ControlPing(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("/get_f64_endian_value", func(w http.ResponseWriter, req *http.Request) { - var request = new(GetF64EndianValue) - 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.GetF64EndianValue(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("/get_f64_increment_by_one", func(w http.ResponseWriter, req *http.Request) { - var request = new(GetF64IncrementByOne) - 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.GetF64IncrementByOne(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("/get_next_index", func(w http.ResponseWriter, req *http.Request) { - var request = new(GetNextIndex) - 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.GetNextIndex(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("/get_node_graph", func(w http.ResponseWriter, req *http.Request) { - var request = new(GetNodeGraph) - reply, err := rpc.GetNodeGraph(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("/get_node_index", func(w http.ResponseWriter, req *http.Request) { - var request = new(GetNodeIndex) - 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.GetNodeIndex(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("/show_threads", func(w http.ResponseWriter, req *http.Request) { - var request = new(ShowThreads) - reply, err := rpc.ShowThreads(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("/show_version", func(w http.ResponseWriter, req *http.Request) { - var request = new(ShowVersion) - reply, err := rpc.ShowVersion(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("/show_vpe_system_time", func(w http.ResponseWriter, req *http.Request) { - var request = new(ShowVpeSystemTime) - reply, err := rpc.ShowVpeSystemTime(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/vpe/vpe_rpc.ba.go b/binapi/vpe/vpe_rpc.ba.go index e41f5f8..fd3901b 100644 --- a/binapi/vpe/vpe_rpc.ba.go +++ b/binapi/vpe/vpe_rpc.ba.go @@ -10,7 +10,7 @@ import ( api "git.fd.io/govpp.git/api" ) -// RPCService defines RPC service vpe. +// RPCService defines RPC service vpe. type RPCService interface { AddNodeNext(ctx context.Context, in *AddNodeNext) (*AddNodeNextReply, error) Cli(ctx context.Context, in *Cli) (*CliReply, error) @@ -41,7 +41,7 @@ func (c *serviceClient) AddNodeNext(ctx context.Context, in *AddNodeNext) (*AddN if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) Cli(ctx context.Context, in *Cli) (*CliReply, error) { @@ -50,7 +50,7 @@ func (c *serviceClient) Cli(ctx context.Context, in *Cli) (*CliReply, error) { if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) CliInband(ctx context.Context, in *CliInband) (*CliInbandReply, error) { @@ -59,7 +59,7 @@ func (c *serviceClient) CliInband(ctx context.Context, in *CliInband) (*CliInban if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ControlPing(ctx context.Context, in *ControlPing) (*ControlPingReply, error) { @@ -68,7 +68,7 @@ func (c *serviceClient) ControlPing(ctx context.Context, in *ControlPing) (*Cont if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GetF64EndianValue(ctx context.Context, in *GetF64EndianValue) (*GetF64EndianValueReply, error) { @@ -77,7 +77,7 @@ func (c *serviceClient) GetF64EndianValue(ctx context.Context, in *GetF64EndianV if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(int32(out.Retval)) } func (c *serviceClient) GetF64IncrementByOne(ctx context.Context, in *GetF64IncrementByOne) (*GetF64IncrementByOneReply, error) { @@ -86,7 +86,7 @@ func (c *serviceClient) GetF64IncrementByOne(ctx context.Context, in *GetF64Incr if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(int32(out.Retval)) } func (c *serviceClient) GetNextIndex(ctx context.Context, in *GetNextIndex) (*GetNextIndexReply, error) { @@ -95,7 +95,7 @@ func (c *serviceClient) GetNextIndex(ctx context.Context, in *GetNextIndex) (*Ge if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GetNodeGraph(ctx context.Context, in *GetNodeGraph) (*GetNodeGraphReply, error) { @@ -104,7 +104,7 @@ func (c *serviceClient) GetNodeGraph(ctx context.Context, in *GetNodeGraph) (*Ge if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) GetNodeIndex(ctx context.Context, in *GetNodeIndex) (*GetNodeIndexReply, error) { @@ -113,7 +113,7 @@ func (c *serviceClient) GetNodeIndex(ctx context.Context, in *GetNodeIndex) (*Ge if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) LogDump(ctx context.Context, in *LogDump) (RPCService_LogDumpClient, error) { @@ -161,7 +161,7 @@ func (c *serviceClient) ShowThreads(ctx context.Context, in *ShowThreads) (*Show if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ShowVersion(ctx context.Context, in *ShowVersion) (*ShowVersionReply, error) { @@ -170,7 +170,7 @@ func (c *serviceClient) ShowVersion(ctx context.Context, in *ShowVersion) (*Show if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) ShowVpeSystemTime(ctx context.Context, in *ShowVpeSystemTime) (*ShowVpeSystemTimeReply, error) { @@ -179,5 +179,5 @@ func (c *serviceClient) ShowVpeSystemTime(ctx context.Context, in *ShowVpeSystem if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapi/vpe_types/vpe_types.ba.go b/binapi/vpe_types/vpe_types.ba.go index f1d21b0..473880d 100644 --- a/binapi/vpe_types/vpe_types.ba.go +++ b/binapi/vpe_types/vpe_types.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/core/vpe_types.api.json // Package vpe_types contains generated bindings for API file vpe_types.api. diff --git a/binapi/vrrp/vrrp.ba.go b/binapi/vrrp/vrrp.ba.go index b00f281..f9f33f6 100644 --- a/binapi/vrrp/vrrp.ba.go +++ b/binapi/vrrp/vrrp.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/vrrp.api.json // Package vrrp contains generated bindings for API file vrrp.api. diff --git a/binapi/vrrp/vrrp_rest.ba.go b/binapi/vrrp/vrrp_rest.ba.go deleted file mode 100644 index 35cedfe..0000000 --- a/binapi/vrrp/vrrp_rest.ba.go +++ /dev/null @@ -1,106 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package vrrp - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/vrrp_vr_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(VrrpVrAddDel) - 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.VrrpVrAddDel(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("/vrrp_vr_set_peers", func(w http.ResponseWriter, req *http.Request) { - var request = new(VrrpVrSetPeers) - 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.VrrpVrSetPeers(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("/vrrp_vr_start_stop", func(w http.ResponseWriter, req *http.Request) { - var request = new(VrrpVrStartStop) - 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.VrrpVrStartStop(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("/vrrp_vr_track_if_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(VrrpVrTrackIfAddDel) - 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.VrrpVrTrackIfAddDel(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/vrrp/vrrp_rpc.ba.go b/binapi/vrrp/vrrp_rpc.ba.go index 12be3c8..ae19b0f 100644 --- a/binapi/vrrp/vrrp_rpc.ba.go +++ b/binapi/vrrp/vrrp_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service vrrp. +// RPCService defines RPC service vrrp. type RPCService interface { VrrpVrAddDel(ctx context.Context, in *VrrpVrAddDel) (*VrrpVrAddDelReply, error) VrrpVrDump(ctx context.Context, in *VrrpVrDump) (RPCService_VrrpVrDumpClient, error) @@ -36,7 +36,7 @@ func (c *serviceClient) VrrpVrAddDel(ctx context.Context, in *VrrpVrAddDel) (*Vr if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) VrrpVrDump(ctx context.Context, in *VrrpVrDump) (RPCService_VrrpVrDumpClient, error) { @@ -123,7 +123,7 @@ func (c *serviceClient) VrrpVrSetPeers(ctx context.Context, in *VrrpVrSetPeers) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) VrrpVrStartStop(ctx context.Context, in *VrrpVrStartStop) (*VrrpVrStartStopReply, error) { @@ -132,7 +132,7 @@ func (c *serviceClient) VrrpVrStartStop(ctx context.Context, in *VrrpVrStartStop if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) VrrpVrTrackIfAddDel(ctx context.Context, in *VrrpVrTrackIfAddDel) (*VrrpVrTrackIfAddDelReply, error) { @@ -141,7 +141,7 @@ func (c *serviceClient) VrrpVrTrackIfAddDel(ctx context.Context, in *VrrpVrTrack if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) VrrpVrTrackIfDump(ctx context.Context, in *VrrpVrTrackIfDump) (RPCService_VrrpVrTrackIfDumpClient, error) { diff --git a/binapi/vxlan/vxlan.ba.go b/binapi/vxlan/vxlan.ba.go index 048b2fa..fe7c5fb 100644 --- a/binapi/vxlan/vxlan.ba.go +++ b/binapi/vxlan/vxlan.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/core/vxlan.api.json // Package vxlan contains generated bindings for API file vxlan.api. diff --git a/binapi/vxlan/vxlan_rest.ba.go b/binapi/vxlan/vxlan_rest.ba.go deleted file mode 100644 index ee35144..0000000 --- a/binapi/vxlan/vxlan_rest.ba.go +++ /dev/null @@ -1,83 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package vxlan - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/sw_interface_set_vxlan_bypass", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceSetVxlanBypass) - 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.SwInterfaceSetVxlanBypass(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("/vxlan_add_del_tunnel", func(w http.ResponseWriter, req *http.Request) { - var request = new(VxlanAddDelTunnel) - 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.VxlanAddDelTunnel(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("/vxlan_offload_rx", func(w http.ResponseWriter, req *http.Request) { - var request = new(VxlanOffloadRx) - 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.VxlanOffloadRx(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/vxlan/vxlan_rpc.ba.go b/binapi/vxlan/vxlan_rpc.ba.go index 34692bb..0ae30a5 100644 --- a/binapi/vxlan/vxlan_rpc.ba.go +++ b/binapi/vxlan/vxlan_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service vxlan. +// RPCService defines RPC service vxlan. type RPCService interface { SwInterfaceSetVxlanBypass(ctx context.Context, in *SwInterfaceSetVxlanBypass) (*SwInterfaceSetVxlanBypassReply, error) VxlanAddDelTunnel(ctx context.Context, in *VxlanAddDelTunnel) (*VxlanAddDelTunnelReply, error) @@ -33,7 +33,7 @@ func (c *serviceClient) SwInterfaceSetVxlanBypass(ctx context.Context, in *SwInt if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) VxlanAddDelTunnel(ctx context.Context, in *VxlanAddDelTunnel) (*VxlanAddDelTunnelReply, error) { @@ -42,7 +42,7 @@ func (c *serviceClient) VxlanAddDelTunnel(ctx context.Context, in *VxlanAddDelTu if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) VxlanOffloadRx(ctx context.Context, in *VxlanOffloadRx) (*VxlanOffloadRxReply, error) { @@ -51,7 +51,7 @@ func (c *serviceClient) VxlanOffloadRx(ctx context.Context, in *VxlanOffloadRx) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) VxlanTunnelDump(ctx context.Context, in *VxlanTunnelDump) (RPCService_VxlanTunnelDumpClient, error) { diff --git a/binapi/vxlan_gbp/vxlan_gbp.ba.go b/binapi/vxlan_gbp/vxlan_gbp.ba.go index 0876906..bd92319 100644 --- a/binapi/vxlan_gbp/vxlan_gbp.ba.go +++ b/binapi/vxlan_gbp/vxlan_gbp.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/core/vxlan_gbp.api.json // Package vxlan_gbp contains generated bindings for API file vxlan_gbp.api. diff --git a/binapi/vxlan_gbp/vxlan_gbp_rest.ba.go b/binapi/vxlan_gbp/vxlan_gbp_rest.ba.go deleted file mode 100644 index 5d94785..0000000 --- a/binapi/vxlan_gbp/vxlan_gbp_rest.ba.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package vxlan_gbp - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/sw_interface_set_vxlan_gbp_bypass", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceSetVxlanGbpBypass) - 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.SwInterfaceSetVxlanGbpBypass(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("/vxlan_gbp_tunnel_add_del", func(w http.ResponseWriter, req *http.Request) { - var request = new(VxlanGbpTunnelAddDel) - 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.VxlanGbpTunnelAddDel(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/vxlan_gbp/vxlan_gbp_rpc.ba.go b/binapi/vxlan_gbp/vxlan_gbp_rpc.ba.go index 403230a..c86edb9 100644 --- a/binapi/vxlan_gbp/vxlan_gbp_rpc.ba.go +++ b/binapi/vxlan_gbp/vxlan_gbp_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service vxlan_gbp. +// RPCService defines RPC service vxlan_gbp. type RPCService interface { SwInterfaceSetVxlanGbpBypass(ctx context.Context, in *SwInterfaceSetVxlanGbpBypass) (*SwInterfaceSetVxlanGbpBypassReply, error) VxlanGbpTunnelAddDel(ctx context.Context, in *VxlanGbpTunnelAddDel) (*VxlanGbpTunnelAddDelReply, error) @@ -32,7 +32,7 @@ func (c *serviceClient) SwInterfaceSetVxlanGbpBypass(ctx context.Context, in *Sw if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) VxlanGbpTunnelAddDel(ctx context.Context, in *VxlanGbpTunnelAddDel) (*VxlanGbpTunnelAddDelReply, error) { @@ -41,7 +41,7 @@ func (c *serviceClient) VxlanGbpTunnelAddDel(ctx context.Context, in *VxlanGbpTu if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) VxlanGbpTunnelDump(ctx context.Context, in *VxlanGbpTunnelDump) (RPCService_VxlanGbpTunnelDumpClient, error) { diff --git a/binapi/vxlan_gpe/vxlan_gpe.ba.go b/binapi/vxlan_gpe/vxlan_gpe.ba.go index 0858ada..f34c328 100644 --- a/binapi/vxlan_gpe/vxlan_gpe.ba.go +++ b/binapi/vxlan_gpe/vxlan_gpe.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/core/vxlan_gpe.api.json // Package vxlan_gpe contains generated bindings for API file vxlan_gpe.api. diff --git a/binapi/vxlan_gpe/vxlan_gpe_rest.ba.go b/binapi/vxlan_gpe/vxlan_gpe_rest.ba.go deleted file mode 100644 index 0761ca3..0000000 --- a/binapi/vxlan_gpe/vxlan_gpe_rest.ba.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package vxlan_gpe - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/sw_interface_set_vxlan_gpe_bypass", func(w http.ResponseWriter, req *http.Request) { - var request = new(SwInterfaceSetVxlanGpeBypass) - 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.SwInterfaceSetVxlanGpeBypass(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("/vxlan_gpe_add_del_tunnel", func(w http.ResponseWriter, req *http.Request) { - var request = new(VxlanGpeAddDelTunnel) - 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.VxlanGpeAddDelTunnel(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/vxlan_gpe/vxlan_gpe_rpc.ba.go b/binapi/vxlan_gpe/vxlan_gpe_rpc.ba.go index 13c2a1c..787a053 100644 --- a/binapi/vxlan_gpe/vxlan_gpe_rpc.ba.go +++ b/binapi/vxlan_gpe/vxlan_gpe_rpc.ba.go @@ -11,7 +11,7 @@ import ( vpe "git.fd.io/govpp.git/binapi/vpe" ) -// RPCService defines RPC service vxlan_gpe. +// RPCService defines RPC service vxlan_gpe. type RPCService interface { SwInterfaceSetVxlanGpeBypass(ctx context.Context, in *SwInterfaceSetVxlanGpeBypass) (*SwInterfaceSetVxlanGpeBypassReply, error) VxlanGpeAddDelTunnel(ctx context.Context, in *VxlanGpeAddDelTunnel) (*VxlanGpeAddDelTunnelReply, error) @@ -32,7 +32,7 @@ func (c *serviceClient) SwInterfaceSetVxlanGpeBypass(ctx context.Context, in *Sw if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) VxlanGpeAddDelTunnel(ctx context.Context, in *VxlanGpeAddDelTunnel) (*VxlanGpeAddDelTunnelReply, error) { @@ -41,7 +41,7 @@ func (c *serviceClient) VxlanGpeAddDelTunnel(ctx context.Context, in *VxlanGpeAd if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) VxlanGpeTunnelDump(ctx context.Context, in *VxlanGpeTunnelDump) (RPCService_VxlanGpeTunnelDumpClient, error) { diff --git a/binapi/vxlan_gpe_ioam_export/vxlan_gpe_ioam_export.ba.go b/binapi/vxlan_gpe_ioam_export/vxlan_gpe_ioam_export.ba.go index 8820fab..1162b59 100644 --- a/binapi/vxlan_gpe_ioam_export/vxlan_gpe_ioam_export.ba.go +++ b/binapi/vxlan_gpe_ioam_export/vxlan_gpe_ioam_export.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/vxlan_gpe_ioam_export.api.json // Package vxlan_gpe_ioam_export contains generated bindings for API file vxlan_gpe_ioam_export.api. diff --git a/binapi/vxlan_gpe_ioam_export/vxlan_gpe_ioam_export_rest.ba.go b/binapi/vxlan_gpe_ioam_export/vxlan_gpe_ioam_export_rest.ba.go deleted file mode 100644 index b2cf182..0000000 --- a/binapi/vxlan_gpe_ioam_export/vxlan_gpe_ioam_export_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package vxlan_gpe_ioam_export - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/vxlan_gpe_ioam_export_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(VxlanGpeIoamExportEnableDisable) - 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.VxlanGpeIoamExportEnableDisable(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/vxlan_gpe_ioam_export/vxlan_gpe_ioam_export_rpc.ba.go b/binapi/vxlan_gpe_ioam_export/vxlan_gpe_ioam_export_rpc.ba.go index d09e3f6..f688803 100644 --- a/binapi/vxlan_gpe_ioam_export/vxlan_gpe_ioam_export_rpc.ba.go +++ b/binapi/vxlan_gpe_ioam_export/vxlan_gpe_ioam_export_rpc.ba.go @@ -8,7 +8,7 @@ import ( api "git.fd.io/govpp.git/api" ) -// RPCService defines RPC service vxlan_gpe_ioam_export. +// RPCService defines RPC service vxlan_gpe_ioam_export. type RPCService interface { VxlanGpeIoamExportEnableDisable(ctx context.Context, in *VxlanGpeIoamExportEnableDisable) (*VxlanGpeIoamExportEnableDisableReply, error) } @@ -27,5 +27,5 @@ func (c *serviceClient) VxlanGpeIoamExportEnableDisable(ctx context.Context, in if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } diff --git a/binapigen/binapigen.go b/binapigen/binapigen.go index 35a07d0..de6a804 100644 --- a/binapigen/binapigen.go +++ b/binapigen/binapigen.go @@ -243,8 +243,8 @@ func newStruct(gen *Generator, file *File, apitype vppapi.StructType) *Struct { }, } gen.structsByName[typ.Name] = typ - for _, fieldType := range apitype.Fields { - field := newField(gen, file, typ, fieldType) + for i, fieldType := range apitype.Fields { + field := newField(gen, file, typ, fieldType, i) typ.Fields = append(typ.Fields, field) } return typ @@ -276,8 +276,8 @@ func newUnion(gen *Generator, file *File, apitype vppapi.UnionType) *Union { }, } gen.unionsByName[typ.Name] = typ - for _, fieldType := range apitype.Fields { - field := newField(gen, file, typ, fieldType) + for i, fieldType := range apitype.Fields { + field := newField(gen, file, typ, fieldType, i) typ.Fields = append(typ.Fields, field) } return typ @@ -302,11 +302,12 @@ const ( msgTypeEvent // msg_id, client_index ) -// message fields +// common message fields const ( fieldMsgID = "_vl_msg_id" fieldClientIndex = "client_index" fieldContext = "context" + fieldRetval = "retval" ) // field options @@ -343,7 +344,7 @@ func newMessage(gen *Generator, file *File, apitype vppapi.Message) *Message { } } n++ - field := newField(gen, file, msg, fieldType) + field := newField(gen, file, msg, fieldType, n) msg.Fields = append(msg.Fields, field) } return msg @@ -394,12 +395,24 @@ func getMsgType(m vppapi.Message) (msgType, error) { return typ, nil } +func getRetvalField(m *Message) *Field { + for _, field := range m.Fields { + if field.Name == fieldRetval { + return field + } + } + return nil +} + // Field represents a field for message or struct/union types. type Field struct { vppapi.Field GoName string + // Index defines field index in parent. + Index int + // DefaultValue is a default value of field or // nil if default value is not defined for field. DefaultValue interface{} @@ -423,10 +436,11 @@ type Field struct { FieldSizeFrom *Field } -func newField(gen *Generator, file *File, parent interface{}, apitype vppapi.Field) *Field { +func newField(gen *Generator, file *File, parent interface{}, apitype vppapi.Field, index int) *Field { typ := &Field{ Field: apitype, GoName: camelCaseName(apitype.Name), + Index: index, } switch p := parent.(type) { case *Message: diff --git a/binapigen/gen_rest.go b/binapigen/gen_http.go similarity index 88% rename from binapigen/gen_rest.go rename to binapigen/gen_http.go index 6ddb57a..4c9697e 100644 --- a/binapigen/gen_rest.go +++ b/binapigen/gen_http.go @@ -20,7 +20,7 @@ import ( ) func init() { - RegisterPlugin("rest", GenerateREST) + RegisterPlugin("http", GenerateHTTP) } // library dependencies @@ -30,16 +30,16 @@ const ( jsonPkg = GoImportPath("encoding/json") ) -func GenerateREST(gen *Generator, file *File) *GenFile { +func GenerateHTTP(gen *Generator, file *File) *GenFile { if file.Service == nil { return nil } logf("----------------------------") - logf(" Generate REST - %s", file.Desc.Name) + logf(" Generate HTTP - %s", file.Desc.Name) logf("----------------------------") - filename := path.Join(file.FilenamePrefix, file.Desc.Name+"_rest.ba.go") + filename := path.Join(file.FilenamePrefix, file.Desc.Name+"_http.ba.go") g := gen.NewGenFile(filename, file.GoImportPath) g.file = file @@ -51,15 +51,15 @@ func GenerateREST(gen *Generator, file *File) *GenFile { // generate RPC service if len(file.Service.RPCs) > 0 { - genRESTHandler(g, file.Service) + genHTTPHandler(g, file.Service) } return g } -func genRESTHandler(g *GenFile, svc *Service) { +func genHTTPHandler(g *GenFile, svc *Service) { // generate handler constructor - g.P("func RESTHandler(rpc ", serviceApiName, ") ", httpPkg.Ident("Handler"), " {") + g.P("func HTTPHandler(rpc ", serviceApiName, ") ", httpPkg.Ident("Handler"), " {") g.P(" mux := ", httpPkg.Ident("NewServeMux"), "()") // generate http handlers for rpc diff --git a/binapigen/gen_rpc.go b/binapigen/gen_rpc.go index ba23f4a..a5974c3 100644 --- a/binapigen/gen_rpc.go +++ b/binapigen/gen_rpc.go @@ -71,7 +71,7 @@ func GenerateRPC(gen *Generator, file *File) *GenFile { func genService(g *GenFile, svc *Service) { // generate comment - g.P("// ", serviceApiName, " defines RPC service ", g.file.Desc.Name, ".") + g.P("// ", serviceApiName, " defines RPC service ", g.file.Desc.Name, ".") // generate service interface g.P("type ", serviceApiName, " interface {") @@ -160,7 +160,15 @@ func genService(g *GenFile, svc *Service) { g.P("out := new(", rpc.MsgReply.GoIdent, ")") g.P("err := c.conn.Invoke(ctx, in, out)") g.P("if err != nil { return nil, err }") - g.P("return out, nil") + if retvalField := getRetvalField(rpc.MsgReply); retvalField != nil { + if fieldType := getFieldType(g, retvalField); fieldType == "int32" { + g.P("return out, ", govppApiPkg.Ident("RetvalToVPPApiError"), "(out.", retvalField.GoName, ")") + } else { + g.P("return out, ", govppApiPkg.Ident("RetvalToVPPApiError"), "(int32(out.", retvalField.GoName, "))") + } + } else { + g.P("return out, nil") + } } else { g.P("stream, err := c.conn.NewStream(ctx)") g.P("if err != nil { return err }") diff --git a/binapigen/run.go b/binapigen/run.go index 8bb88fb..d632519 100644 --- a/binapigen/run.go +++ b/binapigen/run.go @@ -53,7 +53,7 @@ func run(apiDir string, filesToGenerate []string, opts Options, fn func(*Generat if err != nil { return fmt.Errorf("cannot resolve import path for output dir %s: %w", opts.OutputDir, err) } - logrus.Infof("resolved import path prefix: %s", opts.ImportPrefix) + logrus.Debugf("resolved import path prefix: %s", opts.ImportPrefix) } gen, err := New(opts, apiFiles, filesToGenerate) @@ -73,7 +73,6 @@ func run(apiDir string, filesToGenerate []string, opts Options, fn func(*Generat return err } } - if err = gen.Generate(); err != nil { return err } diff --git a/go.mod b/go.mod index 09512f5..78b1b4a 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.12 require ( github.com/bennyscetbun/jsongo v1.1.0 - github.com/fsnotify/fsnotify v0.0.0-20170329110642-4da3e2cfbabc + github.com/fsnotify/fsnotify v1.4.7 github.com/ftrvxmtrx/fd v0.0.0-20150925145434-c6d800382fff github.com/golang/protobuf v1.3.2 // indirect github.com/hpcloud/tail v1.0.0 // indirect @@ -19,5 +19,5 @@ require ( gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect gopkg.in/fsnotify.v1 v1.4.7 // indirect gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect - gopkg.in/yaml.v2 v2.0.0-20170407172122-cd8b52f8269e // indirect + gopkg.in/yaml.v2 v2.2.2 // indirect ) diff --git a/go.sum b/go.sum index 188240b..2273944 100644 --- a/go.sum +++ b/go.sum @@ -4,8 +4,8 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/fsnotify/fsnotify v0.0.0-20170329110642-4da3e2cfbabc h1:fqUzyjP8DApxXq0dOZJE/NvqQkyjxiTy9ARNyRwBPEw= -github.com/fsnotify/fsnotify v0.0.0-20170329110642-4da3e2cfbabc/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/ftrvxmtrx/fd v0.0.0-20150925145434-c6d800382fff h1:zk1wwii7uXmI0znwU+lqg+wFL9G5+vm5I+9rv2let60= github.com/ftrvxmtrx/fd v0.0.0-20150925145434-c6d800382fff/go.mod h1:yUhRXHewUVJ1k89wHKP68xfzk7kwXUx/DV1nx4EBMbw= github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= @@ -39,11 +39,12 @@ golang.org/x/sys v0.0.0-20190422165155-953cdadca894 h1:Cz4ceDQGXuKRnVBDTS23GTn/p golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200610111108-226ff32320da h1:bGb80FudwxpeucJUjPYJXuJ8Hk91vNtfvrymzwiei38= golang.org/x/sys v0.0.0-20200610111108-226ff32320da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.0.0-20170407172122-cd8b52f8269e h1:o/mfNjxpTLivuKEfxzzwrJ8PmulH2wEp7t713uMwKAA= -gopkg.in/yaml.v2 v2.0.0-20170407172122-cd8b52f8269e/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= +gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -- 2.16.6