Skip to content

Commit

Permalink
bgpd: do not show default rpki timers in show run
Browse files Browse the repository at this point in the history
"show run" displays the default RPKI timers when at least one cache
server is configured.

Only display the RPKI timers that differs from the default values.

Signed-off-by: Philippe Guibert <[email protected]>
Signed-off-by: Louis Scalbert <[email protected]>
  • Loading branch information
pguibert6WIND authored and louis-6wind committed Dec 21, 2023
1 parent 6753fe9 commit 3015f8c
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions bgpd/bgp_rpki.c
Original file line number Diff line number Diff line change
Expand Up @@ -1050,6 +1050,13 @@ static int config_write(struct vty *vty)
struct listnode *cache_node;
struct cache *cache;

if (list_isempty(cache_list) &&
polling_period == POLLING_PERIOD_DEFAULT &&
retry_interval == RETRY_INTERVAL_DEFAULT &&
expire_interval == EXPIRE_INTERVAL_DEFAULT)
/* do not display the default config values */
return 0;

if (rpki_debug)
vty_out(vty, "debug rpki\n");

Expand Down Expand Up @@ -1684,6 +1691,46 @@ DEFPY (show_rpki_cache_connection,
return CMD_SUCCESS;
}

DEFPY(show_rpki_configuration, show_rpki_configuration_cmd,
"show rpki configuration [json$uj]",
SHOW_STR RPKI_OUTPUT_STRING
"Show RPKI configuration\n"
JSON_STR)
{
struct json_object *json = NULL;

if (uj) {
json = json_object_new_object();
json_object_boolean_add(json, "enabled",
!!listcount(cache_list));
json_object_int_add(json, "serversCount", listcount(cache_list));
json_object_int_add(json, "pollingPeriodSeconds",
polling_period);
json_object_int_add(json, "retryIntervalSeconds",
retry_interval);
json_object_int_add(json, "expireIntervalSeconds",
expire_interval);

vty_json(vty, json);

return CMD_SUCCESS;
}

vty_out(vty, "rpki is %s",
listcount(cache_list) ? "Enabled" : "Disabled");

if (list_isempty(cache_list))
return CMD_SUCCESS;

vty_out(vty, " (%d cache servers configured)", listcount(cache_list));
vty_out(vty, "\n");
vty_out(vty, "\tpolling period %d\n", polling_period);
vty_out(vty, "\tretry interval %d\n", retry_interval);
vty_out(vty, "\texpire interval %d\n", expire_interval);

return CMD_SUCCESS;
}

static int config_on_exit(struct vty *vty)
{
reset(false);
Expand Down Expand Up @@ -1797,6 +1844,7 @@ static void install_cli_commands(void)
install_element(VIEW_NODE, &show_rpki_cache_server_cmd);
install_element(VIEW_NODE, &show_rpki_prefix_cmd);
install_element(VIEW_NODE, &show_rpki_as_number_cmd);
install_element(VIEW_NODE, &show_rpki_configuration_cmd);

/* Install debug commands */
install_element(CONFIG_NODE, &debug_rpki_cmd);
Expand Down

0 comments on commit 3015f8c

Please sign in to comment.