|
|
|
@ -78,7 +78,9 @@ struct rrc_tester : public rrc_dummy {
|
|
|
|
|
*erabs_modified = next_erabs_modified;
|
|
|
|
|
*erabs_failed_to_modify = next_erabs_failed_to_modify;
|
|
|
|
|
}
|
|
|
|
|
void release_ue(uint16_t rnti) override { last_released_rnti = rnti; }
|
|
|
|
|
|
|
|
|
|
uint16_t last_released_rnti = SRSRAN_INVALID_RNTI;
|
|
|
|
|
std::vector<uint16_t> next_erabs_modified, next_erabs_failed_to_modify;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -161,7 +163,7 @@ void add_rnti(s1ap& s1ap_obj, mme_dummy& mme)
|
|
|
|
|
TESTASSERT(s1ap_pdu.successful_outcome().proc_code == ASN1_S1AP_ID_INIT_CONTEXT_SETUP);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
enum class test_event { success, wrong_erabid_mod };
|
|
|
|
|
enum class test_event { success, wrong_erabid_mod, wrong_mme_s1ap_id };
|
|
|
|
|
|
|
|
|
|
void test_s1ap_erab_setup(test_event event)
|
|
|
|
|
{
|
|
|
|
@ -202,19 +204,34 @@ void test_s1ap_erab_setup(test_event event)
|
|
|
|
|
0x00, 0x24, 0x00, 0x06, 0x0A, 0x00, 0x09, 0x3C, 0x01, 0x00};
|
|
|
|
|
// 00 06 00 1E 00 00 03 00 00 00 02 00 01 00 08 00 02 00 01 00 1E 00 0B 00 00 24 00 06 0A 00 09 3C 01 00
|
|
|
|
|
if (event == test_event::wrong_erabid_mod) {
|
|
|
|
|
mod_req_msg[sizeof(mod_req_msg) - 6] = 0x0C; // E-RAB id == 6
|
|
|
|
|
mod_req_msg[sizeof(mod_req_msg) - 6] = 0x0C; // E-RAB id = 6
|
|
|
|
|
rrc.next_erabs_failed_to_modify.push_back(6);
|
|
|
|
|
} else if (event == test_event::wrong_mme_s1ap_id) {
|
|
|
|
|
mod_req_msg[12] = 0x02; // MME-UE-S1AP-ID = 2
|
|
|
|
|
} else {
|
|
|
|
|
rrc.next_erabs_modified.push_back(5);
|
|
|
|
|
}
|
|
|
|
|
sdu = srsran::make_byte_buffer();
|
|
|
|
|
memcpy(sdu->msg, mod_req_msg, sizeof(mod_req_msg));
|
|
|
|
|
sdu->N_bytes = sizeof(mod_req_msg);
|
|
|
|
|
TESTASSERT(rrc.last_released_rnti == SRSRAN_INVALID_RNTI);
|
|
|
|
|
TESTASSERT(s1ap_obj.handle_mme_rx_msg(std::move(sdu), mme_addr, rcvinfo, flags));
|
|
|
|
|
sdu = mme.read_msg();
|
|
|
|
|
TESTASSERT(sdu->N_bytes > 0);
|
|
|
|
|
asn1::cbit_ref cbref{sdu->msg, sdu->N_bytes};
|
|
|
|
|
TESTASSERT(s1ap_pdu.unpack(cbref) == SRSRAN_SUCCESS);
|
|
|
|
|
|
|
|
|
|
if (event == test_event::wrong_mme_s1ap_id) {
|
|
|
|
|
// See TS 36.413, Section 10.6 - Handling of AP ID
|
|
|
|
|
TESTASSERT(s1ap_pdu.type().value == asn1::s1ap::s1ap_pdu_c::types_opts::init_msg);
|
|
|
|
|
TESTASSERT(s1ap_pdu.init_msg().proc_code == ASN1_S1AP_ID_ERROR_IND);
|
|
|
|
|
auto& protocol_ies = s1ap_pdu.init_msg().value.error_ind().protocol_ies;
|
|
|
|
|
TESTASSERT(protocol_ies.mme_ue_s1ap_id_present and protocol_ies.mme_ue_s1ap_id.value.value == 2);
|
|
|
|
|
TESTASSERT(protocol_ies.enb_ue_s1ap_id_present and protocol_ies.enb_ue_s1ap_id.value.value == 1);
|
|
|
|
|
TESTASSERT(rrc.last_released_rnti == 0x46);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TESTASSERT(s1ap_pdu.type().value == asn1::s1ap::s1ap_pdu_c::types_opts::successful_outcome);
|
|
|
|
|
TESTASSERT(s1ap_pdu.successful_outcome().proc_code == ASN1_S1AP_ID_ERAB_MODIFY);
|
|
|
|
|
auto& protocol_ies = s1ap_pdu.successful_outcome().value.erab_modify_resp().protocol_ies;
|
|
|
|
@ -227,13 +244,13 @@ void test_s1ap_erab_setup(test_event event)
|
|
|
|
|
TESTASSERT(erab_item.cause.type().value == asn1::s1ap::cause_c::types_opts::radio_network);
|
|
|
|
|
TESTASSERT(erab_item.cause.radio_network().value == asn1::s1ap::cause_radio_network_opts::unknown_erab_id);
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TESTASSERT(protocol_ies.erab_modify_list_bearer_mod_res_present);
|
|
|
|
|
TESTASSERT(not protocol_ies.erab_failed_to_modify_list_present);
|
|
|
|
|
TESTASSERT(protocol_ies.erab_modify_list_bearer_mod_res.value.size() == 1);
|
|
|
|
|
TESTASSERT(protocol_ies.erab_modify_list_bearer_mod_res.value[0].value.erab_modify_item_bearer_mod_res().erab_id ==
|
|
|
|
|
5);
|
|
|
|
|
}
|
|
|
|
|
auto& erab_item = protocol_ies.erab_modify_list_bearer_mod_res.value[0].value.erab_modify_item_bearer_mod_res();
|
|
|
|
|
TESTASSERT(erab_item.erab_id == 5);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int main(int argc, char** argv)
|
|
|
|
@ -248,4 +265,5 @@ int main(int argc, char** argv)
|
|
|
|
|
|
|
|
|
|
test_s1ap_erab_setup(test_event::success);
|
|
|
|
|
test_s1ap_erab_setup(test_event::wrong_erabid_mod);
|
|
|
|
|
test_s1ap_erab_setup(test_event::wrong_mme_s1ap_id);
|
|
|
|
|
}
|