summaryrefslogtreecommitdiffstats
path: root/src/vat
diff options
context:
space:
mode:
Diffstat (limited to 'src/vat')
-rw-r--r--src/vat/api_format.c208
1 files changed, 208 insertions, 0 deletions
diff --git a/src/vat/api_format.c b/src/vat/api_format.c
index 391fe9cf7c4..d34a97f65cb 100644
--- a/src/vat/api_format.c
+++ b/src/vat/api_format.c
@@ -2611,6 +2611,92 @@ vl_api_one_eid_table_details_t_handler_json (vl_api_one_eid_table_details_t
}
static void
+vl_api_one_stats_details_t_handler (vl_api_one_stats_details_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ u8 *seid = 0, *deid = 0;
+ u8 *(*format_ip_address_fcn) (u8 *, va_list *) = 0;
+
+ deid = format (0, "%U", format_lisp_eid_vat,
+ mp->eid_type, mp->deid, mp->deid_pref_len, 0, 0, 0);
+
+ seid = format (0, "%U", format_lisp_eid_vat,
+ mp->eid_type, mp->seid, mp->seid_pref_len, 0, 0, 0);
+
+ vec_add1 (deid, 0);
+ vec_add1 (seid, 0);
+
+ if (mp->is_ip4)
+ format_ip_address_fcn = format_ip4_address;
+ else
+ format_ip_address_fcn = format_ip6_address;
+
+
+ print (vam->ofp, "([%d] %s %s) (%U %U) %u %u",
+ clib_net_to_host_u32 (mp->vni),
+ seid, deid,
+ format_ip_address_fcn, mp->lloc,
+ format_ip_address_fcn, mp->rloc,
+ clib_net_to_host_u32 (mp->pkt_count),
+ clib_net_to_host_u32 (mp->bytes));
+
+ vec_free (deid);
+ vec_free (seid);
+}
+
+static void
+vl_api_one_stats_details_t_handler_json (vl_api_one_stats_details_t * mp)
+{
+ struct in6_addr ip6;
+ struct in_addr ip4;
+ vat_main_t *vam = &vat_main;
+ vat_json_node_t *node = 0;
+ u8 *deid = 0, *seid = 0;
+
+ 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);
+ deid = format (0, "%U", format_lisp_eid_vat,
+ mp->eid_type, mp->deid, mp->deid_pref_len, 0, 0, 0);
+
+ seid = format (0, "%U", format_lisp_eid_vat,
+ mp->eid_type, mp->seid, mp->seid_pref_len, 0, 0, 0);
+
+ vec_add1 (deid, 0);
+ vec_add1 (seid, 0);
+
+ vat_json_object_add_string_copy (node, "seid", seid);
+ vat_json_object_add_string_copy (node, "deid", deid);
+ vat_json_object_add_uint (node, "vni", clib_net_to_host_u32 (mp->vni));
+
+ if (mp->is_ip4)
+ {
+ clib_memcpy (&ip4, mp->lloc, sizeof (ip4));
+ vat_json_object_add_ip4 (node, "lloc", ip4);
+ clib_memcpy (&ip4, mp->rloc, sizeof (ip4));
+ vat_json_object_add_ip4 (node, "rloc", ip4);
+ }
+ else
+ {
+ clib_memcpy (&ip6, mp->lloc, sizeof (ip6));
+ vat_json_object_add_ip6 (node, "lloc", ip6);
+ clib_memcpy (&ip6, mp->rloc, sizeof (ip6));
+ vat_json_object_add_ip6 (node, "rloc", ip6);
+ }
+ vat_json_object_add_uint (node, "pkt_count",
+ clib_net_to_host_u32 (mp->pkt_count));
+ vat_json_object_add_uint (node, "bytes", clib_net_to_host_u32 (mp->bytes));
+
+ vec_free (deid);
+ vec_free (seid);
+}
+
+static void
vl_api_one_eid_table_map_details_t_handler
(vl_api_one_eid_table_map_details_t * mp)
{
@@ -2741,6 +2827,42 @@ static void
}
static void
+ vl_api_show_one_stats_enable_disable_reply_t_handler
+ (vl_api_show_one_stats_enable_disable_reply_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ int retval = clib_net_to_host_u32 (mp->retval);
+
+ if (retval)
+ goto end;
+
+ print (vam->ofp, "%s", mp->is_en ? "enabled" : "disabled");
+end:
+ vam->retval = retval;
+ vam->result_ready = 1;
+}
+
+static void
+ vl_api_show_one_stats_enable_disable_reply_t_handler_json
+ (vl_api_show_one_stats_enable_disable_reply_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ vat_json_node_t _node, *node = &_node;
+ int retval = clib_net_to_host_u32 (mp->retval);
+
+ u8 *s = format (0, "%s", mp->is_en ? "enabled" : "disabled");
+ vat_json_init_object (node);
+ vat_json_object_add_string_copy (node, "state", s);
+
+ vat_json_print (vam->ofp, node);
+ vat_json_free (node);
+
+ vam->retval = retval;
+ vam->result_ready = 1;
+ vec_free (s);
+}
+
+static void
api_gpe_fwd_entry_net_to_host (vl_api_gpe_fwd_entry_t * e)
{
e->dp_table = clib_net_to_host_u32 (e->dp_table);
@@ -4040,6 +4162,7 @@ _(one_map_request_mode_reply) \
_(one_add_del_map_request_itr_rlocs_reply) \
_(one_eid_table_add_del_map_reply) \
_(one_use_petr_reply) \
+_(one_stats_enable_disable_reply) \
_(gpe_add_del_fwd_entry_reply) \
_(gpe_enable_disable_reply) \
_(gpe_set_encap_mode_reply) \
@@ -4263,6 +4386,10 @@ _(ONE_EID_TABLE_VNI_DETAILS, one_eid_table_vni_details) \
_(ONE_MAP_RESOLVER_DETAILS, one_map_resolver_details) \
_(ONE_MAP_SERVER_DETAILS, one_map_server_details) \
_(ONE_ADJACENCIES_GET_REPLY, one_adjacencies_get_reply) \
+_(ONE_STATS_DETAILS, one_stats_details) \
+_(ONE_STATS_ENABLE_DISABLE_REPLY, one_stats_enable_disable_reply) \
+_(SHOW_ONE_STATS_ENABLE_DISABLE_REPLY, \
+ show_one_stats_enable_disable_reply) \
_(GPE_SET_ENCAP_MODE_REPLY, gpe_set_encap_mode_reply) \
_(GPE_GET_ENCAP_MODE_REPLY, gpe_get_encap_mode_reply) \
_(GPE_ADD_DEL_IFACE_REPLY, gpe_add_del_iface_reply) \
@@ -14215,6 +14342,64 @@ api_show_one_rloc_probe_state (vat_main_t * vam)
#define api_show_lisp_rloc_probe_state api_show_one_rloc_probe_state
static int
+api_one_stats_enable_disable (vat_main_t * vam)
+{
+ vl_api_one_stats_enable_disable_t *mp;
+ unformat_input_t *input = vam->input;
+ u8 is_set = 0;
+ u8 is_en = 0;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "enable"))
+ {
+ is_set = 1;
+ is_en = 1;
+ }
+ else if (unformat (input, "disable"))
+ {
+ is_set = 1;
+ }
+ else
+ break;
+ }
+
+ if (!is_set)
+ {
+ errmsg ("Value not set");
+ return -99;
+ }
+
+ M (ONE_STATS_ENABLE_DISABLE, mp);
+ mp->is_en = is_en;
+
+ /* send */
+ S (mp);
+
+ /* wait for reply */
+ W (ret);
+ return ret;
+}
+
+static int
+api_show_one_stats_enable_disable (vat_main_t * vam)
+{
+ vl_api_show_one_stats_enable_disable_t *mp;
+ int ret;
+
+ M (SHOW_ONE_STATS_ENABLE_DISABLE, mp);
+
+ /* send */
+ S (mp);
+
+ /* wait for reply */
+ W (ret);
+ return ret;
+}
+
+static int
api_show_one_map_request_mode (vat_main_t * vam)
{
vl_api_show_one_map_request_mode_t *mp;
@@ -15422,6 +15607,26 @@ api_one_map_resolver_dump (vat_main_t * vam)
#define api_lisp_map_resolver_dump api_one_map_resolver_dump
static int
+api_one_stats_dump (vat_main_t * vam)
+{
+ vl_api_one_stats_dump_t *mp;
+ vl_api_control_ping_t *mp_ping;
+ int ret;
+
+ M (ONE_STATS_DUMP, mp);
+ /* send it... */
+ S (mp);
+
+ /* Use a control ping for synchronization */
+ M (CONTROL_PING, mp_ping);
+ S (mp_ping);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static int
api_show_one_status (vat_main_t * vam)
{
vl_api_show_one_status_t *mp;
@@ -18389,6 +18594,8 @@ _(one_locator_set_dump, "[local | remote]") \
_(one_locator_dump, "ls_index <index> | ls_name <name>") \
_(one_eid_table_dump, "[eid <ipv4|ipv6>/<prefix> | <mac>] [vni] " \
"[local] | [remote]") \
+_(one_stats_enable_disable, "enable|disalbe") \
+_(show_one_stats_enable_disable, "") \
_(one_eid_table_vni_dump, "") \
_(one_eid_table_map_dump, "l2|l3") \
_(one_map_resolver_dump, "") \
@@ -18397,6 +18604,7 @@ _(one_adjacencies_get, "vni <vni>") \
_(show_one_rloc_probe_state, "") \
_(show_one_map_register_state, "") \
_(show_one_status, "") \
+_(one_stats_dump, "") \
_(one_get_map_request_itr_rlocs, "") \
_(show_one_pitr, "") \
_(show_one_use_petr, "") \