lte/gateway/c/core/oai/tasks/amf/amf_smf_send.cpp
/***************************************************************************
**                                                                        **
** Name:    amf_smf_get_smcause()                                         **
**                                                                        **
** Description: function to handle PDU Session Establishment Failures     **
**                                                                        **
**                                                                        **
***************************************************************************/


function to handle PDU Session Establishment Failures
function to handle PDU Session Establishment Failures
M5GSmCause amf_smf_get_smcause(amf_ue_ngap_id_t ue_id, ULNASTransportMsg* msg) {
  std::shared_ptr<smf_context_t> smf_ctx;
  M5GSmCause cause = M5GSmCause::INVALID_CAUSE;
  ue_m5gmm_context_s* ue_context = amf_ue_context_exists_amf_ue_ngap_id(ue_id);
  if (!ue_context) {
    return cause;
  }
  if (msg->dnn.len <= 1 &&
      (ue_context->amf_context.apn_config_profile.nb_apns == 0)) {
    cause = M5GSmCause::MISSING_OR_UNKNOWN_DNN;
    return cause;
  }
  M5GPduSessionType session_type = static_cast<M5GPduSessionType>(
      msg->payload_container.smf_msg.msg.pdu_session_estab_request
          .pdu_session_type.type_val);
  if (session_type == M5GPduSessionType::UNSTRUCTURED ||
      session_type == M5GPduSessionType::ETHERNET) {
    cause = M5GSmCause::UNKNOWN_PDU_SESSION_TYPE;
    return cause;
  }
  M5GRequestType requestType =
      static_cast<M5GRequestType>(msg->request_type.type_val);
  smf_ctx = amf_get_smf_context_by_pdu_session_id(
      ue_context, msg->payload_container.smf_msg.header.pdu_session_id);
  if ((msg->payload_container.smf_msg.header.message_type ==
       PDU_SESSION_ESTABLISHMENT_REQUEST) &&
      (requestType == M5GRequestType::INITIAL_REQUEST) && smf_ctx &&
      (smf_ctx->pdu_session_state == ACTIVE)) {
    if (smf_ctx->duplicate_pdu_session_est_req_count >=
        MAX_UE_INITIAL_PDU_SESSION_ESTABLISHMENT_REQ_ALLOWED - 1) {
      cause = M5GSmCause::INVALID_PDU_SESSION_IDENTITY;
    } else {
      smf_ctx->duplicate_pdu_session_est_req_count += 1;
      OAILOG_INFO(
          LOG_AMF_APP,
          "Duplicate Initial PDU Session establishment request received");
    }
  }
  return cause;
}
M5GSmCause amf_smf_get_smcause ( amf_ue_ngap_id_t ue_id , ULNASTransportMsg * msg ) { std :: shared_ptr < smf_context_t > smf_ctx ; M5GSmCause cause = M5GSmCause :: INVALID_CAUSE ; ue_m5gmm_context_s * ue_context = amf_ue_context_exists_amf_ue_ngap_id ( ue_id ) ; if ( ! ue_context ) { return cause ; } if ( msg -> dnn . len <= 1 && ( ue_context -> amf_context . apn_config_profile . nb_apns == 0 ) ) { cause = M5GSmCause :: MISSING_OR_UNKNOWN_DNN ; return cause ; } M5GPduSessionType session_type = static_cast < M5GPduSessionType > ( msg -> payload_container . smf_msg . msg . pdu_session_estab_request . pdu_session_type . type_val ) ; if ( session_type == M5GPduSessionType :: UNSTRUCTURED || session_type == M5GPduSessionType :: ETHERNET ) { cause = M5GSmCause :: UNKNOWN_PDU_SESSION_TYPE ; return cause ; } M5GRequestType requestType = static_cast < M5GRequestType > ( msg -> request_type . type_val ) ; smf_ctx = amf_get_smf_context_by_pdu_session_id ( ue_context , msg -> payload_container . smf_msg . header . pdu_session_id ) ; if ( ( msg -> payload_container . smf_msg . header . message_type == PDU_SESSION_ESTABLISHMENT_REQUEST ) && ( requestType == M5GRequestType :: INITIAL_REQUEST ) && smf_ctx && ( smf_ctx -> pdu_session_state == ACTIVE ) ) { if ( smf_ctx -> duplicate_pdu_session_est_req_count >= MAX_UE_INITIAL_PDU_SESSION_ESTABLISHMENT_REQ_ALLOWED - 1 ) { cause = M5GSmCause :: INVALID_PDU_SESSION_IDENTITY ; } else { smf_ctx -> duplicate_pdu_session_est_req_count += 1 ; OAILOG_INFO ( LOG_AMF_APP , " " ) ; } } return cause ; }
Name:    amf_smf_get_smcause()
Name : amf_smf_get_smcause ()
/*
  Cause #27 – Missing or unknown DNN
  the external DNN because the DNN was not included
  although required or if the DNN could not be resolved.
  */ /*
  Cause #28 – Unknown PDU session type
  the requested PDU session type could not be recognized or is not allowed.
  */ /*
  Cause #43 – Invalid PDU session identity
  Usecase: If AMF receives a new PDU Session Establishment Request and
  AMF has already another active PDU Session in progress with the Same PDU
  Session IDentity, AMF will not process PDUSession Establishment requests for 5
  times, after that AMF rejects with reason #43.
  */