Skip to content

Commit

Permalink
PDU Session Establishment request with Sesssion type 'unstructured' F…
Browse files Browse the repository at this point in the history
…ix (#314)

* unsturctured session type fix

Signed-off-by: AshithaCDAC <[email protected]>

* nil error fix in HandleStateInitEventPduSessCreate

Signed-off-by: AshithaCDAC <[email protected]>

* updated code with proposed changes

Signed-off-by: AshithaCDAC <[email protected]>

* modified the 5G SM cause

Signed-off-by: AshithaCDAC <[email protected]>

* Update fsm/handler.go

Co-authored-by: gab-arrobo <[email protected]>
Signed-off-by: Arrobo, Gabriel <[email protected]>

---------

Signed-off-by: AshithaCDAC <[email protected]>
Signed-off-by: Arrobo, Gabriel <[email protected]>
Co-authored-by: Arrobo, Gabriel <[email protected]>
  • Loading branch information
ashithacdac and gab-arrobo authored Sep 25, 2024
1 parent 9bfa471 commit 381ee21
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 25 deletions.
3 changes: 3 additions & 0 deletions context/sm_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,9 @@ func (smContext *SMContext) isAllowedPDUSessionType(requestedPDUSessionType uint
} else {
return fmt.Errorf("PduSessionType_ETHERNET is not allowed in DNN[%s] configuration", smContext.Dnn)
}
case models.PduSessionType_UNSTRUCTURED:
smContext.SelectedPDUSessionType = nasConvert.ModelsToPDUSessionType(models.PduSessionType_UNSTRUCTURED)
return fmt.Errorf("Unstructured PDU Session type")
default:
return fmt.Errorf("requested PDU Sesstion type[%d] is not supported", requestedPDUSessionType)
}
Expand Down
4 changes: 3 additions & 1 deletion fsm/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,14 @@ func EmptyEventHandler(event SmEvent, eventData *SmEventData) (smf_context.SMCon
func HandleStateInitEventPduSessCreate(event SmEvent, eventData *SmEventData) (smf_context.SMContextState, error) {
if err := producer.HandlePDUSessionSMContextCreate(eventData.Txn); err != nil {
err := stats.PublishMsgEvent(mi.Smf_msg_type_pdu_sess_create_rsp_failure)
var errorMessage string = ""
if err != nil {
logger.FsmLog.Errorf("error while publishing pdu session create response failure, %v ", err.Error())
errorMessage = err.Error()
}
txn := eventData.Txn.(*transaction.Transaction)
txn.Err = err
return smf_context.SmStateInit, fmt.Errorf("pdu session create error, %v ", err.Error())
return smf_context.SmStateInit, fmt.Errorf("pdu session create: %v", errorMessage)
}

err := stats.PublishMsgEvent(mi.Smf_msg_type_pdu_sess_create_rsp_success)
Expand Down
6 changes: 6 additions & 0 deletions producer/pdu_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,12 @@ func HandlePDUSessionSMContextCreate(eventData interface{}) error {
establishmentRequest := m.PDUSessionEstablishmentRequest
smContext.HandlePDUSessionEstablishmentRequest(establishmentRequest)

if smContext.SelectedPDUSessionType == nasMessage.PDUSessionTypeUnstructured {
smContext.SubPduSessLog.Errorf("Unstructured PDU Session Not Supported")
txn.Rsp = smContext.GeneratePDUSessionEstablishmentReject("PDUSessionTypeIPv4OnlyAllowed")
return fmt.Errorf("Unstructured PDU Session not supported")
}

if err := smContext.PCFSelection(); err != nil {
smContext.SubPduSessLog.Errorf("PDUSessionSMContextCreate, send NF Discovery Serving PCF Error[%v]", err)
txn.Rsp = smContext.GeneratePDUSessionEstablishmentReject("PCFDiscoveryFailure")
Expand Down
57 changes: 33 additions & 24 deletions smferrors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,34 +102,43 @@ var (
Cause: "REQUEST_REJECTED",
InvalidParams: nil,
}
PduSessionTypeNotSupported = models.ProblemDetails{
Title: "PduSession Type Not Supported",
Status: http.StatusForbidden,
Detail: "Unstructured PDU Type is not Supported.",
Cause: "REQUEST_REJECTED",
InvalidParams: nil,
}
)

var ErrorType = map[string]*models.ProblemDetails{
"DnnDeniedError": &DnnDeniedError,
"DnnNotSupported": &DnnNotSupported,
"InsufficientResourceSliceDnn": &InsufficientResourceSliceDnn,
"IpAllocError": &IpAllocError,
"SubscriptionDataFetchError": &SubscriptionDataFetchError,
"SubscriptionDataLenError": &SubscriptionDataLenError,
"UDMDiscoveryFailure": &UDMDiscoveryFailure,
"UPFDataPathError": &UPFDataPathError,
"PCFDiscoveryFailure": &PCFDiscoveryFailure,
"PCFPolicyCreateFailure": &PCFPolicyCreateFailure,
"ApplySMPolicyFailure": &ApplySMPolicyFailure,
"AMFDiscoveryFailure": &AMFDiscoveryFailure,
"DnnDeniedError": &DnnDeniedError,
"DnnNotSupported": &DnnNotSupported,
"InsufficientResourceSliceDnn": &InsufficientResourceSliceDnn,
"IpAllocError": &IpAllocError,
"SubscriptionDataFetchError": &SubscriptionDataFetchError,
"SubscriptionDataLenError": &SubscriptionDataLenError,
"UDMDiscoveryFailure": &UDMDiscoveryFailure,
"UPFDataPathError": &UPFDataPathError,
"PCFDiscoveryFailure": &PCFDiscoveryFailure,
"PCFPolicyCreateFailure": &PCFPolicyCreateFailure,
"ApplySMPolicyFailure": &ApplySMPolicyFailure,
"AMFDiscoveryFailure": &AMFDiscoveryFailure,
"PDUSessionTypeIPv4OnlyAllowed": &PduSessionTypeNotSupported,
}

var ErrorCause = map[string]uint8{
"DnnDeniedError": nasMessage.Cause5GMMDNNNotSupportedOrNotSubscribedInTheSlice,
"DnnNotSupported": nasMessage.Cause5GMMDNNNotSupportedOrNotSubscribedInTheSlice,
"InsufficientResourceSliceDnn": nasMessage.Cause5GSMInsufficientResourcesForSpecificSliceAndDNN,
"IpAllocError": nasMessage.Cause5GSMInsufficientResources,
"SubscriptionDataFetchError": nasMessage.Cause5GSMRequestRejectedUnspecified,
"SubscriptionDataLenError": nasMessage.Cause5GSMRequestRejectedUnspecified,
"UDMDiscoveryFailure": nasMessage.Cause5GSMRequestRejectedUnspecified,
"UPFDataPathError": nasMessage.Cause5GSMRequestRejectedUnspecified,
"PCFDiscoveryFailure": nasMessage.Cause5GSMRequestRejectedUnspecified,
"PCFPolicyCreateFailure": nasMessage.Cause5GSMRequestRejectedUnspecified,
"ApplySMPolicyFailure": nasMessage.Cause5GSMRequestRejectedUnspecified,
"AMFDiscoveryFailure": nasMessage.Cause5GSMRequestRejectedUnspecified,
"DnnDeniedError": nasMessage.Cause5GMMDNNNotSupportedOrNotSubscribedInTheSlice,
"DnnNotSupported": nasMessage.Cause5GMMDNNNotSupportedOrNotSubscribedInTheSlice,
"InsufficientResourceSliceDnn": nasMessage.Cause5GSMInsufficientResourcesForSpecificSliceAndDNN,
"IpAllocError": nasMessage.Cause5GSMInsufficientResources,
"SubscriptionDataFetchError": nasMessage.Cause5GSMRequestRejectedUnspecified,
"SubscriptionDataLenError": nasMessage.Cause5GSMRequestRejectedUnspecified,
"UDMDiscoveryFailure": nasMessage.Cause5GSMRequestRejectedUnspecified,
"UPFDataPathError": nasMessage.Cause5GSMRequestRejectedUnspecified,
"PCFDiscoveryFailure": nasMessage.Cause5GSMRequestRejectedUnspecified,
"PCFPolicyCreateFailure": nasMessage.Cause5GSMRequestRejectedUnspecified,
"ApplySMPolicyFailure": nasMessage.Cause5GSMRequestRejectedUnspecified,
"AMFDiscoveryFailure": nasMessage.Cause5GSMRequestRejectedUnspecified,
"PDUSessionTypeIPv4OnlyAllowed": nasMessage.Cause5GSMPDUSessionTypeIPv4OnlyAllowed,
}

0 comments on commit 381ee21

Please sign in to comment.