Loading go-apps/meep-vis/server/vis.go +36 −11 Original line number Diff line number Diff line Loading @@ -943,6 +943,12 @@ func subscriptionsPost(w http.ResponseWriter, r *http.Request) { return } if extractSubType.CallbackReference == "" && extractSubType.WebsockNotifConfig.WebsocketUri == "" { log.Error("At least one of CallbackReference and WebsockNotifConfig parameters should be present") errHandlerProblemDetails(w, "At least one of CallbackReference and WebsockNotifConfig parameters should be present.", http.StatusBadRequest) return } //extract subscription type subscriptionType := extractSubType.SubscriptionType Loading Loading @@ -1288,10 +1294,22 @@ func individualSubscriptionPut(w http.ResponseWriter, r *http.Request) { //extract common body part subscriptionType := subscriptionCommon.SubscriptionType //mandatory parameter if subscriptionCommon.CallbackReference == "" { log.Error("Mandatory CallbackReference parameter not present") errHandlerProblemDetails(w, "Mandatory CallbackReference parameter not present", http.StatusBadRequest) // Validating mandatory parameters provided in the request body if subscriptionCommon.SubscriptionType == "" { log.Error("Mandatory SubscriptionType parameter should be present") errHandlerProblemDetails(w, "Mandatory attribute SubscriptionType is missing in the request body.", http.StatusBadRequest) return } if subscriptionCommon.FilterCriteria == nil { log.Error("FilterCriteria should not be null for this subscription type") errHandlerProblemDetails(w, "Mandatory attribute FilterCriteria is missing for this subscription type", http.StatusBadRequest) return } if subscriptionCommon.CallbackReference == "" && subscriptionCommon.WebsockNotifConfig.WebsocketUri == "" { log.Error("At least one of CallbackReference and WebsockNotifConfig parameters should be present") errHandlerProblemDetails(w, "At least one of CallbackReference and WebsockNotifConfig parameters should be present.", http.StatusBadRequest) return } Loading Loading @@ -1324,17 +1342,24 @@ func individualSubscriptionPut(w http.ResponseWriter, r *http.Request) { return } if subscription.FilterCriteria == nil { log.Error("FilterCriteria should not be null for this subscription type") errHandlerProblemDetails(w, "FilterCriteria should not be null for this subscription type", http.StatusBadRequest) if subscription.FilterCriteria.StdOrganization == "" { log.Error("Mandatory StdOrganization parameter should be present") errHandlerProblemDetails(w, "Mandatory attribute StdOrganization is missing in the request body.", http.StatusBadRequest) return } if subscription.FilterCriteria.StdOrganization != "ETSI" { log.Error("StdOrganizaztion should not be other than ETSI for this subscription type") errHandlerProblemDetails(w, "StdOrganizaztion should not be other than ETSI for this subscription type", http.StatusBadRequest) for _, msgTypeString := range subscription.FilterCriteria.MsgType { msgTypeInt, err := strconv.Atoi(msgTypeString) if msgTypeInt < 1 || msgTypeInt > 13 { log.Error("MsgType parameter should be between 1 and 13") errHandlerProblemDetails(w, "MsgType parameter should be between 1 and 13 in the request body.", http.StatusBadRequest) return } else if err != nil { log.Error("MsgType parameter should be between 1 and 13") errHandlerProblemDetails(w, "MsgType parameter should be between 1 and 13 in the request body.", http.StatusBadRequest) return } } //registration if isSubscriptionIdRegisteredV2x(subsIdStr) { Loading Loading
go-apps/meep-vis/server/vis.go +36 −11 Original line number Diff line number Diff line Loading @@ -943,6 +943,12 @@ func subscriptionsPost(w http.ResponseWriter, r *http.Request) { return } if extractSubType.CallbackReference == "" && extractSubType.WebsockNotifConfig.WebsocketUri == "" { log.Error("At least one of CallbackReference and WebsockNotifConfig parameters should be present") errHandlerProblemDetails(w, "At least one of CallbackReference and WebsockNotifConfig parameters should be present.", http.StatusBadRequest) return } //extract subscription type subscriptionType := extractSubType.SubscriptionType Loading Loading @@ -1288,10 +1294,22 @@ func individualSubscriptionPut(w http.ResponseWriter, r *http.Request) { //extract common body part subscriptionType := subscriptionCommon.SubscriptionType //mandatory parameter if subscriptionCommon.CallbackReference == "" { log.Error("Mandatory CallbackReference parameter not present") errHandlerProblemDetails(w, "Mandatory CallbackReference parameter not present", http.StatusBadRequest) // Validating mandatory parameters provided in the request body if subscriptionCommon.SubscriptionType == "" { log.Error("Mandatory SubscriptionType parameter should be present") errHandlerProblemDetails(w, "Mandatory attribute SubscriptionType is missing in the request body.", http.StatusBadRequest) return } if subscriptionCommon.FilterCriteria == nil { log.Error("FilterCriteria should not be null for this subscription type") errHandlerProblemDetails(w, "Mandatory attribute FilterCriteria is missing for this subscription type", http.StatusBadRequest) return } if subscriptionCommon.CallbackReference == "" && subscriptionCommon.WebsockNotifConfig.WebsocketUri == "" { log.Error("At least one of CallbackReference and WebsockNotifConfig parameters should be present") errHandlerProblemDetails(w, "At least one of CallbackReference and WebsockNotifConfig parameters should be present.", http.StatusBadRequest) return } Loading Loading @@ -1324,17 +1342,24 @@ func individualSubscriptionPut(w http.ResponseWriter, r *http.Request) { return } if subscription.FilterCriteria == nil { log.Error("FilterCriteria should not be null for this subscription type") errHandlerProblemDetails(w, "FilterCriteria should not be null for this subscription type", http.StatusBadRequest) if subscription.FilterCriteria.StdOrganization == "" { log.Error("Mandatory StdOrganization parameter should be present") errHandlerProblemDetails(w, "Mandatory attribute StdOrganization is missing in the request body.", http.StatusBadRequest) return } if subscription.FilterCriteria.StdOrganization != "ETSI" { log.Error("StdOrganizaztion should not be other than ETSI for this subscription type") errHandlerProblemDetails(w, "StdOrganizaztion should not be other than ETSI for this subscription type", http.StatusBadRequest) for _, msgTypeString := range subscription.FilterCriteria.MsgType { msgTypeInt, err := strconv.Atoi(msgTypeString) if msgTypeInt < 1 || msgTypeInt > 13 { log.Error("MsgType parameter should be between 1 and 13") errHandlerProblemDetails(w, "MsgType parameter should be between 1 and 13 in the request body.", http.StatusBadRequest) return } else if err != nil { log.Error("MsgType parameter should be between 1 and 13") errHandlerProblemDetails(w, "MsgType parameter should be between 1 and 13 in the request body.", http.StatusBadRequest) return } } //registration if isSubscriptionIdRegisteredV2x(subsIdStr) { Loading