#include "nexthop.h"
#include "nexthop_group.h"
#include "log.h"
-#include "json.h"
#include "debug.h"
+#include "pbr.h"
#include "pbrd/pbr_nht.h"
#include "pbrd/pbr_map.h"
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;
+ const int minrange = 1000;
+
+ /* validate given bounds */
+ if (lb > ub)
+ vty_out(vty, "%% Lower bound must be less than upper bound\n");
+ else if (ub - lb < minrange)
+ vty_out(vty, "%% Range breadth must be at least %d\n", minrange);
+ 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
if (pbrms->nhg)
nh = nexthop_exists(pbrms->nhg, &nhop);
else {
- char buf[PBR_MAP_NAMELEN];
+ char buf[PBR_NHC_NAMELEN];
if (no) {
vty_out(vty, "No nexthops to delete");
pbrms->internal_nhg_name =
XSTRDUP(MTYPE_TMP,
pbr_nht_nexthop_make_name(pbrms->parent->name,
- PBR_MAP_NAMELEN - 10,
+ PBR_NHC_NAMELEN,
pbrms->seqno,
buf));
nh = NULL;
DEFPY (show_pbr,
show_pbr_cmd,
- "show pbr [json$json]",
+ "show pbr",
SHOW_STR
- "Policy Based Routing\n"
- JSON_STR)
+ PBR_STR)
{
pbr_nht_write_table_range(vty);
pbr_nht_write_rule_range(vty);
DEFPY (show_pbr_map,
show_pbr_map_cmd,
- "show pbr map [NAME$name] [detail$detail] [json$json]",
+ "show pbr map [NAME$name] [detail$detail]",
SHOW_STR
- "Policy Based Routing\n"
+ PBR_STR
"PBR Map\n"
"PBR Map Name\n"
- "Detailed information\n"
- JSON_STR)
+ "Detailed information\n")
{
struct pbr_map_sequence *pbrms;
struct pbr_map *pbrm;
show_pbr_nexthop_group_cmd,
"show pbr nexthop-groups [WORD$word]",
SHOW_STR
- "Policy Based Routing\n"
+ PBR_STR
"Nexthop Groups\n"
"Optional Name of the nexthop group\n")
{
DEFPY (show_pbr_interface,
show_pbr_interface_cmd,
- "show pbr interface [NAME$name] [json$json]",
+ "show pbr interface [NAME$name]",
SHOW_STR
- "Policy Based Routing\n"
+ PBR_STR
"PBR Interface\n"
- "PBR Interface Name\n"
- JSON_STR)
+ "PBR Interface Name\n")
{
struct interface *ifp;
struct vrf *vrf;
}
/* PBR debugging CLI ------------------------------------------------------- */
-/* clang-format off */
static struct cmd_node debug_node = {DEBUG_NODE, "", 1};
"[no] debug pbr [{map$map|zebra$zebra|nht$nht|events$events}]",
NO_STR
DEBUG_STR
- "Policy Based Routing\n"
+ PBR_STR
"Policy maps\n"
"PBRD <-> Zebra communications\n"
"Nexthop tracking\n"
"show debugging [pbr]",
SHOW_STR
DEBUG_STR
- "Policy Based Routing\n")
+ PBR_STR)
{
vty_out(vty, "PBR debugging status:\n");
return CMD_SUCCESS;
}
-/* clang-format on */
/* ------------------------------------------------------------------------- */
vty_frame(vty, "interface %s vrf %s\n",
ifp->name, vrf->name);
+ if (ifp->desc)
+ vty_out(vty, " description %s\n", ifp->desc);
+
pbr_map_write_interfaces(vty, ifp);
vty_endframe(vty, "!\n");
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);