From 2cd5c1faf76498d1be552db5601c2fbf7312e10e Mon Sep 17 00:00:00 2001 From: Teodora Date: Mon, 3 Feb 2025 15:34:15 +0100 Subject: [PATCH] Add RPC for M-plane --- radio/fhi_72/mplane/init-mplane.c | 7 +++++++ radio/fhi_72/mplane/subscribe-mplane.c | 25 +++++++++++++++++++++++++ radio/fhi_72/mplane/subscribe-mplane.h | 2 ++ 3 files changed, 34 insertions(+) diff --git a/radio/fhi_72/mplane/init-mplane.c b/radio/fhi_72/mplane/init-mplane.c index 72f6d46701..453a8b1390 100644 --- a/radio/fhi_72/mplane/init-mplane.c +++ b/radio/fhi_72/mplane/init-mplane.c @@ -159,7 +159,14 @@ bool manage_ru(ru_session_t *ru_session, const openair0_config_t *oai, const siz success = subscribe_mplane(ru_session, stream, filter, (void *)&ru_session->ru_notif); AssertError(success, return false, "[MPLANE] Unable to continue: could not get RU answer via subscribe_mplane().\n"); + // when subscribed to the supervision notification, the watchdog timer needs to be updated + char *watchdog_answer = NULL; + success = update_timer_mplane(ru_session, &watchdog_answer); + AssertError(success, return false, "[MPLANE] Unable to update the watchdog timer. RU will do a reset after default supervision timer of (60+10)[s] expires.\n"); + MP_LOG_I("Watchdog timer answer: \n\t%s\n", watchdog_answer); + free(operational_ds); + free(watchdog_answer); return true; } diff --git a/radio/fhi_72/mplane/subscribe-mplane.c b/radio/fhi_72/mplane/subscribe-mplane.c index 64215c0aba..d96d367d35 100644 --- a/radio/fhi_72/mplane/subscribe-mplane.c +++ b/radio/fhi_72/mplane/subscribe-mplane.c @@ -131,3 +131,28 @@ bool subscribe_mplane(ru_session_t *ru_session, const char *stream, const char * return true; } + +bool update_timer_mplane(ru_session_t *ru_session, char **answer) +{ + int timeout = CLI_RPC_REPLY_TIMEOUT; + struct nc_rpc *rpc; + NC_WD_MODE wd = NC_WD_ALL; + NC_PARAMTYPE param = NC_PARAMTYPE_CONST; + const char *content = "\n\ +65535\n\ +65535\n\ +"; + + MP_LOG_I("RPC request to RU \"%s\" = \"%s\".\n", ru_session->ru_ip_add, content); + rpc = nc_rpc_act_generic_xml(content, param); + AssertError(rpc != NULL, return false, "[MPLANE] RPC creation failed.\n"); + + bool success = rpc_send_recv((struct nc_session *)ru_session->session, rpc, wd, timeout, answer); + AssertError(success, return false, "[MPLANE] Failed to update the watchdog timer.\n"); + + MP_LOG_I("Successfully updated supervision timer to (65535+65535)[s] for RU \"%s\".\n", ru_session->ru_ip_add); + + nc_rpc_free(rpc); + + return true; +} diff --git a/radio/fhi_72/mplane/subscribe-mplane.h b/radio/fhi_72/mplane/subscribe-mplane.h index c5a6762fe9..6cb7a10310 100644 --- a/radio/fhi_72/mplane/subscribe-mplane.h +++ b/radio/fhi_72/mplane/subscribe-mplane.h @@ -28,4 +28,6 @@ bool subscribe_mplane(ru_session_t *ru_session, const char *stream, const char *filter, void *answer); +bool update_timer_mplane(ru_session_t *ru_session, char **answer); + #endif /* SUBSCRIBE_MPLANE_H */