lisp: fix help msg of show eid-table command
[vpp.git] / src / vnet / lisp-cp / one_cli.c
index 70d755b..70de0c1 100644 (file)
@@ -323,7 +323,7 @@ lisp_add_del_ndp_entry_command_fn (vlib_main_t * vm,
     }
 
   /* build GID address */
-  ip_address_set (&gid_address_arp_ndp_ip (g), &ip6, IP6);
+  ip_address_set (&gid_address_arp_ndp_ip (g), &ip6, AF_IP6);
   gid_address_ndp_bd (g) = bd;
   gid_address_type (g) = GID_ADDR_NDP;
   rc = vnet_lisp_add_del_l2_arp_ndp_entry (g, hw_addr, is_add);
@@ -1203,7 +1203,7 @@ done:
 /* *INDENT-OFF* */
 VLIB_CLI_COMMAND (one_cp_show_eid_table_command) = {
     .path = "show one eid-table",
-    .short_help = "Shows EID table",
+    .short_help = "show one eid-table [local|remote|eid <eid>]",
     .function = lisp_show_eid_table_command_fn,
 };
 /* *INDENT-ON* */
@@ -1369,54 +1369,44 @@ VLIB_CLI_COMMAND (one_cp_enable_disable_xtr_mode_command) = {
 /* *INDENT-ON* */
 
 static clib_error_t *
-lisp_enable_disable_command_fn (vlib_main_t * vm, unformat_input_t * input,
-                               vlib_cli_command_t * cmd)
+one_enable_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;
-  clib_error_t *error = NULL;
+  if (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+    return clib_error_return (0, "parse error: '%U'", format_unformat_error,
+                             input);
 
-  /* Get a line of input. */
-  if (!unformat_user (input, unformat_line_input, line_input))
-    return clib_error_return (0, "expected enable | disable");
+  vnet_lisp_enable_disable (1);
 
-  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
-       {
-         error = clib_error_return (0, "parse error: '%U'",
-                                    format_unformat_error, line_input);
-         goto done;
-       }
-    }
+  return 0;
+}
 
-  if (!is_set)
-    {
-      error = clib_error_return (0, "state not set");
-      goto done;
-    }
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (one_cp_enable_command) = {
+    .path = "one enable",
+    .short_help = "one enable",
+    .function = one_enable_command_fn,
+};
+/* *INDENT-ON* */
 
-  vnet_lisp_enable_disable (is_enabled);
+static clib_error_t *
+one_disable_command_fn (vlib_main_t * vm, unformat_input_t * input,
+                       vlib_cli_command_t * cmd)
+{
+  if (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+    return clib_error_return (0, "parse error: '%U'", format_unformat_error,
+                             input);
 
-done:
-  unformat_free (line_input);
+  vnet_lisp_enable_disable (0);
 
-  return error;
+  return 0;
 }
 
 /* *INDENT-OFF* */
-VLIB_CLI_COMMAND (one_cp_enable_disable_command) = {
-    .path = "one",
-    .short_help = "one [enable|disable]",
-    .function = lisp_enable_disable_command_fn,
+VLIB_CLI_COMMAND (one_cp_disable_command) = {
+    .path = "one disable",
+    .short_help = "one disable",
+    .function = one_disable_command_fn,
 };
 /* *INDENT-ON* */
 
@@ -1680,7 +1670,7 @@ done:
 /* *INDENT-OFF* */
 VLIB_CLI_COMMAND (one_show_eid_table_map_command) = {
     .path = "show one eid-table map",
-    .short_help = "show one eid-table l2|l3",
+    .short_help = "show one eid-table map l2|l3",
     .function = lisp_show_eid_table_map_command_fn,
 };
 /* *INDENT-ON* */
@@ -1721,6 +1711,7 @@ lisp_add_del_locator_set_command_fn (vlib_main_t * vm,
                         &locator.weight))
        {
          locator.local = 1;
+         locator.state = 1;
          vec_add1 (locators, locator);
        }
       else