lte/gateway/c/core/oai/tasks/amf/amf_smf_send.cpp
/***************************************************************************
**                                                                        **
** Name:    amf_smf_notification_send()                                   **
**                                                                        **
** Description:                                                           **
** This function for UE idle event notification to SMF or single PDU      **
** session state change to Inactive state and notify to SMF.              **
** 4 types of events are used in proto.                                   **
** PDU_SESSION_INACTIVE_NOTIFY => use for single PDU session notify       **
** UE_IDLE_MODE_NOTIFY     => use for idle mode support                   **
** UE_PAGING_NOTIFY                                                       **
** UE_PERIODIC_REG_ACTIVE_MODE_NOTIFY                                     **
**                                                                        **
***************************************************************************/


This function for UE idle event notification to SMF or single PDU
session state change to Inactive state and notify to SMF.
4 types of events are used in proto.
PDU_SESSION_INACTIVE_NOTIFY => use for single PDU session notify
UE_IDLE_MODE_NOTIFY     => use for idle mode support
UE_PAGING_NOTIFY
UE_PERIODIC_REG_ACTIVE_MODE_NOTIFY
This function for UE idle event notification to SMF or single PDU session state change to Inactive state and notify to SMF . 4 types of events are used in proto . PDU_SESSION_INACTIVE_NOTIFY = > use for single PDU session notify UE_IDLE_MODE_NOTIFY = > use for idle mode support UE_PAGING_NOTIFY UE_PERIODIC_REG_ACTIVE_MODE_NOTIFY
int amf_smf_notification_send(
    amf_ue_ngap_id_t ue_id, ue_m5gmm_context_s* ue_context,
    notify_ue_event notify_event_type) {
  magma::lte::SetSmNotificationContext notify_req;
  auto* req_common       = notify_req.mutable_common_context();
  auto* req_rat_specific = notify_req.mutable_rat_specific_notification();
  char imsi[IMSI_BCD_DIGITS_MAX + 1];
  IMSI64_TO_STRING(ue_context->amf_context.imsi64, imsi, 15);
  req_common->mutable_sid()->mutable_id()->assign(imsi);
  if (notify_event_type == UE_IDLE_MODE_NOTIFY) {
    req_rat_specific->set_notify_ue_event(
        magma::lte::NotifyUeEvents::UE_IDLE_MODE_NOTIFY);
  } else if (notify_event_type == UE_SERVICE_REQUEST_ON_PAGING) {
    req_rat_specific->set_notify_ue_event(
        magma::lte::NotifyUeEvents::UE_SERVICE_REQUEST_ON_PAGING);
  }
  for (const auto& it : ue_context->amf_context.smf_ctxt_map) {
    std::shared_ptr<smf_context_t> smf_context = it.second;
    if (smf_context->pdu_address.pdn_type == IPv4) {
      char ip_str[INET_ADDRSTRLEN];
      inet_ntop(
          AF_INET, &(smf_context->pdu_address.ipv4_address.s_addr), ip_str,
          INET_ADDRSTRLEN);
      req_common->set_ue_ipv4((char*) ip_str);
    }
  }
  OAILOG_DEBUG(
      LOG_AMF_APP,
      " Notification gRPC filled with IMSI %s and "
      "ue_state_idle is set to true \n",
      imsi);
  AsyncSmfServiceClient::getInstance().set_smf_notification(notify_req);
  return RETURNok;
}
int amf_smf_notification_send ( amf_ue_ngap_id_t ue_id , ue_m5gmm_context_s * ue_context , notify_ue_event notify_event_type ) { magma :: lte :: SetSmNotificationContext notify_req ; auto * req_common = notify_req . mutable_common_context ( ) ; auto * req_rat_specific = notify_req . mutable_rat_specific_notification ( ) ; char imsi [ IMSI_BCD_DIGITS_MAX + 1 ] ; IMSI64_TO_STRING ( ue_context -> amf_context . imsi64 , imsi , 15 ) ; req_common -> mutable_sid ( ) -> mutable_id ( ) -> assign ( imsi ) ; if ( notify_event_type == UE_IDLE_MODE_NOTIFY ) { req_rat_specific -> set_notify_ue_event ( magma :: lte :: NotifyUeEvents :: UE_IDLE_MODE_NOTIFY ) ; } else if ( notify_event_type == UE_SERVICE_REQUEST_ON_PAGING ) { req_rat_specific -> set_notify_ue_event ( magma :: lte :: NotifyUeEvents :: UE_SERVICE_REQUEST_ON_PAGING ) ; } for ( const auto & it : ue_context -> amf_context . smf_ctxt_map ) { std :: shared_ptr < smf_context_t > smf_context = it . second ; if ( smf_context -> pdu_address . pdn_type == IPv4 ) { char ip_str [ INET_ADDRSTRLEN ] ; inet_ntop ( AF_INET , & ( smf_context -> pdu_address . ipv4_address . s_addr ) , ip_str , INET_ADDRSTRLEN ) ; req_common -> set_ue_ipv4 ( ( char * ) ip_str ) ; } } OAILOG_DEBUG ( LOG_AMF_APP , " " " \n " , imsi ) ; AsyncSmfServiceClient :: getInstance ( ) . set_smf_notification ( notify_req ) ; return RETURNok ; }
Name:    amf_smf_notification_send()
Name : amf_smf_notification_send ()
/* Get gRPC structure of notification to be filled common and
   * rat type elements.
   * Only need  to be filled IMSI and ue_state_idle of UE
   */ // Set the PDU Address