- NodeType: entities.Node_GNB,
- Configuration: &entities.NodebInfo_Gnb{Gnb: &entities.Gnb{}},
- GlobalNbId: &entities.GlobalNbId{
- PlmnId: request.GetPlmnId(),
- NbId: request.GetNbId(),
- },
- }
- nodebInfo.GetGnb().RanFunctions, err = request.ExtractRanFunctionsList()
- return nodebInfo, err
+ GlobalNbId: h.buildGlobalNbId(request),
+ SetupFromNetwork: true,
+ }
+ err := h.setNodeTypeAndConfiguration(nodebInfo)
+ if err != nil {
+ return nil, err
+ }
+
+ if nodebInfo.NodeType == entities.Node_ENB {
+ return nodebInfo, nil
+ }
+
+ 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
+ }
+ }
+
+ return e2managererrors.NewUnknownSetupRequestRanNameError(nodebInfo.RanName)
+}
+
+func (h *E2SetupRequestNotificationHandler) buildGlobalNbId(setupRequest *models.E2SetupRequestMessage) *entities.GlobalNbId {
+ return &entities.GlobalNbId{
+ PlmnId: setupRequest.GetPlmnId(),
+ NbId: setupRequest.GetNbId(),
+ }