-clib_error_t *
-vnet_lisp_enable_disable (u8 is_enable)
-{
- u32 vni, dp_table;
- clib_error_t *error = 0;
- lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
- vnet_lisp_gpe_enable_disable_args_t _a, *a = &_a;
-
- a->is_en = is_enable;
- error = vnet_lisp_gpe_enable_disable (a);
- if (error)
- {
- return clib_error_return (0, "failed to %s data-plane!",
- a->is_en ? "enable" : "disable");
- }
-
- if (is_enable)
- {
- /* enable all l2 and l3 ifaces */
-
- /* *INDENT-OFF* */
- hash_foreach(vni, dp_table, lcm->table_id_by_vni, ({
- dp_add_del_iface(lcm, vni, 0, 1);
- }));
- hash_foreach(vni, dp_table, lcm->bd_id_by_vni, ({
- dp_add_del_iface(lcm, vni, /* is_l2 */ 1, 1);
- }));
- /* *INDENT-ON* */
- }
- else
- {
- /* clear interface table */
- hash_free (lcm->fwd_entry_by_mapping_index);
- pool_free (lcm->fwd_entry_pool);
- }
-
- /* update global flag */
- lcm->is_enabled = is_enable;
-
- return 0;
-}
-
-static clib_error_t *
-lisp_enable_disable_command_fn (vlib_main_t * vm, unformat_input_t * input,
- vlib_cli_command_t * cmd)
-{
- unformat_input_t _line_input, *line_input = &_line_input;
- u8 is_enabled = 0;
- u8 is_set = 0;
-
- /* Get a line of input. */
- if (!unformat_user (input, unformat_line_input, line_input))
- return 0;
-
- while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (line_input, "enable"))
- {
- is_set = 1;
- is_enabled = 1;
- }
- else if (unformat (line_input, "disable"))
- is_set = 1;
- else
- {
- return clib_error_return (0, "parse error: '%U'",
- format_unformat_error, line_input);
- }
- }
-
- if (!is_set)
- return clib_error_return (0, "state not set");
-
- vnet_lisp_enable_disable (is_enabled);
- return 0;
-}
-
-/* *INDENT-OFF* */
-VLIB_CLI_COMMAND (lisp_cp_enable_disable_command) = {
- .path = "lisp",
- .short_help = "lisp [enable|disable]",
- .function = lisp_enable_disable_command_fn,
-};
-/* *INDENT-ON* */
-
-static clib_error_t *
-lisp_map_register_enable_disable_command_fn (vlib_main_t * vm,
- unformat_input_t * input,
- vlib_cli_command_t * cmd)
-{
- unformat_input_t _line_input, *line_input = &_line_input;
- u8 is_enabled = 0;
- u8 is_set = 0;
-
- /* Get a line of input. */
- if (!unformat_user (input, unformat_line_input, line_input))
- return 0;
-
- while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (line_input, "enable"))
- {
- is_set = 1;
- is_enabled = 1;
- }
- else if (unformat (line_input, "disable"))
- is_set = 1;
- else
- {
- vlib_cli_output (vm, "parse error: '%U'", format_unformat_error,
- line_input);
- return 0;
- }
- }
-
- if (!is_set)
- {
- vlib_cli_output (vm, "state not set!");
- return 0;
- }
-
- vnet_lisp_map_register_enable_disable (is_enabled);
- return 0;
-}
-
-/* *INDENT-OFF* */
-VLIB_CLI_COMMAND (lisp_map_register_enable_disable_command) = {
- .path = "lisp map-register",
- .short_help = "lisp map-register [enable|disable]",
- .function = lisp_map_register_enable_disable_command_fn,
-};
-/* *INDENT-ON* */
-
-static clib_error_t *
-lisp_rloc_probe_enable_disable_command_fn (vlib_main_t * vm,
- unformat_input_t * input,
- vlib_cli_command_t * cmd)