diff options
author | Javier Garcia <javier.garcia@voltanet.io> | 2021-04-22 15:52:27 +0200 |
---|---|---|
committer | Javier Garcia <javier.garcia@voltanet.io> | 2021-05-10 12:36:46 +0200 |
commit | 75c69d151c8e72e42dfb4b1966428e9cf79cb7f4 (patch) | |
tree | 240ecdf1e026387c787fa33fe8a716750525dd1a /pathd/path_zebra.c | |
parent | Merge pull request #8639 from idryzhov/isis-new-bfd-lib (diff) | |
download | frr-75c69d151c8e72e42dfb4b1966428e9cf79cb7f4.tar.xz frr-75c69d151c8e72e42dfb4b1966428e9cf79cb7f4.zip |
pathd. TED support . Client to link State - [part 1/4]
- pathd will act as a client to for the configured igp.
- pathd must be configured to activate and receive data from igp.
!pathd config snippet
segment-routing
traffic-eng
mpls-te on
mpls-te import ospfv2
Signed-off-by: Javier Garcia <javier.garcia@voltanet.io>
Diffstat (limited to 'pathd/path_zebra.c')
-rw-r--r-- | pathd/path_zebra.c | 56 |
1 files changed, 55 insertions, 1 deletions
diff --git a/pathd/path_zebra.c b/pathd/path_zebra.c index 8c9357460..53d834f36 100644 --- a/pathd/path_zebra.c +++ b/pathd/path_zebra.c @@ -32,9 +32,14 @@ #include "typesafe.h" #include "pathd/pathd.h" +#include "pathd/path_ted.h" #include "pathd/path_zebra.h" +#include "lib/command.h" +#include "lib/link_state.h" -static struct zclient *zclient; +static int path_zebra_opaque_msg_handler(ZAPI_CALLBACK_ARGS); + +struct zclient *zclient; static struct zclient *zclient_sync; /* Global Variables */ @@ -267,6 +272,54 @@ static void path_zebra_label_manager_connect(void) } } +static int path_zebra_opaque_msg_handler(ZAPI_CALLBACK_ARGS) +{ + int ret = 0; + struct stream *s; + struct zapi_opaque_msg info; + + s = zclient->ibuf; + + if (zclient_opaque_decode(s, &info) != 0) + return -1; + + switch (info.type) { + case LINK_STATE_UPDATE: + case LINK_STATE_SYNC: + /* Start receiving ls data so cancel request sync timer */ + path_ted_timer_sync_cancel(); + + struct ls_message *msg = ls_parse_msg(s); + + if (msg) { + zlog_debug("%s: [rcv ted] ls (%s) msg (%s)-(%s) !", + __func__, + info.type == LINK_STATE_UPDATE + ? "LINK_STATE_UPDATE" + : "LINK_STATE_SYNC", + LS_MSG_TYPE_PRINT(msg->type), + LS_MSG_EVENT_PRINT(msg->event)); + } else { + zlog_err( + "%s: [rcv ted] Could not parse LinkState stream message.", + __func__); + return -1; + } + + ret = path_ted_rcvd_message(msg); + ls_delete_msg(msg); + /* Update local configuration after process update. */ + path_ted_segment_list_refresh(); + break; + default: + zlog_debug("%s: [rcv ted] unknown opaque event (%d) !", + __func__, info.type); + break; + } + + return ret; +} + /** * Initializes Zebra asynchronous connection. * @@ -283,6 +336,7 @@ void path_zebra_init(struct thread_master *master) zclient->zebra_connected = path_zebra_connected; zclient->sr_policy_notify_status = path_zebra_sr_policy_notify_status; zclient->router_id_update = path_zebra_router_id_update; + zclient->opaque_msg_handler = path_zebra_opaque_msg_handler; /* Initialize special zclient for synchronous message exchanges. */ zclient_sync = zclient_new(master, &options); |