diff --git a/go.mod b/go.mod index 0590834..89f49da 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/free5gc/aper v1.0.6-0.20240503143507-2c4c4780b98f github.com/free5gc/nas v1.1.4-0.20241107083120-4605e0d39ece github.com/free5gc/ngap v1.0.9-0.20241107082718-d359a67ebfa2 - github.com/free5gc/openapi v1.0.9-0.20241112160830-092c679ef6cd + github.com/free5gc/openapi v1.0.9-0.20241116070448-943255152229 github.com/free5gc/sctp v1.0.1 github.com/free5gc/util v1.0.6 github.com/gin-gonic/gin v1.9.1 diff --git a/go.sum b/go.sum index ed17ea1..4fb9cce 100644 --- a/go.sum +++ b/go.sum @@ -27,8 +27,8 @@ github.com/free5gc/nas v1.1.4-0.20241107083120-4605e0d39ece h1:IC+OGynaXwurS2RIf github.com/free5gc/nas v1.1.4-0.20241107083120-4605e0d39ece/go.mod h1:/k8oW94r7D+lKAIFSIxZz0Qg/0tod/+oCJbsVZ2E7SU= github.com/free5gc/ngap v1.0.9-0.20241107082718-d359a67ebfa2 h1:LMqqxvoDZAoG9xtfd5hhOiIDnPawSVcYof1nb6IkoWE= github.com/free5gc/ngap v1.0.9-0.20241107082718-d359a67ebfa2/go.mod h1:uw13NF8Zdqp9LXlQCn9Xp2Ju3LSyki0GTyWEUAbUDbk= -github.com/free5gc/openapi v1.0.9-0.20241112160830-092c679ef6cd h1:VRxE3QzfL1uU8ZnR9Y1aXtslHPeMIVoHb3wU0yOz2AI= -github.com/free5gc/openapi v1.0.9-0.20241112160830-092c679ef6cd/go.mod h1:aKw6uGzEibGDrn9++w4/JpWxaaUBo7GaqsvuFKU9fl4= +github.com/free5gc/openapi v1.0.9-0.20241116070448-943255152229 h1:w3pvwFI5XABoj2J22Hrnn5rIbe0hJFzvsJCIsv8AX44= +github.com/free5gc/openapi v1.0.9-0.20241116070448-943255152229/go.mod h1:aKw6uGzEibGDrn9++w4/JpWxaaUBo7GaqsvuFKU9fl4= github.com/free5gc/sctp v1.0.1 h1:g8WDO97r8B9ubkT5Hyk9b4I1fZUOii9Z39gQ2eRaASo= github.com/free5gc/sctp v1.0.1/go.mod h1:7QXfRWCmlkBGD0EIu3qL5o71bslfIakydz4h2QDZdjQ= github.com/free5gc/util v1.0.6 h1:dBt9drcXtYKE/cY5XuQcuffgsYclPIpIArhSeS6M+DQ= @@ -45,6 +45,7 @@ github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ4 github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= +github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= @@ -56,6 +57,7 @@ github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MG github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= diff --git a/internal/sbi/api_httpcallback.go b/internal/sbi/api_httpcallback.go index 495bab0..e23d8a8 100644 --- a/internal/sbi/api_httpcallback.go +++ b/internal/sbi/api_httpcallback.go @@ -111,21 +111,9 @@ func (s *Server) HTTPAmPolicyControlUpdateNotifyTerminate(c *gin.Context) { func (s *Server) HTTPN1MessageNotify(c *gin.Context) { var n1MessageNotify models.N1MessageNotifyRequest + n1MessageNotify.JsonData = new(models.N1MessageNotification) - requestBody, err := c.GetRawData() - if err != nil { - logger.CallbackLog.Errorf("Get Request Body error: %+v", err) - problemDetail := models.ProblemDetails{ - Title: "System failure", - Status: http.StatusInternalServerError, - Detail: err.Error(), - Cause: "SYSTEM_FAILURE", - } - c.JSON(http.StatusInternalServerError, problemDetail) - return - } - - err = openapi.Deserialize(&n1MessageNotify, requestBody, "application/json") + err := c.ShouldBindWith(&n1MessageNotify, openapi.MultipartRelatedBinding{}) if err != nil { problemDetail := reqbody + err.Error() rsp := models.ProblemDetails{ diff --git a/internal/sbi/processor/callback.go b/internal/sbi/processor/callback.go index cef6f57..8418038 100644 --- a/internal/sbi/processor/callback.go +++ b/internal/sbi/processor/callback.go @@ -263,7 +263,7 @@ func (p *Processor) N1MessageNotifyProcedure(n1MessageNotify models.N1MessageNot amfSelf := context.GetSelf() registrationCtxtContainer := n1MessageNotify.JsonData.RegistrationCtxtContainer - if registrationCtxtContainer.UeContext == nil { + if registrationCtxtContainer == nil || registrationCtxtContainer.UeContext == nil { problemDetails := &models.ProblemDetails{ Status: http.StatusBadRequest, Cause: "MANDATORY_IE_MISSING", // Defined in TS 29.500 5.2.7.2 @@ -274,6 +274,8 @@ func (p *Processor) N1MessageNotifyProcedure(n1MessageNotify models.N1MessageNot ran, ok := amfSelf.AmfRanFindByRanID(*registrationCtxtContainer.RanNodeId) if !ok { + logger.CallbackLog.Warnln("AmfRanFindByRanID not found: ", *registrationCtxtContainer.RanNodeId) + problemDetails := &models.ProblemDetails{ Status: http.StatusBadRequest, Cause: "MANDATORY_IE_INCORRECT",