lte/gateway/c/core/oai/tasks/amf/prepare_request_for_smf.cpp
/***************************************************************************
**                                                                        **
** Name:   create_session_grpc_req_on_gnb_setup_rsp()                     **
**                                                                        **
** Description:                                                           **
** Creating session grpc req upon receiving resource setup response       **
** from gNB which have gNB IP and TEID, and sends to UPF through SMF      **
**                                                                        **
**                                                                        **
***************************************************************************/


Creating session grpc req upon receiving resource setup response
from gNB which have gNB IP and TEID, and sends to UPF through SMF
Creating session grpc req upon receiving resource setup response from gNB which have gNB IP and TEID and sends to UPF through SMF
int create_session_grpc_req_on_gnb_setup_rsp(
    amf_smf_establish_t* message, char* imsi, uint32_t version) {
  int rc = RETURNerror;
  magma::lte::SetSMSessionContext req;
  auto* req_common = req.mutable_common_context();
  auto* req_rat_specific =
      req.mutable_rat_specific_context()->mutable_m5gsm_session_context();
  req_common->mutable_sid()->mutable_id()->assign(imsi);  
  req_common->mutable_sid()->set_type(
      magma::lte::SubscriberID_IDType::SubscriberID_IDType_IMSI);
  req_common->set_rat_type(magma::lte::RATType::TGPP_NR);
  req_common->set_sm_session_state(magma::lte::SMSessionFSMState::CREATING_0);
  req_common->set_sm_session_version(version);
  req_rat_specific->set_pdu_session_id((message->pdu_session_id));
  req_rat_specific->set_request_type(magma::lte::RequestType::INITIAL_REQUEST);
  TeidSet* gnode_endpoint = req_rat_specific->mutable_gnode_endpoint();
  gnode_endpoint->set_teid(message->gnb_gtp_teid);
  char ipv4_str[INET_ADDRSTRLEN] = {0};
  inet_ntop(AF_INET, message->gnb_gtp_teid_ip_addr, ipv4_str, INET_ADDRSTRLEN);
  req_rat_specific->mutable_gnode_endpoint()->set_end_ipv4_addr(ipv4_str);
  OAILOG_INFO(
      LOG_AMF_APP,
      "Sending msg(grpc) to :[sessiond] for ue: [%s] pdu session :[%u]\n", imsi,
      message->pdu_session_id);
  AMFClientServicer::getInstance().set_smf_session(req);
  return rc;
}
int create_session_grpc_req_on_gnb_setup_rsp ( amf_smf_establish_t * message , char * imsi , uint32_t version ) { int rc = RETURNerror ; magma :: lte :: SetSMSessionContext req ; auto * req_common = req . mutable_common_context ( ) ; auto * req_rat_specific = req . mutable_rat_specific_context ( ) -> mutable_m5gsm_session_context ( ) ; req_common -> mutable_sid ( ) -> mutable_id ( ) -> assign ( imsi ) ; req_common -> mutable_sid ( ) -> set_type ( magma :: lte :: SubscriberID_IDType :: SubscriberID_IDType_IMSI ) ; req_common -> set_rat_type ( magma :: lte :: RATType :: TGPP_NR ) ; req_common -> set_sm_session_state ( magma :: lte :: SMSessionFSMState :: CREATING_0 ) ; req_common -> set_sm_session_version ( version ) ; req_rat_specific -> set_pdu_session_id ( ( message -> pdu_session_id ) ) ; req_rat_specific -> set_request_type ( magma :: lte :: RequestType :: INITIAL_REQUEST ) ; TeidSet * gnode_endpoint = req_rat_specific -> mutable_gnode_endpoint ( ) ; gnode_endpoint -> set_teid ( message -> gnb_gtp_teid ) ; char ipv4_str [ INET_ADDRSTRLEN ] = { 0 } ; inet_ntop ( AF_INET , message -> gnb_gtp_teid_ip_addr , ipv4_str , INET_ADDRSTRLEN ) ; req_rat_specific -> mutable_gnode_endpoint ( ) -> set_end_ipv4_addr ( ipv4_str ) ; OAILOG_INFO ( LOG_AMF_APP , " \n " , imsi , message -> pdu_session_id ) ; AMFClientServicer :: getInstance ( ) . set_smf_session ( req ) ; return rc ; }
Name:   create_session_grpc_req_on_gnb_setup_rsp()
Name : create_session_grpc_req_on_gnb_setup_rsp ()
// IMSI retrieved from amf context // string id // PDU session state to CREATING // Version Added