From ba8e17688fcd3f805b8e1fbc98fc0f8f6ca74db1 Mon Sep 17 00:00:00 2001 From: Andrea Lacava Date: Thu, 18 May 2023 13:56:46 -0400 Subject: [PATCH] implement ns-o-ran ASN1 definition to kpimon using libe2proto --- Dockerfile | 49 ++-- control/control.go | 646 +++++++++++++++++++++++---------------------- control/e2ap.go | 8 +- control/e2sm.go | 446 ++++++++++++++++--------------- control/types.go | 77 +++--- 5 files changed, 630 insertions(+), 596 deletions(-) diff --git a/Dockerfile b/Dockerfile index 487577b..83236e7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,25 +28,37 @@ RUN cd xapp-frame && \ WORKDIR /go/src/gerrit.o-ran-sc.org/r/scp/ric-app/kpimon COPY control/ control/ COPY cmd/ cmd/ -COPY e2ap/ e2ap/ -COPY e2sm/ e2sm/ -# "COMPILING E2AP Wrapper" -RUN cd e2ap && \ - gcc -c -fPIC -Iheaders/ lib/*.c wrapper.c && \ - gcc *.o -shared -o libe2apwrapper.so && \ - cp libe2apwrapper.so /usr/local/lib/ && \ - mkdir /usr/local/include/e2ap && \ - cp wrapper.h headers/*.h /usr/local/include/e2ap && \ - ldconfig +# # "COMPILING E2AP Wrapper" +# RUN cd e2ap && \ +# gcc -c -fPIC -Iheaders/ lib/*.c wrapper.c && \ +# gcc *.o -shared -o libe2apwrapper.so && \ +# cp libe2apwrapper.so /usr/local/lib/ && \ +# mkdir /usr/local/include/e2ap && \ +# cp wrapper.h headers/*.h /usr/local/include/e2ap && \ +# ldconfig -# "COMPILING E2SM Wrapper" -RUN cd e2sm && \ - gcc -c -fPIC -Iheaders/ lib/*.c wrapper.c && \ - gcc *.o -shared -o libe2smwrapper.so && \ - cp libe2smwrapper.so /usr/local/lib/ && \ - mkdir /usr/local/include/e2sm && \ - cp wrapper.h headers/*.h /usr/local/include/e2sm && \ +# # "COMPILING E2SM Wrapper" +# RUN cd e2sm && \ +# gcc -c -fPIC -Iheaders/ lib/*.c wrapper.c && \ +# gcc *.o -shared -o libe2smwrapper.so && \ +# cp libe2smwrapper.so /usr/local/lib/ && \ +# mkdir /usr/local/include/e2sm && \ +# cp wrapper.h headers/*.h /usr/local/include/e2sm && \ +# ldconfig + +RUN git clone -b ns-o-ran https://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@github.com/wineslab/libe2proto + +WORKDIR /go/src/gerrit.o-ran-sc.org/r/scp/ric-app/kpimon/libe2proto + +RUN cmake . +RUN make +RUN make install + +RUN mkdir /usr/local/include/libe2proto && \ + cp src/wrapper/wrapper.h /usr/local/include/libe2proto && \ + cp src/e2ap/*.h /usr/local/include/libe2proto && \ + cp src/e2sm/*.h /usr/local/include/libe2proto && \ ldconfig WORKDIR /go/src/gerrit.o-ran-sc.org/r/scp/ric-app/kpimon @@ -66,8 +78,7 @@ ENV RMR_SEED_RT /opt/routes.txt COPY routes.txt /opt/routes.txt COPY --from=kpimonbuild /usr/local/lib /usr/local/lib -COPY --from=kpimonbuild /usr/local/include/e2ap/*.h /usr/local/include/e2ap/ -COPY --from=kpimonbuild /usr/local/include/e2sm/*.h /usr/local/include/e2sm/ +COPY --from=kpimonbuild /usr/local/include/libe2proto/*.h /usr/local/include/libe2proto/ RUN ldconfig WORKDIR /go/src/gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/config/ COPY --from=kpimonbuild /go/src/gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/config/config-file.yaml . diff --git a/control/control.go b/control/control.go index 5252d4d..dd80d94 100644 --- a/control/control.go +++ b/control/control.go @@ -257,75 +257,81 @@ func (c *Control) handleIndication(params *xapp.RMRParams) (err error) { } - if indHdrFormat1.NRCGI != nil { - - log.Printf("nRCGI.PlmnID: %x", indHdrFormat1.NRCGI.PlmnID.Buf) - log.Printf("nRCGI.NRCellID ID: %x, Unused: %d", indHdrFormat1.NRCGI.NRCellID.Buf, indHdrFormat1.NRCGI.NRCellID.BitsUnused) - - cellIDHdr, err = e2sm.ParseNRCGI(*indHdrFormat1.NRCGI) - if err != nil { - xapp.Logger.Error("Failed to parse NRCGI in RIC Indication Header: %v", err) - log.Printf("Failed to parse NRCGI in RIC Indication Header: %v", err) - return - } + if indHdrFormat1.CollectionStartTime != nil { + log.Printf("CollectionStartTime: %x", indHdrFormat1.CollectionStartTime.Buf) } else { - cellIDHdr = "" + log.Printf("No Collection Start Time") } - if indHdrFormat1.PlmnID != nil { - log.Printf("PlmnID: %x", indHdrFormat1.PlmnID.Buf) + // if indHdrFormat1.NRCGI != nil { - plmnIDHdr, err = e2sm.ParsePLMNIdentity(indHdrFormat1.PlmnID.Buf, indHdrFormat1.PlmnID.Size) - if err != nil { - xapp.Logger.Error("Failed to parse PlmnID in RIC Indication Header: %v", err) - log.Printf("Failed to parse PlmnID in RIC Indication Header: %v", err) - return - } - } else { - plmnIDHdr = "" - } + // log.Printf("nRCGI.PlmnID: %x", indHdrFormat1.NRCGI.PlmnID.Buf) + // log.Printf("nRCGI.NRCellID ID: %x, Unused: %d", indHdrFormat1.NRCGI.NRCellID.Buf, indHdrFormat1.NRCGI.NRCellID.BitsUnused) - if indHdrFormat1.SliceID != nil { - log.Printf("SST: %x", indHdrFormat1.SliceID.SST.Buf) + // cellIDHdr, err = e2sm.ParseNRCGI(*indHdrFormat1.NRCGI) + // if err != nil { + // xapp.Logger.Error("Failed to parse NRCGI in RIC Indication Header: %v", err) + // log.Printf("Failed to parse NRCGI in RIC Indication Header: %v", err) + // return + // } + // } else { + // cellIDHdr = "" + // } - if indHdrFormat1.SliceID.SD != nil { - log.Printf("SD: %x", indHdrFormat1.SliceID.SD.Buf) - } + // if indHdrFormat1.PlmnID != nil { + // log.Printf("PlmnID: %x", indHdrFormat1.PlmnID.Buf) - sliceIDHdr, err = e2sm.ParseSliceID(*indHdrFormat1.SliceID) - if err != nil { - xapp.Logger.Error("Failed to parse SliceID in RIC Indication Header: %v", err) - log.Printf("Failed to parse SliceID in RIC Indication Header: %v", err) - return - } - } else { - sliceIDHdr = -1 - } + // plmnIDHdr, err = e2sm.ParsePLMNIdentity(indHdrFormat1.PlmnID.Buf, indHdrFormat1.PlmnID.Size) + // if err != nil { + // xapp.Logger.Error("Failed to parse PlmnID in RIC Indication Header: %v", err) + // log.Printf("Failed to parse PlmnID in RIC Indication Header: %v", err) + // return + // } + // } else { + // plmnIDHdr = "" + // } - if indHdrFormat1.FiveQI != -1 { - log.Printf("5QI: %d", indHdrFormat1.FiveQI) - } - fiveQIHdr = indHdrFormat1.FiveQI + // if indHdrFormat1.SliceID != nil { + // log.Printf("SST: %x", indHdrFormat1.SliceID.SST.Buf) - if indHdrFormat1.Qci != -1 { - log.Printf("QCI: %d", indHdrFormat1.Qci) - } + // if indHdrFormat1.SliceID.SD != nil { + // log.Printf("SD: %x", indHdrFormat1.SliceID.SD.Buf) + // } - if indHdrFormat1.UeMessageType != -1 { - log.Printf("Ue Report type: %d", indHdrFormat1.UeMessageType) - } + // sliceIDHdr, err = e2sm.ParseSliceID(*indHdrFormat1.SliceID) + // if err != nil { + // xapp.Logger.Error("Failed to parse SliceID in RIC Indication Header: %v", err) + // log.Printf("Failed to parse SliceID in RIC Indication Header: %v", err) + // return + // } + // } else { + // sliceIDHdr = -1 + // } - if indHdrFormat1.GnbDUID != nil { - log.Printf("gNB-DU-ID: %x", indHdrFormat1.GnbDUID.Buf) - } + // if indHdrFormat1.FiveQI != -1 { + // log.Printf("5QI: %d", indHdrFormat1.FiveQI) + // } + // fiveQIHdr = indHdrFormat1.FiveQI - if indHdrFormat1.GnbNameType == 1 { - log.Printf("gNB-DU-Name: %x", (indHdrFormat1.GnbName.(*GNB_DU_Name)).Buf) - } else if indHdrFormat1.GnbNameType == 2 { - log.Printf("gNB-CU-CP-Name: %x", (indHdrFormat1.GnbName.(*GNB_CU_CP_Name)).Buf) - } else if indHdrFormat1.GnbNameType == 3 { - log.Printf("gNB-CU-UP-Name: %x", (indHdrFormat1.GnbName.(*GNB_CU_UP_Name)).Buf) - } + // if indHdrFormat1.Qci != -1 { + // log.Printf("QCI: %d", indHdrFormat1.Qci) + // } + + // if indHdrFormat1.UeMessageType != -1 { + // log.Printf("Ue Report type: %d", indHdrFormat1.UeMessageType) + // } + + // if indHdrFormat1.GnbDUID != nil { + // log.Printf("gNB-DU-ID: %x", indHdrFormat1.GnbDUID.Buf) + // } + + // if indHdrFormat1.GnbNameType == 1 { + // log.Printf("gNB-DU-Name: %x", (indHdrFormat1.GnbName.(*GNB_DU_Name)).Buf) + // } else if indHdrFormat1.GnbNameType == 2 { + // log.Printf("gNB-CU-CP-Name: %x", (indHdrFormat1.GnbName.(*GNB_CU_CP_Name)).Buf) + // } else if indHdrFormat1.GnbNameType == 3 { + // log.Printf("gNB-CU-UP-Name: %x", (indHdrFormat1.GnbName.(*GNB_CU_UP_Name)).Buf) + // } if indHdrFormat1.GlobalgNBID != nil { log.Printf("PlmnID: %x", indHdrFormat1.GlobalgNBID.PlmnID.Buf) @@ -359,7 +365,7 @@ func (c *Control) handleIndication(params *xapp.RMRParams) (err error) { var availPRBUL int64 log.Printf("-----------RIC Indication Message-----------") - log.Printf("StyleType: %d", indMsg.StyleType) + // log.Printf("StyleType: %d", indMsg.StyleType) if indMsg.IndMsgType == 1 { log.Printf("RIC Indication Message Format: %d", indMsg.IndMsgType) @@ -479,9 +485,9 @@ func (c *Control) handleIndication(params *xapp.RMRParams) (err error) { oCUCP := pmContainer.PFContainer.Container.(*OCUCPPFContainerType) - if oCUCP.GNBCUCPName != nil { - log.Printf("gNB-CU-CP Name: %x", oCUCP.GNBCUCPName.Buf) - } + // if oCUCP.GNBCUCPName != nil { + // log.Printf("gNB-CU-CP Name: %x", oCUCP.GNBCUCPName.Buf) + // } log.Printf("NumberOfActiveUEs: %d", oCUCP.CUCPResourceStatus.NumberOfActiveUEs) } else if containerType == 3 { @@ -489,9 +495,9 @@ func (c *Control) handleIndication(params *xapp.RMRParams) (err error) { oCUUP := pmContainer.PFContainer.Container.(*OCUUPPFContainerType) - if oCUUP.GNBCUUPName != nil { - log.Printf("gNB-CU-UP Name: %x", oCUUP.GNBCUUPName.Buf) - } + // if oCUUP.GNBCUUPName != nil { + // log.Printf("gNB-CU-UP Name: %x", oCUUP.GNBCUUPName.Buf) + // } cuUPPFContainerItemCount := oCUUP.CUUPPFContainerItemCount log.Printf("CU-UP PF Container Item Count: %d", cuUPPFContainerItemCount) @@ -614,316 +620,320 @@ func (c *Control) handleIndication(params *xapp.RMRParams) (err error) { } if pmContainer.RANContainer != nil { - log.Printf("RANContainer: %x", pmContainer.RANContainer.Timestamp.Buf) + // log.Printf("RANContainer: %x", pmContainer.RANContainer.Timestamp.Buf) + log.Printf("RANContainer: %x", pmContainer.RANContainer.Buf) + // TODO parse RANContainer octect string - timestamp, _ := e2sm.ParseTimestamp(pmContainer.RANContainer.Timestamp.Buf, pmContainer.RANContainer.Timestamp.Size) - log.Printf("Timestamp=[sec: %d, nsec: %d]", timestamp.TVsec, timestamp.TVnsec) + // timestamp, _ := e2sm.ParseTimestamp(pmContainer.RANContainer.Timestamp.Buf, pmContainer.RANContainer.Timestamp.Size) + // log.Printf("Timestamp=[sec: %d, nsec: %d]", timestamp.TVsec, timestamp.TVnsec) - containerType = pmContainer.RANContainer.ContainerType - if containerType == 1 { - log.Printf("DU Usage Report: ") + // TODO given the result of ran container log + // containerType = pmContainer.RANContainer.ContainerType + // containerType = -1 + // if containerType == 1 { + // log.Printf("DU Usage Report: ") - oDUUE := pmContainer.RANContainer.Container.(*DUUsageReportType) + // oDUUE := pmContainer.RANContainer.Container.(*DUUsageReportType) - for j := 0; j < oDUUE.CellResourceReportItemCount; j++ { - cellResourceReportItem := oDUUE.CellResourceReportItems[j] + // for j := 0; j < oDUUE.CellResourceReportItemCount; j++ { + // cellResourceReportItem := oDUUE.CellResourceReportItems[j] - log.Printf("nRCGI.PlmnID: %x", cellResourceReportItem.NRCGI.PlmnID.Buf) - log.Printf("nRCGI.NRCellID: %x, Unused: %d", cellResourceReportItem.NRCGI.NRCellID.Buf, cellResourceReportItem.NRCGI.NRCellID.BitsUnused) + // log.Printf("nRCGI.PlmnID: %x", cellResourceReportItem.NRCGI.PlmnID.Buf) + // log.Printf("nRCGI.NRCellID: %x, Unused: %d", cellResourceReportItem.NRCGI.NRCellID.Buf, cellResourceReportItem.NRCGI.NRCellID.BitsUnused) - servingCellID, err := e2sm.ParseNRCGI(cellResourceReportItem.NRCGI) - if err != nil { - xapp.Logger.Error("Failed to parse NRCGI in DU Usage Report: %v", err) - log.Printf("Failed to parse NRCGI in DU Usage Report: %v", err) - continue - } + // servingCellID, err := e2sm.ParseNRCGI(cellResourceReportItem.NRCGI) + // if err != nil { + // xapp.Logger.Error("Failed to parse NRCGI in DU Usage Report: %v", err) + // log.Printf("Failed to parse NRCGI in DU Usage Report: %v", err) + // continue + // } - for k := 0; k < cellResourceReportItem.UeResourceReportItemCount; k++ { - ueResourceReportItem := cellResourceReportItem.UeResourceReportItems[k] + // for k := 0; k < cellResourceReportItem.UeResourceReportItemCount; k++ { + // ueResourceReportItem := cellResourceReportItem.UeResourceReportItems[k] - log.Printf("C-RNTI: %x", ueResourceReportItem.CRNTI.Buf) + // log.Printf("C-RNTI: %x", ueResourceReportItem.CRNTI.Buf) - ueID, err := e2sm.ParseInteger(ueResourceReportItem.CRNTI.Buf, ueResourceReportItem.CRNTI.Size) - if err != nil { - xapp.Logger.Error("Failed to parse C-RNTI in DU Usage Report with Serving Cell ID [%s]: %v", servingCellID, err) - log.Printf("Failed to parse C-RNTI in DU Usage Report with Serving Cell ID [%s]: %v", servingCellID, err) - continue - } + // ueID, err := e2sm.ParseInteger(ueResourceReportItem.CRNTI.Buf, ueResourceReportItem.CRNTI.Size) + // if err != nil { + // xapp.Logger.Error("Failed to parse C-RNTI in DU Usage Report with Serving Cell ID [%s]: %v", servingCellID, err) + // log.Printf("Failed to parse C-RNTI in DU Usage Report with Serving Cell ID [%s]: %v", servingCellID, err) + // continue + // } - var ueMetrics UeMetricsEntry + // var ueMetrics UeMetricsEntry - retStr, err := c.sdl.Get([]string{"{TS-UE-metrics}," + strconv.FormatInt(ueID, 10)}) - if err != nil { - panic(err) - xapp.Logger.Error("Failed to get ueMetrics from Redis!") - log.Printf("Failed to get ueMetrics from Redis!") - } else { - if retStr["{TS-UE-metrics},"+strconv.FormatInt(ueID, 10)] != nil { - ueJsonStr := retStr["{TS-UE-metrics},"+strconv.FormatInt(ueID, 10)].(string) - json.Unmarshal([]byte(ueJsonStr), &ueMetrics) - } - } + // retStr, err := c.sdl.Get([]string{"{TS-UE-metrics}," + strconv.FormatInt(ueID, 10)}) + // if err != nil { + // panic(err) + // xapp.Logger.Error("Failed to get ueMetrics from Redis!") + // log.Printf("Failed to get ueMetrics from Redis!") + // } else { + // if retStr["{TS-UE-metrics},"+strconv.FormatInt(ueID, 10)] != nil { + // ueJsonStr := retStr["{TS-UE-metrics},"+strconv.FormatInt(ueID, 10)].(string) + // json.Unmarshal([]byte(ueJsonStr), &ueMetrics) + // } + // } - //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) - //} + // //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 - log.Printf("ServingCellID: %s", ueMetrics.ServingCellID) - ueMetrics.MeasPeriodRF = 20 + // ueMetrics.UeID = ueID + // log.Printf("UeID: %d", ueMetrics.UeID) + // ueMetrics.ServingCellID = servingCellID + // log.Printf("ServingCellID: %s", ueMetrics.ServingCellID) + // ueMetrics.MeasPeriodRF = 20 - if flag { - timestampPRB = timestamp - } + // if flag { + // timestampPRB = timestamp + // } - ueMetrics.MeasTimestampPRB.TVsec = timestamp.TVsec - ueMetrics.MeasTimestampPRB.TVnsec = timestamp.TVnsec + // ueMetrics.MeasTimestampPRB.TVsec = timestamp.TVsec + // ueMetrics.MeasTimestampPRB.TVnsec = timestamp.TVnsec - if ueResourceReportItem.PRBUsageDL != -1 { - ueMetrics.PRBUsageDL = ueResourceReportItem.PRBUsageDL - log.Printf("PRBUsageDL: %d", ueMetrics.PRBUsageDL) - } + // if ueResourceReportItem.PRBUsageDL != -1 { + // ueMetrics.PRBUsageDL = ueResourceReportItem.PRBUsageDL + // log.Printf("PRBUsageDL: %d", ueMetrics.PRBUsageDL) + // } - if ueResourceReportItem.PRBUsageUL != -1 { - ueMetrics.PRBUsageUL = ueResourceReportItem.PRBUsageUL - log.Printf("PRBUsageUL: %d", ueMetrics.PRBUsageUL) - } + // if ueResourceReportItem.PRBUsageUL != -1 { + // ueMetrics.PRBUsageUL = ueResourceReportItem.PRBUsageUL + // log.Printf("PRBUsageUL: %d", ueMetrics.PRBUsageUL) + // } - newUeJsonStr, err := json.Marshal(&ueMetrics) - if err != nil { - xapp.Logger.Error("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 - } + // newUeJsonStr, err := json.Marshal(&ueMetrics) + // if err != nil { + // xapp.Logger.Error("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 + // } - err = c.sdl.Set("{TS-UE-metrics},"+strconv.FormatInt(ueID, 10), newUeJsonStr) - 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) - continue - } + // err = c.sdl.Set("{TS-UE-metrics},"+strconv.FormatInt(ueID, 10), newUeJsonStr) + // 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) + // continue + // } - //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) - // continue - //} - } - } - } else if containerType == 2 { - log.Printf("CU-CP Usage Report: ") + // //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) + // // continue + // //} + // } + // } + // } else if containerType == 2 { + // log.Printf("CU-CP Usage Report: ") - oCUCPUE := pmContainer.RANContainer.Container.(*CUCPUsageReportType) + // oCUCPUE := pmContainer.RANContainer.Container.(*CUCPUsageReportType) - for j := 0; j < oCUCPUE.CellResourceReportItemCount; j++ { - cellResourceReportItem := oCUCPUE.CellResourceReportItems[j] + // for j := 0; j < oCUCPUE.CellResourceReportItemCount; j++ { + // cellResourceReportItem := oCUCPUE.CellResourceReportItems[j] - log.Printf("nRCGI.PlmnID: %x", cellResourceReportItem.NRCGI.PlmnID.Buf) - log.Printf("nRCGI.NRCellID: %x, Unused: %d", cellResourceReportItem.NRCGI.NRCellID.Buf, cellResourceReportItem.NRCGI.NRCellID.BitsUnused) + // log.Printf("nRCGI.PlmnID: %x", cellResourceReportItem.NRCGI.PlmnID.Buf) + // log.Printf("nRCGI.NRCellID: %x, Unused: %d", cellResourceReportItem.NRCGI.NRCellID.Buf, cellResourceReportItem.NRCGI.NRCellID.BitsUnused) - servingCellID, err := e2sm.ParseNRCGI(cellResourceReportItem.NRCGI) - if err != nil { - xapp.Logger.Error("Failed to parse NRCGI in CU-CP Usage Report: %v", err) - log.Printf("Failed to parse NRCGI in CU-CP Usage Report: %v", err) - continue - } + // servingCellID, err := e2sm.ParseNRCGI(cellResourceReportItem.NRCGI) + // if err != nil { + // xapp.Logger.Error("Failed to parse NRCGI in CU-CP Usage Report: %v", err) + // log.Printf("Failed to parse NRCGI in CU-CP Usage Report: %v", err) + // continue + // } - for k := 0; k < cellResourceReportItem.UeResourceReportItemCount; k++ { - ueResourceReportItem := cellResourceReportItem.UeResourceReportItems[k] + // for k := 0; k < cellResourceReportItem.UeResourceReportItemCount; k++ { + // ueResourceReportItem := cellResourceReportItem.UeResourceReportItems[k] - log.Printf("C-RNTI: %x", ueResourceReportItem.CRNTI.Buf) + // log.Printf("C-RNTI: %x", ueResourceReportItem.CRNTI.Buf) - ueID, err := e2sm.ParseInteger(ueResourceReportItem.CRNTI.Buf, ueResourceReportItem.CRNTI.Size) - if err != nil { - xapp.Logger.Error("Failed to parse C-RNTI in CU-CP Usage Report with Serving Cell ID [%s]: %v", err) - log.Printf("Failed to parse C-RNTI in CU-CP Usage Report with Serving Cell ID [%s]: %v", err) - continue - } + // ueID, err := e2sm.ParseInteger(ueResourceReportItem.CRNTI.Buf, ueResourceReportItem.CRNTI.Size) + // if err != nil { + // xapp.Logger.Error("Failed to parse C-RNTI in CU-CP Usage Report with Serving Cell ID [%s]: %v", err) + // log.Printf("Failed to parse C-RNTI in CU-CP Usage Report with Serving Cell ID [%s]: %v", err) + // continue + // } - var ueMetrics UeMetricsEntry + // var ueMetrics UeMetricsEntry - retStr, err := c.sdl.Get([]string{"{TS-UE-metrics}," + strconv.FormatInt(ueID, 10)}) - if err != nil { - panic(err) - xapp.Logger.Error("Failed to get ueMetrics from Redis!") - log.Printf("Failed to get ueMetrics from Redis!") - } else { - if retStr["{TS-UE-metrics},"+strconv.FormatInt(ueID, 10)] != nil { - ueJsonStr := retStr["{TS-UE-metrics},"+strconv.FormatInt(ueID, 10)].(string) - json.Unmarshal([]byte(ueJsonStr), &ueMetrics) - } - } + // retStr, err := c.sdl.Get([]string{"{TS-UE-metrics}," + strconv.FormatInt(ueID, 10)}) + // if err != nil { + // panic(err) + // xapp.Logger.Error("Failed to get ueMetrics from Redis!") + // log.Printf("Failed to get ueMetrics from Redis!") + // } else { + // if retStr["{TS-UE-metrics},"+strconv.FormatInt(ueID, 10)] != nil { + // ueJsonStr := retStr["{TS-UE-metrics},"+strconv.FormatInt(ueID, 10)].(string) + // json.Unmarshal([]byte(ueJsonStr), &ueMetrics) + // } + // } - //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) - //} + // //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 - log.Printf("ServingCellID: %s", ueMetrics.ServingCellID) + // ueMetrics.UeID = ueID + // log.Printf("UeID: %d", ueMetrics.UeID) + // ueMetrics.ServingCellID = servingCellID + // log.Printf("ServingCellID: %s", ueMetrics.ServingCellID) - ueMetrics.MeasTimeRF.TVsec = timestamp.TVsec - ueMetrics.MeasTimeRF.TVnsec = timestamp.TVnsec + // ueMetrics.MeasTimeRF.TVsec = timestamp.TVsec + // ueMetrics.MeasTimeRF.TVnsec = timestamp.TVnsec - ueMetrics.MeasPeriodPDCP = 20 - ueMetrics.MeasPeriodPRB = 20 + // 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) - if err != nil { - xapp.Logger.Error("Failed to Unmarshal ServingCellRF in CU-CP Usage Report with UE ID [%d]: %v", ueID, err) - log.Printf("Failed to Unmarshal ServingCellRF in CU-CP Usage Report with UE ID [%d]: %v", ueID, err) - log.Printf("ServingCellRF raw data: %x", ueResourceReportItem.ServingCellRF.Buf) - continue - } - } + // if ueResourceReportItem.ServingCellRF != nil { + // err = json.Unmarshal(ueResourceReportItem.ServingCellRF.Buf, &ueMetrics.ServingCellRF) + // log.Printf("ueMetrics.ServingCellRF: %+v", ueMetrics.ServingCellRF) + // if err != nil { + // xapp.Logger.Error("Failed to Unmarshal ServingCellRF in CU-CP Usage Report with UE ID [%d]: %v", ueID, err) + // log.Printf("Failed to Unmarshal ServingCellRF in CU-CP Usage Report with UE ID [%d]: %v", ueID, err) + // log.Printf("ServingCellRF raw data: %x", ueResourceReportItem.ServingCellRF.Buf) + // continue + // } + // } - if ueResourceReportItem.NeighborCellRF != nil { - err = json.Unmarshal(ueResourceReportItem.NeighborCellRF.Buf, &ueMetrics.NeighborCellsRF) - log.Printf("ueMetrics.NeighborCellsRF: %+v", ueMetrics.NeighborCellsRF) - if err != nil { - xapp.Logger.Error("Failed to Unmarshal NeighborCellRF in CU-CP Usage Report with UE ID [%d]: %v", ueID, err) - log.Printf("Failed to Unmarshal NeighborCellRF in CU-CP Usage Report with UE ID [%d]: %v", ueID, err) - log.Printf("NeighborCellRF raw data: %x", ueResourceReportItem.NeighborCellRF.Buf) - continue - } - } + // if ueResourceReportItem.NeighborCellRF != nil { + // err = json.Unmarshal(ueResourceReportItem.NeighborCellRF.Buf, &ueMetrics.NeighborCellsRF) + // log.Printf("ueMetrics.NeighborCellsRF: %+v", ueMetrics.NeighborCellsRF) + // if err != nil { + // xapp.Logger.Error("Failed to Unmarshal NeighborCellRF in CU-CP Usage Report with UE ID [%d]: %v", ueID, err) + // log.Printf("Failed to Unmarshal NeighborCellRF in CU-CP Usage Report with UE ID [%d]: %v", ueID, err) + // log.Printf("NeighborCellRF raw data: %x", ueResourceReportItem.NeighborCellRF.Buf) + // continue + // } + // } - newUeJsonStr, err := json.Marshal(&ueMetrics) - if err != nil { - xapp.Logger.Error("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 - } + // newUeJsonStr, err := json.Marshal(&ueMetrics) + // if err != nil { + // xapp.Logger.Error("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 + // } - err = c.sdl.Set("{TS-UE-metrics},"+strconv.FormatInt(ueID, 10), newUeJsonStr) - 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) - continue - } + // err = c.sdl.Set("{TS-UE-metrics},"+strconv.FormatInt(ueID, 10), newUeJsonStr) + // 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) + // continue + // } - //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) - // continue - //} - } - } - } else if containerType == 3 { - log.Printf("CU-UP Usage Report: ") + // //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) + // // continue + // //} + // } + // } + // } else if containerType == 3 { + // log.Printf("CU-UP Usage Report: ") - oCUUPUE := pmContainer.RANContainer.Container.(*CUUPUsageReportType) + // oCUUPUE := pmContainer.RANContainer.Container.(*CUUPUsageReportType) - for j := 0; j < oCUUPUE.CellResourceReportItemCount; j++ { - cellResourceReportItem := oCUUPUE.CellResourceReportItems[j] + // for j := 0; j < oCUUPUE.CellResourceReportItemCount; j++ { + // cellResourceReportItem := oCUUPUE.CellResourceReportItems[j] - log.Printf("nRCGI.PlmnID: %x", cellResourceReportItem.NRCGI.PlmnID.Buf) - log.Printf("nRCGI.NRCellID: %x, Unused: %d", cellResourceReportItem.NRCGI.NRCellID.Buf, cellResourceReportItem.NRCGI.NRCellID.BitsUnused) + // log.Printf("nRCGI.PlmnID: %x", cellResourceReportItem.NRCGI.PlmnID.Buf) + // log.Printf("nRCGI.NRCellID: %x, Unused: %d", cellResourceReportItem.NRCGI.NRCellID.Buf, cellResourceReportItem.NRCGI.NRCellID.BitsUnused) - servingCellID, err := e2sm.ParseNRCGI(cellResourceReportItem.NRCGI) - if err != nil { - xapp.Logger.Error("Failed to parse NRCGI in CU-UP Usage Report: %v", err) - log.Printf("Failed to parse NRCGI in CU-UP Usage Report: %v", err) - continue - } + // servingCellID, err := e2sm.ParseNRCGI(cellResourceReportItem.NRCGI) + // if err != nil { + // xapp.Logger.Error("Failed to parse NRCGI in CU-UP Usage Report: %v", err) + // log.Printf("Failed to parse NRCGI in CU-UP Usage Report: %v", err) + // continue + // } - for k := 0; k < cellResourceReportItem.UeResourceReportItemCount; k++ { - ueResourceReportItem := cellResourceReportItem.UeResourceReportItems[k] + // for k := 0; k < cellResourceReportItem.UeResourceReportItemCount; k++ { + // ueResourceReportItem := cellResourceReportItem.UeResourceReportItems[k] - log.Printf("C-RNTI: %x", ueResourceReportItem.CRNTI.Buf) + // log.Printf("C-RNTI: %x", ueResourceReportItem.CRNTI.Buf) - ueID, err := e2sm.ParseInteger(ueResourceReportItem.CRNTI.Buf, ueResourceReportItem.CRNTI.Size) - if err != nil { - xapp.Logger.Error("Failed to parse C-RNTI in CU-UP Usage Report Serving Cell ID [%s]: %v", servingCellID, err) - log.Printf("Failed to parse C-RNTI in CU-UP Usage Report Serving Cell ID [%s]: %v", servingCellID, err) - continue - } + // ueID, err := e2sm.ParseInteger(ueResourceReportItem.CRNTI.Buf, ueResourceReportItem.CRNTI.Size) + // if err != nil { + // xapp.Logger.Error("Failed to parse C-RNTI in CU-UP Usage Report Serving Cell ID [%s]: %v", servingCellID, err) + // log.Printf("Failed to parse C-RNTI in CU-UP Usage Report Serving Cell ID [%s]: %v", servingCellID, err) + // continue + // } - var ueMetrics UeMetricsEntry + // var ueMetrics UeMetricsEntry - retStr, err := c.sdl.Get([]string{"{TS-UE-metrics}," + strconv.FormatInt(ueID, 10)}) - if err != nil { - panic(err) - xapp.Logger.Error("Failed to get ueMetrics from Redis!") - log.Printf("Failed to get ueMetrics from Redis!") - } else { - if retStr["{TS-UE-metrics},"+strconv.FormatInt(ueID, 10)] != nil { - ueJsonStr := retStr["{TS-UE-metrics},"+strconv.FormatInt(ueID, 10)].(string) - json.Unmarshal([]byte(ueJsonStr), &ueMetrics) - } - } + // retStr, err := c.sdl.Get([]string{"{TS-UE-metrics}," + strconv.FormatInt(ueID, 10)}) + // if err != nil { + // panic(err) + // xapp.Logger.Error("Failed to get ueMetrics from Redis!") + // log.Printf("Failed to get ueMetrics from Redis!") + // } else { + // if retStr["{TS-UE-metrics},"+strconv.FormatInt(ueID, 10)] != nil { + // ueJsonStr := retStr["{TS-UE-metrics},"+strconv.FormatInt(ueID, 10)].(string) + // json.Unmarshal([]byte(ueJsonStr), &ueMetrics) + // } + // } - //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) - //} + // //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 - log.Printf("ServingCellID: %s", ueMetrics.ServingCellID) + // ueMetrics.UeID = ueID + // log.Printf("UeID: %d", ueMetrics.UeID) + // ueMetrics.ServingCellID = servingCellID + // log.Printf("ServingCellID: %s", ueMetrics.ServingCellID) - if flag { - timestampPDCPBytes = timestamp - } + // if flag { + // timestampPDCPBytes = timestamp + // } - ueMetrics.MeasTimestampPDCPBytes.TVsec = timestamp.TVsec - ueMetrics.MeasTimestampPDCPBytes.TVnsec = timestamp.TVnsec + // ueMetrics.MeasTimestampPDCPBytes.TVsec = timestamp.TVsec + // ueMetrics.MeasTimestampPDCPBytes.TVnsec = timestamp.TVnsec - if ueResourceReportItem.PDCPBytesDL != nil { - ueMetrics.PDCPBytesDL, err = e2sm.ParseInteger(ueResourceReportItem.PDCPBytesDL.Buf, ueResourceReportItem.PDCPBytesDL.Size) - if err != nil { - xapp.Logger.Error("Failed to parse PDCPBytesDL in CU-UP Usage Report with UE ID [%d]: %v", ueID, err) - log.Printf("Failed to parse PDCPBytesDL in CU-UP Usage Report with UE ID [%d]: %v", ueID, err) - continue - } - } + // if ueResourceReportItem.PDCPBytesDL != nil { + // ueMetrics.PDCPBytesDL, err = e2sm.ParseInteger(ueResourceReportItem.PDCPBytesDL.Buf, ueResourceReportItem.PDCPBytesDL.Size) + // if err != nil { + // xapp.Logger.Error("Failed to parse PDCPBytesDL in CU-UP Usage Report with UE ID [%d]: %v", ueID, err) + // log.Printf("Failed to parse PDCPBytesDL in CU-UP Usage Report with UE ID [%d]: %v", ueID, err) + // continue + // } + // } - if ueResourceReportItem.PDCPBytesUL != nil { - ueMetrics.PDCPBytesUL, err = e2sm.ParseInteger(ueResourceReportItem.PDCPBytesUL.Buf, ueResourceReportItem.PDCPBytesUL.Size) - if err != nil { - xapp.Logger.Error("Failed to parse PDCPBytesUL in CU-UP Usage Report with UE ID [%d]: %v", ueID, err) - log.Printf("Failed to parse PDCPBytesUL in CU-UP Usage Report with UE ID [%d]: %v", ueID, err) - continue - } - } + // if ueResourceReportItem.PDCPBytesUL != nil { + // ueMetrics.PDCPBytesUL, err = e2sm.ParseInteger(ueResourceReportItem.PDCPBytesUL.Buf, ueResourceReportItem.PDCPBytesUL.Size) + // if err != nil { + // xapp.Logger.Error("Failed to parse PDCPBytesUL in CU-UP Usage Report with UE ID [%d]: %v", ueID, err) + // log.Printf("Failed to parse PDCPBytesUL in CU-UP Usage Report with UE ID [%d]: %v", ueID, err) + // continue + // } + // } - newUeJsonStr, err := json.Marshal(&ueMetrics) - if err != nil { - xapp.Logger.Error("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 - } + // newUeJsonStr, err := json.Marshal(&ueMetrics) + // if err != nil { + // xapp.Logger.Error("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 + // } - err = c.sdl.Set("{TS-UE-metrics},"+strconv.FormatInt(ueID, 10), newUeJsonStr) - 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) - continue - } + // err = c.sdl.Set("{TS-UE-metrics},"+strconv.FormatInt(ueID, 10), newUeJsonStr) + // 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) + // continue + // } - //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) - // continue - //} - } - } - } else { - xapp.Logger.Error("Unknown PF Container Type: %d", containerType) - log.Printf("Unknown PF Container Type: %d", containerType) - continue - } + // //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) + // // continue + // //} + // } + // } + // } else { + // xapp.Logger.Error("Unknown PF Container Type: %d", containerType) + // log.Printf("Unknown PF Container Type: %d", containerType) + // continue + // } } if flag { diff --git a/control/e2ap.go b/control/e2ap.go index 867564c..619d71d 100644 --- a/control/e2ap.go +++ b/control/e2ap.go @@ -21,9 +21,9 @@ package control /* #include -#include -#cgo LDFLAGS: -le2apwrapper -#cgo CFLAGS: -I/usr/local/include/e2ap +#include +#cgo LDFLAGS: -le2proto -lm +#cgo CFLAGS: -I/usr/local/include/libe2proto */ import "C" @@ -41,7 +41,7 @@ func (c *E2ap) GetSubscriptionRequestSequenceNumber(payload []byte) (subId uint1 cptr := unsafe.Pointer(&payload[0]) cret := C.e2ap_get_ric_subscription_request_sequence_number(cptr, C.size_t(len(payload))) if cret < 0 { - return 0, errors.New("e2ap wrapper is unable to get Subscirption Request Sequence Number due to wrong or invalid payload") + return 0, errors.New("e2ap wrapper is unable to get Subscription Request Sequence Number due to wrong or invalid payload") } subId = uint16(cret) return diff --git a/control/e2sm.go b/control/e2sm.go index d6a4157..c37bdf8 100644 --- a/control/e2sm.go +++ b/control/e2sm.go @@ -20,9 +20,9 @@ package control /* -#include -#cgo LDFLAGS: -le2smwrapper -#cgo CFLAGS: -I/usr/local/include/e2sm +#include +#cgo LDFLAGS: -le2proto -lm +#cgo CFLAGS: -I/usr/local/include/libe2proto */ import "C" @@ -72,8 +72,9 @@ func (c *E2sm) GetIndicationHeader(buffer []byte) (indHdr *IndicationHeader, err indHdrFormat1 := &IndicationHeaderFormat1{} indHdrFormat1_C := *(**C.E2SM_KPM_IndicationHeader_Format1_t)(unsafe.Pointer(&decodedHdr.choice[0])) - if indHdrFormat1_C.id_GlobalKPMnode_ID != nil { - globalKPMnodeID_C := (*C.GlobalKPMnode_ID_t)(indHdrFormat1_C.id_GlobalKPMnode_ID) + // Decode and analysis of GlobalE2node_ID + if uintptr(unsafe.Pointer(&indHdrFormat1_C.id_GlobalE2node_ID)) != uintptr(0) { + globalKPMnodeID_C := (C.GlobalE2node_ID_t)(indHdrFormat1_C.id_GlobalE2node_ID) indHdrFormat1.GlobalKPMnodeIDType = int32(globalKPMnodeID_C.present) if indHdrFormat1.GlobalKPMnodeIDType == 1 { @@ -226,118 +227,126 @@ func (c *E2sm) GetIndicationHeader(buffer []byte) (indHdr *IndicationHeader, err indHdrFormat1.GlobalKPMnodeIDType = 0 } - if indHdrFormat1_C.nRCGI != nil { - indHdrFormat1.NRCGI = &NRCGIType{} + // Decode and analysis of CollectionStartTime + if uintptr(unsafe.Pointer(&indHdrFormat1_C.collectionStartTime)) != uintptr(0) { + indHdrFormat1.CollectionStartTime = &OctetString{} - plmnID := indHdrFormat1_C.nRCGI.pLMN_Identity - indHdrFormat1.NRCGI.PlmnID.Buf = C.GoBytes(unsafe.Pointer(plmnID.buf), C.int(plmnID.size)) - indHdrFormat1.NRCGI.PlmnID.Size = int(plmnID.size) - - nRCellID := indHdrFormat1_C.nRCGI.nRCellIdentity - indHdrFormat1.NRCGI.NRCellID.Buf = C.GoBytes(unsafe.Pointer(nRCellID.buf), C.int(nRCellID.size)) - indHdrFormat1.NRCGI.NRCellID.Size = int(nRCellID.size) - indHdrFormat1.NRCGI.NRCellID.BitsUnused = int(nRCellID.bits_unused) + indHdrFormat1.CollectionStartTime.Buf = C.GoBytes(unsafe.Pointer(indHdrFormat1_C.collectionStartTime.buf), C.int(indHdrFormat1_C.collectionStartTime.size)) + indHdrFormat1.CollectionStartTime.Size = int(indHdrFormat1_C.collectionStartTime.size) } - if indHdrFormat1_C.pLMN_Identity != nil { - indHdrFormat1.PlmnID = &OctetString{} + // if indHdrFormat1_C.nRCGI != nil { + // indHdrFormat1.NRCGI = &NRCGIType{} - indHdrFormat1.PlmnID.Buf = C.GoBytes(unsafe.Pointer(indHdrFormat1_C.pLMN_Identity.buf), C.int(indHdrFormat1_C.pLMN_Identity.size)) - indHdrFormat1.PlmnID.Size = int(indHdrFormat1_C.pLMN_Identity.size) - } + // plmnID := indHdrFormat1_C.nRCGI.pLMN_Identity + // indHdrFormat1.NRCGI.PlmnID.Buf = C.GoBytes(unsafe.Pointer(plmnID.buf), C.int(plmnID.size)) + // indHdrFormat1.NRCGI.PlmnID.Size = int(plmnID.size) - if indHdrFormat1_C.sliceID != nil { - indHdrFormat1.SliceID = &SliceIDType{} + // nRCellID := indHdrFormat1_C.nRCGI.nRCellIdentity + // indHdrFormat1.NRCGI.NRCellID.Buf = C.GoBytes(unsafe.Pointer(nRCellID.buf), C.int(nRCellID.size)) + // indHdrFormat1.NRCGI.NRCellID.Size = int(nRCellID.size) + // indHdrFormat1.NRCGI.NRCellID.BitsUnused = int(nRCellID.bits_unused) + // } - sST := indHdrFormat1_C.sliceID.sST - indHdrFormat1.SliceID.SST.Buf = C.GoBytes(unsafe.Pointer(sST.buf), C.int(sST.size)) - indHdrFormat1.SliceID.SST.Size = int(sST.size) + // if indHdrFormat1_C.pLMN_Identity != nil { + // indHdrFormat1.PlmnID = &OctetString{} - if indHdrFormat1_C.sliceID.sD != nil { - indHdrFormat1.SliceID.SD = &OctetString{} + // indHdrFormat1.PlmnID.Buf = C.GoBytes(unsafe.Pointer(indHdrFormat1_C.pLMN_Identity.buf), C.int(indHdrFormat1_C.pLMN_Identity.size)) + // indHdrFormat1.PlmnID.Size = int(indHdrFormat1_C.pLMN_Identity.size) + // } - sD := indHdrFormat1_C.sliceID.sD - indHdrFormat1.SliceID.SD.Buf = C.GoBytes(unsafe.Pointer(sD.buf), C.int(sD.size)) - indHdrFormat1.SliceID.SD.Size = int(sD.size) - } - } + // if indHdrFormat1_C.sliceID != nil { + // indHdrFormat1.SliceID = &SliceIDType{} - if indHdrFormat1_C.fiveQI != nil { - indHdrFormat1.FiveQI = int64(*indHdrFormat1_C.fiveQI) - } else { - indHdrFormat1.FiveQI = -1 - } + // sST := indHdrFormat1_C.sliceID.sST + // indHdrFormat1.SliceID.SST.Buf = C.GoBytes(unsafe.Pointer(sST.buf), C.int(sST.size)) + // indHdrFormat1.SliceID.SST.Size = int(sST.size) - if indHdrFormat1_C.qci != nil { - indHdrFormat1.Qci = int64(*indHdrFormat1_C.qci) - } else { - indHdrFormat1.Qci = -1 - } + // if indHdrFormat1_C.sliceID.sD != nil { + // indHdrFormat1.SliceID.SD = &OctetString{} - if indHdrFormat1_C.message_Type != nil { - indHdrFormat1.UeMessageType = int32(*indHdrFormat1_C.message_Type) - } else { - indHdrFormat1.UeMessageType = -1 - } + // sD := indHdrFormat1_C.sliceID.sD + // indHdrFormat1.SliceID.SD.Buf = C.GoBytes(unsafe.Pointer(sD.buf), C.int(sD.size)) + // indHdrFormat1.SliceID.SD.Size = int(sD.size) + // } + // } - if indHdrFormat1_C.gNB_DU_ID != nil { - indHdrFormat1.GnbDUID = &Integer{} + // if indHdrFormat1_C.fiveQI != nil { + // indHdrFormat1.FiveQI = int64(*indHdrFormat1_C.fiveQI) + // } else { + // indHdrFormat1.FiveQI = -1 + // } - indHdrFormat1.GnbDUID.Buf = C.GoBytes(unsafe.Pointer(indHdrFormat1_C.gNB_DU_ID.buf), C.int(indHdrFormat1_C.gNB_DU_ID.size)) - indHdrFormat1.GnbDUID.Size = int(indHdrFormat1_C.gNB_DU_ID.size) - } + // if indHdrFormat1_C.qci != nil { + // indHdrFormat1.Qci = int64(*indHdrFormat1_C.qci) + // } else { + // indHdrFormat1.Qci = -1 + // } - if indHdrFormat1_C.gNB_Name != nil { - indHdrFormat1.GnbNameType = int32(indHdrFormat1_C.gNB_Name.present) - if indHdrFormat1.GnbNameType == 1 { - gNBName := &GNB_DU_Name{} - gNBName_C := (*C.GNB_DU_Name_t)(unsafe.Pointer(&indHdrFormat1_C.gNB_Name.choice[0])) + // if indHdrFormat1_C.message_Type != nil { + // indHdrFormat1.UeMessageType = int32(*indHdrFormat1_C.message_Type) + // } else { + // indHdrFormat1.UeMessageType = -1 + // } - gNBName.Buf = C.GoBytes(unsafe.Pointer(gNBName_C.buf), C.int(gNBName_C.size)) - gNBName.Size = int(gNBName_C.size) + // if indHdrFormat1_C.gNB_DU_ID != nil { + // indHdrFormat1.GnbDUID = &Integer{} - indHdrFormat1.GnbName = gNBName - } else if indHdrFormat1.GnbNameType == 2 { - gNBName := &GNB_CU_CP_Name{} - gNBName_C := (*C.GNB_CU_CP_Name_t)(unsafe.Pointer(&indHdrFormat1_C.gNB_Name.choice[0])) + // indHdrFormat1.GnbDUID.Buf = C.GoBytes(unsafe.Pointer(indHdrFormat1_C.gNB_DU_ID.buf), C.int(indHdrFormat1_C.gNB_DU_ID.size)) + // indHdrFormat1.GnbDUID.Size = int(indHdrFormat1_C.gNB_DU_ID.size) + // } - gNBName.Buf = C.GoBytes(unsafe.Pointer(gNBName_C.buf), C.int(gNBName_C.size)) - gNBName.Size = int(gNBName_C.size) + // if indHdrFormat1_C.gNB_Name != nil { + // indHdrFormat1.GnbNameType = int32(indHdrFormat1_C.gNB_Name.present) + // if indHdrFormat1.GnbNameType == 1 { + // gNBName := &GNB_DU_Name{} + // gNBName_C := (*C.GNB_DU_Name_t)(unsafe.Pointer(&indHdrFormat1_C.gNB_Name.choice[0])) - indHdrFormat1.GnbName = gNBName - } else if indHdrFormat1.GnbNameType == 3 { - gNBName := &GNB_CU_UP_Name{} - gNBName_C := (*C.GNB_CU_UP_Name_t)(unsafe.Pointer(&indHdrFormat1_C.gNB_Name.choice[0])) + // gNBName.Buf = C.GoBytes(unsafe.Pointer(gNBName_C.buf), C.int(gNBName_C.size)) + // gNBName.Size = int(gNBName_C.size) - gNBName.Buf = C.GoBytes(unsafe.Pointer(gNBName_C.buf), C.int(gNBName_C.size)) - gNBName.Size = int(gNBName_C.size) + // indHdrFormat1.GnbName = gNBName + // } else if indHdrFormat1.GnbNameType == 2 { + // gNBName := &GNB_CU_CP_Name{} + // gNBName_C := (*C.GNB_CU_CP_Name_t)(unsafe.Pointer(&indHdrFormat1_C.gNB_Name.choice[0])) - indHdrFormat1.GnbName = gNBName - } - } else { - indHdrFormat1.GnbNameType = -1 - } + // gNBName.Buf = C.GoBytes(unsafe.Pointer(gNBName_C.buf), C.int(gNBName_C.size)) + // gNBName.Size = int(gNBName_C.size) - if indHdrFormat1_C.global_GNB_ID != nil { - indHdrFormat1.GlobalgNBID = &GlobalgNBIDType{} + // indHdrFormat1.GnbName = gNBName + // } else if indHdrFormat1.GnbNameType == 3 { + // gNBName := &GNB_CU_UP_Name{} + // gNBName_C := (*C.GNB_CU_UP_Name_t)(unsafe.Pointer(&indHdrFormat1_C.gNB_Name.choice[0])) - plmnID_C := indHdrFormat1_C.global_GNB_ID.plmn_id - indHdrFormat1.GlobalgNBID.PlmnID.Buf = C.GoBytes(unsafe.Pointer(plmnID_C.buf), C.int(plmnID_C.size)) - indHdrFormat1.GlobalgNBID.PlmnID.Size = int(plmnID_C.size) + // gNBName.Buf = C.GoBytes(unsafe.Pointer(gNBName_C.buf), C.int(gNBName_C.size)) + // gNBName.Size = int(gNBName_C.size) - globalgNBID_gNBID_C := indHdrFormat1_C.global_GNB_ID.gnb_id - indHdrFormat1.GlobalgNBID.GnbIDType = int(globalgNBID_gNBID_C.present) - if indHdrFormat1.GlobalgNBID.GnbIDType == 1 { - gNBID := &GNBID{} - gNBID_C := (*C.BIT_STRING_t)(unsafe.Pointer(&globalgNBID_gNBID_C.choice[0])) + // indHdrFormat1.GnbName = gNBName + // } + // } else { + // indHdrFormat1.GnbNameType = -1 + // } - gNBID.Buf = C.GoBytes(unsafe.Pointer(gNBID_C.buf), C.int(gNBID_C.size)) - gNBID.Size = int(gNBID_C.size) - gNBID.BitsUnused = int(gNBID_C.bits_unused) + // if indHdrFormat1_C.global_GNB_ID != nil { + // indHdrFormat1.GlobalgNBID = &GlobalgNBIDType{} - indHdrFormat1.GlobalgNBID.GnbID = gNBID - } - } + // plmnID_C := indHdrFormat1_C.global_GNB_ID.plmn_id + // indHdrFormat1.GlobalgNBID.PlmnID.Buf = C.GoBytes(unsafe.Pointer(plmnID_C.buf), C.int(plmnID_C.size)) + // indHdrFormat1.GlobalgNBID.PlmnID.Size = int(plmnID_C.size) + + // globalgNBID_gNBID_C := indHdrFormat1_C.global_GNB_ID.gnb_id + // indHdrFormat1.GlobalgNBID.GnbIDType = int(globalgNBID_gNBID_C.present) + // if indHdrFormat1.GlobalgNBID.GnbIDType == 1 { + // gNBID := &GNBID{} + // gNBID_C := (*C.BIT_STRING_t)(unsafe.Pointer(&globalgNBID_gNBID_C.choice[0])) + + // gNBID.Buf = C.GoBytes(unsafe.Pointer(gNBID_C.buf), C.int(gNBID_C.size)) + // gNBID.Size = int(gNBID_C.size) + // gNBID.BitsUnused = int(gNBID_C.bits_unused) + + // indHdrFormat1.GlobalgNBID.GnbID = gNBID + // } + // } indHdr.IndHdr = indHdrFormat1 } else { @@ -350,19 +359,19 @@ func (c *E2sm) GetIndicationHeader(buffer []byte) (indHdr *IndicationHeader, err func (c *E2sm) GetIndicationMessage(buffer []byte) (indMsg *IndicationMessage, err error) { cptr := unsafe.Pointer(&buffer[0]) indMsg = &IndicationMessage{} - decodedMsg := C.e2sm_decode_ric_indication_message(cptr, C.size_t(len(buffer))) - if decodedMsg == nil { + decodedIndicationMsg := C.e2sm_decode_ric_indication_message(cptr, C.size_t(len(buffer))) + if decodedIndicationMsg == nil { return indMsg, errors.New("e2sm wrapper is unable to get IndicationMessage due to wrong or invalid input") } - defer C.e2sm_free_ric_indication_message(decodedMsg) + defer C.e2sm_free_ric_indication_message(decodedIndicationMsg) - indMsg.StyleType = int64(decodedMsg.ric_Style_Type) + // indMsg.StyleType = int64(decodedIndicationMsg.ric_Style_Type) - indMsg.IndMsgType = int32(decodedMsg.indicationMessage.present) + indMsg.IndMsgType = int32(decodedIndicationMsg.present) if indMsg.IndMsgType == 1 { indMsgFormat1 := &IndicationMessageFormat1{} - indMsgFormat1_C := *(**C.E2SM_KPM_IndicationMessage_Format1_t)(unsafe.Pointer(&decodedMsg.indicationMessage.choice[0])) + indMsgFormat1_C := *(**C.E2SM_KPM_IndicationMessage_Format1_t)(unsafe.Pointer(&decodedIndicationMsg.choice[0])) indMsgFormat1.PMContainerCount = int(indMsgFormat1_C.pm_Containers.list.count) for i := 0; i < indMsgFormat1.PMContainerCount; i++ { @@ -461,11 +470,11 @@ func (c *E2sm) GetIndicationMessage(buffer []byte) (indMsg *IndicationMessage, e duPMEPC := &DUPMEPCContainerType{} duPMEPC_C := (*C.EPC_DU_PM_Container_t)(servedPlmnPerCell_C.du_PM_EPC) - duPMEPC.PerQCIReportCount = int(duPMEPC_C.perQCIReportList.list.count) + duPMEPC.PerQCIReportCount = int(duPMEPC_C.perQCIReportList_du.list.count) for l := 0; l < duPMEPC.PerQCIReportCount; l++ { perQCIReport := &duPMEPC.PerQCIReports[l] var sizeof_PerQCIReportListItem_t *C.PerQCIReportListItem_t - perQCIReport_C := *(**C.PerQCIReportListItem_t)(unsafe.Pointer((uintptr)(unsafe.Pointer(duPMEPC_C.perQCIReportList.list.array)) + (uintptr)(l)*unsafe.Sizeof(sizeof_PerQCIReportListItem_t))) + perQCIReport_C := *(**C.PerQCIReportListItem_t)(unsafe.Pointer((uintptr)(unsafe.Pointer(duPMEPC_C.perQCIReportList_du.list.array)) + (uintptr)(l)*unsafe.Sizeof(sizeof_PerQCIReportListItem_t))) perQCIReport.QCI = int64(perQCIReport_C.qci) @@ -492,11 +501,11 @@ func (c *E2sm) GetIndicationMessage(buffer []byte) (indMsg *IndicationMessage, e oCU_CP_PF := &OCUCPPFContainerType{} oCU_CP_PF_C := *(**C.OCUCP_PF_Container_t)(unsafe.Pointer(&pmContainer_C.performanceContainer.choice[0])) - if oCU_CP_PF_C.gNB_CU_CP_Name != nil { - oCU_CP_PF.GNBCUCPName = &PrintableString{} - oCU_CP_PF.GNBCUCPName.Buf = C.GoBytes(unsafe.Pointer(oCU_CP_PF_C.gNB_CU_CP_Name.buf), C.int(oCU_CP_PF_C.gNB_CU_CP_Name.size)) - oCU_CP_PF.GNBCUCPName.Size = int(oCU_CP_PF_C.gNB_CU_CP_Name.size) - } + // if oCU_CP_PF_C.gNB_CU_CP_Name != nil { + // oCU_CP_PF.GNBCUCPName = &PrintableString{} + // oCU_CP_PF.GNBCUCPName.Buf = C.GoBytes(unsafe.Pointer(oCU_CP_PF_C.gNB_CU_CP_Name.buf), C.int(oCU_CP_PF_C.gNB_CU_CP_Name.size)) + // oCU_CP_PF.GNBCUCPName.Size = int(oCU_CP_PF_C.gNB_CU_CP_Name.size) + // } if oCU_CP_PF_C.cu_CP_Resource_Status.numberOfActive_UEs != nil { oCU_CP_PF.CUCPResourceStatus.NumberOfActiveUEs = int64(*oCU_CP_PF_C.cu_CP_Resource_Status.numberOfActive_UEs) @@ -507,11 +516,11 @@ func (c *E2sm) GetIndicationMessage(buffer []byte) (indMsg *IndicationMessage, e oCU_UP_PF := &OCUUPPFContainerType{} oCU_UP_PF_C := *(**C.OCUUP_PF_Container_t)(unsafe.Pointer(&pmContainer_C.performanceContainer.choice[0])) - if oCU_UP_PF_C.gNB_CU_UP_Name != nil { - oCU_UP_PF.GNBCUUPName = &PrintableString{} - oCU_UP_PF.GNBCUUPName.Buf = C.GoBytes(unsafe.Pointer(oCU_UP_PF_C.gNB_CU_UP_Name.buf), C.int(oCU_UP_PF_C.gNB_CU_UP_Name.size)) - oCU_UP_PF.GNBCUUPName.Size = int(oCU_UP_PF_C.gNB_CU_UP_Name.size) - } + // if oCU_UP_PF_C.gNB_CU_UP_Name != nil { + // oCU_UP_PF.GNBCUUPName = &PrintableString{} + // oCU_UP_PF.GNBCUUPName.Buf = C.GoBytes(unsafe.Pointer(oCU_UP_PF_C.gNB_CU_UP_Name.buf), C.int(oCU_UP_PF_C.gNB_CU_UP_Name.size)) + // oCU_UP_PF.GNBCUUPName.Size = int(oCU_UP_PF_C.gNB_CU_UP_Name.size) + // } oCU_UP_PF.CUUPPFContainerItemCount = int(oCU_UP_PF_C.pf_ContainerList.list.count) for j := 0; j < oCU_UP_PF.CUUPPFContainerItemCount; j++ { @@ -578,13 +587,13 @@ func (c *E2sm) GetIndicationMessage(buffer []byte) (indMsg *IndicationMessage, e cuUPPMEPC := &CUUPPMEPCType{} cuUPPMEPC_C := (*C.EPC_CUUP_PM_Format_t)(cuUPPlmn_C.cu_UP_PM_EPC) - cuUPPMEPC.CUUPPMEPCPerQCIReportCount = int(cuUPPMEPC_C.perQCIReportList.list.count) + cuUPPMEPC.CUUPPMEPCPerQCIReportCount = int(cuUPPMEPC_C.perQCIReportList_cuup.list.count) for l := 0; l < cuUPPMEPC.CUUPPMEPCPerQCIReportCount; l++ { perQCIReport := &cuUPPMEPC.CUUPPMEPCPerQCIReports[l] var sizeof_PerQCIReportListItemFormat_t *C.PerQCIReportListItemFormat_t - perQCIReport_C := *(**C.PerQCIReportListItemFormat_t)(unsafe.Pointer((uintptr)(unsafe.Pointer(cuUPPMEPC_C.perQCIReportList.list.array)) + (uintptr)(l)*unsafe.Sizeof(sizeof_PerQCIReportListItemFormat_t))) + perQCIReport_C := *(**C.PerQCIReportListItemFormat_t)(unsafe.Pointer((uintptr)(unsafe.Pointer(cuUPPMEPC_C.perQCIReportList_cuup.list.array)) + (uintptr)(l)*unsafe.Sizeof(sizeof_PerQCIReportListItemFormat_t))) - perQCIReport.QCI = int64(perQCIReport_C.qci) + perQCIReport.QCI = int64(perQCIReport_C.drbqci) if perQCIReport_C.pDCPBytesDL != nil { perQCIReport.PDCPBytesDL = &Integer{} @@ -615,137 +624,138 @@ func (c *E2sm) GetIndicationMessage(buffer []byte) (indMsg *IndicationMessage, e if pmContainer_C.theRANContainer != nil { ranContainer := &RANContainerType{} - ranContainer.Timestamp.Buf = C.GoBytes(unsafe.Pointer(pmContainer_C.theRANContainer.timestamp.buf), C.int(pmContainer_C.theRANContainer.timestamp.size)) - ranContainer.Timestamp.Size = int(pmContainer_C.theRANContainer.timestamp.size) + // TODO: parse correctly Octect String + // ranContainer.Buf = C.GoBytes(unsafe.Pointer(pmContainer_C.theRANContainer), C.int(pmContainer_C.theRANContainer.size)) + // ranContainer.Size = int(pmContainer_C.theRANContainer.size) - ranContainer.ContainerType = int32(pmContainer_C.theRANContainer.reportContainer.present) + // ranContainer.ContainerType = int32(pmContainer_C.theRANContainer.reportContainer.present) - if ranContainer.ContainerType == 1 { - oDU_UE := &DUUsageReportType{} - oDU_UE_C := *(**C.DU_Usage_Report_Per_UE_t)(unsafe.Pointer(&pmContainer_C.theRANContainer.reportContainer.choice[0])) + // if ranContainer.ContainerType == 1 { + // oDU_UE := &DUUsageReportType{} + // oDU_UE_C := *(**C.DU_Usage_Report_Per_UE_t)(unsafe.Pointer(&pmContainer_C.theRANContainer.reportContainer.choice[0])) - oDU_UE.CellResourceReportItemCount = int(oDU_UE_C.cellResourceReportList.list.count) - for j := 0; j < oDU_UE.CellResourceReportItemCount; j++ { - cellResourceReport := &oDU_UE.CellResourceReportItems[j] - var sizeof_DU_Usage_Report_CellResourceReportItem_t *C.DU_Usage_Report_CellResourceReportItem_t - cellResourceReport_C := *(**C.DU_Usage_Report_CellResourceReportItem_t)(unsafe.Pointer((uintptr)(unsafe.Pointer(oDU_UE_C.cellResourceReportList.list.array)) + (uintptr)(j)*unsafe.Sizeof(sizeof_DU_Usage_Report_CellResourceReportItem_t))) + // oDU_UE.CellResourceReportItemCount = int(oDU_UE_C.cellResourceReportList.list.count) + // for j := 0; j < oDU_UE.CellResourceReportItemCount; j++ { + // cellResourceReport := &oDU_UE.CellResourceReportItems[j] + // var sizeof_DU_Usage_Report_CellResourceReportItem_t *C.DU_Usage_Report_CellResourceReportItem_t + // cellResourceReport_C := *(**C.DU_Usage_Report_CellResourceReportItem_t)(unsafe.Pointer((uintptr)(unsafe.Pointer(oDU_UE_C.cellResourceReportList.list.array)) + (uintptr)(j)*unsafe.Sizeof(sizeof_DU_Usage_Report_CellResourceReportItem_t))) - cellResourceReport.NRCGI.PlmnID.Buf = C.GoBytes(unsafe.Pointer(cellResourceReport_C.nRCGI.pLMN_Identity.buf), C.int(cellResourceReport_C.nRCGI.pLMN_Identity.size)) - cellResourceReport.NRCGI.PlmnID.Size = int(cellResourceReport_C.nRCGI.pLMN_Identity.size) + // cellResourceReport.NRCGI.PlmnID.Buf = C.GoBytes(unsafe.Pointer(cellResourceReport_C.nRCGI.pLMN_Identity.buf), C.int(cellResourceReport_C.nRCGI.pLMN_Identity.size)) + // cellResourceReport.NRCGI.PlmnID.Size = int(cellResourceReport_C.nRCGI.pLMN_Identity.size) - cellResourceReport.NRCGI.NRCellID.Buf = C.GoBytes(unsafe.Pointer(cellResourceReport_C.nRCGI.nRCellIdentity.buf), C.int(cellResourceReport_C.nRCGI.nRCellIdentity.size)) - cellResourceReport.NRCGI.NRCellID.Size = int(cellResourceReport_C.nRCGI.nRCellIdentity.size) - cellResourceReport.NRCGI.NRCellID.BitsUnused = int(cellResourceReport_C.nRCGI.nRCellIdentity.bits_unused) + // cellResourceReport.NRCGI.NRCellID.Buf = C.GoBytes(unsafe.Pointer(cellResourceReport_C.nRCGI.nRCellIdentity.buf), C.int(cellResourceReport_C.nRCGI.nRCellIdentity.size)) + // cellResourceReport.NRCGI.NRCellID.Size = int(cellResourceReport_C.nRCGI.nRCellIdentity.size) + // cellResourceReport.NRCGI.NRCellID.BitsUnused = int(cellResourceReport_C.nRCGI.nRCellIdentity.bits_unused) - cellResourceReport.UeResourceReportItemCount = int(cellResourceReport_C.ueResourceReportList.list.count) - for k := 0; k < cellResourceReport.UeResourceReportItemCount; k++ { - ueResourceReport := &cellResourceReport.UeResourceReportItems[k] - var sizeof_DU_Usage_Report_UeResourceReportItem_t *C.DU_Usage_Report_UeResourceReportItem_t - ueResourceReport_C := *(**C.DU_Usage_Report_UeResourceReportItem_t)(unsafe.Pointer((uintptr)(unsafe.Pointer(cellResourceReport_C.ueResourceReportList.list.array)) + (uintptr)(k)*unsafe.Sizeof(sizeof_DU_Usage_Report_UeResourceReportItem_t))) + // cellResourceReport.UeResourceReportItemCount = int(cellResourceReport_C.ueResourceReportList.list.count) + // for k := 0; k < cellResourceReport.UeResourceReportItemCount; k++ { + // ueResourceReport := &cellResourceReport.UeResourceReportItems[k] + // var sizeof_DU_Usage_Report_UeResourceReportItem_t *C.DU_Usage_Report_UeResourceReportItem_t + // ueResourceReport_C := *(**C.DU_Usage_Report_UeResourceReportItem_t)(unsafe.Pointer((uintptr)(unsafe.Pointer(cellResourceReport_C.ueResourceReportList.list.array)) + (uintptr)(k)*unsafe.Sizeof(sizeof_DU_Usage_Report_UeResourceReportItem_t))) - ueResourceReport.CRNTI.Buf = C.GoBytes(unsafe.Pointer(ueResourceReport_C.c_RNTI.buf), C.int(ueResourceReport_C.c_RNTI.size)) - ueResourceReport.CRNTI.Size = int(ueResourceReport_C.c_RNTI.size) + // ueResourceReport.CRNTI.Buf = C.GoBytes(unsafe.Pointer(ueResourceReport_C.c_RNTI.buf), C.int(ueResourceReport_C.c_RNTI.size)) + // ueResourceReport.CRNTI.Size = int(ueResourceReport_C.c_RNTI.size) - if ueResourceReport_C.dl_PRBUsage != nil { - ueResourceReport.PRBUsageDL = int64(*ueResourceReport_C.dl_PRBUsage) - } else { - ueResourceReport.PRBUsageDL = -1 - } + // if ueResourceReport_C.dl_PRBUsage != nil { + // ueResourceReport.PRBUsageDL = int64(*ueResourceReport_C.dl_PRBUsage) + // } else { + // ueResourceReport.PRBUsageDL = -1 + // } - if ueResourceReport_C.ul_PRBUsage != nil { - ueResourceReport.PRBUsageUL = int64(*ueResourceReport_C.ul_PRBUsage) - } else { - ueResourceReport.PRBUsageUL = -1 - } - } - } + // if ueResourceReport_C.ul_PRBUsage != nil { + // ueResourceReport.PRBUsageUL = int64(*ueResourceReport_C.ul_PRBUsage) + // } else { + // ueResourceReport.PRBUsageUL = -1 + // } + // } + // } - ranContainer.Container = oDU_UE - } else if ranContainer.ContainerType == 2 { - oCU_CP_UE := &CUCPUsageReportType{} - oCU_CP_UE_C := *(**C.CU_CP_Usage_Report_Per_UE_t)(unsafe.Pointer(&pmContainer_C.theRANContainer.reportContainer.choice[0])) + // ranContainer.Container = oDU_UE + // } else if ranContainer.ContainerType == 2 { + // oCU_CP_UE := &CUCPUsageReportType{} + // oCU_CP_UE_C := *(**C.CU_CP_Usage_Report_Per_UE_t)(unsafe.Pointer(&pmContainer_C.theRANContainer.reportContainer.choice[0])) - oCU_CP_UE.CellResourceReportItemCount = int(oCU_CP_UE_C.cellResourceReportList.list.count) - for j := 0; j < oCU_CP_UE.CellResourceReportItemCount; j++ { - cellResourceReport := &oCU_CP_UE.CellResourceReportItems[j] - var sizeof_CU_CP_Usage_Report_CellResourceReportItem_t *C.CU_CP_Usage_Report_CellResourceReportItem_t - cellResourceReport_C := *(**C.CU_CP_Usage_Report_CellResourceReportItem_t)(unsafe.Pointer((uintptr)(unsafe.Pointer(oCU_CP_UE_C.cellResourceReportList.list.array)) + (uintptr)(j)*unsafe.Sizeof(sizeof_CU_CP_Usage_Report_CellResourceReportItem_t))) + // oCU_CP_UE.CellResourceReportItemCount = int(oCU_CP_UE_C.cellResourceReportList.list.count) + // for j := 0; j < oCU_CP_UE.CellResourceReportItemCount; j++ { + // cellResourceReport := &oCU_CP_UE.CellResourceReportItems[j] + // var sizeof_CU_CP_Usage_Report_CellResourceReportItem_t *C.CU_CP_Usage_Report_CellResourceReportItem_t + // cellResourceReport_C := *(**C.CU_CP_Usage_Report_CellResourceReportItem_t)(unsafe.Pointer((uintptr)(unsafe.Pointer(oCU_CP_UE_C.cellResourceReportList.list.array)) + (uintptr)(j)*unsafe.Sizeof(sizeof_CU_CP_Usage_Report_CellResourceReportItem_t))) - cellResourceReport.NRCGI.PlmnID.Buf = C.GoBytes(unsafe.Pointer(cellResourceReport_C.nRCGI.pLMN_Identity.buf), C.int(cellResourceReport_C.nRCGI.pLMN_Identity.size)) - cellResourceReport.NRCGI.PlmnID.Size = int(cellResourceReport_C.nRCGI.pLMN_Identity.size) + // cellResourceReport.NRCGI.PlmnID.Buf = C.GoBytes(unsafe.Pointer(cellResourceReport_C.nRCGI.pLMN_Identity.buf), C.int(cellResourceReport_C.nRCGI.pLMN_Identity.size)) + // cellResourceReport.NRCGI.PlmnID.Size = int(cellResourceReport_C.nRCGI.pLMN_Identity.size) - cellResourceReport.NRCGI.NRCellID.Buf = C.GoBytes(unsafe.Pointer(cellResourceReport_C.nRCGI.nRCellIdentity.buf), C.int(cellResourceReport_C.nRCGI.nRCellIdentity.size)) - cellResourceReport.NRCGI.NRCellID.Size = int(cellResourceReport_C.nRCGI.nRCellIdentity.size) - cellResourceReport.NRCGI.NRCellID.BitsUnused = int(cellResourceReport_C.nRCGI.nRCellIdentity.bits_unused) + // cellResourceReport.NRCGI.NRCellID.Buf = C.GoBytes(unsafe.Pointer(cellResourceReport_C.nRCGI.nRCellIdentity.buf), C.int(cellResourceReport_C.nRCGI.nRCellIdentity.size)) + // cellResourceReport.NRCGI.NRCellID.Size = int(cellResourceReport_C.nRCGI.nRCellIdentity.size) + // cellResourceReport.NRCGI.NRCellID.BitsUnused = int(cellResourceReport_C.nRCGI.nRCellIdentity.bits_unused) - cellResourceReport.UeResourceReportItemCount = int(cellResourceReport_C.ueResourceReportList.list.count) - for k := 0; k < cellResourceReport.UeResourceReportItemCount; k++ { - ueResourceReport := &cellResourceReport.UeResourceReportItems[k] - var sizeof_CU_CP_Usage_Report_UeResourceReportItem_t *C.CU_CP_Usage_Report_UeResourceReportItem_t - ueResourceReport_C := *(**C.CU_CP_Usage_Report_UeResourceReportItem_t)(unsafe.Pointer((uintptr)(unsafe.Pointer(cellResourceReport_C.ueResourceReportList.list.array)) + (uintptr)(k)*unsafe.Sizeof(sizeof_CU_CP_Usage_Report_UeResourceReportItem_t))) + // cellResourceReport.UeResourceReportItemCount = int(cellResourceReport_C.ueResourceReportList.list.count) + // for k := 0; k < cellResourceReport.UeResourceReportItemCount; k++ { + // ueResourceReport := &cellResourceReport.UeResourceReportItems[k] + // var sizeof_CU_CP_Usage_Report_UeResourceReportItem_t *C.CU_CP_Usage_Report_UeResourceReportItem_t + // ueResourceReport_C := *(**C.CU_CP_Usage_Report_UeResourceReportItem_t)(unsafe.Pointer((uintptr)(unsafe.Pointer(cellResourceReport_C.ueResourceReportList.list.array)) + (uintptr)(k)*unsafe.Sizeof(sizeof_CU_CP_Usage_Report_UeResourceReportItem_t))) - ueResourceReport.CRNTI.Buf = C.GoBytes(unsafe.Pointer(ueResourceReport_C.c_RNTI.buf), C.int(ueResourceReport_C.c_RNTI.size)) - ueResourceReport.CRNTI.Size = int(ueResourceReport_C.c_RNTI.size) + // ueResourceReport.CRNTI.Buf = C.GoBytes(unsafe.Pointer(ueResourceReport_C.c_RNTI.buf), C.int(ueResourceReport_C.c_RNTI.size)) + // ueResourceReport.CRNTI.Size = int(ueResourceReport_C.c_RNTI.size) - if ueResourceReport_C.serving_Cell_RF_Type != nil { - ueResourceReport.ServingCellRF = &OctetString{} - ueResourceReport.ServingCellRF.Buf = C.GoBytes(unsafe.Pointer(ueResourceReport_C.serving_Cell_RF_Type.buf), C.int(ueResourceReport_C.serving_Cell_RF_Type.size)) - ueResourceReport.ServingCellRF.Size = int(ueResourceReport_C.serving_Cell_RF_Type.size) - } + // if ueResourceReport_C.serving_Cell_RF_Type != nil { + // ueResourceReport.ServingCellRF = &OctetString{} + // ueResourceReport.ServingCellRF.Buf = C.GoBytes(unsafe.Pointer(ueResourceReport_C.serving_Cell_RF_Type.buf), C.int(ueResourceReport_C.serving_Cell_RF_Type.size)) + // ueResourceReport.ServingCellRF.Size = int(ueResourceReport_C.serving_Cell_RF_Type.size) + // } - if ueResourceReport_C.neighbor_Cell_RF != nil { - ueResourceReport.NeighborCellRF = &OctetString{} - ueResourceReport.NeighborCellRF.Buf = C.GoBytes(unsafe.Pointer(ueResourceReport_C.neighbor_Cell_RF.buf), C.int(ueResourceReport_C.neighbor_Cell_RF.size)) - ueResourceReport.NeighborCellRF.Size = int(ueResourceReport_C.neighbor_Cell_RF.size) - } - } - } + // if ueResourceReport_C.neighbor_Cell_RF != nil { + // ueResourceReport.NeighborCellRF = &OctetString{} + // ueResourceReport.NeighborCellRF.Buf = C.GoBytes(unsafe.Pointer(ueResourceReport_C.neighbor_Cell_RF.buf), C.int(ueResourceReport_C.neighbor_Cell_RF.size)) + // ueResourceReport.NeighborCellRF.Size = int(ueResourceReport_C.neighbor_Cell_RF.size) + // } + // } + // } - ranContainer.Container = oCU_CP_UE - } else if ranContainer.ContainerType == 3 { - oCU_UP_UE := &CUUPUsageReportType{} - oCU_UP_UE_C := *(**C.CU_UP_Usage_Report_Per_UE_t)(unsafe.Pointer(&pmContainer_C.theRANContainer.reportContainer.choice[0])) + // ranContainer.Container = oCU_CP_UE + // } else if ranContainer.ContainerType == 3 { + // oCU_UP_UE := &CUUPUsageReportType{} + // oCU_UP_UE_C := *(**C.CU_UP_Usage_Report_Per_UE_t)(unsafe.Pointer(&pmContainer_C.theRANContainer.reportContainer.choice[0])) - oCU_UP_UE.CellResourceReportItemCount = int(oCU_UP_UE_C.cellResourceReportList.list.count) - for j := 0; j < oCU_UP_UE.CellResourceReportItemCount; j++ { - cellResourceReport := &oCU_UP_UE.CellResourceReportItems[j] - var sizeof_CU_UP_Usage_Report_CellResourceReportItem_t *C.CU_UP_Usage_Report_CellResourceReportItem_t - cellResourceReport_C := *(**C.CU_UP_Usage_Report_CellResourceReportItem_t)(unsafe.Pointer((uintptr)(unsafe.Pointer(oCU_UP_UE_C.cellResourceReportList.list.array)) + (uintptr)(j)*unsafe.Sizeof(sizeof_CU_UP_Usage_Report_CellResourceReportItem_t))) + // oCU_UP_UE.CellResourceReportItemCount = int(oCU_UP_UE_C.cellResourceReportList.list.count) + // for j := 0; j < oCU_UP_UE.CellResourceReportItemCount; j++ { + // cellResourceReport := &oCU_UP_UE.CellResourceReportItems[j] + // var sizeof_CU_UP_Usage_Report_CellResourceReportItem_t *C.CU_UP_Usage_Report_CellResourceReportItem_t + // cellResourceReport_C := *(**C.CU_UP_Usage_Report_CellResourceReportItem_t)(unsafe.Pointer((uintptr)(unsafe.Pointer(oCU_UP_UE_C.cellResourceReportList.list.array)) + (uintptr)(j)*unsafe.Sizeof(sizeof_CU_UP_Usage_Report_CellResourceReportItem_t))) - cellResourceReport.NRCGI.PlmnID.Buf = C.GoBytes(unsafe.Pointer(cellResourceReport_C.nRCGI.pLMN_Identity.buf), C.int(cellResourceReport_C.nRCGI.pLMN_Identity.size)) - cellResourceReport.NRCGI.PlmnID.Size = int(cellResourceReport_C.nRCGI.pLMN_Identity.size) + // cellResourceReport.NRCGI.PlmnID.Buf = C.GoBytes(unsafe.Pointer(cellResourceReport_C.nRCGI.pLMN_Identity.buf), C.int(cellResourceReport_C.nRCGI.pLMN_Identity.size)) + // cellResourceReport.NRCGI.PlmnID.Size = int(cellResourceReport_C.nRCGI.pLMN_Identity.size) - cellResourceReport.NRCGI.NRCellID.Buf = C.GoBytes(unsafe.Pointer(cellResourceReport_C.nRCGI.nRCellIdentity.buf), C.int(cellResourceReport_C.nRCGI.nRCellIdentity.size)) - cellResourceReport.NRCGI.NRCellID.Size = int(cellResourceReport_C.nRCGI.nRCellIdentity.size) - cellResourceReport.NRCGI.NRCellID.BitsUnused = int(cellResourceReport_C.nRCGI.nRCellIdentity.bits_unused) + // cellResourceReport.NRCGI.NRCellID.Buf = C.GoBytes(unsafe.Pointer(cellResourceReport_C.nRCGI.nRCellIdentity.buf), C.int(cellResourceReport_C.nRCGI.nRCellIdentity.size)) + // cellResourceReport.NRCGI.NRCellID.Size = int(cellResourceReport_C.nRCGI.nRCellIdentity.size) + // cellResourceReport.NRCGI.NRCellID.BitsUnused = int(cellResourceReport_C.nRCGI.nRCellIdentity.bits_unused) - cellResourceReport.UeResourceReportItemCount = int(cellResourceReport_C.ueResourceReportList.list.count) - for k := 0; k < cellResourceReport.UeResourceReportItemCount; k++ { - ueResourceReport := &cellResourceReport.UeResourceReportItems[k] - var sizeof_CU_UP_Usage_Report_UeResourceReportItem_t *C.CU_UP_Usage_Report_UeResourceReportItem_t - ueResourceReport_C := *(**C.CU_UP_Usage_Report_UeResourceReportItem_t)(unsafe.Pointer((uintptr)(unsafe.Pointer(cellResourceReport_C.ueResourceReportList.list.array)) + (uintptr)(k)*unsafe.Sizeof(sizeof_CU_UP_Usage_Report_UeResourceReportItem_t))) + // cellResourceReport.UeResourceReportItemCount = int(cellResourceReport_C.ueResourceReportList.list.count) + // for k := 0; k < cellResourceReport.UeResourceReportItemCount; k++ { + // ueResourceReport := &cellResourceReport.UeResourceReportItems[k] + // var sizeof_CU_UP_Usage_Report_UeResourceReportItem_t *C.CU_UP_Usage_Report_UeResourceReportItem_t + // ueResourceReport_C := *(**C.CU_UP_Usage_Report_UeResourceReportItem_t)(unsafe.Pointer((uintptr)(unsafe.Pointer(cellResourceReport_C.ueResourceReportList.list.array)) + (uintptr)(k)*unsafe.Sizeof(sizeof_CU_UP_Usage_Report_UeResourceReportItem_t))) - ueResourceReport.CRNTI.Buf = C.GoBytes(unsafe.Pointer(ueResourceReport_C.c_RNTI.buf), C.int(ueResourceReport_C.c_RNTI.size)) - ueResourceReport.CRNTI.Size = int(ueResourceReport_C.c_RNTI.size) + // ueResourceReport.CRNTI.Buf = C.GoBytes(unsafe.Pointer(ueResourceReport_C.c_RNTI.buf), C.int(ueResourceReport_C.c_RNTI.size)) + // ueResourceReport.CRNTI.Size = int(ueResourceReport_C.c_RNTI.size) - if ueResourceReport_C.pDCPBytesDL != nil { - ueResourceReport.PDCPBytesDL = &Integer{} - ueResourceReport.PDCPBytesDL.Buf = C.GoBytes(unsafe.Pointer(ueResourceReport_C.pDCPBytesDL.buf), C.int(ueResourceReport_C.pDCPBytesDL.size)) - ueResourceReport.PDCPBytesDL.Size = int(ueResourceReport_C.pDCPBytesDL.size) - } + // if ueResourceReport_C.pDCPBytesDL != nil { + // ueResourceReport.PDCPBytesDL = &Integer{} + // ueResourceReport.PDCPBytesDL.Buf = C.GoBytes(unsafe.Pointer(ueResourceReport_C.pDCPBytesDL.buf), C.int(ueResourceReport_C.pDCPBytesDL.size)) + // ueResourceReport.PDCPBytesDL.Size = int(ueResourceReport_C.pDCPBytesDL.size) + // } - if ueResourceReport_C.pDCPBytesUL != nil { - ueResourceReport.PDCPBytesUL = &Integer{} - ueResourceReport.PDCPBytesUL.Buf = C.GoBytes(unsafe.Pointer(ueResourceReport_C.pDCPBytesUL.buf), C.int(ueResourceReport_C.pDCPBytesUL.size)) - ueResourceReport.PDCPBytesUL.Size = int(ueResourceReport_C.pDCPBytesUL.size) - } - } - } + // if ueResourceReport_C.pDCPBytesUL != nil { + // ueResourceReport.PDCPBytesUL = &Integer{} + // ueResourceReport.PDCPBytesUL.Buf = C.GoBytes(unsafe.Pointer(ueResourceReport_C.pDCPBytesUL.buf), C.int(ueResourceReport_C.pDCPBytesUL.size)) + // ueResourceReport.PDCPBytesUL.Size = int(ueResourceReport_C.pDCPBytesUL.size) + // } + // } + // } - ranContainer.Container = oCU_UP_UE - } else { - return indMsg, errors.New("Unknown RAN Container type") - } + // ranContainer.Container = oCU_UP_UE + // } else { + // return indMsg, errors.New("Unknown RAN Container type") + // } pmContainer.RANContainer = ranContainer } diff --git a/control/types.go b/control/types.go index f8b4743..742c21a 100644 --- a/control/types.go +++ b/control/types.go @@ -134,18 +134,19 @@ type GNB_CU_CP_Name PrintableString type GNB_CU_UP_Name PrintableString type IndicationHeaderFormat1 struct { + CollectionStartTime *OctetString GlobalKPMnodeIDType int32 GlobalKPMnodeID interface{} - NRCGI *NRCGIType - PlmnID *OctetString - SliceID *SliceIDType - FiveQI int64 - Qci int64 - UeMessageType int32 - GnbDUID *Integer - GnbNameType int32 - GnbName interface{} - GlobalgNBID *GlobalgNBIDType + // NRCGI *NRCGIType + // PlmnID *OctetString + // SliceID *SliceIDType + // FiveQI int64 + // Qci int64 + // UeMessageType int32 + // GnbDUID *Integer + // GnbNameType int32 + // GnbName interface{} + GlobalgNBID *GlobalgNBIDType } type IndicationHeader struct { @@ -202,7 +203,7 @@ type CUCPResourceStatusType struct { } type OCUCPPFContainerType struct { - GNBCUCPName *PrintableString + // GNBCUCPName *PrintableString CUCPResourceStatus CUCPResourceStatusType } @@ -251,7 +252,7 @@ type CUUPPFContainerItemType struct { } type OCUUPPFContainerType struct { - GNBCUUPName *PrintableString + // GNBCUUPName *PrintableString CUUPPFContainerItems [3]CUUPPFContainerItemType CUUPPFContainerItemCount int } @@ -312,11 +313,13 @@ type PFContainerType struct { Container interface{} } -type RANContainerType struct { - Timestamp OctetString - ContainerType int32 - Container interface{} -} +// type RANContainerType struct { +// Timestamp OctetString +// ContainerType int32 +// Container interface{} +// } + +type RANContainerType OctetString type PMContainerType struct { PFContainer *PFContainerType @@ -329,7 +332,7 @@ type IndicationMessageFormat1 struct { } type IndicationMessage struct { - StyleType int64 + // StyleType int64 IndMsgType int32 IndMsg interface{} } @@ -341,19 +344,19 @@ type Timestamp struct { type CellMetricsEntry struct { MeasTimestampPDCPBytes Timestamp `json:"MeasTimestampPDCPBytes"` - CellID string `json:"CellID"` + CellID string `json:"CellID"` PDCPBytesDL int64 `json:"PDCPBytesDL"` PDCPBytesUL int64 `json:"PDCPBytesUL"` MeasTimestampPRB Timestamp `json:"MeasTimestampAvailPRB"` AvailPRBDL int64 `json:"AvailPRBDL"` AvailPRBUL int64 `json:"AvailPRBUL"` - MeasPeriodPDCP int64 `json:"MeasPeriodPDCPBytes"` - MeasPeriodPRB int64 `json:"MeasPeriodAvailPRB"` + MeasPeriodPDCP int64 `json:"MeasPeriodPDCPBytes"` + MeasPeriodPRB int64 `json:"MeasPeriodAvailPRB"` } type CellRFType struct { - RSRP int `json:"rsrp"` - RSRQ int `json:"rsrq"` + RSRP int `json:"rsrp"` + RSRQ int `json:"rsrq"` RSSINR int `json:"rssinr"` } @@ -363,18 +366,18 @@ type NeighborCellRFType struct { } type UeMetricsEntry struct { - UeID int64 `json:"UEID"` - ServingCellID string `json:"ServingCellID"` - MeasTimestampPDCPBytes Timestamp `json:"MeasTimestampUEPDCPBytes"` - PDCPBytesDL int64 `json:"UEPDCPBytesDL"` - PDCPBytesUL int64 `json:"UEPDCPBytesUL"` - MeasTimestampPRB Timestamp `json:"MeasTimestampUEPRBUsage"` - PRBUsageDL int64 `json:"UEPRBUsageDL"` - PRBUsageUL int64 `json:"UEPRBUsageUL"` - MeasTimeRF Timestamp `json:"MeasTimestampRF"` - MeasPeriodRF int64 `json:"MeasPeriodRF"` - MeasPeriodPDCP int64 `json:"MeasPeriodUEPDCPBytes"` - MeasPeriodPRB int64 `json:"MeasPeriodUEPRBUsage"` - ServingCellRF CellRFType `json:"ServingCellRF"` - NeighborCellsRF []NeighborCellRFType `json:"NeighborCellRF"` + UeID int64 `json:"UEID"` + ServingCellID string `json:"ServingCellID"` + MeasTimestampPDCPBytes Timestamp `json:"MeasTimestampUEPDCPBytes"` + PDCPBytesDL int64 `json:"UEPDCPBytesDL"` + PDCPBytesUL int64 `json:"UEPDCPBytesUL"` + MeasTimestampPRB Timestamp `json:"MeasTimestampUEPRBUsage"` + PRBUsageDL int64 `json:"UEPRBUsageDL"` + PRBUsageUL int64 `json:"UEPRBUsageUL"` + MeasTimeRF Timestamp `json:"MeasTimestampRF"` + MeasPeriodRF int64 `json:"MeasPeriodRF"` + MeasPeriodPDCP int64 `json:"MeasPeriodUEPDCPBytes"` + MeasPeriodPRB int64 `json:"MeasPeriodUEPRBUsage"` + ServingCellRF CellRFType `json:"ServingCellRF"` + NeighborCellsRF []NeighborCellRFType `json:"NeighborCellRF"` }