99 "github.com/free5gc/openapi/models"
1010 "github.com/free5gc/udm/internal/logger"
1111 "github.com/free5gc/util/metrics/sbi"
12+ "github.com/free5gc/util/validator"
1213)
1314
1415func (s * Server ) getHttpCallBackRoutes () []Route {
@@ -23,7 +24,7 @@ func (s *Server) getHttpCallBackRoutes() []Route {
2324 {
2425 "DataChangeNotificationToNF" ,
2526 http .MethodPost ,
26- "/sdm-subscriptions" ,
27+ "/:supi/ sdm-subscriptions" ,
2728 s .HandleDataChangeNotificationToNF ,
2829 },
2930 }
@@ -59,7 +60,33 @@ func (s *Server) HandleDataChangeNotificationToNF(c *gin.Context) {
5960 return
6061 }
6162
63+ // TS 29.503 6.1.6.2.21
64+ if len (dataChangeNotify .NotifyItems ) == 0 {
65+ problemDetail := models.ProblemDetails {
66+ Title : "Missing or invalid parameter" ,
67+ Status : http .StatusBadRequest ,
68+ Detail : "Mandatory IE NotifyItems is missing or invalid" ,
69+ Cause : "MANDATORY_IE_MISSING" ,
70+ }
71+ logger .CallbackLog .Warnln ("Mandatory IE NotifyItems is missing or invalid" )
72+ c .Set (sbi .IN_PB_DETAILS_CTX_STR , http .StatusText (int (problemDetail .Status )))
73+ c .JSON (int (problemDetail .Status ), problemDetail )
74+ return
75+ }
76+
6277 supi := c .Params .ByName ("supi" )
78+ if ! validator .IsValidSupi (supi ) {
79+ problemDetail := models.ProblemDetails {
80+ Title : "Invalid Supi format" ,
81+ Status : http .StatusBadRequest ,
82+ Detail : "The Supi format is invalid" ,
83+ Cause : "MANDATORY_IE_INCORRECT" ,
84+ }
85+ logger .UecmLog .Warnf ("Registration Reject: Invalid Supi format [%s]" , supi )
86+ c .Set (sbi .IN_PB_DETAILS_CTX_STR , http .StatusText (int (problemDetail .Status )))
87+ c .JSON (int (problemDetail .Status ), problemDetail )
88+ return
89+ }
6390
6491 logger .CallbackLog .Infof ("Handle DataChangeNotificationToNF" )
6592
0 commit comments