Commit 4b92ee16 authored by Yann Garcia's avatar Yann Garcia
Browse files

End of validation of AtsMec_V2XInformationService

parent d468af7b
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -623,6 +623,9 @@ func GetInfoUuUnicast(params []string, num_item int) (proInfoUuUnicast UuUnicast
	}

	log.Info("GetInfoUuUnicast: proInfoUuUnicast= ", proInfoUuUnicast)
	if len(proInfoUuUnicast) == 0 || len(proInfoUuUnicast) == 1 && proInfoUuUnicast[0].LocationInfo == nil {
		proInfoUuUnicast = make([]UuUnicastProvisioningInfoProInfoUuUnicast, 0)
	}
	return proInfoUuUnicast, nil
}

@@ -708,6 +711,11 @@ func GetInfoUuMbmscast(params []string, num_item int) (proInfoUuMbmscast UuMbmsP
		} // End of 'for' statement
	}

	log.Info("GetInfoUuMbmscast: proInfoUuMbmscast= ", proInfoUuMbmscast)
	if len(proInfoUuMbmscast) == 0 || len(proInfoUuMbmscast) == 1 && proInfoUuMbmscast[0].LocationInfo == nil {
		proInfoUuMbmscast = make([]UuMbmsProvisioningInfoProInfoUuMbms, 0)
	}

	log.Info("GetInfoUuMbmscast: proInfoUuMbmscast= ", proInfoUuMbmscast)
	return proInfoUuMbmscast, nil
}
+100 −11
Original line number Diff line number Diff line
@@ -685,6 +685,14 @@ func predictedQosPost(w http.ResponseWriter, r *http.Request) {
	log.Debug(">>> predictedQosPost: ", r)

	w.Header().Set("Content-Type", "application/json; charset=UTF-8")

	// For debug purpose only
	// bytes, err := ioutil.ReadAll(r.Body)
	// if err != nil {
	// 	log.Fatal(err)
	// }
	// log.Debug("predictedQosPost: bytes: ", string(bytes))

	var requestData PredictedQos
	decoder := json.NewDecoder(r.Body)
	err := decoder.Decode(&requestData)
@@ -706,6 +714,13 @@ func predictedQosPost(w http.ResponseWriter, r *http.Request) {
		log.Error("Mandatory locationGranularity parameter not present")
		errHandlerProblemDetails(w, "Mandatory attribute locationGranularity is missing in the request body.", http.StatusBadRequest)
		return
	} else {
		_, err := strconv.Atoi(requestData.LocationGranularity)
		if err != nil {
			log.Error(err.Error())
			errHandlerProblemDetails(w, err.Error(), http.StatusBadRequest)
			return
		}
	}

	// Validating mandatory parameters in request
@@ -812,6 +827,7 @@ func predictedQosPost(w http.ResponseWriter, r *http.Request) {
		var geocoordinatesList gisClient.GeoCoordinateList
		geocoordinatesList.GeoCoordinates = geocoordinates
		powerResp, _, err := gisAppClient.GeospatialDataApi.GetGeoDataPowerValues(context.TODO(), geocoordinatesList)
		log.Debug("predictedQosPost: powerResp: ", powerResp)
		if err != nil {
			log.Error("Failed to communicate with gis engine: ", err)
			errHandlerProblemDetails(w, "Failed to communicate with gis engine.", http.StatusInternalServerError)
@@ -831,7 +847,17 @@ func predictedQosPost(w http.ResponseWriter, r *http.Request) {
				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)
				currGeoCoordinate.Rsrp, currGeoCoordinate.Rsrq, err = sbi.GetPredictedPowerValues(estTimeHour, rsrp, rsrq, poaName)
				if err != nil {
					log.Error(err.Error())
					if err.Error() == "Missing POA Name" {
						errHandlerProblemDetails(w, err.Error(), http.StatusNotFound)
						return
					} else {
						errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError)
						return
					}
				}
			}
			log.Debug("predictedQosPost: new currGeoCoordinate: ", currGeoCoordinate)
			latCheck := routeInfo.Location.GeoArea.Latitude == currGeoCoordinate.Latitude
@@ -908,15 +934,16 @@ func provInfoUuUnicastGET(w http.ResponseWriter, r *http.Request) {
	resp, err := sbi.GetInfoUuUnicast(params, i)
	if err != nil {
		log.Error(err.Error())
		if strings.Contains(err.Error(), "Cannot find") {
			errHandlerProblemDetails(w, err.Error(), http.StatusNotFound)
		} else {
		errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError)
		}
		return
	}

	proInfoUuUnicast := make([]UuUnicastProvisioningInfoProInfoUuUnicast, len(resp))
	if len(resp) == 0 {
		err = errors.New("Cannot find UuUnicastProvisioningInfo")
		errHandlerProblemDetails(w, err.Error(), http.StatusNotFound)
		return
	}
	for i := range resp {
		if resp[i].LocationInfo != nil {
			proInfoUuUnicast[i].LocationInfo = new(LocationInfo)
@@ -1052,6 +1079,12 @@ func provInfoUuMbmsGET(w http.ResponseWriter, r *http.Request) {
		return
	}

	log.Info("infoUuMbmscastGET: len(resp): ", len(resp))
	if len(resp) == 0 {
		err = errors.New("Cannot find UuUnicastProvisioningInfo")
		errHandlerProblemDetails(w, err.Error(), http.StatusNotFound)
		return
	}
	proInfoUuMbmscast := make([]UuMbmsProvisioningInfoProInfoUuMbms, len(resp))
	for i := range resp {
		if resp[i].LocationInfo != nil {
@@ -1115,6 +1148,16 @@ func provInfoUuMbmsGET(w http.ResponseWriter, r *http.Request) {
				proInfoUuMbmscast[i].V2xServerUsd.Tmgi.Mcc = resp[i].V2xServerUsd.Tmgi.Mcc
				proInfoUuMbmscast[i].V2xServerUsd.Tmgi.Mnc = resp[i].V2xServerUsd.Tmgi.Mnc
			}
		} else { // ETSI GS MEC 030 V3.3.1 (2024-06) Clause 6.2.3 Type: UuMbmsProvisioningInfo: 2xServerUsd cardinality is 1
			proInfoUuMbmscast[i].V2xServerUsd = new(V2xServerUsd) // Keep it empty
			proInfoUuMbmscast[i].V2xServerUsd.SdpInfo = new(V2xServerUsdSdpInfo)
			proInfoUuMbmscast[i].V2xServerUsd.SdpInfo.IpMulticastAddress = ""
			proInfoUuMbmscast[i].V2xServerUsd.SdpInfo.PortNumber = ""
			proInfoUuMbmscast[i].V2xServerUsd.ServiceAreaIdentifier = []string{}
			proInfoUuMbmscast[i].V2xServerUsd.Tmgi = new(V2xServerUsdTmgi)
			proInfoUuMbmscast[i].V2xServerUsd.Tmgi.MbmsServiceId = ""
			proInfoUuMbmscast[i].V2xServerUsd.Tmgi.Mcc = ""
			proInfoUuMbmscast[i].V2xServerUsd.Tmgi.Mnc = ""
		}
	} // End of 'for' statement
	uuMbmsProvisioningInfo := UuMbmsProvisioningInfo{
@@ -1340,8 +1383,10 @@ func v2xMsgDistributionServerPost(w http.ResponseWriter, r *http.Request) {
			if msgProtocol == 0 || msgProtocol == 1 { // MQTT v3.1.0 or MQTT v3.1.1
				v2xMsgDistributionServerInfoResp.V2xMsgDistributionServer[i].InfoConnection = &InfoConnection{IpAddress: u.Hostname(), PortNumber: int32(portNumber)}
			} else {
				v2xMsgDistributionServer.InfoConnection = nil
				log.Warn("v2xMsgDistributionServerPost: Unsupported MsgProtocol: ", msgProtocol)
				err := errors.New("Unsupported MsgProtocol")
				errHandlerProblemDetails(w, err.Error(), http.StatusNotFound)
				return
			}
		} // End of 'for'statement
	} // End of 'for'statement
@@ -3059,7 +3104,11 @@ func individualSubscriptionPut(w http.ResponseWriter, r *http.Request) {
		jsonResponse, alreadyRegistered, err = processPredQosSubscriptionUpdate(bodyBytes, subsIdStr)

	default:
		log.Error("Unsupported subscriptionType")
		err = errors.New("Unsupported subscriptionType")
		log.Error(err.Error())
		errHandlerProblemDetails(w, err.Error(), http.StatusBadRequest)
		return

	}
	log.Info("individualSubscriptionPut: alreadyRegistered: ", alreadyRegistered)

@@ -3279,9 +3328,49 @@ func findMsgTypeId(list []string, item int32) bool {
}

func parseMsgTypeToInt(msgType string) int32 {
	m, err := strconv.Atoi(msgType)
	if err != nil {
		return -1
	m := -1
	switch msgType {
	case "denm":
		m = 1
	case "cam":
		m = 2
	case "poi":
		m = 3
	case "spatem":
		m = 4
	case "mapem":
		m = 5
	case "ivim":
		m = 6
	case "evrsr":
		m = 7
	case "tistpgtransaction":
		m = 8
	case "srem":
		m = 9
	case "ssem":
		m = 10
	case "evcsn":
		m = 11
	case "saem":
		m = 12
	case "rtcmem":
		m = 13
	case "cpm":
		m = 14
	case "imzm":
		m = 15
	case "vam":
		m = 16
	case "dsm":
		m = 17
	case "mim":
		m = 18
	case "mvm":
		m = 19
	case "mcm":
		m = 20
	}

	return int32(m)
}
+1 −13
Original line number Diff line number Diff line
@@ -1140,20 +1140,8 @@ func (tm *TrafficMgr) GetInfoUuMbmscast(params []string, num_item int) (proInfoU
			// uuMbmsNeighbourCellInfo := make([]UuMbmsNeighbourCellInfo, 1)
			// uuMbmsNeighbourCellInfo[0] = UuMbmsNeighbourCellInfo{&ecgi, nil, make([]string, 0), 0, &plmn, nil}

			// FIXME FSCOM How to manage V2xServerUsd
			var v2xServerUsd *V2xServerUsd = nil
			// FIXME FSCOM
			// if _, found := cellId2CellNameMap[params[i]]; found {
			// 	u, err := url.ParseRequestURI(tm.broker)
			// 	if err != nil {
			// 		log.Error(err.Error())
			// 		return nil, err
			// 	}
			// 	log.Info("url:%v - scheme:%v - host:%v - Path:%v - Port:%s", u, u.Scheme, u.Hostname(), u.Path, u.Port())
			// 	V2xServerUsd = &V2xServerUsd{
			// 		IpAddress: u.Hostname(),
			// 		UdpPort:   u.Port(),
			// 	}
			// }

			locationInfoGeoArea := &LocationInfoGeoArea{location_map[1], location_map[0]}
			locationInfo := &LocationInfo{&ecgi, locationInfoGeoArea}