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:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -26,4 +26,6 @@
|
||||
|
||||
bool connect_mplane(ru_session_t *ru_session);
|
||||
|
||||
void disconnect_mplane(void *rus_disconnect);
|
||||
|
||||
#endif /* CONNECT_MPLANE_H */
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ typedef struct {
|
||||
rru_config_msg_type_t last_msg;
|
||||
int capabilities_sent;
|
||||
void *oran_priv;
|
||||
void *mplane_priv;
|
||||
} oran_eth_state_t;
|
||||
|
||||
notifiedFIFO_t oran_sync_fifo;
|
||||
@@ -81,6 +82,10 @@ int trx_oran_stop(openair0_device *device)
|
||||
printf("ORAN: %s\n", __FUNCTION__);
|
||||
oran_eth_state_t *s = device->priv;
|
||||
xran_stop(s->oran_priv);
|
||||
#ifdef OAI_MPLANE
|
||||
printf("[MPLANE] Stopping M-plane.\n");
|
||||
disconnect_mplane(s->mplane_priv);
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -304,6 +309,41 @@ __attribute__((__visibility__("default"))) int transport_init(openair0_device *d
|
||||
}
|
||||
ru_configured[i] = manage_ru(ru_session, openair0_cfg, ru_session_list.num_rus);
|
||||
}
|
||||
|
||||
bool all_ok = true;
|
||||
bool ru_ready[ru_session_list.num_rus];
|
||||
for (size_t i = 0; i < ru_session_list.num_rus; i++) {
|
||||
if (!ru_configured[i]) {
|
||||
MP_LOG_I("RU with IP %s couldn't be configured.\n", ru_session_list.ru_session[i].ru_ip_add);
|
||||
all_ok = false;
|
||||
}
|
||||
ru_ready[i] = false;
|
||||
}
|
||||
|
||||
if (!all_ok) {
|
||||
disconnect_mplane((void *)&ru_session_list);
|
||||
AssertFatal(false, "[MPLANE] Stopping M-plane.\n");
|
||||
}
|
||||
|
||||
while (true) {
|
||||
sleep(1);
|
||||
bool all_rus_ready = true;
|
||||
for (int i = 0; i < ru_session_list.num_rus; i++) {
|
||||
ru_session_t *ru_session = &ru_session_list.ru_session[i];
|
||||
if (!ru_ready[i] && ru_session->ru_notif.config_change && ru_session->ru_notif.rx_carrier_state && ru_session->ru_notif.tx_carrier_state) {
|
||||
MP_LOG_I("RU \"%s\" is now ready.\n", ru_session->ru_ip_add);
|
||||
ru_ready[i] = true;
|
||||
} else {
|
||||
all_rus_ready = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (all_rus_ready) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
eth->mplane_priv = (void *)&ru_session_list;
|
||||
#else
|
||||
success = get_xran_config(openair0_cfg, &fh_init, fh_config);
|
||||
AssertFatal(success, "cannot get configuration for xran\n");
|
||||
|
||||
Reference in New Issue
Block a user