Commit e996f5d0 authored by Navid Nikaein's avatar Navid Nikaein

Add new RAN APIs form SMA app based on the initial eNb config file

parent c8c4b423
...@@ -21,8 +21,8 @@ ...@@ -21,8 +21,8 @@
/*! \file flexran_agent_common_internal.c /*! \file flexran_agent_common_internal.c
* \brief internal functions for common message primitves and utilities * \brief internal functions for common message primitves and utilities
* \author Xenofon Foukas * \author Xenofon Foukas and N. Nikaein
* \date 2016 * \date 2017
* \version 0.1 * \version 0.1
*/ */
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "flexran_agent_common_internal.h" #include "flexran_agent_common_internal.h"
#include "flexran_agent_mac_internal.h" #include "flexran_agent_mac_internal.h"
extern volatile int reconfigure_enb;
int apply_reconfiguration_policy(mid_t mod_id, const char *policy, size_t policy_length) { int apply_reconfiguration_policy(mid_t mod_id, const char *policy, size_t policy_length) {
...@@ -64,7 +65,17 @@ int apply_reconfiguration_policy(mid_t mod_id, const char *policy, size_t policy ...@@ -64,7 +65,17 @@ int apply_reconfiguration_policy(mid_t mod_id, const char *policy, size_t policy
break; break;
case YAML_SCALAR_EVENT: case YAML_SCALAR_EVENT:
// Check the system name and call the proper handler // Check the system name and call the proper handler
if (strcmp((char *) event.data.scalar.value, "mac") == 0) { // Check the system name and call the proper handler
if (strcmp((char *) event.data.scalar.value, "enb") == 0) {
LOG_I(ENB_APP, "This is intended for the enb system\n");
// Call the enb handler
if (parse_enb_id(mod_id, &parser) == -1) {
goto error;
} else { // succeful parse and setting
LOG_I(ENB_APP, "Successful parsed config for enb system\n");
//reconfigure_enb=RECONF_FREQ;
}
} else if (strcmp((char *) event.data.scalar.value, "mac") == 0) {
LOG_D(ENB_APP, "This is intended for the mac system\n"); LOG_D(ENB_APP, "This is intended for the mac system\n");
// Call the mac handler // Call the mac handler
if (parse_mac_config(mod_id, &parser) == -1) { if (parse_mac_config(mod_id, &parser) == -1) {
...@@ -115,6 +126,148 @@ int apply_reconfiguration_policy(mid_t mod_id, const char *policy, size_t policy ...@@ -115,6 +126,148 @@ int apply_reconfiguration_policy(mid_t mod_id, const char *policy, size_t policy
} }
int parse_enb_id(mid_t mod_id, yaml_parser_t *parser) {
yaml_event_t event;
void *param;
char *endptr;
int is_array = 0;
int i = 0;
int done = 0;
int mapping_started = 0;
while (!done) {
if (!yaml_parser_parse(parser, &event))
goto error;
switch (event.type) {
// We are expecting a mapping of parameters
case YAML_SEQUENCE_START_EVENT:
is_array = 1;
break;
case YAML_MAPPING_START_EVENT:
LOG_D(ENB_APP, "The mapping of the parameters started\n");
mapping_started = 1;
break;
case YAML_MAPPING_END_EVENT:
LOG_D(ENB_APP, "The mapping of the parameters ended\n");
mapping_started = 0;
break;
case YAML_SCALAR_EVENT:
if (!mapping_started) {
goto error;
}
// Check what key needs to be set
// use eNB egistered
if (mac_agent_registered[mod_id]) {
LOG_I(ENB_APP, "Setting parameter for eNB %s\n", event.data.scalar.value);
if (strcmp((char *) event.data.scalar.tag, YAML_INT_TAG) == 0) { // if int
if ((strtol((char *) event.data.scalar.value, &endptr, 10))== mod_id ) { // enb_id == mod_id: right enb instance to be configured
if (parse_enb_config_parameters(mod_id, parser) == -1) {
goto error;
}
}
else{
goto error; // not the expected type
}
}
}
break;
default:
goto error;
}
done = (event.type == YAML_MAPPING_END_EVENT);
yaml_event_delete(&event);
}
return 0;
error:
yaml_event_delete(&event);
return -1;
}
int parse_enb_config_parameters(mid_t mod_id, yaml_parser_t *parser) {
yaml_event_t event;
void *param;
char *endptr;
int done = 0;
int mapping_started = 0;
while (!done) {
if (!yaml_parser_parse(parser, &event))
goto error;
switch (event.type) {
// We are expecting a mapping of parameters
case YAML_MAPPING_START_EVENT:
LOG_D(ENB_APP, "The mapping of the parameters started\n");
mapping_started = 1;
break;
case YAML_MAPPING_END_EVENT:
LOG_D(ENB_APP, "The mapping of the parameters ended\n");
mapping_started = 0;
break;
case YAML_SCALAR_EVENT:
if (!mapping_started) {
goto error;
}
// Check what key needs to be set
LOG_I(ENB_APP, "Setting parameter %s\n", event.data.scalar.value);
if (strcmp((char *) event.data.scalar.value, "dl_freq") == 0) {
if (!yaml_parser_parse(parser, &event))
goto error;
flexran_agent_set_operating_dl_freq(mod_id,
0,
strtol((char *) event.data.scalar.value, &endptr, 10));
LOG_I(ENB_APP, "Setting parameter value %s\n", event.data.scalar.value);
} else if (strcmp((char *) event.data.scalar.value, "ul_freq_offset") == 0) {
if (!yaml_parser_parse(parser, &event))
goto error;
flexran_agent_set_operating_ul_freq(mod_id,
0,
strtol((char *) event.data.scalar.value, &endptr, 10));
LOG_I(ENB_APP, "Setting parameter value %s\n", event.data.scalar.value);
} else if (strcmp((char *) event.data.scalar.value, "bandwidth") == 0) {
if (!yaml_parser_parse(parser, &event))
goto error;
flexran_agent_set_operating_bandwidth(mod_id,
0,
strtol((char *) event.data.scalar.value, &endptr, 10));
LOG_I(ENB_APP, "Setting parameter value %s\n", event.data.scalar.value);
} else if (strcmp((char *) event.data.scalar.value, "frame_type") == 0) {
if (!yaml_parser_parse(parser, &event))
goto error;
flexran_agent_set_operating_frame_type (mod_id,
0,
strtol((char *) event.data.scalar.value, &endptr, 10));
LOG_I(ENB_APP, "Setting parameter value %s\n", event.data.scalar.value);
}else { // not supported tag
goto error;
}
break;
default:
goto error;
}
done = (event.type == YAML_MAPPING_END_EVENT);
yaml_event_delete(&event);
}
return 0;
error:
yaml_event_delete(&event);
return -1;
}
int skip_system_section(yaml_parser_t *parser) { int skip_system_section(yaml_parser_t *parser) {
yaml_event_t event; yaml_event_t event;
......
...@@ -21,8 +21,8 @@ ...@@ -21,8 +21,8 @@
/*! \file flexran_agent_common_internal.h /*! \file flexran_agent_common_internal.h
* \brief internal agent functions for common message primitves and utilities * \brief internal agent functions for common message primitves and utilities
* \author Xenofon Foukas * \author Xenofon Foukas and N. Nikaein
* \date 2016 * \date 2017
* \version 0.1 * \version 0.1
*/ */
...@@ -37,6 +37,10 @@ int apply_reconfiguration_policy(mid_t mod_id, const char *policy, size_t policy ...@@ -37,6 +37,10 @@ int apply_reconfiguration_policy(mid_t mod_id, const char *policy, size_t policy
int apply_parameter_modification(void *parameter, yaml_parser_t *parser); int apply_parameter_modification(void *parameter, yaml_parser_t *parser);
int parse_enb_id(mid_t mod_id, yaml_parser_t *parser);
int parse_enb_config_parameters(mid_t mod_id, yaml_parser_t *parser) ;
// This can be used when parsing for a specific system that is not yet implmeneted // This can be used when parsing for a specific system that is not yet implmeneted
// in order to skip its configuration, without affecting the rest // in order to skip its configuration, without affecting the rest
int skip_system_section(yaml_parser_t *parser); int skip_system_section(yaml_parser_t *parser);
......
This diff is collapsed.
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
/*! \file flexran_agent_ran_api.h /*! \file flexran_agent_ran_api.h
* \brief FlexRAN RAN API abstraction header * \brief FlexRAN RAN API abstraction header
* \author shahab SHARIAT BAGHERI * \author N. Nikaein, X. Foukas and S. SHARIAT BAGHERI
* \date 2017 * \date 2017
* \version 0.1 * \version 0.1
*/ */
...@@ -198,6 +198,8 @@ int flexran_get_p0_pucch_status(mid_t mod_id, mid_t ue_id, int CC_id); ...@@ -198,6 +198,8 @@ int flexran_get_p0_pucch_status(mid_t mod_id, mid_t ue_id, int CC_id);
int flexran_update_p0_pucch(mid_t mod_id, mid_t ue_id, int CC_id); int flexran_update_p0_pucch(mid_t mod_id, mid_t ue_id, int CC_id);
int flexran_get_threequarter_fs(mid_t mod_id, int CC_id);
int flexran_get_hopping_mode(mid_t mod_id, int CC_id); int flexran_get_hopping_mode(mid_t mod_id, int CC_id);
int flexran_get_hopping_offset(mid_t mod_id, int CC_id); int flexran_get_hopping_offset(mid_t mod_id, int CC_id);
...@@ -301,10 +303,10 @@ int flexran_get_lcg(mid_t ue_id, mid_t lc_id); ...@@ -301,10 +303,10 @@ int flexran_get_lcg(mid_t ue_id, mid_t lc_id);
int flexran_get_direction(mid_t ue_id, mid_t lc_id); int flexran_get_direction(mid_t ue_id, mid_t lc_id);
/*Get downlink frequency*/ /*Get downlink frequency*/
float flexran_agent_get_operating_dl_freq (mid_t mod_id, int cc_id); uint32_t flexran_agent_get_operating_dl_freq (mid_t mod_id, int cc_id);
/*Get uplink frequency*/ /*Get uplink frequency*/
float flexran_agent_get_operating_ul_freq (mid_t mod_id, int cc_id); uint32_t flexran_agent_get_operating_ul_freq (mid_t mod_id, int cc_id);
/*Get eutra band*/ /*Get eutra band*/
int flexran_agent_get_operating_eutra_band (mid_t mod_id, int cc_id); int flexran_agent_get_operating_eutra_band (mid_t mod_id, int cc_id);
...@@ -315,5 +317,20 @@ int flexran_agent_get_operating_pdsch_refpower (mid_t mod_id, int cc_id); ...@@ -315,5 +317,20 @@ int flexran_agent_get_operating_pdsch_refpower (mid_t mod_id, int cc_id);
/*Get uplink power*/ /*Get uplink power*/
int flexran_agent_get_operating_pusch_p0 (mid_t mod_id, int cc_id); int flexran_agent_get_operating_pusch_p0 (mid_t mod_id, int cc_id);
/*set the dl freq */
void flexran_agent_set_operating_dl_freq (mid_t mod_id, int cc_id, uint32_t dl_freq_mhz);
/* set the ul freq */
void flexran_agent_set_operating_ul_freq (mid_t mod_id, int cc_id, int32_t ul_freq_offset_mhz);
/*set the the band */
void flexran_agent_set_operating_eutra_band (mid_t mod_id, int cc_id);
/* set the bandwidth */
void flexran_agent_set_operating_bandwidth (mid_t mod_id, int cc_id, int bandwidth);
/*set frame type*/
void flexran_agent_set_operating_frame_type (mid_t mod_id, int cc_id, int frame_type);
/*RRC status flexRAN*/ /*RRC status flexRAN*/
int flexran_get_rrc_status(const mid_t mod_id, const rnti_t rntiP); int flexran_get_rrc_status(const mid_t mod_id, const rnti_t rntiP);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment