Loading go-apps/meep-rnis/api/swagger.yaml +3 −0 Original line number Diff line number Diff line Loading @@ -2672,6 +2672,9 @@ components: type: string x-etsi-mec-cardinality: 0..1 x-etsi-mec-origin-type: URI required: - status - detail type: object RabEstNotification: properties: Loading go-apps/meep-rnis/server/convert.go +9 −0 Original line number Diff line number Diff line Loading @@ -242,3 +242,12 @@ func convertNrMeasRepUeSubscriptionToJson(obj *NrMeasRepUeSubscription) string { return string(jsonInfo) } func convertProblemDetailstoJson(probdetails *ProblemDetails) string { jsonInfo, err := json.Marshal(*probdetails) if err != nil { log.Error(err.Error()) return "" } return string(jsonInfo) } go-apps/meep-rnis/server/model_problem_details.go +2 −2 Original line number Diff line number Diff line Loading @@ -25,11 +25,11 @@ package server type ProblemDetails struct { // A human-readable explanation specific to this occurrence of the problem Detail string `json:"detail,omitempty"` Detail string `json:"detail"` // A URI reference that identifies the specific occurrence of the problem Instance string `json:"instance,omitempty"` // The HTTP status code for this occurrence of the problem Status int32 `json:"status,omitempty"` Status int32 `json:"status"` // A short, human-readable summary of the problem type Title string `json:"title,omitempty"` // A URI reference according to IETF RFC 3986 that identifies the problem type Loading go-apps/meep-rnis/server/rnis.go +65 −53 Original line number Diff line number Diff line Loading @@ -675,7 +675,8 @@ func mec011AppTerminationPost(w http.ResponseWriter, r *http.Request) { err := decoder.Decode(¬ification) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } Loading Loading @@ -2224,7 +2225,7 @@ func subscriptionsGet(w http.ResponseWriter, r *http.Request) { err := json.Unmarshal([]byte(jsonRespDB), &subscriptionCommon) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } Loading @@ -2235,7 +2236,7 @@ func subscriptionsGet(w http.ResponseWriter, r *http.Request) { err = json.Unmarshal([]byte(jsonRespDB), &subscription) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } Loading @@ -2246,7 +2247,7 @@ func subscriptionsGet(w http.ResponseWriter, r *http.Request) { err = json.Unmarshal([]byte(jsonRespDB), &subscription) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } Loading @@ -2257,7 +2258,7 @@ func subscriptionsGet(w http.ResponseWriter, r *http.Request) { err = json.Unmarshal([]byte(jsonRespDB), &subscription) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } Loading @@ -2268,7 +2269,7 @@ func subscriptionsGet(w http.ResponseWriter, r *http.Request) { err = json.Unmarshal([]byte(jsonRespDB), &subscription) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } Loading @@ -2279,7 +2280,7 @@ func subscriptionsGet(w http.ResponseWriter, r *http.Request) { err = json.Unmarshal([]byte(jsonRespDB), &subscription) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } Loading @@ -2293,7 +2294,7 @@ func subscriptionsGet(w http.ResponseWriter, r *http.Request) { if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } w.WriteHeader(http.StatusOK) Loading @@ -2309,7 +2310,7 @@ func subscriptionsPost(w http.ResponseWriter, r *http.Request) { err := json.Unmarshal(bodyBytes, &subscriptionCommon) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } Loading @@ -2319,7 +2320,7 @@ func subscriptionsPost(w http.ResponseWriter, r *http.Request) { //mandatory parameter if subscriptionCommon.CallbackReference == "" { log.Error("Mandatory CallbackReference parameter not present") http.Error(w, "Mandatory CallbackReference parameter not present", http.StatusBadRequest) errHandlerProblemDetails(w, "Mandatory CallbackReference parameter not present", http.StatusBadRequest) return } Loading @@ -2342,7 +2343,7 @@ func subscriptionsPost(w http.ResponseWriter, r *http.Request) { err = json.Unmarshal(bodyBytes, &subscription) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } Loading @@ -2350,7 +2351,7 @@ func subscriptionsPost(w http.ResponseWriter, r *http.Request) { if subscription.FilterCriteriaAssocHo == nil { log.Error("FilterCriteriaAssocHo should not be null for this subscription type") http.Error(w, "FilterCriteriaAssocHo should not be null for this subscription type", http.StatusBadRequest) errHandlerProblemDetails(w, "FilterCriteriaAssocHo should not be null for this subscription type", http.StatusBadRequest) return } Loading @@ -2361,7 +2362,7 @@ func subscriptionsPost(w http.ResponseWriter, r *http.Request) { for _, ecgi := range subscription.FilterCriteriaAssocHo.Ecgi { if ecgi.Plmn == nil || ecgi.CellId == "" { log.Error("For non null ecgi, plmn and cellId are mandatory") http.Error(w, "For non null ecgi, plmn and cellId are mandatory", http.StatusBadRequest) errHandlerProblemDetails(w, "For non null ecgi, plmn and cellId are mandatory", http.StatusBadRequest) return } } Loading @@ -2377,7 +2378,7 @@ func subscriptionsPost(w http.ResponseWriter, r *http.Request) { err = json.Unmarshal(bodyBytes, &subscription) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } Loading @@ -2385,20 +2386,20 @@ func subscriptionsPost(w http.ResponseWriter, r *http.Request) { if subscription.FilterCriteriaQci == nil { log.Error("FilterCriteriaQci should not be null for this subscription type") http.Error(w, "FilterCriteriaQci should not be null for this subscription type", http.StatusBadRequest) errHandlerProblemDetails(w, "FilterCriteriaQci should not be null for this subscription type", http.StatusBadRequest) return } if subscription.FilterCriteriaQci.Qci == 0 { log.Error("Missing or non valid value for mandatory Qci parameter in FilterCriteriaQci") http.Error(w, "Missing or non valid value for mandatory Qci parameter in FilterCriteriaQci", http.StatusBadRequest) errHandlerProblemDetails(w, "Missing or non valid value for mandatory Qci parameter in FilterCriteriaQci", http.StatusBadRequest) return } for _, ecgi := range subscription.FilterCriteriaQci.Ecgi { if ecgi.Plmn == nil || ecgi.CellId == "" { log.Error("For non null ecgi, plmn and cellId are mandatory") http.Error(w, "For non null ecgi, plmn and cellId are mandatory", http.StatusBadRequest) errHandlerProblemDetails(w, "For non null ecgi, plmn and cellId are mandatory", http.StatusBadRequest) return } } Loading @@ -2414,7 +2415,7 @@ func subscriptionsPost(w http.ResponseWriter, r *http.Request) { err = json.Unmarshal(bodyBytes, &subscription) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } Loading @@ -2422,26 +2423,26 @@ func subscriptionsPost(w http.ResponseWriter, r *http.Request) { if subscription.FilterCriteriaQci == nil { log.Error("FilterCriteriaQci should not be null for this subscription type") http.Error(w, "FilterCriteriaQci should not be null for this subscription type", http.StatusBadRequest) errHandlerProblemDetails(w, "FilterCriteriaQci should not be null for this subscription type", http.StatusBadRequest) return } if subscription.FilterCriteriaQci.Qci == 0 { log.Error("Missing or non valid value for mandatory Qci parameter in FilterCriteriaQci") http.Error(w, "Missing or non valid value for mandatory Qci parameter in FilterCriteriaQci", http.StatusBadRequest) errHandlerProblemDetails(w, "Missing or non valid value for mandatory Qci parameter in FilterCriteriaQci", http.StatusBadRequest) return } if subscription.FilterCriteriaQci.ErabId == 0 { log.Error("Missing or non valid value of 0 mandatory ErabId parameter in FilterCriteriaQci") http.Error(w, "Missing or non valid value of 0 for mandatory ErabId parameter in FilterCriteriaQci", http.StatusBadRequest) errHandlerProblemDetails(w, "Missing or non valid value of 0 for mandatory ErabId parameter in FilterCriteriaQci", http.StatusBadRequest) return } for _, ecgi := range subscription.FilterCriteriaQci.Ecgi { if ecgi.Plmn == nil || ecgi.CellId == "" { log.Error("For non null ecgi, plmn and cellId are mandatory") http.Error(w, "For non null ecgi, plmn and cellId are mandatory", http.StatusBadRequest) errHandlerProblemDetails(w, "For non null ecgi, plmn and cellId are mandatory", http.StatusBadRequest) return } } Loading @@ -2457,7 +2458,7 @@ func subscriptionsPost(w http.ResponseWriter, r *http.Request) { err = json.Unmarshal(bodyBytes, &subscription) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } Loading @@ -2465,14 +2466,14 @@ func subscriptionsPost(w http.ResponseWriter, r *http.Request) { if subscription.FilterCriteriaAssocTri == nil { log.Error("FilterCriteriaAssocTri should not be null for this subscription type") http.Error(w, "FilterCriteriaAssocTri should not be null for this subscription type", http.StatusBadRequest) errHandlerProblemDetails(w, "FilterCriteriaAssocTri should not be null for this subscription type", http.StatusBadRequest) return } for _, ecgi := range subscription.FilterCriteriaAssocTri.Ecgi { if ecgi.Plmn == nil || ecgi.CellId == "" { log.Error("For non null ecgi, plmn and cellId are mandatory") http.Error(w, "For non null ecgi, plmn and cellId are mandatory", http.StatusBadRequest) errHandlerProblemDetails(w, "For non null ecgi, plmn and cellId are mandatory", http.StatusBadRequest) return } } Loading Loading @@ -2501,7 +2502,7 @@ func subscriptionsPost(w http.ResponseWriter, r *http.Request) { err = json.Unmarshal(bodyBytes, &subscription) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } Loading @@ -2509,14 +2510,14 @@ func subscriptionsPost(w http.ResponseWriter, r *http.Request) { if subscription.FilterCriteriaNrMrs == nil { log.Error("FilterCriteriaNrMrs should not be null for this subscription type") http.Error(w, "FilterCriteriaNrMrs should not be null for this subscription type", http.StatusBadRequest) errHandlerProblemDetails(w, "FilterCriteriaNrMrs should not be null for this subscription type", http.StatusBadRequest) return } for _, nrcgi := range subscription.FilterCriteriaNrMrs.Nrcgi { if nrcgi.Plmn == nil || nrcgi.NrCellId == "" { log.Error("For non null nrcgi, plmn and cellId are mandatory") http.Error(w, "For non null nrcgi, plmn and cellId are mandatory", http.StatusBadRequest) errHandlerProblemDetails(w, "For non null nrcgi, plmn and cellId are mandatory", http.StatusBadRequest) return } } Loading Loading @@ -2548,7 +2549,7 @@ func subscriptionsPost(w http.ResponseWriter, r *http.Request) { //processing the error of the jsonResponse if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } w.WriteHeader(http.StatusCreated) Loading @@ -2567,7 +2568,7 @@ func subscriptionsPut(w http.ResponseWriter, r *http.Request) { err := json.Unmarshal(bodyBytes, &subscriptionCommon) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } //extract common body part Loading @@ -2576,14 +2577,14 @@ func subscriptionsPut(w http.ResponseWriter, r *http.Request) { //mandatory parameter if subscriptionCommon.CallbackReference == "" { log.Error("Mandatory CallbackReference parameter not present") http.Error(w, "Mandatory CallbackReference parameter not present", http.StatusBadRequest) errHandlerProblemDetails(w, "Mandatory CallbackReference parameter not present", http.StatusBadRequest) return } link := subscriptionCommon.Links if link == nil || link.Self == nil { log.Error("Mandatory Link parameter not present") http.Error(w, "Mandatory Link parameter not present", http.StatusBadRequest) errHandlerProblemDetails(w, "Mandatory Link parameter not present", http.StatusBadRequest) return } Loading @@ -2592,7 +2593,7 @@ func subscriptionsPut(w http.ResponseWriter, r *http.Request) { if subsIdStr != subIdParamStr { log.Error("SubscriptionId in endpoint and in body not matching") http.Error(w, "SubscriptionId in endpoint and in body not matching", http.StatusBadRequest) errHandlerProblemDetails(w, "SubscriptionId in endpoint and in body not matching", http.StatusBadRequest) return } Loading @@ -2605,13 +2606,13 @@ func subscriptionsPut(w http.ResponseWriter, r *http.Request) { err = json.Unmarshal(bodyBytes, &subscription) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } if subscription.FilterCriteriaAssocHo == nil { log.Error("FilterCriteriaAssocHo should not be null for this subscription type") http.Error(w, "FilterCriteriaAssocHo should not be null for this subscription type", http.StatusBadRequest) errHandlerProblemDetails(w, "FilterCriteriaAssocHo should not be null for this subscription type", http.StatusBadRequest) return } Loading @@ -2631,13 +2632,13 @@ func subscriptionsPut(w http.ResponseWriter, r *http.Request) { err = json.Unmarshal(bodyBytes, &subscription) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } if subscription.FilterCriteriaQci == nil { log.Error("FilterCriteriaQci should not be null for this subscription type") http.Error(w, "FilterCriteriaQci should not be null for this subscription type", http.StatusBadRequest) errHandlerProblemDetails(w, "FilterCriteriaQci should not be null for this subscription type", http.StatusBadRequest) return } Loading @@ -2653,13 +2654,13 @@ func subscriptionsPut(w http.ResponseWriter, r *http.Request) { err = json.Unmarshal(bodyBytes, &subscription) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } if subscription.FilterCriteriaQci == nil { log.Error("FilterCriteriaQci should not be null for this subscription type") http.Error(w, "FilterCriteriaQci should not be null for this subscription type", http.StatusBadRequest) errHandlerProblemDetails(w, "FilterCriteriaQci should not be null for this subscription type", http.StatusBadRequest) return } Loading @@ -2675,13 +2676,13 @@ func subscriptionsPut(w http.ResponseWriter, r *http.Request) { err = json.Unmarshal(bodyBytes, &subscription) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } if subscription.FilterCriteriaAssocTri == nil { log.Error("FilterCriteriaAssocTri should not be null for this subscription type") http.Error(w, "FilterCriteriaAssocTri should not be null for this subscription type", http.StatusBadRequest) errHandlerProblemDetails(w, "FilterCriteriaAssocTri should not be null for this subscription type", http.StatusBadRequest) return } Loading @@ -2697,13 +2698,13 @@ func subscriptionsPut(w http.ResponseWriter, r *http.Request) { err = json.Unmarshal(bodyBytes, &subscription) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } if subscription.FilterCriteriaNrMrs == nil { log.Error("FilterCriteriaNrMrs should not be null for this subscription type") http.Error(w, "FilterCriteriaNrMrs should not be null for this subscription type", http.StatusBadRequest) errHandlerProblemDetails(w, "FilterCriteriaNrMrs should not be null for this subscription type", http.StatusBadRequest) return } Loading @@ -2722,7 +2723,7 @@ func subscriptionsPut(w http.ResponseWriter, r *http.Request) { if alreadyRegistered { if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } w.WriteHeader(http.StatusOK) Loading @@ -2745,7 +2746,7 @@ func subscriptionsDelete(w http.ResponseWriter, r *http.Request) { err := delSubscription(baseKey+"subscriptions", subIdParamStr, false) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } Loading Loading @@ -3038,7 +3039,7 @@ func plmnInfoGet(w http.ResponseWriter, r *http.Request) { err := rc.ForEachJSONEntry(keyName, populatePlmnInfo, &response) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } //check if more than one plmnInfo in the array Loading @@ -3050,7 +3051,7 @@ func plmnInfoGet(w http.ResponseWriter, r *http.Request) { jsonResponse, err := json.Marshal(response.PlmnInfoList) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } Loading Loading @@ -3132,7 +3133,7 @@ func layer2MeasInfoGet(w http.ResponseWriter, r *http.Request) { err := rc.ForEachJSONEntry(keyName, populateL2Meas, &l2MeasData) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } Loading @@ -3141,7 +3142,7 @@ func layer2MeasInfoGet(w http.ResponseWriter, r *http.Request) { err = rc.ForEachJSONEntry(keyName, populateL2MeasPOA, &l2MeasData) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } Loading @@ -3151,7 +3152,7 @@ func layer2MeasInfoGet(w http.ResponseWriter, r *http.Request) { jsonResponse, err := json.Marshal(l2Meas) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } w.WriteHeader(http.StatusOK) Loading Loading @@ -3530,7 +3531,7 @@ func rabInfoGet(w http.ResponseWriter, r *http.Request) { err := rc.ForEachJSONEntry(keyName, populateRabInfo, &rabInfoData) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } Loading @@ -3543,7 +3544,7 @@ func rabInfoGet(w http.ResponseWriter, r *http.Request) { jsonResponse, err := json.Marshal(rabInfo) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } w.WriteHeader(http.StatusOK) Loading Loading @@ -3789,7 +3790,7 @@ func subscriptionLinkListSubscriptionsGet(w http.ResponseWriter, r *http.Request jsonResponse, err := json.Marshal(response) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } w.WriteHeader(http.StatusOK) Loading Loading @@ -3838,3 +3839,14 @@ func updateStoreName(storeName string) { } } func errHandlerProblemDetails(w http.ResponseWriter, error string, code int) { var pd ProblemDetails pd.Detail = error pd.Status = int32(code) jsonResponse := convertProblemDetailstoJson(&pd) w.WriteHeader(code) fmt.Fprint(w, jsonResponse) } Loading
go-apps/meep-rnis/api/swagger.yaml +3 −0 Original line number Diff line number Diff line Loading @@ -2672,6 +2672,9 @@ components: type: string x-etsi-mec-cardinality: 0..1 x-etsi-mec-origin-type: URI required: - status - detail type: object RabEstNotification: properties: Loading
go-apps/meep-rnis/server/convert.go +9 −0 Original line number Diff line number Diff line Loading @@ -242,3 +242,12 @@ func convertNrMeasRepUeSubscriptionToJson(obj *NrMeasRepUeSubscription) string { return string(jsonInfo) } func convertProblemDetailstoJson(probdetails *ProblemDetails) string { jsonInfo, err := json.Marshal(*probdetails) if err != nil { log.Error(err.Error()) return "" } return string(jsonInfo) }
go-apps/meep-rnis/server/model_problem_details.go +2 −2 Original line number Diff line number Diff line Loading @@ -25,11 +25,11 @@ package server type ProblemDetails struct { // A human-readable explanation specific to this occurrence of the problem Detail string `json:"detail,omitempty"` Detail string `json:"detail"` // A URI reference that identifies the specific occurrence of the problem Instance string `json:"instance,omitempty"` // The HTTP status code for this occurrence of the problem Status int32 `json:"status,omitempty"` Status int32 `json:"status"` // A short, human-readable summary of the problem type Title string `json:"title,omitempty"` // A URI reference according to IETF RFC 3986 that identifies the problem type Loading
go-apps/meep-rnis/server/rnis.go +65 −53 Original line number Diff line number Diff line Loading @@ -675,7 +675,8 @@ func mec011AppTerminationPost(w http.ResponseWriter, r *http.Request) { err := decoder.Decode(¬ification) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } Loading Loading @@ -2224,7 +2225,7 @@ func subscriptionsGet(w http.ResponseWriter, r *http.Request) { err := json.Unmarshal([]byte(jsonRespDB), &subscriptionCommon) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } Loading @@ -2235,7 +2236,7 @@ func subscriptionsGet(w http.ResponseWriter, r *http.Request) { err = json.Unmarshal([]byte(jsonRespDB), &subscription) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } Loading @@ -2246,7 +2247,7 @@ func subscriptionsGet(w http.ResponseWriter, r *http.Request) { err = json.Unmarshal([]byte(jsonRespDB), &subscription) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } Loading @@ -2257,7 +2258,7 @@ func subscriptionsGet(w http.ResponseWriter, r *http.Request) { err = json.Unmarshal([]byte(jsonRespDB), &subscription) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } Loading @@ -2268,7 +2269,7 @@ func subscriptionsGet(w http.ResponseWriter, r *http.Request) { err = json.Unmarshal([]byte(jsonRespDB), &subscription) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } Loading @@ -2279,7 +2280,7 @@ func subscriptionsGet(w http.ResponseWriter, r *http.Request) { err = json.Unmarshal([]byte(jsonRespDB), &subscription) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } Loading @@ -2293,7 +2294,7 @@ func subscriptionsGet(w http.ResponseWriter, r *http.Request) { if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } w.WriteHeader(http.StatusOK) Loading @@ -2309,7 +2310,7 @@ func subscriptionsPost(w http.ResponseWriter, r *http.Request) { err := json.Unmarshal(bodyBytes, &subscriptionCommon) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } Loading @@ -2319,7 +2320,7 @@ func subscriptionsPost(w http.ResponseWriter, r *http.Request) { //mandatory parameter if subscriptionCommon.CallbackReference == "" { log.Error("Mandatory CallbackReference parameter not present") http.Error(w, "Mandatory CallbackReference parameter not present", http.StatusBadRequest) errHandlerProblemDetails(w, "Mandatory CallbackReference parameter not present", http.StatusBadRequest) return } Loading @@ -2342,7 +2343,7 @@ func subscriptionsPost(w http.ResponseWriter, r *http.Request) { err = json.Unmarshal(bodyBytes, &subscription) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } Loading @@ -2350,7 +2351,7 @@ func subscriptionsPost(w http.ResponseWriter, r *http.Request) { if subscription.FilterCriteriaAssocHo == nil { log.Error("FilterCriteriaAssocHo should not be null for this subscription type") http.Error(w, "FilterCriteriaAssocHo should not be null for this subscription type", http.StatusBadRequest) errHandlerProblemDetails(w, "FilterCriteriaAssocHo should not be null for this subscription type", http.StatusBadRequest) return } Loading @@ -2361,7 +2362,7 @@ func subscriptionsPost(w http.ResponseWriter, r *http.Request) { for _, ecgi := range subscription.FilterCriteriaAssocHo.Ecgi { if ecgi.Plmn == nil || ecgi.CellId == "" { log.Error("For non null ecgi, plmn and cellId are mandatory") http.Error(w, "For non null ecgi, plmn and cellId are mandatory", http.StatusBadRequest) errHandlerProblemDetails(w, "For non null ecgi, plmn and cellId are mandatory", http.StatusBadRequest) return } } Loading @@ -2377,7 +2378,7 @@ func subscriptionsPost(w http.ResponseWriter, r *http.Request) { err = json.Unmarshal(bodyBytes, &subscription) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } Loading @@ -2385,20 +2386,20 @@ func subscriptionsPost(w http.ResponseWriter, r *http.Request) { if subscription.FilterCriteriaQci == nil { log.Error("FilterCriteriaQci should not be null for this subscription type") http.Error(w, "FilterCriteriaQci should not be null for this subscription type", http.StatusBadRequest) errHandlerProblemDetails(w, "FilterCriteriaQci should not be null for this subscription type", http.StatusBadRequest) return } if subscription.FilterCriteriaQci.Qci == 0 { log.Error("Missing or non valid value for mandatory Qci parameter in FilterCriteriaQci") http.Error(w, "Missing or non valid value for mandatory Qci parameter in FilterCriteriaQci", http.StatusBadRequest) errHandlerProblemDetails(w, "Missing or non valid value for mandatory Qci parameter in FilterCriteriaQci", http.StatusBadRequest) return } for _, ecgi := range subscription.FilterCriteriaQci.Ecgi { if ecgi.Plmn == nil || ecgi.CellId == "" { log.Error("For non null ecgi, plmn and cellId are mandatory") http.Error(w, "For non null ecgi, plmn and cellId are mandatory", http.StatusBadRequest) errHandlerProblemDetails(w, "For non null ecgi, plmn and cellId are mandatory", http.StatusBadRequest) return } } Loading @@ -2414,7 +2415,7 @@ func subscriptionsPost(w http.ResponseWriter, r *http.Request) { err = json.Unmarshal(bodyBytes, &subscription) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } Loading @@ -2422,26 +2423,26 @@ func subscriptionsPost(w http.ResponseWriter, r *http.Request) { if subscription.FilterCriteriaQci == nil { log.Error("FilterCriteriaQci should not be null for this subscription type") http.Error(w, "FilterCriteriaQci should not be null for this subscription type", http.StatusBadRequest) errHandlerProblemDetails(w, "FilterCriteriaQci should not be null for this subscription type", http.StatusBadRequest) return } if subscription.FilterCriteriaQci.Qci == 0 { log.Error("Missing or non valid value for mandatory Qci parameter in FilterCriteriaQci") http.Error(w, "Missing or non valid value for mandatory Qci parameter in FilterCriteriaQci", http.StatusBadRequest) errHandlerProblemDetails(w, "Missing or non valid value for mandatory Qci parameter in FilterCriteriaQci", http.StatusBadRequest) return } if subscription.FilterCriteriaQci.ErabId == 0 { log.Error("Missing or non valid value of 0 mandatory ErabId parameter in FilterCriteriaQci") http.Error(w, "Missing or non valid value of 0 for mandatory ErabId parameter in FilterCriteriaQci", http.StatusBadRequest) errHandlerProblemDetails(w, "Missing or non valid value of 0 for mandatory ErabId parameter in FilterCriteriaQci", http.StatusBadRequest) return } for _, ecgi := range subscription.FilterCriteriaQci.Ecgi { if ecgi.Plmn == nil || ecgi.CellId == "" { log.Error("For non null ecgi, plmn and cellId are mandatory") http.Error(w, "For non null ecgi, plmn and cellId are mandatory", http.StatusBadRequest) errHandlerProblemDetails(w, "For non null ecgi, plmn and cellId are mandatory", http.StatusBadRequest) return } } Loading @@ -2457,7 +2458,7 @@ func subscriptionsPost(w http.ResponseWriter, r *http.Request) { err = json.Unmarshal(bodyBytes, &subscription) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } Loading @@ -2465,14 +2466,14 @@ func subscriptionsPost(w http.ResponseWriter, r *http.Request) { if subscription.FilterCriteriaAssocTri == nil { log.Error("FilterCriteriaAssocTri should not be null for this subscription type") http.Error(w, "FilterCriteriaAssocTri should not be null for this subscription type", http.StatusBadRequest) errHandlerProblemDetails(w, "FilterCriteriaAssocTri should not be null for this subscription type", http.StatusBadRequest) return } for _, ecgi := range subscription.FilterCriteriaAssocTri.Ecgi { if ecgi.Plmn == nil || ecgi.CellId == "" { log.Error("For non null ecgi, plmn and cellId are mandatory") http.Error(w, "For non null ecgi, plmn and cellId are mandatory", http.StatusBadRequest) errHandlerProblemDetails(w, "For non null ecgi, plmn and cellId are mandatory", http.StatusBadRequest) return } } Loading Loading @@ -2501,7 +2502,7 @@ func subscriptionsPost(w http.ResponseWriter, r *http.Request) { err = json.Unmarshal(bodyBytes, &subscription) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } Loading @@ -2509,14 +2510,14 @@ func subscriptionsPost(w http.ResponseWriter, r *http.Request) { if subscription.FilterCriteriaNrMrs == nil { log.Error("FilterCriteriaNrMrs should not be null for this subscription type") http.Error(w, "FilterCriteriaNrMrs should not be null for this subscription type", http.StatusBadRequest) errHandlerProblemDetails(w, "FilterCriteriaNrMrs should not be null for this subscription type", http.StatusBadRequest) return } for _, nrcgi := range subscription.FilterCriteriaNrMrs.Nrcgi { if nrcgi.Plmn == nil || nrcgi.NrCellId == "" { log.Error("For non null nrcgi, plmn and cellId are mandatory") http.Error(w, "For non null nrcgi, plmn and cellId are mandatory", http.StatusBadRequest) errHandlerProblemDetails(w, "For non null nrcgi, plmn and cellId are mandatory", http.StatusBadRequest) return } } Loading Loading @@ -2548,7 +2549,7 @@ func subscriptionsPost(w http.ResponseWriter, r *http.Request) { //processing the error of the jsonResponse if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } w.WriteHeader(http.StatusCreated) Loading @@ -2567,7 +2568,7 @@ func subscriptionsPut(w http.ResponseWriter, r *http.Request) { err := json.Unmarshal(bodyBytes, &subscriptionCommon) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } //extract common body part Loading @@ -2576,14 +2577,14 @@ func subscriptionsPut(w http.ResponseWriter, r *http.Request) { //mandatory parameter if subscriptionCommon.CallbackReference == "" { log.Error("Mandatory CallbackReference parameter not present") http.Error(w, "Mandatory CallbackReference parameter not present", http.StatusBadRequest) errHandlerProblemDetails(w, "Mandatory CallbackReference parameter not present", http.StatusBadRequest) return } link := subscriptionCommon.Links if link == nil || link.Self == nil { log.Error("Mandatory Link parameter not present") http.Error(w, "Mandatory Link parameter not present", http.StatusBadRequest) errHandlerProblemDetails(w, "Mandatory Link parameter not present", http.StatusBadRequest) return } Loading @@ -2592,7 +2593,7 @@ func subscriptionsPut(w http.ResponseWriter, r *http.Request) { if subsIdStr != subIdParamStr { log.Error("SubscriptionId in endpoint and in body not matching") http.Error(w, "SubscriptionId in endpoint and in body not matching", http.StatusBadRequest) errHandlerProblemDetails(w, "SubscriptionId in endpoint and in body not matching", http.StatusBadRequest) return } Loading @@ -2605,13 +2606,13 @@ func subscriptionsPut(w http.ResponseWriter, r *http.Request) { err = json.Unmarshal(bodyBytes, &subscription) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } if subscription.FilterCriteriaAssocHo == nil { log.Error("FilterCriteriaAssocHo should not be null for this subscription type") http.Error(w, "FilterCriteriaAssocHo should not be null for this subscription type", http.StatusBadRequest) errHandlerProblemDetails(w, "FilterCriteriaAssocHo should not be null for this subscription type", http.StatusBadRequest) return } Loading @@ -2631,13 +2632,13 @@ func subscriptionsPut(w http.ResponseWriter, r *http.Request) { err = json.Unmarshal(bodyBytes, &subscription) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } if subscription.FilterCriteriaQci == nil { log.Error("FilterCriteriaQci should not be null for this subscription type") http.Error(w, "FilterCriteriaQci should not be null for this subscription type", http.StatusBadRequest) errHandlerProblemDetails(w, "FilterCriteriaQci should not be null for this subscription type", http.StatusBadRequest) return } Loading @@ -2653,13 +2654,13 @@ func subscriptionsPut(w http.ResponseWriter, r *http.Request) { err = json.Unmarshal(bodyBytes, &subscription) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } if subscription.FilterCriteriaQci == nil { log.Error("FilterCriteriaQci should not be null for this subscription type") http.Error(w, "FilterCriteriaQci should not be null for this subscription type", http.StatusBadRequest) errHandlerProblemDetails(w, "FilterCriteriaQci should not be null for this subscription type", http.StatusBadRequest) return } Loading @@ -2675,13 +2676,13 @@ func subscriptionsPut(w http.ResponseWriter, r *http.Request) { err = json.Unmarshal(bodyBytes, &subscription) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } if subscription.FilterCriteriaAssocTri == nil { log.Error("FilterCriteriaAssocTri should not be null for this subscription type") http.Error(w, "FilterCriteriaAssocTri should not be null for this subscription type", http.StatusBadRequest) errHandlerProblemDetails(w, "FilterCriteriaAssocTri should not be null for this subscription type", http.StatusBadRequest) return } Loading @@ -2697,13 +2698,13 @@ func subscriptionsPut(w http.ResponseWriter, r *http.Request) { err = json.Unmarshal(bodyBytes, &subscription) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } if subscription.FilterCriteriaNrMrs == nil { log.Error("FilterCriteriaNrMrs should not be null for this subscription type") http.Error(w, "FilterCriteriaNrMrs should not be null for this subscription type", http.StatusBadRequest) errHandlerProblemDetails(w, "FilterCriteriaNrMrs should not be null for this subscription type", http.StatusBadRequest) return } Loading @@ -2722,7 +2723,7 @@ func subscriptionsPut(w http.ResponseWriter, r *http.Request) { if alreadyRegistered { if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } w.WriteHeader(http.StatusOK) Loading @@ -2745,7 +2746,7 @@ func subscriptionsDelete(w http.ResponseWriter, r *http.Request) { err := delSubscription(baseKey+"subscriptions", subIdParamStr, false) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } Loading Loading @@ -3038,7 +3039,7 @@ func plmnInfoGet(w http.ResponseWriter, r *http.Request) { err := rc.ForEachJSONEntry(keyName, populatePlmnInfo, &response) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } //check if more than one plmnInfo in the array Loading @@ -3050,7 +3051,7 @@ func plmnInfoGet(w http.ResponseWriter, r *http.Request) { jsonResponse, err := json.Marshal(response.PlmnInfoList) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } Loading Loading @@ -3132,7 +3133,7 @@ func layer2MeasInfoGet(w http.ResponseWriter, r *http.Request) { err := rc.ForEachJSONEntry(keyName, populateL2Meas, &l2MeasData) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } Loading @@ -3141,7 +3142,7 @@ func layer2MeasInfoGet(w http.ResponseWriter, r *http.Request) { err = rc.ForEachJSONEntry(keyName, populateL2MeasPOA, &l2MeasData) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } Loading @@ -3151,7 +3152,7 @@ func layer2MeasInfoGet(w http.ResponseWriter, r *http.Request) { jsonResponse, err := json.Marshal(l2Meas) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } w.WriteHeader(http.StatusOK) Loading Loading @@ -3530,7 +3531,7 @@ func rabInfoGet(w http.ResponseWriter, r *http.Request) { err := rc.ForEachJSONEntry(keyName, populateRabInfo, &rabInfoData) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } Loading @@ -3543,7 +3544,7 @@ func rabInfoGet(w http.ResponseWriter, r *http.Request) { jsonResponse, err := json.Marshal(rabInfo) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } w.WriteHeader(http.StatusOK) Loading Loading @@ -3789,7 +3790,7 @@ func subscriptionLinkListSubscriptionsGet(w http.ResponseWriter, r *http.Request jsonResponse, err := json.Marshal(response) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } w.WriteHeader(http.StatusOK) Loading Loading @@ -3838,3 +3839,14 @@ func updateStoreName(storeName string) { } } func errHandlerProblemDetails(w http.ResponseWriter, error string, code int) { var pd ProblemDetails pd.Detail = error pd.Status = int32(code) jsonResponse := convertProblemDetailstoJson(&pd) w.WriteHeader(code) fmt.Fprint(w, jsonResponse) }