From e9213f807dd270232645402bc79a1a33bef8f767 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Wed, 7 Mar 2018 12:17:49 +0000 Subject: [PATCH] Starting to change SPGW to handle release access bearers request. Changing MME GTPC entity to contain an IMSI to sgw_ctr_fteid and ctr_teid to IMSI maps. --- srsepc/hdr/mme/mme_gtpc.h | 3 ++- srsepc/hdr/mme/s1ap_common.h | 4 ++-- srsepc/src/mme/mme_gtpc.cc | 27 +++++++++++++++++++++++++++ srsepc/src/mme/s1ap_nas_transport.cc | 2 +- 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/srsepc/hdr/mme/mme_gtpc.h b/srsepc/hdr/mme/mme_gtpc.h index 8909e89e2..c1656afaf 100644 --- a/srsepc/hdr/mme/mme_gtpc.h +++ b/srsepc/hdr/mme/mme_gtpc.h @@ -68,7 +68,8 @@ private: in_addr_t m_mme_gtpc_ip; uint32_t m_next_ctrl_teid; - std::map m_teid_to_mme_s1ap_id; + std::map m_ctr_teid_to_imsi; + std::map m_imsi_to_ctr_fteid; }; diff --git a/srsepc/hdr/mme/s1ap_common.h b/srsepc/hdr/mme/s1ap_common.h index 1b5b0ea54..15f4e3c6d 100644 --- a/srsepc/hdr/mme/s1ap_common.h +++ b/srsepc/hdr/mme/s1ap_common.h @@ -127,7 +127,6 @@ typedef struct{ enum erab_state state; uint8_t erab_id; srslte::gtpc_f_teid_ie enb_fteid; - srslte::gtpc_f_teid_ie sgw_ctrl_fteid; srslte::gtpc_f_teid_ie sgw_s1u_fteid; srslte::gtpc_pdn_address_allocation_ie pdn_addr_alloc; } erab_ctx_t; @@ -148,8 +147,9 @@ typedef struct{ uint32_t mme_ue_s1ap_id; struct sctp_sndrcvinfo enb_sri; ecm_state_t ecm_state; + srslte::gtpc_f_teid_ie sgw_ctrl_fteid; + erab_ctx_t erabs_ctx[MAX_ERABS_PER_UE]; bool eit; - erab_ctx_t erabs_ctx[MAX_ERABS_PER_UE]; } ue_ecm_ctx_t; diff --git a/srsepc/src/mme/mme_gtpc.cc b/srsepc/src/mme/mme_gtpc.cc index 70769c9ef..19bb0f96d 100644 --- a/srsepc/src/mme/mme_gtpc.cc +++ b/srsepc/src/mme/mme_gtpc.cc @@ -298,4 +298,31 @@ mme_gtpc::send_delete_session_request(ue_ecm_ctx_t *ue_ecm_ctx) //TODO Handle delete session response return; } + +void +mme_gtpc::send_release_access_bearers_request(ue_ecm_ctx_t *ecm_ctx) +{ + m_mme_gtpc_log->info("Sending GTP-C Delete Access Bearers Request\n"); + srslte::gtpc_pdu rel_req_pdu; + if(ecm_ctx->state != ECM_ ) + { + + } + srslte::gtpc_f_teid_ie *sgw_ctrl_fteid = NULL; + + srslte::gtpc_header *header = &rel_req_pdu.header; + header->teid_present = true; + header->teid = sgw_ctrl_fteid->teid; + header->type = srslte::GTPC_MSG_TYPE_RELEASE_ACCESS_BEARERS_REQUEST; + + srslte::gtpc_release_access_bearers_request *rel_req = &rel_req_pdu.choice.release_access_bearers_request; + del_req->cause.cause_value = srslte::GTPC_CAUSE_VALUE_ISR_DEACTIVATION; + m_mme_gtpc_log->info("GTP-C Release Access Berarers Request -- S-GW Control TEID %d\n", sgw_ctrl_fteid->teid ); + + srslte::gtpc_pdu del_resp_pdu; + m_spgw->handle_delete_session_request(&del_req_pdu, &del_resp_pdu); + + //TODO Handle delete session response + return; +} } //namespace srsepc diff --git a/srsepc/src/mme/s1ap_nas_transport.cc b/srsepc/src/mme/s1ap_nas_transport.cc index e49c3a05e..97f6149f6 100644 --- a/srsepc/src/mme/s1ap_nas_transport.cc +++ b/srsepc/src/mme/s1ap_nas_transport.cc @@ -707,7 +707,7 @@ s1ap_nas_transport::handle_nas_service_request(uint32_t m_tmsi, m_s1ap_log->info("Generating KeNB with UL NAS COUNT: %d\n",ue_emm_ctx->security_ctxt.ul_nas_count); //FIXME Send Modify context request OR send ctx release command and wait for the reply. m_mme_gtpc->send_create_session_request(ue_ecm_ctx.imsi, ue_ecm_ctx.mme_ue_s1ap_id,false); - m_s1ap_log->console("UE ESM Ctr TEID %d\n", ue_ecm_ctx.erabs_ctx[5].sgw_ctrl_fteid.teid); + m_s1ap_log->console("UE ESM Ctr TEID %d\n", ue_ecm_ctx.sgw_ctrl_fteid.teid); // m_s1ap->m_s1ap_ctx_mngmt_proc->send_initial_context_setup_request(ue_); } }