diff --git a/go-apps/meep-app-enablement/server/app-support/app-support.go b/go-apps/meep-app-enablement/server/app-support/app-support.go index a79558356b4098cceef9e34eec889b6a7ae6eed0..1e1e897df2d3fcdb59f93a3115224f03af26bf75 100644 --- a/go-apps/meep-app-enablement/server/app-support/app-support.go +++ b/go-apps/meep-app-enablement/server/app-support/app-support.go @@ -704,6 +704,17 @@ func appRegistrationPOST(w http.ResponseWriter, r *http.Request) { } } + if appInfo.AppProfile.EasId == "" { + log.Error("Mandatory easId parameter should be present") + errHandlerProblemDetails(w, "Mandatory attribute easId is missing in the request body.", http.StatusBadRequest) + return + } + + if appInfo.AppName != appInfo.AppProfile.EasId { + log.Error("AppName in AppInfo does not match EasId in appProfile") + errHandlerProblemDetails(w, "AppName and EasId must be consistent", http.StatusBadRequest) + return + } // Additional consistency checks for fields like scheds, svcArea, etc., based on appProfile attributes } @@ -870,6 +881,34 @@ func appRegistrationPUT(w http.ResponseWriter, r *http.Request) { errHandlerProblemDetails(w, "Shall be present when IsInsByMec is FALSE.", http.StatusBadRequest) return } + // Process appProfile if present + if appInfoPut.AppProfile != nil { + // Validate appProvider, endpoint, and other fields as per mapping to EASProfile + if appInfoPut.AppProvider != appInfoPut.AppProfile.ProvId { + log.Error("appProvider in AppInfo does not match provId in appProfile") + errHandlerProblemDetails(w, "appProvider and provId must be consistent", http.StatusBadRequest) + return + } + + if appInfoPut.AppProfile != nil { + if !reflect.DeepEqual(getEndpointUris(appInfoPut.Endpoint), getProfileEndpointUris(appInfoPut.AppProfile.EndPt)) { + log.Error("endpoint in AppInfo does not match endPt in appProfile") + errHandlerProblemDetails(w, "Endpoint and endPt must be consistent", http.StatusBadRequest) + return + } + } + if appInfoPut.AppProfile.EasId == "" { + log.Error("Mandatory easId parameter should be present") + errHandlerProblemDetails(w, "Mandatory attribute easId is missing in the request body.", http.StatusBadRequest) + return + } + if appInfoPut.AppName != appInfoPut.AppProfile.EasId { + log.Error("AppName in AppInfo does not match EasId in appProfile") + errHandlerProblemDetails(w, "AppName and EasId must be consistent", http.StatusBadRequest) + return + } + // Additional consistency checks for fields like scheds, svcArea, etc., based on appProfile attributes + } appInfoPut.AppInstanceId = appInstanceId