diff options
| author | Dmytro Shytyi <dmytro.shytyi@6wind.com> | 2022-12-05 16:58:53 +0100 |
|---|---|---|
| committer | Dmytro Shytyi <dmytro.shytyi@6wind.com> | 2024-06-07 12:33:47 +0200 |
| commit | d875dc37ee03acc1fed4e750bbba8f6137e39fba (patch) | |
| tree | 964fa48d4c4f59517dde125d3f04638dcbd0c96a /zebra/zebra_cli.c | |
| parent | 0cbe6dfc0854e50883bad4069a988b0c31afb2d6 (diff) | |
zebra: add 'mpls fec nexthop-resolution' command to vtysh
Commands added:
r3# configure
r3(config)# mpls
fec MPLS FEC table
label Label configuration
ldp Label Distribution Protocol
lsp Establish label switched path
r3(config)# mpls fec
mpls fec nexthop-resolution Authorise nexthop resolution
over all labeled routes.
r3(config)# mpls fec mpls fec nexthop-resolution
r3# configure
r3(config)# vrf default
r3(config-vrf)# mpls
fec MPLS FEC table
r3(config-vrf)# mpls fec
mpls fec nexthop-resolution Authorise nexthop resolution
over all labeled routes.
r3(config-vrf)# mpls fec nexthop-resolution
east-vm# show running-config
Building configuration...
...
!
mpls fec nexthop-resolution
!
...
Signed-off-by: Dmytro Shytyi <dmytro.shytyi@6wind.com>
Diffstat (limited to 'zebra/zebra_cli.c')
| -rw-r--r-- | zebra/zebra_cli.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/zebra/zebra_cli.c b/zebra/zebra_cli.c index 3e03d74775..6ee0fdbb8d 100644 --- a/zebra/zebra_cli.c +++ b/zebra/zebra_cli.c @@ -2221,6 +2221,37 @@ static void lib_vrf_zebra_ipv6_resolve_via_default_cli_write( } } +DEFPY_YANG (mpls_fec_nexthop_resolution, mpls_fec_nexthop_resolution_cmd, + "[no$no] mpls fec nexthop-resolution", + NO_STR + MPLS_STR + "MPLS FEC table\n" + "Authorise nexthop resolution over all labeled routes.\n") +{ + nb_cli_enqueue_change(vty, + "./frr-zebra:zebra/mpls/fec-nexthop-resolution", + NB_OP_MODIFY, no ? "false" : "true"); + + if (vty->node == CONFIG_NODE) + return nb_cli_apply_changes(vty, "/frr-vrf:lib/vrf[name='%s']", + VRF_DEFAULT_NAME); + + return nb_cli_apply_changes(vty, NULL); +} + +static void lib_vrf_mpls_fec_nexthop_resolution_cli_write( + struct vty *vty, const struct lyd_node *dnode, bool show_defaults) +{ + bool fec_nexthop_resolution = yang_dnode_get_bool(dnode, NULL); + + if (fec_nexthop_resolution || show_defaults) { + zebra_vrf_indent_cli_write(vty, dnode); + + vty_out(vty, "%smpls fec nexthop-resolution\n", + fec_nexthop_resolution ? "" : "no "); + } +} + DEFPY_YANG (vrf_netns, vrf_netns_cmd, "[no] netns ![NAME$netns_name]", @@ -2852,6 +2883,10 @@ const struct frr_yang_module_info frr_zebra_cli_info = { .cbs.cli_show = lib_vrf_zebra_netns_table_range_cli_write, }, { + .xpath = "/frr-vrf:lib/vrf/frr-zebra:zebra/mpls/fec-nexthop-resolution", + .cbs.cli_show = lib_vrf_mpls_fec_nexthop_resolution_cli_write, + }, + { .xpath = "/frr-vrf:lib/vrf/frr-zebra:zebra/l3vni-id", .cbs.cli_show = lib_vrf_zebra_l3vni_id_cli_write, }, @@ -2957,6 +2992,9 @@ void zebra_cli_init(void) install_element(VRF_NODE, &ip_nht_default_route_cmd); install_element(VRF_NODE, &ipv6_nht_default_route_cmd); + install_element(CONFIG_NODE, &mpls_fec_nexthop_resolution_cmd); + install_element(VRF_NODE, &mpls_fec_nexthop_resolution_cmd); + install_element(CONFIG_NODE, &vni_mapping_cmd); install_element(VRF_NODE, &vni_mapping_cmd); |
