Skip to content

Commit

Permalink
fix(nsselection): if tai and homePlmnId are both missing, return 400
Browse files Browse the repository at this point in the history
  • Loading branch information
yccodr committed Jun 14, 2024
1 parent d04c2e4 commit 0e29e65
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
23 changes: 23 additions & 0 deletions internal/sbi/processor/nsselection_network_slice_information.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,26 @@ func (p *Processor) NSSelectionSliceInformationGet(c *gin.Context, query url.Val
return
}

if param.Tai == nil && param.HomePlmnId == nil {
problemDetails = &models.ProblemDetails{
Title: util.MANDATORY_IE_MISSING,
Status: http.StatusBadRequest,
Cause: "MANDATORY_IE_MISSING",
Detail: "Either `tai` or `home-plmn-id` should be provided",
InvalidParams: []models.InvalidParam{
{
Param: "tai",
},
{
Param: "home-plmn-id",
},
},
}

util.GinProblemJson(c, problemDetails)
return
}

if param.SliceInfoRequestForRegistration != nil {
// Network slice information is requested during the Registration procedure
status, response, problemDetails = nsselectionForRegistration(param)
Expand Down Expand Up @@ -622,6 +642,7 @@ func nsselectionForPduSession(param plugin.NsselectionQueryParameter) (
// Return ProblemDetails indicating S-NSSAI is not supported
// TODO: Based on TS 23.501 V15.2.0, if the Requested NSSAI includes an S-NSSAI that is not valid in the
// Serving PLMN, the NSSF may derive the Configured NSSAI for Serving PLMN

problemDetails := &models.ProblemDetails{
Title: util.UNSUPPORTED_RESOURCE,
Status: http.StatusForbidden,
Expand Down Expand Up @@ -692,5 +713,7 @@ func nsselectionForPduSession(param plugin.NsselectionQueryParameter) (
*authorizedNetworkSliceInfo.NsiInformation = nsiInformation
}

logger.NsselLog.Infof("authorizedNetworkSliceInfo: %+v", authorizedNetworkSliceInfo)

return http.StatusOK, authorizedNetworkSliceInfo, nil
}
1 change: 1 addition & 0 deletions internal/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
const (
INTERNAL_ERROR = "Internal server error"
INVALID_REQUEST = "Invalid request message framing"
MANDATORY_IE_MISSING = "Mandatory IEs are missing"
MALFORMED_REQUEST = "Malformed request syntax"
UNAUTHORIZED_CONSUMER = "Unauthorized NF service consumer"
UNSUPPORTED_RESOURCE = "Unsupported request resources"
Expand Down

0 comments on commit 0e29e65

Please sign in to comment.