Skip to content
Snippets Groups Projects
Commit cce416a9 authored by Ikram Haq's avatar Ikram Haq
Browse files

Add appProfile attributes functionality in PUT method

parent 31b3e219
No related branches found
No related tags found
1 merge request!1Merge CAPIF into MEC Federation branch for ETSI SNS4SNS demo
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment