X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Fcontrol%2Fut_messaging_test.go;h=c61a49510ebf5b19ac1726e96fb982edf92fb03e;hb=6bd579175aaa85f1dd864ad10fe4209ed6b450ea;hp=3e9a51bcb6abc7182bf665de39ab0f75a3e68b91;hpb=92c3855b5c2d86a54f1342498a2772a605073e06;p=ric-plt%2Fsubmgr.git diff --git a/pkg/control/ut_messaging_test.go b/pkg/control/ut_messaging_test.go index 3e9a51b..c61a495 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) @@ -2745,7 +2745,7 @@ func TestDelAllE2nodeSubsViaDebugIf(t *testing.T) { } // Simulate deletion through REST test and debug interface - mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/delete_all_e2node_subscriptions/RAN_NAME_1") // RAN_NAME_1 = ranName + mainCtrl.SendDeleteRequest(t, "localhost:8080", "/ric/v1/delete_all_e2node_subscriptions/RAN_NAME_1") // RAN_NAME_1 = ranName delreq, delmsg := e2termConn1.RecvSubsDelReq(t) e2termConn1.SendSubsDelResp(t, delreq, delmsg) @@ -2833,7 +2833,7 @@ func TestDelAllxAppSubsViaDebugIf(t *testing.T) { assert.Equal(t, true, mainCtrl.VerifyStringExistInSlice("localhost", xappList)) // Simulate deletion through REST test and debug interface - mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/delete_all_xapp_subscriptions/localhost") // localhost = xappServiceName + mainCtrl.SendDeleteRequest(t, "localhost:8080", "/ric/v1/delete_all_xapp_subscriptions/localhost") // localhost = xappServiceName delreq, delmsg := e2termConn1.RecvSubsDelReq(t) e2termConn1.SendSubsDelResp(t, delreq, delmsg) @@ -4615,6 +4615,83 @@ func TestRESTSubReqSubFailRespInSubmgr(t *testing.T) { mainCtrl.VerifyAllClean(t) } +//----------------------------------------------------------------------------- +// TestRESTSubReqPartialResp +// +// stub stub +// +-------+ +---------+ +---------+ +// | xapp | | submgr | | e2term | +// +-------+ +---------+ +---------+ +// | | | +// | RESTSubReq | | +// |---------------->| | +// | RESTSubResp | | +// |<----------------| | +// | | SubReq | +// | |------------->| +// | | SubResp | Partially accepted +// | |<-------------| +// | | | +// | RESTNotif | | +// |<----------------| | +// | | | +// | [SUBS DELETE] | +// | | | +// +//----------------------------------------------------------------------------- + +func TestRESTSubReqPartialResp(t *testing.T) { + + // Init counter check + mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, + Counter{cSubReqToE2, 1}, + Counter{cSubRespFromE2, 1}, + Counter{cPartialSubRespFromE2, 1}, + Counter{cRestSubNotifToXapp, 1}, + Counter{cRestSubDelReqFromXapp, 1}, + Counter{cSubDelReqToE2, 1}, + Counter{cSubDelRespFromE2, 1}, + Counter{cRestSubDelRespToXapp, 1}, + }) + + // Req + params := xappConn1.GetRESTSubsReqReportParams(subReqCount) + + actionId := int64(2) + actionType := "report" + actionDefinition := []int64{5678, 1} + subsequestActionType := "continue" + timeToWait := "w10ms" + params.AppendActionToActionToBeSetupList(actionId, actionType, actionDefinition, subsequestActionType, timeToWait) + + restSubId := xappConn1.SendRESTSubsReq(t, params) + crereq, cremsg := e2termConn1.RecvSubsReq(t) + xappConn1.ExpectRESTNotification(t, restSubId) + + actionNotAdmittedItem := e2ap.ActionNotAdmittedItem{} + actionNotAdmittedItem.ActionId = 1 + actionNotAdmittedItem.Cause.Content = 1 + actionNotAdmittedItem.Cause.Value = 8 + actionNotAdmittedList := e2ap.ActionNotAdmittedList{} + actionNotAdmittedList.Items = append(actionNotAdmittedList.Items, actionNotAdmittedItem) + e2termConn1.SendPartialSubsResp(t, crereq, cremsg, actionNotAdmittedList) + e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) + + queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) + + // Del + deleteSubscription(t, xappConn1, e2termConn1, &restSubId) + + mainCtrl.wait_subs_clean(t, e2SubsId, 10) + //Wait that subs is cleaned + waitSubsCleanup(t, e2SubsId, 10) + + mainCtrl.VerifyCounterValues(t) + mainCtrl.VerifyAllClean(t) +} + //----------------------------------------------------------------------------- // TestRESTSubDelReqRetryInSubmgr //