catch exceptions from eNB config parser

since the eNB config gets more complex, especially with CA,
we need to catch potential parsing errors from libconfig,
print an error with the position of the error and gracefully
stop the enb
master
Andre Puschmann 5 years ago
parent 43e67b8536
commit 87f1b2a939

@ -812,22 +812,57 @@ int parse_cfg_files(all_args_t* args_, rrc_cfg_t* rrc_cfg_, phy_cfg_t* phy_cfg_)
// Parse config files
srslte_cell_t cell_common_cfg = {};
try {
if (enb_conf_sections::parse_cell_cfg(args_, &cell_common_cfg) != SRSLTE_SUCCESS) {
fprintf(stderr, "Error parsing Cell configuration\n");
return SRSLTE_ERROR;
}
} catch (const SettingTypeException& stex) {
fprintf(stderr, "Error parsing Cell configuration: %s\n", stex.getPath());
return SRSLTE_ERROR;
} catch (const ConfigException& cex) {
fprintf(stderr, "Error parsing Cell configuration\n");
return SRSLTE_ERROR;
}
try {
if (sib_sections::parse_sibs(args_, rrc_cfg_, phy_cfg_) != SRSLTE_SUCCESS) {
fprintf(stderr, "Error parsing SIB configuration\n");
return SRSLTE_ERROR;
}
} catch (const SettingTypeException& stex) {
fprintf(stderr, "Error parsing SIB configuration: %s\n", stex.getPath());
return SRSLTE_ERROR;
} catch (const ConfigException& cex) {
fprintf(stderr, "Error parsing SIB configurationn\n");
return SRSLTE_ERROR;
}
try {
if (rr_sections::parse_rr(args_, rrc_cfg_) != SRSLTE_SUCCESS) {
fprintf(stderr, "Error parsing Radio Resources configuration\n");
return SRSLTE_ERROR;
}
} catch (const SettingTypeException& stex) {
fprintf(stderr, "Error parsing Radio Resources configuration: %s\n", stex.getPath());
return SRSLTE_ERROR;
} catch (const ConfigException& cex) {
fprintf(stderr, "Error parsing Radio Resources configuration\n");
return SRSLTE_ERROR;
}
try {
if (drb_sections::parse_drb(args_, rrc_cfg_) != SRSLTE_SUCCESS) {
fprintf(stderr, "Error parsing DRB configuration\n");
return SRSLTE_ERROR;
}
} catch (const SettingTypeException& stex) {
fprintf(stderr, "\"Error parsing DRB configuration: %s\n", stex.getPath());
return SRSLTE_ERROR;
} catch (const ConfigException& cex) {
fprintf(stderr, "Error parsing DRB configuration\n");
return SRSLTE_ERROR;
}
// Set fields derived from others, and check for correctness of the parsed configuration
return enb_conf_sections::set_derived_args(args_, rrc_cfg_, phy_cfg_, &cell_common_cfg);

Loading…
Cancel
Save