summaryrefslogtreecommitdiff
path: root/bgpd/bgp_rpki.c
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2019-09-19 09:14:53 +0200
committerLouis Scalbert <louis.scalbert@6wind.com>2024-01-11 14:38:08 +0100
commitda947697563d8df05b8f3ba1bc99e2c02313982a (patch)
treeca37753fd8bb8bdf749429332f06d9111f5efb82 /bgpd/bgp_rpki.c
parent9d87a567f9cdd26bb05ee15ee862fc26056a9e6e (diff)
bgpd: do not show default rpki timers in show run
"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 <philippe.guibert@6wind.com> Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
Diffstat (limited to 'bgpd/bgp_rpki.c')
-rw-r--r--bgpd/bgp_rpki.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/bgpd/bgp_rpki.c b/bgpd/bgp_rpki.c
index 3da87d35e1..0abfbd242b 100644
--- a/bgpd/bgp_rpki.c
+++ b/bgpd/bgp_rpki.c
@@ -1052,6 +1052,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");
@@ -1693,6 +1700,48 @@ 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)) {
+ vty_out(vty, "\n");
+ 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);
@@ -1806,6 +1855,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);