Wait until RUs are ready and add <disconnect> RPC for M-plane

- if RU(s) are not well configured, disconnect immediately and stop the DU
  - if all RUs are well configured, proceed with waiting until ready. The RU is
    ready when the carriers are activated. Either the RU already has preconfigured
    carriers (previous M-plane client configured), or the DU has to wait until receives
    the notifications.
This commit is contained in:
Teodora
2025-03-31 12:16:16 +02:00
parent f22bc5acc7
commit 430026f1ec
6 changed files with 73 additions and 0 deletions
+16
View File
@@ -55,3 +55,19 @@ bool connect_mplane(ru_session_t *ru_session)
return true;
}
void disconnect_mplane(void *rus_disconnect)
{
ru_session_list_t *ru_session_list = (ru_session_list_t *)rus_disconnect;
for (size_t i = 0; i <ru_session_list->num_rus; i++) {
ru_session_t *ru_session = &ru_session_list->ru_session[i];
if (ru_session->session == NULL)
continue;
MP_LOG_I("Disconnecting from RU \"%s\".\n", ru_session->ru_ip_add);
nc_session_free(ru_session->session, NULL);
ru_session->session = NULL;
}
nc_client_destroy();
}
+2
View File
@@ -26,4 +26,6 @@
bool connect_mplane(ru_session_t *ru_session);
void disconnect_mplane(void *rus_disconnect);
#endif /* CONNECT_MPLANE_H */
+12
View File
@@ -186,6 +186,18 @@ bool manage_ru(ru_session_t *ru_session, const openair0_config_t *oai, const siz
AssertError(success, return false, "[MPLANE] Unable to commit the RU configuration.\n");
}
const char *usage_state = get_ru_xml_node(operational_ds, "usage-state");
MP_LOG_I("Usage state = \"%s\" for RU \"%s\".\n", usage_state, ru_session->ru_ip_add);
if (strcmp(usage_state, "busy") == 0) { // carriers are already activated
ru_session->ru_notif.rx_carrier_state = true;
ru_session->ru_notif.tx_carrier_state = true;
ru_session->ru_notif.config_change = true;
} else {
ru_session->ru_notif.rx_carrier_state = false;
ru_session->ru_notif.tx_carrier_state = false;
ru_session->ru_notif.config_change = false;
}
free(operational_ds);
free(watchdog_answer);
+1
View File
@@ -35,6 +35,7 @@ typedef struct {
bool ptp_state;
bool rx_carrier_state;
bool tx_carrier_state;
bool config_change;
// to be extended with any notification callback
} ru_notif_t;
+2
View File
@@ -79,6 +79,8 @@ static void recv_notif_v2(struct lyd_node_inner *op, ru_notif_t *answer)
} else { // "DISABLED" or "BUSY"
answer->tx_carrier_state = false;
}
} else if (strcmp(notif, "netconf-config-change") == 0) {
answer->config_change = true;
}
}