Commit 72eca5e9 authored by Yann Garcia's avatar Yann Garcia
Browse files

Bug fixed in VIS/PredictedQoS

parent 16ad6087
Loading
Loading
Loading
Loading
+8 −1
Changes for go-apps/meep-vis/api/swagger.yaml: 8 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ info:
    url: https://forge.etsi.org/legal-matters
  version: 3.2.2
externalDocs:
  description: "ETSI GS MEC 030 V2X Information Services API, v3.1.1"
  description: "ETSI GS MEC 030 V2X Information Services API, v3.2.1"
  url: https://www.etsi.org/deliver/etsi_gs/MEC/001_099/030/03.02.01_60/
servers:
- url: https://localhost/sandboxname/vis/v2
@@ -2799,9 +2799,16 @@ components:
    Stream:
      minItems: 1
      required:
      - streamId
      - qosKpi
      type: object
      properties:
        streamId:
          type: string
          description: "The identifier of a specific data stream. In case of 3GPP \
                        \ network, this is mapped to a QoS flow"
          x-etsi-mec-cardinality: "1"
          x-etsi-mec-origin-type: String
        qosKpi:
          type: array
          items:
+1 −0
Changes for go-apps/meep-vis/go.mod: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ require (
	github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-subscriptions v0.0.0
	github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-swagger-api-mgr v0.0.0
	github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-vis-traffic-mgr v0.0.0
	github.com/google/uuid v1.2.0 // indirect
	github.com/gorilla/handlers v1.5.1
	github.com/gorilla/mux v1.8.0
	github.com/prometheus/client_golang v1.9.0
+1 −0
Changes for go-apps/meep-vis/server/model_stream.go: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -25,5 +25,6 @@ package server

// Predicted QoS at the related time and vehicular UE location for the specific data stream. In case of 3GPP network, this is mapped to a QoS flow. Stream needs to also contain the stream ID that, in case of the 3GPP network, can be mapped on to the 5QI or QCI.
type Stream struct {
	StreamId string   `json:"streamId"`
	QosKpi   []QosKpi `json:"qosKpi"`
}
+53 −8
Changes for go-apps/meep-vis/server/vis.go: 53 added lines, 8 removed lines.
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ import (
	smc "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-service-mgmt-client"
	sm "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-subscriptions"
	//"github.com/gorilla/mux"
	//uuid "github.com/google/uuid"
)

const moduleName = "meep-vis"
@@ -707,9 +708,41 @@ func predictedQosPost(w http.ResponseWriter, r *http.Request) {
		return
	}

	if len(requestData.Routes) == 0 {
		log.Error("Mandatory routes parameter is either empty or not present")
		errHandlerProblemDetails(w, "Mandatory attribute routes is either empty or not present in the request.", http.StatusBadRequest)
	// Validating mandatory parameters in request
	if requestData.Qos != nil {
		log.Error("Qos field shall not be present in the request")
		errHandlerProblemDetails(w, "Qos field shall not be present in the request.", http.StatusBadRequest)
		return
	}

	if requestData.PredictionTarget == "SINGLE_UE_PREDICTION" {
		if requestData.predictionArea != nil || len(requestData.predictionArea) != 0 {
			log.Error("PredictionArea field shall not be present when predictionTarget is SINGLE_UE_PREDICTION")
			errHandlerProblemDetails(w, "PredictionArea field shall not be present when predictionTarget is SINGLE_UE_PREDICTION in the request.", http.StatusBadRequest)
			return
		}
		if requestData.Routes == nil || len(requestData.Routes) == 0 {
			log.Error("Mandatory Routes field is either empty or not present")
			errHandlerProblemDetails(w, "Mandatory Routes field is either empty or not present in the request.", http.StatusBadRequest)
			return
		}
	} else if requestData.PredictionTarget == "E2E_APPLICATION_INSTANCE_PREDICTION" {
		if requestData.Routes != nil || len(requestData.Routes) != 0 {
			log.Error("Routes field shall not present when predictionTarget is E2E_APPLICATION_INSTANCE_PREDICTION")
			errHandlerProblemDetails(w, "Routes field shall not present when predictionTarget is E2E_APPLICATION_INSTANCE_PREDICTION in the request.", http.StatusBadRequest)
			return
		}
		if requestData.predictionArea == nil || len(requestData.predictionArea) == 0 {
			log.Error("PredictionArea field shall be present when predictionTarget is E2E_APPLICATION_INSTANCE_PREDICTION")
			errHandlerProblemDetails(w, "PredictionArea field shall be present when predictionTarget is E2E_APPLICATION_INSTANCE_PREDICTION in the request.", http.StatusBadRequest)
			return
		}
		log.Error("E2E_APPLICATION_INSTANCE_PREDICTION is not supported")
		errHandlerProblemDetails(w, "E2E_APPLICATION_INSTANCE_PREDICTION is not supported.", http.StatusNotImplemented)
		return
	} else {
		log.Error("Invalid PredictionTarget field value")
		errHandlerProblemDetails(w, "Invalid PredictionTarget field value in the request.", http.StatusBadRequest)
		return
	}

@@ -785,27 +818,39 @@ func predictedQosPost(w http.ResponseWriter, r *http.Request) {
			return
		}
		routeInfoList := responseData.Routes[i].RouteInfo
		var qos = Qos{}
		for j, routeInfo := range routeInfoList {
			currGeoCoordinate := powerResp.CoordinatesPower[j]
			log.Debug("predictedQosPost: currGeoCoordinate: ", currGeoCoordinate)
			log.Debug("predictedQosPost: predictionModelSupported: ", predictionModelSupported)
			log.Debug("predictedQosPost: routeInfo.Time: ", routeInfo.Time)
			if predictionModelSupported && routeInfo.Time != nil {
				rsrp := currGeoCoordinate.Rsrp
				rsrq := currGeoCoordinate.Rsrq
				poaName := currGeoCoordinate.PoaName
				estTimeHour := int32(time.Unix(int64(routeInfo.Time.Seconds), int64(routeInfo.Time.NanoSeconds)).Hour())
				log.Debug("predictedQosPost: rsrp: ", rsrp)
				log.Debug("predictedQosPost: rsrq: ", rsrq)
				currGeoCoordinate.Rsrp, currGeoCoordinate.Rsrq, _ = sbi.GetPredictedPowerValues(estTimeHour, rsrp, rsrq, poaName)
			}
			/* FIXME Check what to do with this
			log.Debug("predictedQosPost: new currGeoCoordinate: ", currGeoCoordinate)
			latCheck := routeInfo.Location.GeoArea.Latitude == currGeoCoordinate.Latitude
			longCheck := routeInfo.Location.GeoArea.Longitude == currGeoCoordinate.Longitude
			log.Debug("predictedQosPost: latCheck: ", latCheck)
			log.Debug("predictedQosPost: longCheck: ", longCheck)
			if latCheck && longCheck {
				routeInfoList[j].Rsrq = currGeoCoordinate.Rsrq
				routeInfoList[j].Rsrp = currGeoCoordinate.Rsrp
			}*/
			routeInfo.Location.Ecgi = nil
				qosKpis := make([]QosKpi, 2)
				qosKpis[0] = QosKpi{"rsrp", strconv.Itoa(int(currGeoCoordinate.Rsrp)), "1"}
				qosKpis[1] = QosKpi{"rsrq", strconv.Itoa(int(currGeoCoordinate.Rsrq)), "1"}
				qos.Stream = append(qos.Stream, Stream{StreamId: strconv.Itoa(j), QosKpi: qosKpis})
			}
			routeInfo.Location.Ecgi = nil
		} // End of 'for' statement
		responseData.Qos = &qos
	}

	jsonResponse := convertPredictedQostoJson(&responseData)
	log.Debug("predictedQosPost: jsonResponse: ", jsonResponse)
	w.WriteHeader(http.StatusOK)
	fmt.Fprint(w, jsonResponse)
}
+10 −4
Changes for go-apps/meep-vis/server/vis_test.go: 10 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -568,9 +568,12 @@ func TestPredictedQosPost(t *testing.T) {
	var expected_predictionArea *PredictionArea = nil
	expected_predictionTarget := "1"
	expected_qosKpis := make([]QosKpi, 1)
	expected_qosKpis[0] = QosKpi{"", "latency", "1"}
	expected_qosKpis[0] = QosKpi{"latency", "value", "1"}
	expected_stream := make([]Stream, 1)
	expected_stream[0] = Stream{expected_qosKpis}
	expected_stream[0] = Stream{
		StreamId: "1",
		QosKpi:   expected_qosKpis,
	}
	expected_qos := &Qos{expected_stream}
	expected_timeGranularity := &TimeStamp{0, 1}
	expected_predictedQos := PredictedQos{expected_locationGranularity, expected_noticePeriod, expected_predictionArea, expected_predictionTarget, expected_qos, expected_routes, expected_timeGranularity}
@@ -603,9 +606,12 @@ func TestPredictedQosPost(t *testing.T) {
	var predictionArea *PredictionArea = nil
	predictionTarget := "1"
	qosKpis := make([]QosKpi, 1)
	qosKpis[0] = QosKpi{"", "latency", "1"}
	qosKpis[0] = QosKpi{"latency", "value", "1"}
	stream := make([]Stream, 1)
	stream[0] = Stream{qosKpis}
	stream[0] = Stream{
		StreamId: "1",
		QosKpi:   qosKpis,
	}
	qos := &Qos{stream}
	timeGranularity := &TimeStamp{0, 1}
	testPredictedQos := PredictedQos{locationGranularity, noticePeriod, predictionArea, predictionTarget, qos, routes, timeGranularity}