From f468e23da6c1d40900124aa1f37fdb45189a21a5 Mon Sep 17 00:00:00 2001 From: Matus Fabian Date: Fri, 2 Dec 2016 06:00:53 -0800 Subject: api: L2 XConnect API (VPP-438) Change-Id: I0a86184391723675488a5eb517c375f67940f5b5 Signed-off-by: Matus Fabian --- vpp-api-test/vat/api_format.c | 59 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 2 deletions(-) (limited to 'vpp-api-test/vat') diff --git a/vpp-api-test/vat/api_format.c b/vpp-api-test/vat/api_format.c index 0bbed5c49c7..e93c89bf076 100644 --- a/vpp-api-test/vat/api_format.c +++ b/vpp-api-test/vat/api_format.c @@ -3786,7 +3786,8 @@ _(PUNT_REPLY, punt_reply) \ _(IP_FIB_DETAILS, ip_fib_details) \ _(IP6_FIB_DETAILS, ip6_fib_details) \ _(FEATURE_ENABLE_DISABLE_REPLY, feature_enable_disable_reply) \ -_(SW_INTERFACE_TAG_ADD_DEL_REPLY, sw_interface_tag_add_del_reply) +_(SW_INTERFACE_TAG_ADD_DEL_REPLY, sw_interface_tag_add_del_reply) \ +_(L2_XCONNECT_DETAILS, l2_xconnect_details) /* M: construct, but don't yet send a message */ @@ -16304,6 +16305,59 @@ api_sw_interface_tag_add_del (vat_main_t * vam) W; } +static void vl_api_l2_xconnect_details_t_handler + (vl_api_l2_xconnect_details_t * mp) +{ + vat_main_t *vam = &vat_main; + + fformat (vam->ofp, "%15d%15d\n", + ntohl (mp->rx_sw_if_index), ntohl (mp->tx_sw_if_index)); +} + +static void vl_api_l2_xconnect_details_t_handler_json + (vl_api_l2_xconnect_details_t * mp) +{ + vat_main_t *vam = &vat_main; + vat_json_node_t *node = NULL; + + if (VAT_JSON_ARRAY != vam->json_tree.type) + { + ASSERT (VAT_JSON_NONE == vam->json_tree.type); + vat_json_init_array (&vam->json_tree); + } + node = vat_json_array_add (&vam->json_tree); + + vat_json_init_object (node); + vat_json_object_add_uint (node, "rx_sw_if_index", + ntohl (mp->rx_sw_if_index)); + vat_json_object_add_uint (node, "tx_sw_if_index", + ntohl (mp->tx_sw_if_index)); +} + +static int +api_l2_xconnect_dump (vat_main_t * vam) +{ + vl_api_l2_xconnect_dump_t *mp; + f64 timeout; + + if (!vam->json_output) + { + fformat (vam->ofp, "%15s%15s\n", "rx_sw_if_index", "tx_sw_if_index"); + } + + M (L2_XCONNECT_DUMP, l2_xconnect_dump); + + S; + + /* Use a control ping for synchronization */ + { + vl_api_control_ping_t *mp; + M (CONTROL_PING, control_ping); + S; + } + W; +} + static int q_or_quit (vat_main_t * vam) { @@ -16976,7 +17030,8 @@ _(ip6_fib_dump, "") \ _(feature_enable_disable, "arc_name " \ "feature_name | sw_if_index [disable]") \ _(sw_interface_tag_add_del, " | sw_if_index tag " \ -"[disable]") +"[disable]") \ +_(l2_xconnect_dump, "") /* List of command functions, CLI names map directly to functions */ #define foreach_cli_function \ -- cgit 1.2.3-korg