pbrd: allow configurable table id range

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
This commit is contained in:
Quentin Young 2018-06-12 17:49:29 +00:00
parent b7ae6ac4db
commit 7bec514c7e
2 changed files with 30 additions and 2 deletions

View File

@ -85,6 +85,33 @@ DEFUN_NOSH(no_pbr_map, no_pbr_map_cmd, "no pbr-map WORD [seq (1-700)]",
return CMD_SUCCESS;
}
DEFPY(pbr_set_table_range,
pbr_set_table_range_cmd,
"[no] pbr table range (10000-4294966272)$lb (10000-4294966272)$ub",
NO_STR
PBR_STR
"Set table ID range\n"
"Set table ID range\n"
"Lower bound for table ID range\n"
"Upper bound for table ID range\n")
{
/* upper bound is 2^32 - 2^10 */
int ret = CMD_WARNING;
/* validate given bounds */
if (lb > ub)
vty_out(vty, "%% Lower bound must be less than upper bound\n");
else if (ub - lb < 10)
vty_out(vty, "%% Range breadth must be at least 10\n");
else {
ret = CMD_SUCCESS;
pbr_nht_set_tableid_range((uint32_t) lb, (uint32_t) ub);
}
return ret;
}
DEFPY(pbr_map_match_src, pbr_map_match_src_cmd,
"[no] match src-ip <A.B.C.D/M|X:X::X:X/M>$prefix",
NO_STR
@ -489,7 +516,6 @@ DEFPY (show_pbr_interface,
}
/* PBR debugging CLI ------------------------------------------------------- */
/* clang-format off */
static struct cmd_node debug_node = {DEBUG_NODE, "", 1};
@ -536,7 +562,6 @@ DEFUN_NOSH(show_debugging_pbr,
return CMD_SUCCESS;
}
/* clang-format on */
/* ------------------------------------------------------------------------- */
@ -634,6 +659,7 @@ void pbr_vty_init(void)
install_element(CONFIG_NODE, &pbr_map_cmd);
install_element(CONFIG_NODE, &no_pbr_map_cmd);
install_element(CONFIG_NODE, &pbr_set_table_range_cmd);
install_element(INTERFACE_NODE, &pbr_policy_cmd);
install_element(PBRMAP_NODE, &pbr_map_match_src_cmd);
install_element(PBRMAP_NODE, &pbr_map_match_dst_cmd);

View File

@ -20,5 +20,7 @@
#ifndef __PBR_VTY_H__
#define __PBR_VTY_H__
#define PBR_STR "Policy based routing\n"
extern void pbr_vty_init(void);
#endif