mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-13 22:26:14 +00:00
bgpd: take into account code style recommendations.
take into account polychaeta tips ono code style. also, take into account miscellaneous code style recommandations like braces usage. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
This commit is contained in:
parent
1471864374
commit
9ab0cf5830
377
bgpd/bgp_route.c
377
bgpd/bgp_route.c
@ -10555,15 +10555,10 @@ static int bgp_table_stats(struct vty *vty, struct bgp *bgp, afi_t afi,
|
||||
safi_t safi, struct json_object *json);
|
||||
|
||||
|
||||
DEFUN (show_ip_bgp_statistics_all,
|
||||
show_ip_bgp_statistics_all_cmd,
|
||||
"show [ip] bgp [<view|vrf> VIEWVRFNAME] statistics-all [json]",
|
||||
SHOW_STR
|
||||
IP_STR
|
||||
BGP_STR
|
||||
BGP_INSTANCE_HELP_STR
|
||||
"Display number of prefixes for all afi/safi\n"
|
||||
JSON_STR)
|
||||
DEFUN(show_ip_bgp_statistics_all, show_ip_bgp_statistics_all_cmd,
|
||||
"show [ip] bgp [<view|vrf> VIEWVRFNAME] statistics-all [json]",
|
||||
SHOW_STR IP_STR BGP_STR BGP_INSTANCE_HELP_STR
|
||||
"Display number of prefixes for all afi/safi\n" JSON_STR)
|
||||
{
|
||||
bool uj = use_json(argc, argv);
|
||||
struct bgp *bgp = NULL;
|
||||
@ -10575,43 +10570,38 @@ DEFUN (show_ip_bgp_statistics_all,
|
||||
|
||||
bgp_vty_find_and_parse_afi_safi_bgp(vty, argv, argc, &idx, &afi, &safi,
|
||||
&bgp, false);
|
||||
if (!idx)
|
||||
if (!bgp)
|
||||
return CMD_WARNING;
|
||||
|
||||
if (uj)
|
||||
json_all = json_object_new_object();
|
||||
|
||||
for (afi = AFI_IP; afi < AFI_MAX; afi++) {
|
||||
for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) {
|
||||
/*
|
||||
* So limit output to those afi/safi
|
||||
* pairs that
|
||||
* actualy have something interesting in
|
||||
* them
|
||||
*/
|
||||
if (strmatch(get_afi_safi_str(afi, safi, true),
|
||||
"Unknown")) {
|
||||
continue;
|
||||
}
|
||||
if (uj)
|
||||
json_afi_safi = json_object_new_array();
|
||||
else
|
||||
json_afi_safi = NULL;
|
||||
|
||||
bgp_table_stats(vty, bgp, afi, safi, json_afi_safi);
|
||||
|
||||
if (uj)
|
||||
json_object_object_add(json_all,
|
||||
get_afi_safi_str(afi,
|
||||
safi, true),
|
||||
json_afi_safi);
|
||||
|
||||
FOREACH_AFI_SAFI (afi, safi) {
|
||||
/*
|
||||
* So limit output to those afi/safi pairs that
|
||||
* actually have something interesting in them
|
||||
*/
|
||||
if (strmatch(get_afi_safi_str(afi, safi, true),
|
||||
"Unknown")) {
|
||||
continue;
|
||||
}
|
||||
if (uj) {
|
||||
json_afi_safi = json_object_new_array();
|
||||
json_object_object_add(
|
||||
json_all,
|
||||
get_afi_safi_str(afi, safi, true),
|
||||
json_afi_safi);
|
||||
} else {
|
||||
json_afi_safi = NULL;
|
||||
}
|
||||
|
||||
bgp_table_stats(vty, bgp, afi, safi, json_afi_safi);
|
||||
}
|
||||
|
||||
if (uj) {
|
||||
vty_out(vty, "%s", json_object_to_json_string_ext(
|
||||
json_all, JSON_C_TO_STRING_PRETTY));
|
||||
vty_out(vty, "%s",
|
||||
json_object_to_json_string_ext(
|
||||
json_all, JSON_C_TO_STRING_PRETTY));
|
||||
json_object_free(json_all);
|
||||
}
|
||||
|
||||
@ -10621,7 +10611,7 @@ DEFUN (show_ip_bgp_statistics_all,
|
||||
/* BGP route print out function without JSON */
|
||||
DEFUN (show_ip_bgp_l2vpn_evpn_statistics,
|
||||
show_ip_bgp_l2vpn_evpn_statistics_cmd,
|
||||
"show [ip] bgp [<view|vrf> VIEWVRFNAME] [l2vpn [evpn]] statistics [json]",
|
||||
"show [ip] bgp [<view|vrf> VIEWVRFNAME] l2vpn evpn statistics [json]",
|
||||
SHOW_STR
|
||||
IP_STR
|
||||
BGP_STR
|
||||
@ -10631,8 +10621,8 @@ DEFUN (show_ip_bgp_l2vpn_evpn_statistics,
|
||||
"BGP RIB advertisement statistics\n"
|
||||
JSON_STR)
|
||||
{
|
||||
afi_t afi = AFI_L2VPN;
|
||||
safi_t safi = SAFI_EVPN;
|
||||
afi_t afi;
|
||||
safi_t safi;
|
||||
struct bgp *bgp = NULL;
|
||||
int idx = 0, ret;
|
||||
bool uj = use_json(argc, argv);
|
||||
@ -10662,21 +10652,17 @@ DEFUN (show_ip_bgp_l2vpn_evpn_statistics,
|
||||
}
|
||||
|
||||
/* BGP route print out function without JSON */
|
||||
DEFUN (show_ip_bgp_afi_safi_statistics,
|
||||
show_ip_bgp_afi_safi_statistics_cmd,
|
||||
"show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR" ["BGP_SAFI_WITH_LABEL_CMD_STR"]]\
|
||||
DEFUN(show_ip_bgp_afi_safi_statistics, show_ip_bgp_afi_safi_statistics_cmd,
|
||||
"show [ip] bgp [<view|vrf> VIEWVRFNAME] [" BGP_AFI_CMD_STR
|
||||
" [" BGP_SAFI_WITH_LABEL_CMD_STR
|
||||
"]]\
|
||||
statistics [json]",
|
||||
SHOW_STR
|
||||
IP_STR
|
||||
BGP_STR
|
||||
BGP_INSTANCE_HELP_STR
|
||||
BGP_AFI_HELP_STR
|
||||
BGP_SAFI_WITH_LABEL_HELP_STR
|
||||
"BGP RIB advertisement statistics\n"
|
||||
JSON_STR)
|
||||
SHOW_STR IP_STR BGP_STR BGP_INSTANCE_HELP_STR BGP_AFI_HELP_STR
|
||||
BGP_SAFI_WITH_LABEL_HELP_STR
|
||||
"BGP RIB advertisement statistics\n" JSON_STR)
|
||||
{
|
||||
afi_t afi = AFI_IP6;
|
||||
safi_t safi = SAFI_UNICAST;
|
||||
afi_t afi;
|
||||
safi_t safi;
|
||||
struct bgp *bgp = NULL;
|
||||
int idx = 0, ret;
|
||||
bool uj = use_json(argc, argv);
|
||||
@ -10698,18 +10684,19 @@ DEFUN (show_ip_bgp_afi_safi_statistics,
|
||||
json = json_object_new_object();
|
||||
json_object_object_add(json, get_afi_safi_str(afi, safi, true),
|
||||
json_afi_safi);
|
||||
vty_out(vty, "%s", json_object_to_json_string_ext(
|
||||
json, JSON_C_TO_STRING_PRETTY));
|
||||
vty_out(vty, "%s",
|
||||
json_object_to_json_string_ext(
|
||||
json, JSON_C_TO_STRING_PRETTY));
|
||||
json_object_free(json);
|
||||
}
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
/* BGP route print out function without JSON */
|
||||
DEFUN (show_ip_bgp,
|
||||
show_ip_bgp_cmd,
|
||||
"show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR" ["BGP_SAFI_WITH_LABEL_CMD_STR"]]\
|
||||
DEFUN(show_ip_bgp, show_ip_bgp_cmd,
|
||||
"show [ip] bgp [<view|vrf> VIEWVRFNAME] [" BGP_AFI_CMD_STR
|
||||
" [" BGP_SAFI_WITH_LABEL_CMD_STR
|
||||
"]]\
|
||||
<dampening <parameters>\
|
||||
|route-map WORD\
|
||||
|prefix-list WORD\
|
||||
@ -10718,28 +10705,24 @@ DEFUN (show_ip_bgp,
|
||||
|A.B.C.D/M longer-prefixes\
|
||||
|X:X::X:X/M longer-prefixes\
|
||||
>",
|
||||
SHOW_STR
|
||||
IP_STR
|
||||
BGP_STR
|
||||
BGP_INSTANCE_HELP_STR
|
||||
BGP_AFI_HELP_STR
|
||||
BGP_SAFI_WITH_LABEL_HELP_STR
|
||||
"Display detailed information about dampening\n"
|
||||
"Display detail of configured dampening parameters\n"
|
||||
"Display routes matching the route-map\n"
|
||||
"A route-map to match on\n"
|
||||
"Display routes conforming to the prefix-list\n"
|
||||
"Prefix-list name\n"
|
||||
"Display routes conforming to the filter-list\n"
|
||||
"Regular expression access list name\n"
|
||||
"Display routes matching the community-list\n"
|
||||
"community-list number\n"
|
||||
"community-list name\n"
|
||||
"Exact match of the communities\n"
|
||||
"IPv4 prefix\n"
|
||||
"Display route and more specific routes\n"
|
||||
"IPv6 prefix\n"
|
||||
"Display route and more specific routes\n")
|
||||
SHOW_STR IP_STR BGP_STR BGP_INSTANCE_HELP_STR BGP_AFI_HELP_STR
|
||||
BGP_SAFI_WITH_LABEL_HELP_STR
|
||||
"Display detailed information about dampening\n"
|
||||
"Display detail of configured dampening parameters\n"
|
||||
"Display routes matching the route-map\n"
|
||||
"A route-map to match on\n"
|
||||
"Display routes conforming to the prefix-list\n"
|
||||
"Prefix-list name\n"
|
||||
"Display routes conforming to the filter-list\n"
|
||||
"Regular expression access list name\n"
|
||||
"Display routes matching the community-list\n"
|
||||
"community-list number\n"
|
||||
"community-list name\n"
|
||||
"Exact match of the communities\n"
|
||||
"IPv4 prefix\n"
|
||||
"Display route and more specific routes\n"
|
||||
"IPv6 prefix\n"
|
||||
"Display route and more specific routes\n")
|
||||
{
|
||||
afi_t afi = AFI_IP6;
|
||||
safi_t safi = SAFI_UNICAST;
|
||||
@ -11174,32 +11157,32 @@ enum bgp_stats {
|
||||
BGP_STATS_MAX,
|
||||
};
|
||||
|
||||
#define TABLE_STATS_IDX_VTY 0
|
||||
#define TABLE_STATS_IDX_VTY 0
|
||||
#define TABLE_STATS_IDX_JSON 1
|
||||
|
||||
static const char *table_stats_strs[][2] = {
|
||||
[BGP_STATS_PREFIXES] = {"Total Prefixes", "totalPrefixes"},
|
||||
[BGP_STATS_TOTPLEN] = {"Average prefix length", "averagePrefixLength"},
|
||||
[BGP_STATS_RIB] = {"Total Advertisements", "totalAdvertisements"},
|
||||
[BGP_STATS_UNAGGREGATEABLE] =
|
||||
{"Unaggregateable prefixes", "unaggregateablePrefixes"},
|
||||
[BGP_STATS_MAX_AGGREGATEABLE] =
|
||||
{"Maximum aggregateable prefixes", "maximumAggregateablePrefixes"},
|
||||
[BGP_STATS_AGGREGATES] =
|
||||
{"BGP Aggregate advertisements", "bgpAggregateAdvertisements"},
|
||||
[BGP_STATS_UNAGGREGATEABLE] = {"Unaggregateable prefixes",
|
||||
"unaggregateablePrefixes"},
|
||||
[BGP_STATS_MAX_AGGREGATEABLE] = {"Maximum aggregateable prefixes",
|
||||
"maximumAggregateablePrefixes"},
|
||||
[BGP_STATS_AGGREGATES] = {"BGP Aggregate advertisements",
|
||||
"bgpAggregateAdvertisements"},
|
||||
[BGP_STATS_SPACE] = {"Address space advertised",
|
||||
"addressSpaceAdvertised"},
|
||||
[BGP_STATS_ASPATH_COUNT] =
|
||||
{"Advertisements with paths", "advertisementsWithPaths"},
|
||||
[BGP_STATS_ASPATH_MAXHOPS] =
|
||||
{"Longest AS-Path (hops)", "longestAsPath"},
|
||||
[BGP_STATS_ASPATH_MAXSIZE] =
|
||||
{"Largest AS-Path (bytes)","largestAsPath"},
|
||||
[BGP_STATS_ASPATH_TOTHOPS] =
|
||||
{"Average AS-Path length (hops)", "averageAsPathLengthHops"},
|
||||
[BGP_STATS_ASPATH_TOTSIZE] =
|
||||
{"Average AS-Path size (bytes)", "averageAsPathSizeBytes"},
|
||||
[BGP_STATS_ASN_HIGHEST] = {"Highest public ASN","highestPublicAsn"},
|
||||
[BGP_STATS_ASPATH_COUNT] = {"Advertisements with paths",
|
||||
"advertisementsWithPaths"},
|
||||
[BGP_STATS_ASPATH_MAXHOPS] = {"Longest AS-Path (hops)",
|
||||
"longestAsPath"},
|
||||
[BGP_STATS_ASPATH_MAXSIZE] = {"Largest AS-Path (bytes)",
|
||||
"largestAsPath"},
|
||||
[BGP_STATS_ASPATH_TOTHOPS] = {"Average AS-Path length (hops)",
|
||||
"averageAsPathLengthHops"},
|
||||
[BGP_STATS_ASPATH_TOTSIZE] = {"Average AS-Path size (bytes)",
|
||||
"averageAsPathSizeBytes"},
|
||||
[BGP_STATS_ASN_HIGHEST] = {"Highest public ASN", "highestPublicAsn"},
|
||||
[BGP_STATS_MAX] = {NULL, NULL}
|
||||
};
|
||||
|
||||
@ -11325,9 +11308,9 @@ static int bgp_table_stats_walker(struct thread *t)
|
||||
ts->counts[BGP_STATS_MAXBITLEN] = space;
|
||||
|
||||
for (rn = top; rn; rn = bgp_route_next(rn)) {
|
||||
if (ts->table->safi == SAFI_MPLS_VPN ||
|
||||
ts->table->safi == SAFI_ENCAP ||
|
||||
ts->table->safi == SAFI_EVPN) {
|
||||
if (ts->table->safi == SAFI_MPLS_VPN
|
||||
|| ts->table->safi == SAFI_ENCAP
|
||||
|| ts->table->safi == SAFI_EVPN) {
|
||||
struct bgp_table *table;
|
||||
|
||||
table = bgp_node_get_bgp_table_info(rn);
|
||||
@ -11362,14 +11345,13 @@ static int bgp_table_stats(struct vty *vty, struct bgp *bgp, afi_t afi,
|
||||
char warning_msg[50];
|
||||
|
||||
snprintf(warning_msg, sizeof(warning_msg),
|
||||
"%% No RIB exist's for the AFI(%d)/SAFI(%d)",
|
||||
afi, safi);
|
||||
"%% No RIB exist's for the AFI(%d)/SAFI(%d)", afi,
|
||||
safi);
|
||||
|
||||
if (!json)
|
||||
vty_out(vty, "%s\n", warning_msg);
|
||||
else
|
||||
json_object_string_add(json, "warning",
|
||||
warning_msg);
|
||||
json_object_string_add(json, "warning", warning_msg);
|
||||
|
||||
ret = CMD_WARNING;
|
||||
goto end_table_stats;
|
||||
@ -11388,8 +11370,8 @@ static int bgp_table_stats(struct vty *vty, struct bgp *bgp, afi_t afi,
|
||||
thread_execute(bm->master, bgp_table_stats_walker, &ts, 0);
|
||||
|
||||
for (i = 0; i < BGP_STATS_MAX; i++) {
|
||||
if ((!json && !table_stats_strs[i][TABLE_STATS_IDX_VTY]) ||
|
||||
(json && !table_stats_strs[i][TABLE_STATS_IDX_JSON]))
|
||||
if ((!json && !table_stats_strs[i][TABLE_STATS_IDX_VTY])
|
||||
|| (json && !table_stats_strs[i][TABLE_STATS_IDX_JSON]))
|
||||
continue;
|
||||
|
||||
switch (i) {
|
||||
@ -11405,111 +11387,140 @@ static int bgp_table_stats(struct vty *vty, struct bgp *bgp, afi_t afi,
|
||||
case BGP_STATS_ASPATH_TOTHOPS:
|
||||
case BGP_STATS_ASPATH_TOTSIZE:
|
||||
if (!json) {
|
||||
snprintf(temp_buf, sizeof(temp_buf), "%12.2f",
|
||||
ts.counts[i] ? (float)ts.counts[i] /
|
||||
(float)ts.counts[BGP_STATS_ASPATH_COUNT]
|
||||
: 0);
|
||||
snprintf(
|
||||
temp_buf, sizeof(temp_buf), "%12.2f",
|
||||
ts.counts[i]
|
||||
? (float)ts.counts[i]
|
||||
/ (float)ts.counts
|
||||
[BGP_STATS_ASPATH_COUNT]
|
||||
: 0);
|
||||
vty_out(vty, "%-30s: %s",
|
||||
table_stats_strs[i][TABLE_STATS_IDX_VTY],
|
||||
table_stats_strs[i]
|
||||
[TABLE_STATS_IDX_VTY],
|
||||
temp_buf);
|
||||
} else
|
||||
json_object_double_add(json,
|
||||
table_stats_strs[i][TABLE_STATS_IDX_JSON],
|
||||
ts.counts[i] ? (double)ts.counts[i] /
|
||||
(double)ts.counts[BGP_STATS_ASPATH_COUNT]
|
||||
: 0);
|
||||
} else {
|
||||
json_object_double_add(
|
||||
json,
|
||||
table_stats_strs[i]
|
||||
[TABLE_STATS_IDX_JSON],
|
||||
ts.counts[i]
|
||||
? (double)ts.counts[i]
|
||||
/ (double)ts.counts
|
||||
[BGP_STATS_ASPATH_COUNT]
|
||||
: 0);
|
||||
}
|
||||
break;
|
||||
case BGP_STATS_TOTPLEN:
|
||||
if (!json) {
|
||||
snprintf(temp_buf, sizeof(temp_buf), "%12.2f",
|
||||
ts.counts[i] ? (float)ts.counts[i] /
|
||||
(float)ts.counts[BGP_STATS_PREFIXES]
|
||||
: 0);
|
||||
snprintf(
|
||||
temp_buf, sizeof(temp_buf), "%12.2f",
|
||||
ts.counts[i]
|
||||
? (float)ts.counts[i]
|
||||
/ (float)ts.counts
|
||||
[BGP_STATS_PREFIXES]
|
||||
: 0);
|
||||
vty_out(vty, "%-30s: %s",
|
||||
table_stats_strs[i][TABLE_STATS_IDX_VTY],
|
||||
table_stats_strs[i]
|
||||
[TABLE_STATS_IDX_VTY],
|
||||
temp_buf);
|
||||
} else
|
||||
json_object_double_add(json,
|
||||
table_stats_strs[i][TABLE_STATS_IDX_JSON],
|
||||
ts.counts[i] ? (double)ts.counts[i] /
|
||||
(double)ts.counts[BGP_STATS_PREFIXES] : 0);
|
||||
} else {
|
||||
json_object_double_add(
|
||||
json,
|
||||
table_stats_strs[i]
|
||||
[TABLE_STATS_IDX_JSON],
|
||||
ts.counts[i]
|
||||
? (double)ts.counts[i]
|
||||
/ (double)ts.counts
|
||||
[BGP_STATS_PREFIXES]
|
||||
: 0);
|
||||
}
|
||||
break;
|
||||
case BGP_STATS_SPACE:
|
||||
if (!json) {
|
||||
snprintf(temp_buf, sizeof(temp_buf), "%12g",
|
||||
ts.total_space);
|
||||
vty_out(vty, "%-30s: %s\n",
|
||||
table_stats_strs[i][TABLE_STATS_IDX_VTY],
|
||||
table_stats_strs[i]
|
||||
[TABLE_STATS_IDX_VTY],
|
||||
temp_buf);
|
||||
} else
|
||||
json_object_double_add(json,
|
||||
table_stats_strs[i][TABLE_STATS_IDX_JSON],
|
||||
(double)ts.total_space);
|
||||
} else {
|
||||
json_object_double_add(
|
||||
json,
|
||||
table_stats_strs[i]
|
||||
[TABLE_STATS_IDX_JSON],
|
||||
(double)ts.total_space);
|
||||
}
|
||||
if (afi == AFI_IP6) {
|
||||
if (!json) {
|
||||
snprintf(temp_buf, sizeof(temp_buf),
|
||||
"%12g", ts.total_space *
|
||||
pow(2.0, -128 + 32));
|
||||
"%12g",
|
||||
ts.total_space
|
||||
* pow(2.0, -128 + 32));
|
||||
vty_out(vty, "%30s: %s\n",
|
||||
"/32 equivalent %s\n",
|
||||
temp_buf);
|
||||
} else
|
||||
json_object_double_add(json,
|
||||
"/32equivalent",
|
||||
(double)(ts.total_space *
|
||||
pow(2.0, -128 + 32)));
|
||||
} else {
|
||||
json_object_double_add(
|
||||
json, "/32equivalent",
|
||||
(double)(ts.total_space
|
||||
* pow(2.0,
|
||||
-128 + 32)));
|
||||
}
|
||||
if (!json) {
|
||||
snprintf(temp_buf, sizeof(temp_buf),
|
||||
"%12g", ts.total_space *
|
||||
pow(2.0, -128 + 48));
|
||||
"%12g",
|
||||
ts.total_space
|
||||
* pow(2.0, -128 + 48));
|
||||
vty_out(vty, "%30s: %s\n",
|
||||
"/48 equivalent %s\n",
|
||||
temp_buf);
|
||||
} else
|
||||
json_object_double_add(json,
|
||||
"/48equivalent",
|
||||
(double)(ts.total_space *
|
||||
pow(2.0, -128 + 48)));
|
||||
} else {
|
||||
json_object_double_add(
|
||||
json, "/48equivalent",
|
||||
(double)(ts.total_space
|
||||
* pow(2.0,
|
||||
-128 + 48)));
|
||||
}
|
||||
} else {
|
||||
if (!json) {
|
||||
snprintf(temp_buf, sizeof(temp_buf),
|
||||
"%12.2f",
|
||||
ts.total_space * 100. *
|
||||
pow(2.0, -32));
|
||||
ts.total_space * 100.
|
||||
* pow(2.0, -32));
|
||||
vty_out(vty, "%30s: %s\n",
|
||||
"% announced ",
|
||||
temp_buf);
|
||||
} else
|
||||
json_object_double_add(json,
|
||||
"%announced",
|
||||
(double)(ts.total_space *
|
||||
100. *
|
||||
pow(2.0, -32)));
|
||||
"% announced ", temp_buf);
|
||||
} else {
|
||||
json_object_double_add(
|
||||
json, "%announced",
|
||||
(double)(ts.total_space * 100.
|
||||
* pow(2.0, -32)));
|
||||
}
|
||||
if (!json) {
|
||||
snprintf(temp_buf, sizeof(temp_buf),
|
||||
"%12.2f",
|
||||
ts.total_space *
|
||||
pow(2.0, -32 + 8));
|
||||
ts.total_space
|
||||
* pow(2.0, -32 + 8));
|
||||
vty_out(vty, "%30s: %s\n",
|
||||
"/8 equivalent ", temp_buf);
|
||||
} else
|
||||
json_object_double_add(json,
|
||||
"/8equivalent",
|
||||
(double)(ts.total_space *
|
||||
pow(2.0, -32 + 8)));
|
||||
} else {
|
||||
json_object_double_add(
|
||||
json, "/8equivalent",
|
||||
(double)(ts.total_space
|
||||
* pow(2.0, -32 + 8)));
|
||||
}
|
||||
if (!json) {
|
||||
snprintf(temp_buf, sizeof(temp_buf),
|
||||
"%12.2f",
|
||||
ts.total_space *
|
||||
pow(2.0, -32 + 24));
|
||||
ts.total_space
|
||||
* pow(2.0, -32 + 24));
|
||||
vty_out(vty, "%30s: %s\n",
|
||||
"/24 equivalent ",
|
||||
temp_buf);
|
||||
} else
|
||||
json_object_double_add(json,
|
||||
"/24equivalent",
|
||||
(double)(ts.total_space *
|
||||
pow(2.0, -32 + 24)));
|
||||
"/24 equivalent ", temp_buf);
|
||||
} else {
|
||||
json_object_double_add(
|
||||
json, "/24equivalent",
|
||||
(double)(ts.total_space
|
||||
* pow(2.0, -32 + 24)));
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -11517,17 +11528,21 @@ static int bgp_table_stats(struct vty *vty, struct bgp *bgp, afi_t afi,
|
||||
snprintf(temp_buf, sizeof(temp_buf), "%12llu",
|
||||
ts.counts[i]);
|
||||
vty_out(vty, "%-30s: %s",
|
||||
table_stats_strs[i][TABLE_STATS_IDX_VTY],
|
||||
temp_buf);
|
||||
} else
|
||||
json_object_int_add(json,
|
||||
table_stats_strs[i][TABLE_STATS_IDX_JSON],
|
||||
ts.counts[i]);
|
||||
table_stats_strs[i]
|
||||
[TABLE_STATS_IDX_VTY],
|
||||
temp_buf);
|
||||
} else {
|
||||
json_object_int_add(
|
||||
json,
|
||||
table_stats_strs[i]
|
||||
[TABLE_STATS_IDX_JSON],
|
||||
ts.counts[i]);
|
||||
}
|
||||
}
|
||||
if (!json)
|
||||
vty_out(vty, "\n");
|
||||
}
|
||||
end_table_stats:
|
||||
end_table_stats:
|
||||
if (json)
|
||||
json_object_array_add(json_array, json);
|
||||
return ret;
|
||||
|
@ -175,9 +175,8 @@ extern int bgp_vty_find_and_parse_afi_safi_bgp(struct vty *vty,
|
||||
int argc, int *idx, afi_t *afi,
|
||||
safi_t *safi, struct bgp **bgp,
|
||||
bool use_json);
|
||||
int bgp_vty_find_and_parse_bgp(struct vty *vty,
|
||||
struct cmd_token **argv, int argc,
|
||||
struct bgp **bgp, bool use_json);
|
||||
int bgp_vty_find_and_parse_bgp(struct vty *vty, struct cmd_token **argv,
|
||||
int argc, struct bgp **bgp, bool use_json);
|
||||
extern int bgp_show_summary_vty(struct vty *vty, const char *name, afi_t afi,
|
||||
safi_t safi, bool show_failed, bool use_json);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user