Merge pull request #2282 from dslicenc/cm20939-nbr-msg

bgpd: improve error message for neighbor not found
This commit is contained in:
Renato Westphal 2018-05-25 10:20:39 -03:00 committed by GitHub
commit cd126147a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 6 deletions

View File

@ -9648,13 +9648,13 @@ static struct peer *peer_lookup_in_view(struct vty *vty, struct bgp *bgp,
json_object *json_no = NULL; json_object *json_no = NULL;
json_no = json_object_new_object(); json_no = json_object_new_object();
json_object_string_add(json_no, "warning", json_object_string_add(json_no, "warning",
"No such neighbor"); "No such neighbor in this view/vrf");
vty_out(vty, "%s\n", vty_out(vty, "%s\n",
json_object_to_json_string_ext( json_object_to_json_string_ext(
json_no, JSON_C_TO_STRING_PRETTY)); json_no, JSON_C_TO_STRING_PRETTY));
json_object_free(json_no); json_object_free(json_no);
} else } else
vty_out(vty, "No such neighbor\n"); vty_out(vty, "No such neighbor in this view/vrf\n");
return NULL; return NULL;
} }
@ -10752,10 +10752,8 @@ DEFUN (show_ip_bgp_neighbor_routes,
peerstr = argv[++idx]->arg; peerstr = argv[++idx]->arg;
peer = peer_lookup_in_view(vty, bgp, peerstr, uj); peer = peer_lookup_in_view(vty, bgp, peerstr, uj);
if (!peer) { if (!peer)
vty_out(vty, "No such neighbor\n");
return CMD_WARNING; return CMD_WARNING;
}
if (argv_find(argv, argc, "flap-statistics", &idx)) if (argv_find(argv, argc, "flap-statistics", &idx))
sh_type = bgp_show_type_flap_neighbor; sh_type = bgp_show_type_flap_neighbor;

View File

@ -10655,7 +10655,7 @@ static int bgp_show_neighbor(struct vty *vty, struct bgp *bgp,
if (use_json) if (use_json)
json_object_boolean_true_add(json, "bgpNoSuchNeighbor"); json_object_boolean_true_add(json, "bgpNoSuchNeighbor");
else else
vty_out(vty, "%% No such neighbor\n"); vty_out(vty, "%% No such neighbor in this view/vrf\n");
} }
if (use_json) { if (use_json) {