Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,31 @@ go 1.24
require (
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d
github.com/evanphx/json-patch v0.5.2
github.com/free5gc/openapi v1.2.0
github.com/free5gc/util v1.1.1
github.com/free5gc/openapi v1.2.1
github.com/free5gc/util v1.2.0
github.com/gin-gonic/gin v1.10.0
github.com/go-playground/validator/v10 v10.20.0
github.com/google/uuid v1.3.0
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.21.0
github.com/sirupsen/logrus v1.9.3
github.com/urfave/cli/v2 v2.27.7
go.uber.org/mock v0.4.0
gopkg.in/yaml.v2 v2.4.0
)

require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/bytedance/sonic v1.11.6 // indirect
github.com/bytedance/sonic/loader v0.1.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cloudwego/base64x v0.1.4 // indirect
github.com/cloudwego/iasm v0.2.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/free5gc/aper v1.0.6-0.20250102035630-3ddc831eed6a // indirect
github.com/free5gc/nas v1.1.5 // indirect
github.com/free5gc/ngap v1.0.10 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-logr/logr v1.4.1 // indirect
Expand All @@ -35,13 +41,18 @@ require (
github.com/h2non/gock v1.2.0 // indirect
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.17.11 // indirect
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.62.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/tim-ywliu/nested-logrus-formatter v1.3.2 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
Expand All @@ -58,6 +69,6 @@ require (
golang.org/x/oauth2 v0.27.0 // indirect
golang.org/x/sys v0.31.0 // indirect
golang.org/x/text v0.23.0 // indirect
google.golang.org/protobuf v1.34.1 // indirect
google.golang.org/protobuf v1.36.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
48 changes: 40 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d h1:Byv0BzEl3/e6D5CLfI0j/7hiIEtvGVFPCZ7Ei2oq8iQ=
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0=
github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4=
github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM=
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y=
github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg=
Expand All @@ -17,10 +21,16 @@ github.com/evanphx/json-patch v0.5.2 h1:xVCHIVMUu1wtM/VkR9jVZ45N3FhZfYMMYGorLCR8
github.com/evanphx/json-patch v0.5.2/go.mod h1:ZWS5hhDbVDyob71nXKNL0+PWn6ToqBHMikGIFbs31qQ=
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/free5gc/openapi v1.2.0 h1:AOPqkkiWK7XJPdzWVohWsoGkLBt8OrVkQkU7xzvzbek=
github.com/free5gc/openapi v1.2.0/go.mod h1:pGVJ27QZk4UGG4/1IioBtxwIKNdqOk7L9qcrXvdTjYU=
github.com/free5gc/util v1.1.1 h1:gsjyI/XbHC9EChoMayHvV5kd92vDmp5/TvmBsOuHto4=
github.com/free5gc/util v1.1.1/go.mod h1:numtzcUQDVMpotUjwAXgGHqHHyPWKiicZhQtW4Ijk18=
github.com/free5gc/aper v1.0.6-0.20250102035630-3ddc831eed6a h1:PRapMdjqo96T7y8PHShUlirRDI0EaJNVrmdfQaHxOKY=
github.com/free5gc/aper v1.0.6-0.20250102035630-3ddc831eed6a/go.mod h1:L4d0BJpHVOgiOC49aCz44mF0Vja3l+bcVSAs7i3CZ8s=
github.com/free5gc/nas v1.1.5 h1:Nn+ykQHcc3nHzsufvm/MwQjZRZV9/woxnPeoAMjgjP4=
github.com/free5gc/nas v1.1.5/go.mod h1:PjgawnhAVEMn/GRQw2FHkjRj0m2+9Bhbr1qrQPXCxwo=
github.com/free5gc/ngap v1.0.10 h1:Fj0EcmG+7m3yPKVwmtBPwJupj/dBmPxTG2BNljDSJXQ=
github.com/free5gc/ngap v1.0.10/go.mod h1:YB2lx46yopOOWi3dt/vEg198oHKUyQHo0qwenjdwhi4=
github.com/free5gc/openapi v1.2.1 h1:8Y54anuunBb1HhKuw64qVMdq+iri66CZH8gSrXCIGIU=
github.com/free5gc/openapi v1.2.1/go.mod h1:pGVJ27QZk4UGG4/1IioBtxwIKNdqOk7L9qcrXvdTjYU=
github.com/free5gc/util v1.2.0 h1:qA6EwiM7uAaE2SUSZDkUaMEa1DVEBoMN+wEWhRj8cYs=
github.com/free5gc/util v1.2.0/go.mod h1:eFZg7JCMlG1G5eCBbw+Gfs0SOBSIZv1OeuB1Sh0H+zE=
github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0=
github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
Expand Down Expand Up @@ -56,10 +66,18 @@ github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplb
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc=
github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0=
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM=
github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
Expand All @@ -71,6 +89,8 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32 h1:W6apQkHrMkS0Muv8G/TipAy/FJl/rCYT0+EuS8+Z0z4=
github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms=
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
Expand All @@ -79,6 +99,16 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_golang v1.21.0 h1:DIsaGmiaBkSangBgMtWdNfxbMNdku5IK6iNhrEqWvdA=
github.com/prometheus/client_golang v1.21.0/go.mod h1:U9NM32ykUErtVBxdvD3zfi+EuFkkaBvMb09mIfe0Zgg=
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
github.com/prometheus/common v0.62.0 h1:xasJaQlnWAeyHdUBeGjXmutelfJHWMRr+Fg4QszZ2Io=
github.com/prometheus/common v0.62.0/go.mod h1:vyBcEuLSvWos9B1+CyL7JZ2up+uFzXhkqml0W5zIY1I=
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
Expand All @@ -93,8 +123,9 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/tim-ywliu/nested-logrus-formatter v1.3.2 h1:jugNJ2/CNCI79SxOJCOhwUHeN3O7/7/bj+ZRGOFlCSw=
github.com/tim-ywliu/nested-logrus-formatter v1.3.2/go.mod h1:oGPmcxZB65j9Wo7mCnQKSrKEJtVDqyjD666SGmyStXI=
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
Expand Down Expand Up @@ -133,10 +164,11 @@ golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
google.golang.org/protobuf v1.36.1 h1:yBPeRvTftaleIgM3PZ/WBIZ7XM/eEYAaEyCwvyjq/gk=
google.golang.org/protobuf v1.36.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Expand Down
19 changes: 11 additions & 8 deletions internal/sbi/api_nssaiavailability.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/free5gc/nssf/internal/util"
"github.com/free5gc/openapi"
"github.com/free5gc/openapi/models"
"github.com/free5gc/util/metrics/sbi"
)

func (s *Server) getNssaiAvailabilityRoutes() []Route {
Expand Down Expand Up @@ -86,7 +87,7 @@ func (s *Server) NSSAIAvailabilityDelete(c *gin.Context) {
Status: http.StatusBadRequest,
Cause: "UNSPECIFIED", // TODO: Check if this is the correct cause
}

c.Set(sbi.IN_PB_DETAILS_CTX_STR, problemDetails.Cause)
util.GinProblemJson(c, problemDetails)
return
}
Expand All @@ -106,7 +107,7 @@ func (s *Server) NSSAIAvailabilityPatch(c *gin.Context) {
Status: http.StatusBadRequest,
Cause: "UNSPECIFIED", // TODO: Check if this is the correct cause
}

c.Set(sbi.IN_PB_DETAILS_CTX_STR, problemDetails.Cause)
util.GinProblemJson(c, problemDetails)
return
}
Expand All @@ -119,7 +120,7 @@ func (s *Server) NSSAIAvailabilityPatch(c *gin.Context) {
Status: http.StatusInternalServerError,
Cause: "SYSTEM_FAILURE",
}

