all: Fix underfull doc strings, part 2

Add missing docstrings and separating \n.
Also eat some low-hanging refactoring fruit.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
This commit is contained in:
Quentin Young 2016-11-08 01:46:04 +00:00
parent dff6764af2
commit d7fa34c1bc
8 changed files with 66 additions and 34 deletions

View File

@ -619,7 +619,8 @@ DEFUN_HIDDEN (neighbor_bfd_type,
NEIGHBOR_STR NEIGHBOR_STR
NEIGHBOR_ADDR_STR2 NEIGHBOR_ADDR_STR2
"Enables BFD support\n" "Enables BFD support\n"
"Session type\n") "Multihop session\n"
"Single hop session\n")
{ {
int idx_peer = 1; int idx_peer = 1;
int idx_hop = 3; int idx_hop = 3;

View File

@ -3490,7 +3490,8 @@ DEFUN (no_set_community,
"no set community AA:NN...", "no set community AA:NN...",
NO_STR NO_STR
SET_STR SET_STR
"BGP community attribute\n") "BGP community attribute\n"
COMMUNITY_VAL_STR)
{ {
return generic_set_delete (vty, vty->index, "community", NULL); return generic_set_delete (vty, vty->index, "community", NULL);
} }
@ -3525,7 +3526,11 @@ DEFUN (no_set_community_delete,
"no set comm-list [<(1-99)|(100-500)|WORD> delete]", "no set comm-list [<(1-99)|(100-500)|WORD> delete]",
NO_STR NO_STR
SET_STR SET_STR
"set BGP community list (for deletion)\n") "set BGP community list (for deletion)\n"
"Community-list number (standard)\n"
"Community-list number (expanded)\n"
"Community-list name\n"
"Delete matching communities\n")
{ {
return generic_set_delete (vty, vty->index, "comm-list", NULL); return generic_set_delete (vty, vty->index, "comm-list", NULL);
} }
@ -3619,7 +3624,10 @@ DEFUN (no_set_origin,
"no set origin [<egp|igp|incomplete>]", "no set origin [<egp|igp|incomplete>]",
NO_STR NO_STR
SET_STR SET_STR
"BGP origin code\n") "BGP origin code\n"
"remote EGP\n"
"local IGP\n"
"unknown heritage\n")
{ {
return generic_set_delete (vty, vty->index, "origin", NULL); return generic_set_delete (vty, vty->index, "origin", NULL);
} }

View File

