ttcn3_sys_interface: Parse SIBs even when "StaticCellInfo" is missing

The test TC_9_2_1_1_1 sends a Cell->AddOrReconfigure->Basic message
without a "StaticCellInfo" member. This is used to change SIB1 of
the cell and simulate a different PLMN/TAC in the test.

handle_request_cell_basic() ignored the json message if "StaticCellInfo"
is missing which results in the SIB not being updated (PLMN stays as
00102 for example).
With this patch the SIBs after the json are now parsed even if there
"StaticCellInfo" is missing. A confirmation of the json is not sent
because the test does not seem to expect one in that case.

Related: TC_9_2_1_1_1
This commit is contained in:
Daniel Willmann 2020-03-12 17:16:10 +01:00 committed by Andre Puschmann
parent bc4e4ff97b
commit 3a804e23fa
1 changed files with 21 additions and 19 deletions

View File

@ -121,6 +121,10 @@ private:
void handle_request_cell_basic(Document& document, const uint8_t* payload, const uint16_t len)
{
// That is the cellId or name that the testsuites uses to refer to a specific cell
const Value& cell_name = document["Common"]["CellId"];
assert(cell_name.IsString());
if (document["Request"]["Cell"]["AddOrReconfigure"]["Basic"].HasMember("StaticCellInfo")) {
// Extract EARFCN
const Value& earfcn =
@ -155,33 +159,31 @@ private:
document["Request"]["Cell"]["AddOrReconfigure"]["Basic"]["InitialCellPower"]["MaxReferencePower"];
assert(ref_power.IsInt());
// That is the cellId or name that the testsuites uses to refer to a specific cell
const Value& cell_name = document["Common"]["CellId"];
assert(cell_name.IsString());
// Now configure cell
syssim->set_cell_config(
ttcn3_helpers::get_timing_info(document), cell_name.GetString(), earfcn.GetInt(), cell, ref_power.GetInt());
}
// Pull out SIBs and send to syssim
uint16_t consumed_bytes = 0;
const uint8_t* payload_ptr = payload;
while (consumed_bytes < len) {
uint16_t tb_len = ((uint16_t)payload_ptr[0] << 8) | payload_ptr[1];
payload_ptr += 2;
// Pull out SIBs and send to syssim
uint16_t consumed_bytes = 0;
const uint8_t* payload_ptr = payload;
while (consumed_bytes < len) {
uint16_t tb_len = ((uint16_t)payload_ptr[0] << 8) | payload_ptr[1];
payload_ptr += 2;
unique_byte_buffer_t sib = pool_allocate_blocking;
memcpy(sib->msg, payload_ptr, tb_len);
payload_ptr += tb_len;
sib->N_bytes = tb_len;
unique_byte_buffer_t sib = pool_allocate_blocking;
memcpy(sib->msg, payload_ptr, tb_len);
payload_ptr += tb_len;
sib->N_bytes = tb_len;
// Push to main component
log->info_hex(sib->msg, sib->N_bytes, "Received BCCH DL-SCH for %s\n", cell_name.GetString());
syssim->add_bcch_dlsch_pdu(cell_name.GetString(), std::move(sib));
// Push to main component
log->info_hex(sib->msg, sib->N_bytes, "Received BCCH DL-SCH for %s\n", cell_name.GetString());
syssim->add_bcch_dlsch_pdu(cell_name.GetString(), std::move(sib));
consumed_bytes = payload_ptr - payload;
}
consumed_bytes = payload_ptr - payload;
}
if (document["Request"]["Cell"]["AddOrReconfigure"]["Basic"].HasMember("StaticCellInfo")) {
// Create response for template car_CellConfig_CNF(CellId_Type p_CellId)
std::string resp = ttcn3_helpers::get_basic_sys_req_cnf(cell_name.GetString(), "Cell");