Add <get> RPC for M-plane
This commit is contained in:
@@ -28,6 +28,7 @@ target_sources(oran_fhlib_5g_mplane PRIVATE
|
||||
init-mplane.c
|
||||
connect-mplane.c
|
||||
rpc-send-recv.c
|
||||
get-mplane.c
|
||||
)
|
||||
|
||||
pkg_check_modules(libyang REQUIRED libyang)
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
#include "get-mplane.h"
|
||||
#include "rpc-send-recv.h"
|
||||
|
||||
#include "common/utils/assertions.h"
|
||||
|
||||
bool get_mplane(ru_session_t *ru_session, char **answer)
|
||||
{
|
||||
int timeout = CLI_RPC_REPLY_TIMEOUT;
|
||||
struct nc_rpc *rpc;
|
||||
char *filter = NULL; // e.g. "/o-ran-delay-management:delay-management";
|
||||
NC_WD_MODE wd = NC_WD_ALL;
|
||||
NC_PARAMTYPE param = NC_PARAMTYPE_CONST;
|
||||
|
||||
MP_LOG_I("RPC request to RU \"%s\" = <get> operational datastore.\n", ru_session->ru_ip_add);
|
||||
rpc = nc_rpc_get(filter, wd, param);
|
||||
AssertError(rpc != NULL, return false, "[MPLANE] <get> RPC creation failed.\n");
|
||||
|
||||
bool success = rpc_send_recv((struct nc_session *)ru_session->session, rpc, wd, timeout, answer);
|
||||
AssertError(success, return false, "[MPLANE] Unable to retrieve operational datastore.\n");
|
||||
|
||||
MP_LOG_I("Successfully retrieved operational datastore from RU \"%s\".\n", ru_session->ru_ip_add);
|
||||
|
||||
nc_rpc_free(rpc);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
#ifndef GET_MPLANE_H
|
||||
#define GET_MPLANE_H
|
||||
|
||||
#include "ru-mplane-api.h"
|
||||
|
||||
bool get_mplane(ru_session_t *ru_session, char **answer);
|
||||
|
||||
#endif /* GET_MPLANE_H */
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include "init-mplane.h"
|
||||
#include "radio/fhi_72/oran-params.h"
|
||||
#include "get-mplane.h"
|
||||
|
||||
#include <libyang/libyang.h>
|
||||
#include <nc_client.h>
|
||||
@@ -129,3 +130,16 @@ bool init_mplane(ru_session_list_t *ru_session_list)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool manage_ru(ru_session_t *ru_session, const openair0_config_t *oai, const size_t num_rus)
|
||||
{
|
||||
bool success = false;
|
||||
|
||||
char *operational_ds = NULL;
|
||||
success = get_mplane(ru_session, &operational_ds);
|
||||
AssertError(success, return false, "[MPLANE] Unable to continue: could not get RU answer via get_mplane().\n");
|
||||
|
||||
free(operational_ds);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -27,4 +27,6 @@
|
||||
|
||||
bool init_mplane(ru_session_list_t *ru_session_list);
|
||||
|
||||
bool manage_ru(ru_session_t *ru_session, const openair0_config_t *oai, const size_t num_rus);
|
||||
|
||||
#endif /* OAI_MPLANE_H */
|
||||
|
||||
@@ -302,6 +302,7 @@ __attribute__((__visibility__("default"))) int transport_init(openair0_device *d
|
||||
if (!ru_configured[i]) {
|
||||
continue;
|
||||
}
|
||||
ru_configured[i] = manage_ru(ru_session, openair0_cfg, ru_session_list.num_rus);
|
||||
}
|
||||
#else
|
||||
success = get_xran_config(openair0_cfg, &fh_init, fh_config);
|
||||
|
||||
Reference in New Issue
Block a user