c.Set(sbi.IN_PB_DETAILS_CTX_STR, problemDetails.Cause)
util.GinProblemJson(c, problemDetails)
return
}
Expand All @@ -131,6 +132,7 @@ func (s *Server) NSSAIAvailabilityPatch(c *gin.Context) {
}

logger.SBILog.Errorf("Error deserializing patch document: %+v", err)
c.Set(sbi.IN_PB_DETAILS_CTX_STR, problemDetails.Cause)
util.GinProblemJson(c, problemDetails)
return
}
Expand Down Expand Up @@ -160,7 +162,7 @@ func (s *Server) NSSAIAvailabilityPut(c *gin.Context) {
Cause: "MALFORMED_REQUEST",
InvalidParams: util.BindErrorInvalidParamsMessages(err),
}

c.Set(sbi.IN_PB_DETAILS_CTX_STR, problemDetails.Cause)
util.GinProblemJson(c, problemDetails)
return
}
Expand All @@ -172,7 +174,7 @@ func (s *Server) NSSAIAvailabilityPut(c *gin.Context) {
Status: http.StatusInternalServerError,
Cause: "SYSTEM_FAILURE",
}

c.Set(sbi.IN_PB_DETAILS_CTX_STR, problemDetails.Cause)
util.GinProblemJson(c, problemDetails)
return
}
Expand All @@ -184,6 +186,7 @@ func (s *Server) NSSAIAvailabilityPut(c *gin.Context) {
}

