diff options
author | Filip Tehlar <ftehlar@cisco.com> | 2021-07-23 22:03:05 +0000 |
---|---|---|
committer | Ole Tr�an <otroan@employees.org> | 2021-10-18 07:03:12 +0000 |
commit | f0e67d78ae23ff3d5751ea10e9e76cb6e81ba4a5 (patch) | |
tree | c63b1ac48809a7247bb288e01d5c9cdfb6038b7c /src/vat/vat.h | |
parent | 2e55823af6c1cc6856e4a1f2cea659170bd76fb7 (diff) |
interface: add api test file
Type: improvement
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Change-Id: Ib07029204ecf12bf2adb5a39afa54bc98fb81f34
Diffstat (limited to 'src/vat/vat.h')
-rw-r--r-- | src/vat/vat.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/vat/vat.h b/src/vat/vat.h index 32de90e4411..10199e3e9e6 100644 --- a/src/vat/vat.h +++ b/src/vat/vat.h @@ -33,6 +33,8 @@ #include <vlib/unix/unix.h> #include <vlibapi/api.h> #include <vlibmemory/api.h> +#include <vlibmemory/memclnt.api_enum.h> +#include <vlibmemory/memclnt.api_types.h> #include "vat/json_format.h" @@ -232,6 +234,8 @@ typedef struct struct vat_registered_features_t *feature_function_registrations; + int (*api_sw_interface_dump) (); + /* Convenience */ vlib_main_t *vlib_main; } vat_main_t; @@ -295,6 +299,25 @@ static void __vlib_add_config_function_##x (void) \ .function = x, \ } +#if VPP_API_TEST_BUILTIN == 0 +static_always_inline uword +api_unformat_sw_if_index (unformat_input_t *input, va_list *args) +{ + vat_main_t *vam = va_arg (*args, vat_main_t *); + u32 *result = va_arg (*args, u32 *); + u8 *if_name; + uword *p; + + if (!unformat (input, "%s", &if_name)) + return 0; + + p = hash_get_mem (vam->sw_if_index_by_interface_name, if_name); + if (p == 0) + return 0; + *result = p[0]; + return 1; +} +#endif /* VPP_API_TEST_BUILTIN */ #endif /* __included_vat_h__ */ |