summaryrefslogtreecommitdiff
path: root/lib/routemap_cli.c
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas.abraitis@gmail.com>2021-08-03 11:02:49 +0300
committerDonatas Abraitis <donatas.abraitis@gmail.com>2021-08-03 14:38:53 +0300
commit71bdae66b2c105302f7af9fc0c1deb657e2418d9 (patch)
tree82d433082f3a66e9c1a283c4289fb3af3a334802 /lib/routemap_cli.c
parent04cfc0a3a8b10ad3f8c9faeb9f649515b7b42171 (diff)
bgpd: Keep extcommunity bandwidth commands persistent in route-maps
~/frr# vtysh -c 'conf' -c 'route-map testas permit 10' -c 'set extcommunity bandwidth 321' ~/frr# vtysh -c 'show route-map testas' | grep 321 extcommunity bandwidth 321 non-transitive ~/frr# vtysh -c 'sh run' | grep 321 ~/frr# Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
Diffstat (limited to 'lib/routemap_cli.c')
-rw-r--r--lib/routemap_cli.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/routemap_cli.c b/lib/routemap_cli.c
index ec9033b3aa..77455d991a 100644
--- a/lib/routemap_cli.c
+++ b/lib/routemap_cli.c
@@ -25,6 +25,7 @@
#include "lib/command.h"
#include "lib/northbound_cli.h"
#include "lib/routemap.h"
+#include "bgpd/bgp_ecommunity.h"
#ifndef VTYSH_EXTRACT_PL
#include "lib/routemap_cli_clippy.c"
@@ -1194,6 +1195,34 @@ void route_map_action_show(struct vty *vty, struct lyd_node *dnode,
yang_dnode_get_string(
dnode,
"./rmap-set-action/frr-bgp-route-map:extcommunity-soo"));
+ } else if (IS_SET_EXTCOMMUNITY_LB(action)) {
+ enum ecommunity_lb_type lb_type;
+ char str[VTY_BUFSIZ];
+ uint16_t bandwidth;
+
+ lb_type = yang_dnode_get_enum(
+ dnode,
+ "./rmap-set-action/frr-bgp-route-map:extcommunity-lb/lb-type");
+ switch (lb_type) {
+ case EXPLICIT_BANDWIDTH:
+ bandwidth = yang_dnode_get_uint16(
+ dnode,
+ "./rmap-set-action/frr-bgp-route-map:extcommunity-lb/bandwidth");
+ snprintf(str, sizeof(str), "%d", bandwidth);
+ break;
+ case CUMULATIVE_BANDWIDTH:
+ snprintf(str, sizeof(str), "%s", "cumulative");
+ break;
+ case COMPUTED_BANDWIDTH:
+ snprintf(str, sizeof(str), "%s", "num-multipaths");
+ }
+
+ if (yang_dnode_get_bool(
+ dnode,
+ "./rmap-set-action/frr-bgp-route-map:extcommunity-lb/two-octet-as-specific"))
+ strlcat(str, " non-transitive", sizeof(str));
+
+ vty_out(vty, " set extcommunity bandwidth %s\n", str);
} else if (IS_SET_AGGREGATOR(action)) {
vty_out(vty, " set aggregator as %s %s\n",
yang_dnode_get_string(