X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=E2Manager%2Fconverters%2Fendc_x2setupFailureResponseToProtobuf_test.go;fp=E2Manager%2Fhandlers%2Fendc_x2setupFailureResponseToProtobuf_test.go;h=f51b9877f901d31bb5d3499616632680d1308d1a;hb=1ec13d4076e7c7abefac6176462c1fee31229213;hp=05d7bce7540d43f36eff6889f25c710de6afe195;hpb=3f9a67b3d8e15bc725f2f66adf499617ffc0d2fc;p=ric-plt%2Fe2mgr.git diff --git a/E2Manager/handlers/endc_x2setupFailureResponseToProtobuf_test.go b/E2Manager/converters/endc_x2setupFailureResponseToProtobuf_test.go similarity index 63% rename from E2Manager/handlers/endc_x2setupFailureResponseToProtobuf_test.go rename to E2Manager/converters/endc_x2setupFailureResponseToProtobuf_test.go index 05d7bce..f51b987 100644 --- a/E2Manager/handlers/endc_x2setupFailureResponseToProtobuf_test.go +++ b/E2Manager/converters/endc_x2setupFailureResponseToProtobuf_test.go @@ -15,68 +15,69 @@ * limitations under the License. * *******************************************************************************/ -package handlers +package converters import ( - "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities" + "e2mgr/e2pdus" "e2mgr/logger" "e2mgr/rNibWriter" "fmt" + "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities" "strings" "testing" ) /* Test permutations of x2 setup response to protobuf enb - */ +*/ func TestUnpackEndcX2SetupFailureResponseAndExtract(t *testing.T) { logger, _ := logger.InitLogger(logger.InfoLevel) var testCases = []struct { - saveToRNib bool - response string - packedPdu string - failure error + saveToRNib bool + response string + packedPdu string + failure error }{ { saveToRNib: false, //TODO: use MOCK? - response: "CONNECTED_SETUP_FAILED network_layer_cause:HANDOVER_DESIRABLE_FOR_RADIO_REASONS time_to_wait:V1S criticality_diagnostics: > ", + response: "CONNECTED_SETUP_FAILED network_layer_cause:HANDOVER_DESIRABLE_FOR_RADIO_REASONS time_to_wait:V1S criticality_diagnostics: > ", /* - E2AP-PDU: - unsuccessfulOutcome_t - procedureCode_t = 0x24 - criticality_t = 0 - ENDCX2SetupFailure - protocolIEs_t: - ProtocolIE_Container_elm - id_t = 0x5 - criticality_t = 0x1 - Cause: - radioNetwork_t = 0 - ProtocolIE_Container_elm - id_t = 0x16 - criticality_t = 0x1 - TimeToWait = 0 - ProtocolIE_Container_elm - id_t = 0x11 - criticality_t = 0x1 - CriticalityDiagnostics - procedureCode_t = 0x21 - triggeringMessage_t = 0x2 - procedureCriticality_t = 0x2 - iEsCriticalityDiagnostics_t: - CriticalityDiagnostics_IE_List_elm - iECriticality_t = 0 - iE_ID_t = 0x80 - typeOfError_t = 0x1 + E2AP-PDU: + unsuccessfulOutcome_t + procedureCode_t = 0x24 + criticality_t = 0 + ENDCX2SetupFailure + protocolIEs_t: + ProtocolIE_Container_elm + id_t = 0x5 + criticality_t = 0x1 + Cause: + radioNetwork_t = 0 + ProtocolIE_Container_elm + id_t = 0x16 + criticality_t = 0x1 + TimeToWait = 0 + ProtocolIE_Container_elm + id_t = 0x11 + criticality_t = 0x1 + CriticalityDiagnostics + procedureCode_t = 0x21 + triggeringMessage_t = 0x2 + procedureCriticality_t = 0x2 + iEsCriticalityDiagnostics_t: + CriticalityDiagnostics_IE_List_elm + iECriticality_t = 0 + iE_ID_t = 0x80 + typeOfError_t = 0x1 */ packedPdu: "4024001a0000030005400200000016400100001140087821a00000008040"}, - /**** shares the same code with x2setup failure response to protobuf ****/ + /**** shares the same code with x2setup failure response to protobuf ****/ } - initDb_f := true + initDb_f := true for _, tc := range testCases { t.Run(tc.packedPdu, func(t *testing.T) { @@ -86,7 +87,7 @@ func TestUnpackEndcX2SetupFailureResponseAndExtract(t *testing.T) { t.Errorf("convert inputPayloadAsStr to payloadAsByte. Error: %v\n", err) } - response, err := unpackEndcX2SetupFailureResponseAndExtract(logger, MaxAsn1CodecAllocationBufferSize /*allocation buffer*/, len(payload), payload, MaxAsn1CodecMessageBufferSize /*message buffer*/) + response, err := UnpackEndcX2SetupFailureResponseAndExtract(logger, e2pdus.MaxAsn1CodecAllocationBufferSize /*allocation buffer*/, len(payload), payload, e2pdus.MaxAsn1CodecMessageBufferSize /*message buffer*/) if err != nil { if tc.failure == nil { @@ -105,7 +106,7 @@ func TestUnpackEndcX2SetupFailureResponseAndExtract(t *testing.T) { } else { nb := &entities.NodebInfo{} nb.ConnectionStatus = entities.ConnectionStatus_CONNECTED_SETUP_FAILED - nb.SetupFailure = response + nb.SetupFailure = response nb.FailureType = entities.Failure_X2_SETUP_FAILURE respStr := fmt.Sprintf("%s %s", nb.ConnectionStatus, response) if !strings.EqualFold(respStr, tc.response) { @@ -118,7 +119,7 @@ func TestUnpackEndcX2SetupFailureResponseAndExtract(t *testing.T) { rNibWriter.Init("e2Manager", 1) initDb_f = false } - nbIdentity := &entities.NbIdentity{InventoryName:"RanName"} + nbIdentity := &entities.NbIdentity{InventoryName: "RanName"} if rNibErr := rNibWriter.GetRNibWriter().SaveNodeb(nbIdentity, nb); rNibErr != nil { if tc.failure == nil { t.Errorf("rNibWriter failed to save ENB. Error: %s\n", rNibErr.Error()) @@ -133,4 +134,3 @@ func TestUnpackEndcX2SetupFailureResponseAndExtract(t *testing.T) { }) } } -