Accept both decimal and hexadecimal for enb_id

master
Pedro Alvarez 5 years ago committed by Andre Puschmann
parent f4f7210c56
commit 6a65cb0624

@ -59,7 +59,7 @@ namespace srsenb {
*******************************************************************************/
struct enb_args_t {
std::string enb_id;
uint32_t enb_id;
uint32_t dl_earfcn; // By default the EARFCN from rr.conf's cell list are used but this value can be used for single
// cell eNB
uint32_t n_prb;

@ -896,24 +896,10 @@ int set_derived_args(all_args_t* args_, rrc_cfg_t* rrc_cfg_, phy_cfg_t* phy_cfg_
// set config for RRC's base cell
rrc_cfg_->cell = cell_cfg_;
// Set S1AP related params from cell list (Convert hex strings)
{
std::stringstream sstr;
sstr << std::hex << args_->enb.enb_id;
sstr >> args_->stack.s1ap.enb_id;
}
{
std::stringstream sstr;
sstr << std::hex << rrc_cfg_->cell_list.at(0).cell_id;
uint16_t tmp; // Need intermediate uint16_t as uint8_t is treated as char
sstr >> tmp;
args_->stack.s1ap.cell_id = tmp;
}
{
std::stringstream sstr;
sstr << std::hex << rrc_cfg_->cell_list.at(0).tac;
sstr >> args_->stack.s1ap.tac;
}
// Set S1AP related params from cell list
args_->stack.s1ap.enb_id = args_->enb.enb_id;
args_->stack.s1ap.cell_id = rrc_cfg_->cell_list.at(0).cell_id;
args_->stack.s1ap.tac = rrc_cfg_->cell_list.at(0).tac;
// Create dedicated cell configuration from RRC configuration
for (auto& cfg : rrc_cfg_->cell_list) {

@ -52,6 +52,7 @@ void parse_args(all_args_t* args, int argc, char* argv[])
{
string mcc;
string mnc;
string enb_id;
// Command line only options
bpo::options_description general("General options");
@ -65,7 +66,7 @@ void parse_args(all_args_t* args, int argc, char* argv[])
bpo::options_description common("Configuration options");
common.add_options()
("enb.enb_id", bpo::value<string>(&args->enb.enb_id)->default_value("0x0"), "eNodeB ID")
("enb.enb_id", bpo::value<string>(&enb_id)->default_value("0x0"), "eNodeB ID")
("enb.name", bpo::value<string>(&args->stack.s1ap.enb_name)->default_value("srsenb01"), "eNodeB Name")
("enb.mcc", bpo::value<string>(&mcc)->default_value("001"), "Mobile Country Code")
("enb.mnc", bpo::value<string>(&mnc)->default_value("01"), "Mobile Network Code")
@ -273,6 +274,19 @@ void parse_args(all_args_t* args, int argc, char* argv[])
}
}
// Covert eNB Id
std::size_t pos = {};
try {
args->enb.enb_id = std::stoi(enb_id, &pos, 0);
} catch (...) {
cout << "Error parsing enb.enb_id: " << enb_id << "." << endl;
exit(1);
}
if (pos != enb_id.size()) {
cout << "Error parsing enb.enb_id: " << enb_id << "." << endl;
exit(1);
}
// Apply all_level to any unset layers
if (vm.count("log.all_level")) {
if (!vm.count("log.rf_level")) {

Loading…
Cancel
Save