Commit 6cc40013 authored by Simon Pastor's avatar Simon Pastor
Browse files

merge

parent 77112896
Loading
Loading
Loading
Loading
+37 −22
Original line number Diff line number Diff line
@@ -40,6 +40,10 @@ type UeDataSbi struct {
	ThroughputUL  int32
	ThroughputDL  int32
	PacketLoss    float64
	ParentPoaName string
	InRangePoas   []string
	InRangeRsrps  []int32
	InRangeRsrqs  []int32
}

type PoaInfoSbi struct {
@@ -326,6 +330,10 @@ func processActiveScenarioUpdate() {
						throughputUL = ue.NetChar.ThroughputUl
					}

					//update measurements, don't wait for ticker
					ueMeasMap, _ := sbi.gisCache.GetAllMeasurements()
					poaNamesInRange, rsrpsInRange, rsrqsInRange := getMeas(name, "", ueMeasMap)

					var ueDataSbi = UeDataSbi{
						Name:          name,
						Mnc:           mnc,
@@ -338,6 +346,10 @@ func processActiveScenarioUpdate() {
						ThroughputUL:  throughputUL,
						ThroughputDL:  throughputDL,
						PacketLoss:    ploss,
						ParentPoaName: poa.Name,
						InRangePoas:   poaNamesInRange,
						InRangeRsrps:  rsrpsInRange,
						InRangeRsrqs:  rsrqsInRange,
					}
					sbi.updateUeDataCB(ueDataSbi)
				}
@@ -483,10 +495,12 @@ func processActiveScenarioUpdate() {
}

func refreshMeasurements() {

	// Update UE measurements
	ueMeasMap, _ := sbi.gisCache.GetAllMeasurements()
	ueNameList := sbi.activeModel.GetNodeNames("UE")
	for _, name := range ueNameList {

		// Ignore disconnected UEs
		if !isUeConnected(name) {
			sbi.updateMeasInfoCB(name, "", nil, nil, nil)
@@ -501,6 +515,7 @@ func refreshMeasurements() {
			sbi.updateMeasInfoCB(name, "", nil, nil, nil)
		}
	}

}

func getMeas(ue string, poaName string, ueMeasMap map[string]*gc.UeMeasurement) ([]string, []int32, []int32) {
+32 −1
Original line number Diff line number Diff line
@@ -354,6 +354,18 @@ func updateUeData(obj sbi.UeDataSbi) {
	ueData.ThroughputDL = obj.ThroughputDL
	ueData.PacketLoss = obj.PacketLoss

	var inRangePoas []InRangePoa
	for index := range obj.InRangePoas {
		var inRangePoa InRangePoa
		inRangePoa.Name = obj.InRangePoas[index]
		inRangePoa.Rsrp = obj.InRangeRsrps[index]
		inRangePoa.Rsrq = obj.InRangeRsrqs[index]
		inRangePoas = append(inRangePoas, inRangePoa)
	}

	ueData.InRangePoas = inRangePoas
	ueData.ParentPoaName = obj.ParentPoaName

	oldPlmn := new(Plmn)
	oldPlmnMnc := ""
	oldPlmnMcc := ""
@@ -362,6 +374,7 @@ func updateUeData(obj sbi.UeDataSbi) {
	oldNrPlmnMnc := ""
	oldNrPlmnMcc := ""
	oldNrCellId := ""
	var oldInRangePoas []InRangePoa

	//get from DB
	jsonUeData, _ := rc.JSONGetEntry(baseKey+"UE:"+obj.Name, ".")
@@ -381,9 +394,10 @@ func updateUeData(obj sbi.UeDataSbi) {
				oldNrPlmnMcc = ueDataObj.Nrcgi.Plmn.Mcc
				oldNrCellId = ueDataObj.Nrcgi.NrcellId
			}

			oldInRangePoas = ueDataObj.InRangePoas
		}
	}

	//updateDB if changes occur (4G section)
	if newEcgi.Plmn.Mnc != oldPlmnMnc || newEcgi.Plmn.Mcc != oldPlmnMcc || newEcgi.CellId != oldCellId {

@@ -425,6 +439,23 @@ func updateUeData(obj sbi.UeDataSbi) {
			//update because nrcgi changed
			_ = rc.JSONSetEntry(baseKey+"UE:"+obj.Name, ".", convertUeDataToJson(&ueData))
		}
		//update if poa in range and signal powers changed
		//as soon as there is one difference... need an update
		updateMeas := false
		if len(oldInRangePoas) != len(inRangePoas) {
			updateMeas = true
		} else {
			for index := range oldInRangePoas {
				if oldInRangePoas[index].Name != inRangePoas[index].Name || oldInRangePoas[index].Rsrp != inRangePoas[index].Rsrp || oldInRangePoas[index].Rsrq != inRangePoas[index].Rsrq {
					updateMeas = true
					break
				}
			}
		}
		if updateMeas {
			//update because power signals changed
			_ = rc.JSONSetEntry(baseKey+"UE:"+obj.Name, ".", convertUeDataToJson(&ueData))
		}
	}
}

+3 −0
Original line number Diff line number Diff line
@@ -1839,6 +1839,9 @@ func (am *AssetMgr) updateUeInfo(ueMap map[string]*Ue) (err error) {
		for poaName, meas := range ue.Measurements {
			// Calculate power measurements
			rssi, rsrp, rsrq := calculatePower(meas.SubType, meas.Radius, meas.Distance)
			if rsrp == 0 && rsrq == 0 {
				log.Error("ERROR: Zero Rsrp and RsRq should not happen: ", meas.SubType, "---", meas.Radius, "---", meas.Distance, "---", poaName, "---", ueName)
			}

			// Add new entry or update existing one
			id := ueName + "-" + poaName