lte/gateway/c/core/oai/tasks/amf/amf_smf_send.cpp
/***************************************************************************
**                                                                        **
** Name:    amf_smf_context_exists_pdu_session_id()                       **
**                                                                        **
** Description: Update IP Addrss information in SMF Context               **
**                                                                        **
**                                                                        **
***************************************************************************/


Update IP Addrss information in SMF Context
Update IP Addrss information in SMF Context
int amf_smf_handle_ip_address_response(
    itti_amf_ip_allocation_response_t* response_p) {
  ue_m5gmm_context_s* ue_context;
  std::shared_ptr<smf_context_t> smf_ctx;
  imsi64_t imsi64;
  int rc = RETURNerror;
  IMSI_STRING_TO_IMSI64(response_p->imsi, &imsi64);
  ue_context = lookup_ue_ctxt_by_imsi(imsi64);
  if (ue_context == NULL) {
    OAILOG_ERROR(
        LOG_AMF_APP, "UE Context for [%s] not found \n",
        reinterpret_cast<char*>(response_p->imsi));
    return rc;
  }
  smf_ctx = amf_get_smf_context_by_pdu_session_id(
      ue_context, response_p->pdu_session_id);
  if (NULL == smf_ctx) {
    OAILOG_ERROR(
        LOG_AMF_APP, "Smf Context not found for pdu session id: [%s] \n",
        reinterpret_cast<char*>(response_p->pdu_session_id));
    return rc;
  }
  rc = amf_update_smf_context_pdu_ip(smf_ctx, &(response_p->paa));
  if (rc < 0) {
    OAILOG_ERROR(
        LOG_AMF_APP,
        "SMF Context for PDU not found or Address "
        "type not supported\n");
    return rc;
  }
  if (response_p->paa.pdn_type == IPv4) {
    char ip_str[INET_ADDRSTRLEN];
    inet_ntop(
        AF_INET, &(response_p->paa.ipv4_address.s_addr), ip_str,
        INET_ADDRSTRLEN);
    rc = amf_smf_create_ipv4_session_grpc_req(
        response_p->imsi, response_p->apn, response_p->pdu_session_id,
        response_p->pdu_session_type, response_p->gnb_gtp_teid, response_p->pti,
        response_p->gnb_gtp_teid_ip_addr, ip_str, smf_ctx->smf_ctx_ambr);
    if (rc < 0) {
      OAILOG_ERROR(LOG_AMF_APP, "Create IPV4 Session \n");
    }
  }
  return rc;
}
int amf_smf_handle_ip_address_response ( itti_amf_ip_allocation_response_t * response_p ) { ue_m5gmm_context_s * ue_context ; std :: shared_ptr < smf_context_t > smf_ctx ; imsi64_t imsi64 ; int rc = RETURNerror ; IMSI_STRING_TO_IMSI64 ( response_p -> imsi , & imsi64 ) ; ue_context = lookup_ue_ctxt_by_imsi ( imsi64 ) ; if ( ue_context == NULL ) { OAILOG_ERROR ( LOG_AMF_APP , " \n " , reinterpret_cast < char * > ( response_p -> imsi ) ) ; return rc ; } smf_ctx = amf_get_smf_context_by_pdu_session_id ( ue_context , response_p -> pdu_session_id ) ; if ( NULL == smf_ctx ) { OAILOG_ERROR ( LOG_AMF_APP , " \n " , reinterpret_cast < char * > ( response_p -> pdu_session_id ) ) ; return rc ; } rc = amf_update_smf_context_pdu_ip ( smf_ctx , & ( response_p -> paa ) ) ; if ( rc < 0 ) { OAILOG_ERROR ( LOG_AMF_APP , " " " \n " ) ; return rc ; } if ( response_p -> paa . pdn_type == IPv4 ) { char ip_str [ INET_ADDRSTRLEN ] ; inet_ntop ( AF_INET , & ( response_p -> paa . ipv4_address . s_addr ) , ip_str , INET_ADDRSTRLEN ) ; rc = amf_smf_create_ipv4_session_grpc_req ( response_p -> imsi , response_p -> apn , response_p -> pdu_session_id , response_p -> pdu_session_type , response_p -> gnb_gtp_teid , response_p -> pti , response_p -> gnb_gtp_teid_ip_addr , ip_str , smf_ctx -> smf_ctx_ambr ) ; if ( rc < 0 ) { OAILOG_ERROR ( LOG_AMF_APP , " \n " ) ; } } return rc ; }
Name:    amf_smf_context_exists_pdu_session_id()
Name : amf_smf_context_exists_pdu_session_id ()