diff options
author | Ole Troan <ot@cisco.com> | 2020-09-15 10:53:34 +0200 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2020-09-18 15:24:52 +0000 |
commit | 3d81267945a732753b0dbd0a83a50ab0625b448a (patch) | |
tree | c00b5e6a5e798cbb29c9c450eb37d43f9303cb85 /src/vpp/api | |
parent | 34262d4d56295b0872ad4e9a4a4791953f3fa444 (diff) |
vat: add infrastructure to align vnet test code and plugin test code
Split vat/api_format.c also for VNET features.
Use auto-generated VAT test code and support dynamic message ID allocation as for plugins.
The arp and geneve features as Guinea pigs.
Type: improvement
Signed-off-by: Ole Troan <ot@cisco.com>
Change-Id: I461591496766bdf10c5f950fd30f1a0ae05909da
Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'src/vpp/api')
-rw-r--r-- | src/vpp/api/api_main.c | 22 | ||||
-rw-r--r-- | src/vpp/api/custom_dump.c | 70 |
2 files changed, 22 insertions, 70 deletions
diff --git a/src/vpp/api/api_main.c b/src/vpp/api/api_main.c index e2223a402b9..97dec9e1542 100644 --- a/src/vpp/api/api_main.c +++ b/src/vpp/api/api_main.c @@ -39,6 +39,26 @@ init_error_string_table (vat_main_t * vam) } #if VPP_API_TEST_BUILTIN > 0 +static void +load_features (void) +{ + vat_registered_features_t *f; + vat_main_t *vam = &vat_main; + clib_error_t *error; + + f = vam->feature_function_registrations; + + while (f) + { + error = f->function (vam); + if (error) + { + clib_warning ("INIT FAILED"); + } + f = f->next; + } +} + clib_error_t * vat_builtin_main_init (vlib_main_t * vm) { @@ -57,6 +77,8 @@ vat_builtin_main_init (vlib_main_t * vm) if (rv) clib_warning ("vat_plugin_init returned %d", rv); + load_features (); + return 0; } #endif diff --git a/src/vpp/api/custom_dump.c b/src/vpp/api/custom_dump.c index 5f022952cfa..87729721fea 100644 --- a/src/vpp/api/custom_dump.c +++ b/src/vpp/api/custom_dump.c @@ -30,7 +30,6 @@ #include <vnet/srmpls/sr_mpls.h> #include <vnet/gre/gre.h> #include <vnet/vxlan-gpe/vxlan_gpe.h> -#include <vnet/geneve/geneve.h> #include <vnet/classify/policer_classify.h> #include <vnet/policer/xlate.h> #include <vnet/policer/policer.h> @@ -264,26 +263,6 @@ static void *vl_api_sw_interface_set_vxlan_bypass_t_print FINISH; } -static void *vl_api_sw_interface_set_geneve_bypass_t_print - (vl_api_sw_interface_set_geneve_bypass_t * mp, void *handle) -{ - u8 *s; - - s = format (0, "SCRIPT: sw_interface_set_geneve_bypass "); - - s = format (s, "sw_if_index %d ", (mp->sw_if_index)); - - if (mp->is_ipv6) - s = format (s, "ip6 "); - - if (mp->enable) - s = format (s, "enable "); - else - s = format (s, "disable "); - - FINISH; -} - static void *vl_api_sw_interface_set_l2_xconnect_t_print (vl_api_sw_interface_set_l2_xconnect_t * mp, void *handle) { @@ -1654,52 +1633,6 @@ static void *vl_api_sw_interface_set_vxlan_gbp_bypass_t_print FINISH; } -static void *vl_api_geneve_add_del_tunnel_t_print - (vl_api_geneve_add_del_tunnel_t * mp, void *handle) -{ - u8 *s; - s = format (0, "SCRIPT: geneve_add_del_tunnel "); - - ip46_address_t local; - ip46_address_t remote; - ip_address_decode (&mp->remote_address, &remote); - ip_address_decode (&mp->local_address, &local); - - u8 is_grp = ip46_address_is_multicast (&remote); - char *remote_name = is_grp ? "group" : "dst"; - - s = format (s, "src %U ", format_ip46_address, &local, IP46_TYPE_ANY); - s = format (s, "%s %U ", remote_name, format_ip46_address, - &remote, IP46_TYPE_ANY); - - if (is_grp) - s = format (s, "mcast_sw_if_index %d ", (mp->mcast_sw_if_index)); - - if (mp->encap_vrf_id) - s = format (s, "encap-vrf-id %d ", (mp->encap_vrf_id)); - - s = format (s, "decap-next %d ", (mp->decap_next_index)); - - s = format (s, "vni %d ", (mp->vni)); - - if (mp->is_add == 0) - s = format (s, "del "); - - FINISH; -} - -static void *vl_api_geneve_tunnel_dump_t_print - (vl_api_geneve_tunnel_dump_t * mp, void *handle) -{ - u8 *s; - - s = format (0, "SCRIPT: geneve_tunnel_dump "); - - s = format (s, "sw_if_index %d ", (mp->sw_if_index)); - - FINISH; -} - static void *vl_api_gre_tunnel_add_del_t_print (vl_api_gre_tunnel_add_del_t * mp, void *handle) { @@ -3612,7 +3545,6 @@ _(SW_INTERFACE_SET_TABLE, sw_interface_set_table) \ _(SW_INTERFACE_SET_MPLS_ENABLE, sw_interface_set_mpls_enable) \ _(SW_INTERFACE_SET_VPATH, sw_interface_set_vpath) \ _(SW_INTERFACE_SET_VXLAN_BYPASS, sw_interface_set_vxlan_bypass) \ -_(SW_INTERFACE_SET_GENEVE_BYPASS, sw_interface_set_geneve_bypass) \ _(BOND_CREATE, bond_create) \ _(BOND_CREATE2, bond_create2) \ _(BOND_DELETE, bond_delete) \ @@ -3669,8 +3601,6 @@ _(SW_IF_L2TPV3_TUNNEL_DUMP, sw_if_l2tpv3_tunnel_dump) \ _(VXLAN_ADD_DEL_TUNNEL, vxlan_add_del_tunnel) \ _(VXLAN_TUNNEL_DUMP, vxlan_tunnel_dump) \ _(VXLAN_OFFLOAD_RX, vxlan_offload_rx) \ -_(GENEVE_ADD_DEL_TUNNEL, geneve_add_del_tunnel) \ -_(GENEVE_TUNNEL_DUMP, geneve_tunnel_dump) \ _(GRE_TUNNEL_ADD_DEL, gre_tunnel_add_del) \ _(GRE_TUNNEL_DUMP, gre_tunnel_dump) \ _(L2_FIB_CLEAR_TABLE, l2_fib_clear_table) \ |