From: Anssi Mannila Date: Tue, 21 Dec 2021 07:19:05 +0000 (+0000) Subject: Merge "Unit test cases improvements - Some fixed delays replaced with function which... X-Git-Tag: 0.9.3~15 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=b43c8445740c9a5ac5535a2b065b403c3608b5dc;hp=-c;p=ric-plt%2Fsubmgr.git Merge "Unit test cases improvements - Some fixed delays replaced with function which tests that test case can contiue - This should reduce random test failuers" --- b43c8445740c9a5ac5535a2b065b403c3608b5dc diff --combined pkg/control/ut_messaging_test.go index 23a12a9,10e10b7..4117aff --- a/pkg/control/ut_messaging_test.go +++ b/pkg/control/ut_messaging_test.go @@@ -675,6 -675,7 +675,6 @@@ func TestSubDelReqAndRouteDeleteNok(t * xappConn2.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) - mainCtrl.VerifyCounterValues(t) } @@@ -2982,19 -2983,21 +2982,21 @@@ func TestRESTSubReqRetransmissionV2(t * queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) + mainCtrl.WaitOngoingRequestMapEmpty() + //1.st resend restSubId_resend := xappConn1.SendRESTSubsReq(t, params) assert.Equal(t, restSubId_resend, restSubId) - <-time.After(100 * time.Millisecond) + mainCtrl.WaitOngoingRequestMapEmpty() //2.nd resend restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) assert.Equal(t, restSubId_resend2, restSubId) - <-time.After(100 * time.Millisecond) + mainCtrl.WaitOngoingRequestMapEmpty() deleteSubscription(t, xappConn1, e2termConn1, &restSubId) @@@ -3066,7 -3069,7 +3068,7 @@@ func TestRESTSubReqRetransmissionV3(t * queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) - <-time.After(100 * time.Millisecond) + mainCtrl.WaitOngoingRequestMapEmpty() //1.st resend with subscription ID params.SetSubscriptionID(&restSubId) @@@ -3074,7 -3077,7 +3076,7 @@@ assert.Equal(t, restSubId_resend, restSubId) - <-time.After(100 * time.Millisecond) + mainCtrl.WaitOngoingRequestMapEmpty() //2.nd resend without subscription ID (faking app restart) params = xappConn1.GetRESTSubsReqReportParams(subReqCount) @@@ -3082,7 -3085,7 +3084,7 @@@ assert.Equal(t, restSubId_resend2, restSubId) - <-time.After(100 * time.Millisecond) + mainCtrl.WaitOngoingRequestMapEmpty() deleteSubscription(t, xappConn1, e2termConn1, &restSubId) @@@ -3168,7 -3171,7 +3170,7 @@@ func TestRESTSubReqRetransmissionV4(t * restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) - <-time.After(100 * time.Millisecond) + mainCtrl.WaitOngoingRequestMapEmpty() // Send modified requst, this time with e2 subscriptions. params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) @@@ -3189,7 -3192,7 +3191,7 @@@ e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) assert.NotEqual(t, e2SubsId2, 0) - <-time.After(100 * time.Millisecond) + mainCtrl.WaitOngoingRequestMapEmpty() xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) params = xappConn1.GetRESTSubsReqReportParams(subReqCount) @@@ -3202,6 -3205,8 +3204,8 @@@ e2SubsId1 = xappConn1.WaitAnyRESTNotification(t) assert.Equal(t, e2SubsId, e2SubsId1) + mainCtrl.WaitOngoingRequestMapEmpty() + // Delete both e2 subscriptions xappConn1.SendRESTSubsDelReq(t, &restSubId) e2SubsIds := []uint32{e2SubsId, e2SubsId2} @@@ -3289,9 -3294,9 +3293,9 @@@ func TestRESTSubReqRetransmissionV5(t * restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) - <-time.After(100 * time.Millisecond) + mainCtrl.WaitOngoingRequestMapEmpty() - // Send modified requst, this time with e2 subscriptions. + // Send modified request, this time with e2 subscriptions. params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) params2.SetSubscriptionID(&restSubId) @@@ -3312,7 -3317,7 +3316,7 @@@ e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) assert.NotEqual(t, e2SubsId2, 0) - <-time.After(100 * time.Millisecond) + mainCtrl.WaitOngoingRequestMapEmpty() xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) params = xappConn1.GetRESTSubsReqReportParams(subReqCount) @@@ -3325,6 -3330,8 +3329,8 @@@ e2SubsId1 = xappConn1.WaitAnyRESTNotification(t) assert.Equal(t, e2SubsId, e2SubsId1) + mainCtrl.WaitOngoingRequestMapEmpty() + // Delete both e2 subscriptions xappConn1.SendRESTSubsDelReq(t, &restSubId) e2SubsIds := []uint32{e2SubsId, e2SubsId2} @@@ -3421,7 -3428,7 +3427,7 @@@ func TestRESTSubReqRetransmissionV6(t * restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) - <-time.After(100 * time.Millisecond) + mainCtrl.WaitOngoingRequestMapEmpty() // Send modified requst, this time with e2 subscriptions. params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) @@@ -3442,7 -3449,7 +3448,7 @@@ e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) assert.NotEqual(t, e2SubsId2, 0) - <-time.After(100 * time.Millisecond) + mainCtrl.WaitOngoingRequestMapEmpty() // Delete both e2 subscriptions xappConn1.SendRESTSubsDelReq(t, &restSubId) @@@ -3456,7 -3463,7 +3462,7 @@@ // fresh create. restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params) - <-time.After(100 * time.Millisecond) + mainCtrl.WaitOngoingRequestMapEmpty() deleteSubscription(t, xappConn1, e2termConn1, &restSubId) @@@ -5312,14 -5319,14 +5318,14 @@@ func TestRESTSubReqAndSubDelOkSameActio // | RESTSubDelReq | | // |---------------->| | // | | | +// | RESTSubDelResp| | +// |<----------------| | // | | SubDelReq | // | |------------->| // | | | // | | SubDelResp | // | |<-------------| // | | | -// | RESTSubDelResp| | -// |<----------------| | // //----------------------------------------------------------------------------- @@@ -5333,18 -5340,6 +5339,18 @@@ func TestRESTReportSubReqAndSubDelOk(t func RESTReportSubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { xapp.Logger.Debug("TEST: TestRESTReportSubReqAndSubDelOk with testIndex %v", testIndex) + mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, + Counter{cSubReqToE2, uint64(subReqCount)}, + Counter{cSubRespFromE2, uint64(subReqCount)}, + Counter{cRestSubNotifToXapp, 1}, + Counter{cRestSubDelReqFromXapp, 1}, + Counter{cRestSubDelRespToXapp, 1}, + Counter{cSubDelReqToE2, uint64(subReqCount)}, + Counter{cSubDelRespFromE2, uint64(subReqCount)}, + }) + // Req params := xappConn1.GetRESTSubsReqReportParams(subReqCount) restSubId := xappConn1.SendRESTSubsReq(t, params) @@@ -5382,11 -5377,10 +5388,11 @@@ e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyCounterValues(t) } /* -func TestRESTPolicySubReqAndSubDelOk(t *testing.T) { was in comments already +func TestRESTPolicySubReqAndSubDelOk(t *testing.T) { //Was in comments already. Next case is not run! CaseBegin("TestRESTPolicySubReqAndSubDelOk") subReqCount := 2 @@@ -5401,18 -5395,6 +5407,18 @@@ func RESTPolicySubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { xapp.Logger.Debug("TEST: TestRESTPolicySubReqAndSubDelOk with testIndex %v", testIndex) + mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, + Counter{cSubReqToE2, uint64(subReqCount)}, + Counter{cSubRespFromE2, uint64(subReqCount)}, + Counter{cRestSubNotifToXapp, 1}, + Counter{cRestSubDelReqFromXapp, 1}, + Counter{cRestSubDelRespToXapp, 1}, + Counter{cSubDelReqToE2, uint64(subReqCount)}, + Counter{cSubDelRespFromE2, uint64(subReqCount)}, + }) + // Req params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) restSubId := xappConn1.SendRESTSubsReq(t, params) @@@ -5443,7 -5425,6 +5449,7 @@@ e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyCounterValues(t) } func TestRESTTwoPolicySubReqAndSubDelOk(t *testing.T) { @@@ -6022,7 -6003,7 +6028,7 @@@ func TestRESTSubReqReportSameActionDiff // | |------------->| // | | | // | | SubResp | ASN.1 decode fails -// | |<-------------| +// | |<-------------| Decode failed. More data needed. This will result timer expiry and resending // | | | // | | SubReq | // | |------------->| @@@ -6032,27 -6013,11 +6038,27 @@@ // | RESTNotif (fail)| | // |<----------------| | // | | | +// | [SUBS DELETE] | +// | | | // //----------------------------------------------------------------------------- func TestRESTUnpackSubscriptionResponseDecodeFail(t *testing.T) { xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionResponseDecodeFail") + + mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, + Counter{cSubReqToE2, 1}, + Counter{cSubReqTimerExpiry, 1}, + Counter{cSubReReqToE2, 1}, + Counter{cSubRespFromE2, 1}, + Counter{cSubFailFromE2, 1}, + Counter{cRestSubFailNotifToXapp, 1}, + Counter{cRestSubDelReqFromXapp, 1}, + Counter{cRestSubDelRespToXapp, 1}, + }) + const subReqCount int = 1 // Req @@@ -6085,7 -6050,6 +6091,7 @@@ e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyCounterValues(t) } //----------------------------------------------------------------------------- @@@ -6106,13 -6070,13 +6112,13 @@@ // | |------------->| // | | | // | | SubResp | Unknown instanceId -// | |<-------------| +// | |<-------------| No valid subscription found with subIds [0] // | | | // | | SubReq | // | |------------->| // | | | // | | SubFail | Duplicated action -// | |<-------------| +// | |<-------------| No valid subscription found with subIds [0] // | RESTNotif (fail)| | // |<----------------| | // | | SubDelReq | @@@ -6120,30 -6084,11 +6126,30 @@@ // | | | // | | SubDelResp | // | |<-------------| +// | | | +// | [SUBS DELETE] | +// | | | // //----------------------------------------------------------------------------- func TestRESTUnpackSubscriptionResponseUnknownInstanceId(t *testing.T) { xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionResponseUnknownInstanceId") + + mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, + Counter{cSubReqToE2, 1}, + Counter{cSubReqTimerExpiry, 2}, + Counter{cSubReReqToE2, 1}, + Counter{cSubRespFromE2, 1}, + Counter{cSubFailFromE2, 1}, + Counter{cRestSubFailNotifToXapp, 1}, + Counter{cRestSubDelReqFromXapp, 1}, + Counter{cRestSubDelRespToXapp, 1}, + Counter{cSubDelReqToE2, 1}, + Counter{cSubDelRespFromE2, 1}, + }) + const subReqCount int = 1 // Req @@@ -6152,7 -6097,7 +6158,7 @@@ crereq, cremsg := e2termConn1.RecvSubsReq(t) - // Unknown instanceId in this response which will result resending original request + // Unknown instanceId 0 in this response which will result resending original request orgInstanceId := crereq.RequestId.InstanceId crereq.RequestId.InstanceId = 0 e2termConn1.SendSubsResp(t, crereq, cremsg) @@@ -6161,7 -6106,7 +6167,7 @@@ xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") - // Subscription already created in E2 Node. + // Subscription already created in E2 Node. E2 Node responds with failure but there is also same unknown instanceId 0 fparams := &teststube2ap.E2StubSubsFailParams{} fparams.Set(crereq) fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action @@@ -6182,7 -6127,6 +6188,7 @@@ e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyCounterValues(t) } //----------------------------------------------------------------------------- @@@ -6203,51 -6147,30 +6209,51 @@@ // | |------------->| // | | | // | | SubResp | No transaction for the response -// | |<-------------| +// | |<-------------| Ongoing transaction not found. This will result timer expiry and resending // | | | // | | SubReq | // | |------------->| // | | | // | | SubFail | Duplicated action -// | |<-------------| +// | |<-------------|Ongoing transaction not found. This will result timer expiry and sending delete // | RESTNotif (fail)| | // |<----------------| | // | | SubDelReq | // | |------------->| // | | | // | | SubDelResp | -// | |<-------------| +// | |<-------------| Ongoing transaction not found. This will result timer expiry and resending // | | | // | | SubDelReq | // | |------------->| // | | | // | | SubDelResp | -// | |<-------------| +// | |<-------------| Ongoing transaction not found. +// | | | +// | [SUBS DELETE] | +// | | | // //----------------------------------------------------------------------------- func TestRESTUnpackSubscriptionResponseNoTransaction(t *testing.T) { xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionResponseNoTransaction") + + mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, + Counter{cSubReqToE2, 1}, + Counter{cSubReqTimerExpiry, 2}, + Counter{cSubReReqToE2, 1}, + Counter{cSubRespFromE2, 1}, + Counter{cSubFailFromE2, 1}, + Counter{cRestSubFailNotifToXapp, 1}, + Counter{cRestSubDelReqFromXapp, 1}, + Counter{cRestSubDelRespToXapp, 1}, + Counter{cSubDelReqToE2, 1}, + Counter{cSubDelReqTimerExpiry, 2}, + Counter{cSubDelReReqToE2, 1}, + Counter{cSubDelRespFromE2, 2}, + }) + const subReqCount int = 1 // Req @@@ -6289,7 -6212,6 +6295,7 @@@ e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyCounterValues(t) } //----------------------------------------------------------------------------- @@@ -6310,7 -6232,7 +6316,7 @@@ // | |------------->| // | | | // | | SubFail | ASN.1 decode fails -// | |<-------------| +// | |<-------------| Decode failed. More data needed. This will result timer expiry and resending // | | | // | | SubReq | // | |------------->| @@@ -6320,25 -6242,10 +6326,25 @@@ // | RESTNotif (fail)| | // |<----------------| | // | | | +// | [SUBS DELETE] | +// | | | // //----------------------------------------------------------------------------- func TestRESTUnpackSubscriptionFailureDecodeFail(t *testing.T) { xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionFailureDecodeFail") + + mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, + Counter{cSubReqToE2, 1}, + Counter{cSubReqTimerExpiry, 1}, + Counter{cSubReReqToE2, 1}, + Counter{cSubFailFromE2, 2}, + Counter{cRestSubFailNotifToXapp, 1}, + Counter{cRestSubDelReqFromXapp, 1}, + Counter{cRestSubDelRespToXapp, 1}, + }) + const subReqCount int = 1 // Req @@@ -6372,7 -6279,6 +6378,7 @@@ e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyCounterValues(t) } //----------------------------------------------------------------------------- @@@ -6393,13 -6299,13 +6399,13 @@@ // | |------------->| // | | | // | | SubFail | Unknown instanceId -// | |<-------------| +// | |<-------------| No valid subscription found with subIds [0]. This will result timer expiry and resending // | | | // | | SubReq | // | |------------->| // | | | // | | SubFail | Duplicated action -// | |<-------------| +// | |<-------------|No valid subscription found with subIds [0]. This will result timer expiry and sending delete // | RESTNotif (fail)| | // |<----------------| | // | | SubDelReq | @@@ -6407,36 -6313,19 +6413,36 @@@ // | | | // | | SubDelResp | // | |<-------------| +// | | | +// | [SUBS DELETE] | +// | | | // //----------------------------------------------------------------------------- func TestRESTUnpackSubscriptionFailureUnknownInstanceId(t *testing.T) { xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionFailureUnknownInstanceId") const subReqCount int = 1 + mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, + Counter{cSubReqToE2, 1}, + Counter{cSubReqTimerExpiry, 2}, + Counter{cSubReReqToE2, 1}, + Counter{cSubFailFromE2, 2}, + Counter{cRestSubFailNotifToXapp, 1}, + Counter{cRestSubDelReqFromXapp, 1}, + Counter{cRestSubDelRespToXapp, 1}, + Counter{cSubDelReqToE2, 1}, + Counter{cSubDelRespFromE2, 1}, + }) + // Req params := xappConn1.GetRESTSubsReqReportParams(subReqCount) restSubId := xappConn1.SendRESTSubsReq(t, params) crereq, cremsg := e2termConn1.RecvSubsReq(t) - // Unknown instanceId in this response which will result resending original request + // Unknown instanceId 0 in this response which will result resending original request fparams := &teststube2ap.E2StubSubsFailParams{} fparams.Set(crereq) fparams.Fail.RequestId.InstanceId = 0 @@@ -6446,7 -6335,7 +6452,7 @@@ xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") - // Subscription already created in E2 Node. + // Subscription already created in E2 Node. E2 Node responds with failure but there is also same unknown instanceId 0 fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action e2termConn1.SendSubsFail(t, fparams, cremsg) @@@ -6465,7 -6354,6 +6471,7 @@@ e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyCounterValues(t) } //----------------------------------------------------------------------------- @@@ -6486,51 -6374,26 +6492,51 @@@ // | |------------->| // | | | // | | SubFail | No transaction for the response -// | |<-------------| +// | |<-------------| Ongoing transaction not found. This will result timer expiry and resending // | | | // | | SubReq | // | |------------->| // | | | // | | SubFail | Duplicated action -// | |<-------------| +// | |<-------------| Ongoing transaction not found. This will result timer expiry and sending delete // | RESTNotif (fail)| | // |<----------------| | // | | SubDelReq | // | |------------->| // | | | // | | SubDelResp | -// | |<-------------| +// | |<-------------| Ongoing transaction not found. This will result timer expiry and resending +// | | | +// | | SubDelReq | +// | |------------->| +// | | | +// | | SubDelResp | +// | |<-------------| Ongoing transaction not found. +// | | | +// | [SUBS DELETE] | +// | | | // //----------------------------------------------------------------------------- func TestRESTUnpackSubscriptionFailureNoTransaction(t *testing.T) { xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionFailureNoTransaction") const subReqCount int = 1 + mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, + Counter{cSubReqToE2, 1}, + Counter{cSubReqTimerExpiry, 2}, + Counter{cSubReReqToE2, 1}, + Counter{cSubFailFromE2, 2}, + Counter{cRestSubFailNotifToXapp, 1}, + Counter{cRestSubDelReqFromXapp, 1}, + Counter{cRestSubDelRespToXapp, 1}, + Counter{cSubDelReqToE2, 1}, + Counter{cSubDelReqTimerExpiry, 2}, + Counter{cSubDelReReqToE2, 1}, + Counter{cSubDelRespFromE2, 2}, + }) + // Req params := xappConn1.GetRESTSubsReqReportParams(subReqCount) restSubId := xappConn1.SendRESTSubsReq(t, params) @@@ -6571,7 -6434,6 +6577,7 @@@ e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyCounterValues(t) } //----------------------------------------------------------------------------- @@@ -6594,37 -6456,20 +6600,37 @@@ // | | SubDelReq | // | |------------->| // | | | -// | | SubDelResp | ASN.1 decode fails -// | |<-------------| +// | | SubDelResp | ASN.1 decode fails. +// | |<-------------| Decode failed. More data needed. This will result timer expiry and resending // | | | // | | SubDelReq | // | |------------->| // | | | -// | | SubDelFail | Subscription does exist any more +// | | SubDelFail | Subscription does exist any more in E2 node // | |<-------------| // | | | +// | [SUBS DELETE] | +// | | | // //----------------------------------------------------------------------------- func TestRESTUnpackSubscriptionDeleteResponseDecodeFail(t *testing.T) { xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteResponseDecodeFail") + mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, + Counter{cSubReqToE2, 1}, + Counter{cSubRespFromE2, 1}, + Counter{cRestSubNotifToXapp, 1}, + Counter{cRestSubDelReqFromXapp, 1}, + Counter{cRestSubDelRespToXapp, 1}, + Counter{cSubDelReqToE2, 1}, + Counter{cSubDelReqTimerExpiry, 1}, + Counter{cSubDelReReqToE2, 1}, + Counter{cSubDelFailFromE2, 1}, + Counter{cSubDelRespFromE2, 1}, + }) + // Req var params *teststube2ap.RESTSubsReqParams = nil restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) @@@ -6636,7 -6481,7 +6642,7 @@@ delreq, delmsg := e2termConn1.RecvSubsDelReq(t) // Decode of this response fails which will result resending original request - e2termConn1.SendInvalidE2Asn1Resp(t, delmsg, xapp.RIC_SUB_DEL_REQ) + e2termConn1.SendInvalidE2Asn1Resp(t, delmsg, xapp.RIC_SUB_DEL_RESP) // E2t: Receive 2nd SubsDelReq and send SubsDelResp delreq, delmsg = e2termConn1.RecvSubsDelReq(t) @@@ -6651,7 -6496,6 +6657,7 @@@ e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyCounterValues(t) } //----------------------------------------------------------------------------- @@@ -6675,35 -6519,18 +6681,35 @@@ // | |------------->| // | | | // | | SubDelResp | Unknown instanceId -// | |<-------------| +// | |<-------------| No valid subscription found with subIds [0]. This will result timer expiry and resending // | | | // | | SubDelReq | // | |------------->| // | | | -// | | SubDelFail | Subscription does exist any more +// | | SubDelFail | Subscription does exist any more in E2 node // | |<-------------| -// +// | | | +// | [SUBS DELETE] | +// | | | //----------------------------------------------------------------------------- func TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId(t *testing.T) { xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId") + mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, + Counter{cSubReqToE2, 1}, + Counter{cSubRespFromE2, 1}, + Counter{cRestSubNotifToXapp, 1}, + Counter{cRestSubDelReqFromXapp, 1}, + Counter{cRestSubDelRespToXapp, 1}, + Counter{cSubDelReqToE2, 1}, + Counter{cSubDelReqTimerExpiry, 1}, + Counter{cSubDelReReqToE2, 1}, + Counter{cSubDelRespFromE2, 1}, + Counter{cSubDelFailFromE2, 1}, + }) + // Req var params *teststube2ap.RESTSubsReqParams = nil restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) @@@ -6731,7 -6558,6 +6737,7 @@@ e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyCounterValues(t) } //----------------------------------------------------------------------------- @@@ -6755,35 -6581,18 +6761,35 @@@ // | |------------->| // | | | // | | SubDelResp | No transaction for the response -// | |<-------------| +// | |<-------------| Ongoing transaction not found. This will result timer expiry and resending // | | | // | | SubDelReq | // | |------------->| // | | | -// | | SubDelFail | Subscription does exist any more -// | |<-------------| -// +// | | SubDelFail | Subscription does exist any more in E2 node +// | |<-------------| Ongoing transaction not found. This will result timer expiry +// | | | +// | [SUBS DELETE] | +// | | | //----------------------------------------------------------------------------- func TestRESTUnpackSubscriptionDeleteResponseNoTransaction(t *testing.T) { xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteResponseNoTransaction") + mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, + Counter{cSubReqToE2, 1}, + Counter{cSubRespFromE2, 1}, + Counter{cRestSubNotifToXapp, 1}, + Counter{cRestSubDelReqFromXapp, 1}, + Counter{cRestSubDelRespToXapp, 1}, + Counter{cSubDelReqToE2, 1}, + Counter{cSubDelReqTimerExpiry, 2}, + Counter{cSubDelReReqToE2, 1}, + Counter{cSubDelRespFromE2, 1}, + Counter{cSubDelFailFromE2, 1}, + }) + // Req var params *teststube2ap.RESTSubsReqParams = nil restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) @@@ -6812,7 -6621,6 +6818,7 @@@ e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyCounterValues(t) } //----------------------------------------------------------------------------- @@@ -6836,34 -6644,18 +6842,34 @@@ // | |------------->| // | | | // | | SubDelFail | ASN.1 decode fails -// | |<-------------| +// | |<-------------| Decode failed. More data needed. This will result timer expiry and resending // | | | // | | SubDelReq | // | |------------->| // | | | -// | | SubDelFail | Subscription does exist any more +// | | SubDelFail | Subscription does exist any more in E2 node // | |<-------------| -// +// | | | +// | [SUBS DELETE] | +// | | | //----------------------------------------------------------------------------- func TestRESTUnpackSubscriptionDeleteFailureDecodeFail(t *testing.T) { xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteFailureDecodeFail") + mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, + Counter{cSubReqToE2, 1}, + Counter{cSubRespFromE2, 1}, + Counter{cRestSubNotifToXapp, 1}, + Counter{cRestSubDelReqFromXapp, 1}, + Counter{cRestSubDelRespToXapp, 1}, + Counter{cSubDelReqToE2, 1}, + Counter{cSubDelReqTimerExpiry, 1}, + Counter{cSubDelReReqToE2, 1}, + Counter{cSubDelFailFromE2, 2}, + }) + // Req var params *teststube2ap.RESTSubsReqParams = nil restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) @@@ -6890,7 -6682,6 +6896,7 @@@ e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyCounterValues(t) } //----------------------------------------------------------------------------- @@@ -6914,34 -6705,18 +6920,34 @@@ // | |------------->| // | | | // | | SubDelFail | Unknown instanceId -// | |<-------------| +// | |<-------------| No valid subscription found with subIds [0]. This will result timer expiry and resending // | | | // | | SubDelReq | // | |------------->| // | | | -// | | SubDelFail | Subscription does exist any more -// | |<-------------| -// +// | | SubDelFail | Subscription does exist any more in E2 node +// | |<-------------| No valid subscription found with subIds [0]. +// | | | +// | [SUBS DELETE] | +// | | | //----------------------------------------------------------------------------- func TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId(t *testing.T) { xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId") + mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, + Counter{cSubReqToE2, 1}, + Counter{cSubRespFromE2, 1}, + Counter{cRestSubNotifToXapp, 1}, + Counter{cRestSubDelReqFromXapp, 1}, + Counter{cRestSubDelRespToXapp, 1}, + Counter{cSubDelReqToE2, 1}, + Counter{cSubDelReqTimerExpiry, 1}, + Counter{cSubDelReReqToE2, 1}, + Counter{cSubDelFailFromE2, 2}, + }) + // Req var params *teststube2ap.RESTSubsReqParams = nil restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) @@@ -6952,14 -6727,14 +6958,14 @@@ // E2t: Receive 1st SubsDelReq delreq, delmsg := e2termConn1.RecvSubsDelReq(t) - // Unknown instanceId in this response which will result resending original request + // Unknown instanceId 0 in this response which will result resending original request delreq.RequestId.InstanceId = 0 e2termConn1.SendSubsDelFail(t, delreq, delmsg) // E2t: Receive 2nd SubsDelReq delreq, delmsg = e2termConn1.RecvSubsDelReq(t) - // Subscription does not exist in in E2 Node. + // Subscription does not exist in in E2 Node. E2 Node responds with failure but there is also same unknown instanceId 0 e2termConn1.SendSubsDelFail(t, delreq, delmsg) // Wait that subs is cleaned @@@ -6969,7 -6744,6 +6975,7 @@@ e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyCounterValues(t) } //----------------------------------------------------------------------------- @@@ -6993,34 -6767,18 +6999,34 @@@ // | |------------->| // | | | // | | SubDelFail | No transaction for the response -// | |<-------------| +// | |<-------------| Ongoing transaction not found. This will result timer expiry and resending // | | | // | | SubDelReq | // | |------------->| // | | | -// | | SubDelFail | Subscription does exist any more -// | |<-------------| -// +// | | SubDelFail | Subscription does exist any more in E2 node +// | |<-------------| Ongoing transaction not found. This will result timer expiry +// | | | +// | [SUBS DELETE] | +// | | | //----------------------------------------------------------------------------- func TestRESTUnpackSubscriptionDeleteFailureNoTransaction(t *testing.T) { xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteFailureNoTransaction") + mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, + Counter{cSubReqToE2, 1}, + Counter{cSubRespFromE2, 1}, + Counter{cRestSubNotifToXapp, 1}, + Counter{cRestSubDelReqFromXapp, 1}, + Counter{cRestSubDelRespToXapp, 1}, + Counter{cSubDelReqToE2, 1}, + Counter{cSubDelReqTimerExpiry, 2}, + Counter{cSubDelReReqToE2, 1}, + Counter{cSubDelFailFromE2, 2}, + }) + // Req var params *teststube2ap.RESTSubsReqParams = nil restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) @@@ -7049,7 -6807,6 +7055,7 @@@ e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyCounterValues(t) } //----------------------------------------------------------------------------- @@@ -7114,8 -6871,8 +7120,8 @@@ func TestRESTSubReqFailAsn1PackSubReqEr // Wait that subs is cleaned waitSubsCleanup(t, e2SubsId, 10) - mainCtrl.VerifyCounterValues(t) mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyCounterValues(t) } func TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction(t *testing.T) { @@@ -7173,8 -6930,9 +7179,8 @@@ e2termConn1.SendSubsDelResp(t, delreq, delmsg) waitSubsCleanup(t, e2SubsId, 10) - - mainCtrl.VerifyCounterValues(t) mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyCounterValues(t) } //-----------------------------------------------------------------------------