mirror of
https://github.com/open5gs/open5gs.git
synced 2025-11-02 13:03:31 +00:00
feat: E-RABModificationIndication/Confirm (#834)
This commit is contained in:
@@ -23,7 +23,7 @@ static void test1_func(abts_case *tc, void *data)
|
||||
{
|
||||
int rv;
|
||||
ogs_socknode_t *s1ap;
|
||||
ogs_socknode_t *gtpu;
|
||||
ogs_socknode_t *gtpu1, *gtpu2;
|
||||
ogs_pkbuf_t *emmbuf;
|
||||
ogs_pkbuf_t *esmbuf;
|
||||
ogs_pkbuf_t *sendbuf;
|
||||
@@ -71,9 +71,12 @@ static void test1_func(abts_case *tc, void *data)
|
||||
s1ap = tests1ap_client(AF_INET);
|
||||
ABTS_PTR_NOTNULL(tc, s1ap);
|
||||
|
||||
/* eNB connects to SGW */
|
||||
gtpu = test_gtpu_server(1, AF_INET);
|
||||
ABTS_PTR_NOTNULL(tc, gtpu);
|
||||
/* Two eNB connects to SGW */
|
||||
gtpu1 = test_gtpu_server(1, AF_INET);
|
||||
ABTS_PTR_NOTNULL(tc, gtpu1);
|
||||
|
||||
gtpu2 = test_gtpu_server(2, AF_INET);
|
||||
ABTS_PTR_NOTNULL(tc, gtpu2);
|
||||
|
||||
/* Send S1-Setup Reqeust */
|
||||
sendbuf = test_s1ap_build_s1_setup_request(
|
||||
@@ -99,6 +102,7 @@ static void test1_func(abts_case *tc, void *data)
|
||||
ABTS_PTR_NOTNULL(tc, esmbuf);
|
||||
|
||||
test_ue->attach_request_param.ms_network_feature_support = 1;
|
||||
test_ue->attach_request_param.ue_additional_security_capability = 1;
|
||||
emmbuf = testemm_build_attach_request(test_ue, esmbuf);
|
||||
ABTS_PTR_NOTNULL(tc, emmbuf);
|
||||
|
||||
@@ -189,11 +193,38 @@ static void test1_func(abts_case *tc, void *data)
|
||||
/* Send GTP-U ICMP Packet */
|
||||
bearer = test_bearer_find_by_ue_ebi(test_ue, 5);
|
||||
ogs_assert(bearer);
|
||||
rv = test_gtpu_send_ping(gtpu, bearer, TEST_PING_IPV4);
|
||||
rv = test_gtpu_send_ping(gtpu1, bearer, TEST_PING_IPV4);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
/* Receive GTP-U ICMP Packet */
|
||||
recvbuf = test_gtpu_read(gtpu);
|
||||
recvbuf = test_gtpu_read(gtpu1);
|
||||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
ogs_pkbuf_free(recvbuf);
|
||||
|
||||
/* Send E-RABModificationIndication */
|
||||
ogs_list_for_each(&sess->bearer_list, bearer) {
|
||||
bearer->enb_s1u_addr = test_self()->gnb2_addr;
|
||||
bearer->enb_s1u_addr6 = test_self()->gnb2_addr6;
|
||||
}
|
||||
|
||||
sendbuf = test_s1ap_build_e_rab_modification_indication(test_ue);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testenb_s1ap_send(s1ap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
/* Receive E-RABModificationConfirm */
|
||||
recvbuf = testenb_s1ap_read(s1ap);
|
||||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
tests1ap_recv(test_ue, recvbuf);
|
||||
|
||||
/* Send GTP-U ICMP Packet */
|
||||
bearer = test_bearer_find_by_ue_ebi(test_ue, 5);
|
||||
ogs_assert(bearer);
|
||||
rv = test_gtpu_send_ping(gtpu2, bearer, TEST_PING_IPV4);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
/* Receive GTP-U ICMP Packet */
|
||||
recvbuf = test_gtpu_read(gtpu2);
|
||||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
ogs_pkbuf_free(recvbuf);
|
||||
|
||||
@@ -203,8 +234,9 @@ static void test1_func(abts_case *tc, void *data)
|
||||
/* eNB disonncect from MME */
|
||||
testenb_s1ap_close(s1ap);
|
||||
|
||||
/* eNB disonncect from SGW */
|
||||
test_gtpu_close(gtpu);
|
||||
/* Two eNB disonncect from SGW */
|
||||
testgnb_gtpu_close(gtpu1);
|
||||
testgnb_gtpu_close(gtpu2);
|
||||
|
||||
test_ue_remove(test_ue);
|
||||
}
|
||||
|
||||
@@ -811,7 +811,6 @@ ogs_pkbuf_t *test_s1ap_build_ue_context_release_complete(test_ue_t *test_ue)
|
||||
ogs_pkbuf_t *test_s1ap_build_e_rab_setup_response(test_bearer_t *bearer)
|
||||
{
|
||||
int rv;
|
||||
ogs_sockaddr_t *addr = NULL;
|
||||
|
||||
test_ue_t *test_ue = NULL;
|
||||
test_sess_t *sess = NULL;
|
||||
@@ -911,7 +910,6 @@ ogs_pkbuf_t *test_s1ap_build_e_rab_setup_response(test_bearer_t *bearer)
|
||||
ogs_pkbuf_t *test_s1ap_build_e_rab_modify_response(test_bearer_t *bearer)
|
||||
{
|
||||
int rv;
|
||||
ogs_sockaddr_t *addr = NULL;
|
||||
|
||||
test_ue_t *test_ue = NULL;
|
||||
test_sess_t *sess = NULL;
|
||||
@@ -995,7 +993,6 @@ ogs_pkbuf_t *test_s1ap_build_e_rab_modify_response(test_bearer_t *bearer)
|
||||
ogs_pkbuf_t *test_s1ap_build_e_rab_release_response(test_bearer_t *bearer)
|
||||
{
|
||||
int rv;
|
||||
ogs_sockaddr_t *addr = NULL;
|
||||
|
||||
test_ue_t *test_ue = NULL;
|
||||
test_sess_t *sess = NULL;
|
||||
@@ -1079,6 +1076,107 @@ ogs_pkbuf_t *test_s1ap_build_e_rab_release_response(test_bearer_t *bearer)
|
||||
return ogs_s1ap_encode(&pdu);
|
||||
}
|
||||
|
||||
ogs_pkbuf_t *test_s1ap_build_e_rab_modification_indication(test_ue_t *test_ue)
|
||||
{
|
||||
int rv;
|
||||
|
||||
test_sess_t *sess = NULL;
|
||||
test_bearer_t *bearer = NULL;
|
||||
|
||||
S1AP_S1AP_PDU_t pdu;
|
||||
S1AP_InitiatingMessage_t *initiatingMessage = NULL;
|
||||
S1AP_E_RABModificationIndication_t *E_RABModificationIndication = NULL;
|
||||
|
||||
S1AP_E_RABModificationIndicationIEs_t *ie = NULL;
|
||||
S1AP_ENB_UE_S1AP_ID_t *ENB_UE_S1AP_ID = NULL;
|
||||
S1AP_MME_UE_S1AP_ID_t *MME_UE_S1AP_ID = NULL;
|
||||
S1AP_E_RABToBeModifiedListBearerModInd_t
|
||||
*E_RABToBeModifiedListBearerModInd = NULL;
|
||||
|
||||
memset(&pdu, 0, sizeof (S1AP_S1AP_PDU_t));
|
||||
pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage;
|
||||
pdu.choice.initiatingMessage = CALLOC(1, sizeof(S1AP_InitiatingMessage_t));
|
||||
|
||||
initiatingMessage = pdu.choice.initiatingMessage;
|
||||
initiatingMessage->procedureCode =
|
||||
S1AP_ProcedureCode_id_E_RABModificationIndication;
|
||||
initiatingMessage->criticality = S1AP_Criticality_reject;
|
||||
initiatingMessage->value.present =
|
||||
S1AP_InitiatingMessage__value_PR_E_RABModificationIndication;
|
||||
|
||||
E_RABModificationIndication =
|
||||
&initiatingMessage->value.choice.E_RABModificationIndication;
|
||||
|
||||
ie = CALLOC(1, sizeof(S1AP_E_RABModificationIndicationIEs_t));
|
||||
ASN_SEQUENCE_ADD(&E_RABModificationIndication->protocolIEs, ie);
|
||||
|
||||
ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID;
|
||||
ie->criticality = S1AP_Criticality_reject;
|
||||
ie->value.present =
|
||||
S1AP_E_RABModificationIndicationIEs__value_PR_MME_UE_S1AP_ID;
|
||||
MME_UE_S1AP_ID = &ie->value.choice.MME_UE_S1AP_ID;
|
||||
|
||||
ie = CALLOC(1, sizeof(S1AP_E_RABModificationIndicationIEs_t));
|
||||
ASN_SEQUENCE_ADD(&E_RABModificationIndication->protocolIEs, ie);
|
||||
|
||||
ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID;
|
||||
ie->criticality = S1AP_Criticality_reject;
|
||||
ie->value.present =
|
||||
S1AP_E_RABModificationIndicationIEs__value_PR_ENB_UE_S1AP_ID;
|
||||
|
||||
ENB_UE_S1AP_ID = &ie->value.choice.ENB_UE_S1AP_ID;
|
||||
|
||||
ie = CALLOC(1, sizeof(S1AP_E_RABModificationIndicationIEs_t));
|
||||
ASN_SEQUENCE_ADD(&E_RABModificationIndication->protocolIEs, ie);
|
||||
|
||||
ie->id = S1AP_ProtocolIE_ID_id_E_RABToBeModifiedListBearerModInd;
|
||||
ie->criticality = S1AP_Criticality_reject;
|
||||
ie->value.present = S1AP_E_RABModificationIndicationIEs__value_PR_E_RABToBeModifiedListBearerModInd;
|
||||
|
||||
E_RABToBeModifiedListBearerModInd =
|
||||
&ie->value.choice.E_RABToBeModifiedListBearerModInd;
|
||||
|
||||
*ENB_UE_S1AP_ID = test_ue->enb_ue_s1ap_id;
|
||||
*MME_UE_S1AP_ID = test_ue->mme_ue_s1ap_id;
|
||||
|
||||
ogs_list_for_each(&test_ue->sess_list, sess) {
|
||||
ogs_list_for_each(&sess->bearer_list, bearer) {
|
||||
S1AP_E_RABToBeModifiedItemBearerModIndIEs_t *item = NULL;
|
||||
S1AP_E_RABToBeModifiedItemBearerModInd_t *e_rab = NULL;
|
||||
|
||||
ogs_gtp_f_teid_t f_teid;
|
||||
ogs_ip_t ip;
|
||||
int len;
|
||||
|
||||
item = CALLOC(1,
|
||||
sizeof(S1AP_E_RABToBeModifiedItemBearerModIndIEs_t));
|
||||
ASN_SEQUENCE_ADD(&E_RABToBeModifiedListBearerModInd->list, item);
|
||||
|
||||
item->id = S1AP_ProtocolIE_ID_id_E_RABToBeModifiedItemBearerModInd;
|
||||
item->criticality = S1AP_Criticality_reject;
|
||||
item->value.present = S1AP_E_RABToBeModifiedItemBearerModIndIEs__value_PR_E_RABToBeModifiedItemBearerModInd;
|
||||
|
||||
e_rab = &item->value.choice.E_RABToBeModifiedItemBearerModInd;
|
||||
|
||||
e_rab->e_RAB_ID = bearer->ebi;
|
||||
|
||||
rv = ogs_gtp_sockaddr_to_f_teid(
|
||||
bearer->enb_s1u_addr, bearer->enb_s1u_addr6, &f_teid, &len);
|
||||
ogs_assert(rv == OGS_OK);
|
||||
|
||||
rv = ogs_gtp_f_teid_to_ip(&f_teid, &ip);
|
||||
ogs_assert(rv == OGS_OK);
|
||||
|
||||
rv = ogs_asn_ip_to_BIT_STRING(&ip, &e_rab->transportLayerAddress);
|
||||
ogs_assert(rv == OGS_OK);
|
||||
ogs_asn_uint32_to_OCTET_STRING(
|
||||
bearer->enb_s1u_teid, &e_rab->dL_GTP_TEID);
|
||||
}
|
||||
}
|
||||
|
||||
return ogs_s1ap_encode(&pdu);
|
||||
}
|
||||
|
||||
ogs_pkbuf_t *test_s1ap_build_path_switch_request(test_ue_t *test_ue)
|
||||
{
|
||||
int rv;
|
||||
@@ -1174,7 +1272,6 @@ ogs_pkbuf_t *test_s1ap_build_path_switch_request(test_ue_t *test_ue)
|
||||
S1AP_E_RABToBeSwitchedDLItemIEs_t *item = NULL;
|
||||
S1AP_E_RABToBeSwitchedDLItem_t *e_rab = NULL;
|
||||
|
||||
ogs_sockaddr_t *addr = NULL;
|
||||
ogs_gtp_f_teid_t f_teid;
|
||||
ogs_ip_t ip;
|
||||
int len;
|
||||
|
||||
@@ -47,6 +47,8 @@ ogs_pkbuf_t *test_s1ap_build_e_rab_setup_response(test_bearer_t *bearer);
|
||||
ogs_pkbuf_t *test_s1ap_build_e_rab_modify_response(test_bearer_t *bearer);
|
||||
ogs_pkbuf_t *test_s1ap_build_e_rab_release_response(test_bearer_t *bearer);
|
||||
|
||||
ogs_pkbuf_t *test_s1ap_build_e_rab_modification_indication(test_ue_t *test_ue);
|
||||
|
||||
ogs_pkbuf_t *test_s1ap_build_path_switch_request(test_ue_t *test_ue);
|
||||
|
||||
ogs_pkbuf_t *test_s1ap_build_handover_required(
|
||||
|
||||
@@ -106,6 +106,8 @@ void tests1ap_recv(test_ue_t *test_ue, ogs_pkbuf_t *pkbuf)
|
||||
break;
|
||||
case S1AP_ProcedureCode_id_Reset:
|
||||
break;
|
||||
case S1AP_ProcedureCode_id_E_RABModificationIndication:
|
||||
break;
|
||||
default:
|
||||
ogs_error("Not implemented(choice:%d, proc:%d)",
|
||||
pdu->present, (int)successfulOutcome->procedureCode);
|
||||
|
||||
Reference in New Issue
Block a user