RICPLT-2707 - Create RNIB reader in C 56/2156/1
authorIrina <ib565x@intl.att.com>
Mon, 6 Jan 2020 13:07:15 +0000 (15:07 +0200)
committerIrina <ib565x@intl.att.com>
Mon, 6 Jan 2020 13:07:29 +0000 (15:07 +0200)
Change-Id: Ie3b336d24bfa77247fe19962c5bd2a1ee80582d9
Signed-off-by: Irina <ib565x@intl.att.com>
creader/rNibReader_c.go

index 3ab4d49..6952a4b 100644 (file)
@@ -3,6 +3,7 @@ package main
 import (
        "encoding/json"
        "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common"
+       "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities"
        "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader"
        "gerrit.o-ran-sc.org/r/ric-plt/sdlgo"
        "unsafe"
@@ -15,8 +16,8 @@ var sdl common.ISdlInstance
 var instance reader.RNibReader
 
 type response struct {
-       GnbList  []string `json:"gnb_list"`
-       ErrorMsg string   `json:"error_msg,omitempty"`
+       GnbList  []*entities.NbIdentity `json:"gnb_list"`
+       ErrorMsg string                 `json:"error_msg,omitempty"`
 }
 
 //export open
@@ -33,9 +34,7 @@ func close() {
 //export getListGnbIds
 func getListGnbIds() unsafe.Pointer {
        listGnbIds, err := instance.GetListGnbIds()
-       res := &response{
-               GnbList: []string{},
-       }
+       res := &response{}
 
        if err != nil {
                res.ErrorMsg = err.Error()
@@ -43,8 +42,8 @@ func getListGnbIds() unsafe.Pointer {
                return createCBytesResponse(res)
        }
 
-       for _, value := range listGnbIds {
-               res.GnbList = append(res.GnbList, value.InventoryName)
+       if listGnbIds != nil {
+               res.GnbList = listGnbIds
        }
 
        return createCBytesResponse(res)
@@ -59,6 +58,4 @@ func createCBytesResponse(res *response) unsafe.Pointer {
        return C.CBytes(byteResponse)
 }
 
-func main() {
-
-}
+func main() {}