- NodeType: entities.Node_GNB,
- Configuration: &entities.NodebInfo_Gnb{Gnb: &entities.Gnb{}},
- GlobalNbId: h.buildGlobalNbId(request),
+ GlobalNbId: h.buildGlobalNbId(request),
+ SetupFromNetwork: true,
+ }
+ err := h.setNodeTypeAndConfiguration(nodebInfo)
+ if err != nil {
+ return nil, err
+ }
+
+ e2NodeConfig := request.ExtractE2NodeConfigList()
+ if e2NodeConfig == nil {
+ return nil, errors.New("Empty E2nodeComponentConfigAddition-List")
+ }
+
+ if nodebInfo.NodeType == entities.Node_ENB {
+ if len(e2NodeConfig) == 0 && len(nodebInfo.GetEnb().GetNodeConfigs()) == 0 {
+ return nil, errors.New("Empty E2nodeComponentConfigAddition-List")
+ }
+ nodebInfo.GetEnb().NodeConfigs = e2NodeConfig
+
+ return nodebInfo, nil
+ }
+
+ if len(e2NodeConfig) == 0 && len(nodebInfo.GetGnb().GetNodeConfigs()) == 0 {
+ return nil, errors.New("Empty E2nodeComponentConfigAddition-List")
+ }
+ nodebInfo.GetGnb().NodeConfigs = e2NodeConfig
+
+ ranFuncs := request.ExtractRanFunctionsList()
+
+ if ranFuncs != nil {
+ nodebInfo.GetGnb().RanFunctions = ranFuncs
+ }
+
+ return nodebInfo, nil
+}
+
+func (h *E2SetupRequestNotificationHandler) setNodeTypeAndConfiguration(nodebInfo *entities.NodebInfo) error {
+ for k, v := range gnbTypesMap {
+ if strings.HasPrefix(nodebInfo.RanName, k) {
+ nodebInfo.NodeType = entities.Node_GNB
+ nodebInfo.Configuration = &entities.NodebInfo_Gnb{Gnb: &entities.Gnb{GnbType: v}}
+ return nil
+ }
+ }
+ for k, v := range enbTypesMap {
+ if strings.HasPrefix(nodebInfo.RanName, k) {
+ nodebInfo.NodeType = entities.Node_ENB
+ nodebInfo.Configuration = &entities.NodebInfo_Enb{Enb: &entities.Enb{EnbType: v}}
+ return nil
+ }