node_cli: Give the user a hint as to the problem.
[vpp.git] / src / vlib / node_cli.c
index 95f0fab..2523b41 100644 (file)
@@ -345,9 +345,9 @@ show_node_runtime (vlib_main_t * vm,
              if (j > 0)
                vlib_cli_output (vm, "---------------");
 
-             if (w->lcore_id > -1)
+             if (w->cpu_id > -1)
                vlib_cli_output (vm, "Thread %d %s (lcore %u)", j, w->name,
-                                w->lcore_id);
+                                w->cpu_id);
              else
                vlib_cli_output (vm, "Thread %d %s", j, w->name);
            }
@@ -459,27 +459,37 @@ show_node (vlib_main_t * vm, unformat_input_t * input,
           vlib_cli_command_t * cmd)
 {
   unformat_input_t _line_input, *line_input = &_line_input;
+  clib_error_t *error = 0;
   vlib_node_main_t *nm = &vm->node_main;
   vlib_node_t *n;
   u8 *s = 0, *s2 = 0;
   u32 i, node_index = ~0;
   char *type_str;
+  u8 valid_node_name = 0;
 
   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, "%U", unformat_vlib_node, vm, &node_index))
-       ;
-      else if (unformat (line_input, "index %u", &node_index))
+      if (unformat (line_input, "index %u", &node_index))
        ;
       else
-       return clib_error_return (0, "unknown input '%U'",
-                                 format_unformat_error, line_input);
+       if (unformat (line_input, "%U", unformat_vlib_node, vm, &node_index))
+       valid_node_name = 1;
+      else if (!valid_node_name)
+       error = clib_error_return (0, "unknown node name: '%U'",
+                                  format_unformat_error, line_input);
+      else
+       error = clib_error_return (0, "unknown input '%U'",
+                                  format_unformat_error, line_input);
     }
+
   unformat_free (line_input);
 
+  if (error)
+    return error;
+
   if (node_index >= vec_len (vm->node_main.nodes))
     return clib_error_return (0, "please specify valid node");
 
@@ -526,7 +536,7 @@ show_node (vlib_main_t * vm, unformat_input_t * input,
        }
     }
   else
-    s = format (s, "\n    defult only");
+    s = format (s, "\n    default only");
   vlib_cli_output (vm, "  node function variants:%v\n", s);
   vec_reset_length (s);
 
@@ -604,7 +614,7 @@ set_node_fn(vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd
 
   if (!unformat (line_input, "%s", &variant))
     {
-      err = clib_error_return (0, "please specify node function variant");
+      err = clib_error_return (0, "please specify node functional variant");
       goto done;
     }
 
@@ -612,7 +622,7 @@ set_node_fn(vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd
 
   if (n->node_fn_registrations == 0)
     {
-      err = clib_error_return (0, "node doesn't have fnuctiona varinats");
+      err = clib_error_return (0, "node doesn't have functional variants");
       goto done;
     }
 
@@ -638,7 +648,7 @@ set_node_fn(vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd
       fnr = fnr->next_registration;
     }
 
-  err = clib_error_return (0, "node fnuction variant '%s' not found", variant);
+  err = clib_error_return (0, "node functional variant '%s' not found", variant);
 
 done:
   vec_free (variant);