Changes so that Redis entries will be understood by other xapps.

Issue-ID: RICAPP-96

Signed-off-by: Ron Shacham <rshacham@research.att.com>
Change-Id: Ieffceab767f53163d197101bdf0785c07a79b2d7
This commit is contained in:
Ron Shacham 2020-12-09 23:17:28 -05:00
parent 3557f23287
commit 87bba2bd0f
2 changed files with 45 additions and 31 deletions

View File

@ -644,8 +644,8 @@ func (c *Control) handleIndication(params *xapp.RMRParams) (err error) {
} }
var ueMetrics UeMetricsEntry var ueMetrics UeMetricsEntry
if isUeExist, _ := c.client.Exists(strconv.FormatInt(ueID, 10)).Result(); isUeExist == 1 { if isUeExist, _ := c.client.Exists("{TS-UE-metrics}," + strconv.FormatInt(ueID, 10)).Result(); isUeExist == 1 {
ueJsonStr, _ := c.client.Get(strconv.FormatInt(ueID, 10)).Result() ueJsonStr, _ := c.client.Get("{TS-UE-metrics}," + strconv.FormatInt(ueID, 10)).Result()
json.Unmarshal([]byte(ueJsonStr), &ueMetrics) json.Unmarshal([]byte(ueJsonStr), &ueMetrics)
} }
@ -653,6 +653,7 @@ func (c *Control) handleIndication(params *xapp.RMRParams) (err error) {
log.Printf("UeID: %d", ueMetrics.UeID) log.Printf("UeID: %d", ueMetrics.UeID)
ueMetrics.ServingCellID = servingCellID ueMetrics.ServingCellID = servingCellID
log.Printf("ServingCellID: %s", ueMetrics.ServingCellID) log.Printf("ServingCellID: %s", ueMetrics.ServingCellID)
ueMetrics.MeasPeriodRF = 20
if flag { if flag {
timestampPRB = timestamp 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) log.Printf("Failed to marshal UeMetrics with UE ID [%d]: %v", ueID, err)
continue 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 { if err != nil {
xapp.Logger.Error("Failed to set UeMetrics into redis with UE ID [%d]: %v", ueID, err) 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) 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 var ueMetrics UeMetricsEntry
if isUeExist, _ := c.client.Exists(strconv.FormatInt(ueID, 10)).Result(); isUeExist == 1 { if isUeExist, _ := c.client.Exists("{TS-UE-metrics}," + strconv.FormatInt(ueID, 10)).Result(); isUeExist == 1 {
ueJsonStr, _ := c.client.Get(strconv.FormatInt(ueID, 10)).Result() ueJsonStr, _ := c.client.Get("{TS-UE-metrics}," + strconv.FormatInt(ueID, 10)).Result()
json.Unmarshal([]byte(ueJsonStr), &ueMetrics) 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.TVsec = timestamp.TVsec
ueMetrics.MeasTimeRF.TVnsec = timestamp.TVnsec ueMetrics.MeasTimeRF.TVnsec = timestamp.TVnsec
ueMetrics.MeasPeriodPDCP = 20
ueMetrics.MeasPeriodPRB = 20
if ueResourceReportItem.ServingCellRF != nil { if ueResourceReportItem.ServingCellRF != nil {
err = json.Unmarshal(ueResourceReportItem.ServingCellRF.Buf, &ueMetrics.ServingCellRF) err = json.Unmarshal(ueResourceReportItem.ServingCellRF.Buf, &ueMetrics.ServingCellRF)
log.Printf("ueMetrics.ServingCellRF: %+v", 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) log.Printf("Failed to marshal UeMetrics with UE ID [%d]: %v", ueID, err)
continue 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 { if err != nil {
xapp.Logger.Error("Failed to set UeMetrics into redis with UE ID [%d]: %v", ueID, err) 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) 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 var ueMetrics UeMetricsEntry
if isUeExist, _ := c.client.Exists(strconv.FormatInt(ueID, 10)).Result(); isUeExist == 1 { if isUeExist, _ := c.client.Exists("{TS-UE-metrics}," + strconv.FormatInt(ueID, 10)).Result(); isUeExist == 1 {
ueJsonStr, _ := c.client.Get(strconv.FormatInt(ueID, 10)).Result() ueJsonStr, _ := c.client.Get("{TS-UE-metrics}," + strconv.FormatInt(ueID, 10)).Result()
json.Unmarshal([]byte(ueJsonStr), &ueMetrics) 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) log.Printf("Failed to marshal UeMetrics with UE ID [%d]: %v", ueID, err)
continue 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 { if err != nil {
xapp.Logger.Error("Failed to set UeMetrics into redis with UE ID [%d]: %v", ueID, err) 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) 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 { if flag {
var cellMetrics CellMetricsEntry var cellMetrics CellMetricsEntry
if isCellExist, _ := c.client.Exists(cellIDHdr).Result(); isCellExist == 1 { if isCellExist, _ := c.client.Exists("{TS-cell-metrics}," + cellIDHdr).Result(); isCellExist == 1 {
cellJsonStr, _ := c.client.Get(cellIDHdr).Result() cellJsonStr, _ := c.client.Get("{TS-cell-metrics}," + cellIDHdr).Result()
json.Unmarshal([]byte(cellJsonStr), &cellMetrics) json.Unmarshal([]byte(cellJsonStr), &cellMetrics)
} }
cellMetrics.MeasPeriodPDCP = 20
cellMetrics.MeasPeriodPRB = 20
cellMetrics.CellID = cellIDHdr
if timestampPDCPBytes != nil { if timestampPDCPBytes != nil {
cellMetrics.MeasTimestampPDCPBytes.TVsec = timestampPDCPBytes.TVsec cellMetrics.MeasTimestampPDCPBytes.TVsec = timestampPDCPBytes.TVsec
cellMetrics.MeasTimestampPDCPBytes.TVnsec = timestampPDCPBytes.TVnsec 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) log.Printf("Failed to marshal CellMetrics with CellID [%s]: %v", cellIDHdr, err)
continue continue
} }
err = c.client.Set(cellIDHdr, newCellJsonStr, 0).Err() err = c.client.Set("{TS-cell-metrics}," + cellIDHdr, newCellJsonStr, 0).Err()
if err != nil { if err != nil {
xapp.Logger.Error("Failed to set CellMetrics into redis with CellID [%s]: %v", cellIDHdr, err) 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) log.Printf("Failed to set CellMetrics into redis with CellID [%s]: %v", cellIDHdr, err)

View File

@ -340,12 +340,15 @@ type Timestamp struct {
} }
type CellMetricsEntry struct { type CellMetricsEntry struct {
MeasTimestampPDCPBytes Timestamp `json:"Meas-Timestamp-PDCP-Bytes"` MeasTimestampPDCPBytes Timestamp `json:"MeasTimestampPDCPBytes"`
PDCPBytesDL int64 `json:"PDCP-Bytes-DL"` CellID string `json:"CellID"`
PDCPBytesUL int64 `json:"PDCP-Bytes-UL"` PDCPBytesDL int64 `json:"PDCPBytesDL"`
MeasTimestampPRB Timestamp `json:"Meas-Timestamp-PRB"` PDCPBytesUL int64 `json:"PDCPBytesUL"`
AvailPRBDL int64 `json:"Avail-PRB-DL"` MeasTimestampPRB Timestamp `json:"MeasTimestampAvailPRB"`
AvailPRBUL int64 `json:"Avail-PRB-UL"` AvailPRBDL int64 `json:"AvailPRBDL"`
AvailPRBUL int64 `json:"AvailPRBUL"`
MeasPeriodPDCP int64 `json:"MeasPeriodPDCPBytes"`
MeasPeriodPRB int64 `json:"MeasPeriodAvailPRB"`
} }
type CellRFType struct { type CellRFType struct {
@ -356,19 +359,22 @@ type CellRFType struct {
type NeighborCellRFType struct { type NeighborCellRFType struct {
CellID string `json:"CID"` CellID string `json:"CID"`
CellRF CellRFType `json:"Cell-RF"` CellRF CellRFType `json:"CellRF"`
} }
type UeMetricsEntry struct { type UeMetricsEntry struct {
UeID int64 `json:"UEID"` UeID int64 `json:"UEID"`
ServingCellID string `json:"ServingCellID"` ServingCellID string `json:"ServingCellID"`
MeasTimestampPDCPBytes Timestamp `json:"Meas-Timestamp-PDCP-Bytes"` MeasTimestampPDCPBytes Timestamp `json:"MeasTimestampUEPDCPBytes"`
PDCPBytesDL int64 `json:"PDCP-Bytes-DL"` PDCPBytesDL int64 `json:"UEPDCPBytesDL"`
PDCPBytesUL int64 `json:"PDCP-Bytes-UL"` PDCPBytesUL int64 `json:"UEPDCPBytesUL"`
MeasTimestampPRB Timestamp `json:"Meas-Timestamp-PRB"` MeasTimestampPRB Timestamp `json:"MeasTimestampUEPRBUsage"`
PRBUsageDL int64 `json:"PRB-Usage-DL"` PRBUsageDL int64 `json:"UEPRBUsageDL"`
PRBUsageUL int64 `json:"PRB-Usage-UL"` PRBUsageUL int64 `json:"UEPRBUsageUL"`
MeasTimeRF Timestamp `json:"Meas-Time-RF"` MeasTimeRF Timestamp `json:"MeasTimestampRF"`
ServingCellRF CellRFType `json:"servingCellRfReport"` MeasPeriodRF int64 `json:"MeasPeriodRF"`
NeighborCellsRF []NeighborCellRFType `json:"neighbourCellList"` MeasPeriodPDCP int64 `json:"MeasPeriodUEPDCPBytes"`
MeasPeriodPRB int64 `json:"MeasPeriodUEPRBUsage"`
ServingCellRF CellRFType `json:"ServingCellRF"`
NeighborCellsRF []NeighborCellRFType `json:"NeighborCellRF"`
} }