fix cellIndex assignment in srsENB to not necessarily copy cell ID

master
Francisco Paisana 4 years ago
parent cf89d6645b
commit 098172c911

@ -136,11 +136,11 @@ meas_obj_to_add_mod_s* find_meas_obj(meas_obj_to_add_mod_list_l& l, uint32_t ear
return it;
}
/** Finds a cell in this->objects based on cell_id and frequency
/** Finds a cell in this->objects based on pci and earfcn
* return pair of (meas_obj,cell_obj). If no cell has frequency==earfcn, meas_obj=nullptr
*/
std::pair<meas_obj_to_add_mod_s*, cells_to_add_mod_s*>
find_cell(meas_obj_to_add_mod_list_l& l, uint32_t earfcn, uint8_t cell_id)
find_cell(meas_obj_to_add_mod_list_l& l, uint32_t earfcn, uint32_t pci)
{
// find meas_obj with same earfcn
meas_obj_to_add_mod_s* obj = rrc_details::find_meas_obj(l, earfcn);
@ -149,7 +149,7 @@ find_cell(meas_obj_to_add_mod_list_l& l, uint32_t earfcn, uint8_t cell_id)
}
// find cell with same id
auto& cells = obj->meas_obj.meas_obj_eutra().cells_to_add_mod_list;
auto cell_it = srslte::find_rrc_obj_id(cells, cell_id);
auto cell_it = std::find_if(cells.begin(), cells.end(), [pci](const cells_to_add_mod_s& c) { return c.pci == pci; });
if (cell_it == cells.end()) {
cell_it = nullptr;
}
@ -194,14 +194,12 @@ var_meas_cfg_t::add_cell_cfg(const meas_cell_cfg_t& cellcfg)
using namespace rrc_details;
bool inserted_flag = true;
// TODO: cellcfg.eci is the ECI
uint32_t cell_id = rrc_details::eci_to_cellid(cellcfg.eci);
q_offset_range_e offset;
asn1::number_to_enum(offset, (int8_t)cellcfg.q_offset); // TODO: What's the difference
std::pair<meas_obj_t*, meas_cell_t*> ret = rrc_details::find_cell(var_meas.meas_obj_list, cellcfg.earfcn, cell_id);
cells_to_add_mod_s new_cell;
new_cell.cell_idx = cell_id;
std::pair<meas_obj_t*, meas_cell_t*> ret =
rrc_details::find_cell(var_meas.meas_obj_list, cellcfg.earfcn, cellcfg.pci);
cells_to_add_mod_s new_cell;
new_cell.cell_individual_offset = offset;
new_cell.pci = cellcfg.pci;
@ -209,15 +207,17 @@ var_meas_cfg_t::add_cell_cfg(const meas_cell_cfg_t& cellcfg)
// there are cells with the same earfcn at least.
if (ret.second != nullptr) {
// the cell already existed.
if (ret.second->pci != cellcfg.pci or ret.second->cell_individual_offset != offset) {
if (ret.second->cell_individual_offset != offset) {
// members of cell were updated
*ret.second = new_cell;
new_cell.cell_idx = ret.second->cell_idx;
*ret.second = new_cell;
} else {
inserted_flag = false;
}
} else {
// eci not found. create new cell
ret.second = srslte::add_rrc_obj(ret.first->meas_obj.meas_obj_eutra().cells_to_add_mod_list, new_cell);
// pci not found. create new cell
new_cell.cell_idx = srslte::find_rrc_obj_id_gap(ret.first->meas_obj.meas_obj_eutra().cells_to_add_mod_list);
ret.second = srslte::add_rrc_obj(ret.first->meas_obj.meas_obj_eutra().cells_to_add_mod_list, new_cell);
}
} else {
// no measobj has been found with same earfcn, create a new one
@ -230,6 +230,7 @@ var_meas_cfg_t::add_cell_cfg(const meas_cell_cfg_t& cellcfg)
eutra.offset_freq_present = true;
// TODO: Assert that q_offset is in ms
asn1::number_to_enum(eutra.offset_freq, cellcfg.q_offset);
new_cell.cell_idx = 1;
eutra.cells_to_add_mod_list_present = true;
eutra.cells_to_add_mod_list.push_back(new_cell);
ret.first = srslte::add_rrc_obj(var_meas.meas_obj_list, new_obj);
@ -609,9 +610,10 @@ void rrc::ue::rrc_mobility::handle_ue_meas_report(const meas_report_s& msg)
continue;
}
meas_ev.meas_cell = cell_it;
meas_ev.target_eci = std::find_if(meas_list_cfg.begin(), meas_list_cfg.end(), [pci](const meas_cell_cfg_t& c) {
return c.pci == pci;
})->eci;
meas_ev.target_eci = std::find_if(meas_list_cfg.begin(),
meas_list_cfg.end(),
[pci](const meas_cell_cfg_t& c) { return c.pci == pci; })
->eci;
// eNB found the respective cell. eNB takes "HO Decision"
// NOTE: From now we just choose the strongest.

