From: rh362j Date: Tue, 12 Nov 2019 16:04:20 +0000 (+0200) Subject: Support multiple cells per resource status request +unpack cleanups X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F11%2F1511%2F1;p=ric-plt%2Fresource-status-manager.git Support multiple cells per resource status request +unpack cleanups Change-Id: If5c6c42cca138e16b2166d174539f39f3342e7dc Signed-off-by: rh362j --- diff --git a/RSM/app/main.go b/RSM/app/main.go index 5f79f9e..0cb9b75 100644 --- a/RSM/app/main.go +++ b/RSM/app/main.go @@ -25,6 +25,7 @@ import ( "rsm/configuration" "rsm/controllers" "rsm/converters" + "rsm/e2pdus" "rsm/httpserver" "rsm/logger" "rsm/managers" @@ -58,7 +59,7 @@ func main() { rmrSender := rmrsender.NewRmrSender(logger, rmrMessenger) resourceStatusInitiateManager := managers.NewResourceStatusInitiateManager(logger, rnibDataService, rmrSender) - unpacker := converters.NewX2apPduUnpacker(logger) + unpacker := converters.NewX2apPduUnpacker(logger,e2pdus.MaxAsn1CodecMessageBufferSize) var rmrManager = rmrmanagers.NewRmrMessageManager(logger, config, rnibDataService, rmrSender, resourceStatusInitiateManager,converters.NewResourceStatusResponseConverter(unpacker), converters.NewResourceStatusFailureConverter(unpacker)) rmrReceiver := rmrreceiver.NewRmrReceiver(logger, rmrMessenger, rmrManager) diff --git a/RSM/asn1codec/inc/resource_status_request_wrapper.h b/RSM/asn1codec/inc/resource_status_request_wrapper.h index f357a2a..1d743bc 100644 --- a/RSM/asn1codec/inc/resource_status_request_wrapper.h +++ b/RSM/asn1codec/inc/resource_status_request_wrapper.h @@ -33,8 +33,9 @@ extern "C" bool build_pack_resource_status_request( - uint8_t const* pLMN_Identity, - uint8_t const* eUTRANCellIdentifier, + uint8_t const** pLMN_Identities, + uint8_t const** eUTRANCellIdentifiers, + size_t nECGIs, Measurement_ID_t measurement_ID, Measurement_ID_t measurement_ID2, Registration_Request_t registration_Request /*Registration_Request_start,Registration_Request_stop,Registration_Request_partial_stop, Registration_Request_add*/, uint32_t reportCharacteristics, @@ -47,8 +48,9 @@ build_pack_resource_status_request( bool build_pack_resource_status_request_aux( - uint8_t const* pLMN_Identity, - uint8_t const* eUTRANCellIdentifier, + uint8_t const** pLMN_Identities, + uint8_t const** eUTRANCellIdentifiers, + size_t nECGIs, Measurement_ID_t measurement_ID, Measurement_ID_t measurement_ID2, Registration_Request_t registration_Request /*Registration_Request_start,Registration_Request_stop,Registration_Request_partial_stop, Registration_Request_add*/, uint32_t reportCharacteristics, diff --git a/RSM/asn1codec/src/resource_status_request_wrapper.c b/RSM/asn1codec/src/resource_status_request_wrapper.c index b7c6a0d..93bbe03 100644 --- a/RSM/asn1codec/src/resource_status_request_wrapper.c +++ b/RSM/asn1codec/src/resource_status_request_wrapper.c @@ -38,8 +38,9 @@ static void assignEUTRANcellIdentifier (EUTRANCellIdentifier_t *eUTRANCellIdenti bool build_pack_resource_status_request( - uint8_t const* pLMN_Identity, - uint8_t const* eUTRANCellIdentifier, + uint8_t const** pLMN_Identities, + uint8_t const** eUTRANCellIdentifiers, + size_t nECGIs, Measurement_ID_t measurement_ID, Measurement_ID_t measurement_ID2, Registration_Request_t registration_Request /*Registration_Request_start,Registration_Request_stop,Registration_Request_partial_stop, Registration_Request_add*/, uint32_t reportCharacteristics, @@ -51,8 +52,9 @@ build_pack_resource_status_request( ) { return build_pack_resource_status_request_aux( - pLMN_Identity, - eUTRANCellIdentifier, + pLMN_Identities, + eUTRANCellIdentifiers, + nECGIs, measurement_ID, measurement_ID2, registration_Request, reportCharacteristics, @@ -66,8 +68,9 @@ build_pack_resource_status_request( bool build_pack_resource_status_request_aux( - uint8_t const* pLMN_Identity, - uint8_t const* eUTRANCellIdentifier, + uint8_t const** pLMN_Identities, + uint8_t const** eUTRANCellIdentifiers, + size_t nECGIs, Measurement_ID_t measurement_ID, Measurement_ID_t measurement_ID2, Registration_Request_t registration_Request /*Registration_Request_start,Registration_Request_stop,Registration_Request_partial_stop, Registration_Request_add*/, uint32_t reportCharacteristics, @@ -151,15 +154,17 @@ build_pack_resource_status_request_aux( cellToReport_List_ie->criticality = Criticality_ignore; cellToReport_List_ie->value.present = ResourceStatusRequest_IEs__value_PR_CellToReport_List; - CellToReport_ItemIEs_t *item = calloc(1, sizeof(CellToReport_ItemIEs_t)); - assert(item != 0); - ASN_SEQUENCE_ADD(&cellToReport_List_ie->value.choice.CellToReport_List, item); + for (size_t i = 0; i < nECGIs; i++){ + CellToReport_ItemIEs_t *item = calloc(1, sizeof(CellToReport_ItemIEs_t)); + assert(item != 0); + ASN_SEQUENCE_ADD(&cellToReport_List_ie->value.choice.CellToReport_List, item); - item->id = ProtocolIE_ID_id_CellToReport_Item; - item->criticality = Criticality_ignore; - item->value.present = CellToReport_ItemIEs__value_PR_CellToReport_Item; - assignPLMN_Identity(&item->value.choice.CellToReport_Item.cell_ID.pLMN_Identity, pLMN_Identity); - assignEUTRANcellIdentifier(&item->value.choice.CellToReport_Item.cell_ID.eUTRANcellIdentifier,eUTRANCellIdentifier); + item->id = ProtocolIE_ID_id_CellToReport_Item; + item->criticality = Criticality_ignore; + item->value.present = CellToReport_ItemIEs__value_PR_CellToReport_Item; + assignPLMN_Identity(&item->value.choice.CellToReport_Item.cell_ID.pLMN_Identity, pLMN_Identities[i]); + assignEUTRANcellIdentifier(&item->value.choice.CellToReport_Item.cell_ID.eUTRANcellIdentifier,eUTRANCellIdentifiers[i]); + } if (reportingPeriodicity >= 0){ ResourceStatusRequest_IEs_t *reportingPeriodicity_ie = calloc(1, sizeof(ResourceStatusRequest_IEs_t)); diff --git a/RSM/asn1codec/src/tests/resource_status_request_wrapper_test.c b/RSM/asn1codec/src/tests/resource_status_request_wrapper_test.c index 2aee074..2b504c6 100644 --- a/RSM/asn1codec/src/tests/resource_status_request_wrapper_test.c +++ b/RSM/asn1codec/src/tests/resource_status_request_wrapper_test.c @@ -48,12 +48,14 @@ or Third bits is set to 1, size_t packed_buf_size = 4096; unsigned char outBuf[packed_buf_size]; char errorBuf[error_buf_size]; - uint8_t pLMN_Identity[] = {0xa,0xb,0xc}; - uint8_t eUTRANCellIdentifier[] = {0xab, 0xcd, 0x70, 0}; + const uint8_t pLMN_Identity[] = {0xa,0xb,0xc}; + const uint8_t eUTRANCellIdentifier[] = {0xab, 0xcd, 0x70, 0}; + const uint8_t *pLMN_Identities[] = {pLMN_Identity}; + const uint8_t *eUTRANCellIdentifiers[] = {eUTRANCellIdentifier}; E2AP_PDU_t *pdu; bool result = build_pack_resource_status_request( - pLMN_Identity, eUTRANCellIdentifier, + pLMN_Identities, eUTRANCellIdentifiers, 1, 15 /*measurement_ID*/, 0 /*measurement_ID2*/, Registration_Request_start /*Registration_Request_start,Registration_Request_stop,Registration_Request_partial_stop, Registration_Request_add*/, 0xf0, diff --git a/RSM/converters/resource_status_failure_unpacker.go b/RSM/converters/resource_status_failure_unpacker.go index c390615..afaae62 100644 --- a/RSM/converters/resource_status_failure_unpacker.go +++ b/RSM/converters/resource_status_failure_unpacker.go @@ -112,8 +112,8 @@ func convertResourceStatusFailure(pdu *C.E2AP_PDU_t) (*models.ResourceStatusResp } // Convert pdu to public ResourceStatusResponse -func (r ResourceStatusFailureConverter) Convert(packedBufferSize int, packedBuf []byte, maxMessageBufferSize int) (*models.ResourceStatusResponse, error) { - pdu, err := r.UnpackX2apPdu(packedBufferSize, packedBuf, maxMessageBufferSize) +func (r ResourceStatusFailureConverter) Convert(packedBuf []byte) (*models.ResourceStatusResponse, error) { + pdu, err := r.UnpackX2apPdu(packedBuf) if err != nil { return nil, err } diff --git a/RSM/converters/resource_status_failure_unpacker_test.go b/RSM/converters/resource_status_failure_unpacker_test.go index 3f0a36d..fbbdf3b 100644 --- a/RSM/converters/resource_status_failure_unpacker_test.go +++ b/RSM/converters/resource_status_failure_unpacker_test.go @@ -32,7 +32,7 @@ import ( func TestResourceStatusFailureConverter(t *testing.T) { logger, _ := logger.InitLogger(logger.DebugLevel) - unpacker := NewX2apPduUnpacker(logger) + unpacker := NewX2apPduUnpacker(logger, e2pdus.MaxAsn1CodecMessageBufferSize) rsFailureConverter := NewResourceStatusFailureConverter(unpacker) var testCases = []struct { @@ -134,7 +134,7 @@ func TestResourceStatusFailureConverter(t *testing.T) { t.Errorf("convert inputPayloadAsStr to payloadAsByte. Error: %v\n", err) } - response, err := rsFailureConverter.Convert(len(payload), payload, e2pdus.MaxAsn1CodecMessageBufferSize /*message buffer*/) + response, err := rsFailureConverter.Convert(payload) if err != nil { t.Errorf("want: success, got: unpack failed. Error: %v\n", err) } @@ -154,7 +154,7 @@ func TestResourceStatusFailureConverter(t *testing.T) { func TestResourceStatusFailureConverterError(t *testing.T) { logger, _ := logger.InitLogger(logger.InfoLevel) - unpacker := NewX2apPduUnpacker(logger) + unpacker := NewX2apPduUnpacker(logger, e2pdus.MaxAsn1CodecMessageBufferSize) rsFailureConverter := NewResourceStatusFailureConverter(unpacker) wantError := "unpacking error: #src/asn1codec_utils.c.unpack_pdu_aux - Failed to decode E2AP-PDU (consumed 0), error = 0 Success" //--------------------2006002a @@ -165,7 +165,7 @@ func TestResourceStatusFailureConverterError(t *testing.T) { t.Errorf("convert inputPayloadAsStr to payloadAsByte. Error: %v\n", err) } - _, err = rsFailureConverter.Convert(len(payload), payload, e2pdus.MaxAsn1CodecMessageBufferSize /*message buffer*/) + _, err = rsFailureConverter.Convert(payload) if err != nil { if 0 != strings.Compare(fmt.Sprintf("%s", err), wantError) { t.Errorf("want failure: %s, got: %s", wantError, err) @@ -178,7 +178,7 @@ func TestResourceStatusFailureConverterError(t *testing.T) { func TestResourceStatusFailureConverterPduOfSuccess(t *testing.T) { logger, _ := logger.InitLogger(logger.InfoLevel) - unpacker := NewX2apPduUnpacker(logger) + unpacker := NewX2apPduUnpacker(logger, e2pdus.MaxAsn1CodecMessageBufferSize) rsFailureConverter := NewResourceStatusFailureConverter(unpacker) wantError := "unexpected PDU, 2" inputPayloadAsStr := "200900220000030027000300000e0028000300000c0041400d00004240080002f8290007ab50" @@ -188,7 +188,7 @@ func TestResourceStatusFailureConverterPduOfSuccess(t *testing.T) { t.Errorf("convert inputPayloadAsStr to payloadAsByte. Error: %v\n", err) } - _, err = rsFailureConverter.Convert(len(payload), payload, e2pdus.MaxAsn1CodecMessageBufferSize /*message buffer*/) + _, err = rsFailureConverter.Convert(payload) if err != nil { if 0 != strings.Compare(fmt.Sprintf("%s", err), wantError) { t.Errorf("want failure: %s, got: %s", wantError, err) @@ -201,7 +201,7 @@ func TestResourceStatusFailureConverterPduOfSuccess(t *testing.T) { func TestResourceStatusFailureConverterWrongPdu(t *testing.T) { logger, _ := logger.InitLogger(logger.InfoLevel) - unpacker := NewX2apPduUnpacker(logger) + unpacker := NewX2apPduUnpacker(logger, e2pdus.MaxAsn1CodecMessageBufferSize) rsFailureConverter := NewResourceStatusFailureConverter(unpacker) wantError := "unexpected PDU - not a resource status failure" inputPayloadAsStr := "4006001a0000030005400200000016400100001140087821a00000008040" @@ -211,7 +211,7 @@ func TestResourceStatusFailureConverterWrongPdu(t *testing.T) { t.Errorf("convert inputPayloadAsStr to payloadAsByte. Error: %v\n", err) } - _, err = rsFailureConverter.Convert(len(payload), payload, e2pdus.MaxAsn1CodecMessageBufferSize /*message buffer*/) + _, err = rsFailureConverter.Convert(payload) if err != nil { if 0 != strings.Compare(fmt.Sprintf("%s", err), wantError) { t.Errorf("want failure: %s, got: %s", wantError, err) diff --git a/RSM/converters/resource_status_response_unpacker.go b/RSM/converters/resource_status_response_unpacker.go index 9d0b874..9bf3722 100644 --- a/RSM/converters/resource_status_response_unpacker.go +++ b/RSM/converters/resource_status_response_unpacker.go @@ -34,8 +34,8 @@ const ( ) type IResourceStatusResponseConverter interface { - Convert(packedBufferSize int, packedBuf []byte, maxMessageBufferSize int) (*models.ResourceStatusResponse, error) - UnpackX2apPduAsString(packedBufferSize int, packedBuf []byte, maxMessageBufferSize int) (string, error) + Convert(packedBuf []byte) (*models.ResourceStatusResponse, error) + UnpackX2apPduAsString(packedBuf []byte, maxMessageBufferSize int) (string, error) } type ResourceStatusResponseConverter struct { @@ -157,8 +157,8 @@ func convertResourceStatusResponse(pdu *C.E2AP_PDU_t) (*models.ResourceStatusRes } // Convert pdu to public ResourceStatusResponse -func (r ResourceStatusResponseConverter) Convert(packedBufferSize int, packedBuf []byte, maxMessageBufferSize int) (*models.ResourceStatusResponse, error) { - pdu, err := r.UnpackX2apPdu(packedBufferSize, packedBuf, maxMessageBufferSize) +func (r ResourceStatusResponseConverter) Convert(packedBuf []byte) (*models.ResourceStatusResponse, error) { + pdu, err := r.UnpackX2apPdu(packedBuf) if err != nil { return nil, err } diff --git a/RSM/converters/resource_status_response_unpacker_test.go b/RSM/converters/resource_status_response_unpacker_test.go index 5671fe7..db7b5fe 100644 --- a/RSM/converters/resource_status_response_unpacker_test.go +++ b/RSM/converters/resource_status_response_unpacker_test.go @@ -32,7 +32,7 @@ import ( func TestResourceStatusResponseConverter(t *testing.T) { logger, _ := logger.InitLogger(logger.DebugLevel) - unpacker := NewX2apPduUnpacker(logger) + unpacker := NewX2apPduUnpacker(logger, e2pdus.MaxAsn1CodecMessageBufferSize) rsConverters := NewResourceStatusResponseConverter(unpacker) var testCases = []struct { @@ -179,7 +179,7 @@ func TestResourceStatusResponseConverter(t *testing.T) { t.Errorf("convert inputPayloadAsStr to payloadAsByte. Error: %v\n", err) } - response, err := rsConverters.Convert(len(payload), payload, e2pdus.MaxAsn1CodecMessageBufferSize /*message buffer*/) + response, err := rsConverters.Convert(payload) if err != nil { t.Errorf("want: success, got: unpack failed. Error: %v\n", err) } @@ -199,7 +199,7 @@ func TestResourceStatusResponseConverter(t *testing.T) { func TestResourceStatusResponseConverterError(t *testing.T) { logger, _ := logger.InitLogger(logger.InfoLevel) - unpacker := NewX2apPduUnpacker(logger) + unpacker := NewX2apPduUnpacker(logger, e2pdus.MaxAsn1CodecMessageBufferSize) rsConverters := NewResourceStatusResponseConverter(unpacker) wantError := "unpacking error: #src/asn1codec_utils.c.unpack_pdu_aux - Failed to decode E2AP-PDU (consumed 0), error = 0 Success" @@ -211,7 +211,7 @@ func TestResourceStatusResponseConverterError(t *testing.T) { t.Errorf("convert inputPayloadAsStr to payloadAsByte. Error: %v\n", err) } - _, err = rsConverters.Convert(len(payload), payload, e2pdus.MaxAsn1CodecMessageBufferSize /*message buffer*/) + _, err = rsConverters.Convert(payload) if err != nil { if 0 != strings.Compare(fmt.Sprintf("%s", err), wantError) { t.Errorf("want failure: %s, got: %s", wantError, err) @@ -224,7 +224,7 @@ func TestResourceStatusResponseConverterError(t *testing.T) { func TestResourceStatusResponseConverterPduOfFailure(t *testing.T) { logger, _ := logger.InitLogger(logger.InfoLevel) - unpacker := NewX2apPduUnpacker(logger) + unpacker := NewX2apPduUnpacker(logger, e2pdus.MaxAsn1CodecMessageBufferSize) rsConverters := NewResourceStatusResponseConverter(unpacker) wantError := "unexpected PDU, 3" @@ -235,7 +235,7 @@ func TestResourceStatusResponseConverterPduOfFailure(t *testing.T) { t.Errorf("convert inputPayloadAsStr to payloadAsByte. Error: %v\n", err) } - _, err = rsConverters.Convert(len(payload), payload, e2pdus.MaxAsn1CodecMessageBufferSize /*message buffer*/) + _, err = rsConverters.Convert(payload) if err != nil { if 0 != strings.Compare(fmt.Sprintf("%s", err), wantError) { t.Errorf("want failure: %s, got: %s", wantError, err) @@ -248,7 +248,7 @@ func TestResourceStatusResponseConverterPduOfFailure(t *testing.T) { func TestResourceStatusResponseConverterWrongPdu(t *testing.T) { logger, _ := logger.InitLogger(logger.InfoLevel) - unpacker := NewX2apPduUnpacker(logger) + unpacker := NewX2apPduUnpacker(logger,e2pdus.MaxAsn1CodecMessageBufferSize) rsConverters := NewResourceStatusResponseConverter(unpacker) wantError := "unexpected PDU - not a resource status response" @@ -259,7 +259,7 @@ func TestResourceStatusResponseConverterWrongPdu(t *testing.T) { t.Errorf("convert inputPayloadAsStr to payloadAsByte. Error: %v\n", err) } - _, err = rsConverters.Convert(len(payload), payload, e2pdus.MaxAsn1CodecMessageBufferSize /*message buffer*/) + _, err = rsConverters.Convert(payload) if err != nil { if 0 != strings.Compare(fmt.Sprintf("%s", err), wantError) { t.Errorf("want failure: %s, got: %s", wantError, err) diff --git a/RSM/converters/x2apPdu_asn1_unpacker.go b/RSM/converters/x2apPdu_asn1_unpacker.go index ac77fb0..c19e5ae 100644 --- a/RSM/converters/x2apPdu_asn1_unpacker.go +++ b/RSM/converters/x2apPdu_asn1_unpacker.go @@ -30,37 +30,38 @@ import ( type X2apPduUnpacker struct { logger *logger.Logger + maxMessageBufferSize int } -func NewX2apPduUnpacker(logger *logger.Logger) X2apPduUnpacker { - return X2apPduUnpacker{logger :logger} +func NewX2apPduUnpacker(logger *logger.Logger, maxMessageBufferSize int) X2apPduUnpacker { + return X2apPduUnpacker{logger :logger, maxMessageBufferSize: maxMessageBufferSize} } -func (r X2apPduUnpacker) UnpackX2apPdu(packedBufferSize int, packedBuf []byte, maxMessageBufferSize int) (*C.E2AP_PDU_t, error) { +func (r X2apPduUnpacker) UnpackX2apPdu(packedBuf []byte) (*C.E2AP_PDU_t, error) { pdu := C.new_pdu() if pdu == nil { return nil, errors.New("allocation failure (pdu)") } - r.logger.Infof("#x2apPdu_asn1_unpacker.UnpackX2apPdu - Packed pdu(%d):%x", packedBufferSize, packedBuf) + r.logger.Infof("#x2apPdu_asn1_unpacker.UnpackX2apPdu - Packed pdu(%d):%x", len(packedBuf), packedBuf) - errBuf := make([]C.char, maxMessageBufferSize) - if !C.per_unpack_pdu(pdu, C.ulong(packedBufferSize), (*C.uchar)(unsafe.Pointer(&packedBuf[0])), C.ulong(len(errBuf)), &errBuf[0]) { + errBuf := make([]C.char, r.maxMessageBufferSize) + if !C.per_unpack_pdu(pdu, C.ulong(len(packedBuf)), (*C.uchar)(unsafe.Pointer(&packedBuf[0])), C.ulong(len(errBuf)), &errBuf[0]) { return nil, errors.New(fmt.Sprintf("unpacking error: %s", C.GoString(&errBuf[0]))) } if r.logger.DebugEnabled() { C.asn1_pdu_printer(pdu, C.size_t(len(errBuf)), &errBuf[0]) - r.logger.Debugf("#x2apPdu_asn1_unpacker.UnpackX2apPdu - PDU: %v packed size:%d", C.GoString(&errBuf[0]), packedBufferSize) + r.logger.Debugf("#x2apPdu_asn1_unpacker.UnpackX2apPdu - PDU: %v packed size:%d", C.GoString(&errBuf[0]), len(packedBuf)) } return pdu, nil } -func (r X2apPduUnpacker)UnpackX2apPduAsString(packedBufferSize int, packedBuf []byte, maxMessageBufferSize int) (string, error) { - pdu, err := r.UnpackX2apPdu(packedBufferSize, packedBuf, maxMessageBufferSize) +func (r X2apPduUnpacker)UnpackX2apPduAsString(packedBuf []byte, maxMessageBufferSize int) (string, error) { + pdu, err := r.UnpackX2apPdu(packedBuf) if err != nil { return "", err } diff --git a/RSM/converters/x2apPdu_asn1_unpacker_test.go b/RSM/converters/x2apPdu_asn1_unpacker_test.go index 230dd6c..aecf638 100644 --- a/RSM/converters/x2apPdu_asn1_unpacker_test.go +++ b/RSM/converters/x2apPdu_asn1_unpacker_test.go @@ -32,7 +32,7 @@ import ( func TestUnpackX2apPduResponse(t *testing.T) { logger, _ := logger.InitLogger(logger.DebugLevel) - unpacker := NewX2apPduUnpacker(logger) + unpacker := NewX2apPduUnpacker(logger, e2pdus.MaxAsn1CodecMessageBufferSize) wantPduAsStr := `UnsuccessfulOutcome ::= { procedureCode: 9 @@ -92,7 +92,7 @@ func TestUnpackX2apPduResponse(t *testing.T) { t.Errorf("convert inputPayloadAsStr to payloadAsByte. Error: %v\n", err) } - response, err := unpacker.UnpackX2apPduAsString(len(payload), payload, e2pdus.MaxAsn1CodecMessageBufferSize /*message buffer*/) + response, err := unpacker.UnpackX2apPduAsString(payload, e2pdus.MaxAsn1CodecMessageBufferSize /*message buffer*/) if err != nil { t.Errorf("want: success, got: unpack failed. Error: %v\n", err) } @@ -114,7 +114,7 @@ func TestUnpackX2apPduResponse(t *testing.T) { func TestUnpackX2apPduError(t *testing.T) { logger, _ := logger.InitLogger(logger.InfoLevel) - unpacker := NewX2apPduUnpacker(logger) + unpacker := NewX2apPduUnpacker(logger, e2pdus.MaxAsn1CodecMessageBufferSize) wantError := "unpacking error: #src/asn1codec_utils.c.unpack_pdu_aux - Failed to decode E2AP-PDU (consumed 0), error = 0 Success" //--------------------2006002a @@ -125,7 +125,7 @@ func TestUnpackX2apPduError(t *testing.T) { t.Errorf("convert inputPayloadAsStr to payloadAsByte. Error: %v\n", err) } - _, err = unpacker.UnpackX2apPduAsString(len(payload), payload, e2pdus.MaxAsn1CodecMessageBufferSize /*message buffer*/) + _, err = unpacker.UnpackX2apPduAsString(payload, e2pdus.MaxAsn1CodecMessageBufferSize /*message buffer*/) if err != nil { if 0 != strings.Compare(fmt.Sprintf("%s", err), wantError) { t.Errorf("want failure: %s, got: %s", wantError, err) diff --git a/RSM/e2pdus/resource_status_request.go b/RSM/e2pdus/resource_status_request.go index ebff854..7af3983 100644 --- a/RSM/e2pdus/resource_status_request.go +++ b/RSM/e2pdus/resource_status_request.go @@ -19,6 +19,7 @@ package e2pdus // #cgo CFLAGS: -I../asn1codec/inc/ -I../asn1codec/e2ap_engine/ // #cgo LDFLAGS: -L ../asn1codec/lib/ -L../asn1codec/e2ap_engine/ -le2ap_codec -lasncodec +// #include // #include // #include import "C" @@ -37,7 +38,7 @@ const ( type Measurement_ID int64 type ResourceStatusRequestData struct { - CellID string // PLMNIdentifier:eUTRANCellIdentifier + CellIdList []string // PLMNIdentifier:eUTRANCellIdentifier MeasurementID Measurement_ID MeasurementID2 Measurement_ID PartialSuccessAllowed bool @@ -59,18 +60,34 @@ func BuildPackedResourceStatusRequest(registrationRequest enums.Registration_Req packedBufSize := C.ulong(len(packedBuf)) pduAsString := "" - var pLMNIdentifier, eUTRANCellIdentifier string + pLMNIdentities := make([]*C.char, len(request.CellIdList)) + eUTRANCellIdentifiers := make([]*C.char, len(request.CellIdList)) - if _, err := fmt.Sscanf(request.CellID, "%x:%x", &pLMNIdentifier, &eUTRANCellIdentifier); err != nil { - return nil, "", fmt.Errorf("BuildPackedResourceStatusRequest() - unexpected CellID value [%s] (want: \":\"), err: %s", request.CellID, err) + for i, cellID := range request.CellIdList { + var pLMNIdentity, eUTRANCellIdentifier string + if _, err := fmt.Sscanf(cellID, "%x:%x", &pLMNIdentity, &eUTRANCellIdentifier); err != nil { + return nil, "", fmt.Errorf("BuildPackedResourceStatusRequest() - unexpected CellID value [%s]@%d (want: \":\"), err: %s", cellID, i, err) + } + pLMNIdentities[i], eUTRANCellIdentifiers[i] = C.CString(pLMNIdentity), C.CString(eUTRANCellIdentifier) } + defer func() { + for _, cPtr := range pLMNIdentities { + C.free(unsafe.Pointer(cPtr)) + + } + for _, cPtr := range eUTRANCellIdentifiers { + C.free(unsafe.Pointer(cPtr)) + } + + }() + /* - 9.2.0 General - When specifying information elements which are to be represented by bit strings, if not otherwise specifically stated in the semantics description of the concerned IE or elsewhere, the following principle applies with regards to the ordering of bits: - - The first bit (leftmost bit) contains the most significant bit (MSB); - - The last bit (rightmost bit) contains the least significant bit (LSB); - - When importing bit strings from other specifications, the first bit of the bit string contains the first bit of the concerned information. + 9.2.0 General + When specifying information elements which are to be represented by bit strings, if not otherwise specifically stated in the semantics description of the concerned IE or elsewhere, the following principle applies with regards to the ordering of bits: + - The first bit (leftmost bit) contains the most significant bit (MSB); + - The last bit (rightmost bit) contains the least significant bit (LSB); + - When importing bit strings from other specifications, the first bit of the bit string contains the first bit of the concerned information. */ /*reportCharacteristics: @@ -114,8 +131,9 @@ func BuildPackedResourceStatusRequest(registrationRequest enums.Registration_Req reportCharacteristics := uint32(prbPeriodic<<7 | tnlLoadIndPeriodic<<6 | hwLoadIndPeriodic<<5 | compositeAvailablCapacityPeriodic<<4 | absStatusPeriodic<<3 | rsrpMeasurementPeriodic<<2 | csiPeriodic<<1) if !C.build_pack_resource_status_request( - (*C.uchar)(unsafe.Pointer(&[]byte(pLMNIdentifier)[0])), - (*C.uchar)(unsafe.Pointer(&[]byte(eUTRANCellIdentifier)[0])), + (**C.uchar)(unsafe.Pointer(&pLMNIdentities[0])), + (**C.uchar)(unsafe.Pointer(&eUTRANCellIdentifiers[0])), + C.ulong(len(request.CellIdList)), C.Measurement_ID_t(request.MeasurementID), C.Measurement_ID_t(request.MeasurementID2), C.Registration_Request_t(registrationRequest), diff --git a/RSM/e2pdus/resource_status_request_test.go b/RSM/e2pdus/resource_status_request_test.go index 6aa4d45..829816a 100644 --- a/RSM/e2pdus/resource_status_request_test.go +++ b/RSM/e2pdus/resource_status_request_test.go @@ -35,7 +35,7 @@ func TestBuildPackedResourceStatusRequest(t *testing.T) { }{ { request: ResourceStatusRequestData{ - CellID: "0a0b0c:abcd8000", + CellIdList: []string{"0a0b0c:abcd8000"}, MeasurementID: 15, MeasurementID2: 0, PartialSuccessAllowed: true, @@ -53,7 +53,7 @@ func TestBuildPackedResourceStatusRequest(t *testing.T) { }, { request: ResourceStatusRequestData{ - CellID: "0a0b0c:abcd8000", + CellIdList: []string{"0a0b0c:abcd8000"}, MeasurementID: 15, MeasurementID2: 0, PartialSuccessAllowed: true, @@ -71,7 +71,7 @@ func TestBuildPackedResourceStatusRequest(t *testing.T) { }, { request: ResourceStatusRequestData{ - CellID: "0a0b0c:abcd8000", + CellIdList: []string{"0a0b0c:abcd8000"}, MeasurementID: 15, MeasurementID2: 0, PartialSuccessAllowed: true, @@ -89,7 +89,7 @@ func TestBuildPackedResourceStatusRequest(t *testing.T) { }, { request: ResourceStatusRequestData{ - CellID: "0a0b0c:abcd8000", + CellIdList: []string{"0a0b0c:abcd8000"}, MeasurementID: 15, MeasurementID2: 0, PartialSuccessAllowed: false, @@ -105,6 +105,24 @@ func TestBuildPackedResourceStatusRequest(t *testing.T) { }, packedPdu: "000900370000070027000300000e001c000100002600040e000000001d400d00001f4008000a0b0cabcd8000001e400160006d4001600091400140", }, + { + request: ResourceStatusRequestData{ + CellIdList: []string{"0a0b0c:abcd8000", "0b0c0d:acde8000"}, + MeasurementID: 15, + MeasurementID2: 0, + PartialSuccessAllowed: true, + PrbPeriodic: true, + TnlLoadIndPeriodic: true, + HwLoadIndPeriodic: true, + AbsStatusPeriodic: true, + RsrpMeasurementPeriodic: true, + CsiPeriodic: true, + PeriodicityMS: enums.ReportingPeriodicity_one_thousand_ms, + PeriodicityRsrpMeasurementMS: enums.ReportingPeriodicityRSRPMR_one_hundred_20_ms, + PeriodicityCsiMS: enums.ReportingPeriodicityCSIR_ms5, + }, + packedPdu: "000900480000080027000300000e001c00010000260004fe000000001d401901001f4008000a0b0cabcd8000001f4008000b0c0dacde8000001e4001000040400100006d4001000091400100", + }, } for _, tc := range testCases { @@ -114,7 +132,7 @@ func TestBuildPackedResourceStatusRequest(t *testing.T) { if err != nil { t.Errorf("want: success, got: pack failed. Error: %v\n", err) } else { - t.Logf("packed resource status request (size=%d): %x\n\n%s", len(payload), payload,asString) + t.Logf("packed resource status request (size=%d): %x\n\n%s", len(payload), payload, asString) tmp := fmt.Sprintf("%x", payload) if len(tmp) != len(tc.packedPdu) { t.Errorf("want packed len:%d, got: %d\n", len(tc.packedPdu)/2, len(payload)/2) @@ -132,7 +150,7 @@ func TestBuildPackedResourceStatusRequest(t *testing.T) { func TestBuildPackedResourceStatusRequestError(t *testing.T) { request := ResourceStatusRequestData{ - CellID: "0a0b0c:abcd8000", + CellIdList: []string{"0a0b0c:abcd8000"}, MeasurementID: 15, MeasurementID2: 0, PrbPeriodic: true, @@ -145,7 +163,7 @@ func TestBuildPackedResourceStatusRequestError(t *testing.T) { PeriodicityRsrpMeasurementMS: enums.ReportingPeriodicityRSRPMR_one_hundred_20_ms, PeriodicityCsiMS: enums.ReportingPeriodicityCSIR_ms5, } - expected:= "packing error: #src/asn1codec_utils.c.pack_pdu_aux - Encoded output of E2AP-PDU, is too big" + expected := "packing error: #src/asn1codec_utils.c.pack_pdu_aux - Encoded output of E2AP-PDU, is too big" _, _, err := BuildPackedResourceStatusRequest(enums.Registration_Request_start, &request, 40 /*max packed buffer*/, MaxAsn1CodecMessageBufferSize /*max message buffer*/, true /*withDebug*/) if err != nil { if !strings.Contains(err.Error(), expected) { @@ -159,7 +177,7 @@ func TestBuildPackedResourceStatusRequestError(t *testing.T) { func TestBuildPackedResourceStatusInvalidCellID(t *testing.T) { request := ResourceStatusRequestData{ - CellID: "0a0b0cabcd8000", + CellIdList: []string{"0a0b0cabcd8000"}, MeasurementID: 15, MeasurementID2: 0, PrbPeriodic: true, @@ -172,7 +190,7 @@ func TestBuildPackedResourceStatusInvalidCellID(t *testing.T) { PeriodicityRsrpMeasurementMS: enums.ReportingPeriodicityRSRPMR_one_hundred_20_ms, PeriodicityCsiMS: enums.ReportingPeriodicityCSIR_ms5, } - expected:= "BuildPackedResourceStatusRequest() - unexpected CellID value [0a0b0cabcd8000] (want: \":\"), err: unexpected EOF" + expected := "BuildPackedResourceStatusRequest() - unexpected CellID value [0a0b0cabcd8000]@0 (want: \":\"), err: unexpected EOF" _, _, err := BuildPackedResourceStatusRequest(enums.Registration_Request_start, &request, MaxAsn1PackedBufferSize /*max packed buffer*/, MaxAsn1CodecMessageBufferSize /*max message buffer*/, true /*withDebug*/) if err != nil { if !strings.Contains(err.Error(), expected) { @@ -186,7 +204,7 @@ func TestBuildPackedResourceStatusInvalidCellID(t *testing.T) { func TestBuildPackedResourceStatusInvalidPeriodicity(t *testing.T) { request := ResourceStatusRequestData{ - CellID: "0a0b0c:abcd8000", + CellIdList: []string{"0a0b0c:abcd8000"}, MeasurementID: 15, MeasurementID2: 0, PrbPeriodic: true, @@ -199,7 +217,54 @@ func TestBuildPackedResourceStatusInvalidPeriodicity(t *testing.T) { PeriodicityRsrpMeasurementMS: enums.ReportingPeriodicityRSRPMR_one_hundred_20_ms, PeriodicityCsiMS: enums.ReportingPeriodicityCSIR_ms5, } - expected:= "BuildPackedResourceStatusRequest - packing error: #src/asn1codec_utils.c.pack_pdu_aux - Failed to encode E2AP-PDU, error = 9 Bad file descriptor" + expected := "BuildPackedResourceStatusRequest - packing error: #src/asn1codec_utils.c.pack_pdu_aux - Failed to encode E2AP-PDU, error = 9 Bad file descriptor" + _, _, err := BuildPackedResourceStatusRequest(enums.Registration_Request_start, &request, MaxAsn1PackedBufferSize /*max packed buffer*/, MaxAsn1CodecMessageBufferSize /*max message buffer*/, true /*withDebug*/) + if err != nil { + if !strings.Contains(err.Error(), expected) { + t.Errorf("want failure:[%s], got: [%s]\n", expected, err) + } + } else { + t.Errorf("want failure: ...%s..., got: success", expected) + + } +} + +func TestBuildPackedResourceStatusTooManyCells(t *testing.T) { + request := ResourceStatusRequestData{ + CellIdList: []string{ + "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", + "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", + "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", + "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", + "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", + "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", + "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", + "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", + "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", + "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", + "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", + "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", + "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", + "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", + "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", + "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", "0a0b0c:abcd8000", "0b0c0d:acde8000", + "0a0b0c:abcd8000", + }, + MeasurementID: 15, + MeasurementID2: 0, + PartialSuccessAllowed: true, + PrbPeriodic: true, + TnlLoadIndPeriodic: true, + HwLoadIndPeriodic: true, + AbsStatusPeriodic: true, + RsrpMeasurementPeriodic: true, + CsiPeriodic: true, + PeriodicityMS: enums.ReportingPeriodicity_one_thousand_ms, + PeriodicityRsrpMeasurementMS: enums.ReportingPeriodicityRSRPMR_one_hundred_20_ms, + PeriodicityCsiMS: enums.ReportingPeriodicityCSIR_ms5, + } + + expected := "BuildPackedResourceStatusRequest - packing error: #src/asn1codec_utils.c.pack_pdu_aux - Failed to encode E2AP-PDU, error = 9 Bad file descriptor" _, _, err := BuildPackedResourceStatusRequest(enums.Registration_Request_start, &request, MaxAsn1PackedBufferSize /*max packed buffer*/, MaxAsn1CodecMessageBufferSize /*max message buffer*/, true /*withDebug*/) if err != nil { if !strings.Contains(err.Error(), expected) { diff --git a/RSM/handlers/rmrmsghandlers/resource_status_failure_handler.go b/RSM/handlers/rmrmsghandlers/resource_status_failure_handler.go index 32ed655..f7f5fb6 100644 --- a/RSM/handlers/rmrmsghandlers/resource_status_failure_handler.go +++ b/RSM/handlers/rmrmsghandlers/resource_status_failure_handler.go @@ -25,13 +25,13 @@ import ( ) type ResourceStatusFailureHandler struct { - logger *logger.Logger + logger *logger.Logger converter converters.IResourceStatusResponseConverter } func NewResourceStatusFailureHandler(logger *logger.Logger, converter converters.IResourceStatusResponseConverter) ResourceStatusFailureHandler { return ResourceStatusFailureHandler{ - logger: logger, + logger: logger, converter: converter, } } @@ -39,14 +39,14 @@ func NewResourceStatusFailureHandler(logger *logger.Logger, converter converters func (h ResourceStatusFailureHandler) Handle(request *models.RmrRequest) { h.logger.Infof("#ResourceStatusFailureHandler.Handle - RAN name: %s - Received resource status failure notification", request.RanName) if h.logger.DebugEnabled() { - pduAsString, err := h.converter.UnpackX2apPduAsString(request.Len, request.Payload, e2pdus.MaxAsn1CodecMessageBufferSize) + pduAsString, err := h.converter.UnpackX2apPduAsString(request.Payload, e2pdus.MaxAsn1CodecMessageBufferSize) if err != nil { h.logger.Errorf("#ResourceStatusFailureHandler.Handle - RAN name: %s - unpack failed. Error: %v", request.RanName, err) return } h.logger.Infof("#ResourceStatusFailureHandler.Handle - RAN name: %s - message: %s", request.RanName, pduAsString) } - response, err := h.converter.Convert(request.Len, request.Payload, e2pdus.MaxAsn1CodecMessageBufferSize) + response, err := h.converter.Convert(request.Payload) if err != nil { h.logger.Errorf("#ResourceStatusFailureHandler.Handle - RAN name: %s - unpack failed. Error: %v", request.RanName, err) return diff --git a/RSM/handlers/rmrmsghandlers/resource_status_failure_handler_test.go b/RSM/handlers/rmrmsghandlers/resource_status_failure_handler_test.go index aff5408..32e82d5 100644 --- a/RSM/handlers/rmrmsghandlers/resource_status_failure_handler_test.go +++ b/RSM/handlers/rmrmsghandlers/resource_status_failure_handler_test.go @@ -34,12 +34,12 @@ func TestResourceStatusFailureHandlerConvertFailure(t *testing.T) { if err != nil { t.Errorf("#... - failed to initialize logger, error: %s", err) } - payload:= []byte("aaa") - req:= models.RmrRequest{RanName: "test", StartTime:time.Now(), Payload:payload,Len:len(payload)} - converterMock:= mocks.ResourceStatusFailureConverterMock{} - converterMock.On("UnpackX2apPduAsString", req.Len, req.Payload, e2pdus.MaxAsn1CodecMessageBufferSize).Return(string(payload), nil) - converterMock.On("Convert", req.Len, req.Payload, e2pdus.MaxAsn1CodecMessageBufferSize).Return((*models.ResourceStatusResponse)(nil), fmt.Errorf("error")) - h:= NewResourceStatusFailureHandler(logger, &converterMock) + payload := []byte("aaa") + req := models.RmrRequest{RanName: "test", StartTime: time.Now(), Payload: payload, Len: len(payload)} + converterMock := mocks.ResourceStatusFailureConverterMock{} + converterMock.On("UnpackX2apPduAsString", req.Payload, e2pdus.MaxAsn1CodecMessageBufferSize).Return(string(payload), nil) + converterMock.On("Convert", req.Payload).Return((*models.ResourceStatusResponse)(nil), fmt.Errorf("error")) + h := NewResourceStatusFailureHandler(logger, &converterMock) h.Handle(&req) @@ -47,21 +47,20 @@ func TestResourceStatusFailureHandlerConvertFailure(t *testing.T) { converterMock.AssertNumberOfCalls(t, "Convert", 1) } - func TestResourceStatusFailureHandlerUnpackFailure(t *testing.T) { logger, err := logger.InitLogger(logger.DebugLevel) if err != nil { t.Errorf("#... - failed to initialize logger, error: %s", err) } - payload:= []byte("aaa") - req:= models.RmrRequest{RanName: "test", StartTime:time.Now(), Payload:payload,Len:len(payload)} - converterMock:= mocks.ResourceStatusFailureConverterMock{} + payload := []byte("aaa") + req := models.RmrRequest{RanName: "test", StartTime: time.Now(), Payload: payload, Len: len(payload)} + converterMock := mocks.ResourceStatusFailureConverterMock{} err = fmt.Errorf("error") var payloadAsString string - converterMock.On("UnpackX2apPduAsString", req.Len, req.Payload, e2pdus.MaxAsn1CodecMessageBufferSize).Return(payloadAsString, err) - converterMock.On("Convert", req.Len, req.Payload, e2pdus.MaxAsn1CodecMessageBufferSize).Return((*models.ResourceStatusResponse)(nil), fmt.Errorf("error")) - h:= NewResourceStatusFailureHandler(logger, &converterMock) + converterMock.On("UnpackX2apPduAsString", req.Payload, e2pdus.MaxAsn1CodecMessageBufferSize).Return(payloadAsString, err) + converterMock.On("Convert", req.Payload).Return((*models.ResourceStatusResponse)(nil), fmt.Errorf("error")) + h := NewResourceStatusFailureHandler(logger, &converterMock) h.Handle(&req) @@ -74,12 +73,12 @@ func TestResourceStatusFailureHandler(t *testing.T) { if err != nil { t.Errorf("#... - failed to initialize logger, error: %s", err) } - unpacker := converters.NewX2apPduUnpacker(logger) - converer:= converters.NewResourceStatusFailureConverter(unpacker) + unpacker := converters.NewX2apPduUnpacker(logger, e2pdus.MaxAsn1CodecMessageBufferSize) + converer := converters.NewResourceStatusFailureConverter(unpacker) var payload []byte fmt.Sscanf("400900320000040027000300000e0028000300000c00054001620044401800004540130002f8290007ab500000434006000000000740", "%x", &payload) - req:= models.RmrRequest{RanName: "test", StartTime:time.Now(), Payload:payload,Len:len(payload)} - h:= NewResourceStatusFailureHandler(logger, converer) + req := models.RmrRequest{RanName: "test", StartTime: time.Now(), Payload: payload, Len: len(payload)} + h := NewResourceStatusFailureHandler(logger, converer) h.Handle(&req) } @@ -89,12 +88,12 @@ func TestResourceStatusFailureHandlerMinimalPdu(t *testing.T) { if err != nil { t.Errorf("#... - failed to initialize logger, error: %s", err) } - unpacker := converters.NewX2apPduUnpacker(logger) - converer:= converters.NewResourceStatusFailureConverter(unpacker) + unpacker := converters.NewX2apPduUnpacker(logger, e2pdus.MaxAsn1CodecMessageBufferSize) + converer := converters.NewResourceStatusFailureConverter(unpacker) var payload []byte fmt.Sscanf("400900170000030027000300000000280003000049000540020a80", "%x", &payload) - req:= models.RmrRequest{RanName: "test", StartTime:time.Now(), Payload:payload,Len:len(payload)} - h:= NewResourceStatusFailureHandler(logger, converer) + req := models.RmrRequest{RanName: "test", StartTime: time.Now(), Payload: payload, Len: len(payload)} + h := NewResourceStatusFailureHandler(logger, converer) h.Handle(&req) } diff --git a/RSM/handlers/rmrmsghandlers/resource_status_response_handler.go b/RSM/handlers/rmrmsghandlers/resource_status_response_handler.go index 7b7cb01..456110b 100644 --- a/RSM/handlers/rmrmsghandlers/resource_status_response_handler.go +++ b/RSM/handlers/rmrmsghandlers/resource_status_response_handler.go @@ -25,13 +25,13 @@ import ( ) type ResourceStatusResponseHandler struct { - logger *logger.Logger + logger *logger.Logger converter converters.IResourceStatusResponseConverter } func NewResourceStatusResponseHandler(logger *logger.Logger, converter converters.IResourceStatusResponseConverter) ResourceStatusResponseHandler { return ResourceStatusResponseHandler{ - logger: logger, + logger: logger, converter: converter, } } @@ -39,14 +39,14 @@ func NewResourceStatusResponseHandler(logger *logger.Logger, converter converter func (h ResourceStatusResponseHandler) Handle(request *models.RmrRequest) { h.logger.Infof("#ResourceStatusResponseHandler.Handle - RAN name: %s - Received resource status response notification", request.RanName) if h.logger.DebugEnabled() { - pduAsString, err := h.converter.UnpackX2apPduAsString(request.Len, request.Payload, e2pdus.MaxAsn1CodecMessageBufferSize) + pduAsString, err := h.converter.UnpackX2apPduAsString(request.Payload, e2pdus.MaxAsn1CodecMessageBufferSize) if err != nil { h.logger.Errorf("#ResourceStatusResponseHandler.Handle - RAN name: %s - unpack failed. Error: %v", request.RanName, err) return } h.logger.Debugf("#ResourceStatusResponseHandler.Handle - RAN name: %s - pdu: %s", request.RanName, pduAsString) } - response, err := h.converter.Convert(request.Len, request.Payload, e2pdus.MaxAsn1CodecMessageBufferSize) + response, err := h.converter.Convert(request.Payload) if err != nil { h.logger.Errorf("#ResourceStatusResponseHandler.Handle - RAN name: %s - unpack failed. Error: %v", request.RanName, err) return @@ -56,7 +56,6 @@ func (h ResourceStatusResponseHandler) Handle(request *models.RmrRequest) { return } - h.logger.Infof("#ResourceStatusResponseHandler.Handle - RAN name: %s - (success) ENB1_Measurement_ID: %d, ENB2_Measurement_ID: %d", request.RanName, response.ENB1_Measurement_ID, diff --git a/RSM/handlers/rmrmsghandlers/resource_status_response_handler_test.go b/RSM/handlers/rmrmsghandlers/resource_status_response_handler_test.go index 138b400..6e47041 100644 --- a/RSM/handlers/rmrmsghandlers/resource_status_response_handler_test.go +++ b/RSM/handlers/rmrmsghandlers/resource_status_response_handler_test.go @@ -36,8 +36,8 @@ func TestResourceStatusResponseHandler(t *testing.T) { payload:= []byte("aaa") req:= models.RmrRequest{RanName: "test", StartTime:time.Now(), Payload:payload,Len:len(payload)} converterMock:= mocks.ResourceStatusResponseConverterMock{} - converterMock.On("UnpackX2apPduAsString", req.Len, req.Payload, e2pdus.MaxAsn1CodecMessageBufferSize).Return(string(payload), nil) - converterMock.On("Convert", req.Len, req.Payload, e2pdus.MaxAsn1CodecMessageBufferSize).Return((*models.ResourceStatusResponse)(nil), fmt.Errorf("error")) + converterMock.On("UnpackX2apPduAsString", req.Payload, e2pdus.MaxAsn1CodecMessageBufferSize).Return(string(payload), nil) + converterMock.On("Convert", req.Payload).Return((*models.ResourceStatusResponse)(nil), fmt.Errorf("error")) h:= NewResourceStatusResponseHandler(logger, &converterMock) h.Handle(&req) @@ -58,8 +58,8 @@ func TestResourceStatusResponseHandlerError(t *testing.T) { err = fmt.Errorf("error") var payloadAsString string - converterMock.On("UnpackX2apPduAsString", req.Len, req.Payload, e2pdus.MaxAsn1CodecMessageBufferSize).Return(payloadAsString, err) - converterMock.On("Convert", req.Len, req.Payload, e2pdus.MaxAsn1CodecMessageBufferSize).Return((*models.ResourceStatusResponse)(nil), fmt.Errorf("error")) + converterMock.On("UnpackX2apPduAsString", req.Payload, e2pdus.MaxAsn1CodecMessageBufferSize).Return(payloadAsString, err) + converterMock.On("Convert", req.Payload).Return((*models.ResourceStatusResponse)(nil), fmt.Errorf("error")) h:= NewResourceStatusResponseHandler(logger, &converterMock) h.Handle(&req) @@ -78,8 +78,8 @@ func TestResourceStatusResponseHandlerEnb2Mid0(t *testing.T) { req:= models.RmrRequest{RanName: "test", StartTime:time.Now(), Payload:payload,Len:len(payload)} response := &models.ResourceStatusResponse{} converterMock:= mocks.ResourceStatusResponseConverterMock{} - converterMock.On("UnpackX2apPduAsString", req.Len, req.Payload, e2pdus.MaxAsn1CodecMessageBufferSize).Return(string(payload), nil) - converterMock.On("Convert", req.Len, req.Payload, e2pdus.MaxAsn1CodecMessageBufferSize).Return(response, nil) + converterMock.On("UnpackX2apPduAsString", req.Payload, e2pdus.MaxAsn1CodecMessageBufferSize).Return(string(payload), nil) + converterMock.On("Convert", req.Payload).Return(response, nil) h:= NewResourceStatusResponseHandler(logger, &converterMock) h.Handle(&req) @@ -97,8 +97,8 @@ func TestResourceStatusResponseHandlerWithMid(t *testing.T) { req:= models.RmrRequest{RanName: "test", StartTime:time.Now(), Payload:payload,Len:len(payload)} response := &models.ResourceStatusResponse{ENB1_Measurement_ID:1, ENB2_Measurement_ID:2} converterMock:= mocks.ResourceStatusResponseConverterMock{} - converterMock.On("UnpackX2apPduAsString", req.Len, req.Payload, e2pdus.MaxAsn1CodecMessageBufferSize).Return(string(payload), nil) - converterMock.On("Convert", req.Len, req.Payload, e2pdus.MaxAsn1CodecMessageBufferSize).Return(response, nil) + converterMock.On("UnpackX2apPduAsString", req.Payload, e2pdus.MaxAsn1CodecMessageBufferSize).Return(string(payload), nil) + converterMock.On("Convert", req.Payload).Return(response, nil) h:= NewResourceStatusResponseHandler(logger, &converterMock) h.Handle(&req) diff --git a/RSM/managers/resource_status_initiate_manager.go b/RSM/managers/resource_status_initiate_manager.go index b96574d..4ff7e1d 100644 --- a/RSM/managers/resource_status_initiate_manager.go +++ b/RSM/managers/resource_status_initiate_manager.go @@ -56,18 +56,18 @@ func (m *ResourceStatusInitiateManager) sendResourceStatusInitiatePerCell(nodebI cells := enb.Enb.ServedCells for index, cellInfo := range cells { - requestParams.CellID = cellInfo.CellId + requestParams.CellIdList = []string{cellInfo.CellId} requestParams.MeasurementID = e2pdus.Measurement_ID(index + 1) - m.logger.Infof("#ResourceStatusInitiateManager.sendResourceStatusInitiatePerCell - RAN name: %s, Going to send request for cell id %s, measurement id %d", nodebInfo.RanName, requestParams.CellID, requestParams.MeasurementID) + m.logger.Infof("#ResourceStatusInitiateManager.sendResourceStatusInitiatePerCell - RAN name: %s, Going to send request for cell id %v, measurement id %d", nodebInfo.RanName, requestParams.CellIdList, requestParams.MeasurementID) payload, payloadAsString, err := e2pdus.BuildPackedResourceStatusRequest(enums.Registration_Request_start, &requestParams, e2pdus.MaxAsn1PackedBufferSize, e2pdus.MaxAsn1CodecMessageBufferSize, m.logger.DebugEnabled()) if err != nil { - m.logger.Errorf("#ResourceStatusInitiateManager.sendResourceStatusInitiatePerCell - RAN name: %s. Failed to build and pack the resource status initiate request for cell id %s, measurement id %d. error: %s", nodebInfo.RanName, requestParams.CellID, requestParams.MeasurementID, err) + m.logger.Errorf("#ResourceStatusInitiateManager.sendResourceStatusInitiatePerCell - RAN name: %s. Failed to build and pack the resource status initiate request for cell id %v, measurement id %d. error: %s", nodebInfo.RanName, requestParams.CellIdList, requestParams.MeasurementID, err) continue } - m.logger.Debugf("#ResourceStatusInitiateManager.sendResourceStatusInitiatePerCell - RAN name: %s, cell id: %s, measurement id: %d, payload: %s", nodebInfo.RanName, requestParams.CellID, requestParams.MeasurementID, payloadAsString) + m.logger.Debugf("#ResourceStatusInitiateManager.sendResourceStatusInitiatePerCell - RAN name: %s, cell id: %v, measurement id: %d, payload: %s", nodebInfo.RanName, requestParams.CellIdList, requestParams.MeasurementID, payloadAsString) rmrMsg := models.NewRmrMessage(rmrcgo.RicResStatusReq, nodebInfo.RanName, payload) go m.rmrSender.Send(rmrMsg) diff --git a/RSM/managers/resource_status_initiate_manager_test.go b/RSM/managers/resource_status_initiate_manager_test.go index fc134a0..a136177 100644 --- a/RSM/managers/resource_status_initiate_manager_test.go +++ b/RSM/managers/resource_status_initiate_manager_test.go @@ -200,7 +200,7 @@ func TestFiveCellsSuccess(t *testing.T) { } func getPackedPayloadForCell(cellId string, index int, resourceStatusRequestData e2pdus.ResourceStatusRequestData) []byte { - resourceStatusRequestData.CellID = cellId + resourceStatusRequestData.CellIdList = []string{cellId} resourceStatusRequestData.MeasurementID = e2pdus.Measurement_ID(index) expectedPayload, _, _ := e2pdus.BuildPackedResourceStatusRequest(enums.Registration_Request_start, &resourceStatusRequestData, e2pdus.MaxAsn1PackedBufferSize, e2pdus.MaxAsn1CodecMessageBufferSize, false) return expectedPayload diff --git a/RSM/managers/rmrmanagers/rmr_message_manager_test.go b/RSM/managers/rmrmanagers/rmr_message_manager_test.go index 80e590d..c102754 100644 --- a/RSM/managers/rmrmanagers/rmr_message_manager_test.go +++ b/RSM/managers/rmrmanagers/rmr_message_manager_test.go @@ -19,6 +19,7 @@ package rmrmanagers import ( "rsm/configuration" "rsm/converters" + "rsm/e2pdus" "rsm/managers" "rsm/rmrcgo" "rsm/tests/testhelper" @@ -30,7 +31,7 @@ func TestRmrMessageManagerSuccess(t *testing.T) { rnibDataService, rmrSender, logger := testhelper.InitTestCase(t) config, _ := configuration.ParseConfiguration() resourceStatusInitiateManager := managers.NewResourceStatusInitiateManager(logger, rnibDataService, rmrSender) - unpacker := converters.NewX2apPduUnpacker(logger) + unpacker := converters.NewX2apPduUnpacker(logger, e2pdus.MaxAsn1CodecMessageBufferSize) manager := NewRmrMessageManager(logger, config, rnibDataService, rmrSender, resourceStatusInitiateManager, converters.NewResourceStatusResponseConverter(unpacker), converters.NewResourceStatusFailureConverter(unpacker)) xactionByteArr := []byte("1111111") @@ -45,7 +46,7 @@ func TestRmrMessageManagerFailure(t *testing.T) { rnibDataService, rmrSender, logger := testhelper.InitTestCase(t) config, _ := configuration.ParseConfiguration() resourceStatusInitiateManager := managers.NewResourceStatusInitiateManager(logger, rnibDataService, rmrSender) - unpacker := converters.NewX2apPduUnpacker(logger) + unpacker := converters.NewX2apPduUnpacker(logger, e2pdus.MaxAsn1CodecMessageBufferSize) manager := NewRmrMessageManager(logger, config, rnibDataService, rmrSender, resourceStatusInitiateManager,converters.NewResourceStatusResponseConverter(unpacker), converters.NewResourceStatusFailureConverter(unpacker)) xactionByteArr := []byte("1111111") diff --git a/RSM/mocks/resource_status_failure_converter_mock.go b/RSM/mocks/resource_status_failure_converter_mock.go index 54b056c..099900b 100644 --- a/RSM/mocks/resource_status_failure_converter_mock.go +++ b/RSM/mocks/resource_status_failure_converter_mock.go @@ -27,13 +27,13 @@ type ResourceStatusFailureConverterMock struct { } -func (m *ResourceStatusFailureConverterMock)Convert(packedBufferSize int, packedBuf []byte, maxMessageBufferSize int) (*models.ResourceStatusResponse, error){ - args := m.Called(packedBufferSize, packedBuf, maxMessageBufferSize) +func (m *ResourceStatusFailureConverterMock)Convert(packedBuf []byte) (*models.ResourceStatusResponse, error){ + args := m.Called(packedBuf) return args.Get(0).(*models.ResourceStatusResponse), args.Error(1) } -func (m *ResourceStatusFailureConverterMock)UnpackX2apPduAsString(packedBufferSize int, packedBuf []byte, maxMessageBufferSize int) (string, error){ - args := m.Called(packedBufferSize, packedBuf, maxMessageBufferSize) +func (m *ResourceStatusFailureConverterMock)UnpackX2apPduAsString(packedBuf []byte, maxMessageBufferSize int) (string, error){ + args := m.Called(packedBuf, maxMessageBufferSize) return args.Get(0).(string), args.Error(1) } diff --git a/RSM/mocks/resource_status_response_converter_mock.go b/RSM/mocks/resource_status_response_converter_mock.go index 54a53f5..592b12d 100644 --- a/RSM/mocks/resource_status_response_converter_mock.go +++ b/RSM/mocks/resource_status_response_converter_mock.go @@ -26,13 +26,13 @@ type ResourceStatusResponseConverterMock struct { mock.Mock } -func (m *ResourceStatusResponseConverterMock)Convert(packedBufferSize int, packedBuf []byte, maxMessageBufferSize int) (*models.ResourceStatusResponse, error){ - args := m.Called(packedBufferSize, packedBuf, maxMessageBufferSize) +func (m *ResourceStatusResponseConverterMock)Convert(packedBuf []byte) (*models.ResourceStatusResponse, error){ + args := m.Called(packedBuf) return args.Get(0).(*models.ResourceStatusResponse), args.Error(1) } -func (m *ResourceStatusResponseConverterMock)UnpackX2apPduAsString(packedBufferSize int, packedBuf []byte, maxMessageBufferSize int) (string, error){ - args := m.Called(packedBufferSize, packedBuf, maxMessageBufferSize) +func (m *ResourceStatusResponseConverterMock)UnpackX2apPduAsString(packedBuf []byte, maxMessageBufferSize int) (string, error){ + args := m.Called(packedBuf, maxMessageBufferSize) return args.Get(0).(string), args.Error(1) } diff --git a/RSM/providers/rmrmsghandlerprovider/message_handler_provider_test.go b/RSM/providers/rmrmsghandlerprovider/message_handler_provider_test.go index 32d644c..b4957eb 100644 --- a/RSM/providers/rmrmsghandlerprovider/message_handler_provider_test.go +++ b/RSM/providers/rmrmsghandlerprovider/message_handler_provider_test.go @@ -21,6 +21,7 @@ import ( "fmt" "rsm/configuration" "rsm/converters" + "rsm/e2pdus" "rsm/handlers/rmrmsghandlers" "rsm/managers" "rsm/tests/testhelper" @@ -41,7 +42,7 @@ func TestGetNotificationHandlerSuccess(t *testing.T) { t.Errorf("#... - failed to parse configuration error: %s", err) } resourceStatusInitiateManager := managers.NewResourceStatusInitiateManager(logger, rnibDataService, rmrSender) - unpacker := converters.NewX2apPduUnpacker(logger) + unpacker := converters.NewX2apPduUnpacker(logger, e2pdus.MaxAsn1CodecMessageBufferSize) var testCases = []struct { msgType int handler rmrmsghandlers.RmrMessageHandler @@ -51,7 +52,7 @@ func TestGetNotificationHandlerSuccess(t *testing.T) { } for _, tc := range testCases { - provider := NewMessageHandlerProvider(logger, config, rnibDataService, rmrSender, resourceStatusInitiateManager,converters.NewResourceStatusResponseConverter(unpacker), converters.NewResourceStatusFailureConverter(unpacker)) + provider := NewMessageHandlerProvider(logger, config, rnibDataService, rmrSender, resourceStatusInitiateManager, converters.NewResourceStatusResponseConverter(unpacker), converters.NewResourceStatusFailureConverter(unpacker)) t.Run(fmt.Sprintf("%d", tc.msgType), func(t *testing.T) { handler, err := provider.GetMessageHandler(tc.msgType) if err != nil { @@ -76,7 +77,7 @@ func TestGetNotificationHandlerFailure(t *testing.T) { t.Errorf("#... - failed to parse configuration error: %s", err) } resourceStatusInitiateManager := managers.NewResourceStatusInitiateManager(logger, rnibDataService, rmrSender) - unpacker := converters.NewX2apPduUnpacker(logger) + unpacker := converters.NewX2apPduUnpacker(logger, e2pdus.MaxAsn1CodecMessageBufferSize) var testCases = []struct { msgType int @@ -85,7 +86,7 @@ func TestGetNotificationHandlerFailure(t *testing.T) { {9999 /*unknown*/, "notification handler not found"}, } for _, tc := range testCases { - provider := NewMessageHandlerProvider(logger, config, rnibDataService, rmrSender, resourceStatusInitiateManager,converters.NewResourceStatusResponseConverter(unpacker), converters.NewResourceStatusFailureConverter(unpacker)) + provider := NewMessageHandlerProvider(logger, config, rnibDataService, rmrSender, resourceStatusInitiateManager, converters.NewResourceStatusResponseConverter(unpacker), converters.NewResourceStatusFailureConverter(unpacker)) t.Run(fmt.Sprintf("%d", tc.msgType), func(t *testing.T) { _, err := provider.GetMessageHandler(tc.msgType) if err == nil { @@ -97,4 +98,3 @@ func TestGetNotificationHandlerFailure(t *testing.T) { }) } } - diff --git a/RSM/services/rmrreceiver/rmr_receiver_test.go b/RSM/services/rmrreceiver/rmr_receiver_test.go index b9d1232..881d2fe 100644 --- a/RSM/services/rmrreceiver/rmr_receiver_test.go +++ b/RSM/services/rmrreceiver/rmr_receiver_test.go @@ -21,6 +21,7 @@ import ( "fmt" "rsm/configuration" "rsm/converters" + "rsm/e2pdus" "rsm/logger" "rsm/managers" "rsm/managers/rmrmanagers" @@ -59,7 +60,7 @@ func initRmrReceiver(t *testing.T) *RmrReceiver { resourceStatusInitiateManager := managers.NewResourceStatusInitiateManager(logger, rnibDataService, rmrSender) rmrMessenger := initRmrMessenger(logger) - unpacker := converters.NewX2apPduUnpacker(logger) + unpacker := converters.NewX2apPduUnpacker(logger, e2pdus.MaxAsn1CodecMessageBufferSize) manager := rmrmanagers.NewRmrMessageManager(logger, config, rnibDataService, rmrSender, resourceStatusInitiateManager,converters.NewResourceStatusResponseConverter(unpacker), converters.NewResourceStatusFailureConverter(unpacker)) return NewRmrReceiver(logger, rmrMessenger, manager)