logger.SBILog.Errorf("Error deserializing NSSAI availability info: %+v", err)
c.Set(sbi.IN_PB_DETAILS_CTX_STR, problemDetails.Cause)
util.GinProblemJson(c, problemDetails)
return
}
Expand All @@ -207,7 +210,7 @@ func (s *Server) NSSAIAvailabilityPost(c *gin.Context) {
Cause: "SYSTEM_FAILURE",
}
logger.NssaiavailLog.Errorf("Get Request Body error: %+v", err)

c.Set(sbi.IN_PB_DETAILS_CTX_STR, problemDetail.Cause)
util.GinProblemJson(c, problemDetail)
return
}
Expand All @@ -221,7 +224,7 @@ func (s *Server) NSSAIAvailabilityPost(c *gin.Context) {
Detail: problemDetail,
}
logger.NssaiavailLog.Errorln(problemDetail)

c.Set(sbi.IN_PB_DETAILS_CTX_STR, rsp.Title)
util.GinProblemJson(c, rsp)
return
}
Expand All @@ -240,7 +243,7 @@ func (s *Server) NSSAIAvailabilityUnsubscribeDelete(c *gin.Context) {
Status: http.StatusBadRequest,
Cause: "UNSPECIFIED", // TODO: Check if this is the correct cause
}

c.Set(sbi.IN_PB_DETAILS_CTX_STR, problemDetails.Cause)
util.GinProblemJson(c, problemDetails)
return
}
Expand Down
2 changes: 2 additions & 0 deletions internal/sbi/api_nsselection.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/free5gc/nssf/internal/sbi/processor"
"github.com/free5gc/nssf/internal/util"
"github.com/free5gc/openapi/models"
"github.com/free5gc/util/metrics/sbi"
)

func (s *Server) getNsSelectionRoutes() []Route {
Expand Down Expand Up @@ -44,6 +45,7 @@ func (s *Server) NetworkSliceInformationGet(c *gin.Context) {
Instance: "",
InvalidParams: util.BindErrorInvalidParamsMessages(err),
}
c.Set(sbi.IN_PB_DETAILS_CTX_STR, problemDetail.Title)
util.GinProblemJson(c, problemDetail)
return
}
Expand Down
2 changes: 2 additions & 0 deletions internal/sbi/consumer/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package consumer
import (
"github.com/free5gc/nssf/pkg/app"
"github.com/free5gc/openapi/nrf/NFManagement"
sbi_metrics "github.com/free5gc/util/metrics/sbi"
)

