+ 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
+
+ if nodebInfo.NodeType == entities.Node_GNB {
+ h.logger.Debugf("#E2SetupRequestNotificationHandler buildNodebInfo - entities.Node_GNB %d", entities.Node_GNB)
+
+ gnbNodetype := h.setGnbNodeType(request)
+ h.logger.Debugf("#E2SetupRequestNotificationHandler buildNodebInfo -gnbNodetype %s", gnbNodetype)
+ nodebInfo.GnbNodeType = gnbNodetype
+ nodebInfo.CuUpId = request.GetCuupId()
+ nodebInfo.DuId = request.GetDuId()
+ h.logger.Debugf("#E2SetupRequestNotificationHandler buildNodebInfo -cuupid%s", request.GetCuupId())
+ h.logger.Debugf("#E2SetupRequestNotificationHandler buildNodebInfo -duid %s", request.GetDuId())
+ }
+
+ ranFuncs := request.ExtractRanFunctionsList()
+
+ if ranFuncs != nil {
+ nodebInfo.GetGnb().RanFunctions = ranFuncs
+ }
+
+ return nodebInfo, nil
+}
+
+
+func (h *E2SetupRequestNotificationHandler) setGnbNodeType(setupRequest *models.E2SetupRequestMessage) string {
+ gnbNodetype := "gNB"
+ /*Note: Deployment where CU-UP and DU are combined
+ (but do not include the CP-CP) and have a single E2 connection
+ is not supported. The combination of CU-CP, CU-UP, and DU will be
+ treated as a single gNB and expect it to have only the
+ global gNB ID in its E2 Setup ID*/
+ if setupRequest.GetCuupId() != "" && setupRequest.GetDuId() != "" {
+ gnbNodetype = "gNB"
+ } else if setupRequest.GetCuupId() != "" {
+ gnbNodetype = "gNB_CU_UP"
+ } else if setupRequest.GetDuId() != "" {
+ gnbNodetype = "gNB_DU"
+ }
+ return gnbNodetype
+}
+
+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
+ }