Merge "RICPLT-2707 - Create RNIB reader in C"
authorShuky Har-Noy <shuky.har-noy@intl.att.com>
Thu, 2 Jan 2020 12:12:06 +0000 (12:12 +0000)
committerGerrit Code Review <gerrit@o-ran-sc.org>
Thu, 2 Jan 2020 12:12:06 +0000 (12:12 +0000)
entities/e2t_instance.go
reader/go.mod
reader/rNibReader_test.go

index 9ba7bab..ad5723a 100644 (file)
@@ -26,6 +26,7 @@ type E2TInstance struct {
        AssociatedRanList  []string         `json:"associatedRanList"`
        KeepAliveTimestamp int64            `json:"keepAliveTimestamp"`
        State              E2TInstanceState `json:"state"`
+       DeletionTimestamp  int64                        `json:"deletionTimeStamp"`
 }
 
 func NewE2TInstance(address string) *E2TInstance {
index f4a3de2..6a0236e 100644 (file)
@@ -3,8 +3,8 @@ module gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader
 go 1.12
 
 require (
-       gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.0.27
-       gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.0.27
+       gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.0.29
+       gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.0.29
        gerrit.o-ran-sc.org/r/ric-plt/sdlgo v0.5.0
        github.com/golang/protobuf v1.3.2
        github.com/pkg/errors v0.8.1
index 66205f8..8757b53 100644 (file)
@@ -1033,6 +1033,17 @@ func TestGetE2TInstanceSuccess(t *testing.T) {
        assert.Equal(t, e2tInstance, res)
 }
 
+func TestUnmarshal(t *testing.T) {
+       e2tInstance := generateE2tInstance("10.0.2.15:5555")
+       marshaled, _ := json.Marshal(e2tInstance)
+       m := map[string]interface{}{
+               "whatever": string(marshaled),
+       }
+       var entity entities.E2TInstance
+       err := json.Unmarshal([]byte(m["whatever"].(string)), &entity)
+       assert.Nil(t, err)
+}
+
 func TestGetE2TInstanceEmptyAddressFailure(t *testing.T) {
        w, _ := initSdlInstanceMock()
        res, err := w.GetE2TInstance("")
@@ -1063,6 +1074,7 @@ func TestGetE2TInstanceSdlError(t *testing.T) {
 func generateE2tInstance(address string) *entities.E2TInstance {
        e2tInstance := entities.NewE2TInstance(address)
        e2tInstance.AssociatedRanList = []string{"test1", "test2"}
+       e2tInstance.DeletionTimestamp = time.Now().UnixNano()
        return e2tInstance
 }