logger *logger.Logger
nodebValidator *managers.NodebValidator
rNibDataService services.RNibDataService
+ ranListManager managers.RanListManager
}
-func NewAddEnbRequestHandler(logger *logger.Logger, rNibDataService services.RNibDataService, nodebValidator *managers.NodebValidator) *AddEnbRequestHandler {
+func NewAddEnbRequestHandler(logger *logger.Logger, rNibDataService services.RNibDataService, nodebValidator *managers.NodebValidator, ranListManager managers.RanListManager) *AddEnbRequestHandler {
return &AddEnbRequestHandler{
logger: logger,
nodebValidator: nodebValidator,
rNibDataService: rNibDataService,
+ ranListManager: ranListManager,
}
}
return nil, e2managererrors.NewRnibDbError()
}
- nbIdentity := h.createNbIdentity(addEnbRequest)
nodebInfo := h.createNodebInfo(addEnbRequest)
-
- err = h.rNibDataService.SaveNodeb(nbIdentity, nodebInfo)
+ err = h.rNibDataService.SaveNodeb(nodebInfo)
if err != nil {
h.logger.Errorf("#AddEnbRequestHandler.Handle - RAN name: %s - failed to save nodeb entity in RNIB. Error: %s", addEnbRequest.RanName, err)
return nil, e2managererrors.NewRnibDbError()
}
- return models.NewAddEnbResponse(nodebInfo), nil
+ nbIdentity := h.createNbIdentity(addEnbRequest)
+ err = h.ranListManager.AddNbIdentity(entities.Node_ENB, nbIdentity)
+
+ if err != nil {
+ return nil, e2managererrors.NewRnibDbError()
+ }
+
+ return models.NewNodebResponse(nodebInfo), nil
}
func (h *AddEnbRequestHandler) createNodebInfo(addEnbRequest *models.AddEnbRequest) *entities.NodebInfo {
Port: addEnbRequest.Port,
GlobalNbId: addEnbRequest.GlobalNbId,
Configuration: &entities.NodebInfo_Enb{Enb: addEnbRequest.Enb},
+ NodeType: entities.Node_ENB,
ConnectionStatus: entities.ConnectionStatus_DISCONNECTED,
}
}
func (h *AddEnbRequestHandler) createNbIdentity(addEnbRequest *models.AddEnbRequest) *entities.NbIdentity {
- nbIdentity := entities.NbIdentity{
- GlobalNbId: addEnbRequest.GlobalNbId,
- InventoryName: addEnbRequest.RanName,
+ return &entities.NbIdentity{
+ GlobalNbId: addEnbRequest.GlobalNbId,
+ InventoryName: addEnbRequest.RanName,
+ ConnectionStatus: entities.ConnectionStatus_DISCONNECTED,
}
-
- return &nbIdentity
}
func (h *AddEnbRequestHandler) validateRequestBody(addEnbRequest *models.AddEnbRequest) error {