X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=control%2Fcontrol.go;fp=control%2Fcontrol.go;h=3e63ef1d627006d786f5747942f9b69cde14acdb;hb=87bba2bd0f2fb331707f8d5933260cca09ae3fef;hp=969ef90f0237594ae4a73da01f38595f13b139b0;hpb=3557f23287ead88d87934e2df4d0b31e27d15b3f;p=scp%2Fric-app%2Fkpimon.git diff --git a/control/control.go b/control/control.go index 969ef90..3e63ef1 100644 --- a/control/control.go +++ b/control/control.go @@ -644,15 +644,16 @@ func (c *Control) handleIndication(params *xapp.RMRParams) (err error) { } var ueMetrics UeMetricsEntry - if isUeExist, _ := c.client.Exists(strconv.FormatInt(ueID, 10)).Result(); isUeExist == 1 { - ueJsonStr, _ := c.client.Get(strconv.FormatInt(ueID, 10)).Result() + if isUeExist, _ := c.client.Exists("{TS-UE-metrics}," + strconv.FormatInt(ueID, 10)).Result(); isUeExist == 1 { + ueJsonStr, _ := c.client.Get("{TS-UE-metrics}," + strconv.FormatInt(ueID, 10)).Result() json.Unmarshal([]byte(ueJsonStr), &ueMetrics) } ueMetrics.UeID = ueID log.Printf("UeID: %d", ueMetrics.UeID) - ueMetrics.ServingCellID = servingCellID + ueMetrics.ServingCellID = servingCellID log.Printf("ServingCellID: %s", ueMetrics.ServingCellID) + ueMetrics.MeasPeriodRF = 20 if flag { timestampPRB = timestamp @@ -677,7 +678,7 @@ func (c *Control) handleIndication(params *xapp.RMRParams) (err error) { log.Printf("Failed to marshal UeMetrics with UE ID [%d]: %v", ueID, err) continue } - err = c.client.Set(strconv.FormatInt(ueID, 10), newUeJsonStr, 0).Err() + err = c.client.Set("{TS-UE-metrics}," + strconv.FormatInt(ueID, 10), newUeJsonStr, 0).Err() if err != nil { xapp.Logger.Error("Failed to set UeMetrics into redis with UE ID [%d]: %v", ueID, err) log.Printf("Failed to set UeMetrics into redis with UE ID [%d]: %v", ueID, err) @@ -716,8 +717,8 @@ func (c *Control) handleIndication(params *xapp.RMRParams) (err error) { } var ueMetrics UeMetricsEntry - if isUeExist, _ := c.client.Exists(strconv.FormatInt(ueID, 10)).Result(); isUeExist == 1 { - ueJsonStr, _ := c.client.Get(strconv.FormatInt(ueID, 10)).Result() + if isUeExist, _ := c.client.Exists("{TS-UE-metrics}," + strconv.FormatInt(ueID, 10)).Result(); isUeExist == 1 { + ueJsonStr, _ := c.client.Get("{TS-UE-metrics}," + strconv.FormatInt(ueID, 10)).Result() json.Unmarshal([]byte(ueJsonStr), &ueMetrics) } @@ -729,6 +730,9 @@ func (c *Control) handleIndication(params *xapp.RMRParams) (err error) { ueMetrics.MeasTimeRF.TVsec = timestamp.TVsec ueMetrics.MeasTimeRF.TVnsec = timestamp.TVnsec + ueMetrics.MeasPeriodPDCP = 20 + ueMetrics.MeasPeriodPRB = 20 + if ueResourceReportItem.ServingCellRF != nil { err = json.Unmarshal(ueResourceReportItem.ServingCellRF.Buf, &ueMetrics.ServingCellRF) log.Printf("ueMetrics.ServingCellRF: %+v", ueMetrics.ServingCellRF) @@ -757,7 +761,7 @@ func (c *Control) handleIndication(params *xapp.RMRParams) (err error) { log.Printf("Failed to marshal UeMetrics with UE ID [%d]: %v", ueID, err) continue } - err = c.client.Set(strconv.FormatInt(ueID, 10), newUeJsonStr, 0).Err() + err = c.client.Set("{TS-UE-metrics}," + strconv.FormatInt(ueID, 10), newUeJsonStr, 0).Err() if err != nil { xapp.Logger.Error("Failed to set UeMetrics into redis with UE ID [%d]: %v", ueID, err) log.Printf("Failed to set UeMetrics into redis with UE ID [%d]: %v", ueID, err) @@ -796,8 +800,8 @@ func (c *Control) handleIndication(params *xapp.RMRParams) (err error) { } var ueMetrics UeMetricsEntry - if isUeExist, _ := c.client.Exists(strconv.FormatInt(ueID, 10)).Result(); isUeExist == 1 { - ueJsonStr, _ := c.client.Get(strconv.FormatInt(ueID, 10)).Result() + if isUeExist, _ := c.client.Exists("{TS-UE-metrics}," + strconv.FormatInt(ueID, 10)).Result(); isUeExist == 1 { + ueJsonStr, _ := c.client.Get("{TS-UE-metrics}," + strconv.FormatInt(ueID, 10)).Result() json.Unmarshal([]byte(ueJsonStr), &ueMetrics) } @@ -837,7 +841,7 @@ func (c *Control) handleIndication(params *xapp.RMRParams) (err error) { log.Printf("Failed to marshal UeMetrics with UE ID [%d]: %v", ueID, err) continue } - err = c.client.Set(strconv.FormatInt(ueID, 10), newUeJsonStr, 0).Err() + err = c.client.Set("{TS-UE-metrics}," + strconv.FormatInt(ueID, 10), newUeJsonStr, 0).Err() if err != nil { xapp.Logger.Error("Failed to set UeMetrics into redis with UE ID [%d]: %v", ueID, err) log.Printf("Failed to set UeMetrics into redis with UE ID [%d]: %v", ueID, err) @@ -854,11 +858,15 @@ func (c *Control) handleIndication(params *xapp.RMRParams) (err error) { if flag { var cellMetrics CellMetricsEntry - if isCellExist, _ := c.client.Exists(cellIDHdr).Result(); isCellExist == 1 { - cellJsonStr, _ := c.client.Get(cellIDHdr).Result() + if isCellExist, _ := c.client.Exists("{TS-cell-metrics}," + cellIDHdr).Result(); isCellExist == 1 { + cellJsonStr, _ := c.client.Get("{TS-cell-metrics}," + cellIDHdr).Result() json.Unmarshal([]byte(cellJsonStr), &cellMetrics) } + cellMetrics.MeasPeriodPDCP = 20 + cellMetrics.MeasPeriodPRB = 20 + cellMetrics.CellID = cellIDHdr + if timestampPDCPBytes != nil { cellMetrics.MeasTimestampPDCPBytes.TVsec = timestampPDCPBytes.TVsec cellMetrics.MeasTimestampPDCPBytes.TVnsec = timestampPDCPBytes.TVnsec @@ -886,7 +894,7 @@ func (c *Control) handleIndication(params *xapp.RMRParams) (err error) { log.Printf("Failed to marshal CellMetrics with CellID [%s]: %v", cellIDHdr, err) continue } - err = c.client.Set(cellIDHdr, newCellJsonStr, 0).Err() + err = c.client.Set("{TS-cell-metrics}," + cellIDHdr, newCellJsonStr, 0).Err() if err != nil { xapp.Logger.Error("Failed to set CellMetrics into redis with CellID [%s]: %v", cellIDHdr, err) log.Printf("Failed to set CellMetrics into redis with CellID [%s]: %v", cellIDHdr, err)