2019-04-27 14:54:30 +00:00
|
|
|
#include "core/abts.h"
|
|
|
|
|
2019-06-11 13:10:47 +00:00
|
|
|
#include "mme/s1ap-build.h"
|
|
|
|
#include "mme/s1ap-conv.h"
|
2019-04-27 14:54:30 +00:00
|
|
|
|
2019-06-11 05:12:31 +00:00
|
|
|
#include "test-packet.h"
|
2019-04-27 14:54:30 +00:00
|
|
|
|
|
|
|
#define NUM_OF_TEST_DUPLICATED_ENB 4
|
|
|
|
|
|
|
|
static void s1setup_test1(abts_case *tc, void *data)
|
|
|
|
{
|
|
|
|
int rv;
|
2019-05-31 01:18:43 +00:00
|
|
|
ogs_socknode_t *node[NUM_OF_TEST_DUPLICATED_ENB];
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_pkbuf_t *sendbuf;
|
|
|
|
ogs_pkbuf_t *recvbuf = NULL;
|
|
|
|
s1ap_message_t message;
|
|
|
|
int i;
|
|
|
|
|
2019-06-21 09:23:29 +00:00
|
|
|
for (i = 0; i < NUM_OF_TEST_DUPLICATED_ENB; i++) {
|
2019-05-31 01:18:43 +00:00
|
|
|
node[i] = testenb_s1ap_client("127.0.0.1");
|
|
|
|
ABTS_PTR_NOTNULL(tc, node[i]);
|
2019-04-27 14:54:30 +00:00
|
|
|
}
|
|
|
|
|
2019-06-21 09:23:29 +00:00
|
|
|
for (i = 0; i < NUM_OF_TEST_DUPLICATED_ENB; i++) {
|
2019-04-27 14:54:30 +00:00
|
|
|
rv = tests1ap_build_setup_req(
|
|
|
|
&sendbuf, S1AP_ENB_ID_PR_macroENB_ID, 0x54f64, 12345, 1, 1, 2);
|
|
|
|
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
|
|
|
|
2019-05-31 01:18:43 +00:00
|
|
|
rv = testenb_s1ap_send(node[i], sendbuf);
|
2019-04-27 14:54:30 +00:00
|
|
|
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
|
|
|
|
2019-05-31 01:18:43 +00:00
|
|
|
recvbuf = testenb_s1ap_read(node[i]);
|
2019-04-27 14:54:30 +00:00
|
|
|
ABTS_PTR_NOTNULL(tc, recvbuf);
|
|
|
|
|
|
|
|
rv = s1ap_decode_pdu(&message, recvbuf);
|
|
|
|
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
|
|
|
|
|
|
|
s1ap_free_pdu(&message);
|
|
|
|
ogs_pkbuf_free(recvbuf);
|
|
|
|
}
|
|
|
|
|
2019-06-21 09:23:29 +00:00
|
|
|
for (i = 0; i < NUM_OF_TEST_DUPLICATED_ENB; i++) {
|
2019-05-31 01:18:43 +00:00
|
|
|
testenb_s1ap_close(node[i]);
|
2019-04-27 14:54:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ogs_pkbuf_free(recvbuf);
|
|
|
|
}
|
|
|
|
|
|
|
|
#define NUM_OF_TEST_ENB 4
|
|
|
|
|
|
|
|
static void s1setup_test2(abts_case *tc, void *data)
|
|
|
|
{
|
|
|
|
int rv;
|
2019-05-31 01:18:43 +00:00
|
|
|
ogs_socknode_t *node[NUM_OF_TEST_ENB];
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_pkbuf_t *sendbuf;
|
|
|
|
ogs_pkbuf_t *recvbuf;
|
|
|
|
s1ap_message_t message;
|
|
|
|
int i;
|
|
|
|
|
2019-06-21 09:23:29 +00:00
|
|
|
for (i = 0; i < NUM_OF_TEST_ENB; i++) {
|
2019-05-31 01:18:43 +00:00
|
|
|
node[i] = testenb_s1ap_client("127.0.0.1");
|
|
|
|
ABTS_PTR_NOTNULL(tc, node[i]);
|
2019-04-27 14:54:30 +00:00
|
|
|
}
|
|
|
|
|
2019-06-21 09:23:29 +00:00
|
|
|
for (i = 0; i < NUM_OF_TEST_ENB; i++) {
|
2019-04-27 14:54:30 +00:00
|
|
|
rv = tests1ap_build_setup_req(
|
|
|
|
&sendbuf, S1AP_ENB_ID_PR_macroENB_ID, 0x54f64+i, 12345, 1, 1, 2);
|
|
|
|
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
|
|
|
|
2019-05-31 01:18:43 +00:00
|
|
|
rv = testenb_s1ap_send(node[i], sendbuf);
|
2019-04-27 14:54:30 +00:00
|
|
|
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
|
|
|
|
2019-05-31 01:18:43 +00:00
|
|
|
recvbuf = testenb_s1ap_read(node[i]);
|
2019-04-27 14:54:30 +00:00
|
|
|
ABTS_PTR_NOTNULL(tc, recvbuf);
|
|
|
|
|
|
|
|
rv = s1ap_decode_pdu(&message, recvbuf);
|
|
|
|
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
|
|
|
|
|
|
|
s1ap_free_pdu(&message);
|
|
|
|
ogs_pkbuf_free(recvbuf);
|
|
|
|
}
|
|
|
|
|
2019-06-21 09:23:29 +00:00
|
|
|
for (i = 0; i < NUM_OF_TEST_ENB; i++) {
|
2019-05-31 01:18:43 +00:00
|
|
|
testenb_s1ap_close(node[i]);
|
2019-04-27 14:54:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ogs_pkbuf_free(recvbuf);
|
|
|
|
}
|
|
|
|
|
2019-07-12 07:22:40 +00:00
|
|
|
static void s1setup_test3(abts_case *tc, void *data)
|
|
|
|
{
|
|
|
|
int rv;
|
|
|
|
ogs_socknode_t *s1ap;
|
|
|
|
ogs_pkbuf_t *sendbuf;
|
|
|
|
ogs_pkbuf_t *recvbuf;
|
|
|
|
|
|
|
|
s1ap = testenb_s1ap_client("127.0.0.1");
|
|
|
|
ABTS_PTR_NOTNULL(tc, s1ap);
|
|
|
|
|
|
|
|
rv = tests1ap_build_invalid_packet(&sendbuf, 0);
|
|
|
|
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
|
|
|
|
|
|
|
rv = testenb_s1ap_send(s1ap, sendbuf);
|
|
|
|
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
|
|
|
|
|
|
|
recvbuf = testenb_s1ap_read(s1ap);
|
|
|
|
ABTS_PTR_NOTNULL(tc, recvbuf);
|
|
|
|
ogs_pkbuf_free(recvbuf);
|
|
|
|
|
|
|
|
testenb_s1ap_close(s1ap);
|
|
|
|
}
|
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
abts_suite *test_s1setup(abts_suite *suite)
|
|
|
|
{
|
|
|
|
suite = ADD_SUITE(suite)
|
|
|
|
|
|
|
|
abts_run_test(suite, s1setup_test1, NULL);
|
|
|
|
abts_run_test(suite, s1setup_test2, NULL);
|
2019-07-12 07:22:40 +00:00
|
|
|
abts_run_test(suite, s1setup_test3, NULL);
|
2019-04-27 14:54:30 +00:00
|
|
|
|
|
|
|
return suite;
|
|
|
|
}
|