Add E2 agent in CU-UP
This commit is contained in:
@@ -128,3 +128,4 @@ add_subdirectory(flexric/src/sm)
|
||||
add_subdirectory(flexric/src/util)
|
||||
add_subdirectory(RAN_FUNCTION)
|
||||
|
||||
add_library(e2_agent_arg STATIC e2_agent_arg.c)
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* 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 "e2_agent_arg.h"
|
||||
#include "e2_agent_paramdef.h"
|
||||
#include "common/config/config_userapi.h"
|
||||
|
||||
e2_agent_args_t RCconfig_NR_E2agent(void)
|
||||
{
|
||||
paramdef_t e2agent_params[] = E2AGENT_PARAMS_DESC;
|
||||
int ret = config_get(config_get_if(), e2agent_params, sizeofArray(e2agent_params), CONFIG_STRING_E2AGENT);
|
||||
if (ret < 0) {
|
||||
printf("configuration file does not contain a \"%s\" section, applying default parameters from FlexRIC\n", CONFIG_STRING_E2AGENT);
|
||||
return (e2_agent_args_t) { 0 };
|
||||
}
|
||||
|
||||
bool enabled = config_isparamset(e2agent_params, E2AGENT_CONFIG_SMDIR_IDX)
|
||||
&& config_isparamset(e2agent_params, E2AGENT_CONFIG_IP_IDX);
|
||||
e2_agent_args_t dst = {.enabled = enabled};
|
||||
if (!enabled) {
|
||||
printf("E2 agent is DISABLED (for activation, define .%s.{%s,%s} parameters)\n", CONFIG_STRING_E2AGENT, E2AGENT_CONFIG_IP, E2AGENT_CONFIG_SMDIR);
|
||||
return dst;
|
||||
}
|
||||
|
||||
if (e2agent_params[E2AGENT_CONFIG_SMDIR_IDX].strptr != NULL)
|
||||
dst.sm_dir = *e2agent_params[E2AGENT_CONFIG_SMDIR_IDX].strptr;
|
||||
|
||||
if (e2agent_params[E2AGENT_CONFIG_IP_IDX].strptr != NULL)
|
||||
dst.ip = *e2agent_params[E2AGENT_CONFIG_IP_IDX].strptr;
|
||||
|
||||
return dst;
|
||||
}
|
||||
@@ -23,6 +23,8 @@
|
||||
#define E2_AGENT_ARGS_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
// Wrapper for OAI
|
||||
typedef struct{
|
||||
@@ -31,6 +33,8 @@ typedef struct{
|
||||
const bool enabled;
|
||||
} e2_agent_args_t;
|
||||
|
||||
e2_agent_args_t RCconfig_NR_E2agent(void);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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 E2_AGENT_PARAMDEF_H_
|
||||
#define E2_AGENT_PARAMDEF_H_
|
||||
|
||||
/* E2 Agent configuration */
|
||||
#define CONFIG_STRING_E2AGENT "e2_agent"
|
||||
|
||||
#define E2AGENT_CONFIG_IP "near_ric_ip_addr"
|
||||
#define E2AGENT_CONFIG_SMDIR "sm_dir"
|
||||
|
||||
static const char* const e2agent_config_ip_default = "127.0.0.1";
|
||||
static const char* const e2agent_config_smdir_default = ".";
|
||||
|
||||
#define E2AGENT_PARAMS_DESC { \
|
||||
{E2AGENT_CONFIG_IP, "RIC IP address", 0, strptr:NULL, defstrval:(char*)e2agent_config_ip_default, TYPE_STRING, 0}, \
|
||||
{E2AGENT_CONFIG_SMDIR, "Directory with SMs to load", 0, strptr:NULL, defstrval:(char*)e2agent_config_smdir_default, TYPE_STRING, 0}, \
|
||||
}
|
||||
|
||||
#define E2AGENT_CONFIG_IP_IDX 0
|
||||
#define E2AGENT_CONFIG_SMDIR_IDX 1
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user