Add F1 Reset enc/dec/cp/eq/free library and test
This commit is contained in:
@@ -383,6 +383,70 @@ static void test_f1ap_setup_failure(void)
|
||||
AssertFatal(ret, "eq_f1ap_setup_failure(): copied message doesn't match\n");
|
||||
}
|
||||
|
||||
static void _test_f1ap_reset_msg(const f1ap_reset_t *orig)
|
||||
{
|
||||
F1AP_F1AP_PDU_t *f1enc = encode_f1ap_reset(orig);
|
||||
F1AP_F1AP_PDU_t *f1dec = f1ap_encode_decode(f1enc);
|
||||
f1ap_msg_free(f1enc);
|
||||
|
||||
f1ap_reset_t decoded = {0};
|
||||
bool ret = decode_f1ap_reset(f1dec, &decoded);
|
||||
AssertFatal(ret, "decode_f1ap_reset(): could not decode message\n");
|
||||
f1ap_msg_free(f1dec);
|
||||
|
||||
ret = eq_f1ap_reset(orig, &decoded);
|
||||
AssertFatal(ret, "eq_f1ap_reset(): decoded message doesn't match original\n");
|
||||
free_f1ap_reset(&decoded);
|
||||
|
||||
f1ap_reset_t cp = cp_f1ap_reset(orig);
|
||||
ret = eq_f1ap_reset(orig, &cp);
|
||||
AssertFatal(ret, "eq_f1ap_reset(): copied message doesn't match original\n");
|
||||
free_f1ap_reset(&cp);
|
||||
|
||||
printf("f1ap_reset successful\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Test F1AP Reset message where the entire F1 interface is reset
|
||||
*/
|
||||
static void test_f1ap_reset_all(void)
|
||||
{
|
||||
f1ap_reset_t orig = {
|
||||
.transaction_id = 2,
|
||||
.cause = F1AP_CAUSE_TRANSPORT,
|
||||
.cause_value = 3, /* no type -> whatever */
|
||||
.reset_type = F1AP_RESET_ALL,
|
||||
};
|
||||
_test_f1ap_reset_msg(&orig);
|
||||
free_f1ap_reset(&orig);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Test F1AP Reset message where only some UEs are marked to reset
|
||||
*/
|
||||
static void test_f1ap_reset_part(void)
|
||||
{
|
||||
f1ap_reset_t orig = {
|
||||
.transaction_id = 3,
|
||||
.cause = F1AP_CAUSE_MISC,
|
||||
.cause_value = 3, /* no type -> whatever */
|
||||
.reset_type = F1AP_RESET_PART_OF_F1_INTERFACE,
|
||||
.num_ue_to_reset = 4,
|
||||
};
|
||||
orig.ue_to_reset = calloc_or_fail(orig.num_ue_to_reset, sizeof(*orig.ue_to_reset));
|
||||
orig.ue_to_reset[0].gNB_CU_ue_id = malloc_or_fail(sizeof(*orig.ue_to_reset[0].gNB_CU_ue_id));
|
||||
*orig.ue_to_reset[0].gNB_CU_ue_id = 10;
|
||||
orig.ue_to_reset[1].gNB_DU_ue_id = malloc_or_fail(sizeof(*orig.ue_to_reset[1].gNB_DU_ue_id));
|
||||
*orig.ue_to_reset[1].gNB_DU_ue_id = 11;
|
||||
orig.ue_to_reset[2].gNB_CU_ue_id = malloc_or_fail(sizeof(*orig.ue_to_reset[2].gNB_CU_ue_id));
|
||||
*orig.ue_to_reset[2].gNB_CU_ue_id = 12;
|
||||
orig.ue_to_reset[2].gNB_DU_ue_id = malloc_or_fail(sizeof(*orig.ue_to_reset[2].gNB_DU_ue_id));
|
||||
*orig.ue_to_reset[2].gNB_DU_ue_id = 13;
|
||||
// orig.ue_to_reset[3] intentionally empty (because it is allowed, both IDs are optional)
|
||||
_test_f1ap_reset_msg(&orig);
|
||||
free_f1ap_reset(&orig);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Test F1 gNB-DU Configuration Update
|
||||
*/
|
||||
@@ -605,6 +669,8 @@ int main()
|
||||
test_f1ap_setup_request();
|
||||
test_f1ap_setup_response();
|
||||
test_f1ap_setup_failure();
|
||||
test_f1ap_reset_all();
|
||||
test_f1ap_reset_part();
|
||||
test_f1ap_du_configuration_update();
|
||||
test_f1ap_cu_configuration_update();
|
||||
test_f1ap_cu_configuration_update_acknowledge();
|
||||
|
||||
Reference in New Issue
Block a user