Commit a1eaea2d authored by Yann Garcia's avatar Yann Garcia
Browse files

Bug fixed in Liveness support (message part)

parent 7928a3f7
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -9,6 +9,6 @@
 */
package server

type ServiceLivenessUpdate struct { // FSCOM Chang manuall (remove *)
	State ServiceState `json:"state"`
type ServiceLivenessUpdate struct {
	State *ServiceState `json:"state"`
}
+21 −2
Original line number Diff line number Diff line
@@ -240,6 +240,11 @@ func appServicesPOST(w http.ResponseWriter, r *http.Request) {
	}

	// Retrieve request parameters from body
	if r.Body == nil {
		err := errors.New("Request body is missing")
		errHandlerProblemDetails(w, err.Error(), http.StatusBadRequest)
		return
	}
	// NOTE: Set default values for omitted fields
	locality := MEC_HOST_LocalityType
	sInfoPost := ServiceInfo{
@@ -400,6 +405,11 @@ func appServicesByIdPUT(w http.ResponseWriter, r *http.Request) {
	sInfoPrev := convertJsonToServiceInfo(sInfoPrevJson)

	// Retrieve request parameters from body
	if r.Body == nil {
		err := errors.New("Request body is missing")
		errHandlerProblemDetails(w, err.Error(), http.StatusBadRequest)
		return
	}
	// NOTE: Set default values for omitted fields
	locality := MEC_HOST_LocalityType
	sInfo := ServiceInfo{
@@ -639,6 +649,11 @@ func applicationsSubscriptionsPOST(w http.ResponseWriter, r *http.Request) {
	}

	// Retrieve subscription request
	if r.Body == nil {
		err := errors.New("Request body is missing")
		errHandlerProblemDetails(w, err.Error(), http.StatusBadRequest)
		return
	}
	var serAvailNotifSub SerAvailabilityNotificationSubscription
	decoder := json.NewDecoder(r.Body)
	err = decoder.Decode(&serAvailNotifSub)
@@ -947,6 +962,11 @@ func patchIndividualMECService(w http.ResponseWriter, r *http.Request) {
		return
	} else {
		// Retrieve request
		if r.Body == nil {
			err := errors.New("Request body is missing")
			errHandlerProblemDetails(w, err.Error(), http.StatusBadRequest)
			return
		}
		var serviceLivenessUpdate ServiceLivenessUpdate
		decoder := json.NewDecoder(r.Body)
		err := decoder.Decode(&serviceLivenessUpdate)
@@ -956,8 +976,7 @@ func patchIndividualMECService(w http.ResponseWriter, r *http.Request) {
			return
		}
		log.Info("patchIndividualMECService: serviceLivenessUpdate: ", serviceLivenessUpdate)
		log.Info("patchIndividualMECService: serviceLivenessUpdate: ", serviceLivenessUpdate.State)
		if serviceLivenessUpdate.State == ACTIVE_ServiceState {
		if *serviceLivenessUpdate.State == ACTIVE_ServiceState {
			entry.State = &ACTIVE_ServiceState
		} else { // ETSI GS MEC 011 V3.2.1 (2024-04) Table 8.1.2.5-1: Attributes of ServiceLivenessUpdate
			err := errors.New("Wrong body content")