isisd: Add Link State Traffic Engineering support

Add Link State TED features to isis_te.c and new CLI to export LS TED and
show LS TED to IS-IS.

IS-IS LSPs are parse each time a new LSP event occurs in order to update
accordingly the Link State Traffic Engineering Database. LS TED could be
exported through the ZAPI Opaque message (see sharpd as example).

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
This commit is contained in:
Olivier Dugeon 2021-06-22 20:18:00 +02:00
parent d9884a758c
commit ed6189a9b5
8 changed files with 1334 additions and 38 deletions

View File

@ -318,6 +318,11 @@ Traffic Engineering
.. note:: .. note::
IS-IS-TE supports RFC 5305 (base TE), RFC 6119 (IPv6) and RFC 7810 / 8570
(Extended Metric) with or without Multi-Topology. All Traffic Engineering
information are stored in a database formally named TED. However, best
acccuracy is provided without Multi-Topology due to inconsistency of Traffic
Engineering Advertisement of 3rd party commercial routers when MT is enabled.
At this time, FRR offers partial support for some of the routing protocol At this time, FRR offers partial support for some of the routing protocol
extensions that can be used with MPLS-TE. FRR does not currently support a extensions that can be used with MPLS-TE. FRR does not currently support a
complete RSVP-TE solution. complete RSVP-TE solution.
@ -334,6 +339,11 @@ Traffic Engineering
Configure stable IPv6 address for MPLS-TE. Configure stable IPv6 address for MPLS-TE.
.. clicmd:: mpls-te export
Export Traffic Engineering DataBase to other daemons through the ZAPI
Opaque Link State messages.
.. clicmd:: show isis mpls-te interface .. clicmd:: show isis mpls-te interface
.. clicmd:: show isis mpls-te interface INTERFACE .. clicmd:: show isis mpls-te interface INTERFACE
@ -344,6 +354,16 @@ Traffic Engineering
Show Traffic Engineering router parameters. Show Traffic Engineering router parameters.
.. clicmd:: show isis [vrf <NAME|all>] mpls-te database [detail|json]
.. clicmd:: show isis [vrf <NAME|all>] mpls-te database vertex [WORD] [detail|json]
.. clicmd:: show isis [vrf <NAME|all>] mpls-te database edge [A.B.C.D|X:X::X:X] [detail|json]
.. clicmd:: show isis [vrf <NAME|all>] mpls-te database subnet [A.B.C.D/M|X:X::X:X/M] [detail|json]
Show Traffic Engineering Database
.. seealso:: .. seealso::
:ref:`ospf-traffic-engineering` :ref:`ospf-traffic-engineering`
@ -449,6 +469,10 @@ Debugging ISIS
Update related packets. Update related packets.
.. clicmd:: debug isis te-events
IS-IS Traffic Engineering events
.. clicmd:: debug isis sr-events .. clicmd:: debug isis sr-events

View File

@ -1189,6 +1189,36 @@ DEFPY_YANG(isis_mpls_te_inter_as, isis_mpls_te_inter_as_cmd,
return CMD_SUCCESS; return CMD_SUCCESS;
} }
/*
* XPath: /frr-isisd:isis/instance/mpls-te/export
*/
DEFPY_YANG(isis_mpls_te_export, isis_mpls_te_export_cmd, "mpls-te export",
MPLS_TE_STR "Enable export of MPLS-TE Link State information\n")
{
nb_cli_enqueue_change(vty, "./mpls-te/export", NB_OP_MODIFY, "true");
return nb_cli_apply_changes(vty, NULL);
}
DEFPY_YANG(no_isis_mpls_te_export, no_isis_mpls_te_export_cmd,
"no mpls-te export",
NO_STR MPLS_TE_STR
"Disable export of MPLS-TE Link State information\n")
{
nb_cli_enqueue_change(vty, "./mpls-te/export", NB_OP_MODIFY, "false");
return nb_cli_apply_changes(vty, NULL);
}
void cli_show_isis_mpls_te_export(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults)
{
if (!yang_dnode_get_bool(dnode, NULL))
vty_out(vty, " no");
vty_out(vty, " mpls-te export\n");
}
/* /*
* XPath: /frr-isisd:isis/instance/default-information-originate * XPath: /frr-isisd:isis/instance/default-information-originate
*/ */
@ -3165,6 +3195,8 @@ void isis_cli_init(void)
install_element(ISIS_NODE, &isis_mpls_te_router_addr_v6_cmd); install_element(ISIS_NODE, &isis_mpls_te_router_addr_v6_cmd);
install_element(ISIS_NODE, &no_isis_mpls_te_router_addr_v6_cmd); install_element(ISIS_NODE, &no_isis_mpls_te_router_addr_v6_cmd);
install_element(ISIS_NODE, &isis_mpls_te_inter_as_cmd); install_element(ISIS_NODE, &isis_mpls_te_inter_as_cmd);
install_element(ISIS_NODE, &isis_mpls_te_export_cmd);
install_element(ISIS_NODE, &no_isis_mpls_te_export_cmd);
install_element(ISIS_NODE, &isis_default_originate_cmd); install_element(ISIS_NODE, &isis_default_originate_cmd);
install_element(ISIS_NODE, &isis_redistribute_cmd); install_element(ISIS_NODE, &isis_redistribute_cmd);