@ -57,8 +57,7 @@ report_cfg_eutra_s generate_rep1()
bool is_cell_cfg_equal(const meas_cell_cfg_t& cfg, const cells_to_add_mod_s& cell)
{
return cfg.pci == cell.pci and cell.cell_individual_offset.to_number() == (int8_t)round(cfg.q_offset) and
cell.cell_idx == (cfg.eci & 0xFFu);
return cfg.pci == cell.pci and cell.cell_individual_offset.to_number() == (int8_t)round(cfg.q_offset);
}
int test_correct_insertion()
@ -105,9 +104,10 @@ int test_correct_insertion()
TESTASSERT(eutra.carrier_freq == cell1.earfcn);
TESTASSERT(eutra.cells_to_add_mod_list.size() == 2);
const cells_to_add_mod_s* cell_it = eutra.cells_to_add_mod_list.begin();
TESTASSERT(cell_it[0].cell_idx == (cell1.eci & 0xFFu));
TESTASSERT(cell_it[1].cell_idx == (cell2.eci & 0xFFu));
TESTASSERT(cell_it[1].pci == cell2.pci);
TESTASSERT(cell_it[0].cell_idx == 1);
TESTASSERT(cell_it[1].cell_idx == 2);
TESTASSERT(cell_it[0].pci == cell2.pci);
TESTASSERT(cell_it[1].pci == cell1.pci);
// TEST 3: insertion of cell in another frequency
auto ret1 = var_cfg.add_cell_cfg(cell3);
@ -115,7 +115,9 @@ int test_correct_insertion()
TESTASSERT(objs.size() == 2 and objs[1].meas_obj_id == 2);
const auto& eutra2 = objs[1].meas_obj.meas_obj_eutra();
TESTASSERT(eutra2.carrier_freq == cell3.earfcn);
TESTASSERT(eutra2.cells_to_add_mod_list.size() == 1);
TESTASSERT(eutra2.cells_to_add_mod_list_present and eutra2.cells_to_add_mod_list.size() == 1);
TESTASSERT(eutra2.cells_to_add_mod_list[0].cell_idx == 1);
TESTASSERT(eutra2.cells_to_add_mod_list[0].pci == cell3.pci);
// TEST 4: update of existing cell
auto ret2 = var_cfg.add_cell_cfg(cell4);
@ -124,8 +126,9 @@ int test_correct_insertion()
TESTASSERT(objs.size() == 2 and objs[0].meas_obj_id == 1);
TESTASSERT(eutra3.carrier_freq == cell4.earfcn);
TESTASSERT(eutra3.cells_to_add_mod_list.size() == 2);
TESTASSERT(eutra3.cells_to_add_mod_list[0].cell_idx == (cell1.eci & 0xFFu));
TESTASSERT(eutra3.cells_to_add_mod_list[0].cell_individual_offset.to_number() == 1);
TESTASSERT(eutra3.cells_to_add_mod_list[1].cell_idx == 2);
TESTASSERT(eutra3.cells_to_add_mod_list[1].pci == cell4.pci);
TESTASSERT(eutra3.cells_to_add_mod_list[1].cell_individual_offset.to_number() == 1);
}
return 0;
@ -197,8 +200,8 @@ int test_correct_meascfg_calculation()
TESTASSERT(result_meascfg.report_cfg_to_add_mod_list.size() == 0);
// TEST 3: Cell is added to cellsToAddModList if just a field was updated
cell1.pci = 3;
src_var = target_var;
cell1.q_offset = 5;
src_var = target_var;
target_var.add_cell_cfg(cell1);
src_var.compute_diff_meas_cfg(target_var, &result_meascfg);
TESTASSERT(result_meascfg.meas_obj_to_add_mod_list_present);
@ -213,7 +216,9 @@ int test_correct_meascfg_calculation()
TESTASSERT(is_cell_cfg_equal(cell1, *cell_item));
// TEST 4: Removal of cell/rep from target propagates to the resulting meas_cfg_s
src_var = target_var;
src_var = target_var;
TESTASSERT(src_var.meas_objs().size() == 1);
TESTASSERT(src_var.meas_objs()[0].meas_obj.meas_obj_eutra().cells_to_add_mod_list.size() == 2);
target_var = var_meas_cfg_t{};
target_var.add_cell_cfg(cell2);
target_var.add_report_cfg(rep1);
@ -225,9 +230,10 @@ int test_correct_meascfg_calculation()
TESTASSERT(item->meas_obj_id == 1 and
item->meas_obj.type().value == meas_obj_to_add_mod_s::meas_obj_c_::types_opts::meas_obj_eutra);
eutra = item->meas_obj.meas_obj_eutra();
TESTASSERT(not eutra.cells_to_add_mod_list_present and eutra.cells_to_rem_list_present);
TESTASSERT(eutra.cells_to_rem_list.size() == 1);
TESTASSERT(eutra.cells_to_rem_list[0] == (cell1.eci & 0xFFu));
TESTASSERT(eutra.cells_to_add_mod_list_present and eutra.cells_to_add_mod_list.size() == 1);
TESTASSERT(eutra.cells_to_add_mod_list[0].pci == cell2.pci);
TESTASSERT(eutra.cells_to_rem_list_present and eutra.cells_to_rem_list.size() == 1);
TESTASSERT(eutra.cells_to_rem_list[0] == 2);
TESTASSERT(result_meascfg.report_cfg_to_add_mod_list_present and not result_meascfg.report_cfg_to_rem_list_present);
TESTASSERT(result_meascfg.report_cfg_to_add_mod_list.size() == 1);
TESTASSERT(result_meascfg.report_cfg_to_add_mod_list[0].report_cfg_id == 2);

Loading…
Cancel
Save