2017-03-05 07:49:57 +00:00
|
|
|
#include "core_debug.h"
|
|
|
|
#include "core_pkbuf.h"
|
|
|
|
|
|
|
|
#include "s1ap_message.h"
|
|
|
|
|
|
|
|
#include "testutil.h"
|
|
|
|
#include "tests1ap.h"
|
|
|
|
|
|
|
|
static void nas_sm_test1(abts_case *tc, void *data)
|
|
|
|
{
|
|
|
|
status_t rv;
|
|
|
|
net_sock_t *sock;
|
|
|
|
pkbuf_t *sendbuf;
|
|
|
|
pkbuf_t *recvbuf;
|
2017-03-06 00:07:59 +00:00
|
|
|
s1ap_message_t message;
|
2017-03-05 07:49:57 +00:00
|
|
|
int rc;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/* eNB connects to MME */
|
|
|
|
sock = tests1ap_enb_connect();
|
|
|
|
ABTS_PTR_NOTNULL(tc, sock);
|
|
|
|
|
|
|
|
/* Send S1-Setup Reqeust */
|
|
|
|
rv = tests1ap_build_setup_req(&sendbuf, 0x54f64);
|
|
|
|
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
|
|
|
rv = tests1ap_enb_send(sock, sendbuf);
|
|
|
|
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
|
|
|
pkbuf_free(sendbuf);
|
|
|
|
|
|
|
|
/* Receive S1-Setup Response */
|
2017-03-05 14:36:17 +00:00
|
|
|
recvbuf = pkbuf_alloc(0, MESSAGE_SDU_SIZE);
|
2017-03-05 07:49:57 +00:00
|
|
|
rc = tests1ap_enb_read(sock, recvbuf);
|
|
|
|
ABTS_INT_NEQUAL(tc, 0, rc);
|
|
|
|
rv = s1ap_decode_pdu(&message, recvbuf);
|
|
|
|
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
|
|
|
s1ap_free_pdu(&message);
|
|
|
|
pkbuf_free(recvbuf);
|
|
|
|
|
|
|
|
/* Send Initial-UE Message */
|
|
|
|
rv = tests1ap_build_initial_ue_msg(&sendbuf);
|
|
|
|
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
|
|
|
rv = tests1ap_enb_send(sock, sendbuf);
|
|
|
|
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
|
|
|
pkbuf_free(sendbuf);
|
|
|
|
|
|
|
|
/* Receive XXXX */
|
|
|
|
#if 0
|
2017-03-05 14:36:17 +00:00
|
|
|
recvbuf = pkbuf_alloc(0, MESSAGE_SDU_SIZE);
|
2017-03-05 07:49:57 +00:00
|
|
|
rc = tests1ap_enb_read(sock, recvbuf);
|
|
|
|
ABTS_INT_NEQUAL(tc, 0, rc);
|
|
|
|
rv = s1ap_decode_pdu(&message, recvbuf);
|
|
|
|
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
|
|
|
s1ap_free_pdu(&message);
|
|
|
|
pkbuf_free(recvbuf);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* eNB disonncect from MME */
|
|
|
|
rv = tests1ap_enb_close(sock);
|
|
|
|
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
|
|
|
|
|
|
|
core_sleep(time_from_msec(300));
|
|
|
|
}
|
|
|
|
|
|
|
|
abts_suite *test_nas_sm(abts_suite *suite)
|
|
|
|
{
|
|
|
|
suite = ADD_SUITE(suite)
|
|
|
|
|
|
|
|
d_log_set_level(D_MSG_TO_STDOUT, D_LOG_LEVEL_FULL);
|
|
|
|
|
|
|
|
abts_run_test(suite, nas_sm_test1, NULL);
|
|
|
|
|
|
|
|
return suite;
|
|
|
|
}
|