From 7048ff1e3af7a3979a9134cbbb8157df8e1a8a53 Mon Sep 17 00:00:00 2001 From: Filip Tehlar Date: Thu, 27 Jul 2017 08:09:14 +0200 Subject: LISP: Map-server fallback feature Change-Id: I1356296e1a85b5d532f45ba70572b2184ac3f6fb Signed-off-by: Filip Tehlar --- src/vat/api_format.c | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) (limited to 'src/vat') diff --git a/src/vat/api_format.c b/src/vat/api_format.c index 27286686..f97cdeef 100644 --- a/src/vat/api_format.c +++ b/src/vat/api_format.c @@ -2930,6 +2930,39 @@ static void vat_json_object_add_uint (node, "vni", clib_net_to_host_u32 (mp->vni)); } +static void + vl_api_show_one_map_register_fallback_threshold_reply_t_handler + (vl_api_show_one_map_register_fallback_threshold_reply_t * mp) +{ + vat_main_t *vam = &vat_main; + int retval = clib_net_to_host_u32 (mp->retval); + + vl_api_show_one_map_register_fallback_threshold_reply_t_endian (mp); + print (vam->ofp, "fallback threshold value: %d", mp->value); + + vam->retval = retval; + vam->result_ready = 1; +} + +static void + vl_api_show_one_map_register_fallback_threshold_reply_t_handler_json + (vl_api_show_one_map_register_fallback_threshold_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); + + vl_api_show_one_map_register_fallback_threshold_reply_t_endian (mp); + vat_json_init_object (node); + vat_json_object_add_uint (node, "value", mp->value); + + vat_json_print (vam->ofp, node); + vat_json_free (node); + + vam->retval = retval; + vam->result_ready = 1; +} + static void vl_api_show_one_map_register_state_reply_t_handler (vl_api_show_one_map_register_state_reply_t * mp) @@ -4663,6 +4696,7 @@ _(one_enable_disable_reply) \ _(one_rloc_probe_enable_disable_reply) \ _(one_map_register_enable_disable_reply) \ _(one_map_register_set_ttl_reply) \ +_(one_map_register_fallback_threshold_reply) \ _(one_pitr_set_locator_set_reply) \ _(one_map_request_mode_reply) \ _(one_add_del_map_request_itr_rlocs_reply) \ @@ -4890,6 +4924,8 @@ _(ONE_ENABLE_DISABLE_REPLY, one_enable_disable_reply) \ _(ONE_MAP_REGISTER_ENABLE_DISABLE_REPLY, \ one_map_register_enable_disable_reply) \ _(ONE_MAP_REGISTER_SET_TTL_REPLY, one_map_register_set_ttl_reply) \ +_(ONE_MAP_REGISTER_FALLBACK_THRESHOLD_REPLY, \ + one_map_register_fallback_threshold_reply) \ _(ONE_RLOC_PROBE_ENABLE_DISABLE_REPLY, \ one_rloc_probe_enable_disable_reply) \ _(ONE_PITR_SET_LOCATOR_SET_REPLY, one_pitr_set_locator_set_reply) \ @@ -4937,6 +4973,8 @@ _(SHOW_ONE_RLOC_PROBE_STATE_REPLY, show_one_rloc_probe_state_reply) \ _(SHOW_ONE_MAP_REGISTER_STATE_REPLY, \ show_one_map_register_state_reply) \ _(SHOW_ONE_MAP_REGISTER_TTL_REPLY, show_one_map_register_ttl_reply) \ +_(SHOW_ONE_MAP_REGISTER_FALLBACK_THRESHOLD_REPLY, \ + show_one_map_register_fallback_threshold_reply) \ _(AF_PACKET_CREATE_REPLY, af_packet_create_reply) \ _(AF_PACKET_DELETE_REPLY, af_packet_delete_reply) \ _(POLICER_ADD_DEL_REPLY, policer_add_del_reply) \ @@ -16161,6 +16199,60 @@ api_lisp_gpe_add_del_iface (vat_main_t * vam) return ret; } +static int +api_one_map_register_fallback_threshold (vat_main_t * vam) +{ + unformat_input_t *input = vam->input; + vl_api_one_map_register_fallback_threshold_t *mp; + u32 value = 0; + u8 is_set = 0; + int ret; + + /* Parse args required to build the message */ + while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) + { + if (unformat (input, "%u", &value)) + is_set = 1; + else + { + clib_warning ("parse error '%U'", format_unformat_error, input); + return -99; + } + } + + if (!is_set) + { + errmsg ("fallback threshold value is missing!"); + return -99; + } + + M (ONE_MAP_REGISTER_FALLBACK_THRESHOLD, mp); + mp->value = clib_host_to_net_u32 (value); + + /* send it... */ + S (mp); + + /* Wait for a reply... */ + W (ret); + return ret; +} + +static int +api_show_one_map_register_fallback_threshold (vat_main_t * vam) +{ + vl_api_show_one_map_register_fallback_threshold_t *mp; + int ret; + + M (SHOW_ONE_MAP_REGISTER_FALLBACK_THRESHOLD, mp); + + /* send it... */ + S (mp); + + /* Wait for a reply... */ + W (ret); + return ret; +} + static int api_one_map_register_set_ttl (vat_main_t * vam) { @@ -20115,6 +20207,7 @@ _(one_add_del_map_resolver, " [del]") \ _(one_add_del_map_server, " [del]") \ _(one_enable_disable, "enable|disable") \ _(one_map_register_enable_disable, "enable|disable") \ +_(one_map_register_fallback_threshold, "") \ _(one_rloc_probe_enable_disable, "enable|disable") \ _(one_add_del_remote_mapping, "add|del vni eid " \ "[seid ] " \ @@ -20155,6 +20248,7 @@ _(show_one_pitr, "") \ _(show_one_use_petr, "") \ _(show_one_map_request_mode, "") \ _(show_one_map_register_ttl, "") \ +_(show_one_map_register_fallback_threshold, "") \ _(lisp_add_del_locator_set, "locator-set [iface |"\ " sw_if_index p " \ "w ] [del]") \ -- cgit 1.2.3-korg