export CFLAGS
OBJDIR=lib
LIB=$(OBJDIR)/libe2ap_codec.a
-LIBSRC=configuration_update_wrapper.c x2setup_request_wrapper.c x2reset_request_wrapper.c asn1codec_utils.c
+LIBSRC=configuration_update_wrapper.c x2setup_request_wrapper.c x2reset_request_wrapper.c x2reset_response_wrapper.c asn1codec_utils.c
LIBOBJ=$(addprefix $(OBJDIR)/,$(LIBSRC:.c=.o))
TESTX2SETUPREQUEST=tests/x2setup_request_wrapper_test
TESTCONFUPDATE=tests/configuration_update_wrapper_test
TESTX2RESETREQUEST=tests/x2reset_request_wrapper_test
+TESTX2RESETRESPONSE=tests/x2reset_response_wrapper_test
TESTUNPACKXER=tests/unpack_xer
.PHONY: all clean e2ap_engine
-all: $(LIB) $(TESTX2SETUPREQUEST) $(TESTCONFUPDATE) $(TESTX2RESETREQUEST) $(TESTUNPACKXER)
+all: $(LIB) $(TESTX2SETUPREQUEST) $(TESTCONFUPDATE) $(TESTX2RESETREQUEST) $(TESTUNPACKXER) $(TESTX2RESETRESPONSE)
e2ap_engine/libasncodec.a:
cd e2ap_engine/ && make -f converter-example.mk
mkdir -p $(dir $@)
$(CC) $(CFLAGS) src/$@.c -o $@ $(LIB) e2ap_engine/libasncodec.a
+$(TESTX2RESETRESPONSE): % : $(LIB) src/%.c
+ mkdir -p $(dir $@)
+ $(CC) $(CFLAGS) src/$@.c -o $@ $(LIB) e2ap_engine/libasncodec.a
+
clean:
rm -rf $(OBJDIR) tests
clobber:
--- /dev/null
+/*
+ *
+ * Copyright 2019 AT&T Intellectual Property
+ * Copyright 2019 Nokia
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+
+#include <stddef.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <asn1codec_utils.h>
+
+#ifndef INC_X2RESET_RESPONSE_WRAPPER_H
+#define INC_X2RESET_RESPONSE_WRAPPER_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+bool
+build_pack_x2reset_response(size_t* packed_buf_size, unsigned char* packed_buf,size_t err_buf_size, char* err_buf);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* INC_X2RESET_RESPONSE_WRAPPER_H */
+
--- /dev/null
+ /*
+ *
+ * Copyright 2019 AT&T Intellectual Property
+ * Copyright 2019 Nokia
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+
+ #include <stdbool.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <x2reset_response_wrapper.h>
+
+ void test_build_pack_x2reset_response();
+ void test_unpack(void);
+
+ int
+ main(int argc, char* argv[])
+ {
+ test_build_pack_x2reset_response();
+ exit(0);
+ }
+
+ void test_build_pack_x2reset_response(){
+ size_t error_buf_size = 8192;
+ size_t packed_buf_size = 4096;
+ unsigned char responseDataBuf[packed_buf_size];
+ char responseErrorBuf[error_buf_size];
+ bool result = build_pack_x2reset_response(&packed_buf_size, responseDataBuf, error_buf_size, responseErrorBuf);
+
+ if (!result) {
+ printf("#test_build_pack_x2reset_response failed. Packing error %s\n", responseErrorBuf);
+ return;
+ }
+ printf("x2reset response packed size:%lu\nPayload:\n", packed_buf_size);
+ for (size_t i = 0; i < packed_buf_size; ++i)
+ printf("%02x",responseDataBuf[i]);
+ printf("\n");
+ }
+
--- /dev/null
+/*
+ *
+ * Copyright 2019 AT&T Intellectual Property
+ * Copyright 2019 Nokia
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <string.h>
+#include <errno.h>
+#undef NDEBUG
+#include <assert.h>
+#include <asn_application.h>
+#include <E2AP-PDU.h>
+#include <ProcedureCode.h>
+#include <SuccessfulOutcome.h>
+#include <ProtocolIE-ID.h>
+#include <ProtocolIE-Field.h>
+#include <x2reset_response_wrapper.h>
+
+/*
+ * Build and pack a reset response.
+ * Abort the process on allocation failure.
+ * packed_buf_size - in: size of packed_buf; out: number of chars used.
+ */
+
+bool
+build_pack_x2reset_response(size_t* packed_buf_size, unsigned char* packed_buf,size_t err_buf_size, char* err_buf)
+{
+ bool rc = true;
+ E2AP_PDU_t *pdu = calloc(1, sizeof(E2AP_PDU_t));
+
+ ResetResponse_t *resetResponse;
+ SuccessfulOutcome_t *successfulOutcome = calloc(1, sizeof(SuccessfulOutcome_t));
+ ResetResponse_IEs_t *resetResponse_ie = calloc(1, sizeof(ResetResponse_IEs_t));
+
+ assert(pdu != 0);
+ assert(successfulOutcome != 0);
+ assert(resetResponse_ie != 0);
+
+ pdu->present = E2AP_PDU_PR_successfulOutcome;
+ pdu->choice.successfulOutcome = successfulOutcome;
+
+ successfulOutcome->procedureCode = ProcedureCode_id_reset;
+ successfulOutcome->criticality = Criticality_reject;
+ successfulOutcome->value.present = SuccessfulOutcome__value_PR_ResetResponse;
+ resetResponse = &successfulOutcome->value.choice.ResetResponse;
+
+ resetResponse_ie->id = ProtocolIE_ID_id_CriticalityDiagnostics;
+ resetResponse_ie->criticality = Criticality_ignore;
+ resetResponse_ie->value.present = ResetResponse_IEs__value_PR_CriticalityDiagnostics;
+
+ ASN_SEQUENCE_ADD(&resetResponse->protocolIEs, resetResponse_ie);
+
+ CriticalityDiagnostics_IE_List_t *critList = calloc(1, sizeof(CriticalityDiagnostics_IE_List_t));
+ assert(critList != 0);
+
+ CriticalityDiagnostics_IE_List__Member *member= calloc(1, sizeof(CriticalityDiagnostics_IE_List__Member));
+ assert(member != 0);
+
+ ASN_SEQUENCE_ADD(critList ,member);
+ ASN_SEQUENCE_ADD(resetResponse_ie->value.choice.CriticalityDiagnostics.iEsCriticalityDiagnostics, critList);
+
+ rc = per_pack_pdu(pdu, packed_buf_size, packed_buf,err_buf_size, err_buf);
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pdu);
+
+ return rc;
+}
+
//TODO change to rmr_request
response := models.NotificationResponse{MgsType: rmrCgo.RIC_SCTP_CLEAR_ALL}
if err:= handler.rmrService.SendRmrMessage(&response); err != nil {
- logger.Errorf("#delete_all_request_handler.Handle - failed to send sctp clear all message to RMR: %s", err)
+ logger.Errorf("#DeleteAllRequestHandler.Handle - failed to send sctp clear all message to RMR: %s", err)
return e2managererrors.NewRmrError()
}
time.Sleep(time.Duration(handler.config.BigRedButtonTimeoutSec) * time.Second)
- logger.Infof("#delete_all_request_handler.Handle - timer expired")
+ logger.Infof("#DeleteAllRequestHandler.Handle - timer expired")
err, _ = handler.updateNodebStates(logger, true)
if err != nil {
nbIdentityList, err := handler.readerProvider().GetListNodebIds()
if err != nil {
- logger.Errorf("#delete_all_request_handler.updateNodebStates - failed to get nodes list from RNIB. Error: %s", err.Error())
+ logger.Errorf("#DeleteAllRequestHandler.updateNodebStates - failed to get nodes list from RNIB. Error: %s", err.Error())
return e2managererrors.NewRnibDbError(), false
}
node, err := handler.readerProvider().GetNodeb((*nbIdentity).GetInventoryName())
if err != nil {
- logger.Errorf("#delete_all_request_handler.updateNodebStates - failed to get nodeB entity for ran name: %v from RNIB. Error: %s",
+ logger.Errorf("#DeleteAllRequestHandler.updateNodebStates - failed to get nodeB entity for ran name: %v from RNIB. Error: %s",
(*nbIdentity).GetInventoryName(), err.Error())
continue
}
}
if numOfRanToShutDown > 0{
- logger.Infof("#delete_all_request_handler.updateNodebStates - update nodebs states in RNIB completed")
+ logger.Infof("#DeleteAllRequestHandler.updateNodebStates - update nodebs states in RNIB completed")
}else {
- logger.Infof("#delete_all_request_handler.updateNodebStates - nodebs states are not updated ")
+ logger.Infof("#DeleteAllRequestHandler.updateNodebStates - nodebs states are not updated ")
return nil, false
}
err := handler.writerProvider().SaveNodeb(nbIdentity, node)
if err != nil {
- logger.Errorf("#delete_all_request_handler.saveNodebNextState - failed to save nodeB entity for inventory name: %v to RNIB. Error: %s",
+ logger.Errorf("#DeleteAllRequestHandler.saveNodebNextState - failed to save nodeB entity for inventory name: %v to RNIB. Error: %s",
(*nbIdentity).GetInventoryName(), err.Error())
return false
}
if logger.DebugEnabled() {
- logger.Debugf("#delete_all_request_handler.saveNodebNextState - connection status of inventory name: %v changed to %v",
+ logger.Debugf("#DeleteAllRequestHandler.saveNodebNextState - connection status of inventory name: %v changed to %v",
(*nbIdentity).GetInventoryName(), nextStatus.String())
}
return true
}
if node.ConnectionStatus != entities.ConnectionStatus_SHUTTING_DOWN {
- logger.Errorf("#delete_all_request_handler.saveNodebShutDownState - ignore, status is not Shutting Down, inventory name: %v ", (*nbIdentity).GetInventoryName())
+ logger.Errorf("#DeleteAllRequestHandler.saveNodebShutDownState - ignore, status is not Shutting Down, inventory name: %v ", (*nbIdentity).GetInventoryName())
return false
}
err := handler.writerProvider().SaveNodeb(nbIdentity, node)
if err != nil {
- logger.Errorf("#delete_all_request_handler.saveNodebShutDownState - failed to save nodeB entity for inventory name: %v to RNIB. Error: %s",
+ logger.Errorf("#DeleteAllRequestHandler.saveNodebShutDownState - failed to save nodeB entity for inventory name: %v to RNIB. Error: %s",
(*nbIdentity).GetInventoryName(), err.Error())
return false
}
- logger.Errorf("#delete_all_request_handler.saveNodebShutDownState - Shut Down , inventory name: %v ", (*nbIdentity).GetInventoryName())
+ logger.Errorf("#DeleteAllRequestHandler.saveNodebShutDownState - Shut Down , inventory name: %v ", (*nbIdentity).GetInventoryName())
return true
}
func initLog(t *testing.T) *logger.Logger {
log, err := logger.InitLogger(logger.InfoLevel)
if err != nil {
- t.Errorf("#delete_all_request_handler_test.TestHandleSuccessFlow - failed to initialize logger, error: %s", err)
+ t.Errorf("#initLog test - failed to initialize logger, error: %s", err)
}
return log
}
initiatingMessage := *(**C.InitiatingMessage_t)(unsafe.Pointer(&pdu.choice[0]))
- if (initiatingMessage == nil || initiatingMessage.value.present != C.InitiatingMessage__value_PR_LoadInformation) {
+ if initiatingMessage == nil || initiatingMessage.value.present != C.InitiatingMessage__value_PR_LoadInformation {
return nil, fmt.Errorf("#extractPduCellInformationItemIEs - Invalid InitiatingMessage value")
}
--- /dev/null
+//
+// Copyright 2019 AT&T Intellectual Property
+// Copyright 2019 Nokia
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package handlers
+
+// #cgo CFLAGS: -I../asn1codec/inc/ -I../asn1codec/e2ap_engine/
+// #cgo LDFLAGS: -L ../asn1codec/lib/ -L../asn1codec/e2ap_engine/ -le2ap_codec -lasncodec
+// #include <asn1codec_utils.h>
+// #include <x2reset_response_wrapper.h>
+import "C"
+import (
+ "e2mgr/logger"
+ "e2mgr/models"
+ "e2mgr/rmrCgo"
+ "e2mgr/sessions"
+ "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities"
+ "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader"
+ "unsafe"
+)
+
+type X2ResetRequestNotificationHandler struct {
+ rnibReaderProvider func() reader.RNibReader
+}
+
+func NewX2ResetRequestNotificationHandler(rnibReaderProvider func() reader.RNibReader) X2ResetRequestNotificationHandler {
+ return X2ResetRequestNotificationHandler{
+ rnibReaderProvider: rnibReaderProvider,
+ }
+}
+
+func (src X2ResetRequestNotificationHandler) Handle(logger *logger.Logger, e2Sessions sessions.E2Sessions,
+ request *models.NotificationRequest, messageChannel chan<- *models.NotificationResponse) {
+
+ logger.Debugf("#X2ResetRequestNotificationHandler.Handle - Ran name: %s", request.RanName)
+
+ nb, rNibErr := src.rnibReaderProvider().GetNodeb(request.RanName)
+ if rNibErr != nil {
+ logger.Errorf("#X2ResetRequestNotificationHandler.Handle - failed to retrieve nodeB entity. RanName: %s. Error: %s", request.RanName, rNibErr.Error())
+ printHandlingSetupResponseElapsedTimeInMs(logger, "#X2ResetRequestNotificationHandler.Handle - Summary: Elapsed time for receiving and handling reset request message from E2 terminator", request.StartTime)
+
+ return
+ }
+ logger.Debugf("#X2ResetRequestNotificationHandler.Handle - nodeB entity retrieved. RanName %s, ConnectionStatus %s", nb.RanName, nb.ConnectionStatus)
+
+ if nb.ConnectionStatus == entities.ConnectionStatus_SHUTTING_DOWN {
+ logger.Warnf("#X2ResetRequestNotificationHandler.Handle - nodeB entity in incorrect state. RanName %s, ConnectionStatus %s", nb.RanName, nb.ConnectionStatus)
+ printHandlingSetupResponseElapsedTimeInMs(logger, "#X2ResetRequestNotificationHandler.Handle - Summary: Elapsed time for receiving and handling reset request message from E2 terminator", request.StartTime)
+
+ return
+ }
+
+ if nb.ConnectionStatus != entities.ConnectionStatus_CONNECTED {
+ logger.Errorf("#X2ResetRequestNotificationHandler.Handle - nodeB entity in incorrect state. RanName %s, ConnectionStatus %s", nb.RanName, nb.ConnectionStatus)
+ printHandlingSetupResponseElapsedTimeInMs(logger, "#X2ResetRequestNotificationHandler.Handle - Summary: Elapsed time for receiving and handling reset request message from E2 terminator", request.StartTime)
+
+ return
+ }
+ src.createAndAddToChannel(logger, request, messageChannel)
+
+ //TODO change name of printHandlingSetupResponseElapsedTimeInMs (remove setup response) and move to utils?
+ printHandlingSetupResponseElapsedTimeInMs(logger, "#X2ResetRequestNotificationHandler.Handle - Summary: Elapsed time for receiving and handling reset request message from E2 terminator", request.StartTime)
+}
+
+func (src X2ResetRequestNotificationHandler) createAndAddToChannel(logger *logger.Logger, request *models.NotificationRequest, messageChannel chan<- *models.NotificationResponse) {
+
+ packedBuffer := make([]C.uchar, MaxAsn1PackedBufferSize)
+ errorBuffer := make([]C.char, MaxAsn1CodecMessageBufferSize)
+ var payloadSize = C.ulong(MaxAsn1PackedBufferSize)
+
+ if status := C.build_pack_x2reset_response(&payloadSize, &packedBuffer[0], C.ulong(MaxAsn1CodecMessageBufferSize), &errorBuffer[0]); !status {
+ logger.Errorf("#X2ResetRequestNotificationHandler.createAndAddToChannel - failed to build and pack the reset response message %s ", C.GoString(&errorBuffer[0]))
+ return
+ }
+ payload := C.GoBytes(unsafe.Pointer(&packedBuffer[0]), C.int(payloadSize))
+ response := models.NotificationResponse{RanName: request.RanName, Payload: payload, MgsType: rmrCgo.RIC_X2_RESET_RESP}
+
+ messageChannel <- &response
+}
--- /dev/null
+//
+// Copyright 2019 AT&T Intellectual Property
+// Copyright 2019 Nokia
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package handlers
+
+import (
+ "e2mgr/mocks"
+ "e2mgr/models"
+ "e2mgr/rmrCgo"
+ "e2mgr/tests"
+ "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common"
+ "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities"
+ "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader"
+ "github.com/stretchr/testify/assert"
+ "testing"
+ "time"
+)
+
+func TestX2ResetRequestNotifSuccess(t *testing.T) {
+ log := initLog(t)
+ payload := []byte("payload")
+ readerMock := &mocks.RnibReaderMock{}
+ readerProvider := func() reader.RNibReader {
+ return readerMock
+ }
+
+ h := NewX2ResetRequestNotificationHandler(readerProvider)
+
+ xaction := []byte("RanName")
+ mBuf := rmrCgo.NewMBuf(tests.MessageType, len(payload),"RanName", &payload, &xaction)
+ notificationRequest := models.NotificationRequest{RanName: mBuf.Meid, Len: mBuf.Len, Payload: *mBuf.Payload,
+ StartTime: time.Now(), TransactionId: string(xaction)}
+
+ nb := &entities.NodebInfo{RanName:mBuf.Meid, ConnectionStatus:entities.ConnectionStatus_CONNECTED,}
+ var rnibErr common.IRNibError
+ readerMock.On("GetNodeb", mBuf.Meid).Return(nb, rnibErr)
+
+ messageChannel := make(chan *models.NotificationResponse)
+
+ go h.Handle(log,nil, ¬ificationRequest, messageChannel)
+
+ result := <-messageChannel
+ assert.Equal(t, result.RanName, mBuf.Meid)
+ assert.Equal(t, result.MgsType, rmrCgo.RIC_X2_RESET_RESP)
+}
+
+func TestHandleX2ResetRequestNotifShuttingDownStatus(t *testing.T) {
+ log := initLog(t)
+ var payload []byte
+ readerMock := &mocks.RnibReaderMock{}
+ readerProvider := func() reader.RNibReader {
+ return readerMock
+ }
+
+ h := NewX2ResetRequestNotificationHandler(readerProvider)
+
+ xaction := []byte("RanName")
+ mBuf := rmrCgo.NewMBuf(tests.MessageType, len(payload),"RanName", &payload, &xaction)
+ notificationRequest := models.NotificationRequest{RanName: mBuf.Meid, Len: mBuf.Len, Payload: *mBuf.Payload,
+ StartTime: time.Now(), TransactionId: string(xaction)}
+
+ nb := &entities.NodebInfo{RanName:mBuf.Meid, ConnectionStatus:entities.ConnectionStatus_SHUTTING_DOWN,}
+ var rnibErr common.IRNibError
+
+ readerMock.On("GetNodeb", mBuf.Meid).Return(nb, rnibErr)
+
+ h.Handle(log,nil, ¬ificationRequest, nil)
+}
+
+func TestHandleX2ResetRequestNotifDisconnectStatus(t *testing.T) {
+ log := initLog(t)
+ var payload []byte
+ readerMock := &mocks.RnibReaderMock{}
+ readerProvider := func() reader.RNibReader {
+ return readerMock
+ }
+
+ h := NewX2ResetRequestNotificationHandler(readerProvider)
+
+ xaction := []byte("RanName")
+ mBuf := rmrCgo.NewMBuf(tests.MessageType, len(payload),"RanName", &payload, &xaction)
+ notificationRequest := models.NotificationRequest{RanName: mBuf.Meid, Len: mBuf.Len, Payload: *mBuf.Payload,
+ StartTime: time.Now(), TransactionId: string(xaction)}
+
+ nb := &entities.NodebInfo{RanName:mBuf.Meid, ConnectionStatus:entities.ConnectionStatus_DISCONNECTED,}
+ var rnibErr common.IRNibError
+
+ readerMock.On("GetNodeb", mBuf.Meid).Return(nb, rnibErr)
+
+ h.Handle(log,nil, ¬ificationRequest, nil)
+}
+
+func TestHandleX2ResetRequestNotifGetNodebFailed(t *testing.T){
+
+ log := initLog(t)
+ var payload []byte
+ readerMock := &mocks.RnibReaderMock{}
+ readerProvider := func() reader.RNibReader {
+ return readerMock
+ }
+
+ h := NewX2ResetRequestNotificationHandler(readerProvider)
+ xaction := []byte("RanName")
+ mBuf := rmrCgo.NewMBuf(tests.MessageType, len(payload),"RanName", &payload, &xaction)
+ notificationRequest := models.NotificationRequest{RanName: mBuf.Meid, Len: mBuf.Len, Payload: *mBuf.Payload,
+ StartTime: time.Now(), TransactionId: string(xaction)}
+
+ var nb *entities.NodebInfo
+ rnibErr := &common.RNibError{}
+ readerMock.On("GetNodeb", mBuf.Meid).Return(nb, rnibErr)
+
+ h.Handle(log,nil, ¬ificationRequest, nil)
+}
)
type NotificationManager struct {
- rnibReaderProvider func() reader.RNibReader
- rnibWriterProvider func() rNibWriter.RNibWriter
+ notificationHandlerProvider *providers.NotificationHandlerProvider
}
func NewNotificationManager(rnibReaderProvider func() reader.RNibReader, rnibWriterProvider func() rNibWriter.RNibWriter) *NotificationManager {
+ notificationHandlerProvider := providers.NewNotificationHandlerProvider(rnibReaderProvider, rnibWriterProvider)
+
return &NotificationManager{
- rnibReaderProvider: rnibReaderProvider,
- rnibWriterProvider: rnibWriterProvider,
+ notificationHandlerProvider: notificationHandlerProvider,
}
}
//TODO add NEWHandler with log
func (m NotificationManager) HandleMessage(logger *logger.Logger, e2Sessions sessions.E2Sessions, mbuf *rmrCgo.MBuf, responseChannel chan<- *models.NotificationResponse) {
- provider := providers.NewNotificationHandlerProvider(m.rnibReaderProvider, m.rnibWriterProvider)
- notificationHandler, err := provider.GetNotificationHandler(mbuf.MType)
+ notificationHandler, err := m.notificationHandlerProvider.GetNotificationHandler(mbuf.MType)
if err != nil {
logger.Errorf(fmt.Sprintf("%s", err))
type NotificationHandlerProvider struct{
notificationHandlers map[int]handlers.NotificationHandler
- rnibReaderProvider func() reader.RNibReader
- rnibWriterProvider func() rNibWriter.RNibWriter
}
func NewNotificationHandlerProvider(rnibReaderProvider func() reader.RNibReader, rnibWriterProvider func() rNibWriter.RNibWriter) *NotificationHandlerProvider {
return &NotificationHandlerProvider{
- rnibReaderProvider: rnibReaderProvider,
- rnibWriterProvider: rnibWriterProvider,
notificationHandlers: initNotificationHandlersMap(rnibReaderProvider, rnibWriterProvider),
}
}
rmrCgo.RIC_ENB_CONF_UPDATE: handlers.X2EnbConfigurationUpdateHandler{},
rmrCgo.RIC_ENDC_CONF_UPDATE: handlers.EndcConfigurationUpdateHandler{},
rmrCgo.RIC_X2_RESET_RESP: handlers.NewX2ResetResponseHandler(rnibReaderProvider),
+ rmrCgo.RIC_X2_RESET: handlers.NewX2ResetRequestNotificationHandler(rnibReaderProvider),
}
}
rte|10060|10.0.2.15:38000
rte|10360|10.0.2.15:38000
rte|10070|10.0.2.15:38000
-rte|10071|10.0.2.15:3801
+rte|10071|10.0.2.15:38000
rte|10061|10.0.2.15:3801
rte|10361|10.0.2.15:3801
rte|10062|10.0.2.15:3801