From 463e40d41b4b918fd6dd061251be15a8a6724198 Mon Sep 17 00:00:00 2001 From: Sukchan Lee Date: Thu, 15 Mar 2018 17:22:45 +0900 Subject: [PATCH] test initial context setup failure and handover failure --- test/basic/attach_test.c | 7 ++++++ test/basic/handover_test.c | 8 ++++++ test/common/testpacket.c | 50 ++++++++++++++++++++++++++++++++++++++ test/common/testpacket.h | 3 +++ 4 files changed, 68 insertions(+) diff --git a/test/basic/attach_test.c b/test/basic/attach_test.c index 5b1aeaa63b..5b6469767a 100644 --- a/test/basic/attach_test.c +++ b/test/basic/attach_test.c @@ -247,6 +247,13 @@ static void attach_test1(abts_case *tc, void *data) ABTS_TRUE(tc, memcmp(recvbuf->payload+32, tmp+32, 20) == 0); pkbuf_free(recvbuf); +#if TEST_INITIAL_CONTEXT_SETUP_FAILURE + /* Send Initial Context Setup Failure */ + rv = tests1ap_build_initial_context_setup_failure(&sendbuf, msgindex); + ABTS_INT_EQUAL(tc, CORE_OK, rv); + rv = tests1ap_enb_send(sock, sendbuf); + ABTS_INT_EQUAL(tc, CORE_OK, rv); +#endif core_sleep(time_from_msec(300)); rv = testgtpu_build_slacc_rs(&sendbuf, 0); diff --git a/test/basic/handover_test.c b/test/basic/handover_test.c index b6a23434ef..a8dc792c1b 100644 --- a/test/basic/handover_test.c +++ b/test/basic/handover_test.c @@ -637,6 +637,14 @@ static void handover_test2(abts_case *tc, void *data) ABTS_INT_EQUAL(tc, CORE_OK, rv); pkbuf_free(recvbuf); +#if TEST_HANDOVER_FAILURE + /* Send Handover Failure */ + rv = tests1ap_build_handover_failure(&sendbuf, 0); + ABTS_INT_EQUAL(tc, CORE_OK, rv); + rv = tests1ap_enb_send(sock1, sendbuf); + ABTS_INT_EQUAL(tc, CORE_OK, rv); +#endif + /* Send Handover Request Ack */ rv = tests1ap_build_handover_request_ack(&sendbuf, 1, 33554629, 8, 2, 5, 1); ABTS_INT_EQUAL(tc, CORE_OK, rv); diff --git a/test/common/testpacket.c b/test/common/testpacket.c index bb4d4c6485..78dcba4504 100644 --- a/test/common/testpacket.c +++ b/test/common/testpacket.c @@ -835,6 +835,31 @@ status_t tests1ap_build_initial_context_setup_response( return CORE_OK; } +status_t tests1ap_build_initial_context_setup_failure(pkbuf_t **pkbuf, int i) +{ + char *payload[TESTS1AP_MAX_MESSAGE] = { + "4009 0015000003000040 0200020008400200 01000240020000", + + "", + "", + }; + c_uint16_t len[TESTS1AP_MAX_MESSAGE] = { + 25, + 0, + 0, + }; + char hexbuf[MAX_SDU_LEN]; + + *pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); + if (!(*pkbuf)) return CORE_ERROR; + + (*pkbuf)->len = len[i]; + memcpy((*pkbuf)->payload, CORE_HEX(payload[i], strlen(payload[i]), hexbuf), + (*pkbuf)->len); + + return CORE_OK; +} + status_t tests1ap_build_attach_complete(pkbuf_t **pkbuf, int i) { char *payload[TESTS1AP_MAX_MESSAGE] = { @@ -1949,6 +1974,31 @@ status_t tests1ap_build_handover_required( return CORE_OK; } +status_t tests1ap_build_handover_failure(pkbuf_t **pkbuf, int i) +{ + char *payload[TESTS1AP_MAX_MESSAGE] = { + "4001 0012000002000040 05c0020000c5 000240020000", + + "", + "", + }; + c_uint16_t len[TESTS1AP_MAX_MESSAGE] = { + 22, + 0, + 0, + }; + char hexbuf[MAX_SDU_LEN]; + + *pkbuf = pkbuf_alloc(0, MAX_SDU_LEN); + if (!(*pkbuf)) return CORE_ERROR; + + (*pkbuf)->len = len[i]; + memcpy((*pkbuf)->payload, CORE_HEX(payload[i], strlen(payload[i]), hexbuf), + (*pkbuf)->len); + + return CORE_OK; +} + CORE_DECLARE(status_t) tests1ap_build_handover_request_ack( pkbuf_t **pkbuf, int target, c_uint32_t mme_ue_s1ap_id, c_uint32_t enb_ue_s1ap_id, diff --git a/test/common/testpacket.h b/test/common/testpacket.h index a7b50de8a8..fe33580226 100644 --- a/test/common/testpacket.h +++ b/test/common/testpacket.h @@ -36,6 +36,8 @@ CORE_DECLARE(status_t) tests1ap_build_initial_context_setup_response( pkbuf_t **pkbuf, c_uint32_t mme_ue_s1ap_id, c_uint32_t enb_ue_s1ap_id, c_uint8_t ebi, c_uint32_t teid); +CORE_DECLARE(status_t) tests1ap_build_initial_context_setup_failure( + pkbuf_t **pkbuf, int i); CORE_DECLARE(status_t) tests1ap_build_attach_complete(pkbuf_t **pkbuf, int i); CORE_DECLARE(status_t) tests1ap_build_emm_status(pkbuf_t **pkbuf, int i); CORE_DECLARE(status_t) tests1ap_build_detach_request(pkbuf_t **pkbuf, int i); @@ -74,6 +76,7 @@ CORE_DECLARE(status_t) tests1ap_build_path_switch_request( c_uint32_t mme_ue_s1ap_id, c_uint32_t enb_ue_s1ap_id, int num_of_bearer, c_uint8_t ebi, c_uint32_t teid); CORE_DECLARE(status_t) tests1ap_build_handover_required(pkbuf_t **pkbuf, int i); +CORE_DECLARE(status_t) tests1ap_build_handover_failure(pkbuf_t **pkbuf, int i); CORE_DECLARE(status_t) tests1ap_build_handover_request_ack( pkbuf_t **pkbuf, int target, c_uint32_t mme_ue_s1ap_id, c_uint32_t enb_ue_s1ap_id,