ospfd: Add Link-State support

This patch allows to store Link State Information received through the various
LSAs into a dedicated Traffic Engineering Database (TED). This feature is
automatically activated once mpls-te is enabled.

A new CLI command `mpls-te export` permits to export the TED to other daemons
through the new ZAPI Opaque Link State messages. In complement, a new CLI
command `show ip ospf mpls-te database ...` output the contains of the TED to
the console.

Major modifications take place in ospf_te.[c, h]. File ospf_zebra.c has been
modified to handle TED synchronisation request.

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
This commit is contained in:
Olivier Dugeon 2021-01-05 16:05:09 +01:00
parent 2efd7e2bdc
commit f173deb352
4 changed files with 1794 additions and 28 deletions

View File

@ -823,6 +823,13 @@ Traffic Engineering
flood in AREA <area-id> with Opaque Type-10, respectively in AS with Opaque
Type-11. In all case, Opaque-LSA TLV=6.
.. index:: mpls-te export
.. clicmd:: no mpls-te export
Export Traffic Engineering Data Base to other daemons through the ZAPI
Opaque Link State messages.
.. index:: show ip ospf mpls-te interface
.. clicmd:: show ip ospf mpls-te interface
.. clicmd:: show ip ospf mpls-te interface INTERFACE
@ -833,6 +840,20 @@ Traffic Engineering
Show Traffic Engineering router parameters.
.. index:: show ip ospf mpls-te database [verbose|json]
.. clicmd:: show ip ospf mpls-te database [verbose|json]
.. index:: show ip ospf mpls-te database vertex [self-originate|adv-router ADV-ROUTER] [verbose|json]
.. clicmd:: show ip ospf mpls-te database vertex [self-originate|adv-router ADV-ROUTER] [verbose|json]
.. index:: show ip ospf mpls-te database edge [A.B.C.D] [verbose|json]
.. clicmd:: show ip ospf mpls-te database edge [A.B.C.D] [verbose|json]
.. index:: show ip ospf mpls-te database subnet [A.B.C.D/M] [verbose|json]
.. clicmd:: show ip ospf mpls-te database subnet [A.B.C.D/M] [verbose|json]
Show Traffic Engineering Database
.. _router-information:
Router Information

File diff suppressed because it is too large Load Diff

View File

@ -340,9 +340,13 @@ struct te_link_subtlv {
/* Following structure are internal use only. */
struct ospf_mpls_te {
/* Status of MPLS-TE: enable or disbale */
/* Status of MPLS-TE: enable or disable */
bool enabled;
/* Traffic Engineering Database i.e. Link State */
struct ls_ted *ted;
bool export;
/* RFC5392 */
enum inter_as_mode inter_as;
struct in_addr interas_areaid;
@ -418,4 +422,15 @@ extern void set_linkparams_llri(struct mpls_te_link *, uint32_t, uint32_t);
extern void set_linkparams_lrrid(struct mpls_te_link *, struct in_addr,
struct in_addr);
struct zapi_opaque_reg_info;
/**
* Call when a client send a Link State Sync message. In turn, OSPF will send
* the contain of the Link State Data base.
*
* @param info ZAPI Opaque message information
*
* @return 0 on success, -1 otherwise
*/
extern int ospf_te_sync_ted(struct zapi_opaque_reg_info dst);
#endif /* _ZEBRA_OSPF_MPLS_TE_H */

View File

@ -2043,6 +2043,7 @@ static int ospf_opaque_msg_handler(ZAPI_CALLBACK_ARGS)
struct zapi_opaque_msg info;
struct ldp_igp_sync_if_state state;
struct ldp_igp_sync_announce announce;
struct zapi_opaque_reg_info dst;
int ret = 0;
s = zclient->ibuf;
@ -2051,6 +2052,13 @@ static int ospf_opaque_msg_handler(ZAPI_CALLBACK_ARGS)
return -1;
switch (info.type) {
case LINK_STATE_SYNC:
STREAM_GETC(s, dst.proto);
STREAM_GETW(s, dst.instance);
STREAM_GETL(s, dst.session_id);
dst.type = LINK_STATE_SYNC;
ret = ospf_te_sync_ted(dst);
break;
case LDP_IGP_SYNC_IF_STATE_UPDATE:
STREAM_GET(&state, s, sizeof(state));
ret = ospf_ldp_sync_state_update(state);