LF RNIB Adaptation
Change-Id: Ibfddb7688559c77803a5df025c5bbdbcf1ce2e8d
Signed-off-by: Mohamed Abukar <abukar.mohamed@nokia.com>
diff --git a/pkg/xapp/config.go b/pkg/xapp/config.go
index 647b3eb..0493059 100755
--- a/pkg/xapp/config.go
+++ b/pkg/xapp/config.go
@@ -80,3 +80,7 @@
func (*Configurator) GetInt(key string) int {
return viper.GetInt(key)
}
+
+func (*Configurator) GetBool(key string) bool {
+ return viper.GetBool(key)
+}
diff --git a/pkg/xapp/db.go b/pkg/xapp/db.go
index 542c755..779e2cd 100755
--- a/pkg/xapp/db.go
+++ b/pkg/xapp/db.go
@@ -20,7 +20,14 @@
package xapp
import (
+ rnibcommon "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common"
+ rnibentities "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities"
+ rnibreader "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader"
sdl "gerrit.o-ran-sc.org/r/ric-plt/sdlgo"
+ uenibprotobuf "gerrit.o-ran-sc.org/r/ric-plt/ue-nib/uernibprotobuf"
+ uenibreader "gerrit.o-ran-sc.org/r/ric-plt/ue-nib/uernibreader"
+ uenibwriter "gerrit.o-ran-sc.org/r/ric-plt/ue-nib/uernibwriter"
+ rnibwriter "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/rnib"
"sync"
"time"
)
@@ -40,8 +47,44 @@
ready bool
}
+// Alias
+type EventCategory = uenibreader.EventCategory
+type EventCallback = uenibreader.EventCallback
+type MeasResultNR = uenibprotobuf.MeasResultNR
+type MeasQuantityResults = uenibprotobuf.MeasResultNR_MeasQuantityResults
+type MeasResultServMO = uenibprotobuf.MeasResults_MeasResultServMO
+type MeasResults = uenibprotobuf.MeasResults
+
+type UENIBClient struct {
+ reader *uenibreader.Reader
+ writer *uenibwriter.Writer
+}
+
+// Alias
+type RNIBNodeType = rnibentities.Node_Type
+type RNIBGlobalNbId = rnibentities.GlobalNbId
+type RNIBNodebInfo = rnibentities.NodebInfo
+type RNIBIRNibError = rnibcommon.IRNibError
+type RNIBCells = rnibentities.Cells
+type RNIBNbIdentity = rnibentities.NbIdentity
+type RNIBCellType = rnibentities.Cell_Type
+type RNIBCell = rnibentities.Cell
+type RNIBEnb = rnibentities.Enb
+type RNIBGnb = rnibentities.Gnb
+
+const RNIBNodeENB = rnibentities.Node_ENB
+const RNIBNodeGNB = rnibentities.Node_GNB
+
+type RNIBServedCellInfo = rnibentities.ServedCellInfo
+type RNIBNodebInfoEnb = rnibentities.NodebInfo_Enb
+type RNIBNodebInfoGnb = rnibentities.NodebInfo_Gnb
+type RNIBServedNRCell = rnibentities.ServedNRCell
+type RNIBServedNRCellInformation = rnibentities.ServedNRCellInformation
+type RNIBNrNeighbourInformation = rnibentities.NrNeighbourInformation
+
type RNIBClient struct {
- db *sdl.SdlInstance
+ reader rnibreader.RNibReader
+ writer rnibwriter.RNibWriter
}
// NewSDLClient returns a new SDLClient.
@@ -134,39 +177,74 @@
return
}
-// To be removed ...
+func NewUENIBClient() *UENIBClient {
+ return &UENIBClient{
+ reader: uenibreader.NewReader(),
+ writer: uenibwriter.NewWriter(),
+ }
+}
+
+func (u *UENIBClient) StoreUeMeasurement(gNbId string, gNbUeX2ApId string, data *uenibprotobuf.MeasResults) error {
+ return u.writer.UpdateUeMeasurement(gNbId, gNbUeX2ApId, data)
+}
+
+func (u *UENIBClient) CreateUeContext(gNbId string, gNbUeX2ApId string) error {
+ return u.writer.UeContextAddComplete(gNbId, gNbUeX2ApId)
+}
+
+func (u *UENIBClient) ReleaseUeContext(gNbId string, gNbUeX2ApId string) error {
+ return u.writer.RemoveUeContext(gNbId, gNbUeX2ApId)
+}
+
+func (u *UENIBClient) ReadUeMeasurement(gNbId string, gNbUeX2ApId string) (*uenibprotobuf.MeasResults, error) {
+ return u.reader.GetUeMeasurement(gNbId, gNbUeX2ApId)
+}
+
+func (u *UENIBClient) SubscribeEvents(gNbIDs []string, eventCategories []EventCategory, cb EventCallback) error {
+ return u.reader.SubscribeEvents(gNbIDs, eventCategories, cb)
+}
+
func NewRNIBClient(ns string) *RNIBClient {
+ rnibreader.Init("rnib", 1)
+ rnibwriter.InitWriter("rnib", 1)
return &RNIBClient{
- db: sdl.NewSdlInstance(ns, sdl.NewDatabase()),
+ reader: nil,
+ writer: nil,
}
}
-func (r *RNIBClient) GetgNBList() (values map[string]interface{}, err error) {
- keys, err := r.db.GetAll()
- if err == nil {
- values = make(map[string]interface{})
- for _, key := range keys {
- v, err := r.db.Get([]string{key})
- if err == nil {
- values[key] = v[key]
- }
- }
- }
- return
+func (r *RNIBClient) GetNodeb(invName string) (*RNIBNodebInfo, RNIBIRNibError) {
+ return rnibreader.GetRNibReader().GetNodeb(invName)
}
-func (r *RNIBClient) GetNRCellList(key string) (value map[string]interface{}, err error) {
- return r.db.Get([]string{key})
+func (r *RNIBClient) GetNodebByGlobalNbId(t RNIBNodeType, gid *RNIBGlobalNbId) (*RNIBNodebInfo, RNIBIRNibError) {
+ return rnibreader.GetRNibReader().GetNodebByGlobalNbId(t, gid)
}
-func (r *RNIBClient) GetUE(key1, key2 string) (value map[string]interface{}, err error) {
- return r.db.Get([]string{key1 + key2})
+func (r *RNIBClient) GetCellList(invName string) (*RNIBCells, RNIBIRNibError) {
+ return rnibreader.GetRNibReader().GetCellList(invName)
}
-func (r *RNIBClient) Store(key string, value interface{}) (err error) {
- return r.db.Set(key, value)
+func (r *RNIBClient) GetListGnbIds() (*[]*RNIBNbIdentity, RNIBIRNibError) {
+ return rnibreader.GetRNibReader().GetListGnbIds()
}
-func (r *RNIBClient) Clear() {
- r.db.RemoveAll()
+func (r *RNIBClient) GetListEnbIds() (*[]*RNIBNbIdentity, RNIBIRNibError) {
+ return rnibreader.GetRNibReader().GetListEnbIds()
+}
+
+func (r *RNIBClient) GetCountGnbList() (int, RNIBIRNibError) {
+ return rnibreader.GetRNibReader().GetCountGnbList()
+}
+
+func (r *RNIBClient) GetCell(invName string, pci uint32) (*RNIBCell, RNIBIRNibError) {
+ return rnibreader.GetRNibReader().GetCell(invName, pci)
+}
+
+func (r *RNIBClient) GetCellById(cellType RNIBCellType, cellId string) (*RNIBCell, RNIBIRNibError) {
+ return rnibreader.GetRNibReader().GetCellById(cellType, cellId)
+}
+
+func (r *RNIBClient) SaveNodeb(nbIdentity *RNIBNbIdentity, entity *RNIBNodebInfo) RNIBIRNibError {
+ return rnibwriter.GetRNibWriter().SaveNodeb(nbIdentity, entity)
}
diff --git a/pkg/xapp/logger.go b/pkg/xapp/logger.go
index 484df2c..ff6e52e 100755
--- a/pkg/xapp/logger.go
+++ b/pkg/xapp/logger.go
@@ -21,6 +21,7 @@
import (
mdclog "gerrit.o-ran-sc.org/r/com/golog"
+ "time"
)
type Log struct {
@@ -43,17 +44,21 @@
}
func (l *Log) Error(pattern string, args ...interface{}) {
+ l.SetMdc("time", time.Now().Format("2019-01-02 15:04:05"))
l.logger.Error(pattern, args...)
}
func (l *Log) Warn(pattern string, args ...interface{}) {
+ l.SetMdc("time", time.Now().Format("2019-01-02 15:04:05"))
l.logger.Warning(pattern, args...)
}
func (l *Log) Info(pattern string, args ...interface{}) {
+ l.SetMdc("time", time.Now().Format("2019-01-02 15:04:05"))
l.logger.Info(pattern, args...)
}
func (l *Log) Debug(pattern string, args ...interface{}) {
+ l.SetMdc("time", time.Now().Format("2019-01-02 15:04:05"))
l.logger.Debug(pattern, args...)
}
diff --git a/pkg/xapp/mtypes.go b/pkg/xapp/mtypes.go
index 2965e1e..82f3466 100755
--- a/pkg/xapp/mtypes.go
+++ b/pkg/xapp/mtypes.go
@@ -67,89 +67,88 @@
"DC_ADM_INT_CONTROL_ACK": C.DC_ADM_INT_CONTROL_ACK,
}
-
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
const (
- RIC_SUB_REQ = C.RIC_SUB_REQ
- RIC_SUB_RESP = C.RIC_SUB_RESP
- RIC_SUB_FAILURE = C.RIC_SUB_FAILURE
- RIC_SUB_DEL_REQ = C.RIC_SUB_DEL_REQ
- RIC_SUB_DEL_RESP = C.RIC_SUB_DEL_RESP
- RIC_SUB_DEL_FAILURE = C.RIC_SUB_DEL_FAILURE
- RIC_SERVICE_UPDATE = C.RIC_SERVICE_UPDATE
- RIC_SERVICE_UPDATE_ACK = C.RIC_SERVICE_UPDATE_ACK
- RIC_SERVICE_UPDATE_FAILURE = C.RIC_SERVICE_UPDATE_FAILURE
- RIC_CONTROL_REQ = C.RIC_CONTROL_REQ
- RIC_CONTROL_ACK = C.RIC_CONTROL_ACK
- RIC_CONTROL_FAILURE = C.RIC_CONTROL_FAILURE
- RIC_INDICATION = C.RIC_INDICATION
- RIC_SERVICE_QUERY = C.RIC_SERVICE_QUERY
- RIC_X2_SETUP_REQ = C.RIC_X2_SETUP_REQ
- RIC_X2_SETUP_RESP = C.RIC_X2_SETUP_RESP
- RIC_X2_SETUP_FAILURE = C.RIC_X2_SETUP_FAILURE
- RIC_X2_RESET = C.RIC_X2_RESET
- RIC_X2_RESET_RESP = C.RIC_X2_RESET_RESP
- RIC_ENDC_X2_SETUP_REQ = C.RIC_ENDC_X2_SETUP_REQ
- RIC_ENDC_X2_SETUP_RESP = C.RIC_ENDC_X2_SETUP_RESP
- RIC_ENDC_X2_SETUP_FAILURE = C.RIC_ENDC_X2_SETUP_FAILURE
- RIC_ENDC_CONF_UPDATE = C.RIC_ENDC_CONF_UPDATE
- RIC_ENDC_CONF_UPDATE_ACK = C.RIC_ENDC_CONF_UPDATE_ACK
+ RIC_SUB_REQ = C.RIC_SUB_REQ
+ RIC_SUB_RESP = C.RIC_SUB_RESP
+ RIC_SUB_FAILURE = C.RIC_SUB_FAILURE
+ RIC_SUB_DEL_REQ = C.RIC_SUB_DEL_REQ
+ RIC_SUB_DEL_RESP = C.RIC_SUB_DEL_RESP
+ RIC_SUB_DEL_FAILURE = C.RIC_SUB_DEL_FAILURE
+ RIC_SERVICE_UPDATE = C.RIC_SERVICE_UPDATE
+ RIC_SERVICE_UPDATE_ACK = C.RIC_SERVICE_UPDATE_ACK
+ RIC_SERVICE_UPDATE_FAILURE = C.RIC_SERVICE_UPDATE_FAILURE
+ RIC_CONTROL_REQ = C.RIC_CONTROL_REQ
+ RIC_CONTROL_ACK = C.RIC_CONTROL_ACK
+ RIC_CONTROL_FAILURE = C.RIC_CONTROL_FAILURE
+ RIC_INDICATION = C.RIC_INDICATION
+ RIC_SERVICE_QUERY = C.RIC_SERVICE_QUERY
+ RIC_X2_SETUP_REQ = C.RIC_X2_SETUP_REQ
+ RIC_X2_SETUP_RESP = C.RIC_X2_SETUP_RESP
+ RIC_X2_SETUP_FAILURE = C.RIC_X2_SETUP_FAILURE
+ RIC_X2_RESET = C.RIC_X2_RESET
+ RIC_X2_RESET_RESP = C.RIC_X2_RESET_RESP
+ RIC_ENDC_X2_SETUP_REQ = C.RIC_ENDC_X2_SETUP_REQ
+ RIC_ENDC_X2_SETUP_RESP = C.RIC_ENDC_X2_SETUP_RESP
+ RIC_ENDC_X2_SETUP_FAILURE = C.RIC_ENDC_X2_SETUP_FAILURE
+ RIC_ENDC_CONF_UPDATE = C.RIC_ENDC_CONF_UPDATE
+ RIC_ENDC_CONF_UPDATE_ACK = C.RIC_ENDC_CONF_UPDATE_ACK
RIC_ENDC_CONF_UPDATE_FAILURE = C.RIC_ENDC_CONF_UPDATE_FAILURE
- RIC_RES_STATUS_REQ = C.RIC_RES_STATUS_REQ
- RIC_RES_STATUS_RESP = C.RIC_RES_STATUS_RESP
- RIC_RES_STATUS_FAILURE = C.RIC_RES_STATUS_FAILURE
- RIC_ENB_CONF_UPDATE = C.RIC_ENB_CONF_UPDATE
- RIC_ENB_CONF_UPDATE_ACK = C.RIC_ENB_CONF_UPDATE_ACK
- RIC_ENB_CONF_UPDATE_FAILURE = C.RIC_ENB_CONF_UPDATE_FAILURE
- RIC_ENB_LOAD_INFORMATION = C.RIC_ENB_LOAD_INFORMATION
- RIC_GNB_STATUS_INDICATION = C.RIC_GNB_STATUS_INDICATION
- RIC_RESOURCE_STATUS_UPDATE = C.RIC_RESOURCE_STATUS_UPDATE
- RIC_ERROR_INDICATION = C.RIC_ERROR_INDICATION
- DC_ADM_INT_CONTROL = C.DC_ADM_INT_CONTROL
- DC_ADM_INT_CONTROL_ACK = C.DC_ADM_INT_CONTROL_ACK
+ RIC_RES_STATUS_REQ = C.RIC_RES_STATUS_REQ
+ RIC_RES_STATUS_RESP = C.RIC_RES_STATUS_RESP
+ RIC_RES_STATUS_FAILURE = C.RIC_RES_STATUS_FAILURE
+ RIC_ENB_CONF_UPDATE = C.RIC_ENB_CONF_UPDATE
+ RIC_ENB_CONF_UPDATE_ACK = C.RIC_ENB_CONF_UPDATE_ACK
+ RIC_ENB_CONF_UPDATE_FAILURE = C.RIC_ENB_CONF_UPDATE_FAILURE
+ RIC_ENB_LOAD_INFORMATION = C.RIC_ENB_LOAD_INFORMATION
+ RIC_GNB_STATUS_INDICATION = C.RIC_GNB_STATUS_INDICATION
+ RIC_RESOURCE_STATUS_UPDATE = C.RIC_RESOURCE_STATUS_UPDATE
+ RIC_ERROR_INDICATION = C.RIC_ERROR_INDICATION
+ DC_ADM_INT_CONTROL = C.DC_ADM_INT_CONTROL
+ DC_ADM_INT_CONTROL_ACK = C.DC_ADM_INT_CONTROL_ACK
)
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
var RicMessageTypeToName = map[int]string{
- RIC_SUB_REQ: "RIC SUBSCRIPTION REQUEST",
- RIC_SUB_RESP: "RIC SUBSCRIPTION RESPONSE",
- RIC_SUB_FAILURE: "RIC SUBSCRIPTION FAILURE",
- RIC_SUB_DEL_REQ: "RIC SUBSCRIPTION DELETE REQUEST",
- RIC_SUB_DEL_RESP: "RIC SUBSCRIPTION DELETE RESPONSE",
- RIC_SUB_DEL_FAILURE: "RIC SUBSCRIPTION DELETE FAILURE",
- RIC_SERVICE_UPDATE: "RIC SERVICE UPDATE",
- RIC_SERVICE_UPDATE_ACK: "RIC SERVICE UPDATE ACKNOWLEDGE",
- RIC_SERVICE_UPDATE_FAILURE: "RIC SERVICE UPDATE FAILURE",
- RIC_CONTROL_REQ: "RIC CONTROL REQUEST",
- RIC_CONTROL_ACK: "RIC CONTROL ACKNOWLEDGE",
- RIC_CONTROL_FAILURE: "RIC CONTROL FAILURE",
- RIC_INDICATION: "RIC INDICATION",
- RIC_SERVICE_QUERY: "RIC SERVICE QUERY",
- RIC_X2_SETUP_REQ: "RIC X2 SETUP REQUEST",
- RIC_X2_SETUP_RESP: "RIC X2 SETUP RESPONSE",
- RIC_X2_SETUP_FAILURE: "RIC X2 SETUP FAILURE",
- RIC_X2_RESET: "RIC X2 RESET REQUEST",
- RIC_X2_RESET_RESP: "RIC X2 RESET RESPONSE",
- RIC_ENDC_X2_SETUP_REQ: "RIC EN-DC X2 SETUP REQUEST",
- RIC_ENDC_X2_SETUP_RESP: "RIC EN-DC X2 SETUP RESPONSE",
- RIC_ENDC_X2_SETUP_FAILURE: "RIC EN-DC X2 SETUP FAILURE",
- RIC_ENDC_CONF_UPDATE: "RIC EN-DC CONFIGURATION UPDATE",
- RIC_ENDC_CONF_UPDATE_ACK: "RIC EN-DC CONFIGURATION UPDATE ACKNOWLEDGE",
- RIC_ENDC_CONF_UPDATE_FAILURE:"RIC EN-DC CONFIGURATION UPDATE FAILURE",
- RIC_RES_STATUS_REQ: "RIC RESOURCE STATUS REQUEST",
- RIC_RES_STATUS_RESP: "RIC RESOURCE STATUS RESPONSE",
- RIC_RES_STATUS_FAILURE: "RIC RESOURCE STATUS FAILURE",
- RIC_ENB_CONF_UPDATE: "RIC ENB CONFIGURATION UPDATE",
- RIC_ENB_CONF_UPDATE_ACK: "RIC ENB CONFIGURATION UPDATE ACKNOWLEDGE",
- RIC_ENB_CONF_UPDATE_FAILURE: "RIC ENB CONFIGURATION UPDATE FAILURE",
- RIC_ENB_LOAD_INFORMATION: "RIC ENB LOAD INFORMATION",
- RIC_GNB_STATUS_INDICATION: "RIC GNB STATUS INDICATION",
- RIC_RESOURCE_STATUS_UPDATE: "RIC RESOURCE STATUS UPDATE",
- RIC_ERROR_INDICATION: "RIC ERROR INDICATION",
- DC_ADM_INT_CONTROL: "DC ADMISSION INTERVAL CONTROL",
- DC_ADM_INT_CONTROL_ACK: "DC ADMISSION INTERVAL CONTROL ACK",
+ RIC_SUB_REQ: "RIC SUBSCRIPTION REQUEST",
+ RIC_SUB_RESP: "RIC SUBSCRIPTION RESPONSE",
+ RIC_SUB_FAILURE: "RIC SUBSCRIPTION FAILURE",
+ RIC_SUB_DEL_REQ: "RIC SUBSCRIPTION DELETE REQUEST",
+ RIC_SUB_DEL_RESP: "RIC SUBSCRIPTION DELETE RESPONSE",
+ RIC_SUB_DEL_FAILURE: "RIC SUBSCRIPTION DELETE FAILURE",
+ RIC_SERVICE_UPDATE: "RIC SERVICE UPDATE",
+ RIC_SERVICE_UPDATE_ACK: "RIC SERVICE UPDATE ACKNOWLEDGE",
+ RIC_SERVICE_UPDATE_FAILURE: "RIC SERVICE UPDATE FAILURE",
+ RIC_CONTROL_REQ: "RIC CONTROL REQUEST",
+ RIC_CONTROL_ACK: "RIC CONTROL ACKNOWLEDGE",
+ RIC_CONTROL_FAILURE: "RIC CONTROL FAILURE",
+ RIC_INDICATION: "RIC INDICATION",
+ RIC_SERVICE_QUERY: "RIC SERVICE QUERY",
+ RIC_X2_SETUP_REQ: "RIC X2 SETUP REQUEST",
+ RIC_X2_SETUP_RESP: "RIC X2 SETUP RESPONSE",
+ RIC_X2_SETUP_FAILURE: "RIC X2 SETUP FAILURE",
+ RIC_X2_RESET: "RIC X2 RESET REQUEST",
+ RIC_X2_RESET_RESP: "RIC X2 RESET RESPONSE",
+ RIC_ENDC_X2_SETUP_REQ: "RIC EN-DC X2 SETUP REQUEST",
+ RIC_ENDC_X2_SETUP_RESP: "RIC EN-DC X2 SETUP RESPONSE",
+ RIC_ENDC_X2_SETUP_FAILURE: "RIC EN-DC X2 SETUP FAILURE",
+ RIC_ENDC_CONF_UPDATE: "RIC EN-DC CONFIGURATION UPDATE",
+ RIC_ENDC_CONF_UPDATE_ACK: "RIC EN-DC CONFIGURATION UPDATE ACKNOWLEDGE",
+ RIC_ENDC_CONF_UPDATE_FAILURE: "RIC EN-DC CONFIGURATION UPDATE FAILURE",
+ RIC_RES_STATUS_REQ: "RIC RESOURCE STATUS REQUEST",
+ RIC_RES_STATUS_RESP: "RIC RESOURCE STATUS RESPONSE",
+ RIC_RES_STATUS_FAILURE: "RIC RESOURCE STATUS FAILURE",
+ RIC_ENB_CONF_UPDATE: "RIC ENB CONFIGURATION UPDATE",
+ RIC_ENB_CONF_UPDATE_ACK: "RIC ENB CONFIGURATION UPDATE ACKNOWLEDGE",
+ RIC_ENB_CONF_UPDATE_FAILURE: "RIC ENB CONFIGURATION UPDATE FAILURE",
+ RIC_ENB_LOAD_INFORMATION: "RIC ENB LOAD INFORMATION",
+ RIC_GNB_STATUS_INDICATION: "RIC GNB STATUS INDICATION",
+ RIC_RESOURCE_STATUS_UPDATE: "RIC RESOURCE STATUS UPDATE",
+ RIC_ERROR_INDICATION: "RIC ERROR INDICATION",
+ DC_ADM_INT_CONTROL: "DC ADMISSION INTERVAL CONTROL",
+ DC_ADM_INT_CONTROL_ACK: "DC ADMISSION INTERVAL CONTROL ACK",
}
diff --git a/pkg/xapp/xapp.go b/pkg/xapp/xapp.go
index 1fd7ad6..69d2964 100755
--- a/pkg/xapp/xapp.go
+++ b/pkg/xapp/xapp.go
@@ -31,6 +31,7 @@
// XApp is an application instance
Rmr *RMRClient
Sdl *SDLClient
+ UeNib *UENIBClient
Rnib *RNIBClient
Resource *Router
Metric *Metrics
@@ -55,6 +56,7 @@
Config = Configurator{}
Metric = NewMetrics(viper.GetString("metrics.url"), viper.GetString("metrics.namespace"), Resource.router)
Rmr = NewRMRClient()
+ UeNib = NewUENIBClient()
if viper.IsSet("db.namespaces") {
namespaces := viper.GetStringSlice("db.namespaces")
diff --git a/pkg/xapp/xapp_test.go b/pkg/xapp/xapp_test.go
index 06345af..84a910f 100755
--- a/pkg/xapp/xapp_test.go
+++ b/pkg/xapp/xapp_test.go
@@ -32,7 +32,7 @@
type Consumer struct {
}
-func (m Consumer) Consume(mtype, sid, len int, payload []byte) (err error) {
+func (m Consumer) Consume(mtype, sid int, payload []byte, meid *RMRMeid) (err error) {
Sdl.Store("myKey", payload)
return nil
}
@@ -100,7 +100,7 @@
func TestMessagesReceivedSuccessfully(t *testing.T) {
for i := 0; i < 100; i++ {
- Rmr.Send(10004, 1111, 100, []byte{1, 2, 3, 4, 5, 6})
+ Rmr.Send(10004, 1111, []byte{1, 2, 3, 4, 5, 6}, &RMRMeid{PlmnID: "1234", EnbID: "7788"})
}
// Allow time to process the messages
@@ -132,16 +132,6 @@
}
}
-func TestGetgNBList(t *testing.T) {
- Rnib.Store("Kiikale", "Hello")
- Rnib.Store("mykey", "myval")
-
- v, _ := Rnib.GetgNBList()
- if v["Kiikale"] != "Hello" || v["mykey"] != "myval" {
- t.Errorf("Error: GetgNBList failed!")
- }
-}
-
func TestSubscribeChannels(t *testing.T) {
var NotificationCb = func(ch string, events ...string) {
if ch != "channel1" {
@@ -166,7 +156,7 @@
}
name := Rmr.GetRicMessageName(12010)
- if name != "RIC_SUB_REQ" {
+ if name != "RIC_SUB_REQ" {
t.Errorf("Error: GetRicMessageName failed: name=%s", name)
}
}
@@ -178,14 +168,13 @@
}
name := Rmr.GetRicMessageName(123456)
- if name != "" {
+ if name != "" {
t.Errorf("Error: GetRicMessageName returned invalid value: name=%s", name)
}
}
func TestTeardown(t *testing.T) {
Sdl.Clear()
- Rnib.Clear()
}
// Helper functions
@@ -209,4 +198,4 @@
response := executeRequest(req)
return response.Body.String()
-}
\ No newline at end of file
+}