From fdebe90f7c4bcb2bdaced19efdfba89e942b216c Mon Sep 17 00:00:00 2001 From: Sukchan Lee Date: Mon, 18 Dec 2017 17:10:44 +0900 Subject: [PATCH] test scenario is added for debug re-synch failure --- test/attach_test.c | 72 ++++++++++++++++++++++++++++++++++++++++++++-- test/testpacket.c | 7 +++-- 2 files changed, 73 insertions(+), 6 deletions(-) diff --git a/test/attach_test.c b/test/attach_test.c index 874561216..d346e38dc 100644 --- a/test/attach_test.c +++ b/test/attach_test.c @@ -460,6 +460,46 @@ static void attach_test2(abts_case *tc, void *data) "}, " "\"__v\" : 0 " "}"; + const char *json2 = + "{" + "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c7\" }, " + "\"imsi\" : \"001010000000002\", " + "\"pdn\" : [" + "{" + "\"apn\" : \"internet\", " + "\"_id\" : { \"$oid\" : \"597223158b8861d7605378c8\" }, " + "\"ambr\" : {" + "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " + "\"downlink\" : { \"$numberLong\" : \"1024000\" } " + "}," + "\"qos\" : { " + "\"qci\" : 9, " + "\"arp\" : { " + "\"priority_level\" : 8," + "\"pre_emption_vulnerability\" : 1, " + "\"pre_emption_capability\" : 1" + "} " + "}, " + "\"type\" : 2" + "}" + "]," + "\"ambr\" : { " + "\"uplink\" : { \"$numberLong\" : \"1024000\" }, " + "\"downlink\" : { \"$numberLong\" : \"1024000\" } " + "}," + "\"subscribed_rau_tau_timer\" : 12," + "\"network_access_mode\" : 2, " + "\"subscriber_status\" : 0, " + "\"access_restriction_data\" : 32, " + "\"security\" : { " + "\"k\" : \"00112233 44556677 8899AABB CCDDEEFF\", " + "\"opc\" : \"00010203 04050607 08090A0B 0C0D0E0F\", " + "\"amf\" : \"9001\", " + "\"sqn\" : { \"$numberLong\" : \"96\" }, " + "\"rand\" : \"1c92dd6e dcd676e8 7b590ba2 20c1874e\" " + "}, " + "\"__v\" : 0 " + "}"; c_uint8_t tmp[MAX_SDU_LEN]; @@ -485,15 +525,15 @@ static void attach_test2(abts_case *tc, void *data) s1ap_free_pdu(&message); pkbuf_free(recvbuf); - doc = bson_new_from_json((const uint8_t *)json, -1, &error);; - ABTS_PTR_NOTNULL(tc, doc); - collection = mongoc_client_get_collection( context_self()->db_client, context_self()->db_name, "subscribers"); ABTS_PTR_NOTNULL(tc, collection); /********** Insert Subscriber in Database */ + doc = bson_new_from_json((const uint8_t *)json, -1, &error);; + ABTS_PTR_NOTNULL(tc, doc); + ABTS_TRUE(tc, mongoc_collection_insert(collection, MONGOC_INSERT_NONE, doc, NULL, &error)); bson_destroy(doc); @@ -507,6 +547,22 @@ static void attach_test2(abts_case *tc, void *data) } while (count == 0); bson_destroy(doc); + doc = bson_new_from_json((const uint8_t *)json2, -1, &error);; + ABTS_PTR_NOTNULL(tc, doc); + + ABTS_TRUE(tc, mongoc_collection_insert(collection, + MONGOC_INSERT_NONE, doc, NULL, &error)); + bson_destroy(doc); + + doc = BCON_NEW("imsi", BCON_UTF8("001010000000002")); + ABTS_PTR_NOTNULL(tc, doc); + do + { + count = mongoc_collection_count ( + collection, MONGOC_QUERY_NONE, doc, 0, 0, NULL, &error); + } while (count == 0); + bson_destroy(doc); + /***************************************************************** * Attach Request : Known IMSI, Plain NAS message * Send Initial-UE Message + Attach Request + PDN Connectivity */ @@ -661,6 +717,12 @@ static void attach_test2(abts_case *tc, void *data) MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) bson_destroy(doc); + doc = BCON_NEW("imsi", BCON_UTF8("001010000000002")); + ABTS_PTR_NOTNULL(tc, doc); + ABTS_TRUE(tc, mongoc_collection_remove(collection, + MONGOC_REMOVE_SINGLE_REMOVE, doc, NULL, &error)) + bson_destroy(doc); + mongoc_collection_destroy(collection); /* eNB disonncect from MME */ @@ -972,9 +1034,13 @@ abts_suite *test_attach(abts_suite *suite) { suite = ADD_SUITE(suite) +#if 0 abts_run_test(suite, attach_test1, NULL); +#endif abts_run_test(suite, attach_test2, NULL); +#if 0 abts_run_test(suite, attach_test3, NULL); +#endif return suite; } diff --git a/test/testpacket.c b/test/testpacket.c index d0ba80001..f5b1e7230 100644 --- a/test/testpacket.c +++ b/test/testpacket.c @@ -176,7 +176,7 @@ status_t tests1ap_build_initial_ue_msg(pkbuf_t **pkbuf, int i) "0000f11030390064 40080000f1109d67 aa500086400130", "000c405300000500 080003002100001a 002a2917bcba67c4 8207410108091010" - "103254866205f0f0 000000000e023cd0 11d1270780000a00 000d00c100430006" + "000000002005f0f0 000000000e023cd0 11d1270780000a00 000d00c100430006" "0000f11030390064 40080000f1109d67 aa500086400130", @@ -341,6 +341,7 @@ status_t tests1ap_build_authentication_response(pkbuf_t **pkbuf, int i) return CORE_OK; } + status_t tests1ap_build_authentication_failure(pkbuf_t **pkbuf, int i) { char *payload[TESTS1AP_MAX_MESSAGE] = { @@ -351,8 +352,8 @@ status_t tests1ap_build_authentication_failure(pkbuf_t **pkbuf, int i) "", "", "000d" - "403d000005000000 0200030008000200 21001a001413075c 15300e9a73df7ef8" - "05f893f312a930a9 8f006440080000f1 100019b010004340 060000f1100001", + "403d000005000000 0200030008000200 21001a001413075c 15300e 61640edcfb" + "605d25911423ee1f 9e006440080000f1 100019b010004340 060000f1100001", "", "",