Skip to content

Commit

Permalink
fix: nf discovery filter & token request reflect type
Browse files Browse the repository at this point in the history
  • Loading branch information
andy89923 committed Oct 24, 2024
1 parent ebf47db commit 6784b7c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion internal/sbi/api_accesstoken.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ func (s *Server) HTTPAccessTokenRequest(c *gin.Context) {
break
}
}
if vt.Name() == "string" || vt.Name() == "NfType" {
if vt == reflect.TypeOf("") || vt == reflect.TypeOf(models.NrfNfManagementNfType_NRF) {
// Type is string
reflect.ValueOf(&accessTokenReq).Elem().FieldByName(name).SetString(value[0])
} else {
plmnid := models.PlmnId{}
Expand Down
3 changes: 2 additions & 1 deletion internal/sbi/processor/nf_discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,10 @@ func buildFilter(queryParameters url.Values) bson.M {
// Pattern: '^[A-Fa-f0-9]{6}$'
if queryParameters["snssais"] != nil {
snssais := queryParameters["snssais"][0]
// snssais = [{"sst":1,"sd":"fedcba"}]

var snssaisBsonArray bson.A
slices := util.SnssaisToBsonM(snssais)
slices := util.SnssaisToBsonM(snssais[1 : len(snssais)-1])
for _, slice := range slices {
snssaisBsonArray = append(snssaisBsonArray, bson.M{"sNssais": bson.M{"$elemMatch": slice}})
}
Expand Down

0 comments on commit 6784b7c

Please sign in to comment.