@ -1307,6 +1307,7 @@ DEFUN (bgp_wpkt_quanta,
DEFUN (no_bgp_wpkt_quanta, DEFUN (no_bgp_wpkt_quanta,
no_bgp_wpkt_quanta_cmd, no_bgp_wpkt_quanta_cmd,
"no write-quanta (1-10000)", "no write-quanta (1-10000)",
NO_STR
"How many packets to write to peer socket per run\n" "How many packets to write to peer socket per run\n"
"Number of packets\n") "Number of packets\n")
{ {
@ -2380,26 +2381,29 @@ DEFUN (bgp_listen_range,
bgp_listen_range_cmd, bgp_listen_range_cmd,
"bgp listen range <A.B.C.D/M|X:X::X:X/M> peer-group WORD", "bgp listen range <A.B.C.D/M|X:X::X:X/M> peer-group WORD",
"BGP specific commands\n" "BGP specific commands\n"
"Configure BGP Dynamic Neighbors\n" "Configure BGP dynamic neighbors listen range\n"
"add a listening range for Dynamic Neighbors\n" "Configure BGP dynamic neighbors listen range\n"
NEIGHBOR_ADDR_STR NEIGHBOR_ADDR_STR
"Member of the peer-group\n" "Member of the peer-group\n"
"Peer-group name\n") "Peer-group name\n")
{ {
int idx_ipv4_ipv6_prefixlen = 3;
int idx_word = 5;
struct bgp *bgp; struct bgp *bgp;
struct prefix range; struct prefix range;
struct peer_group *group, *existing_group; struct peer_group *group, *existing_group;
afi_t afi; afi_t afi;
int ret; int ret;
int idx = 0;
argv_find (argv, argc, "A.B.C.D/M", &idx);
argv_find (argv, argc, "X:X::X:X/M", &idx);
char *prefix = argv[idx]->arg;
argv_find (argv, argc, "WORD", &idx);
char *peergroup = argv[idx]->arg;
bgp = vty->index; bgp = vty->index;
//VTY_GET_IPV4_PREFIX ("listen range", range, argv[idx_ipv4_ipv6_prefixlen]->arg);
/* Convert IP prefix string to struct prefix. */ /* Convert IP prefix string to struct prefix. */
ret = str2prefix (argv[idx_ipv4_ipv6_prefixlen]->arg, &range); ret = str2prefix (prefix, &range);
if (! ret) if (! ret)
{ {
vty_out (vty, "%% Malformed listen range%s", VTY_NEWLINE); vty_out (vty, "%% Malformed listen range%s", VTY_NEWLINE);
@ -2408,14 +2412,12 @@ DEFUN (bgp_listen_range,
afi = family2afi(range.family); afi = family2afi(range.family);
#ifdef HAVE_IPV6
if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&range.u.prefix6)) if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&range.u.prefix6))
{ {
vty_out (vty, "%% Malformed listen range (link-local address)%s", vty_out (vty, "%% Malformed listen range (link-local address)%s",
VTY_NEWLINE); VTY_NEWLINE);
return CMD_WARNING; return CMD_WARNING;
} }
#endif /* HAVE_IPV6 */
apply_mask (&range); apply_mask (&range);
@ -2423,7 +2425,7 @@ DEFUN (bgp_listen_range,
existing_group = listen_range_exists (bgp, &range, 1); existing_group = listen_range_exists (bgp, &range, 1);
if (existing_group) if (existing_group)
{ {
if (strcmp (existing_group->name, argv[idx_word]->arg) == 0) if (strcmp (existing_group->name, peergroup) == 0)
return CMD_SUCCESS; return CMD_SUCCESS;
else else
{ {
@ -2441,7 +2443,7 @@ DEFUN (bgp_listen_range,
return CMD_WARNING; return CMD_WARNING;
} }
group = peer_group_lookup (bgp, argv[idx_word]->arg); group = peer_group_lookup (bgp, peergroup);
if (! group) if (! group)
{ {
vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
@ -2454,26 +2456,34 @@ DEFUN (bgp_listen_range,
DEFUN (no_bgp_listen_range, DEFUN (no_bgp_listen_range,
no_bgp_listen_range_cmd, no_bgp_listen_range_cmd,
"no bgp listen range A.B.C.D/M peer-group WORD", "no bgp listen range <A.B.C.D/M|X:X::X:X/M> peer-group WORD",
NO_STR
"BGP specific commands\n" "BGP specific commands\n"
"Configure BGP defaults\n" "Unconfigure BGP dynamic neighbors listen range\n"
"delete a listening range for Dynamic Neighbors\n" "Unconfigure BGP dynamic neighbors listen range\n"
"Remove Dynamic Neighbors listening range\n") NEIGHBOR_ADDR_STR
"Member of the peer-group\n"
"Peer-group name\n")
{ {
int idx_ipv4_prefixlen = 4;
int idx_word = 6;
struct bgp *bgp; struct bgp *bgp;
struct prefix range; struct prefix range;
struct peer_group *group; struct peer_group *group;
afi_t afi; afi_t afi;
int ret; int ret;
int idx = 0;
argv_find (argv, argc, "A.B.C.D/M", &idx);
argv_find (argv, argc, "X:X::X:X/M", &idx);
char *prefix = argv[idx]->arg;
argv_find (argv, argc, "WORD", &idx);
char *peergroup = argv[idx]->arg;
bgp = vty->index; bgp = vty->index;
// VTY_GET_IPV4_PREFIX ("listen range", range, argv[idx_ipv4_prefixlen]->arg); // VTY_GET_IPV4_PREFIX ("listen range", range, argv[idx_ipv4_prefixlen]->arg);
/* Convert IP prefix string to struct prefix. */ /* Convert IP prefix string to struct prefix. */
ret = str2prefix (argv[idx_ipv4_prefixlen]->arg, &range); ret = str2prefix (prefix, &range);
if (! ret) if (! ret)
{ {
vty_out (vty, "%% Malformed listen range%s", VTY_NEWLINE); vty_out (vty, "%% Malformed listen range%s", VTY_NEWLINE);
@ -2482,19 +2492,16 @@ DEFUN (no_bgp_listen_range,
afi = family2afi(range.family); afi = family2afi(range.family);
#ifdef HAVE_IPV6
if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&range.u.prefix6)) if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&range.u.prefix6))
{ {
vty_out (vty, "%% Malformed listen range (link-local address)%s", vty_out (vty, "%% Malformed listen range (link-local address)%s",
VTY_NEWLINE); VTY_NEWLINE);
return CMD_WARNING; return CMD_WARNING;
} }
#endif /* HAVE_IPV6 */
apply_mask (&range); apply_mask (&range);
group = peer_group_lookup (bgp, peergroup);
group = peer_group_lookup (bgp, argv[idx_word]->arg);
if (! group) if (! group)
{ {
vty_out (vty, "%% Peer-group does not exist%s", VTY_NEWLINE); vty_out (vty, "%% Peer-group does not exist%s", VTY_NEWLINE);
@ -2643,7 +2650,9 @@ DEFUN (neighbor_remote_as,
NEIGHBOR_STR NEIGHBOR_STR
NEIGHBOR_ADDR_STR2 NEIGHBOR_ADDR_STR2
"Specify a BGP neighbor\n" "Specify a BGP neighbor\n"
AS_STR) AS_STR
"External BGP peer\n"
"Internal BGP peer\n")
{ {
int idx_peer = 1; int idx_peer = 1;
int idx_remote_as = 3; int idx_remote_as = 3;
@ -2800,7 +2809,9 @@ DEFUN (neighbor_interface_config_remote_as,
NEIGHBOR_STR NEIGHBOR_STR
"Interface name or neighbor tag\n" "Interface name or neighbor tag\n"
"Enable BGP on interface\n" "Enable BGP on interface\n"
AS_STR) AS_STR
"External BGP peer\n"
"Internal BGP peer\n")
{ {
int idx_word = 1; int idx_word = 1;
int idx_remote_as = 4; int idx_remote_as = 4;
@ -2814,7 +2825,9 @@ DEFUN (neighbor_interface_v6only_config_remote_as,
NEIGHBOR_STR NEIGHBOR_STR
"Interface name or neighbor tag\n" "Interface name or neighbor tag\n"
"Enable BGP on interface\n" "Enable BGP on interface\n"
AS_STR) AS_STR
"External BGP peer\n"
"Internal BGP peer\n")
{ {
int idx_word = 1; int idx_word = 1;
int idx_remote_as = 5; int idx_remote_as = 5;
@ -5409,7 +5422,8 @@ DEFUN (neighbor_ttl_security,
NEIGHBOR_STR NEIGHBOR_STR
NEIGHBOR_ADDR_STR2 NEIGHBOR_ADDR_STR2
"BGP ttl-security parameters\n" "BGP ttl-security parameters\n"
"Specify the maximum number of hops to the BGP peer\n") "Specify the maximum number of hops to the BGP peer\n"
"Number of hops to BGP peer\n")
{ {
int idx_peer = 1; int idx_peer = 1;
int idx_number = 4; int idx_number = 4;

View File

@ -1906,6 +1906,7 @@ DEFUN (log_adj_changes,
DEFUN (no_log_adj_changes, DEFUN (no_log_adj_changes,
no_log_adj_changes_cmd, no_log_adj_changes_cmd,
"no log-adjacency-changes", "no log-adjacency-changes",
NO_STR
"Stop logging changes in adjacency state\n") "Stop logging changes in adjacency state\n")
{ {
VTY_DECLVAR_CONTEXT (isis_area, area); VTY_DECLVAR_CONTEXT (isis_area, area);

View File

@ -898,9 +898,11 @@ DEFUN (show_ipv6_ospf6_simulate_spf_tree_root,
SHOW_STR SHOW_STR
IP6_STR IP6_STR
OSPF6_STR OSPF6_STR
"Shortest Path First caculation\n" "Shortest Path First calculation\n"
"Show SPF tree\n" "Show SPF tree\n"
"Specify root's router-id to calculate another router's SPF tree\n") "Specify root's router-id to calculate another router's SPF tree\n"
"OSPF6 area parameters\n"
OSPF6_AREA_ID_STR)
{ {
int idx_ipv4 = 5; int idx_ipv4 = 5;
int idx_ipv4_2 = 7; int idx_ipv4_2 = 7;

View File

@ -3189,6 +3189,7 @@ DEFUN (interface_ip_pim_drprio,
DEFUN (interface_no_ip_pim_drprio, DEFUN (interface_no_ip_pim_drprio,
interface_no_ip_pim_drprio_cmd, interface_no_ip_pim_drprio_cmd,
"no ip pim drpriority [(1-4294967295)]", "no ip pim drpriority [(1-4294967295)]",
NO_STR
IP_STR IP_STR
PIM_STR PIM_STR
"Revert the Designated Router Priority to default\n" "Revert the Designated Router Priority to default\n"

View File

@ -415,6 +415,7 @@ DEFUN (ip_irdp_shutdown,
ip_irdp_shutdown_cmd, ip_irdp_shutdown_cmd,
"ip irdp shutdown", "ip irdp shutdown",
IP_STR IP_STR
"ICMP Router discovery on this interface\n"
"ICMP Router discovery shutdown on this interface\n") "ICMP Router discovery shutdown on this interface\n")
{ {
VTY_DECLVAR_CONTEXT (interface, ifp); VTY_DECLVAR_CONTEXT (interface, ifp);
@ -428,6 +429,7 @@ DEFUN (no_ip_irdp_shutdown,
"no ip irdp shutdown", "no ip irdp shutdown",
NO_STR NO_STR
IP_STR IP_STR
"ICMP Router discovery on this interface\n"
"ICMP Router discovery no shutdown on this interface\n") "ICMP Router discovery no shutdown on this interface\n")
{ {
VTY_DECLVAR_CONTEXT (interface, ifp); VTY_DECLVAR_CONTEXT (interface, ifp);

View File

@ -230,6 +230,7 @@ DEFUN (ip_mroute_dist,
DEFUN (no_ip_mroute_dist, DEFUN (no_ip_mroute_dist,
no_ip_mroute_dist_cmd, no_ip_mroute_dist_cmd,
"no ip mroute A.B.C.D/M <A.B.C.D|INTERFACE> [(1-255)]", "no ip mroute A.B.C.D/M <A.B.C.D|INTERFACE> [(1-255)]",
NO_STR
IP_STR IP_STR
"Configure static unicast route into MRIB for multicast RPF lookup\n" "Configure static unicast route into MRIB for multicast RPF lookup\n"
"IP destination prefix (e.g. 10.0.0.0/8)\n" "IP destination prefix (e.g. 10.0.0.0/8)\n"
@ -1195,7 +1196,8 @@ DEFUN (show_ip_route,
"show ip route [json]", "show ip route [json]",
SHOW_STR SHOW_STR
IP_STR IP_STR
"IP routing table\n") "IP routing table\n"
"JavaScript Object Notation\n")
{ {
return do_show_ip_route (vty, VRF_DEFAULT_NAME, SAFI_UNICAST, use_json(argc, argv)); return do_show_ip_route (vty, VRF_DEFAULT_NAME, SAFI_UNICAST, use_json(argc, argv));
} }
@ -1290,7 +1292,8 @@ DEFUN (show_ip_route_vrf,
SHOW_STR SHOW_STR
IP_STR IP_STR
"IP routing table\n" "IP routing table\n"
VRF_CMD_HELP_STR) VRF_CMD_HELP_STR
"JavaScript Object Notation\n")
{ {
int idx_vrf = 4; int idx_vrf = 4;
u_char uj = use_json(argc, argv); u_char uj = use_json(argc, argv);