2 // Copyright 2019 AT&T Intellectual Property
3 // Copyright 2019 Nokia
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
17 // This source code is part of the near-RT RIC (RAN Intelligent Controller)
18 // platform project (RICP).
20 package rmrmsghandlers
33 "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common"
34 "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities"
35 "github.com/stretchr/testify/assert"
36 "github.com/stretchr/testify/mock"
45 prefix = "10.0.2.15:9999|"
46 logFilePath = "./loggerTest.txt"
47 e2tInstanceAddress = "10.0.2.15"
48 nodebRanName = "gnb:310-410-b5c67788"
51 func TestParseSetupRequest_Success(t *testing.T){
52 path, err :=filepath.Abs("../../tests/resources/setupRequest_gnb.xml")
56 xmlGnb, err := ioutil.ReadFile(path)
60 handler := stubMockSuccessFlowNewNodeb(t)
61 prefBytes := []byte(prefix)
62 request, _, err := handler.parseSetupRequest(append(prefBytes, xmlGnb...))
63 assert.Equal(t, request.GetPlmnId(), "131014")
64 assert.Equal(t, request.GetNbId(), "10110101110001100111011110001000")
67 func TestParseSetupRequest_ColonFailure(t *testing.T){
68 path, err :=filepath.Abs("../../tests/resources/setupRequest_gnb.xml")
72 xmlGnb, err := ioutil.ReadFile(path)
76 handler := stubMockSuccessFlowNewNodeb(t)
77 prefBytes := []byte("10.0.2.15;9999|")
78 request, _, err := handler.parseSetupRequest(append(prefBytes, xmlGnb...))
79 assert.Nil(t, request)
81 assert.EqualError(t, err, "#E2SetupRequestNotificationHandler.parseSetupRequest - Error parsing E2 Setup Request, failed extract E2T IP Address: no ':' separator found")
84 func TestParseSetupRequest_PipFailure(t *testing.T){
85 path, err :=filepath.Abs("../../tests/resources/setupRequest_gnb.xml")
89 xmlGnb, err := ioutil.ReadFile(path)
93 handler := stubMockSuccessFlowNewNodeb(t)
94 prefBytes := []byte("10.0.2.15:9999")
95 request, _, err := handler.parseSetupRequest(append(prefBytes, xmlGnb...))
96 assert.Nil(t, request)
98 assert.EqualError(t, err, "#E2SetupRequestNotificationHandler.parseSetupRequest - Error parsing E2 Setup Request failed extract Payload: no | separator found")
101 func TestParseSetupRequest_UnmarshalFailure(t *testing.T){
102 handler := stubMockSuccessFlowNewNodeb(t)
103 prefBytes := []byte(prefix)
104 request, _, err := handler.parseSetupRequest(append(prefBytes, 1,2,3))
105 assert.Nil(t, request)
106 assert.NotNil(t, err)
107 assert.EqualError(t, err, "#E2SetupRequestNotificationHandler.parseSetupRequest - Error unmarshalling E2 Setup Request payload: 31302e302e322e31353a393939397c010203")
110 func TestE2SetupRequestNotificationHandler_HandleNewGnbSuccess(t *testing.T) {
111 path, err :=filepath.Abs("../../tests/resources/setupRequest_gnb.xml")
115 xmlGnb, err := ioutil.ReadFile(path)
120 logFile, err := os.Create(logFilePath)
122 t.Errorf("e2_setup_request_notification_handler_test.TestE2SetupRequestNotificationHandler_HandleNewGnbSuccess - failed to create file, error: %s", err)
124 oldStdout := os.Stdout
125 defer changeStdout(oldStdout)
126 defer removeLogFile(t)
129 handler := stubMockSuccessFlowNewNodeb(t)
130 prefBytes := []byte(prefix)
131 notificationRequest := &models.NotificationRequest{RanName: nodebRanName, Payload: append(prefBytes, xmlGnb...)}
132 handler.Handle(notificationRequest)
133 assertSuccessFlowNewNodebLogs(t)
136 func TestE2SetupRequestNotificationHandler_HandleNewEnGnbSuccess(t *testing.T) {
137 path, err :=filepath.Abs("../../tests/resources/setupRequest_en-gNB.xml")
141 xmlEnGnb, err := ioutil.ReadFile(path)
145 logFile, err := os.Create(logFilePath)
147 t.Errorf("e2_setup_request_notification_handler_test.TestE2SetupRequestNotificationHandler_HandleNewEnGnbSuccess - failed to create file, error: %s", err)
149 oldStdout := os.Stdout
150 defer changeStdout(oldStdout)
151 defer removeLogFile(t)
154 handler := stubMockSuccessFlowNewNodeb(t)
155 prefBytes := []byte(prefix)
156 notificationRequest := &models.NotificationRequest{RanName: nodebRanName, Payload: append(prefBytes, xmlEnGnb...)}
157 handler.Handle(notificationRequest)
158 assertSuccessFlowNewNodebLogs(t)
161 func TestE2SetupRequestNotificationHandler_HandleNewNgEnbSuccess(t *testing.T) {
162 path, err :=filepath.Abs("../../tests/resources/setupRequest_ng-eNB.xml")
166 xmlEnGnb, err := ioutil.ReadFile(path)
170 logFile, err := os.Create(logFilePath)
172 t.Errorf("e2_setup_request_notification_handler_test.TestE2SetupRequestNotificationHandler_HandleNewNgEnbSuccess - failed to create file, error: %s", err)
174 oldStdout := os.Stdout
175 defer changeStdout(oldStdout)
176 defer removeLogFile(t)
179 handler := stubMockSuccessFlowNewNodeb(t)
180 prefBytes := []byte(prefix)
181 notificationRequest := &models.NotificationRequest{RanName: nodebRanName, Payload: append(prefBytes, xmlEnGnb...)}
182 handler.Handle(notificationRequest)
183 assertSuccessFlowNewNodebLogs(t)
186 func TestE2SetupRequestNotificationHandler_HandleExistingGnbSuccess(t *testing.T) {
187 path, err :=filepath.Abs("../../tests/resources/setupRequest_gnb.xml")
191 xmlGnb, err := ioutil.ReadFile(path)
196 logFile, err := os.Create(logFilePath)
198 t.Errorf("e2_setup_request_notification_handler_test.TestE2SetupRequestNotificationHandler_HandleNewGnbSuccess - failed to create file, error: %s", err)
200 oldStdout := os.Stdout
201 defer changeStdout(oldStdout)
202 defer removeLogFile(t)
205 handler := stubMockSuccessFlowExistingNodeb(t)
206 prefBytes := []byte(prefix)
207 notificationRequest := &models.NotificationRequest{RanName: nodebRanName, Payload: append(prefBytes, xmlGnb...)}
208 handler.Handle(notificationRequest)
209 assertSuccessFlowExistingNodebLogs(t)
212 func TestE2SetupRequestNotificationHandler_HandleParseError(t *testing.T) {
213 path, err :=filepath.Abs("../../tests/resources/setupRequest_gnb.xml")
217 xmlGnb, err := ioutil.ReadFile(path)
222 logFile, err := os.Create(logFilePath)
224 t.Errorf("e2_setup_request_notification_handler_test.TestE2SetupRequestNotificationHandler_HandleNewGnbSuccess - failed to create file, error: %s", err)
226 oldStdout := os.Stdout
227 defer changeStdout(oldStdout)
228 defer removeLogFile(t)
231 _, handler, _, _, _, _, _ := initMocks(t)
232 prefBytes := []byte("invalid_prefix")
233 notificationRequest := &models.NotificationRequest{RanName: nodebRanName, Payload: append(prefBytes, xmlGnb...)}
234 handler.Handle(notificationRequest)
235 assertParseErrorFlowLogs(t)
238 func TestE2SetupRequestNotificationHandler_HandleUnmarshalError(t *testing.T) {
239 logFile, err := os.Create(logFilePath)
241 t.Errorf("e2_setup_request_notification_handler_test.TestE2SetupRequestNotificationHandler_HandleNewGnbSuccess - failed to create file, error: %s", err)
243 oldStdout := os.Stdout
244 defer changeStdout(oldStdout)
245 defer removeLogFile(t)
248 _, handler, _, _, _, _, _ := initMocks(t)
249 prefBytes := []byte(prefix)
250 notificationRequest := &models.NotificationRequest{RanName: nodebRanName, Payload: append(prefBytes, "xmlGnb"...)}
251 handler.Handle(notificationRequest)
252 assertUnmarshalErrorFlowLogs(t)
255 func TestE2SetupRequestNotificationHandler_HandleGetE2TInstanceError(t *testing.T) {
256 path, err :=filepath.Abs("../../tests/resources/setupRequest_gnb.xml")
260 xmlGnb, err := ioutil.ReadFile(path)
265 logFile, err := os.Create(logFilePath)
267 t.Errorf("e2_setup_request_notification_handler_test.TestE2SetupRequestNotificationHandler_HandleNewGnbSuccess - failed to create file, error: %s", err)
269 oldStdout := os.Stdout
270 defer changeStdout(oldStdout)
271 defer removeLogFile(t)
274 _, handler, _, _, _, e2tInstancesManagerMock, _ := initMocks(t)
275 var e2tInstance * entities.E2TInstance
276 e2tInstancesManagerMock.On("GetE2TInstance", e2tInstanceAddress).Return(e2tInstance, common.NewResourceNotFoundError("Not found"))
277 prefBytes := []byte(prefix)
278 notificationRequest := &models.NotificationRequest{RanName: nodebRanName, Payload: append(prefBytes, xmlGnb...)}
279 handler.Handle(notificationRequest)
280 assertGetE2TInstanceErrorLogs(t)
283 func TestE2SetupRequestNotificationHandler_HandleGetNodebError(t *testing.T) {
284 path, err :=filepath.Abs("../../tests/resources/setupRequest_gnb.xml")
288 xmlGnb, err := ioutil.ReadFile(path)
293 logFile, err := os.Create(logFilePath)
295 t.Errorf("e2_setup_request_notification_handler_test.TestE2SetupRequestNotificationHandler_HandleNewGnbSuccess - failed to create file, error: %s", err)
297 oldStdout := os.Stdout
298 defer changeStdout(oldStdout)
299 defer removeLogFile(t)
301 _, handler, readerMock, _, _, e2tInstancesManagerMock, _ := initMocks(t)
302 var e2tInstance = &entities.E2TInstance{}
303 e2tInstancesManagerMock.On("GetE2TInstance", e2tInstanceAddress).Return(e2tInstance, nil)
304 var gnb *entities.NodebInfo
305 readerMock.On("GetNodeb", mock.Anything).Return(gnb, common.NewInternalError(errors.New("Some error")))
306 prefBytes := []byte(prefix)
307 notificationRequest := &models.NotificationRequest{RanName: nodebRanName, Payload: append(prefBytes, xmlGnb...)}
308 handler.Handle(notificationRequest)
309 assertGetNodebErrorLogs(t)
312 func TestE2SetupRequestNotificationHandler_HandleAssociationError(t *testing.T) {
313 path, err :=filepath.Abs("../../tests/resources/setupRequest_gnb.xml")
317 xmlGnb, err := ioutil.ReadFile(path)
322 logFile, err := os.Create(logFilePath)
324 t.Errorf("e2_setup_request_notification_handler_test.TestE2SetupRequestNotificationHandler_HandleNewGnbSuccess - failed to create file, error: %s", err)
326 oldStdout := os.Stdout
327 defer changeStdout(oldStdout)
328 defer removeLogFile(t)
331 _, handler, readerMock, writerMock, _, e2tInstancesManagerMock, routingManagerClientMock := initMocks(t)
332 var e2tInstance = &entities.E2TInstance{}
333 e2tInstancesManagerMock.On("GetE2TInstance", e2tInstanceAddress).Return(e2tInstance, nil)
334 var gnb *entities.NodebInfo
335 readerMock.On("GetNodeb", mock.Anything).Return(gnb, common.NewResourceNotFoundError("Not found"))
336 writerMock.On("SaveNodeb", mock.Anything, mock.Anything).Return(nil)
337 routingManagerClientMock.On("AssociateRanToE2TInstance", e2tInstanceAddress, mock.Anything).Return(errors.New("association error"))
339 prefBytes := []byte(prefix)
340 notificationRequest := &models.NotificationRequest{RanName: nodebRanName, Payload: append(prefBytes, xmlGnb...)}
341 handler.Handle(notificationRequest)
342 assertAssociationErrorLogs(t)
345 func TestE2SetupRequestNotificationHandler_HandleExistingGnbInvalidStatusError(t *testing.T) {
346 path, err :=filepath.Abs("../../tests/resources/setupRequest_gnb.xml")
350 xmlGnb, err := ioutil.ReadFile(path)
355 logFile, err := os.Create(logFilePath)
357 t.Errorf("e2_setup_request_notification_handler_test.TestE2SetupRequestNotificationHandler_HandleNewGnbSuccess - failed to create file, error: %s", err)
359 oldStdout := os.Stdout
360 defer changeStdout(oldStdout)
361 defer removeLogFile(t)
364 handler := stubMockInvalidStatusFlowExistingNodeb(t)
365 prefBytes := []byte(prefix)
366 notificationRequest := &models.NotificationRequest{RanName: nodebRanName, Payload: append(prefBytes, xmlGnb...)}
367 handler.Handle(notificationRequest)
368 assertInvalidNodebStatusLogs(t)
371 func assertInvalidNodebStatusLogs(t *testing.T){
372 buf := getLogFileBuffer(t)
373 assertReceivedAndParsedLog(buf, t)
374 assertInvalidNodebStatusLog(buf, t)
375 assertNoMoreRecordsLog(buf, t)
378 func assertInvalidNodebStatusLog(buf *bytes.Buffer, t *testing.T) {
379 record, _ := buf.ReadString('\n')
380 assert.Contains(t, record, "#RnibDataService.GetNodeb")
381 assert.Contains(t, record, "connection status: SHUTTING_DOWN")
382 record, _ = buf.ReadString('\n')
383 assert.Contains(t, record, "#E2SetupRequestNotificationHandler.Handle")
384 assert.Contains(t, record, "connection status: SHUTTING_DOWN - nodeB entity in incorrect state")
385 record, _ = buf.ReadString('\n')
386 assert.Contains(t, record, "#E2SetupRequestNotificationHandler.Handle")
387 assert.Contains(t, record, "Summary: elapsed time for receiving and handling setup request message from E2 terminator")
390 func assertAssociationErrorLogs(t *testing.T){
391 buf := getLogFileBuffer(t)
392 assertReceivedAndParsedLog(buf, t)
393 assertNewNodebSavedLog(buf, t)
394 assertAssociationErrorLog(buf, t)
395 assertNoMoreRecordsLog(buf, t)
398 func assertAssociationErrorLog(buf *bytes.Buffer, t *testing.T) {
399 record, _ := buf.ReadString('\n')
400 assert.Contains(t, record, "#E2TAssociationManager.AssociateRan - Associating RAN")
401 record, _ = buf.ReadString('\n')
402 assert.Contains(t, record, "#E2TAssociationManager.AssociateRan - RoutingManager failure: Failed to associate RAN")
403 record, _ = buf.ReadString('\n')
404 assert.Contains(t, record, "#E2SetupRequestNotificationHandler.Handle - RAN name:")
405 assert.Contains(t, record, "failed to associate E2T to nodeB entity")
408 func assertGetNodebErrorLogs(t *testing.T) {
409 buf := getLogFileBuffer(t)
410 assertReceivedAndParsedLog(buf, t)
411 assertGetNodebErrorLog(buf, t)
412 assertNoMoreRecordsLog(buf, t)
415 func assertGetNodebErrorLog(buf *bytes.Buffer, t *testing.T) {
416 record, _ := buf.ReadString('\n')
417 assert.Contains(t, record, "failed to retrieve nodebInfo entity")
420 func assertGetE2TInstanceErrorLogs(t *testing.T) {
421 buf := getLogFileBuffer(t)
422 assertReceivedAndParsedLog(buf, t)
423 assertGetE2TInstanceErrorLog(buf, t)
424 assertNoMoreRecordsLog(buf, t)
427 func assertGetE2TInstanceErrorLog(buf *bytes.Buffer, t *testing.T) {
428 record, _ := buf.ReadString('\n')
429 assert.Contains(t, record, "Failed retrieving E2TInstance")
432 func removeLogFile(t *testing.T) {
433 err := os.Remove(logFilePath)
435 t.Errorf("e2_setup_request_notification_handler_test.TestE2SetupRequestNotificationHandler_HandleGnbSuccess - failed to remove file, error: %s", err)
439 func assertParseErrorFlowLogs(t *testing.T) {
440 buf := getLogFileBuffer(t)
441 assertReceivedAndFailedParseLog(buf, t)
442 assertNoMoreRecordsLog(buf, t)
445 func assertUnmarshalErrorFlowLogs(t *testing.T) {
446 buf := getLogFileBuffer(t)
447 assertReceivedAndFailedUnmarshalLog(buf, t)
448 assertNoMoreRecordsLog(buf, t)
451 func assertSuccessFlowNewNodebLogs(t *testing.T){
452 buf := getLogFileBuffer(t)
453 assertReceivedAndParsedLog(buf, t)
454 assertNewNodebSavedLog(buf, t)
455 assertAssociatedLog(buf, t)
456 assertRequestBuiltLog(buf, t)
457 assertRequestSentLog(buf, t)
458 assertNoMoreRecordsLog(buf, t)
461 func assertSuccessFlowExistingNodebLogs(t *testing.T){
462 buf := getLogFileBuffer(t)
463 assertReceivedAndParsedLog(buf, t)
464 assertExistingNodebRetrievedLog(buf, t)
465 assertAssociatedLog(buf, t)
466 assertRequestBuiltLog(buf, t)
467 assertRequestSentLog(buf, t)
468 assertNoMoreRecordsLog(buf, t)
471 func assertReceivedAndParsedLog(buf *bytes.Buffer, t *testing.T) {
472 record, _ := buf.ReadString('\n')
473 assert.Contains(t, record, "received E2 Setup Request")
474 record, _ = buf.ReadString('\n')
475 assert.Contains(t, record, "handling E2_SETUP_REQUEST")
478 func assertReceivedAndFailedParseLog(buf *bytes.Buffer, t *testing.T) {
479 record, _ := buf.ReadString('\n')
480 assert.Contains(t, record, "received E2 Setup Request")
481 record, _ = buf.ReadString('\n')
482 assert.Contains(t, record, "Error parsing E2 Setup Request")
485 func assertReceivedAndFailedUnmarshalLog(buf *bytes.Buffer, t *testing.T) {
486 record, _ := buf.ReadString('\n')
487 assert.Contains(t, record, "received E2 Setup Request")
488 record, _ = buf.ReadString('\n')
489 assert.Contains(t, record, "Error unmarshalling E2 Setup Request")
492 func assertNewNodebSavedLog(buf *bytes.Buffer, t *testing.T) {
493 record, _ := buf.ReadString('\n')
494 assert.Contains(t, record, "#RnibDataService.SaveNodeb - nbIdentity:")
497 func assertExistingNodebRetrievedLog(buf *bytes.Buffer, t *testing.T) {
498 record, _ := buf.ReadString('\n')
499 assert.Contains(t, record, "#RnibDataService.GetNodeb - RAN name:")
502 func assertAssociatedLog(buf *bytes.Buffer, t *testing.T){
503 record, _ := buf.ReadString('\n')
504 assert.Contains(t, record, "#E2TAssociationManager.AssociateRan - Associating RAN")
505 record, _ = buf.ReadString('\n')
506 assert.Contains(t, record, "#RnibDataService.UpdateNodebInfo")
507 record, _ = buf.ReadString('\n')
508 assert.Contains(t, record, "#E2TAssociationManager.AssociateRan - successfully associated RAN")
511 func assertRequestSentLog(buf *bytes.Buffer, t *testing.T) {
512 record, _ := buf.ReadString('\n')
513 assert.Contains(t, record, "uccessfully sent RMR message")
515 func assertRequestBuiltLog(buf *bytes.Buffer, t *testing.T) {
516 record, _ := buf.ReadString('\n')
517 assert.Contains(t, record, "E2 Setup Request has been built")
520 func assertNoMoreRecordsLog(buf *bytes.Buffer, t *testing.T) {
521 record, _ := buf.ReadString('\n')
522 assert.Empty(t, record)
525 func stubMockSuccessFlowNewNodeb(t *testing.T) E2SetupRequestNotificationHandler{
526 _, handler, readerMock, writerMock, rmrMessengerMock, e2tInstancesManagerMock, routingManagerClientMock := initMocks(t)
527 var e2tInstance = &entities.E2TInstance{}
528 e2tInstancesManagerMock.On("GetE2TInstance", e2tInstanceAddress).Return(e2tInstance, nil)
529 var gnb *entities.NodebInfo
530 readerMock.On("GetNodeb", mock.Anything).Return(gnb, common.NewResourceNotFoundError("Not found"))
531 writerMock.On("SaveNodeb", mock.Anything, mock.Anything).Return(nil)
532 routingManagerClientMock.On("AssociateRanToE2TInstance", e2tInstanceAddress, mock.Anything).Return(nil)
533 writerMock.On("UpdateNodebInfo", mock.Anything).Return(nil)
534 e2tInstancesManagerMock.On("AddRansToInstance", mock.Anything, mock.Anything).Return(nil)
536 rmrMessage := &rmrCgo.MBuf{}
537 rmrMessengerMock.On("SendMsg", mock.Anything, mock.Anything).Return(rmrMessage, err)
541 func stubMockSuccessFlowExistingNodeb(t *testing.T) E2SetupRequestNotificationHandler{
542 _, handler, readerMock, writerMock, rmrMessengerMock, e2tInstancesManagerMock, routingManagerClientMock := initMocks(t)
543 var e2tInstance = &entities.E2TInstance{}
544 e2tInstancesManagerMock.On("GetE2TInstance", e2tInstanceAddress).Return(e2tInstance, nil)
545 var gnb = &entities.NodebInfo{
546 RanName: nodebRanName,
547 AssociatedE2TInstanceAddress: e2tAddress,
548 ConnectionStatus: entities.ConnectionStatus_CONNECTED,
549 NodeType: entities.Node_GNB,
550 Configuration: &entities.NodebInfo_Gnb{Gnb: &entities.Gnb{}},
552 readerMock.On("GetNodeb", mock.Anything).Return(gnb, nil)
553 routingManagerClientMock.On("AssociateRanToE2TInstance", e2tInstanceAddress, mock.Anything).Return(nil)
554 writerMock.On("UpdateNodebInfo", mock.Anything).Return(nil)
555 e2tInstancesManagerMock.On("AddRansToInstance", mock.Anything, mock.Anything).Return(nil)
557 rmrMessage := &rmrCgo.MBuf{}
558 rmrMessengerMock.On("SendMsg", mock.Anything, mock.Anything).Return(rmrMessage, err)
562 func stubMockInvalidStatusFlowExistingNodeb(t *testing.T) E2SetupRequestNotificationHandler{
563 _, handler, readerMock, _, _, e2tInstancesManagerMock, _ := initMocks(t)
564 var e2tInstance = &entities.E2TInstance{}
565 e2tInstancesManagerMock.On("GetE2TInstance", e2tInstanceAddress).Return(e2tInstance, nil)
566 var gnb = &entities.NodebInfo{RanName: nodebRanName, ConnectionStatus:entities.ConnectionStatus_SHUTTING_DOWN}
567 readerMock.On("GetNodeb", mock.Anything).Return(gnb, nil)
571 func initMocks(t *testing.T) (*logger.Logger, E2SetupRequestNotificationHandler, *mocks.RnibReaderMock, *mocks.RnibWriterMock, *mocks.RmrMessengerMock, *mocks.E2TInstancesManagerMock, *mocks.RoutingManagerClientMock) {
572 logger := tests.InitLog(t)
573 config := &configuration.Configuration{RnibRetryIntervalMs: 10, MaxRnibConnectionAttempts: 3}
574 rmrMessengerMock := &mocks.RmrMessengerMock{}
575 rmrSender := tests.InitRmrSender(rmrMessengerMock, logger)
576 readerMock := &mocks.RnibReaderMock{}
577 writerMock := &mocks.RnibWriterMock{}
578 routingManagerClientMock := &mocks.RoutingManagerClientMock{}
579 rnibDataService := services.NewRnibDataService(logger, config, readerMock, writerMock)
580 e2tInstancesManagerMock := &mocks.E2TInstancesManagerMock{}
581 e2tAssociationManager := managers.NewE2TAssociationManager(logger, rnibDataService, e2tInstancesManagerMock, routingManagerClientMock)
582 handler := NewE2SetupRequestNotificationHandler(logger, config, e2tInstancesManagerMock, rmrSender, rnibDataService, e2tAssociationManager)
583 return logger, handler, readerMock, writerMock, rmrMessengerMock, e2tInstancesManagerMock, routingManagerClientMock
586 func changeStdout(old *os.File) {
590 func getLogFileBuffer(t *testing.T) *bytes.Buffer {
591 logFile, err := os.Open(logFilePath)
593 t.Errorf("e2_setup_request_notification_handler_test.assertSuccessFlowNewNodebLogRecords - failed to open file, error: %s", err)
596 _, err = io.Copy(&buf, logFile)
598 t.Errorf("e2_setup_request_notification_handler_test.assertSuccessFlowNewNodebLogRecords - failed to copy bytes, error: %s", err)