type Consumer struct {
Expand All @@ -14,6 +15,7 @@ type Consumer struct {
func NewConsumer(nssf app.NssfApp) *Consumer {
configuration := NFManagement.NewConfiguration()
configuration.SetBasePath(nssf.Context().NrfUri)
configuration.SetMetrics(sbi_metrics.SbiMetricHook)
nrfService := &NrfService{
nrfNfMgmtClient: NFManagement.NewAPIClient(configuration),
}
Expand Down
8 changes: 7 additions & 1 deletion internal/sbi/processor/nssaiavailability_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/free5gc/nssf/internal/util"
"github.com/free5gc/nssf/pkg/factory"
"github.com/free5gc/openapi/models"
"github.com/free5gc/util/metrics/sbi"
)

func (p *Processor) NssaiAvailabilityNfInstanceDelete(c *gin.Context, nfId string) {
Expand All @@ -41,6 +42,7 @@ func (p *Processor) NssaiAvailabilityNfInstanceDelete(c *gin.Context, nfId strin
Status: http.StatusNotFound,
Detail: fmt.Sprintf("AMF ID '%s' does not exist", nfId),
}
c.Set(sbi.IN_PB_DETAILS_CTX_STR, problemDetails.Title)
util.GinProblemJson(c, problemDetails)
}

Expand Down Expand Up @@ -90,6 +92,7 @@ func (p *Processor) NssaiAvailabilityNfInstancePatch(
Status: http.StatusNotFound,
Detail: fmt.Sprintf("AMF ID '%s' does not exist", nfId),
}
c.Set(sbi.IN_PB_DETAILS_CTX_STR, problemDetails.Title)
util.GinProblemJson(c, problemDetails)
return
}
Expand Down Expand Up @@ -118,6 +121,7 @@ func (p *Processor) NssaiAvailabilityNfInstancePatch(
Status: http.StatusBadRequest,
Detail: err.Error(),
}
c.Set(sbi.IN_PB_DETAILS_CTX_STR, problemDetails.Title)
util.GinProblemJson(c, problemDetails)
return
}
Expand All @@ -129,6 +133,7 @@ func (p *Processor) NssaiAvailabilityNfInstancePatch(
Status: http.StatusConflict,
Detail: err.Error(),
}
c.Set(sbi.IN_PB_DETAILS_CTX_STR, problemDetails.Title)
util.GinProblemJson(c, problemDetails)
return
}
Expand All @@ -142,6 +147,7 @@ func (p *Processor) NssaiAvailabilityNfInstancePatch(
Status: http.StatusBadRequest,
Detail: err.Error(),
}
c.Set(sbi.IN_PB_DETAILS_CTX_STR, problemDetails.Title)
util.GinProblemJson(c, problemDetails)
return
}
Expand Down Expand Up @@ -175,7 +181,7 @@ func (p *Processor) NssaiAvailabilityNfInstanceUpdate(
Detail: "S-NSSAI in Requested NSSAI is not supported in PLMN",
Cause: "SNSSAI_NOT_SUPPORTED",
}

c.Set(sbi.IN_PB_DETAILS_CTX_STR, problemDetails.Cause)
util.GinProblemJson(c, problemDetails)
return
}
Expand Down
5 changes: 3 additions & 2 deletions internal/sbi/processor/nssaiavailability_subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/free5gc/nssf/internal/util"
"github.com/free5gc/nssf/pkg/factory"
"github.com/free5gc/openapi/models"
"github.com/free5gc/util/metrics/sbi"
)

// Get available subscription ID from configuration
Expand Down Expand Up @@ -64,7 +65,7 @@ func (p *Processor) NssaiAvailabilitySubscriptionCreate(
Status: http.StatusNotFound,
Detail: err.Error(),
}

c.Set(sbi.IN_PB_DETAILS_CTX_STR, problemDetails.Title)
util.GinProblemJson(c, problemDetails)
return
}
Expand Down Expand Up @@ -106,6 +107,6 @@ func (p *Processor) NssaiAvailabilitySubscriptionUnsubscribe(c *gin.Context, sub
Status: http.StatusNotFound,
Detail: fmt.Sprintf("Subscription ID '%s' is not available", subscriptionId),
}

c.Set(sbi.IN_PB_DETAILS_CTX_STR, problemDetails.Title)
util.GinProblemJson(c, problemDetails)
}
Loading
Loading