+// SPDX-License-Identifier: GPL-2.0-or-later
/*
*
* Copyright 2015-2016, LabN Consulting, L.L.C.
*
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
/* stub rfp */
#include "rfp_internal.h"
#include "bgpd/rfapi/rfapi.h"
return CMD_SUCCESS;
}
-static void rfp_vty_install()
+DEFUN (rfp_holddown_factor,
+ rfp_holddown_factor_cmd,
+ "rfp holddown-factor (0-4294967295)",
+ RFP_SHOW_STR
+ "Set Hold-Down Factor as a percentage of registration lifetime.\n"
+ "Percentage of registration lifetime\n")
+{
+ struct rfp_instance_t *rfi;
+ uint32_t value = 0;
+
+ value = strtoul((argv[--argc]->arg), NULL, 10);
+ rfi = rfapi_get_rfp_start_val(VTY_GET_CONTEXT(bgp)); /* BGP_NODE */
+ if (!rfi) {
+ vty_out(vty, "VNC not configured\n");
+ return CMD_WARNING;
+ }
+ rfi->rfapi_config.holddown_factor = value;
+ rfapi_rfp_set_configuration(rfi, &rfi->rfapi_config);
+ return CMD_SUCCESS;
+}
+
+
+DEFUN (rfp_full_table_download,
+ rfp_full_table_download_cmd,
+ "rfp full-table-download <on|off>",
+ RFP_SHOW_STR
+ "RFP full table download support (default=on)\n"
+ "Enable RFP full table download\n"
+ "Disable RFP full table download\n")
+{
+ struct rfp_instance_t *rfi;
+ rfapi_rfp_download_type old;
+
+ rfi = rfapi_get_rfp_start_val(VTY_GET_CONTEXT(bgp)); /* BGP_NODE */
+ if (!rfi) {
+ vty_out(vty, "VNC not configured\n");
+ return CMD_WARNING;
+ }
+ old = rfi->rfapi_config.download_type;
+ if (argv[--argc]->arg[1] == 'n' || argv[argc]->arg[1] == 'N')
+ rfi->rfapi_config.download_type = RFAPI_RFP_DOWNLOAD_FULL;
+ else
+ rfi->rfapi_config.download_type = RFAPI_RFP_DOWNLOAD_PARTIAL;
+ if (old != rfi->rfapi_config.download_type)
+ rfapi_rfp_set_configuration(rfi, &rfi->rfapi_config);
+ return CMD_SUCCESS;
+}
+
+static void rfp_vty_install(void)
{
static int installed = 0;
if (installed) /* do this only once */
installed = 1;
/* example of new cli command */
install_element(BGP_NODE, &rfp_example_config_value_cmd);
+ install_element(BGP_NODE, &rfp_holddown_factor_cmd);
+ install_element(BGP_NODE, &rfp_full_table_download_cmd);
}
/***********************************************************************
vty_out(vty, "\n");
write++;
}
-
+ if (rfi->rfapi_config.holddown_factor != 0) {
+ vty_out(vty, " rfp holddown-factor %u\n",
+ rfi->rfapi_config.holddown_factor);
+ write++;
+ }
+ if (rfi->rfapi_config.download_type == RFAPI_RFP_DOWNLOAD_FULL) {
+ vty_out(vty, " rfp full-table-download on\n");
+ write++;
+ }
return write;
}
void *rfp_start(struct thread_master *master, struct rfapi_rfp_cfg **cfgp,
struct rfapi_rfp_cb_methods **cbmp)
{
- memset(&global_rfi, 0, sizeof(struct rfp_instance_t));
+ memset(&global_rfi, 0, sizeof(global_rfi));
global_rfi.master = master; /* for BGPD threads */
/* initilize struct rfapi_rfp_cfg, see rfapi.h */
global_rfi.rfapi_config.download_type =
- RFAPI_RFP_DOWNLOAD_FULL; /* default=partial */
+ RFAPI_RFP_DOWNLOAD_PARTIAL; /* default=partial */
global_rfi.rfapi_config.ftd_advertisement_interval =
RFAPI_RFP_CFG_DEFAULT_FTD_ADVERTISEMENT_INTERVAL;
global_rfi.rfapi_config.holddown_factor =