From 718326d71c35bf7af233e8e3e32630bc55c60610 Mon Sep 17 00:00:00 2001 From: is005q Date: Mon, 25 Nov 2019 17:12:17 +0200 Subject: [PATCH] [RICPLT-2585] Update NodebInfo proto | GetE2TInstance | GetE2TInfoList Change-Id: Ie4123d4fefacbd6075a2f0cc3b86a86a71765591 Signed-off-by: is005q --- common/utils.go | 9 ++++ entities/e2t_instance.go | 18 +++++++ entities/e2t_instance_info.go | 12 +++++ entities/e2t_instance_state.go | 8 ++++ entities/go.mod | 2 +- entities/go.sum | 2 + entities/nodeb_info.pb.go | 103 +++++++++++++++++++++++------------------ entities/nodeb_info.proto | 1 + reader/go.mod | 6 +-- reader/go.sum | 2 + reader/rNibReader.go | 47 +++++++++++++++++++ 11 files changed, 160 insertions(+), 50 deletions(-) create mode 100644 entities/e2t_instance.go create mode 100644 entities/e2t_instance_info.go create mode 100644 entities/e2t_instance_state.go diff --git a/common/utils.go b/common/utils.go index baf5d23..e14dcb0 100644 --- a/common/utils.go +++ b/common/utils.go @@ -84,3 +84,12 @@ func ValidateAndBuildRanLoadInformationKey(inventoryName string) (string, error) return fmt.Sprintf("LOAD:%s", inventoryName), nil } + +func ValidateAndBuildE2TInstanceKey(address string) (string, error) { + + if address == "" { + return "", NewValidationError("#utils.ValidateAndBuildRanLoadInformationKey - an empty inventory name received") + } + + return fmt.Sprintf("E2TInstance:%s", address), nil +} \ No newline at end of file diff --git a/entities/e2t_instance.go b/entities/e2t_instance.go new file mode 100644 index 0000000..28e5531 --- /dev/null +++ b/entities/e2t_instance.go @@ -0,0 +1,18 @@ +package entities + +import "time" + +type E2TInstance struct { + Address string `json:"address"` + AssociatedRanList []string `json:"associatedRanList"` + KeepAliveTimestamp int64 `json:"keepAliveTimestamp"` + State E2TInstanceState `json:"state"` +} + +func NewE2TInstance(address string) *E2TInstance { + return &E2TInstance{ + Address: address, + KeepAliveTimestamp:time.Now().UnixNano(), + State: Active, + } +} \ No newline at end of file diff --git a/entities/e2t_instance_info.go b/entities/e2t_instance_info.go new file mode 100644 index 0000000..c03d8b5 --- /dev/null +++ b/entities/e2t_instance_info.go @@ -0,0 +1,12 @@ +package entities + +type E2TInstanceInfo struct { + Address string `json:"address"` + AssociatedRanCount int `json:"associatedRanCount"` +} + +func NewE2TInstanceInfo(address string) *E2TInstanceInfo { + return &E2TInstanceInfo{ + Address: address, + } +} \ No newline at end of file diff --git a/entities/e2t_instance_state.go b/entities/e2t_instance_state.go new file mode 100644 index 0000000..220a737 --- /dev/null +++ b/entities/e2t_instance_state.go @@ -0,0 +1,8 @@ +package entities + +type E2TInstanceState string + +const ( + Active E2TInstanceState = "ACTIVE" + ToBeDeleted E2TInstanceState = "TO_BE_DELETED" +) diff --git a/entities/go.mod b/entities/go.mod index b7633da..b0518a7 100644 --- a/entities/go.mod +++ b/entities/go.mod @@ -2,4 +2,4 @@ module gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities go 1.12 -require github.com/golang/protobuf v1.3.1 +require github.com/golang/protobuf v1.3.2 diff --git a/entities/go.sum b/entities/go.sum index 04e9e7c..92819f0 100644 --- a/entities/go.sum +++ b/entities/go.sum @@ -1,6 +1,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/entities/nodeb_info.pb.go b/entities/nodeb_info.pb.go index 0bf1fa6..0933fb1 100644 --- a/entities/nodeb_info.pb.go +++ b/entities/nodeb_info.pb.go @@ -172,12 +172,13 @@ type NodebInfo struct { // Types that are valid to be assigned to Configuration: // *NodebInfo_Enb // *NodebInfo_Gnb - Configuration isNodebInfo_Configuration `protobuf_oneof:"configuration"` - FailureType Failure_Type `protobuf:"varint,11,opt,name=failure_type,json=failureType,proto3,enum=entities.Failure_Type" json:"failure_type,omitempty"` - SetupFailure *SetupFailure `protobuf:"bytes,12,opt,name=setup_failure,json=setupFailure,proto3" json:"setup_failure,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Configuration isNodebInfo_Configuration `protobuf_oneof:"configuration"` + FailureType Failure_Type `protobuf:"varint,11,opt,name=failure_type,json=failureType,proto3,enum=entities.Failure_Type" json:"failure_type,omitempty"` + SetupFailure *SetupFailure `protobuf:"bytes,12,opt,name=setup_failure,json=setupFailure,proto3" json:"setup_failure,omitempty"` + AssociatedE2TInstanceAddress string `protobuf:"bytes,13,opt,name=associated_e2t_instance_address,json=associatedE2tInstanceAddress,proto3" json:"associated_e2t_instance_address,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *NodebInfo) Reset() { *m = NodebInfo{} } @@ -312,6 +313,13 @@ func (m *NodebInfo) GetSetupFailure() *SetupFailure { return nil } +func (m *NodebInfo) GetAssociatedE2TInstanceAddress() string { + if m != nil { + return m.AssociatedE2TInstanceAddress + } + return "" +} + // XXX_OneofWrappers is for the internal use of the proto package. func (*NodebInfo) XXX_OneofWrappers() []interface{} { return []interface{}{ @@ -395,44 +403,47 @@ func init() { func init() { proto.RegisterFile("nodeb_info.proto", fileDescriptor_04b920976079e56c) } var fileDescriptor_04b920976079e56c = []byte{ - // 623 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x53, 0xef, 0x6e, 0xda, 0x3e, - 0x14, 0x25, 0x81, 0x16, 0x72, 0x81, 0xfe, 0x5c, 0xf7, 0xcf, 0x2f, 0x45, 0x9a, 0xca, 0x98, 0x26, - 0xa1, 0x4a, 0x63, 0x53, 0x26, 0x4d, 0x9a, 0xf6, 0x89, 0x42, 0x4a, 0xa3, 0x55, 0x86, 0x25, 0x41, - 0xdd, 0x3e, 0x59, 0x09, 0x35, 0x28, 0x12, 0x38, 0x51, 0x62, 0xa4, 0xf5, 0x6d, 0xf6, 0x54, 0x7b, - 0x9e, 0xc9, 0x26, 0x10, 0xc6, 0xfa, 0xed, 0xfa, 0x9c, 0x73, 0xcf, 0xc9, 0xbd, 0x76, 0x00, 0xf1, - 0xf8, 0x89, 0x85, 0x34, 0xe2, 0xf3, 0xb8, 0x97, 0xa4, 0xb1, 0x88, 0x71, 0x8d, 0x71, 0x11, 0x89, - 0x88, 0x65, 0x2d, 0x63, 0xc1, 0xc3, 0x0d, 0xd8, 0x32, 0xd8, 0xae, 0xbc, 0xfe, 0x69, 0xd1, 0x8c, - 0x89, 0x75, 0x42, 0xe7, 0x41, 0xb4, 0x5c, 0xa7, 0x8c, 0xa6, 0x2c, 0x4b, 0x62, 0x9e, 0xb1, 0x5c, - 0x70, 0xca, 0x43, 0x1a, 0x3d, 0x29, 0x97, 0xe7, 0x0d, 0xd4, 0xf9, 0x5d, 0x01, 0x83, 0xc8, 0x20, - 0x87, 0xcf, 0x63, 0x7c, 0x05, 0xb5, 0x34, 0xe0, 0x94, 0x07, 0x2b, 0x66, 0x6a, 0x6d, 0xad, 0x6b, - 0xb8, 0xd5, 0x34, 0xe0, 0x24, 0x58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0xe6, 0x97, 0x06, 0xe8, 0xf0, 0x11, 0xe2, 0x57, 0x70, 0xb5, 0x8d, 0x1a, 0x8c, 0x09, - 0xb1, 0x07, 0x2a, 0xc6, 0xf3, 0xfb, 0xfe, 0xd4, 0x43, 0x25, 0xdc, 0x04, 0x23, 0x87, 0xed, 0x21, - 0xd2, 0xe4, 0xd0, 0x43, 0xc7, 0x2b, 0x10, 0x1d, 0xb7, 0xe0, 0x72, 0x77, 0xdc, 0x1b, 0xd0, 0x1e, - 0xa2, 0x32, 0x3e, 0x01, 0xd8, 0x7a, 0x92, 0x11, 0xaa, 0xe0, 0x53, 0x68, 0x7a, 0xf7, 0x53, 0x5f, - 0x9e, 0xe8, 0x50, 0xae, 0xfa, 0x48, 0xfa, 0x4b, 0x68, 0x73, 0x3c, 0x0e, 0x8f, 0xd5, 0x1f, 0xf9, - 0xf1, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x92, 0xa2, 0xb1, 0x67, 0x5e, 0x04, 0x00, 0x00, + // 662 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x53, 0xef, 0x8b, 0xda, 0x4a, + 0x14, 0x35, 0xea, 0xae, 0x7a, 0xd5, 0x7d, 0xd9, 0xd9, 0x1f, 0x2f, 0x2b, 0xef, 0xa1, 0xb5, 0x14, + 0x64, 0xa1, 0xb6, 0xa4, 0x50, 0x28, 0xfd, 0xe4, 0xea, 0xac, 0x1b, 0xba, 0x44, 0x9b, 0x44, 0xb6, + 0xfd, 0x34, 0x4c, 0xe2, 0x28, 0x01, 0x9d, 0x84, 0x64, 0x84, 0xee, 0x1f, 0x53, 0xe8, 0x9f, 0x5a, + 0x66, 0x8c, 0xc6, 0xda, 0xfd, 0x76, 0xe7, 0x9c, 0x33, 0xe7, 0xcc, 0xbd, 0xb9, 0x01, 0x9d, 0x47, + 0x73, 0xe6, 0x93, 0x90, 0x2f, 0xa2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 0x79, 0x22, 0x23, 0x39, 0xea, 0x13, 0xe9, 0x2f, 0xa1, + 0xed, 0xf1, 0xd4, 0x3f, 0x55, 0x3f, 0xf6, 0x87, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xa4, 0x8a, + 0x3b, 0x82, 0xa5, 0x04, 0x00, 0x00, } diff --git a/entities/nodeb_info.proto b/entities/nodeb_info.proto index c8676aa..a6f2ab1 100644 --- a/entities/nodeb_info.proto +++ b/entities/nodeb_info.proto @@ -37,6 +37,7 @@ message NodebInfo { } Failure.Type failure_type = 11; SetupFailure setup_failure = 12; + string associated_e2t_instance_address = 13; } enum E2ApplicationProtocol { diff --git a/reader/go.mod b/reader/go.mod index 50004a6..7f92eac 100644 --- a/reader/go.mod +++ b/reader/go.mod @@ -3,10 +3,10 @@ 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.23 - gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.0.23 + gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.0.25 + gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.0.25 gerrit.o-ran-sc.org/r/ric-plt/sdlgo v0.5.0 - github.com/golang/protobuf v1.3.1 + github.com/golang/protobuf v1.3.2 github.com/pkg/errors v0.8.1 github.com/stretchr/testify v1.3.0 ) diff --git a/reader/go.sum b/reader/go.sum index ed70528..3df6c8d 100644 --- a/reader/go.sum +++ b/reader/go.sum @@ -15,6 +15,8 @@ github.com/go-redis/redis v6.15.3+incompatible/go.mod h1:W2YCLaZryXHirdd9QqwkiVU github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= diff --git a/reader/rNibReader.go b/reader/rNibReader.go index 0d1d80f..8abaf81 100644 --- a/reader/rNibReader.go +++ b/reader/rNibReader.go @@ -17,12 +17,15 @@ package reader 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" "github.com/golang/protobuf/proto" "reflect" ) +const E2TInfoListKey = "E2TInfoList" + type rNibReaderInstance struct { sdl common.ISdlInstance } @@ -51,6 +54,11 @@ type RNibReader interface { GetListNodebIds() ([]*entities.NbIdentity, error) // GetRanLoadInformation retrieves nodeb load information entity from redis DB by nodeb inventory name GetRanLoadInformation(inventoryName string) (*entities.RanLoadInformation, error) + + GetE2TInstance(address string) (*entities.E2TInstance, error) + + GetE2TInfoList() ([]*entities.E2TInstanceInfo, error) + } /* @@ -187,6 +195,45 @@ func (w *rNibReaderInstance) GetRanLoadInformation(inventoryName string) (*entit return loadInfo, err } +func (w *rNibReaderInstance) GetE2TInstance(address string) (*entities.E2TInstance, error) { + key, rNibErr := common.ValidateAndBuildE2TInstanceKey(address) + if rNibErr != nil { + return nil, rNibErr + } + e2tInstance := &entities.E2TInstance{} + err := w.getByKeyAndUnmarshalJson(key, e2tInstance) + if err != nil { + return nil, err + } + return e2tInstance, err +} + +func (w *rNibReaderInstance) GetE2TInfoList() ([]*entities.E2TInstanceInfo, error) { + e2tInfoList := []*entities.E2TInstanceInfo{} + err := w.getByKeyAndUnmarshalJson(E2TInfoListKey, &e2tInfoList) + if err != nil { + return nil, err + } + return e2tInfoList, err +} + +func (w *rNibReaderInstance) getByKeyAndUnmarshalJson(key string, entity interface{}) error { + data, err := w.sdl.Get([]string{key}) + + if err != nil { + return common.NewInternalError(err) + } + + if data != nil && data[key] != nil { + err = json.Unmarshal([]byte(data[key].(string)), entity) + if err != nil { + return common.NewInternalError(err) + } + return nil + } + return common.NewResourceNotFoundErrorf("#rNibReader.getByKeyAndUnmarshalJson - entity of type %s not found. Key: %s", reflect.TypeOf(entity).String(), key) +} + func (w *rNibReaderInstance) getByKeyAndUnmarshal(key string, entity proto.Message) error { data, err := w.sdl.Get([]string{key}) if err != nil { -- 2.16.6