* that is being parsed.
*
* The show commands are generally of the form:
- * "show [ip] bgp [<view|vrf> WORD] [<ipv4|ipv6> [<unicast|multicast|vpn|labeled-unicast>]] ..."
+ * "show [ip] bgp [<view|vrf> VIEWVRFNAME] [<ipv4|ipv6> [<unicast|multicast|vpn|labeled-unicast>]] ..."
*
* Since we use argv_find if the show command in particular doesn't have:
* [ip]
- * [<view|vrf> WORD]
+ * [<view|vrf> VIEWVRFNAME]
* [<ipv4|ipv6> [<unicast|multicast|vpn|labeled-unicast>]]
* The command parsing should still be ok.
*
/* "router bgp" commands. */
DEFUN_NOSH (router_bgp,
router_bgp_cmd,
- "router bgp [(1-4294967295) [<view|vrf> WORD]]",
+ "router bgp [(1-4294967295) [<view|vrf> VIEWVRFNAME]]",
ROUTER_STR
BGP_STR
AS_STR
/* "no router bgp" commands. */
DEFUN (no_router_bgp,
no_router_bgp_cmd,
- "no router bgp [(1-4294967295) [<view|vrf> WORD]]",
+ "no router bgp [(1-4294967295) [<view|vrf> VIEWVRFNAME]]",
NO_STR
ROUTER_STR
BGP_STR
DEFUN (bgp_maxmed_admin_medv,
bgp_maxmed_admin_medv_cmd,
- "bgp max-med administrative (0-4294967294)",
+ "bgp max-med administrative (0-4294967295)",
BGP_STR
"Advertise routes with max-med\n"
"Administratively applied, for an indefinite period\n"
int idx_number = 3;
bgp->v_maxmed_admin = 1;
- VTY_GET_INTEGER ("max-med admin med-value", bgp->maxmed_admin_value, argv[idx_number]->arg);
+ bgp->maxmed_admin_value = strtoul (argv[idx_number]->arg, NULL, 10);
bgp_maxmed_update(bgp);
DEFUN (no_bgp_maxmed_admin,
no_bgp_maxmed_admin_cmd,
- "no bgp max-med administrative [(0-4294967294)]",
+ "no bgp max-med administrative [(0-4294967295)]",
NO_STR
BGP_STR
"Advertise routes with max-med\n"
DEFUN (bgp_maxmed_onstartup,
bgp_maxmed_onstartup_cmd,
- "bgp max-med on-startup (5-86400)",
- BGP_STR
- "Advertise routes with max-med\n"
- "Effective on a startup\n"
- "Time (seconds) period for max-med\n")
-{
- VTY_DECLVAR_CONTEXT(bgp, bgp);
- int idx_number = 3;
- VTY_GET_INTEGER ("max-med on-startup period", bgp->v_maxmed_onstartup, argv[idx_number]->arg);
- bgp->maxmed_onstartup_value = BGP_MAXMED_VALUE_DEFAULT;
- bgp_maxmed_update(bgp);
-
- return CMD_SUCCESS;
-}
-
-DEFUN (bgp_maxmed_onstartup_medv,
- bgp_maxmed_onstartup_medv_cmd,
- "bgp max-med on-startup (5-86400) (0-4294967294)",
+ "bgp max-med on-startup (5-86400) [(0-4294967295)]",
BGP_STR
"Advertise routes with max-med\n"
"Effective on a startup\n"
"Max MED value to be used\n")
{
VTY_DECLVAR_CONTEXT(bgp, bgp);
- int idx_number = 3;
- int idx_number_2 = 4;
- VTY_GET_INTEGER ("max-med on-startup period", bgp->v_maxmed_onstartup, argv[idx_number]->arg);
- VTY_GET_INTEGER ("max-med on-startup med-value", bgp->maxmed_onstartup_value, argv[idx_number_2]->arg);
+ int idx = 0;
+
+ argv_find (argv, argc, "(5-86400)", &idx);
+ bgp->v_maxmed_onstartup = strtoul (argv[idx]->arg, NULL, 10);
+ if (argv_find (argv, argc, "(0-4294967295)", &idx))
+ bgp->maxmed_onstartup_value = strtoul (argv[idx]->arg, NULL, 10);
+ else
+ bgp->maxmed_onstartup_value = BGP_MAXMED_VALUE_DEFAULT;
+
bgp_maxmed_update(bgp);
return CMD_SUCCESS;
DEFUN (no_bgp_maxmed_onstartup,
no_bgp_maxmed_onstartup_cmd,
- "no bgp max-med on-startup [(5-86400) [(0-4294967294)]]",
+ "no bgp max-med on-startup [(5-86400) [(0-4294967295)]]",
NO_STR
BGP_STR
"Advertise routes with max-med\n"
return bgp_wpkt_quanta_config_vty(vty, argv[idx_number]->arg, 0);
}
-static int
-bgp_coalesce_config_vty (struct vty *vty, const char *num, char set)
-{
- VTY_DECLVAR_CONTEXT(bgp, bgp);
-
- if (set)
- VTY_GET_INTEGER_RANGE ("coalesce-time", bgp->coalesce_time, num,
- 0, 4294967295);
- else
- bgp->coalesce_time = BGP_DEFAULT_SUBGROUP_COALESCE_TIME;
-
- return CMD_SUCCESS;
-}
-
int
bgp_config_write_coalesce_time (struct vty *vty, struct bgp *bgp)
{
if (bgp->coalesce_time != BGP_DEFAULT_SUBGROUP_COALESCE_TIME)
- vty_out (vty, " coalesce-time %d%s",
+ vty_out (vty, " coalesce-time %u%s",
bgp->coalesce_time, VTY_NEWLINE);
return 0;
"Subgroup coalesce timer\n"
"Subgroup coalesce timer value (in ms)\n")
{
- int idx_number = 1;
- return bgp_coalesce_config_vty(vty, argv[idx_number]->arg, 1);
+ VTY_DECLVAR_CONTEXT(bgp, bgp);
+
+ int idx = 0;
+ argv_find (argv, argc, "(0-4294967295)", &idx);
+ bgp->coalesce_time = strtoul (argv[idx]->arg, NULL, 10);
+ return CMD_SUCCESS;
}
DEFUN (no_bgp_coalesce_time,
"Subgroup coalesce timer\n"
"Subgroup coalesce timer value (in ms)\n")
{
- int idx_number = 2;
- return bgp_coalesce_config_vty(vty, argv[idx_number]->arg, 0);
+ VTY_DECLVAR_CONTEXT(bgp, bgp);
+
+ bgp->coalesce_time = BGP_DEFAULT_SUBGROUP_COALESCE_TIME;
+ return CMD_SUCCESS;
}
/* Maximum-paths configuration */
/* one clear bgp command to rule them all */
DEFUN (clear_ip_bgp_all,
clear_ip_bgp_all_cmd,
- "clear [ip] bgp [<view|vrf> WORD] ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] <*|A.B.C.D|X:X::X:X|WORD|(1-4294967295)|external|peer-group WORD> [<soft [<in|out>]|in [prefix-filter]|out>]",
+ "clear [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] <*|A.B.C.D|X:X::X:X|WORD|(1-4294967295)|external|peer-group WORD> [<soft [<in|out>]|in [prefix-filter]|out>]",
CLEAR_STR
IP_STR
BGP_STR
/* clear [ip] bgp */
if (argv_find (argv, argc, "ip", &idx))
afi = AFI_IP;
- /* [<view|vrf> WORD] */
+ /* [<view|vrf> VIEWVRFNAME] */
if (argv_find (argv, argc, "view", &idx) || argv_find (argv, argc, "vrf", &idx))
{
vrf = argv[idx + 1]->arg;
DEFUN (clear_ip_bgp_prefix,
clear_ip_bgp_prefix_cmd,
- "clear [ip] bgp [<view|vrf> WORD] prefix A.B.C.D/M",
+ "clear [ip] bgp [<view|vrf> VIEWVRFNAME] prefix A.B.C.D/M",
CLEAR_STR
IP_STR
BGP_STR
int idx = 0;
- /* [<view|vrf> WORD] */
+ /* [<view|vrf> VIEWVRFNAME] */
if (argv_find (argv, argc, "WORD", &idx))
vrf = argv[idx]->arg;
DEFUN (clear_bgp_instance_ipv6_safi_prefix,
clear_bgp_instance_ipv6_safi_prefix_cmd,
- "clear [ip] bgp <view|vrf> WORD ipv6 "BGP_SAFI_CMD_STR" prefix X:X::X:X/M",
+ "clear [ip] bgp <view|vrf> VIEWVRFNAME ipv6 "BGP_SAFI_CMD_STR" prefix X:X::X:X/M",
CLEAR_STR
IP_STR
BGP_STR
else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
json_object_string_add(json_peer, "state", "Idle (PfxCt)");
else
- json_object_string_add(json_peer, "state", LOOKUP(bgp_status_msg, peer->status));
+ json_object_string_add(json_peer, "state", lookup_msg(bgp_status_msg, peer->status, NULL));
if (peer->conf_if)
json_object_string_add(json_peer, "idType", "interface");
else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
vty_out (vty, " Idle (PfxCt)");
else
- vty_out (vty, " %12s", LOOKUP(bgp_status_msg, peer->status));
+ vty_out (vty, " %12s", lookup_msg(bgp_status_msg, peer->status, NULL));
}
vty_out (vty, "%s", VTY_NEWLINE);
}
/* `show [ip] bgp summary' commands. */
DEFUN (show_ip_bgp_summary,
show_ip_bgp_summary_cmd,
- "show [ip] bgp [<view|vrf> WORD] ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] summary [json]",
+ "show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] summary [json]",
SHOW_STR
IP_STR
BGP_STR
/* show [ip] bgp */
if (argv_find (argv, argc, "ip", &idx))
afi = AFI_IP;
- /* [<view|vrf> WORD] */
+ /* [<view|vrf> VIEWVRFNAME] */
if (argv_find (argv, argc, "view", &idx) || argv_find (argv, argc, "vrf", &idx))
vrf = argv[++idx]->arg;
/* ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] */
json_object_boolean_true_add(json_neigh, "nbrCommonAdmin");
/* Status. */
- json_object_string_add(json_neigh, "bgpState", LOOKUP (bgp_status_msg, p->status));
+ json_object_string_add(json_neigh, "bgpState", lookup_msg(bgp_status_msg, p->status, NULL));
if (p->status == Established)
{
vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE);
/* Status. */
- vty_out (vty, " BGP state = %s", LOOKUP (bgp_status_msg, p->status));
+ vty_out (vty, " BGP state = %s", lookup_msg(bgp_status_msg, p->status, NULL));
if (p->status == Established)
vty_out (vty, ", up for %8s", peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN, 0, NULL));
/* "show [ip] bgp neighbors" commands. */
DEFUN (show_ip_bgp_neighbors,
show_ip_bgp_neighbors_cmd,
- "show [ip] bgp [<view|vrf> WORD] [<ipv4|ipv6|vpnv4 <all|rd ASN:nn_or_IP-address:nn>>] neighbors [<A.B.C.D|X:X::X:X|WORD>] [json]",
+ "show [ip] bgp [<view|vrf> VIEWVRFNAME] [<ipv4|ipv6|vpnv4 <all|rd ASN:nn_or_IP-address:nn>>] neighbors [<A.B.C.D|X:X::X:X|WORD>] [json]",
SHOW_STR
IP_STR
BGP_STR
DEFUN (show_ip_bgp_updgrps,
show_ip_bgp_updgrps_cmd,
- "show [ip] bgp [<view|vrf> WORD] ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] update-groups [SUBGROUP-ID]",
+ "show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] update-groups [SUBGROUP-ID]",
SHOW_STR
IP_STR
BGP_STR
/* show [ip] bgp */
if (argv_find (argv, argc, "ip", &idx))
afi = AFI_IP;
- /* [<view|vrf> WORD] */
+ /* [<view|vrf> VIEWVRFNAME] */
if (argv_find (argv, argc, "view", &idx) || argv_find (argv, argc, "vrf", &idx))
vrf = argv[++idx]->arg;
/* ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] */
DEFUN (show_bgp_instance_updgrps_stats,
show_bgp_instance_updgrps_stats_cmd,
- "show [ip] bgp <view|vrf> WORD update-groups statistics",
+ "show [ip] bgp <view|vrf> VIEWVRFNAME update-groups statistics",
SHOW_STR
IP_STR
BGP_STR
DEFUN (show_ip_bgp_instance_updgrps_adj,
show_ip_bgp_instance_updgrps_adj_cmd,
- "show [ip] bgp <view|vrf> WORD update-groups <advertise-queue|advertised-routes|packet-queue>",
+ "show [ip] bgp <view|vrf> VIEWVRFNAME update-groups <advertise-queue|advertised-routes|packet-queue>",
SHOW_STR
IP_STR
BGP_STR
DEFUN (show_bgp_instance_updgrps_adj,
show_bgp_instance_updgrps_adj_cmd,
- "show [ip] bgp <view|vrf> WORD update-groups <advertise-queue|advertised-routes|packet-queue>",
+ "show [ip] bgp <view|vrf> VIEWVRFNAME update-groups <advertise-queue|advertised-routes|packet-queue>",
SHOW_STR
IP_STR
BGP_STR
DEFUN (show_ip_bgp_instance_updgrps_adj_s,
show_ip_bgp_instance_updgrps_adj_s_cmd,
- "show [ip] bgp <view|vrf> WORD update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
+ "show [ip] bgp <view|vrf> VIEWVRFNAME update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
SHOW_STR
IP_STR
BGP_STR
DEFUN (show_bgp_instance_updgrps_adj_s,
show_bgp_instance_updgrps_adj_s_cmd,
- "show [ip] bgp <view|vrf> WORD update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
+ "show [ip] bgp <view|vrf> VIEWVRFNAME update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
SHOW_STR
IP_STR
BGP_STR
else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
peer_status = "Idle (PfxCt)";
else
- peer_status = LOOKUP(bgp_status_msg, peer->status);
+ peer_status = lookup_msg(bgp_status_msg, peer->status, NULL);
dynamic = peer_dynamic_neighbor(peer);
vty_out (vty, " %s %s %s %s",
DEFUN (show_ip_bgp_peer_groups,
show_ip_bgp_peer_groups_cmd,
- "show [ip] bgp [<view|vrf> WORD] peer-group [PGNAME]",
+ "show [ip] bgp [<view|vrf> VIEWVRFNAME] peer-group [PGNAME]",
SHOW_STR
IP_STR
BGP_STR
install_element (BGP_NODE, &bgp_maxmed_admin_medv_cmd);
install_element (BGP_NODE, &bgp_maxmed_onstartup_cmd);
install_element (BGP_NODE, &no_bgp_maxmed_onstartup_cmd);
- install_element (BGP_NODE, &bgp_maxmed_onstartup_medv_cmd);
/* bgp disable-ebgp-connected-nh-check */
install_element (BGP_NODE, &bgp_disable_connected_route_check_cmd);