View File

@ -572,6 +572,13 @@ const struct frr_yang_module_info frr_isisd_info = {
.cli_show = cli_show_isis_mpls_te_router_addr_ipv6, .cli_show = cli_show_isis_mpls_te_router_addr_ipv6,
.destroy = isis_instance_mpls_te_router_address_ipv6_destroy, .destroy = isis_instance_mpls_te_router_address_ipv6_destroy,
.modify = isis_instance_mpls_te_router_address_ipv6_modify, .modify = isis_instance_mpls_te_router_address_ipv6_modify,
}
},
{
.xpath = "/frr-isisd:isis/instance/mpls-te/export",
.cbs = {
.cli_show = cli_show_isis_mpls_te_export,
.modify = isis_instance_mpls_te_export_modify,
}, },
}, },
{ {

View File

@ -215,6 +215,7 @@ int isis_instance_mpls_te_router_address_ipv6_modify(
struct nb_cb_modify_args *args); struct nb_cb_modify_args *args);
int isis_instance_mpls_te_router_address_ipv6_destroy( int isis_instance_mpls_te_router_address_ipv6_destroy(
struct nb_cb_destroy_args *args); struct nb_cb_destroy_args *args);
int isis_instance_mpls_te_export_modify(struct nb_cb_modify_args *args);
int lib_interface_isis_create(struct nb_cb_create_args *args); int lib_interface_isis_create(struct nb_cb_create_args *args);
int lib_interface_isis_destroy(struct nb_cb_destroy_args *args); int lib_interface_isis_destroy(struct nb_cb_destroy_args *args);
int lib_interface_isis_area_tag_modify(struct nb_cb_modify_args *args); int lib_interface_isis_area_tag_modify(struct nb_cb_modify_args *args);
@ -470,6 +471,8 @@ void cli_show_isis_mpls_te_router_addr(struct vty *vty,
void cli_show_isis_mpls_te_router_addr_ipv6(struct vty *vty, void cli_show_isis_mpls_te_router_addr_ipv6(struct vty *vty,
const struct lyd_node *dnode, const struct lyd_node *dnode,
bool show_defaults); bool show_defaults);
void cli_show_isis_mpls_te_export(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults);
void cli_show_isis_def_origin_ipv4(struct vty *vty, void cli_show_isis_def_origin_ipv4(struct vty *vty,
const struct lyd_node *dnode, const struct lyd_node *dnode,
bool show_defaults); bool show_defaults);

View File

@ -33,6 +33,7 @@
#include "lib_errors.h" #include "lib_errors.h"
#include "vrf.h" #include "vrf.h"
#include "ldp_sync.h" #include "ldp_sync.h"
#include "link_state.h"
#include "isisd/isisd.h" #include "isisd/isisd.h"
#include "isisd/isis_nb.h" #include "isisd/isis_nb.h"
@ -51,6 +52,7 @@
#include "isisd/isis_redist.h" #include "isisd/isis_redist.h"
#include "isisd/isis_ldp_sync.h" #include "isisd/isis_ldp_sync.h"
#include "isisd/isis_dr.h" #include "isisd/isis_dr.h"
#include "isisd/isis_zebra.h"
DEFINE_MTYPE_STATIC(ISISD, ISIS_MPLS_TE, "ISIS MPLS_TE parameters"); DEFINE_MTYPE_STATIC(ISISD, ISIS_MPLS_TE, "ISIS MPLS_TE parameters");
DEFINE_MTYPE_STATIC(ISISD, ISIS_PLIST_NAME, "ISIS prefix-list name"); DEFINE_MTYPE_STATIC(ISISD, ISIS_PLIST_NAME, "ISIS prefix-list name");
@ -1827,12 +1829,19 @@ int isis_instance_mpls_te_create(struct nb_cb_create_args *args)
new->inter_as = off; new->inter_as = off;
new->interas_areaid.s_addr = 0; new->interas_areaid.s_addr = 0;
new->router_id.s_addr = 0; new->router_id.s_addr = 0;
new->ted = ls_ted_new(1, "ISIS", 0);
if (!new->ted)
zlog_warn("Unable to create Link State Data Base");
area->mta = new; area->mta = new;
} else { } else {
area->mta->status = enable; area->mta->status = enable;
} }
/* Initialize Link State Database */
if (area->mta->ted)
isis_te_init_ted(area);
/* Update Extended TLVs according to Interface link parameters */ /* Update Extended TLVs according to Interface link parameters */
for (ALL_LIST_ELEMENTS_RO(area->circuit_list, node, circuit)) for (ALL_LIST_ELEMENTS_RO(area->circuit_list, node, circuit))
isis_link_params_update(circuit, circuit->interface); isis_link_params_update(circuit, circuit->interface);
@ -1858,6 +1867,9 @@ int isis_instance_mpls_te_destroy(struct nb_cb_destroy_args *args)
else else
return NB_OK; return NB_OK;
/* Remove Link State Database */
ls_ted_del_all(area->mta->ted);
/* Flush LSP if circuit engage */ /* Flush LSP if circuit engage */
for (ALL_LIST_ELEMENTS_RO(area->circuit_list, node, circuit)) { for (ALL_LIST_ELEMENTS_RO(area->circuit_list, node, circuit)) {
if (!IS_EXT_TE(circuit->ext)) if (!IS_EXT_TE(circuit->ext))
@ -1980,6 +1992,37 @@ int isis_instance_mpls_te_router_address_ipv6_destroy(
return NB_OK; return NB_OK;
} }
/*
* XPath: /frr-isisd:isis/instance/mpls-te/export
*/
int isis_instance_mpls_te_export_modify(struct nb_cb_modify_args *args)
{
struct isis_area *area;
if (args->event != NB_EV_APPLY)
return NB_OK;
area = nb_running_get_entry(args->dnode, NULL, true);
/* only proceed if MPLS-TE is enabled */
if (!IS_MPLS_TE(area->mta))
return NB_OK;
area->mta->export = yang_dnode_get_bool(args->dnode, NULL);
if (area->mta->export) {
if (IS_DEBUG_EVENTS)
zlog_debug("MPLS-TE: Enabled Link State export");
if (isis_zebra_ls_register(true) != 0)
zlog_warn("Unable to register Link State\n");
} else {
if (IS_DEBUG_EVENTS)
zlog_debug("MPLS-TE: Disable Link State export");
if (isis_zebra_ls_register(false) != 0)
zlog_warn("Unable to register Link State\n");
}
return NB_OK;
}
/* /*
* XPath: /frr-isisd:isis/instance/segment-routing/enabled * XPath: /frr-isisd:isis/instance/segment-routing/enabled
*/ */

File diff suppressed because it is too large Load Diff

View File

@ -88,8 +88,10 @@ typedef enum _interas_mode_t { off, region, as, emulate } interas_mode_t;
&& e->status != EXT_ADJ_SID \ && e->status != EXT_ADJ_SID \
&& e->status != EXT_LAN_ADJ_SID) && e->status != EXT_LAN_ADJ_SID)
#define IS_MPLS_TE(a) (a && a->status == enable) #define IS_MPLS_TE(a) (a && a->status == enable)
#define IS_EXPORT_TE(a) (a->export)
/* Per area MPLS-TE parameters */ /* Per area MPLS-TE parameters */
struct ls_ted;
struct mpls_te_area { struct mpls_te_area {
/* Status of MPLS-TE: enable or disable */ /* Status of MPLS-TE: enable or disable */
status_t status; status_t status;
@ -104,11 +106,27 @@ struct mpls_te_area {
/* MPLS_TE IPv4 & IPv6 Router IDs */ /* MPLS_TE IPv4 & IPv6 Router IDs */
struct in_addr router_id; struct in_addr router_id;
struct in6_addr router_id_ipv6; struct in6_addr router_id_ipv6;
/* Link State Database */
struct ls_ted *ted;
bool export;
}; };
/* Structure to provide parameters to lsp iterate callback function */
struct isis_te_args {
struct ls_ted *ted;
struct ls_vertex *vertex;
bool export;
};
enum lsp_event { LSP_UNKNOWN, LSP_ADD, LSP_UPD, LSP_DEL, LSP_INC, LSP_TICK };
/* Prototypes. */ /* Prototypes. */
void isis_mpls_te_init(void); void isis_mpls_te_init(void);
void isis_link_params_update(struct isis_circuit *, struct interface *); void isis_link_params_update(struct isis_circuit *, struct interface *);
int isis_mpls_te_update(struct interface *); int isis_mpls_te_update(struct interface *);
void isis_te_lsp_event(struct isis_lsp *lsp, enum lsp_event event);
int isis_te_sync_ted(struct zapi_opaque_reg_info dst);
void isis_te_init_ted(struct isis_area *area);
#endif /* _ZEBRA_ISIS_MPLS_TE_H */ #endif /* _ZEBRA_ISIS_MPLS_TE_H */

View File

@ -1486,6 +1486,12 @@ module frr-isisd {
description description
"Stable IPv6 address of the advertising router."; "Stable IPv6 address of the advertising router.";
} }
leaf export {
type boolean;
default "false";
description
"Export Link State informatin.";
}
} }
container segment-routing { container segment-routing {