From d875dc37ee03acc1fed4e750bbba8f6137e39fba Mon Sep 17 00:00:00 2001 From: Dmytro Shytyi Date: Mon, 5 Dec 2022 16:58:53 +0100 Subject: 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 --- zebra/zebra_cli.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'zebra/zebra_cli.c') 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]", @@ -2851,6 +2882,10 @@ const struct frr_yang_module_info frr_zebra_cli_info = { .xpath = "/frr-vrf:lib/vrf/frr-zebra:zebra/netns/table-range", .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); -- cgit v1.2.3