--- /dev/null
+/*
+ *
+ * Copyright 2019 AT&T Intellectual Property
+ * Copyright 2019 Nokia
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef INC_LOAD_INFORMATION_WRAPPER_H
+#define INC_LOAD_INFORMATION_WRAPPER_H
+
+#include <InitiatingMessage.h>
+#include <LoadInformation.h>
+#include <ProtocolIE-Field.h>
+#include <CellInformation-Item.h>
+#include <RelativeNarrowbandTxPower.h>
+#include <UL-HighInterferenceIndicationInfo.h>
+#include <UL-HighInterferenceIndicationInfo-Item.h>
+#include <ECGI.h>
+#include <DynamicNAICSInformation.h>
+#include <EnhancedRNTPStartTime.h>
+#include <CoMPInformationItem.h>
+#include <CoMPInformationStartTime.h>
+#include <CoMPHypothesisSetItem.h>
+#include <ABSInformationFDD.h>
+#include <ABSInformationTDD.h>
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* INC_LOAD_INFORMATION_WRAPPER_H */
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
+gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.0.8 h1:KaSOJmMDsb3IW+YGHLrr5X36zRjcaclexPG9AiLBoRY=
+gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.0.8/go.mod h1:XZBjA22t5rvzU4SrSGfa9TpSfPOgxhA1I3oJwWFdEM4=
gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.0.9 h1:Y3g4sQc5hiVq84xJ1Ud2m1UlxDojlO2wIP54yVFCplo=
gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.0.9/go.mod h1:XZBjA22t5rvzU4SrSGfa9TpSfPOgxhA1I3oJwWFdEM4=
gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.0.11 h1:LtxjTzxDbfaAWcfsXFZX0c2GDFNGnPgRGdHUdKlF9oc=
gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.0.11/go.mod h1:QJ1uPPZosGbhxUWpUpeM5fLqFHdnWTrVnvW2DgyOCes=
-gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.0.12 h1:3x2WB/QdXofHxgJZXdFiOiiLmmV13fHWc9FfbZJtF1I=
-gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.0.12/go.mod h1:QJ1uPPZosGbhxUWpUpeM5fLqFHdnWTrVnvW2DgyOCes=
-gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.0.15 h1:Q2f5oLVbFi2VhlFZuU//qaC2QCXa50Ly4y0n4BV1OtQ=
-gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.0.15/go.mod h1:QJ1uPPZosGbhxUWpUpeM5fLqFHdnWTrVnvW2DgyOCes=
gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.0.16 h1:xrgKncpNUDycoug2bnJ+Z74AePIKYOE8eykr0vxNu70=
gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.0.16/go.mod h1:QJ1uPPZosGbhxUWpUpeM5fLqFHdnWTrVnvW2DgyOCes=
+gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.0.17 h1:yaAQwkAkgDTbWDQA5gss0/3tp2u9zGKi2WLnSgw8xm8=
+gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.0.17/go.mod h1:QJ1uPPZosGbhxUWpUpeM5fLqFHdnWTrVnvW2DgyOCes=
+gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.0.18 h1:JuWtnrDLcqEnZz3cMLQkJ/2cy/3AscuZuef8jkvidHs=
+gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.0.18/go.mod h1:QJ1uPPZosGbhxUWpUpeM5fLqFHdnWTrVnvW2DgyOCes=
gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.0.8 h1:25mglk3nUhSkVYnpxJH2SF9SccY2ecLio/OGBsJLNjk=
gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.0.8/go.mod h1:GXiXLz4ORBeIr0FLIbzENRykgh3Po5uPkX2jICxnRF0=
gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.0.9 h1:433mb6o1LXwDDxuq2k8NOWbo68HHgdlfxZo0s8X6n7g=
gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.0.9/go.mod h1:GXiXLz4ORBeIr0FLIbzENRykgh3Po5uPkX2jICxnRF0=
gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.0.11 h1:IzuE0JMoSd0tJG1/pw3ubim9/vBZ4/oazu6+8CpiZlA=
gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.0.11/go.mod h1:GXiXLz4ORBeIr0FLIbzENRykgh3Po5uPkX2jICxnRF0=
-gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.0.12/go.mod h1:GXiXLz4ORBeIr0FLIbzENRykgh3Po5uPkX2jICxnRF0=
-gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.0.14/go.mod h1:GXiXLz4ORBeIr0FLIbzENRykgh3Po5uPkX2jICxnRF0=
-gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.0.15 h1:RoVrLIkCmYesG/dXHH6F3nb8nHzZBGPiuD/cA7+mPoE=
-gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.0.15/go.mod h1:GXiXLz4ORBeIr0FLIbzENRykgh3Po5uPkX2jICxnRF0=
gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.0.16 h1:qcjvxx/bpoFMRYbLz0hioVmgH6xdE3+FMF7pVmprHOI=
gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.0.16/go.mod h1:GXiXLz4ORBeIr0FLIbzENRykgh3Po5uPkX2jICxnRF0=
+gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.0.17 h1:cigXR/l8U2NNXg2Y7UpO49UTJbLNY1iEb57Q5hKPl+o=
+gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.0.17/go.mod h1:GXiXLz4ORBeIr0FLIbzENRykgh3Po5uPkX2jICxnRF0=
+gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.0.18 h1:BKszWTZv/JpYn0vadQXUg8Ol8qqIrjFHs9BY58BHTtw=
+gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.0.18/go.mod h1:GXiXLz4ORBeIr0FLIbzENRykgh3Po5uPkX2jICxnRF0=
gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.0.8 h1:nvJjn4VyRGuyp5irasfFSPKW4zNDTh12sfky53UaqL4=
gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.0.8/go.mod h1:wqyKCJkXzU/UqeuRBUv3QrMHYVI544wdoMav3aeJXdE=
gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.0.9 h1:ziuiw/eX0zBqdEGTz3Jdvp9KbirFt5mwjk6bx7c20pc=
gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.0.9/go.mod h1:85fHlwiVClS4o+BrCODiOk7ZaH9YUSYAio9masBw2Q8=
gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.0.11 h1:/+0fPbJZUhsaVlhXbSwmH8GvcGQZ8+GAnmkLH/j/qkI=
gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.0.11/go.mod h1:NF/NuFuSCfC5qdJQOdorlyW1ljIkvhQUVCRzKZzwScA=
-gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.0.14/go.mod h1:wBPb2ZHeJk6i7xOiKzf1Toom0J8cKtrYH525S2baALo=
-gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.0.15 h1:ejoTjZsZuWDTmqbUV0sak34X6DURQ20m7bPgIGBu4hc=
-gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.0.15/go.mod h1:epfVaMMzpETIKafi3YSYWNtoY5l/0MDDR1njyUVgikE=
gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.0.16 h1:7r99RGKmyliF1jeHsOdLxE08MeNrcATLwvOxEniNDA8=
gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.0.16/go.mod h1:myZiM4n1DH4Ukak//khaimR75ymx5MwlXaob4kOYvY4=
+gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.0.17 h1:VnCLibET0jepZUBMppkz1dXJu/Ayy0dBlFzyEw8/Eck=
+gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.0.17/go.mod h1:kdgMqHn3InTc9qj24qbzXJo6zAyF1YTKDI/rca868pQ=
+gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.0.18 h1:pkpyFGLV7hPd8AnheMnDl6r5a5gtIANjXhqLZmMxUz8=
+gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.0.18/go.mod h1:kdgMqHn3InTc9qj24qbzXJo6zAyF1YTKDI/rca868pQ=
gerrit.o-ran-sc.org/r/ric-plt/sdlgo.git v0.1.1 h1:D2fU0/YXdqSNYsmptSBbkDfG76uBFKjnhQiq5cD4WT4=
gerrit.o-ran-sc.org/r/ric-plt/sdlgo.git v0.1.1/go.mod h1:2Y8gw2jqj9urI8VFqFQn7BX0J3A852+YrXVV9V8gOt4=
gerrit.o-ran-sc.org/r/ric-plt/sdlgo.git v0.2.0 h1:7edCLIQtk9xCwxTtLRUlXr8wQ6nmr/Mo4ZoqjF3m0NE=
gerrit.ranco-dev-tools.eastus.cloudapp.azure.com/ric-plt/nodeb-rnib.git v1.0.1/go.mod h1:4QHen1jkf+TWKmFTY038+evuNgbyJAonjCGn3a5qIAc=
gerrit.ranco-dev-tools.eastus.cloudapp.azure.com/ric-plt/nodeb-rnib.git/common v1.0.4 h1:gKJXQpSDbGfuYIbcDASZGHjcm33TlAf83aBqUiyeq1Q=
gerrit.ranco-dev-tools.eastus.cloudapp.azure.com/ric-plt/nodeb-rnib.git/common v1.0.4/go.mod h1:tg9/uNSCfkE3CkRSP1sycz43memMn6xas6fvvaGakWM=
-gerrit.ranco-dev-tools.eastus.cloudapp.azure.com/ric-plt/nodeb-rnib.git/common v1.0.5/go.mod h1:tg9/uNSCfkE3CkRSP1sycz43memMn6xas6fvvaGakWM=
gerrit.ranco-dev-tools.eastus.cloudapp.azure.com/ric-plt/nodeb-rnib.git/entities v1.0.4 h1:QNieurltghn1wFUxGeT5AW38lbfSIIUHLtO5kBgJyMU=
gerrit.ranco-dev-tools.eastus.cloudapp.azure.com/ric-plt/nodeb-rnib.git/entities v1.0.4/go.mod h1:zJjqld4o1wW6g89uVwQCj/iGciQ//rSbnzMAOQ+M0jk=
-gerrit.ranco-dev-tools.eastus.cloudapp.azure.com/ric-plt/nodeb-rnib.git/entities v1.0.5 h1:jPboKye70XLCKIUcqJW/qplfG4t70q+LpgQ0dGTl+FY=
-gerrit.ranco-dev-tools.eastus.cloudapp.azure.com/ric-plt/nodeb-rnib.git/entities v1.0.5/go.mod h1:zJjqld4o1wW6g89uVwQCj/iGciQ//rSbnzMAOQ+M0jk=
gerrit.ranco-dev-tools.eastus.cloudapp.azure.com/ric-plt/nodeb-rnib.git/reader v1.0.4 h1:hGkCP2WMnWkqgiOGEgkhPa5qqNj5+IE3BSEpjUNcTEk=
gerrit.ranco-dev-tools.eastus.cloudapp.azure.com/ric-plt/nodeb-rnib.git/reader v1.0.4/go.mod h1:ylflcy9ejVNfA8adx3GmnaeDkfNpMLt9Nf3E3Nmn0D4=
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
--- /dev/null
+package handlers
+
+// #cgo CFLAGS: -I../asn1codec/inc/ -I../asn1codec/e2ap_engine/
+// #cgo LDFLAGS: -L ../asn1codec/lib/ -L../asn1codec/e2ap_engine/ -le2ap_codec -lasncodec
+// #include <asn1codec_utils.h>
+// #include <load_information_wrapper.h>
+import "C"
+import (
+ "fmt"
+ "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities"
+ "unsafe"
+)
+
+const (
+ MaxCellineNb = 256
+ MaxNoOfPrbs = 110
+ NaxNoOfCompHypothesisSet = 256
+ NaxNoOfCompCells = 32
+ MaxNoOfPa = 3
+)
+
+var populators = map[C.CellInformation_Item_ExtIEs__extensionValue_PR]func(string, *entities.CellLoadInformation, *C.CellInformation_Item_ExtIEs_t) error{
+ C.CellInformation_Item_ExtIEs__extensionValue_PR_ABSInformation: populateAbsInformation,
+ C.CellInformation_Item_ExtIEs__extensionValue_PR_InvokeIndication: populateInvokeIndication,
+ C.CellInformation_Item_ExtIEs__extensionValue_PR_SubframeAssignment: populateIntendedUlDlConfiguration,
+ C.CellInformation_Item_ExtIEs__extensionValue_PR_ExtendedULInterferenceOverloadInfo: populateExtendedUlInterferenceOverloadInfo,
+ C.CellInformation_Item_ExtIEs__extensionValue_PR_CoMPInformation: populateCompInformation,
+ C.CellInformation_Item_ExtIEs__extensionValue_PR_DynamicDLTransmissionInformation: populateDynamicDLTransmissionInformation,
+}
+
+func extractPduCellInformationItemIEs(pdu *C.E2AP_PDU_t) ([]*C.CellInformation_ItemIEs_t, error) {
+
+ if pdu.present != C.E2AP_PDU_PR_initiatingMessage {
+ return nil, fmt.Errorf("#extractPduCellInformationItemIEs - Invalid E2AP_PDU value")
+ }
+
+ initiatingMessage := *(**C.InitiatingMessage_t)(unsafe.Pointer(&pdu.choice[0]))
+
+ if (initiatingMessage == nil || initiatingMessage.value.present != C.InitiatingMessage__value_PR_LoadInformation) {
+ return nil, fmt.Errorf("#extractPduCellInformationItemIEs - Invalid InitiatingMessage value")
+ }
+
+ loadInformationMessage := (*C.LoadInformation_t)(unsafe.Pointer(&initiatingMessage.value.choice[0]))
+
+ if loadInformationMessage == nil {
+ return nil, fmt.Errorf("#extractPduCellInformationItemIEs - Invalid LoadInformation container")
+ }
+
+ protocolIEsListCount := loadInformationMessage.protocolIEs.list.count
+
+ if protocolIEsListCount != 1 {
+ return nil, fmt.Errorf("#extractPduCellInformationItemIEs - Invalid protocolIEs list count")
+ }
+
+ loadInformationIEs := (*[1 << 30]*C.LoadInformation_IEs_t)(unsafe.Pointer(loadInformationMessage.protocolIEs.list.array))[:int(protocolIEsListCount):int(protocolIEsListCount)]
+
+ loadInformationIE := loadInformationIEs[0]
+
+ if loadInformationIE.value.present != C.LoadInformation_IEs__value_PR_CellInformation_List {
+ return nil, fmt.Errorf("#extractPduCellInformationItemIEs - Invalid protocolIEs value")
+ }
+
+ loadInformationCellList := (*C.CellInformation_List_t)(unsafe.Pointer(&loadInformationIE.value.choice[0]))
+
+ loadInformationCellListCount := loadInformationCellList.list.count
+
+ if loadInformationCellListCount == 0 || loadInformationCellListCount > MaxCellineNb {
+ return nil, fmt.Errorf("#extractPduCellInformationItemIEs - Invalid CellInformation list count")
+ }
+
+ return (*[1 << 30]*C.CellInformation_ItemIEs_t)(unsafe.Pointer(loadInformationCellList.list.array))[:int(loadInformationCellListCount):int(loadInformationCellListCount)], nil
+}
+
+func populateCellLoadInformation(pduCellInformationItemIE *C.CellInformation_ItemIEs_t, ranLoadInformation *entities.RanLoadInformation) error {
+
+ pduCellInformationItem, err := extractPduCellInformationItem(pduCellInformationItemIE)
+
+ if err != nil {
+ return err
+ }
+
+ cellLoadInformation := entities.CellLoadInformation{}
+ err = buildCellLoadInformation(&cellLoadInformation, pduCellInformationItem)
+
+ if err != nil {
+ return err
+ }
+
+ ranLoadInformation.CellLoadInfos = append(ranLoadInformation.CellLoadInfos, &cellLoadInformation)
+
+ return nil
+}
+
+func extractPduCellInformationItem(cell *C.CellInformation_ItemIEs_t) (*C.CellInformation_Item_t, error) {
+
+ if cell.value.present != C.CellInformation_ItemIEs__value_PR_CellInformation_Item {
+ return nil, fmt.Errorf("#extractPduCellInformationItem - Failed extracting pdu cell information item")
+ }
+
+ return (*C.CellInformation_Item_t)(unsafe.Pointer(&cell.value.choice[0])), nil
+}
+
+func buildCellLoadInformation(cellLoadInformation *entities.CellLoadInformation, cellInformationItem *C.CellInformation_Item_t) error {
+
+ cellId := buildCellId(cellInformationItem.cell_ID)
+ cellLoadInformation.CellId = cellId
+
+ pduUlInterferenceOverloadIndicationItems, err := extractPduUlInterferenceOverloadIndicationItems(cellId, cellInformationItem)
+
+ if err != nil {
+ return err
+ }
+
+ if (pduUlInterferenceOverloadIndicationItems != nil) {
+ cellLoadInformation.UlInterferenceOverloadIndications = buildUlInterferenceOverloadIndicationList(pduUlInterferenceOverloadIndicationItems)
+ }
+
+ pduUlHighInterferenceIndicationInfoItems, err := extractPduUlHighInterferenceIndicationInfoItems(cellId, cellInformationItem)
+
+ if err != nil {
+ return err
+ }
+
+ if pduUlHighInterferenceIndicationInfoItems != nil {
+ cellLoadInformation.UlHighInterferenceInfos = buildUlHighInterferenceIndicationInfoList(pduUlHighInterferenceIndicationInfoItems)
+ }
+
+ pduRelativeNarrowbandTxPower := extractPduRelativeNarrowbandTxPower(cellInformationItem)
+
+ if pduRelativeNarrowbandTxPower != nil {
+ pduEnhancedRntp, err := extractPduEnhancedRntp(cellId, pduRelativeNarrowbandTxPower)
+
+ if err != nil {
+ return err
+ }
+
+ cellLoadInformation.RelativeNarrowbandTxPower = buildRelativeNarrowbandTxPower(pduRelativeNarrowbandTxPower, pduEnhancedRntp)
+ }
+
+ pduCellInformationItemExtensionIEs := extractPduCellInformationItemExtensionIEs(cellInformationItem)
+
+ if (pduCellInformationItemExtensionIEs == nil) {
+ return nil
+ }
+
+ err = populateCellLoadInformationExtensionIEs(cellId, cellLoadInformation, pduCellInformationItemExtensionIEs)
+
+ if err != nil {
+ return err
+ }
+
+ return nil
+
+}
+
+func buildCellId(cellId C.ECGI_t) string {
+ plmnId := cUcharArrayToGoByteSlice(cellId.pLMN_Identity.buf, cellId.pLMN_Identity.size)
+ eutranCellIdentifier := cUcharArrayToGoByteSlice(cellId.eUTRANcellIdentifier.buf, cellId.eUTRANcellIdentifier.size)
+ return fmt.Sprintf("%x:%x", plmnId, eutranCellIdentifier)
+}
+
+func buildUlInterferenceOverloadIndicationList(pduUlInterferenceOverloadIndicationItems []*C.UL_InterferenceOverloadIndication_Item_t) []entities.UlInterferenceOverloadIndication {
+ indications := make([]entities.UlInterferenceOverloadIndication, len(pduUlInterferenceOverloadIndicationItems))
+ for i, ci := range pduUlInterferenceOverloadIndicationItems {
+ indications[i] = entities.UlInterferenceOverloadIndication(*ci + 1)
+ }
+
+ return indications
+}
+
+func extractPduUlInterferenceOverloadIndicationItems(cellId string, cellInformationItem *C.CellInformation_Item_t) ([]*C.UL_InterferenceOverloadIndication_Item_t, error) {
+
+ if cellInformationItem.ul_InterferenceOverloadIndication == nil {
+ return nil, nil
+ }
+
+ ulInterferenceOverLoadIndicationCount := cellInformationItem.ul_InterferenceOverloadIndication.list.count
+
+ if ulInterferenceOverLoadIndicationCount == 0 || ulInterferenceOverLoadIndicationCount > MaxNoOfPrbs {
+ return nil, fmt.Errorf("#extractPduUlInterferenceOverloadIndicationItems - cellId: %s - Invalid UL Interference OverLoad Indication list count", cellId)
+ }
+
+ pduUlInterferenceOverloadIndicationItems := (*[1 << 30]*C.UL_InterferenceOverloadIndication_Item_t)(unsafe.Pointer(cellInformationItem.ul_InterferenceOverloadIndication.list.array))[:int(ulInterferenceOverLoadIndicationCount):int(ulInterferenceOverLoadIndicationCount)]
+
+ return pduUlInterferenceOverloadIndicationItems, nil
+}
+
+func NewStartTime(startSfn C.long, startSubframeNumber C.long) *entities.StartTime {
+ return &entities.StartTime{
+ StartSfn: int32(startSfn),
+ StartSubframeNumber: int32(startSubframeNumber),
+ }
+}
+
+func buildEnhancedRntp(pduEnhancedRntp *C.EnhancedRNTP_t) *entities.EnhancedRntp {
+
+ enhancedRntp := entities.EnhancedRntp{
+ EnhancedRntpBitmap: NewHexString(pduEnhancedRntp.enhancedRNTPBitmap.buf, pduEnhancedRntp.enhancedRNTPBitmap.size),
+ RntpHighPowerThreshold: entities.RntpThreshold(pduEnhancedRntp.rNTP_High_Power_Threshold + 1),
+ }
+
+ pduEnhancedRntpStartTime := (*C.EnhancedRNTPStartTime_t)(unsafe.Pointer(pduEnhancedRntp.enhancedRNTPStartTime))
+
+ if pduEnhancedRntpStartTime != nil {
+ enhancedRntp.EnhancedRntpStartTime = NewStartTime(pduEnhancedRntpStartTime.startSFN, pduEnhancedRntpStartTime.startSubframeNumber)
+ }
+
+ return &enhancedRntp
+}
+
+func cUcharArrayToGoByteSlice(buf *C.uchar, size C.ulong) []byte {
+ return C.GoBytes(unsafe.Pointer(buf), C.int(size))
+}
+
+func NewHexString(buf *C.uchar, size C.ulong) string {
+ return fmt.Sprintf("%x", cUcharArrayToGoByteSlice(buf, size))
+}
+
+func buildRelativeNarrowbandTxPower(pduRelativeNarrowbandTxPower *C.RelativeNarrowbandTxPower_t, pduEnhancedRntp *C.EnhancedRNTP_t) *entities.RelativeNarrowbandTxPower {
+
+ relativeNarrowbandTxPower := entities.RelativeNarrowbandTxPower{
+ RntpThreshold: entities.RntpThreshold(pduRelativeNarrowbandTxPower.rNTP_Threshold + 1),
+ NumberOfCellSpecificAntennaPorts: entities.NumberOfCellSpecificAntennaPorts(pduRelativeNarrowbandTxPower.numberOfCellSpecificAntennaPorts + 1),
+ PB: uint32(pduRelativeNarrowbandTxPower.p_B),
+ PdcchInterferenceImpact: uint32(pduRelativeNarrowbandTxPower.pDCCH_InterferenceImpact),
+ RntpPerPrb: NewHexString(pduRelativeNarrowbandTxPower.rNTP_PerPRB.buf, pduRelativeNarrowbandTxPower.rNTP_PerPRB.size),
+ }
+
+ if pduEnhancedRntp != nil {
+ relativeNarrowbandTxPower.EnhancedRntp = buildEnhancedRntp(pduEnhancedRntp)
+ }
+
+ return &relativeNarrowbandTxPower
+}
+
+func extractPduRelativeNarrowbandTxPower(cellInformationItem *C.CellInformation_Item_t) *C.RelativeNarrowbandTxPower_t {
+
+ if cellInformationItem.relativeNarrowbandTxPower == nil {
+ return nil
+ }
+
+ return (*C.RelativeNarrowbandTxPower_t)(unsafe.Pointer(cellInformationItem.relativeNarrowbandTxPower))
+}
+
+func buildUlHighInterferenceIndicationInfoList(ulHighInterferenceIndicationInfoList []*C.UL_HighInterferenceIndicationInfo_Item_t) []*entities.UlHighInterferenceInformation {
+ infos := make([]*entities.UlHighInterferenceInformation, len(ulHighInterferenceIndicationInfoList))
+
+ for i, v := range ulHighInterferenceIndicationInfoList {
+
+ infos[i] = &entities.UlHighInterferenceInformation{
+ TargetCellId: buildCellId(v.target_Cell_ID),
+ UlHighInterferenceIndication: NewHexString(v.ul_interferenceindication.buf, v.ul_interferenceindication.size),
+ }
+ }
+
+ return infos
+}
+
+func extractPduUlHighInterferenceIndicationInfoItems(cellId string, cellInformationItem *C.CellInformation_Item_t) ([]*C.UL_HighInterferenceIndicationInfo_Item_t, error) {
+ pduUlHighInterferenceIndicationInfo := (*C.UL_HighInterferenceIndicationInfo_t)(unsafe.Pointer(cellInformationItem.ul_HighInterferenceIndicationInfo))
+
+ if (pduUlHighInterferenceIndicationInfo == nil) {
+ return nil, nil
+ }
+
+ pduUlHighInterferenceIndicationInfoListCount := pduUlHighInterferenceIndicationInfo.list.count
+
+ if pduUlHighInterferenceIndicationInfoListCount == 0 || pduUlHighInterferenceIndicationInfoListCount > MaxCellineNb {
+ return nil, fmt.Errorf("#extractPduUlHighInterferenceIndicationInfoItems - cellId: %s - Invalid UL High Interference Indication info list count", cellId)
+ }
+
+ pduUlHighInterferenceIndicationInfoItems := (*[1 << 30]*C.UL_HighInterferenceIndicationInfo_Item_t)(unsafe.Pointer(cellInformationItem.ul_HighInterferenceIndicationInfo.list.array))[:int(pduUlHighInterferenceIndicationInfoListCount):int(pduUlHighInterferenceIndicationInfoListCount)]
+
+ return pduUlHighInterferenceIndicationInfoItems, nil
+}
+
+func extractPduCellInformationItemExtensionIEs(cellInformationItem *C.CellInformation_Item_t) []*C.CellInformation_Item_ExtIEs_t {
+ extIEs := (*C.ProtocolExtensionContainer_170P7_t)(unsafe.Pointer(cellInformationItem.iE_Extensions))
+
+ if extIEs == nil {
+ return nil
+ }
+
+ extIEsCount := int(extIEs.list.count)
+
+ if extIEsCount == 0 {
+ return nil
+ }
+
+ return (*[1 << 30]*C.CellInformation_Item_ExtIEs_t)(unsafe.Pointer(extIEs.list.array))[:extIEsCount:extIEsCount]
+}
+
+func extractPduEnhancedRntp(cellId string, pduRelativeNarrowbandTxPower *C.RelativeNarrowbandTxPower_t) (*C.EnhancedRNTP_t, error) {
+
+ extIEs := (*C.ProtocolExtensionContainer_170P184_t)(unsafe.Pointer(pduRelativeNarrowbandTxPower.iE_Extensions))
+
+ if extIEs == nil {
+ return nil, nil
+ }
+
+ extIEsCount := int(extIEs.list.count)
+
+ if extIEsCount != 1 {
+ return nil, fmt.Errorf("#extractPduEnhancedRntp - cellId: %s - Invalid Enhanced RNTP container", cellId)
+ }
+
+ enhancedRntpExtIEs := (*[1 << 30]*C.RelativeNarrowbandTxPower_ExtIEs_t)(unsafe.Pointer(extIEs.list.array))[:extIEsCount:extIEsCount]
+
+ enhancedRntpExtIE := enhancedRntpExtIEs[0]
+
+ if enhancedRntpExtIE.extensionValue.present != C.RelativeNarrowbandTxPower_ExtIEs__extensionValue_PR_EnhancedRNTP {
+ return nil, fmt.Errorf("#extractPduEnhancedRntp - cellId: %s - Invalid Enhanced RNTP container", cellId)
+ }
+
+ return (*C.EnhancedRNTP_t)(unsafe.Pointer(&enhancedRntpExtIE.extensionValue.choice[0])), nil
+}
+
+func buildAbsInformationFdd(cellId string, pduAbsInformation *C.ABSInformation_t) (*entities.AbsInformation, error) {
+ pduAbsInformationFdd := *(**C.ABSInformationFDD_t)(unsafe.Pointer(&pduAbsInformation.choice[0]))
+
+ if pduAbsInformationFdd == nil {
+ return nil, fmt.Errorf("#buildAbsInformationFdd - cellId: %s - Invalid FDD Abs Information", cellId)
+ }
+
+ absInformation := entities.AbsInformation{
+ Mode: entities.AbsInformationMode_ABS_INFO_FDD,
+ AbsPatternInfo: NewHexString(pduAbsInformationFdd.abs_pattern_info.buf, pduAbsInformationFdd.abs_pattern_info.size),
+ NumberOfCellSpecificAntennaPorts: entities.NumberOfCellSpecificAntennaPorts(pduAbsInformationFdd.numberOfCellSpecificAntennaPorts + 1),
+ MeasurementSubset: NewHexString(pduAbsInformationFdd.measurement_subset.buf, pduAbsInformationFdd.measurement_subset.size),
+ }
+
+ return &absInformation, nil
+}
+
+func buildAbsInformationTdd(cellId string, pduAbsInformation *C.ABSInformation_t) (*entities.AbsInformation, error) {
+ pduAbsInformationTdd := *(**C.ABSInformationTDD_t)(unsafe.Pointer(&pduAbsInformation.choice[0]))
+
+ if pduAbsInformationTdd == nil {
+ return nil, fmt.Errorf("#buildAbsInformationTdd - cellId: %s - Invalid TDD Abs Information", cellId)
+ }
+
+ absInformation := entities.AbsInformation{
+ Mode: entities.AbsInformationMode_ABS_INFO_TDD,
+ AbsPatternInfo: NewHexString(pduAbsInformationTdd.abs_pattern_info.buf, pduAbsInformationTdd.abs_pattern_info.size),
+ NumberOfCellSpecificAntennaPorts: entities.NumberOfCellSpecificAntennaPorts(pduAbsInformationTdd.numberOfCellSpecificAntennaPorts + 1),
+ MeasurementSubset: NewHexString(pduAbsInformationTdd.measurement_subset.buf, pduAbsInformationTdd.measurement_subset.size),
+ }
+
+ return &absInformation, nil
+}
+
+func extractAndBuildCellLoadInformationAbsInformation(cellId string, extIE *C.CellInformation_Item_ExtIEs_t) (*entities.AbsInformation, error) {
+ pduAbsInformation := (*C.ABSInformation_t)(unsafe.Pointer(&extIE.extensionValue.choice[0]))
+
+ switch pduAbsInformation.present {
+ case C.ABSInformation_PR_fdd:
+ return buildAbsInformationFdd(cellId, pduAbsInformation)
+ case C.ABSInformation_PR_tdd:
+ return buildAbsInformationTdd(cellId, pduAbsInformation)
+ case C.ABSInformation_PR_abs_inactive:
+ return &entities.AbsInformation{Mode: entities.AbsInformationMode_ABS_INACTIVE}, nil
+ }
+
+ return nil, fmt.Errorf("#extractAndBuildCellLoadInformationAbsInformation - cellId: %s - Failed extracting AbsInformation", cellId)
+}
+
+func extractExtendedUlInterferenceOverloadIndicationList(extendedULInterferenceOverloadInfo *C.ExtendedULInterferenceOverloadInfo_t) []*C.UL_InterferenceOverloadIndication_Item_t {
+
+ extendedUlInterferenceOverLoadIndicationCount := extendedULInterferenceOverloadInfo.extended_ul_InterferenceOverloadIndication.list.count
+
+ if extendedUlInterferenceOverLoadIndicationCount == 0 {
+ return nil
+ }
+
+ extendedUlInterferenceOverLoadIndicationList := (*[1 << 30]*C.UL_InterferenceOverloadIndication_Item_t)(unsafe.Pointer(extendedULInterferenceOverloadInfo.extended_ul_InterferenceOverloadIndication.list.array))[:int(extendedUlInterferenceOverLoadIndicationCount):int(extendedUlInterferenceOverLoadIndicationCount)]
+
+ if (extendedUlInterferenceOverLoadIndicationList == nil) {
+ return nil
+ }
+
+ return extendedUlInterferenceOverLoadIndicationList
+}
+
+func buildExtendedULInterferenceOverloadInfo(pduExtendedULInterferenceOverloadInfo *C.ExtendedULInterferenceOverloadInfo_t) *entities.ExtendedUlInterferenceOverloadInfo {
+ associatedSubframes := NewHexString(pduExtendedULInterferenceOverloadInfo.associatedSubframes.buf, pduExtendedULInterferenceOverloadInfo.associatedSubframes.size)
+ indications := extractExtendedUlInterferenceOverloadIndicationList(pduExtendedULInterferenceOverloadInfo)
+
+ return &entities.ExtendedUlInterferenceOverloadInfo{
+ AssociatedSubframes: associatedSubframes,
+ ExtendedUlInterferenceOverloadIndications: buildUlInterferenceOverloadIndicationList(indications),
+ }
+}
+
+func extractPaListFromDynamicNaicsInformation(cellId string, dynamicNAICSInformation *C.DynamicNAICSInformation_t) ([]*C.long, error) {
+
+ paListCount := dynamicNAICSInformation.pA_list.list.count
+
+ if paListCount == 0 {
+ return nil, nil
+ }
+
+ if paListCount > MaxNoOfPa {
+ return nil, fmt.Errorf("#extractPaListFromDynamicNaicsInformation - cellId: %s - Invalid PA list count", cellId)
+ }
+
+ extendedUlInterferenceOverLoadIndicationList := (*[1 << 30]*C.long)(unsafe.Pointer(dynamicNAICSInformation.pA_list.list.array))[:int(paListCount):int(paListCount)]
+
+ if (extendedUlInterferenceOverLoadIndicationList == nil) {
+ return nil, fmt.Errorf("#extractPaListFromDynamicNaicsInformation - cellId: %s - Extended Ul Interference OverLoad Indication List is nil")
+ }
+
+ return extendedUlInterferenceOverLoadIndicationList, nil
+}
+
+func buildPaList(paList []*C.long) []entities.PA {
+ pas := make([]entities.PA, len(paList))
+ for i, pi := range paList {
+ pas[i] = entities.PA(*pi + 1)
+ }
+
+ return pas
+}
+
+func extractAndBuildActiveDynamicDlTransmissionInformation(cellId string, pduDynamicDlTransmissionInformation *C.DynamicDLTransmissionInformation_t) (*entities.DynamicDlTransmissionInformation, error) {
+ dynamicNaicsInformation := *(**C.DynamicNAICSInformation_t)(unsafe.Pointer(&pduDynamicDlTransmissionInformation.choice[0]))
+
+ if dynamicNaicsInformation == nil {
+ return nil, fmt.Errorf("#extractAndBuildActiveDynamicDlTransmissionInformation - cellId: %s - Invalid NAICS Information value", cellId)
+ }
+
+ dynamicDlTransmissionInformation := entities.DynamicDlTransmissionInformation{State: entities.NaicsState_NAICS_ACTIVE}
+
+ if dynamicNaicsInformation.transmissionModes != nil {
+ transmissionModes := NewHexString(dynamicNaicsInformation.transmissionModes.buf, dynamicNaicsInformation.transmissionModes.size)
+ dynamicDlTransmissionInformation.TransmissionModes = transmissionModes
+ }
+
+ if dynamicNaicsInformation.pB_information != nil {
+ dynamicDlTransmissionInformation.PB = uint32(*dynamicNaicsInformation.pB_information)
+ }
+
+ paList, err := extractPaListFromDynamicNaicsInformation(cellId, dynamicNaicsInformation)
+
+ if err != nil {
+ return nil, err
+ }
+
+ if (paList != nil) {
+ dynamicDlTransmissionInformation.PAList = buildPaList(paList)
+ }
+
+ return &dynamicDlTransmissionInformation, nil
+}
+
+func extractAndBuildDynamicDlTransmissionInformation(cellId string, extIE *C.CellInformation_Item_ExtIEs_t) (*entities.DynamicDlTransmissionInformation, error) {
+ pduDynamicDlTransmissionInformation := (*C.DynamicDLTransmissionInformation_t)(unsafe.Pointer(&extIE.extensionValue.choice[0]))
+
+ if pduDynamicDlTransmissionInformation.present == C.DynamicDLTransmissionInformation_PR_naics_inactive {
+ return &entities.DynamicDlTransmissionInformation{State: entities.NaicsState_NAICS_INACTIVE}, nil
+ }
+
+ if pduDynamicDlTransmissionInformation.present != C.DynamicDLTransmissionInformation_PR_naics_active {
+ return nil, fmt.Errorf("#extractAndBuildDynamicDlTransmissionInformation - cellId: %s - Invalid Dynamic Dl Transmission Information value", cellId)
+ }
+
+ return extractAndBuildActiveDynamicDlTransmissionInformation(cellId, pduDynamicDlTransmissionInformation)
+}
+
+func extractCompInformationStartTime(cellId string, compInformation *C.CoMPInformation_t) (*C.CoMPInformationStartTime__Member, error) {
+ compInformationStartTimeListCount := compInformation.coMPInformationStartTime.list.count
+
+ if compInformationStartTimeListCount == 0 {
+ return nil, nil
+ }
+
+ compInformationStartTimeList := (*[1 << 30]*C.CoMPInformationStartTime__Member)(unsafe.Pointer(compInformation.coMPInformationStartTime.list.array))[:int(compInformationStartTimeListCount):int(compInformationStartTimeListCount)]
+
+ if len(compInformationStartTimeList) != 1 {
+ return nil, fmt.Errorf("#extractCompInformationStartTime - cellId: %s - Invalid Comp Information StartTime list count", cellId)
+ }
+
+ return compInformationStartTimeList[0], nil
+}
+
+func buildCompHypothesisSet(pduCompHypothesisSetItem *C.CoMPHypothesisSetItem_t) *entities.CompHypothesisSet {
+ return &entities.CompHypothesisSet{
+ CellId: buildCellId(pduCompHypothesisSetItem.coMPCellID),
+ CompHypothesis: NewHexString(pduCompHypothesisSetItem.coMPHypothesis.buf, pduCompHypothesisSetItem.coMPHypothesis.size),
+ }
+}
+
+func buildCompHypothesisSets(cellId string, pduCompInformationItemMember *C.CoMPInformationItem__Member) ([]*entities.CompHypothesisSet, error) {
+
+ compHypothesisSets := []*entities.CompHypothesisSet{}
+
+ pduCompHypothesisSetItemsListCount := pduCompInformationItemMember.coMPHypothesisSet.list.count
+
+ if pduCompHypothesisSetItemsListCount == 0 || pduCompHypothesisSetItemsListCount > NaxNoOfCompCells {
+ return nil, fmt.Errorf("#buildCompHypothesisSets - cellId: %s - Invalid Comp Hypothesis Set Items list count")
+ }
+
+ pduCompHypothesisSetItems := (*[1 << 30]*C.CoMPHypothesisSetItem_t)(unsafe.Pointer(pduCompInformationItemMember.coMPHypothesisSet.list.array))[:int(pduCompHypothesisSetItemsListCount):int(pduCompHypothesisSetItemsListCount)]
+
+ for _, pduCompHypothesisSetItem := range pduCompHypothesisSetItems {
+ compHypothesisSet := buildCompHypothesisSet(pduCompHypothesisSetItem)
+ compHypothesisSets = append(compHypothesisSets, compHypothesisSet)
+ }
+
+ return compHypothesisSets, nil
+}
+
+func buildCompInformationItem(cellId string, pduCompInformationItemMember *C.CoMPInformationItem__Member) (*entities.CompInformationItem, error) {
+
+ compHypothesisSets, err := buildCompHypothesisSets(cellId, pduCompInformationItemMember)
+
+ if err != nil {
+ return nil, err
+ }
+
+ compInformation := entities.CompInformationItem{
+ CompHypothesisSets: compHypothesisSets,
+ BenefitMetric: int32(pduCompInformationItemMember.benefitMetric),
+ }
+
+ return &compInformation, nil
+}
+
+func extractAndBuildCompInformation(cellId string, extIE *C.CellInformation_Item_ExtIEs_t) (*entities.CompInformation, error) {
+
+ pduCompInformation := (*C.CoMPInformation_t)(unsafe.Pointer(&extIE.extensionValue.choice[0]))
+
+ compInformation := entities.CompInformation{}
+ pduCompInformationStartTime, err := extractCompInformationStartTime(cellId, pduCompInformation)
+
+ if err != nil {
+ return nil, err
+ }
+
+ if pduCompInformationStartTime != nil {
+ compInformation.CompInformationStartTime = NewStartTime(pduCompInformationStartTime.startSFN, pduCompInformationStartTime.startSubframeNumber)
+ }
+
+ pduCompInformationItemsListCount := pduCompInformation.coMPInformationItem.list.count
+
+ if pduCompInformationItemsListCount == 0 || pduCompInformationItemsListCount > NaxNoOfCompHypothesisSet {
+ return nil, fmt.Errorf("#extractAndBuildCompInformation - cellId: %s - Invalid Comp Information Items list count", cellId)
+ }
+
+ pduCompInformationItems := (*[1 << 30]*C.CoMPInformationItem__Member)(unsafe.Pointer(pduCompInformation.coMPInformationItem.list.array))[:int(pduCompInformationItemsListCount):int(pduCompInformationItemsListCount)]
+
+ for _, pduCompInformationItem := range pduCompInformationItems {
+ compInformationItem, err := buildCompInformationItem(cellId, pduCompInformationItem)
+
+ if err != nil {
+ return nil, err
+ }
+
+ compInformation.CompInformationItems = append(compInformation.CompInformationItems, compInformationItem)
+ }
+
+ return &compInformation, nil
+}
+
+func populateAbsInformation(cellId string, cellLoadInformation *entities.CellLoadInformation, extIE *C.CellInformation_Item_ExtIEs_t) error {
+ absInformation, err := extractAndBuildCellLoadInformationAbsInformation(cellId, extIE)
+
+ if err != nil {
+ return err
+ }
+
+ cellLoadInformation.AbsInformation = absInformation
+ return nil
+}
+
+func populateInvokeIndication(cellId string, cellLoadInformation *entities.CellLoadInformation, extIE *C.CellInformation_Item_ExtIEs_t) error {
+ pduInvokeIndication := (*C.InvokeIndication_t)(unsafe.Pointer(&extIE.extensionValue.choice[0]))
+ cellLoadInformation.InvokeIndication = entities.InvokeIndication(*pduInvokeIndication + 1)
+ return nil
+}
+
+func populateIntendedUlDlConfiguration(cellId string, cellLoadInformation *entities.CellLoadInformation, extIE *C.CellInformation_Item_ExtIEs_t) error {
+ pduSubframeAssignment := (*C.SubframeAssignment_t)(unsafe.Pointer(&extIE.extensionValue.choice[0]))
+ cellLoadInformation.IntendedUlDlConfiguration = entities.SubframeAssignment(*pduSubframeAssignment + 1)
+ return nil
+}
+
+func populateExtendedUlInterferenceOverloadInfo(cellId string, cellLoadInformation *entities.CellLoadInformation, extIE *C.CellInformation_Item_ExtIEs_t) error {
+ pduExtendedULInterferenceOverloadInfo := (*C.ExtendedULInterferenceOverloadInfo_t)(unsafe.Pointer(&extIE.extensionValue.choice[0]))
+ cellLoadInformation.ExtendedUlInterferenceOverloadInfo = buildExtendedULInterferenceOverloadInfo(pduExtendedULInterferenceOverloadInfo)
+ return nil
+}
+
+func populateCompInformation(cellId string, cellLoadInformation *entities.CellLoadInformation, extIE *C.CellInformation_Item_ExtIEs_t) error {
+ pduCompInformation, err := extractAndBuildCompInformation(cellId, extIE)
+
+ if err != nil {
+ return err
+ }
+
+ cellLoadInformation.CompInformation = pduCompInformation
+ return nil
+}
+
+func populateDynamicDLTransmissionInformation(cellId string, cellLoadInformation *entities.CellLoadInformation, extIE *C.CellInformation_Item_ExtIEs_t) error {
+ dynamicDLTransmissionInformation, err := extractAndBuildDynamicDlTransmissionInformation(cellId, extIE)
+
+ if err != nil {
+ return err
+ }
+
+ cellLoadInformation.DynamicDlTransmissionInformation = dynamicDLTransmissionInformation
+ return nil
+}
+
+func populateCellLoadInformationExtensionIEs(cellId string, cellLoadInformation *entities.CellLoadInformation, extIEs []*C.CellInformation_Item_ExtIEs_t) error {
+ for _, extIE := range extIEs {
+
+ populator, ok := populators[extIE.extensionValue.present]
+
+ if (!ok) {
+ continue
+ }
+
+ err := populator(cellId, cellLoadInformation, extIE)
+
+ if err != nil {
+ return err
+ }
+
+ }
+
+ return nil
+}
+
+func extractAndBuildRanLoadInformation(pdu *C.E2AP_PDU_t, ranLoadInformation *entities.RanLoadInformation) error {
+
+ defer C.delete_pdu(pdu)
+
+ pduCellInformationItemIEs, err := extractPduCellInformationItemIEs(pdu)
+
+ if err != nil {
+ return err
+ }
+
+ for _, pduCellInformationItemIE := range pduCellInformationItemIEs {
+ err = populateCellLoadInformation(pduCellInformationItemIE, ranLoadInformation)
+
+ if err != nil {
+ return err
+ }
+ }
+
+ return nil
+}
package handlers
+import "C"
import (
"e2mgr/logger"
"e2mgr/models"
+ "e2mgr/rNibWriter"
"e2mgr/sessions"
+ "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities"
+ "time"
)
type RicEnbLoadInformationNotificationHandler struct{}
+func elapsed(startTime time.Time) float64 {
+ return float64(time.Since(startTime)) / float64(time.Millisecond)
+}
+
+func (src RicEnbLoadInformationNotificationHandler) Handle(logger *logger.Logger, e2Sessions sessions.E2Sessions, request *models.NotificationRequest, messageChannel chan<- *models.NotificationResponse) {
+
+ pdu, err := unpackX2apPdu(logger, MaxAsn1CodecAllocationBufferSize, request.Len, request.Payload, MaxAsn1CodecMessageBufferSize)
-func (src RicEnbLoadInformationNotificationHandler) Handle(logger *logger.Logger, e2Sessions sessions.E2Sessions,
- request *models.NotificationRequest, messageChannel chan<- *models.NotificationResponse) {
+ //packedExampleString := "004c07080004001980da0100075bde017c148003d5a8205000017c180003d5a875555403331420000012883a0003547400cd20002801ea16007c1f07c1f107c1f0781e007c80800031a02c000c88199040a00352083669190000d8908020000be0c4001ead4016e007ab50100002f8320067ab5005b8c1ead5070190c00001d637805f220000f56a081400005f020000f56a1d555400ccc508002801ea16007c1f07c1f107c1f0781e007c80800031a02c000c88199040a00352083669190000d8908020000be044001ead4016e007ab50100002f8120067ab5005b8c1ead5070190c00000"
+ //
+ //var packedExampleByteSlice []byte
+ //
+ //_, err := fmt.Sscanf(packedExampleString, "%x", &packedExampleByteSlice)
+ //
+ //pdu, err := unpackX2apPduUPer(logger, MaxAsn1CodecAllocationBufferSize, len(packedExampleByteSlice), packedExampleByteSlice, MaxAsn1CodecMessageBufferSize)
- notification, err := unpackX2apPduAndRefine(logger, MaxAsn1CodecAllocationBufferSize /*allocation buffer*/, request.Len, request.Payload, MaxAsn1CodecMessageBufferSize /*message buffer*/)
if err != nil {
- logger.Errorf("#ric_enb_load_information_notification_handler.Handle - unpack failed. Error: %v", err)
+ logger.Errorf("#RicEnbLoadInformationNotificationHandler.Handle - RAN name: %s - Unpack failed. Error: %v", request.RanName, err)
+ return
+ }
+
+ logger.Debugf("#RicEnbLoadInformationNotificationHandler.Handle - RAN name: %s - Unpacked message successfully", request.RanName)
+
+ ranLoadInformation := &entities.RanLoadInformation{LoadTimestamp: uint64(request.StartTime.UnixNano())}
+
+ err = extractAndBuildRanLoadInformation(pdu, ranLoadInformation)
+
+ if (err != nil) {
+ logger.Errorf("#RicEnbLoadInformationNotificationHandler.Handle - RAN name: %s - Failed at extractAndBuildRanLoadInformation. Error: %v", request.RanName, err)
+ return
+ }
+
+ logger.Debugf("#RicEnbLoadInformationNotificationHandler.Handle - RAN name: %s - Successfully done with extracting and building RAN load information. elapsed: %f ms", request.RanName, elapsed(request.StartTime))
+
+ rnibErr := rNibWriter.GetRNibWriter().SaveRanLoadInformation(request.RanName, ranLoadInformation) // TODO: Should inject RnibWriter
+
+ if rnibErr != nil {
+ logger.Errorf("#RicEnbLoadInformationNotificationHandler.Handle - RAN name: %s - Failed saving RAN load information. Error: %v", request.RanName, rnibErr)
+ return
}
- logger.Infof("#ric_enb_load_information_notification_handler.handle - Enb load information notification message received")
- logger.Debugf("#ric_enb_load_information_notification_handler.handle - Enb load information notification message payload: %s", notification.pduPrint)
+ logger.Debugf("#RicEnbLoadInformationNotificationHandler.Handle - RAN name: %s - Successfully saved RAN load information to RNIB. elapsed: %f ms", request.RanName, elapsed(request.StartTime))
}
"github.com/pkg/errors"
"unsafe"
)
+func unpackX2apPduUPer(logger *logger.Logger, allocationBufferSize int, packedBufferSize int, packedBuf []byte, maxMessageBufferSize int) (*C.E2AP_PDU_t, error) {
+ pdu := C.new_pdu(C.ulong(allocationBufferSize))
+
+ if pdu == nil {
+ return nil, errors.New("allocation failure (pdu)")
+ }
+
+ logger.Debugf("#x2apPdu_asn1_unpacker.unpackX2apPduUPer - Packed pdu(%d):%x", packedBufferSize, packedBuf)
+
+ errBuf := make([]C.char, maxMessageBufferSize)
+ if !C.unpack_pdu_aux(pdu, C.ulong(packedBufferSize), (*C.uchar)(unsafe.Pointer(&packedBuf[0])), C.ulong(len(errBuf)), &errBuf[0], C.ATS_UNALIGNED_BASIC_PER) {
+ return nil, errors.New(fmt.Sprintf("unpacking error: %s", C.GoString(&errBuf[0])))
+ }
+
+ if logger.DebugEnabled() {
+ C.asn1_pdu_printer(pdu, C.size_t(len(errBuf)), &errBuf[0])
+ logger.Debugf("#x2apPdu_asn1_unpacker.unpackX2apPduUPer - PDU: %v packed size:%d", C.GoString(&errBuf[0]), packedBufferSize)
+ }
+ return pdu, nil
+}
type X2PduRefinedResponse struct {
pduPrint string
}
+//func unpackX2apPduUPer(logger *logger.Logger, allocationBufferSize int, packedBufferSize int, packedBuf []byte, maxMessageBufferSize int) (*C.E2AP_PDU_t, error) {
+// pdu := C.new_pdu(C.ulong(allocationBufferSize))
+//
+// if pdu == nil {
+// return nil, errors.New("allocation failure (pdu)")
+// }
+//
+// logger.Debugf("#x2apPdu_asn1_unpacker.unpackX2apPduUPer - Packed pdu(%d):%x", packedBufferSize, packedBuf)
+//
+// errBuf := make([]C.char, maxMessageBufferSize)
+// if !C.unpack_pdu_aux(pdu, C.ulong(packedBufferSize), (*C.uchar)(unsafe.Pointer(&packedBuf[0])), C.ulong(len(errBuf)), &errBuf[0], C.ATS_UNALIGNED_BASIC_PER) {
+// return nil, errors.New(fmt.Sprintf("unpacking error: %s", C.GoString(&errBuf[0])))
+// }
+//
+// if logger.DebugEnabled() {
+// C.asn1_pdu_printer(pdu, C.size_t(len(errBuf)), &errBuf[0])
+// logger.Debugf("#x2apPdu_asn1_unpacker.unpackX2apPduUPer - PDU: %v packed size:%d", C.GoString(&errBuf[0]), packedBufferSize)
+// }
+//
+// return pdu, nil
+//}
+
func unpackX2apPdu(logger *logger.Logger, allocationBufferSize int, packedBufferSize int, packedBuf []byte, maxMessageBufferSize int) (*C.E2AP_PDU_t, error) {
pdu := C.new_pdu(C.ulong(allocationBufferSize))
package rNibWriter
import (
- "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities"
"e2mgr/mocks"
- "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common"
"errors"
"fmt"
+ "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common"
+ "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities"
"github.com/golang/protobuf/proto"
- "github.com/golang/protobuf/ptypes/timestamp"
"github.com/stretchr/testify/assert"
"testing"
"time"
nb.Ip = "localhost"
nb.Port = 5656
enb := entities.Enb{}
- cell := &entities.ServedCellInfo{CellId:"aaff", Pci:3}
- cellEntity := entities.Cell{Type:entities.Cell_LTE_CELL, Cell:&entities.Cell_ServedCellInfo{ServedCellInfo:cell}}
+ cell := &entities.ServedCellInfo{CellId: "aaff", Pci: 3}
+ cellEntity := entities.Cell{Type: entities.Cell_LTE_CELL, Cell: &entities.Cell_ServedCellInfo{ServedCellInfo: cell}}
enb.ServedCells = []*entities.ServedCellInfo{cell}
- nb.Configuration = &entities.NodebInfo_Enb{Enb:&enb}
+ nb.Configuration = &entities.NodebInfo_Enb{Enb: &enb}
data, err := proto.Marshal(&nb)
if err != nil {
t.Errorf("#rNibWriter_test.TestSaveEnb - Failed to marshal NodeB entity. Error: %v", err)
setExpected = append(setExpected, fmt.Sprintf("PCI:%s:%02x", name, cell.GetPci()), cellData)
sdlInstanceMock.On("Set", []interface{}{setExpected}).Return(e)
- nbIdentity := &entities.NbIdentity{InventoryName:name, GlobalNbId:&entities.GlobalNbId{PlmnId:"02f829", NbId:"4a952a0a"}}
+ nbIdentity := &entities.NbIdentity{InventoryName: name, GlobalNbId: &entities.GlobalNbId{PlmnId: "02f829", NbId: "4a952a0a"}}
nbIdData, err := proto.Marshal(nbIdentity)
if err != nil {
t.Errorf("#rNibWriter_test.TestSaveEnb - Failed to marshal NodeB Identity entity. Error: %v", err)
nb.Ip = "localhost"
nb.Port = 5656
enb := entities.Enb{}
- cell := &entities.ServedCellInfo{Pci:3}
+ cell := &entities.ServedCellInfo{Pci: 3}
enb.ServedCells = []*entities.ServedCellInfo{cell}
- nb.Configuration = &entities.NodebInfo_Enb{Enb:&enb}
+ nb.Configuration = &entities.NodebInfo_Enb{Enb: &enb}
- nbIdentity := &entities.NbIdentity{InventoryName:name, GlobalNbId:&entities.GlobalNbId{PlmnId:"02f829", NbId:"4a952a0a"}}
+ nbIdentity := &entities.NbIdentity{InventoryName: name, GlobalNbId: &entities.GlobalNbId{PlmnId: "02f829", NbId: "4a952a0a"}}
rNibErr := w.SaveNodeb(nbIdentity, &nb)
assert.NotNil(t, rNibErr)
assert.Equal(t, common.VALIDATION_ERROR, rNibErr.GetCode())
nb.Ip = "localhost"
nb.Port = 5656
enb := entities.Enb{}
- cell := &entities.ServedCellInfo{CellId:"aaa",Pci:3}
+ cell := &entities.ServedCellInfo{CellId: "aaa", Pci: 3}
enb.ServedCells = []*entities.ServedCellInfo{cell}
- nb.Configuration = &entities.NodebInfo_Enb{Enb:&enb}
+ nb.Configuration = &entities.NodebInfo_Enb{Enb: &enb}
- nbIdentity := &entities.NbIdentity{InventoryName:"", GlobalNbId:&entities.GlobalNbId{PlmnId:"02f829", NbId:"4a952a0a"}}
+ nbIdentity := &entities.NbIdentity{InventoryName: "", GlobalNbId: &entities.GlobalNbId{PlmnId: "02f829", NbId: "4a952a0a"}}
rNibErr := w.SaveNodeb(nbIdentity, &nb)
assert.NotNil(t, rNibErr)
assert.Equal(t, common.VALIDATION_ERROR, rNibErr.GetCode())
nb.Ip = "localhost"
nb.Port = 5656
enb := entities.Enb{}
- nb.Configuration = &entities.NodebInfo_Enb{Enb:&enb}
+ nb.Configuration = &entities.NodebInfo_Enb{Enb: &enb}
data, err := proto.Marshal(&nb)
if err != nil {
t.Errorf("#rNibWriter_test.TestSaveEnbOnClosedPool - Failed to marshal NodeB entity. Error: %v", err)
sdlInstanceMock.On("Set", setExpected).Return(e)
writerPool.Close()
nbIdentity := &entities.NbIdentity{}
- assert.Panics(t, func(){w.SaveNodeb(nbIdentity, &nb)})
+ assert.Panics(t, func() { w.SaveNodeb(nbIdentity, &nb) })
}
func TestSaveGnbCellIdValidationFailure(t *testing.T) {
nb.Ip = "localhost"
nb.Port = 5656
gnb := entities.Gnb{}
- cellInfo:= &entities.ServedNRCellInformation{NrPci:2}
- cell := &entities.ServedNRCell{ServedNrCellInformation:cellInfo}
+ cellInfo := &entities.ServedNRCellInformation{NrPci: 2}
+ cell := &entities.ServedNRCell{ServedNrCellInformation: cellInfo}
gnb.ServedNrCells = []*entities.ServedNRCell{cell}
- nb.Configuration = &entities.NodebInfo_Gnb{Gnb:&gnb}
+ nb.Configuration = &entities.NodebInfo_Gnb{Gnb: &gnb}
- nbIdentity := &entities.NbIdentity{InventoryName:name, GlobalNbId:&entities.GlobalNbId{PlmnId:"02f829", NbId:"4a952a0a"}}
+ nbIdentity := &entities.NbIdentity{InventoryName: name, GlobalNbId: &entities.GlobalNbId{PlmnId: "02f829", NbId: "4a952a0a"}}
rNibErr := w.SaveNodeb(nbIdentity, &nb)
assert.NotNil(t, rNibErr)
assert.Equal(t, common.VALIDATION_ERROR, rNibErr.GetCode())
nb.Ip = "localhost"
nb.Port = 5656
gnb := entities.Gnb{}
- cellInfo:= &entities.ServedNRCellInformation{NrPci:2,CellId:"ccdd"}
- cell := &entities.ServedNRCell{ServedNrCellInformation:cellInfo}
- cellEntity := entities.Cell{Type:entities.Cell_NR_CELL, Cell:&entities.Cell_ServedNrCell{ServedNrCell:cell}}
+ cellInfo := &entities.ServedNRCellInformation{NrPci: 2, CellId: "ccdd"}
+ cell := &entities.ServedNRCell{ServedNrCellInformation: cellInfo}
+ cellEntity := entities.Cell{Type: entities.Cell_NR_CELL, Cell: &entities.Cell_ServedNrCell{ServedNrCell: cell}}
gnb.ServedNrCells = []*entities.ServedNRCell{cell}
- nb.Configuration = &entities.NodebInfo_Gnb{Gnb:&gnb}
+ nb.Configuration = &entities.NodebInfo_Gnb{Gnb: &gnb}
data, err := proto.Marshal(&nb)
if err != nil {
t.Errorf("#rNibWriter_test.TestSaveGnb - Failed to marshal NodeB entity. Error: %v", err)
}
var e error
-
cellData, err := proto.Marshal(&cellEntity)
if err != nil {
t.Errorf("#rNibWriter_test.TestSaveGnb - Failed to marshal Cell entity. Error: %v", err)
setExpected = append(setExpected, fmt.Sprintf("PCI:%s:%02x", name, cell.GetServedNrCellInformation().GetNrPci()), cellData)
sdlInstanceMock.On("Set", []interface{}{setExpected}).Return(e)
- nbIdentity := &entities.NbIdentity{InventoryName:name, GlobalNbId:&entities.GlobalNbId{PlmnId:"02f829", NbId:"4a952a0a"}}
+ nbIdentity := &entities.NbIdentity{InventoryName: name, GlobalNbId: &entities.GlobalNbId{PlmnId: "02f829", NbId: "4a952a0a"}}
nbIdData, err := proto.Marshal(nbIdentity)
if err != nil {
t.Errorf("#rNibWriter_test.TestSaveGnb - Failed to marshal NodeB Identity entity. Error: %v", err)
sdlInstanceMock := initSdlInstanceMock(namespace, 1)
w := GetRNibWriter()
-
ranLoadInformation := generateRanLoadInformation()
data, err := proto.Marshal(ranLoadInformation)
setExpected = append(setExpected, loadKey, data)
sdlInstanceMock.On("Set", []interface{}{setExpected}).Return(e)
-
rNibErr := w.SaveRanLoadInformation(inventoryName, ranLoadInformation)
assert.Nil(t, rNibErr)
}
w := GetRNibWriter()
expectedErr := common.NewInternalError(errors.New("proto: Marshal called with nil"))
- err:= w.SaveRanLoadInformation(inventoryName, nil)
+ err := w.SaveRanLoadInformation(inventoryName, nil)
assert.Equal(t, expectedErr, err)
}
initSdlInstanceMock(namespace, 1)
w := GetRNibWriter()
- err:= w.SaveRanLoadInformation(inventoryName, nil)
+ err := w.SaveRanLoadInformation(inventoryName, nil)
assert.NotNil(t, err)
assert.Equal(t, common.VALIDATION_ERROR, err.GetCode())
}
t.Errorf("#rNibWriter_test.TestSaveRanLoadInformationSuccess - Failed to build ran load infromation key. Error: %v", validationErr)
}
-
writerPool = nil
sdlInstanceMock := initSdlInstanceMock(namespace, 1)
w := GetRNibWriter()
t.Errorf("#rNibWriter_test.TestSaveRanLoadInformation - Failed to marshal RanLoadInformation entity. Error: %v", err)
}
-
expectedErr := errors.New("expected error")
var setExpected []interface{}
setExpected = append(setExpected, loadKey, data)
sdlInstanceMock.On("Set", []interface{}{setExpected}).Return(expectedErr)
-
rNibErr := w.SaveRanLoadInformation(inventoryName, ranLoadInformation)
assert.NotNil(t, rNibErr)
assert.Equal(t, common.INTERNAL_ERROR, rNibErr.GetCode())
cellLoadInformation.UlInterferenceOverloadIndications = []entities.UlInterferenceOverloadIndication{ulInterferenceOverloadIndication}
ulHighInterferenceInformation := entities.UlHighInterferenceInformation{
- TargetCellId:"456",
- UlHighInterferenceIndication:"xxx",
+ TargetCellId: "456",
+ UlHighInterferenceIndication: "xxx",
}
- cellLoadInformation.UlHighInterferenceInfos = []*entities.UlHighInterferenceInformation{&ulHighInterferenceInformation }
+ cellLoadInformation.UlHighInterferenceInfos = []*entities.UlHighInterferenceInformation{&ulHighInterferenceInformation}
cellLoadInformation.RelativeNarrowbandTxPower = &entities.RelativeNarrowbandTxPower{
- RntpPerPrb:"xxx",
- RntpThreshold:entities.RntpThreshold_NEG_4,
+ RntpPerPrb: "xxx",
+ RntpThreshold: entities.RntpThreshold_NEG_4,
NumberOfCellSpecificAntennaPorts: entities.NumberOfCellSpecificAntennaPorts_V1_ANT_PRT,
- PB: 1,
- PdcchInterferenceImpact:2,
+ PB: 1,
+ PdcchInterferenceImpact: 2,
EnhancedRntp: &entities.EnhancedRntp{
- EnhancedRntpBitmap:"xxx",
- RntpHighPowerThreshold:entities.RntpThreshold_NEG_2,
- EnhancedRntpStartTimes: []*entities.StartTime{&entities.StartTime{StartSfn:500,StartSubframeNumber:5}},
+ EnhancedRntpBitmap: "xxx",
+ RntpHighPowerThreshold: entities.RntpThreshold_NEG_2,
+ EnhancedRntpStartTime: &entities.StartTime{StartSfn: 500, StartSubframeNumber: 5},
},
}
cellLoadInformation.AbsInformation = &entities.AbsInformation{
- Mode: entities.AbsInformationMode_ABS_INFO_FDD,
- AbsPatternInfo:"xxx",
- NumberOfCellSpecificAntennaPorts:entities.NumberOfCellSpecificAntennaPorts_V2_ANT_PRT,
- MeasurementSubset:"xxx",
+ Mode: entities.AbsInformationMode_ABS_INFO_FDD,
+ AbsPatternInfo: "xxx",
+ NumberOfCellSpecificAntennaPorts: entities.NumberOfCellSpecificAntennaPorts_V2_ANT_PRT,
+ MeasurementSubset: "xxx",
}
cellLoadInformation.InvokeIndication = entities.InvokeIndication_ABS_INFORMATION
cellLoadInformation.ExtendedUlInterferenceOverloadInfo = &entities.ExtendedUlInterferenceOverloadInfo{
- AssociatedSubframes:"xxx",
- ExtendedUlInterferenceOverloadIndications:cellLoadInformation.UlInterferenceOverloadIndications,
+ AssociatedSubframes: "xxx",
+ ExtendedUlInterferenceOverloadIndications: cellLoadInformation.UlInterferenceOverloadIndications,
}
compInformationItem := &entities.CompInformationItem{
- CompHypothesisSets: []*entities.CompHypothesisSet{&entities.CompHypothesisSet{CellId: "789", CompHypothesis:"xxx"}},
- BenefitMetric:50,
+ CompHypothesisSets: []*entities.CompHypothesisSet{&entities.CompHypothesisSet{CellId: "789", CompHypothesis: "xxx"}},
+ BenefitMetric: 50,
}
cellLoadInformation.CompInformation = &entities.CompInformation{
- CompInformationItems:[]*entities.CompInformationItem{compInformationItem},
- CompInformationStartTime:[]*entities.StartTime{&entities.StartTime{StartSfn:123,StartSubframeNumber:456}},
+ CompInformationItems: []*entities.CompInformationItem{compInformationItem},
+ CompInformationStartTime: &entities.StartTime{StartSfn: 123, StartSubframeNumber: 456},
}
cellLoadInformation.DynamicDlTransmissionInformation = &entities.DynamicDlTransmissionInformation{
- State: entities.NaicsState_NAICS_ACTIVE,
- TransmissionModes:"xxx",
- PB: 2,
- PAList:[]entities.PA{entities.PA_DB_NEG_3},
+ State: entities.NaicsState_NAICS_ACTIVE,
+ TransmissionModes: "xxx",
+ PB: 2,
+ PAList: []entities.PA{entities.PA_DB_NEG_3},
}
return &cellLoadInformation
func generateRanLoadInformation() *entities.RanLoadInformation {
ranLoadInformation := entities.RanLoadInformation{}
- ranLoadInformation.LoadTimestamp = ×tamp.Timestamp{Seconds:time.Now().Unix(),Nanos: int32(time.Now().UnixNano())}
-
+ ranLoadInformation.LoadTimestamp = uint64(time.Now().UnixNano())
cellLoadInformation := generateCellLoadInformation()
ranLoadInformation.CellLoadInfos = []*entities.CellLoadInformation{cellLoadInformation}
initSdlInstanceMock(namespace, 1)
w := GetRNibWriter()
expectedErr := common.NewValidationError(errors.New("#rNibWriter.saveNodeB - Unknown responding node type, entity: ip:\"localhost\" port:5656 "))
- nbIdentity := &entities.NbIdentity{InventoryName:"name", GlobalNbId:&entities.GlobalNbId{PlmnId:"02f829", NbId:"4a952a0a"}}
+ nbIdentity := &entities.NbIdentity{InventoryName: "name", GlobalNbId: &entities.GlobalNbId{PlmnId: "02f829", NbId: "4a952a0a"}}
nb := &entities.NodebInfo{}
nb.Port = 5656
nb.Ip = "localhost"
if err != nil {
t.Errorf("#rNibWriter_test.TestSaveEntityFailure - Failed to marshal NodeB entity. Error: %v", err)
}
- nbIdentity := &entities.NbIdentity{InventoryName:name, GlobalNbId:&entities.GlobalNbId{PlmnId:plmnId, NbId:nbId}}
+ nbIdentity := &entities.NbIdentity{InventoryName: name, GlobalNbId: &entities.GlobalNbId{PlmnId: plmnId, NbId: nbId}}
setExpected := []interface{}{"RAN:" + name, data}
- setExpected = append(setExpected,"GNB:" + plmnId + ":" + nbId, data)
+ setExpected = append(setExpected, "GNB:"+plmnId+":"+nbId, data)
expectedErr := errors.New("expected error")
sdlInstanceMock.On("Set", []interface{}{setExpected}).Return(expectedErr)
rNibErr := w.SaveNodeb(nbIdentity, &gnb)
func TestGetRNibWriterPoolNotInitializedFailure(t *testing.T) {
writerPool = nil
- assert.Panics(t, func(){GetRNibWriter()})
+ assert.Panics(t, func() { GetRNibWriter() })
}
func TestGetRNibWriter(t *testing.T) {
var e error
instanceMock.On("Close").Return(e)
Close()
- assert.Panics(t, func(){Close()})
+ assert.Panics(t, func() { Close() })
}
func TestCloseFailure(t *testing.T) {
// if err != nil{
// t.Errorf("#rNibWriter_test.TestSaveRanLoadInformationInteg - Failed to save RanLoadInformation entity. Error: %v", err)
// }
-//}
\ No newline at end of file
+//}
func convertToMBuf(logger *logger.Logger, m *C.rmr_mbuf_t) *MBuf {
payloadArr := C.GoBytes(unsafe.Pointer(m.payload),C.int(m.len))
- xActionArr := C.GoBytes(unsafe.Pointer(m.xaction),RMR_MAX_XACTION_LEN)
+ xActionArr := C.GoBytes(unsafe.Pointer(m.xaction),C.int(RMR_MAX_XACTION_LEN))
// Trim padding (space and 0)
xActionStr := strings.TrimRight(string(xActionArr),"\040\000")