Changing Activate EPS bearer function to work with IMSI.

master
Pedro Alvarez 7 years ago
parent 98345ed6a2
commit a3b31966b8

@ -72,7 +72,7 @@ public:
bool handle_initiating_message(LIBLTE_S1AP_INITIATINGMESSAGE_STRUCT *msg, struct sctp_sndrcvinfo *enb_sri); bool handle_initiating_message(LIBLTE_S1AP_INITIATINGMESSAGE_STRUCT *msg, struct sctp_sndrcvinfo *enb_sri);
bool handle_successful_outcome(LIBLTE_S1AP_SUCCESSFULOUTCOME_STRUCT *msg); bool handle_successful_outcome(LIBLTE_S1AP_SUCCESSFULOUTCOME_STRUCT *msg);
void activate_eps_bearer(uint32_t mme_s1ap_id, uint8_t ebi); void activate_eps_bearer(uint64_t imsi, uint8_t ebi);
void print_enb_ctx_info(const std::string &prefix, const enb_ctx_t &enb_ctx); void print_enb_ctx_info(const std::string &prefix, const enb_ctx_t &enb_ctx);

@ -288,16 +288,16 @@ void
mme_gtpc::handle_modify_bearer_response(srslte::gtpc_pdu *mb_resp_pdu) mme_gtpc::handle_modify_bearer_response(srslte::gtpc_pdu *mb_resp_pdu)
{ {
uint32_t mme_ctrl_teid = mb_resp_pdu->header.teid; uint32_t mme_ctrl_teid = mb_resp_pdu->header.teid;
std::map<uint32_t,uint32_t>::iterator mme_s1ap_id_it = m_teid_to_mme_s1ap_id.find(mme_ctrl_teid); std::map<uint32_t,uint64_t>::iterator imsi_it = m_mme_ctr_teid_to_imsi.find(mme_ctrl_teid);
if(mme_s1ap_id_it == m_teid_to_mme_s1ap_id.end()) if(imsi_it == m_mme_ctr_teid_to_imsi.end())
{ {
m_mme_gtpc_log->error("Could not find MME S1AP Id from control TEID\n"); m_mme_gtpc_log->error("Could not find IMSI from control TEID\n");
return; return;
} }
uint8_t ebi = mb_resp_pdu->choice.modify_bearer_response.eps_bearer_context_modified.ebi; uint8_t ebi = mb_resp_pdu->choice.modify_bearer_response.eps_bearer_context_modified.ebi;
m_mme_gtpc_log->debug("Activating EPS bearer with id %d\n", ebi); m_mme_gtpc_log->debug("Activating EPS bearer with id %d\n", ebi);
m_s1ap->activate_eps_bearer(mme_s1ap_id_it->second,ebi); m_s1ap->activate_eps_bearer(imsi_it->second,ebi);
return; return;
} }

@ -501,23 +501,31 @@ s1ap::delete_ues_ecm_ctx_in_enb(uint16_t enb_id)
//UE Bearer Managment //UE Bearer Managment
void void
s1ap::activate_eps_bearer(uint32_t mme_s1ap_id, uint8_t ebi) s1ap::activate_eps_bearer(uint64_t imsi, uint8_t ebi)
{ {
std::map<uint32_t,ue_ecm_ctx_t*>::iterator ue_ctx_it = m_mme_ue_s1ap_id_to_ue_ecm_ctx.find(mme_s1ap_id); std::map<uint64_t,ue_emm_ctx_t*>::iterator emm_ctx_it = m_imsi_to_ue_emm_ctx.find(imsi);
if(ue_ctx_it == m_mme_ue_s1ap_id_to_ue_ecm_ctx.end()) if(emm_ctx_it == m_imsi_to_ue_emm_ctx.end())
{ {
m_s1ap_log->error("Could not find UE context\n"); m_s1ap_log->error("Could not find UE EMM context\n");
return;
}
uint32_t mme_ue_s1ap_id = emm_ctx_it->second->mme_ue_s1ap_id;
std::map<uint32_t,ue_ecm_ctx_t*>::iterator ecm_ctx_it = m_mme_ue_s1ap_id_to_ue_ecm_ctx.find(mme_s1ap_id);
if(ecm_ctx_it == m_mme_ue_s1ap_id_to_ue_ecm_ctx.end())
{
m_s1ap_log->error("Could not find UE ECM context\n");
return; return;
} }
ue_ecm_ctx_t * ue_ctx = ue_ctx_it->second;
if (ue_ctx->erabs_ctx[ebi].state != ERAB_CTX_SETUP) ue_ecm_ctx_t * ecm_ctx = ue_ctx_it->second;
if (ecm_ctx->erabs_ctx[ebi].state != ERAB_CTX_SETUP)
{ {
m_s1ap_log->error("EPS Bearer could not be activated. MME S1AP Id %d, EPS Bearer id %d, state %d\n",mme_s1ap_id,ebi,ue_ctx->erabs_ctx[ebi].state); m_s1ap_log->error("EPS Bearer could not be activated. MME S1AP Id %d, EPS Bearer id %d, state %d\n",mme_s1ap_id,ebi,ue_ctx->erabs_ctx[ebi].state);
m_s1ap_log->console("EPS Bearer could not be activated. MME S1AP Id %d, EPS Bearer id %d\n",mme_s1ap_id,ebi,ue_ctx->erabs_ctx[ebi].state); m_s1ap_log->console("EPS Bearer could not be activated. MME S1AP Id %d, EPS Bearer id %d\n",mme_s1ap_id,ebi,ue_ctx->erabs_ctx[ebi].state);
return; return;
} }
ue_ctx->erabs_ctx[ebi].state = ERAB_ACTIVE; ecm_ctx->erabs_ctx[ebi].state = ERAB_ACTIVE;
m_s1ap_log->info("Activated EPS Bearer\n"); m_s1ap_log->info("Activated EPS Bearer\n");
return; return;
} }

Loading…
Cancel
Save