X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Fcontrol%2Fut_messaging_test.go;h=f27284855e42821d29a0e5018a8e3069280b0008;hb=55d2a285e4914afce7492c6b4b6feebe5485210b;hp=b3f105d93e072babd9f167146b5d2a6eaf27016f;hpb=316d8a176feac5e67dcaa360c0f5996e87b32904;p=ric-plt%2Fsubmgr.git diff --git a/pkg/control/ut_messaging_test.go b/pkg/control/ut_messaging_test.go index b3f105d..f272848 100644 --- a/pkg/control/ut_messaging_test.go +++ b/pkg/control/ut_messaging_test.go @@ -20,6 +20,7 @@ package control import ( + "strings" "testing" "time" @@ -2417,7 +2418,7 @@ func TestRESTSubReqAndRouteNok(t *testing.T) { // Req params := xappConn1.GetRESTSubsReqReportParams(subReqCount) restSubId := xappConn1.SendRESTSubsReq(t, params) - xappConn1.ExpectRESTNotification(t, restSubId) + xappConn1.ExpectRESTNotificationNok(t, restSubId, "failAll") waiter.WaitResult(t) e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) @@ -2464,7 +2465,7 @@ func TestRESTSubReqAndRouteUpdateNok(t *testing.T) { params.SetMeid("RAN_NAME_1") restSubId2 := xappConn2.SendRESTSubsReq(t, params) xapp.Logger.Info("Send REST subscriber request for second subscriber : %v", restSubId2) - xappConn2.ExpectRESTNotification(t, restSubId2) + xappConn2.ExpectRESTNotificationNok(t, restSubId2, "allFail") waiter.WaitResult(t) // e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) - TOD: missing delete xappConn2.WaitRESTNotification(t, restSubId2) @@ -2940,6 +2941,7 @@ func TestRESTSubReqRetryInSubmgr(t *testing.T) { // | | | // //----------------------------------------------------------------------------- + func TestRESTSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { CaseBegin("TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr start") @@ -2965,9 +2967,8 @@ func TestRESTSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { xapp.Logger.Info("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) delreq, delmsg := e2termConn1.RecvSubsDelReq(t) - xappConn1.ExpectRESTNotification(t, restSubId) + xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") e2termConn1.SendSubsDelResp(t, delreq, delmsg) - // e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) - TODO: Should we delete this? xappConn1.WaitRESTNotification(t, restSubId) // Wait that subs is cleaned @@ -3003,7 +3004,7 @@ func TestREST2eTermNotRespondingToSubReq(t *testing.T) { e2termConn1.RecvSubsDelReq(t) xapp.Logger.Info("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) - xappConn1.ExpectRESTNotification(t, restSubId) + xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") e2termConn1.RecvSubsDelReq(t) xapp.Logger.Info("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) @@ -3081,7 +3082,7 @@ func TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { e2termConn1.RecvSubsDelReq(t) xapp.Logger.Info("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) - xappConn1.ExpectRESTNotification(t, restSubId) + xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") e2termConn1.RecvSubsDelReq(t) xapp.Logger.Info("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) @@ -3148,7 +3149,7 @@ func TestRESTSubReqSubFailRespInSubmgr(t *testing.T) { e2termConn1.SendSubsFail(t, fparams1, cremsg1) delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) - xappConn1.ExpectRESTNotification(t, restSubId) + xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", e2SubsId) @@ -3857,10 +3858,10 @@ func TestRESTSubReqPolicyChangeAndSubDelOk(t *testing.T) { restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) // Policy change - instanceId := int64(e2SubsId) // GetRESTSubsReqPolicyParams sets some coutners on tc side. + params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) - params.SubsReqParams.SubscriptionDetails[0].InstanceID = &instanceId + params.SetSubscriptionID(&restSubId) params.SetTimeToWait("w200ms") restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params) @@ -3875,6 +3876,90 @@ func TestRESTSubReqPolicyChangeAndSubDelOk(t *testing.T) { mainCtrl.VerifyCounterValues(t) } +//----------------------------------------------------------------------------- +// TestRESTSubReqPolicyChangeNOk +// +// stub stub +// +-------+ +---------+ +---------+ +// | xapp | | submgr | | e2term | +// +-------+ +---------+ +---------+ +// | | | +// | RESTSubReq | | +// |---------------->| | +// | | | +// | RESTSubResp | | +// |<----------------| | +// | | SubReq | +// | |------------->| +// | | | +// | | SubResp | +// | |<-------------| +// | | | +// | RESTNotif | | +// |<----------------| | +// | | | +// | RESTSubReq | | +// |---------------->| | +// | | | +// | RESTSubUpdateFail | +// | | | +// | RESTSubDelReq | | +// |---------------->| | +// | | | +// | | SubDelReq | +// | |------------->| +// | | | +// | | SubDelResp | +// | |<-------------| +// | | | +// | RESTSubDelResp | | +// |<----------------| | +// +//----------------------------------------------------------------------------- +func TestRESTSubReqPolicyChangeNOk(t *testing.T) { + CaseBegin("TestRESTSubReqPolicyChangeNOk") + + mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ + Counter{cRestSubReqFromXapp, 2}, + Counter{cRestSubRespToXapp, 1}, + Counter{cSubReqToE2, 1}, + Counter{cSubRespFromE2, 1}, + Counter{cRestSubNotifToXapp, 1}, + Counter{cRestSubFailToXapp, 1}, + Counter{cRestSubDelReqFromXapp, 1}, + Counter{cSubDelReqToE2, 1}, + Counter{cSubDelRespFromE2, 1}, + Counter{cRestSubDelRespToXapp, 1}, + }) + + const subReqCount int = 1 + + // Req + params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) + restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) + + // Policy change + + params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) + + restSubIdUpd := strings.ToUpper(restSubId) + params.SetSubscriptionID(&restSubIdUpd) + params.SetTimeToWait("w200ms") + + restSubId2 := xappConn1.SendRESTSubsReq(t, params) + assert.Equal(t, restSubId2, "") + + // Del + xappConn1.SendRESTSubsDelReq(t, &restSubId) + + delreq, delmsg := e2termConn1.RecvSubsDelReq(t) + e2termConn1.SendSubsDelResp(t, delreq, delmsg) + + // Wait that subs is cleaned + waitSubsCleanup(t, e2SubsId, 10) + mainCtrl.VerifyCounterValues(t) +} + //----------------------------------------------------------------------------- // TestRESTSubReqAndSubDelOkTwoE2termParallel // @@ -4687,7 +4772,7 @@ func TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen(t *testing.T) { // Req2 params = xappConn2.GetRESTSubsReqReportParams(subReqCount) params.SetMeid("RAN_NAME_1") - eventTriggerDefinition := "1234" + eventTriggerDefinition := []int64{1234, 1} params.SetSubEventTriggerDefinition(eventTriggerDefinition) restSubId2 := xappConn2.SendRESTSubsReq(t, params) @@ -4737,7 +4822,7 @@ func TestRESTSubReqReportSameActionDiffActionListLen(t *testing.T) { actionId := int64(1) actionType := "report" - actionDefinition := "56781" + actionDefinition := []int64{5678, 1} subsequestActionType := "continue" timeToWait := "w10ms" params.AppendActionToActionToBeSetupList(actionId, actionType, actionDefinition, subsequestActionType, timeToWait) @@ -4922,7 +5007,7 @@ func TestRESTSubReqReportSameActionDiffActionDefinitionLen(t *testing.T) { // Req2 params = xappConn2.GetRESTSubsReqReportParams(subReqCount) params.SetMeid("RAN_NAME_1") - actionDefinition := "5678" + actionDefinition := []int64{5678, 1} params.SetSubActionDefinition(actionDefinition) restSubId2 := xappConn2.SendRESTSubsReq(t, params) @@ -4969,7 +5054,7 @@ func TestRESTSubReqReportSameActionDiffActionDefinitionContents(t *testing.T) { // Req2 params = xappConn2.GetRESTSubsReqReportParams(subReqCount) params.SetMeid("RAN_NAME_1") - actionDefinition := "56782" + actionDefinition := []int64{56782} params.SetSubActionDefinition(actionDefinition) restSubId2 := xappConn2.SendRESTSubsReq(t, params) @@ -5082,7 +5167,7 @@ func TestRESTUnpackSubscriptionResponseDecodeFail(t *testing.T) { _, cremsg = e2termConn1.RecvSubsReq(t) - xappConn1.ExpectRESTNotification(t, restSubId) + xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") // Subscription already created in E2 Node. fparams := &teststube2ap.E2StubSubsFailParams{} @@ -5155,7 +5240,7 @@ func TestRESTUnpackSubscriptionResponseUnknownInstanceId(t *testing.T) { _, cremsg = e2termConn1.RecvSubsReq(t) - xappConn1.ExpectRESTNotification(t, restSubId) + xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") // Subscription already created in E2 Node. fparams := &teststube2ap.E2StubSubsFailParams{} @@ -5233,7 +5318,7 @@ func TestRESTUnpackSubscriptionResponseNoTransaction(t *testing.T) { _, cremsg = e2termConn1.RecvSubsReq(t) - xappConn1.ExpectRESTNotification(t, restSubId) + xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") // Subscription already created in E2 Node. fparams := &teststube2ap.E2StubSubsFailParams{} @@ -5309,7 +5394,7 @@ func TestRESTUnpackSubscriptionFailureDecodeFail(t *testing.T) { _, cremsg = e2termConn1.RecvSubsReq(t) - xappConn1.ExpectRESTNotification(t, restSubId) + xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") // Subscription already created in E2 Node. fparams := &teststube2ap.E2StubSubsFailParams{} @@ -5383,7 +5468,7 @@ func TestRESTUnpackSubscriptionFailureUnknownInstanceId(t *testing.T) { _, cremsg = e2termConn1.RecvSubsReq(t) - xappConn1.ExpectRESTNotification(t, restSubId) + xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") // Subscription already created in E2 Node. fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action @@ -5456,7 +5541,7 @@ func TestRESTUnpackSubscriptionFailureNoTransaction(t *testing.T) { _, cremsg = e2termConn1.RecvSubsReq(t) - xappConn1.ExpectRESTNotification(t, restSubId) + xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") // Subscription already created in E2 Node. fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action @@ -5899,7 +5984,7 @@ func TestRESTSubReqFailAsn1PackSubReqError(t *testing.T) { // E2t: Receive SubsDelReq delreq, delmsg := e2termConn1.RecvSubsDelReq(t) - xappConn1.ExpectRESTNotification(t, restSubId) + xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") // Subscription does not exist in in E2 Node. e2termConn1.SendSubsDelFail(t, delreq, delmsg)