+ h, readerMock, rmrMessengerMock := initX2ResetResponseHandlerTest(t)
+ var payload []byte
+ _, err := fmt.Sscanf(SuccessfulX2ResetResponsePackedPdu, "%x", &payload)
+ if err != nil {
+ t.Fatalf("Failed converting packed pdu. Error: %v\n", err)
+ }
+
+ xaction := []byte(RanName)
+ notificationRequest := models.NotificationRequest{RanName: RanName, Len: len(payload), Payload: payload, StartTime: time.Now(), TransactionId: string(xaction)}
+ nb := &entities.NodebInfo{RanName: RanName, ConnectionStatus: entities.ConnectionStatus_CONNECTED, NodeType: entities.Node_ENB}
+ var rnibErr error
+ readerMock.On("GetNodeb", RanName).Return(nb, rnibErr)
+ ranRestartedMbuf := getRanRestartedMbuf(nb.NodeType, enums.RIC_TO_RAN)
+ rmrMessengerMock.On("SendMsg", ranRestartedMbuf).Return(&rmrCgo.MBuf{}, err)
+ h.Handle(¬ificationRequest)
+ rmrMessengerMock.AssertCalled(t, "SendMsg", ranRestartedMbuf)
+}
+
+func TestX2ResetResponseSuccessEmptyIEs(t *testing.T) {
+ h, readerMock, rmrMessengerMock := initX2ResetResponseHandlerTest(t)
+ var payload []byte
+ _, err := fmt.Sscanf(SuccessfulX2ResetResponsePackedPduEmptyIEs, "%x", &payload)
+ if err != nil {
+ t.Fatalf("Failed converting packed pdu. Error: %v\n", err)
+ }
+
+ xaction := []byte(RanName)
+ notificationRequest := models.NotificationRequest{RanName: RanName, Len: len(payload), Payload: payload, StartTime: time.Now(), TransactionId: string(xaction)}
+ nb := &entities.NodebInfo{RanName: RanName, ConnectionStatus: entities.ConnectionStatus_CONNECTED, NodeType: entities.Node_ENB}
+ var rnibErr error
+ readerMock.On("GetNodeb", RanName).Return(nb, rnibErr)
+ ranRestartedMbuf := getRanRestartedMbuf(nb.NodeType, enums.RIC_TO_RAN)
+ rmrMessengerMock.On("SendMsg", ranRestartedMbuf).Return(&rmrCgo.MBuf{}, err)
+ h.Handle(¬ificationRequest)
+ rmrMessengerMock.AssertCalled(t, "SendMsg", ranRestartedMbuf)
+}