X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=pkg%2Fcontrol%2Fut_messaging_test.go;h=3d0b448524d42c2793f5427fa25f88961bcf7f03;hb=84662c4f3e2273152fc849f74880108b6346bcad;hp=e66dc3a160406265cf5d811ccf8bf8fbe291b60e;hpb=56233b081ed5c8620ca6909fb4f13fb31e2d3592;p=ric-plt%2Fsubmgr.git diff --git a/pkg/control/ut_messaging_test.go b/pkg/control/ut_messaging_test.go index e66dc3a..3d0b448 100644 --- a/pkg/control/ut_messaging_test.go +++ b/pkg/control/ut_messaging_test.go @@ -432,7 +432,7 @@ func TestRESTSubReqAndE1apDeleteReqPackingError(t *testing.T) { } //----------------------------------------------------------------------------- -// TestRESTSubReqAndE1apDeleteRespUnpackingError +// TestRESTSubReqAndE2APDeleteRespUnpackingError // // stub stub stub // +-------+ +---------+ +---------+ +---------+ @@ -476,7 +476,7 @@ func TestRESTSubReqAndE1apDeleteReqPackingError(t *testing.T) { // //----------------------------------------------------------------------------- -func TestRESTSubReqAndE1apDeleteRespUnpackingError(t *testing.T) { +func TestRESTSubReqAndE2APDeleteRespUnpackingError(t *testing.T) { restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil) @@ -880,6 +880,100 @@ func TestSubReqAndSubDelOk(t *testing.T) { mainCtrl.VerifyCounterValues(t) } +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// TestSubReqAndSubDelOkOutofOrderIEs +// +// stub stub +// +-------+ +---------+ +---------+ +// | xapp | | submgr | | e2term | +// +-------+ +---------+ +---------+ +// | | | +// | SubReq | | +// |------------->| | +// | | | +// | | SubReq | +// | |------------->| +// | | | +// | | SubResp | (Out of Order IEs) +// | |<-------------| +// | | | +// | SubResp | | +// |<-------------| | +// | | | +// | | | +// | SubDelReq | | +// |------------->| | +// | | | +// | | SubDelReq | +// | |------------->| +// | | | +// | | SubDelResp | +// | |<-------------| +// | | | +// | SubDelResp | | +// |<-------------| | +// +//----------------------------------------------------------------------------- + +func TestSubReqAndSubDelOkOutofOrderIEs(t *testing.T) { + CaseBegin("TestSubReqAndSubDelOkOutofOrderIEs") + + mainCtrl.c.e2ap.SetE2IEOrderCheck(0) + // Init counter check + mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ + Counter{cSubReqFromXapp, 1}, + Counter{cSubReqToE2, 1}, + Counter{cSubRespFromE2, 1}, + Counter{cSubRespToXapp, 1}, + Counter{cSubDelReqFromXapp, 1}, + Counter{cSubDelReqToE2, 1}, + Counter{cSubDelRespFromE2, 1}, + Counter{cSubDelRespToXapp, 1}, + }) + + cretrans := xappConn1.SendSubsReq(t, nil, nil) + if cretrans == nil { + t.Logf("Could not send SubsReq") + t.FailNow() + } + crereq, cremsg := e2termConn1.RecvSubsReq(t) + if crereq == nil || cremsg == nil { + t.Logf("Could not recieve SubsReq") + t.FailNow() + } + + e2termConn1.SendSubsResp(t, crereq, cremsg) + + mainCtrl.c.e2ap.SetE2IEOrderCheck(0) + + e2SubsId := xappConn1.RecvSubsResp(t, cretrans) + resp, _ := xapp.Subscription.QuerySubscriptions() + assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) + assert.Equal(t, resp[0].Meid, "RAN_NAME_1") + assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) + + deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) + delreq, delmsg := e2termConn1.RecvSubsDelReq(t) + + e2termConn1.SendSubsDelResp(t, delreq, delmsg) + xappConn1.RecvSubsDelResp(t, deltrans) + + //Wait that subs is cleaned + mainCtrl.wait_subs_clean(t, e2SubsId, 10) + + xappConn1.TestMsgChanEmpty(t) + xappConn2.TestMsgChanEmpty(t) + e2termConn1.TestMsgChanEmpty(t) + mainCtrl.wait_registry_empty(t, 10) + + mainCtrl.VerifyCounterValues(t) + mainCtrl.c.e2ap.SetE2IEOrderCheck(1) +} + +//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- // TestSubReqRetransmission //