summaryrefslogtreecommitdiff
path: root/zebra/zebra_vty.c
diff options
context:
space:
mode:
authorDonald Lee <dlqs@gmx.com>2021-10-13 23:08:31 +0800
committerDonald Lee <dlqs@gmx.com>2021-10-20 00:56:00 +0800
commit310dd2b362b77b470540eedf4cc162298bdd586d (patch)
treeeea824290ce7886ef7c57931e9c80f18a0a883df /zebra/zebra_vty.c
parent461c173cbdb3d532e6824a4a22bbdec632b09a06 (diff)
zebra: Add vty cmd zebra on-rib-process script SCRIPT
Signed-off-by: Donald Lee <dlqs@gmx.com>
Diffstat (limited to 'zebra/zebra_vty.c')
-rw-r--r--zebra/zebra_vty.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
index c6b3eb48a0..76c1014212 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -60,6 +60,7 @@
#include "zebra/zebra_nb.h"
#include "zebra/kernel_netlink.h"
#include "zebra/table_manager.h"
+#include "zebra/zebra_script.h"
extern int allow_delete;
@@ -4317,6 +4318,30 @@ DEFUN(ip_table_range, ip_table_range_cmd,
return table_manager_range(vty, true, zvrf, argv[3]->arg, argv[4]->arg);
}
+#ifdef HAVE_SCRIPTING
+
+DEFUN(zebra_on_rib_process_script, zebra_on_rib_process_script_cmd,
+ "zebra on-rib-process script SCRIPT",
+ ZEBRA_STR
+ "on_rib_process_dplane_results hook call\n"
+ "Set a script\n"
+ "Script name (same as filename in /etc/frr/scripts/, without .lua)\n")
+{
+
+ if (frrscript_names_set_script_name(ZEBRA_ON_RIB_PROCESS_HOOK_CALL,
+ argv[3]->arg)
+ == 0) {
+ vty_out(vty, "Successfully added script %s for hook call %s\n",
+ argv[3]->arg, ZEBRA_ON_RIB_PROCESS_HOOK_CALL);
+ } else {
+ vty_out(vty, "Failed to add script %s for hook call %s\n",
+ argv[3]->arg, ZEBRA_ON_RIB_PROCESS_HOOK_CALL);
+ }
+ return CMD_SUCCESS;
+}
+
+#endif /* HAVE_SCRIPTING */
+
/* IP node for static routes. */
static int zebra_ip_config(struct vty *vty);
static struct cmd_node ip_node = {
@@ -4473,5 +4498,9 @@ void zebra_vty_init(void)
install_element(CONFIG_NODE, &no_zebra_kernel_netlink_batch_tx_buf_cmd);
#endif /* HAVE_NETLINK */
+#ifdef HAVE_SCRIPTING
+ install_element(CONFIG_NODE, &zebra_on_rib_process_script_cmd);
+#endif /* HAVE_SCRIPTING */
+
install_element(VIEW_NODE, &zebra_show_routing_tables_summary_cmd);
}