diff options
author | Dave Wallace <dwallacelf@gmail.com> | 2015-12-17 21:04:30 -0500 |
---|---|---|
committer | Dave Wallace <dwallacelf@gmail.com> | 2015-12-17 21:47:54 -0500 |
commit | 60231f35fa860228f31f40753d94e129e8432988 (patch) | |
tree | c142ac60b47c2a1ab7e8426e16d8f094c960a30a /vpp | |
parent | a4105dead4d83fe2130feb50870c4b8ab3c3cbbe (diff) |
Add vpe-api message to get vxlan tunnel details.
Change-Id: I3bfb84dfcb08c6ff5cb473f3ce05b91b222182a1
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
Diffstat (limited to 'vpp')
-rw-r--r-- | vpp/api/api.c | 50 | ||||
-rw-r--r-- | vpp/api/custom_dump.c | 13 | ||||
-rw-r--r-- | vpp/api/vpe.api | 18 |
3 files changed, 80 insertions, 1 deletions
diff --git a/vpp/api/api.c b/vpp/api/api.c index 7bbb5c03..fe926791 100644 --- a/vpp/api/api.c +++ b/vpp/api/api.c @@ -271,6 +271,7 @@ _(L2TPV3_INTERFACE_ENABLE_DISABLE, l2tpv3_interface_enable_disable) \ _(L2TPV3_SET_LOOKUP_KEY, l2tpv3_set_lookup_key) \ _(SW_IF_L2TPV3_TUNNEL_DUMP, sw_if_l2tpv3_tunnel_dump) \ _(VXLAN_ADD_DEL_TUNNEL, vxlan_add_del_tunnel) \ +_(VXLAN_TUNNEL_DUMP, vxlan_tunnel_dump) \ _(L2_FIB_CLEAR_TABLE, l2_fib_clear_table) \ _(L2_INTERFACE_EFP_FILTER, l2_interface_efp_filter) \ _(L2_INTERFACE_VLAN_TAG_REWRITE, l2_interface_vlan_tag_rewrite) \ @@ -4118,6 +4119,55 @@ out: })); } +static void send_vxlan_tunnel_details +(vxlan_tunnel_t * t, unix_shared_memory_queue_t * q) +{ + vl_api_vxlan_tunnel_details_t * rmp; + ip4_main_t * im = &ip4_main; + + rmp = vl_msg_api_alloc (sizeof (*rmp)); + memset (rmp, 0, sizeof (*rmp)); + rmp->_vl_msg_id = ntohs(VL_API_VXLAN_TUNNEL_DETAILS); + rmp->src_address = t->src.data_u32; + rmp->dst_address = t->dst.data_u32; + rmp->encap_vrf_id = htonl(im->fibs[t->encap_fib_index].table_id); + rmp->vni = htonl(t->vni); + rmp->decap_next_index = htonl(t->decap_next_index); + rmp->sw_if_index = htonl(t->sw_if_index); + + vl_msg_api_send_shmem (q, (u8 *)&rmp); +} + +static void vl_api_vxlan_tunnel_dump_t_handler +(vl_api_vxlan_tunnel_dump_t * mp) +{ + unix_shared_memory_queue_t * q; + vxlan_main_t * vxm = &vxlan_main; + vxlan_tunnel_t * t; + u32 sw_if_index; + + q = vl_api_client_index_to_input_queue (mp->client_index); + if (q == 0) { + return; + } + + sw_if_index = ntohl(mp->sw_if_index); + + if (~0 == sw_if_index) { + pool_foreach (t, vxm->tunnels, + ({ + send_vxlan_tunnel_details(t, q); + })); + } else { + if ((sw_if_index >= vec_len(vxm->tunnel_index_by_sw_if_index)) || + (~0 == vxm->tunnel_index_by_sw_if_index[sw_if_index])) { + return; + } + t = &vxm->tunnels[vxm->tunnel_index_by_sw_if_index[sw_if_index]]; + send_vxlan_tunnel_details(t, q); + } +} + static void vl_api_l2_patch_add_del_t_handler (vl_api_l2_patch_add_del_t *mp) { diff --git a/vpp/api/custom_dump.c b/vpp/api/custom_dump.c index 784c9d24..85740eee 100644 --- a/vpp/api/custom_dump.c +++ b/vpp/api/custom_dump.c @@ -1285,6 +1285,18 @@ static void * vl_api_vxlan_add_del_tunnel_t_print FINISH; } +static void * vl_api_vxlan_tunnel_dump_t_print +(vl_api_vxlan_tunnel_dump_t * mp, void *handle) +{ + u8 * s; + + s = format (0, "SCRIPT: vxlan_tunnel_dump "); + + s = format (s, "sw_if_index %d ", ntohl(mp->sw_if_index)); + + FINISH; +} + static void *vl_api_l2_fib_clear_table_t_print (vl_api_l2_fib_clear_table_t * mp, void *handle) { @@ -1737,6 +1749,7 @@ _(L2TPV3_INTERFACE_ENABLE_DISABLE, l2tpv3_interface_enable_disable) \ _(L2TPV3_SET_LOOKUP_KEY, l2tpv3_set_lookup_key) \ _(SW_IF_L2TPV3_TUNNEL_DUMP, sw_if_l2tpv3_tunnel_dump) \ _(VXLAN_ADD_DEL_TUNNEL, vxlan_add_del_tunnel) \ +_(VXLAN_TUNNEL_DUMP, vxlan_tunnel_dump) \ _(L2_FIB_CLEAR_TABLE, l2_fib_clear_table) \ _(L2_INTERFACE_EFP_FILTER, l2_interface_efp_filter) \ _(L2_INTERFACE_VLAN_TAG_REWRITE, l2_interface_vlan_tag_rewrite) \ diff --git a/vpp/api/vpe.api b/vpp/api/vpe.api index 480558aa..6b54ab82 100644 --- a/vpp/api/vpe.api +++ b/vpp/api/vpe.api @@ -1854,6 +1854,22 @@ define vxlan_add_del_tunnel_reply { i32 retval; u32 sw_if_index; }; + +manual_java define vxlan_tunnel_dump { + u32 client_index; + u32 context; + u32 sw_if_index; +}; + +manual_java define vxlan_tunnel_details { + u32 context; + u32 sw_if_index; + u32 src_address; + u32 dst_address; + u32 encap_vrf_id; + u32 decap_next_index; + u32 vni; +}; /** \brief L2 interface vlan tag rewrite configure request @param client_index - opaque cookie to identify the sender @@ -2062,7 +2078,7 @@ manual_java define ip_address_details { u8 prefix_length; }; -define ip_address_dump { +manual_java define ip_address_dump { u32 client_index; u32 context; u32 sw_if_index; |