X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Fcontrol%2Fut_messaging_test.go;h=99ceafc539c0632517e588048f939b7b2ac75f85;hb=afadb6df033657afef927964aa637ba7c8fc0880;hp=92ff1785ca80b98f3ca3e9433197ffc4e1b12d4e;hpb=c9ef0ba044f66201c34f42e3bb459e0ae4e6855b;p=ric-plt%2Fsubmgr.git diff --git a/pkg/control/ut_messaging_test.go b/pkg/control/ut_messaging_test.go index 92ff178..99ceafc 100644 --- a/pkg/control/ut_messaging_test.go +++ b/pkg/control/ut_messaging_test.go @@ -20,30 +20,464 @@ package control import ( + //"os" + "strings" "testing" "time" "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap" "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap_wrapper" + "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities" "gerrit.o-ran-sc.org/r/ric-plt/submgr/pkg/teststube2ap" "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp" "github.com/stretchr/testify/assert" ) -func TestRESTSubReqAndDeleteOkWithE2apUtWrapper(t *testing.T) { - - // The effect of this call shall endure thgough the UT suite! - // If this causes any issues, the previout interface can be restored - // like this: +func TestSuiteSetup(t *testing.T) { + // The effect of this call shall endure though the UT suite! + // If this causes any issues, the previous interface can be restored + // like this:git log // SetPackerIf(e2ap_wrapper.NewAsn1E2APPacker()) + mainCtrl.InitAllCounterMap() SetPackerIf(e2ap_wrapper.NewUtAsn1E2APPacker()) + mainCtrl.c.restDuplicateCtrl.Init() + +} +func TestRanStatusChangeViaSDLNotification(t *testing.T) { + + // Current UT test cases use these ran names + xappRnibMock.CreateGnb("RAN_NAME_1", entities.ConnectionStatus_DISCONNECTED) + xappRnibMock.CreateGnb("RAN_NAME_11", entities.ConnectionStatus_DISCONNECTED) + xappRnibMock.CreateGnb("RAN_NAME_2", entities.ConnectionStatus_DISCONNECTED) + + mainCtrl.c.e2IfState.ReadE2ConfigurationFromRnib() + mainCtrl.c.e2IfState.SubscribeChannels() + + mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") + mainCtrl.SetE2State(t, "RAN_NAME_2_CONNECTED") + mainCtrl.SetE2State(t, "RAN_NAME_11_CONNECTED") +} + +//----------------------------------------------------------------------------- +// TestRESTSubReqAfterE2ConnBreak +// +// stub stub +// +-------+ +---------+ +---------+ +// | xapp | | submgr | | e2term | +// +-------+ +---------+ +---------+ +// | | | +// | [E2 Conn. DOWN] | +// | | | +// | RESTSubReq | | +// |---------------->| | +// | RESTSubFail | | +// |<----------------| | +// | | | +// +//----------------------------------------------------------------------------- + +func TestRESTSubReqAfterE2ConnBreak(t *testing.T) { + CaseBegin("TestRESTSubReqAfterE2ConnBreak") + + mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestReqRejDueE2Down, 1}, + }) + + // E2 disconnect after E2term has received response + mainCtrl.SetE2State(t, "RAN_NAME_1_DISCONNECTED") + // Req + const subReqCount int = 1 + params := xappConn1.GetRESTSubsReqReportParams(subReqCount) + xappConn1.SendRESTSubsReq(t, params) + + // Restore E2 connection for following test cases + mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") + + mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) + //os.Exit(1) +} + +//----------------------------------------------------------------------------- +// TestRESTSubReqE2ConnBreak +// +// stub stub +// +-------+ +---------+ +---------+ +// | xapp | | submgr | | e2term | +// +-------+ +---------+ +---------+ +// | | | +// | RESTSubReq | | +// |---------------->| | +// | RESTSubResp | | +// |<----------------| | +// | | SubReq | +// | |------------->| +// | | SubResp | +// | |<-------------| +// | | | +// | [E2 Conn. DOWN] | +// | [Int. SUBS DELETE] | +// | | | +// | RESTNotif(unsuccessful) | +// |<----------------| | +// | | | +// | | | +// +//----------------------------------------------------------------------------- +func TestRESTSubReqE2ConnBreak(t *testing.T) { + CaseBegin("TestRESTSubReqE2ConnBreak") + + mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, + Counter{cSubReqToE2, 1}, + Counter{cSubRespFromE2, 1}, + Counter{cRestSubFailNotifToXapp, 1}, + }) + + // Req + const subReqCount int = 1 + params := xappConn1.GetRESTSubsReqReportParams(subReqCount) + restSubId := xappConn1.SendRESTSubsReq(t, params) + + crereq, cremsg := e2termConn1.RecvSubsReq(t) + xappConn1.ExpectRESTNotification(t, restSubId) + + // E2 disconnect after E2term has received response + mainCtrl.SetE2State(t, "RAN_NAME_1_DISCONNECTED") + + e2termConn1.SendSubsResp(t, crereq, cremsg) + e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) + + <-time.After(time.Second * 1) + assert.Equal(t, 0, len(mainCtrl.c.registry.register)) + assert.Equal(t, 0, len(mainCtrl.c.registry.restSubscriptions)) + + subIds, register, err := mainCtrl.c.ReadAllSubscriptionsFromSdl() + if err != nil { + xapp.Logger.Error("%v", err) + } else { + assert.Equal(t, 65534, len(subIds)) // range 1-65535 , FFFF = 65535 + assert.Equal(t, 0, len(register)) + } + + restSubscriptions, err := mainCtrl.c.ReadAllRESTSubscriptionsFromSdl() + if err != nil { + xapp.Logger.Error("%v", err) + } else { + assert.Equal(t, 0, len(restSubscriptions)) + } + + // Restore E2 connection for following test cases + mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") + + // Wait that subs is cleaned + waitSubsCleanup(t, e2SubsId, 10) + mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) +} + +//----------------------------------------------------------------------------- +// TestRESTSubscriptionDeleteAfterE2ConnectionBreak +// +// stub stub +// +-------+ +---------+ +---------+ +// | xapp | | submgr | | e2term | +// +-------+ +---------+ +---------+ +// | | | +// | [SUBS CREATE] | +// | | | +// | [E2 Conn. DOWN] | +// | | | +// | RESTSubDelReq | | +// |---------------->| | +// | | | +// | RESTSubDelResp | | +// |<----------------| | +// | | | +// | [No valid subscription found] | +// | | | +// +//----------------------------------------------------------------------------- +func TestRESTSubscriptionDeleteAfterE2ConnectionBreak(t *testing.T) { + xapp.Logger.Debug("TEST: TestRESTSubscriptionDeleteAfterE2ConnectionBreak") + + 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}, + }) + + // Req + var params *teststube2ap.RESTSubsReqParams = nil + restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) + + // E2 disconnect after E2term has received response + mainCtrl.SetE2State(t, "RAN_NAME_1_DISCONNECTED") + + // Del + xappConn1.SendRESTSubsDelReq(t, &restSubId) + + <-time.After(time.Second * 1) + assert.Equal(t, 0, len(mainCtrl.c.registry.register)) + assert.Equal(t, 0, len(mainCtrl.c.registry.restSubscriptions)) + + subIds, register, err := mainCtrl.c.ReadAllSubscriptionsFromSdl() + if err != nil { + xapp.Logger.Error("%v", err) + } else { + assert.Equal(t, 65534, len(subIds)) // range 1-65535 , FFFF = 65535 + assert.Equal(t, 0, len(register)) + } + + restSubscriptions, err := mainCtrl.c.ReadAllRESTSubscriptionsFromSdl() + if err != nil { + xapp.Logger.Error("%v", err) + } else { + assert.Equal(t, 0, len(restSubscriptions)) + } + + // Restore E2 connection for following test cases + mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") + + // Wait that subs is cleaned + mainCtrl.wait_subs_clean(t, e2SubsId, 10) + + xappConn1.TestMsgChanEmpty(t) + e2termConn1.TestMsgChanEmpty(t) + mainCtrl.wait_registry_empty(t, 10) + mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) +} + +//----------------------------------------------------------------------------- +// TestRESTOtherE2ConnectionChanges +// + +// stub stub +// +-------+ +---------+ +---------+ +// | xapp | | submgr | | e2term | +// +-------+ +---------+ +---------+ +// | | | +// | [SUBS CREATE] | +// | | | +// | [E2 CONNECTED_SETUP_FAILED] | +// | [E2 CONNECTING] | +// | [E2 SHUTTING_DOWN] | +// | [E2 SHUT_DOWN] | +// | | | +// | [SUBS DELETE] | +// | | | +// +//----------------------------------------------------------------------------- +func TestRESTOtherE2ConnectionChanges(t *testing.T) { + xapp.Logger.Debug("TEST: TestRESTOtherE2ConnectionChanges") + + mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, + Counter{cSubReqToE2, 1}, + Counter{cSubRespFromE2, 1}, + Counter{cRestSubNotifToXapp, 1}, + Counter{cRestSubDelReqFromXapp, 1}, + Counter{cSubDelReqToE2, 1}, + Counter{cSubDelRespFromE2, 1}, + Counter{cRestSubDelRespToXapp, 1}, + }) + + // Req + params := xappConn1.GetRESTSubsReqReportParams(subReqCount) + restSubId := xappConn1.SendRESTSubsReq(t, params) + + crereq, cremsg := e2termConn1.RecvSubsReq(t) + xappConn1.ExpectRESTNotification(t, restSubId) + e2termConn1.SendSubsResp(t, crereq, cremsg) + e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) + + // Submgr should not react any other connection state changes than CONNECTED and DISCONNECTED + mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED_SETUP_FAILED") + mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTING") + mainCtrl.SetE2State(t, "RAN_NAME_1_SHUTTING_DOWN") + mainCtrl.SetE2State(t, "RAN_NAME_1_SHUT_DOWN") + + // Del + xappConn1.SendRESTSubsDelReq(t, &restSubId) + delreq, delmsg := e2termConn1.RecvSubsDelReq(t) + e2termConn1.SendSubsDelResp(t, delreq, delmsg) + + // Restore E2 connection for following test cases + mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") + + // Wait that subs is cleaned + waitSubsCleanup(t, e2SubsId, 10) + mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) +} + +//----------------------------------------------------------------------------- +// TestRESTSubReqAndDeleteOkWithE2apUtWrapper +// +// stub stub stub +// +-------+ +---------+ +---------+ +---------+ +// | xapp | | submgr | | e2term | | rtmgr | +// +-------+ +---------+ +---------+ +---------+ +// | | | | +// | RESTSubReq | | | +// |---------------->| | | +// | | RouteCreate | | +// | |--------------------------->| // The order of these events may vary +// | | | | +// | RESTSubResp | | | // The order of these events may vary +// |<----------------| | | +// | | RouteResponse| | +// | |<---------------------------| // The order of these events may vary +// | | | | +// | | SubReq | | +// | |------------->| | // The order of these events may vary +// | | | | +// | | SubResp | | +// | |<-------------| | +// | RESTNotif1 | | | +// |<----------------| | | +// | | | | +// | RESTSubDelReq | | | +// |---------------->| | | +// | | SubDelReq | | +// | |------------->| | +// | | | | +// | RESTSubDelResp| | | +// |<----------------| | | +// | | | | +// | | SubDelResp | | +// | |<-------------| | +// | | | | +// | | | | +// +//----------------------------------------------------------------------------- +func TestRESTSubReqAndDeleteOkWithE2apUtWrapper(t *testing.T) { restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil) deleteSubscription(t, xappConn1, e2termConn1, &restSubId) waitSubsCleanup(t, e2SubsId, 10) + //mainCtrl.VerifyAllClean(t) +} + +//----------------------------------------------------------------------------- +// TestRESTSubReqAndE1apDeleteReqPackingError +// +// stub stub stub +// +-------+ +---------+ +---------+ +---------+ +// | xapp | | submgr | | e2term | | rtmgr | +// +-------+ +---------+ +---------+ +---------+ +// | | | | +// | RESTSubReq | | | +// |---------------->| | | +// | | RouteCreate | | +// | |--------------------------->| // The order of these events may vary +// | | | | +// | RESTSubResp | | | // The order of these events may vary +// |<----------------| | | +// | | RouteResponse| | +// | |<---------------------------| // The order of these events may vary +// | | | | +// | | SubReq | | +// | |------------->| | // The order of these events may vary +// | | | | +// | | SubResp | | +// | |<-------------| | +// | RESTNotif1 | | | +// |<----------------| | | +// | | | | +// | RESTSubDelReq | | | +// |---------------->| | | +// | | | | +// | RESTSubDelResp| | | +// |<----------------| | | +// | | | | +// | | | | +// +//----------------------------------------------------------------------------- +func TestRESTSubReqAndE1apDeleteReqPackingError(t *testing.T) { + + restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil) + + e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_REQ, false) + xappConn1.SendRESTSubsDelReq(t, &restSubId) + defer e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_REQ, true) + + waitSubsCleanup(t, e2SubsId, 10) + //mainCtrl.VerifyAllClean(t) +} + +//----------------------------------------------------------------------------- +// TestRESTSubReqAndE1apDeleteRespUnpackingError +// +// stub stub stub +// +-------+ +---------+ +---------+ +---------+ +// | xapp | | submgr | | e2term | | rtmgr | +// +-------+ +---------+ +---------+ +---------+ +// | | | | +// | RESTSubReq | | | +// |---------------->| | | +// | | RouteCreate | | +// | |--------------------------->| // The order of these events may vary +// | | | | +// | RESTSubResp | | | // The order of these events may vary +// |<----------------| | | +// | | RouteResponse| | +// | |<---------------------------| // The order of these events may vary +// | | | | +// | | SubReq | | +// | |------------->| | // The order of these events may vary +// | | | | +// | | SubResp | | +// | |<-------------| | +// | RESTNotif1 | | | +// |<----------------| | | +// | | | | +// | RESTSubDelReq | | | +// |---------------->| | | +// | | SubDelReq | | +// | |------------->| | +// | | | | +// | RESTSubDelResp| | | +// |<----------------| | | // The order of these events may vary +// | | | | +// | | SubDelResp | | +// | |<-------------| | // 1.st NOK +// | | | | +// | | SubDelReq | | +// | |------------->| | +// | | | | +// | | SubDelResp | | +// | |<-------------| | // 2.nd NOK +// +//----------------------------------------------------------------------------- + +func TestRESTSubReqAndE1apDeleteRespUnpackingError(t *testing.T) { + + restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil) + + xappConn1.SendRESTSubsDelReq(t, &restSubId) + e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_RESP, false) + delreq, delmsg := e2termConn1.RecvSubsDelReq(t) + e2termConn1.SendSubsDelResp(t, delreq, delmsg) + + delreq, delmsg = e2termConn1.RecvSubsDelReq(t) + e2termConn1.SendSubsDelResp(t, delreq, delmsg) + + defer e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_RESP, true) + + waitSubsCleanup(t, e2SubsId, 10) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -301,6 +735,7 @@ func TestSubMergeDelAndRouteUpdateNok(t *testing.T) { // Init counter check mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cSubReqFromXapp, 2}, + Counter{cMergedSubscriptions, 1}, Counter{cSubReqToE2, 1}, Counter{cSubRespFromE2, 1}, Counter{cSubRespToXapp, 2}, @@ -309,6 +744,7 @@ func TestSubMergeDelAndRouteUpdateNok(t *testing.T) { Counter{cSubDelReqToE2, 1}, Counter{cSubDelRespFromE2, 1}, Counter{cSubDelRespToXapp, 2}, + Counter{cUnmergedSubscriptions, 1}, }) //Req1 @@ -835,6 +1271,7 @@ func TestSubReqRetryInSubmgr(t *testing.T) { mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cSubReqFromXapp, 1}, Counter{cSubReqToE2, 1}, + Counter{cSubReqTimerExpiry, 1}, Counter{cSubReReqToE2, 1}, Counter{cSubRespFromE2, 1}, Counter{cSubRespToXapp, 1}, @@ -1021,12 +1458,6 @@ func TestSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { // | | SubFail | // | |<-------------| // | | | -// | | SubDelReq | -// | |------------->| -// | | | -// | | SubDelResp | -// | |<-------------| -// | | | // | SubFail | | // |<-------------| | // | | | @@ -1052,10 +1483,6 @@ func TestSubReqSubFailRespInSubmgr(t *testing.T) { fparams1.Set(crereq1) e2termConn1.SendSubsFail(t, fparams1, cremsg1) - // E2t: Receive SubsDelReq and send SubsDelResp (internal first) - delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) - e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) - // Xapp: Receive SubsFail e2SubsId := xappConn1.RecvSubsFail(t, cretrans) @@ -1330,8 +1757,6 @@ func TestSubReqAndSubDelOkSameAction(t *testing.T) { rparams2 := &teststube2ap.E2StubSubsReqParams{} rparams2.Init() cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) - //crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) - //e2termConn1.SendSubsResp(t, crereq2, cremsg2) e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) resp, _ := xapp.Subscription.QuerySubscriptions() @@ -1341,11 +1766,7 @@ func TestSubReqAndSubDelOkSameAction(t *testing.T) { //Del1 deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) - //e2termConn1.RecvSubsDelReq(t) - //e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) xappConn1.RecvSubsDelResp(t, deltrans1) - //Wait that subs is cleaned - //mainCtrl.wait_subs_clean(t, e2SubsId1, 10) //Del2 deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) @@ -1467,11 +1888,6 @@ func TestSubReqAndSubDelOkSameActionParallel(t *testing.T) { // | | | SubFail1 | // | | |<-------------| // | | | | -// | | | SubDelReq | -// | | |------------->| -// | | | SubDelResp | -// | | |<-------------| -// | | | | // | | SubFail1 | | // | |<-------------| | // | | | | @@ -1502,10 +1918,6 @@ func TestSubReqAndSubDelNokSameActionParallel(t *testing.T) { fparams1.Set(crereq1) e2termConn1.SendSubsFail(t, fparams1, cremsg1) - // E2t: internal delete - delreq, delmsg := e2termConn1.RecvSubsDelReq(t) - e2termConn1.SendSubsDelResp(t, delreq, delmsg) - //Fail1 e2SubsId1 := xappConn1.RecvSubsFail(t, cretrans1) //Fail2 @@ -1980,6 +2392,7 @@ func TestSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { mainCtrl.SimulateRestart(t) xapp.Logger.Debug("mainCtrl.SimulateRestart done") + // Submgr send delete for uncompleted subscription delreq, delmsg := e2termConn1.RecvSubsDelReq(t) e2termConn1.SendSubsDelResp(t, delreq, delmsg) @@ -2216,6 +2629,11 @@ func TestPostEmptyDb(t *testing.T) { mainCtrl.sendPostRequest(t, "localhost:8080", "/ric/v1/test/emptydb") } +func TestGetRestSubscriptions(t *testing.T) { + + mainCtrl.sendGetRequest(t, "localhost:8080", "/ric/v1/restsubscriptions") +} + //----------------------------------------------------------------------------- // TestRESTSubReqAndRouteNok // @@ -2251,14 +2669,16 @@ func TestRESTSubReqAndRouteNok(t *testing.T) { CaseBegin("TestRESTSubReqAndRouteNok") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cSubReqFromXapp, 1}, + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, Counter{cRouteCreateFail, 1}, - Counter{cSubRespToXapp, 1}, - Counter{cSubDelReqFromXapp, 1}, - Counter{cSubDelRespToXapp, 1}, + Counter{cRestSubFailNotifToXapp, 1}, + Counter{cRestSubDelReqFromXapp, 1}, + Counter{cRestSubDelRespToXapp, 1}, }) const subReqCount int = 1 + // Add delay for rtmgt HTTP handling so that HTTP response is received before notify on XAPP side waiter := rtmgrHttp.AllocNextSleep(50, false) newSubsId := mainCtrl.get_registry_next_subid(t) @@ -2266,11 +2686,11 @@ 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) - xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", e2SubsId) + xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) // Del xappConn1.SendRESTSubsDelReq(t, &restSubId) @@ -2279,6 +2699,7 @@ func TestRESTSubReqAndRouteNok(t *testing.T) { mainCtrl.wait_subs_clean(t, newSubsId, 10) waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } func TestRESTSubReqAndRouteUpdateNok(t *testing.T) { @@ -2286,15 +2707,17 @@ func TestRESTSubReqAndRouteUpdateNok(t *testing.T) { //Init counter check mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cSubReqFromXapp, 2}, + Counter{cRestSubReqFromXapp, 2}, + Counter{cRestSubRespToXapp, 2}, Counter{cSubReqToE2, 1}, Counter{cSubRespFromE2, 1}, - Counter{cSubRespToXapp, 2}, + Counter{cRestSubNotifToXapp, 1}, + Counter{cRestSubFailNotifToXapp, 1}, Counter{cRouteCreateUpdateFail, 1}, - Counter{cSubDelReqFromXapp, 1}, + Counter{cRestSubDelReqFromXapp, 1}, Counter{cSubDelReqToE2, 1}, Counter{cSubDelRespFromE2, 1}, - Counter{cSubDelRespToXapp, 1}, + Counter{cRestSubDelRespToXapp, 1}, }) var params *teststube2ap.RESTSubsReqParams = nil @@ -2310,8 +2733,8 @@ func TestRESTSubReqAndRouteUpdateNok(t *testing.T) { params = xappConn2.GetRESTSubsReqReportParams(subReqCount) 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) + xapp.Logger.Debug("Send REST subscriber request for second subscriber : %v", restSubId2) + xappConn2.ExpectRESTNotificationNok(t, restSubId2, "allFail") waiter.WaitResult(t) // e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) - TOD: missing delete xappConn2.WaitRESTNotification(t, restSubId2) @@ -2325,6 +2748,7 @@ func TestRESTSubReqAndRouteUpdateNok(t *testing.T) { waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) //This test case is not working correctly } func TestRESTSubDelReqAndRouteDeleteNok(t *testing.T) { @@ -2332,15 +2756,16 @@ func TestRESTSubDelReqAndRouteDeleteNok(t *testing.T) { // Init counter check mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cSubReqFromXapp, 1}, + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, Counter{cSubReqToE2, 1}, Counter{cSubRespFromE2, 1}, - Counter{cSubRespToXapp, 1}, - Counter{cSubDelReqFromXapp, 1}, + Counter{cRestSubNotifToXapp, 1}, + Counter{cRestSubDelReqFromXapp, 1}, Counter{cRouteDeleteFail, 1}, Counter{cSubDelReqToE2, 1}, Counter{cSubDelRespFromE2, 1}, - Counter{cSubDelRespToXapp, 1}, + Counter{cRestSubDelRespToXapp, 1}, }) var params *teststube2ap.RESTSubsReqParams = nil @@ -2359,21 +2784,25 @@ func TestRESTSubDelReqAndRouteDeleteNok(t *testing.T) { waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) + ////mainCtrl.VerifyAllClean(t) This test case is not working correctly } func TestRESTSubMergeDelAndRouteUpdateNok(t *testing.T) { CaseBegin("TestRESTSubMergeDelAndRouteUpdateNok") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cSubReqFromXapp, 2}, + Counter{cRestSubReqFromXapp, 2}, + Counter{cMergedSubscriptions, 1}, + Counter{cRestSubRespToXapp, 2}, Counter{cSubReqToE2, 1}, Counter{cSubRespFromE2, 1}, - Counter{cSubRespToXapp, 2}, - Counter{cSubDelReqFromXapp, 2}, + Counter{cRestSubNotifToXapp, 2}, + Counter{cRestSubDelReqFromXapp, 2}, Counter{cRouteDeleteUpdateFail, 1}, Counter{cSubDelReqToE2, 1}, Counter{cSubDelRespFromE2, 1}, - Counter{cSubDelRespToXapp, 2}, + Counter{cRestSubDelRespToXapp, 2}, + Counter{cUnmergedSubscriptions, 1}, }) var params *teststube2ap.RESTSubsReqParams = nil @@ -2397,8 +2826,8 @@ func TestRESTSubMergeDelAndRouteUpdateNok(t *testing.T) { deleteXapp2Subscription(t, &restSubId2) waitSubsCleanup(t, e2SubsId2, 10) - mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -2420,19 +2849,13 @@ func TestRESTSubMergeDelAndRouteUpdateNok(t *testing.T) { // | RESTSubReq2 | | // | (retrans) | | // |---------------->| | -// | | | -// | | SubReq2 | -// | |------------->| -// | RESTSubResp2 | | +// | RESTSubResp(201)| | // |<----------------| | +// | | | // | | SubResp1 | // | |<-------------| // | RESTNotif1 | | // |<----------------| | -// | | SubResp1 | -// | |<-------------| -// | RESTNotif2 | | -// |<----------------| | // | | | // | [SUBS DELETE] | // | | | @@ -2443,16 +2866,17 @@ func TestRESTSubReqRetransmission(t *testing.T) { CaseBegin("TestRESTSubReqRetransmission") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cSubReqFromXapp, 2}, - Counter{cSubReqToE2, 2}, - Counter{cSubRespFromE2, 2}, - Counter{cSubRespToXapp, 2}, - Counter{cSubDelReqFromXapp, 2}, - Counter{cSubDelReqToE2, 2}, - Counter{cSubDelRespFromE2, 2}, - Counter{cSubDelRespToXapp, 2}, + Counter{cRestSubReqFromXapp, 2}, + Counter{cRestSubRespToXapp, 2}, + Counter{cSubReqToE2, 1}, + Counter{cSubRespFromE2, 1}, + Counter{cRestSubNotifToXapp, 1}, + Counter{cRestSubDelReqFromXapp, 1}, + Counter{cSubDelReqToE2, 1}, + Counter{cSubDelRespFromE2, 1}, + Counter{cRestSubDelRespToXapp, 1}, }) - // Retry/duplicate will get the same way as the first request. Submgr cannot detect duplicate RESTRequests + // Retry/duplicate will get the same way as the first request. // Contianed duplicate messages from same xapp will not be merged. Here we use xappConn2 to simulate sending // second request from same xapp as doing it from xappConn1 would not work as notification would not be received @@ -2464,53 +2888,601 @@ func TestRESTSubReqRetransmission(t *testing.T) { waiter := rtmgrHttp.AllocNextSleep(10, true) params := xappConn1.GetRESTSubsReqReportParams(subReqCount) restSubId1 := xappConn1.SendRESTSubsReq(t, params) - restSubId2 := xappConn2.SendRESTSubsReq(t, params) + xappConn2.SendRESTSubsReq(t, params) waiter.WaitResult(t) - xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) + xappConn1.WaitListedRestNotifications(t, []string{restSubId1}) // Depending one goroutine scheduling order, we cannot say for sure which xapp reaches e2term first. Thus // the order is not significant he6re. crereq, cremsg := e2termConn1.RecvSubsReq(t) e2termConn1.SendSubsResp(t, crereq, cremsg) - crereq, cremsg = e2termConn1.RecvSubsReq(t) - e2termConn1.SendSubsResp(t, crereq, cremsg) e2SubsIdA := <-xappConn1.ListedRESTNotifications - xapp.Logger.Info("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) - e2SubsIdB := <-xappConn1.ListedRESTNotifications - xapp.Logger.Info("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) + xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) // Del1 xappConn1.SendRESTSubsDelReq(t, &restSubId1) delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) - // Del2 - xappConn2.SendRESTSubsDelReq(t, &restSubId2) - delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) - e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) + mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsIdA.E2SubsId}, 10) - mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsIdA.E2SubsId, e2SubsIdB.E2SubsId}, 10) + mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) +} - waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) +//----------------------------------------------------------------------------- +// stub stub stub +// +-------+ +---------+ +---------+ +---------+ +// | xapp | | submgr | | e2term | | rtmgr | +// +-------+ +---------+ +---------+ +---------+ +// | | | | +// | RESTSubReq | | | +// |---------------->| | | +// | RESTSubResp | | | +// |<----------------| | | +// | | RouteCreate | | +// | |--------------------------->| +// | | RouteResponse| | +// | |<---------------------------| // The order of these events may vary +// | | SubReq | | +// | |------------->| | // The order of these events may vary +// | | SubResp | | +// | |<-------------| | +// | RESTNotif1 | | | +// |<----------------| | | +// | RESTSubReq | | | +// | [RETRANS1] | | | +// |---------------->| | | +// | RESTNotif1 | | | +// |<----------------| | | +// | RESTSubReq | | | +// | [RETRANS2] | | | +// |---------------->| | | +// | RESTNotif1 | | | +// |<----------------| | | +// | RESTSubDelReq | | | +// |---------------->| | | +// | | SubDelReq | | +// | |------------->| | +// | RESTSubDelResp| | | +// |<----------------| | | +// | | SubDelResp | | +// | |<-------------| | +// | | | | +// +//----------------------------------------------------------------------------- + +func TestRESTSubReqRetransmissionV2(t *testing.T) { + CaseBegin("TestRESTSubReqRetransmissionV2") + + mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ + Counter{cRestSubReqFromXapp, 3}, + Counter{cDuplicateE2SubReq, 2}, + Counter{cRestSubRespToXapp, 3}, + Counter{cSubReqToE2, 1}, + Counter{cSubRespFromE2, 1}, + Counter{cRestSubNotifToXapp, 3}, + Counter{cRestSubDelReqFromXapp, 1}, + Counter{cSubDelReqToE2, 1}, + Counter{cSubDelRespFromE2, 1}, + Counter{cRestSubDelRespToXapp, 1}, + }) + + params := xappConn1.GetRESTSubsReqReportParams(subReqCount) + + restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) + + queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) + + //1.st resend + restSubId_resend := xappConn1.SendRESTSubsReq(t, params) + + assert.Equal(t, restSubId_resend, restSubId) + + <-time.After(100 * time.Millisecond) + + //2.nd resend + restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) + + assert.Equal(t, restSubId_resend2, restSubId) + + <-time.After(100 * time.Millisecond) + + deleteSubscription(t, xappConn1, e2termConn1, &restSubId) + + waitSubsCleanup(t, e2SubsId, 10) + + //Wait that subs is cleaned + mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) +} + +//----------------------------------------------------------------------------- +// stub stub stub +// +-------+ +---------+ +---------+ +---------+ +// | xapp | | submgr | | e2term | | rtmgr | +// +-------+ +---------+ +---------+ +---------+ +// | | | | +// | RESTSubReq | | | +// |---------------->| | | +// | RESTSubResp | | | +// |<----------------| | | +// | | RouteCreate | | +// | |--------------------------->| +// | | RouteResponse| | +// | |<---------------------------| // The order of these events may vary +// | | SubReq | | +// | |------------->| | // The order of these events may vary +// | | SubResp | | +// | |<-------------| | +// | RESTNotif1 | | | +// |<----------------| | | +// | RESTSubReq | | | +// | [RETRANS, with RESTsubsId] | | +// |---------------->| | | +// | RESTNotif1 | | | +// |<----------------| | | +// | RESTSubReq | | | +// | [RETRANS, without RESTsubsId] | | +// |---------------->| | | +// | RESTNotif1 | | | +// |<----------------| | | +// | RESTSubDelReq | | | +// |---------------->| | | +// | | SubDelReq | | +// | |------------->| | +// | RESTSubDelResp| | | +// |<----------------| | | +// | | SubDelResp | | +// | |<-------------| | +// | | | | +// +//----------------------------------------------------------------------------- +func TestRESTSubReqRetransmissionV3(t *testing.T) { + CaseBegin("TestRESTSubReqRetransmissionV3") + + mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ + Counter{cRestSubReqFromXapp, 3}, + Counter{cDuplicateE2SubReq, 2}, + Counter{cRestSubRespToXapp, 3}, + Counter{cSubReqToE2, 1}, + Counter{cSubRespFromE2, 1}, + Counter{cRestSubNotifToXapp, 3}, + Counter{cRestSubDelReqFromXapp, 1}, + Counter{cSubDelReqToE2, 1}, + Counter{cSubDelRespFromE2, 1}, + Counter{cRestSubDelRespToXapp, 1}, + }) + + params := xappConn1.GetRESTSubsReqReportParams(subReqCount) + + restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) + + queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) + + <-time.After(100 * time.Millisecond) + + //1.st resend with subscription ID + params.SetSubscriptionID(&restSubId) + restSubId_resend := xappConn1.SendRESTSubsReq(t, params) + + assert.Equal(t, restSubId_resend, restSubId) + + <-time.After(100 * time.Millisecond) + + //2.nd resend without subscription ID (faking app restart) + params = xappConn1.GetRESTSubsReqReportParams(subReqCount) + restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) + + assert.Equal(t, restSubId_resend2, restSubId) + + <-time.After(100 * time.Millisecond) + + deleteSubscription(t, xappConn1, e2termConn1, &restSubId) + + waitSubsCleanup(t, e2SubsId, 10) + + //Wait that subs is cleaned + mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) +} + +//----------------------------------------------------------------------------- +// stub stub stub +// +-------+ +---------+ +---------+ +---------+ +// | xapp | | submgr | | e2term | | rtmgr | +// +-------+ +---------+ +---------+ +---------+ +// | | | | +// | RESTSubReq | | | +// |---------------->| | | +// | RESTSubResp | | | +// |<----------------| | | +// | | RouteCreate | | +// | |--------------------------->| +// | | RouteResponse| | +// | |<---------------------------| +// | | SubReq | | +// | |------------->| | +// | | SubResp | | +// | |<-------------| | +// | RESTNotif1 | | | +// |<----------------| | | +// | RESTSubReq | | | +// | [with RestSUbsId + one additional e2 subDetail] +// |---------------->| | | +// | RESTNotif1 | | | +// | [for initial e2 subDetail] | | +// |<----------------| | | +// | | RouteCreate | | +// | |--------------------------->| +// | | RouteResponse| | +// | |<---------------------------| +// | | SubReq | | +// | |------------->| | +// | | SubResp | | +// | |<-------------| | +// | RESTNotif1 | | | +// |<----------------| | | +// | RESTSubReq | | | +// | [with RESTsubsId initial request] | +// |---------------->| | | +// | RESTNotif1 | | | +// |<----------------| | | +// | RESTSubDelReq | | | +// |---------------->| | | +// | RESTSubDelResp| | | +// |<----------------| | | +// | | SubDelReq | | +// | |------------->| | +// | | SubDelResp | | +// | |<-------------| | +// | | SubDelReq | | +// | |------------->| | +// | | SubDelResp | | +// | |<-------------| | +// | | | | +// +//----------------------------------------------------------------------------- + +func TestRESTSubReqRetransmissionV4(t *testing.T) { + CaseBegin("TestRESTSubReqRetransmissionV4") + + mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ + Counter{cRestSubReqFromXapp, 3}, + Counter{cDuplicateE2SubReq, 2}, + Counter{cRestSubRespToXapp, 3}, + Counter{cSubReqToE2, 2}, + Counter{cSubRespFromE2, 2}, + Counter{cRestSubNotifToXapp, 4}, + Counter{cRestSubDelReqFromXapp, 1}, + Counter{cSubDelReqToE2, 2}, + Counter{cSubDelRespFromE2, 2}, + Counter{cRestSubDelRespToXapp, 1}, + }) + + params := xappConn1.GetRESTSubsReqReportParams(subReqCount) + + restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) + + <-time.After(100 * time.Millisecond) + + // Send modified requst, this time with e2 subscriptions. + params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) + params2.SetSubscriptionID(&restSubId) + + xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) + xappConn1.ExpectAnyNotification(t) + // Resend the original request with an additional e2 subscription (detail), this time with restsubsid + restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) + e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) + assert.Equal(t, e2SubsId, e2SubsId1) + + crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) + + xappConn1.DecrementRequestCount() + xappConn1.ExpectRESTNotification(t, restSubId_resend) + e2termConn1.SendSubsResp(t, crereq2, cremsg2) + e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) + assert.NotEqual(t, e2SubsId2, 0) + + <-time.After(100 * time.Millisecond) + + xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) + params = xappConn1.GetRESTSubsReqReportParams(subReqCount) + params.SetSubscriptionID(&restSubId) + xappConn1.ExpectAnyNotification(t) + // Resend the original request again with only one e2 subscription (detail), this time with restsubsid + restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) + assert.Equal(t, restSubId_resend, restSubId_resend2) + + e2SubsId1 = xappConn1.WaitAnyRESTNotification(t) + assert.Equal(t, e2SubsId, e2SubsId1) + + // Delete both e2 subscriptions + xappConn1.SendRESTSubsDelReq(t, &restSubId) + e2SubsIds := []uint32{e2SubsId, e2SubsId2} + sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) + + waitSubsCleanup(t, e2SubsId, 10) + + //Wait that subs is cleaned + mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) +} + +//----------------------------------------------------------------------------- +// stub stub stub +// +-------+ +---------+ +---------+ +---------+ +// | xapp | | submgr | | e2term | | rtmgr | +// +-------+ +---------+ +---------+ +---------+ +// | | | | +// | RESTSubReq | | | +// |---------------->| | | +// | RESTSubResp | | | +// |<----------------| | | +// | | RouteCreate | | +// | |--------------------------->| +// | | RouteResponse| | +// | |<---------------------------| +// | | SubReq | | +// | |------------->| | +// | | SubResp | | +// | |<-------------| | +// | RESTNotif1 | | | +// |<----------------| | | +// | RESTSubReq | | | +// | [with RestSUbsId + one additional e2 subDetail] +// |---------------->| | | +// | RESTNotif1 | | | +// | [for initial e2 subDetail] | | +// |<----------------| | | +// | | RouteCreate | | +// | |--------------------------->| +// | | RouteResponse| | +// | |<---------------------------| +// | | SubReq | | +// | |------------->| | +// | | SubResp | | +// | |<-------------| | +// | RESTNotif1 | | | +// |<----------------| | | +// | RESTSubReq | | | +// | [without RESTsubsId initial request] | +// |---------------->| | | +// | RESTNotif1 | | | +// |<----------------| | | +// | RESTSubDelReq | | | +// |---------------->| | | +// | RESTSubDelResp| | | +// |<----------------| | | +// | | SubDelReq | | +// | |------------->| | +// | | SubDelResp | | +// | |<-------------| | +// | | SubDelReq | | +// | |------------->| | +// | | SubDelResp | | +// | |<-------------| | +// | | | | +// +//----------------------------------------------------------------------------- + +func TestRESTSubReqRetransmissionV5(t *testing.T) { + CaseBegin("TestRESTSubReqRetransmissionV5") + + mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ + Counter{cRestSubReqFromXapp, 3}, + Counter{cDuplicateE2SubReq, 2}, + Counter{cRestSubRespToXapp, 3}, + Counter{cSubReqToE2, 2}, + Counter{cSubRespFromE2, 2}, + Counter{cRestSubNotifToXapp, 4}, + Counter{cRestSubDelReqFromXapp, 1}, + Counter{cSubDelReqToE2, 2}, + Counter{cSubDelRespFromE2, 2}, + Counter{cRestSubDelRespToXapp, 1}, + }) + + params := xappConn1.GetRESTSubsReqReportParams(subReqCount) + + restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) + + <-time.After(100 * time.Millisecond) + + // Send modified requst, this time with e2 subscriptions. + params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) + params2.SetSubscriptionID(&restSubId) + + xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) + xappConn1.ExpectAnyNotification(t) + // Resend the original request with an additional e2 subscription (detail), this time with restsubsid + restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) + + e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) + assert.Equal(t, e2SubsId, e2SubsId1) + // The first E2 subscription returns immediately, manually decrement expected request count for the remaining request handling + xappConn1.DecrementRequestCount() + + crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) + + xappConn1.ExpectRESTNotification(t, restSubId_resend) + e2termConn1.SendSubsResp(t, crereq2, cremsg2) + e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) + assert.NotEqual(t, e2SubsId2, 0) + + <-time.After(100 * time.Millisecond) + + xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) + params = xappConn1.GetRESTSubsReqReportParams(subReqCount) + xappConn1.ExpectAnyNotification(t) + // Resend the original request again with only one e2 subscription (detail), WITHOUT restsubsid + // md5sum shall find the original request + restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) + assert.Equal(t, restSubId_resend, restSubId_resend2) + + e2SubsId1 = xappConn1.WaitAnyRESTNotification(t) + assert.Equal(t, e2SubsId, e2SubsId1) + + // Delete both e2 subscriptions + xappConn1.SendRESTSubsDelReq(t, &restSubId) + e2SubsIds := []uint32{e2SubsId, e2SubsId2} + sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) + + waitSubsCleanup(t, e2SubsId, 10) + + //Wait that subs is cleaned + mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) +} + +//----------------------------------------------------------------------------- +// stub stub stub +// +-------+ +---------+ +---------+ +---------+ +// | xapp | | submgr | | e2term | | rtmgr | +// +-------+ +---------+ +---------+ +---------+ +// | | | | +// | RESTSubReq | | | +// |---------------->| | | +// | RESTSubResp | | | +// |<----------------| | | +// | | RouteCreate | | +// | |--------------------------->| +// | | RouteResponse| | +// | |<---------------------------| +// | | SubReq | | +// | |------------->| | +// | | SubResp | | +// | |<-------------| | +// | RESTNotif1 | | | +// |<----------------| | | +// | RESTSubReq | | | +// | [with RestSUbsId + one additional e2 subDetail] +// |---------------->| | | +// | RESTNotif1 | | | +// | [for initial e2 subDetail] | | +// |<----------------| | | +// | | RouteCreate | | +// | |--------------------------->| +// | | RouteResponse| | +// | |<---------------------------| +// | | SubReq | | +// | |------------->| | +// | | SubResp | | +// | |<-------------| | +// | RESTNotif1 | | | +// |<----------------| | | +// | RESTSubDelReq | | | +// |---------------->| | | +// | RESTSubDelResp| | | +// |<----------------| | | +// | | SubDelReq | | +// | |------------->| | +// | | SubDelResp | | +// | |<-------------| | +// | | SubDelReq | | +// | |------------->| | +// | | SubDelResp | | +// | |<-------------| | +// | RESTSubReq | | | +// | [with RESTsubsId initial request] | +// |---------------->| | | +// | RESTSubResp | | | +// |<----------------| | | +// | | RouteCreate | | +// | |--------------------------->| +// | | RouteResponse| | +// | |<---------------------------| +// | | SubReq | | +// | |------------->| | +// | | SubResp | | +// | |<-------------| | +// | RESTNotif1 | | | +// |<----------------| | | +// | | | | +// +//----------------------------------------------------------------------------- +func TestRESTSubReqRetransmissionV6(t *testing.T) { + CaseBegin("TestRESTSubReqRetransmissionV6") + + mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ + Counter{cRestSubReqFromXapp, 3}, + Counter{cDuplicateE2SubReq, 1}, + Counter{cRestSubRespToXapp, 3}, + Counter{cSubReqToE2, 3}, + Counter{cSubRespFromE2, 3}, + Counter{cRestSubNotifToXapp, 4}, + Counter{cRestSubDelReqFromXapp, 2}, + Counter{cSubDelReqToE2, 3}, + Counter{cSubDelRespFromE2, 3}, + Counter{cRestSubDelRespToXapp, 2}, + }) + + params := xappConn1.GetRESTSubsReqReportParams(subReqCount) + + restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) + + <-time.After(100 * time.Millisecond) + + // Send modified requst, this time with e2 subscriptions. + params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) + params2.SetSubscriptionID(&restSubId) + + xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) + xappConn1.ExpectAnyNotification(t) + // Resend the original request with an additional e2 subscription (detail), this time with restsubsid + restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) + + e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) + assert.Equal(t, e2SubsId, e2SubsId1) + + crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) + + xappConn1.ExpectRESTNotification(t, restSubId_resend) + e2termConn1.SendSubsResp(t, crereq2, cremsg2) + e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) + assert.NotEqual(t, e2SubsId2, 0) + + <-time.After(100 * time.Millisecond) + + // Delete both e2 subscriptions + xappConn1.SendRESTSubsDelReq(t, &restSubId) + e2SubsIds := []uint32{e2SubsId, e2SubsId2} + sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) + + waitSubsCleanup(t, e2SubsId, 10) + + // Resend the original request, we shall find it's previous md5sum/restsubs + // but the restsubscription has been already removed. This shall trigger a + // fresh create. + restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params) + + <-time.After(100 * time.Millisecond) + deleteSubscription(t, xappConn1, e2termConn1, &restSubId) + + waitSubsCleanup(t, e2SubsId, 10) + + //Wait that subs is cleaned mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } func TestRESTSubDelReqRetransmission(t *testing.T) { CaseBegin("TestRESTSubDelReqRetransmission") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cSubReqFromXapp, 1}, + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, Counter{cSubReqToE2, 1}, Counter{cSubRespFromE2, 1}, - Counter{cSubRespToXapp, 1}, - Counter{cSubDelReqFromXapp, 2}, + Counter{cRestSubNotifToXapp, 1}, + Counter{cRestSubDelReqFromXapp, 2}, Counter{cSubDelReqToE2, 1}, Counter{cSubDelRespFromE2, 1}, - Counter{cSubDelRespToXapp, 1}, + Counter{cRestSubDelRespToXapp, 2}, }) var params *teststube2ap.RESTSubsReqParams = nil @@ -2533,6 +3505,7 @@ func TestRESTSubDelReqRetransmission(t *testing.T) { waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -2568,14 +3541,16 @@ func TestRESTSubReqDelReq(t *testing.T) { CaseBegin("TestRESTSubReqDelReq") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cSubReqFromXapp, 1}, + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, Counter{cSubReqToE2, 1}, Counter{cSubRespFromE2, 1}, - Counter{cSubRespToXapp, 1}, - Counter{cSubDelReqFromXapp, 2}, + Counter{cRestSubNotifToXapp, 1}, + Counter{cRestSubDelReqFromXapp, 2}, + Counter{cRestSubDelFailToXapp, 1}, Counter{cSubDelReqToE2, 1}, Counter{cSubDelRespFromE2, 1}, - Counter{cSubDelRespToXapp, 1}, + Counter{cRestSubDelRespToXapp, 1}, }) const subReqCount int = 1 @@ -2602,7 +3577,7 @@ func TestRESTSubReqDelReq(t *testing.T) { // Wait that subs is cleaned waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) - + //mainCtrl.VerifyAllClean(t) } func TestRESTSubDelReqCollision(t *testing.T) { @@ -2613,25 +3588,26 @@ func TestRESTSubReqAndSubDelOkTwoParallel(t *testing.T) { CaseBegin("TestRESTSubReqAndSubDelOkTwoParallel") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cSubReqFromXapp, 2}, + Counter{cRestSubReqFromXapp, 2}, + Counter{cRestSubRespToXapp, 2}, Counter{cSubReqToE2, 2}, Counter{cSubRespFromE2, 2}, - Counter{cSubRespToXapp, 2}, - Counter{cSubDelReqFromXapp, 2}, + Counter{cRestSubNotifToXapp, 2}, + Counter{cRestSubDelReqFromXapp, 2}, Counter{cSubDelReqToE2, 2}, Counter{cSubDelRespFromE2, 2}, - Counter{cSubDelRespToXapp, 2}, + Counter{cRestSubDelRespToXapp, 2}, }) //Req1 params := xappConn1.GetRESTSubsReqReportParams(subReqCount) restSubId1 := xappConn1.SendRESTSubsReq(t, params) - xapp.Logger.Info("Send 1st REST subscriber request for subscriberId : %v", restSubId1) + xapp.Logger.Debug("Send 1st REST subscriber request for subscriberId : %v", restSubId1) //Req2 params = xappConn2.GetRESTSubsReqReportParams(subReqCount) restSubId2 := xappConn2.SendRESTSubsReq(t, params) - xapp.Logger.Info("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) + xapp.Logger.Debug("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) @@ -2645,9 +3621,9 @@ func TestRESTSubReqAndSubDelOkTwoParallel(t *testing.T) { e2termConn1.SendSubsResp(t, crereq2, cremsg2) e2SubsIdA := <-xappConn1.ListedRESTNotifications - xapp.Logger.Info("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) + xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) e2SubsIdB := <-xappConn1.ListedRESTNotifications - xapp.Logger.Info("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) + xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) //Del1 deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) @@ -2659,31 +3635,32 @@ func TestRESTSubReqAndSubDelOkTwoParallel(t *testing.T) { waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) mainCtrl.VerifyCounterValues(t) - + //mainCtrl.VerifyAllClean(t) } func TestRESTSameSubsDiffRan(t *testing.T) { CaseBegin("TestRESTSameSubsDiffRan") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cSubReqFromXapp, 2}, + Counter{cRestSubReqFromXapp, 2}, + Counter{cRestSubRespToXapp, 2}, Counter{cSubReqToE2, 2}, Counter{cSubRespFromE2, 2}, - Counter{cSubRespToXapp, 2}, - Counter{cSubDelReqFromXapp, 2}, + Counter{cRestSubNotifToXapp, 2}, + Counter{cRestSubDelReqFromXapp, 2}, Counter{cSubDelReqToE2, 2}, Counter{cSubDelRespFromE2, 2}, - Counter{cSubDelRespToXapp, 2}, + Counter{cRestSubDelRespToXapp, 2}, }) params := xappConn1.GetRESTSubsReqReportParams(subReqCount) restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) - xapp.Logger.Info("Send 1st REST subscriber request for subscriberId : %v", restSubId1) + xapp.Logger.Debug("Send 1st REST subscriber request for subscriberId : %v", restSubId1) params = xappConn1.GetRESTSubsReqReportParams(subReqCount) params.SetMeid("RAN_NAME_2") restSubId2, e2SubsId2 := createSubscription(t, xappConn1, e2termConn1, params) - xapp.Logger.Info("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) + xapp.Logger.Debug("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) //Del1 deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) @@ -2695,7 +3672,7 @@ func TestRESTSameSubsDiffRan(t *testing.T) { waitSubsCleanup(t, e2SubsId2, 10) mainCtrl.VerifyCounterValues(t) - + //mainCtrl.VerifyAllClean(t) } func TestRESTSubReqRetryInSubmgr(t *testing.T) { @@ -2703,25 +3680,27 @@ func TestRESTSubReqRetryInSubmgr(t *testing.T) { // Init counter check mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cSubReqFromXapp, 1}, + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, Counter{cSubReqToE2, 1}, + Counter{cSubReqTimerExpiry, 1}, Counter{cSubReReqToE2, 1}, Counter{cSubRespFromE2, 1}, - Counter{cSubRespToXapp, 1}, - Counter{cSubDelReqFromXapp, 1}, + Counter{cRestSubNotifToXapp, 1}, + Counter{cRestSubDelReqFromXapp, 1}, Counter{cSubDelReqToE2, 1}, Counter{cSubDelRespFromE2, 1}, - Counter{cSubDelRespToXapp, 1}, + Counter{cRestSubDelRespToXapp, 1}, }) params := xappConn1.GetRESTSubsReqReportParams(subReqCount) restSubId := xappConn1.SendRESTSubsReq(t, params) - xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId) + xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) // Catch the first message and ignore it crereq, cremsg := e2termConn1.RecvSubsReq(t) - xapp.Logger.Info("Ignore REST subscriber request for subscriber : %v", restSubId) + xapp.Logger.Debug("Ignore REST subscriber request for subscriber : %v", restSubId) // The second request is being handled normally crereq, cremsg = e2termConn1.RecvSubsReq(t) @@ -2738,7 +3717,7 @@ func TestRESTSubReqRetryInSubmgr(t *testing.T) { waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) - + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -2779,39 +3758,41 @@ func TestRESTSubReqRetryInSubmgr(t *testing.T) { // | | | // //----------------------------------------------------------------------------- + func TestRESTSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { CaseBegin("TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr start") // Init counter check mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cSubReqFromXapp, 1}, + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, Counter{cSubReqToE2, 1}, Counter{cSubReReqToE2, 1}, Counter{cSubReqTimerExpiry, 2}, + Counter{cRestSubFailNotifToXapp, 1}, Counter{cSubDelReqToE2, 1}, Counter{cSubDelRespFromE2, 1}, }) - params := xappConn1.GetRESTSubsReqReportParams(subReqCount) restSubId := xappConn1.SendRESTSubsReq(t, params) - xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId) + xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) e2termConn1.RecvSubsReq(t) - xapp.Logger.Info("Ignore 1st REST subscriber request for subscriber : %v", restSubId) + xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) e2termConn1.RecvSubsReq(t) - xapp.Logger.Info("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) + xapp.Logger.Debug("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 waitSubsCleanup(t, delreq.RequestId.InstanceId, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } func TestREST2eTermNotRespondingToSubReq(t *testing.T) { @@ -2819,37 +3800,39 @@ func TestREST2eTermNotRespondingToSubReq(t *testing.T) { // Init counter check mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cSubReqFromXapp, 1}, + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, Counter{cSubReqToE2, 1}, Counter{cSubReReqToE2, 1}, Counter{cSubReqTimerExpiry, 2}, + Counter{cSubDelReReqToE2, 1}, + Counter{cRestSubFailNotifToXapp, 1}, Counter{cSubDelReqToE2, 1}, Counter{cSubDelReqTimerExpiry, 2}, }) - params := xappConn1.GetRESTSubsReqReportParams(subReqCount) restSubId := xappConn1.SendRESTSubsReq(t, params) - xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId) + xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) e2termConn1.RecvSubsReq(t) - xapp.Logger.Info("Ignore 1st REST subscriber request for subscriber : %v", restSubId) + xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) e2termConn1.RecvSubsReq(t) - xapp.Logger.Info("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) + xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) e2termConn1.RecvSubsDelReq(t) - xapp.Logger.Info("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) + xapp.Logger.Debug("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) + xapp.Logger.Debug("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) - + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -2895,10 +3878,12 @@ func TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { // Init counter check mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cSubReqFromXapp, 1}, + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, Counter{cSubReqToE2, 1}, Counter{cSubReReqToE2, 1}, Counter{cSubReqTimerExpiry, 2}, + Counter{cRestSubFailNotifToXapp, 1}, Counter{cSubDelReqToE2, 1}, Counter{cSubDelReReqToE2, 1}, Counter{cSubDelReqTimerExpiry, 2}, @@ -2906,26 +3891,27 @@ func TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { params := xappConn1.GetRESTSubsReqReportParams(subReqCount) restSubId := xappConn1.SendRESTSubsReq(t, params) - xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId) + xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) e2termConn1.RecvSubsReq(t) - xapp.Logger.Info("Ignore 1st REST subscriber request for subscriber : %v", restSubId) + xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) e2termConn1.RecvSubsReq(t) - xapp.Logger.Info("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) + xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) e2termConn1.RecvSubsDelReq(t) - xapp.Logger.Info("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) + xapp.Logger.Debug("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) + xapp.Logger.Debug("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -2947,12 +3933,6 @@ func TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { // | | SubFail | // | |<-------------| // | | | -// | | SubDelReq | -// | |------------->| -// | | | -// | | SubDelResp | -// | |<-------------| -// | | | // | RESTNotif | | // | unsuccess | | // |<----------------| | @@ -2965,28 +3945,32 @@ func TestRESTSubReqSubFailRespInSubmgr(t *testing.T) { CaseBegin("TestRESTSubReqSubFailRespInSubmgr") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cSubReqFromXapp, 1}, + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, Counter{cSubReqToE2, 1}, Counter{cSubFailFromE2, 1}, - Counter{cSubRespToXapp, 1}, - Counter{cSubDelReqFromXapp, 1}, + Counter{cRestSubFailNotifToXapp, 1}, + Counter{cRestSubDelReqFromXapp, 1}, + Counter{cRestSubDelRespToXapp, 1}, }) const subReqCount int = 1 + const e2Timeout int64 = 2 + const e2RetryCount int64 = 1 + const routingNeeded bool = true params := xappConn1.GetRESTSubsReqReportParams(subReqCount) + params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) restSubId := xappConn1.SendRESTSubsReq(t, params) crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) fparams1 := &teststube2ap.E2StubSubsFailParams{} fparams1.Set(crereq1) + xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") e2termConn1.SendSubsFail(t, fparams1, cremsg1) - delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) - xappConn1.ExpectRESTNotification(t, restSubId) - e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) - xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", e2SubsId) + xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) // REST subscription sill there to be deleted xappConn1.SendRESTSubsDelReq(t, &restSubId) @@ -2995,7 +3979,7 @@ func TestRESTSubReqSubFailRespInSubmgr(t *testing.T) { waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) - + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -3029,15 +4013,17 @@ func TestRESTSubDelReqRetryInSubmgr(t *testing.T) { CaseBegin("TestRESTSubDelReqRetryInSubmgr") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cSubReqFromXapp, 1}, + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, Counter{cSubReqToE2, 1}, Counter{cSubRespFromE2, 1}, - Counter{cSubRespToXapp, 1}, - Counter{cSubDelReqFromXapp, 1}, + Counter{cRestSubNotifToXapp, 1}, + Counter{cRestSubDelReqFromXapp, 1}, Counter{cSubDelReqToE2, 1}, + Counter{cSubDelReqTimerExpiry, 1}, Counter{cSubDelReReqToE2, 1}, Counter{cSubDelRespFromE2, 1}, - Counter{cSubDelRespToXapp, 1}, + Counter{cRestSubDelRespToXapp, 1}, }) // Req var params *teststube2ap.RESTSubsReqParams = nil @@ -3057,6 +4043,7 @@ func TestRESTSubDelReqRetryInSubmgr(t *testing.T) { waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -3088,15 +4075,17 @@ func TestRESTSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { CaseBegin("TestRESTSubDelReTwoRetriesNoRespInSubmgr") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cSubReqFromXapp, 1}, + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, Counter{cSubReqToE2, 1}, Counter{cSubRespFromE2, 1}, - Counter{cSubRespToXapp, 1}, - Counter{cSubDelReqFromXapp, 1}, + Counter{cRestSubNotifToXapp, 1}, + Counter{cRestSubDelReqFromXapp, 1}, Counter{cSubDelReqToE2, 1}, + Counter{cSubDelReqTimerExpiry, 1}, Counter{cSubDelReReqToE2, 1}, Counter{cSubDelRespFromE2, 1}, - Counter{cSubDelRespToXapp, 1}, + Counter{cRestSubDelRespToXapp, 1}, }) // Req @@ -3117,6 +4106,7 @@ func TestRESTSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -3147,14 +4137,15 @@ func TestRESTSubDelReqSubDelFailRespInSubmgr(t *testing.T) { CaseBegin("TestRESTSubDelReqSubDelFailRespInSubmgr") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cSubReqFromXapp, 1}, + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, Counter{cSubReqToE2, 1}, Counter{cSubRespFromE2, 1}, - Counter{cSubRespToXapp, 1}, - Counter{cSubDelReqFromXapp, 1}, + Counter{cRestSubNotifToXapp, 1}, + Counter{cRestSubDelReqFromXapp, 1}, Counter{cSubDelReqToE2, 1}, Counter{cSubDelFailFromE2, 1}, - Counter{cSubDelRespToXapp, 1}, + Counter{cRestSubDelRespToXapp, 1}, }) // Req @@ -3172,6 +4163,7 @@ func TestRESTSubDelReqSubDelFailRespInSubmgr(t *testing.T) { waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -3228,16 +4220,17 @@ func TestRESTSubReqAndSubDelOkSameAction(t *testing.T) { CaseBegin("TestRESTSubReqAndSubDelOkSameAction") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cSubReqFromXapp, 2}, + Counter{cRestSubReqFromXapp, 2}, + Counter{cRestSubRespToXapp, 2}, Counter{cSubReqToE2, 1}, Counter{cSubRespFromE2, 1}, - Counter{cSubRespToXapp, 2}, + Counter{cRestSubNotifToXapp, 2}, Counter{cMergedSubscriptions, 1}, Counter{cUnmergedSubscriptions, 1}, - Counter{cSubDelReqFromXapp, 2}, + Counter{cRestSubDelReqFromXapp, 2}, Counter{cSubDelReqToE2, 1}, Counter{cSubDelRespFromE2, 1}, - Counter{cSubDelRespToXapp, 2}, + Counter{cRestSubDelRespToXapp, 2}, }) // Req1 @@ -3252,13 +4245,13 @@ func TestRESTSubReqAndSubDelOkSameAction(t *testing.T) { params.SetMeid("RAN_NAME_1") xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) - xappConn2.WaitRESTNotificationForAnySubscriptionId(t) + xappConn2.ExpectAnyNotification(t) waiter := rtmgrHttp.AllocNextSleep(10, true) restSubId2 := xappConn2.SendRESTSubsReq(t, params) waiter.WaitResult(t) - xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) - e2SubsId2 := <-xappConn2.RESTNotification - xapp.Logger.Info("REST notification received e2SubsId=%v", e2SubsId2) + xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) + e2SubsId2 := xappConn2.WaitAnyRESTNotification(t) + xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId2) queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) @@ -3272,6 +4265,7 @@ func TestRESTSubReqAndSubDelOkSameAction(t *testing.T) { waitSubsCleanup(t, e2SubsId2, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -3325,14 +4319,15 @@ func TestRESTSubReqAndSubDelOkSameActionParallel(t *testing.T) { CaseBegin("TestRESTSubReqAndSubDelOkSameActionParallel") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cSubReqFromXapp, 2}, + Counter{cRestSubReqFromXapp, 2}, + Counter{cRestSubRespToXapp, 2}, Counter{cSubReqToE2, 2}, Counter{cSubRespFromE2, 2}, - Counter{cSubRespToXapp, 2}, - Counter{cSubDelReqFromXapp, 2}, + Counter{cRestSubNotifToXapp, 2}, + Counter{cRestSubDelReqFromXapp, 2}, Counter{cSubDelReqToE2, 2}, Counter{cSubDelRespFromE2, 2}, - Counter{cSubDelRespToXapp, 2}, + Counter{cRestSubDelRespToXapp, 2}, }) params := xappConn1.GetRESTSubsReqReportParams(subReqCount) @@ -3365,6 +4360,7 @@ func TestRESTSubReqAndSubDelOkSameActionParallel(t *testing.T) { waitSubsCleanup(t, e2SubsId2, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -3387,7 +4383,7 @@ func TestRESTSubReqAndSubDelOkSameActionParallel(t *testing.T) { // | RESTSubReq2 | | // |------------------------------>| | // | | | | -// | RESTSubDelResp2 | | +// | RESTSubResp2 | | // |<------------------------------| | // | | | SubReq1 | // | | |------------->| @@ -3422,15 +4418,18 @@ func TestRESTSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { CaseBegin("TestRESTSubReqAndSubDelNoAnswerSameActionParallel") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cSubReqFromXapp, 2}, + Counter{cRestSubReqFromXapp, 2}, + Counter{cMergedSubscriptions, 1}, + Counter{cRestSubRespToXapp, 2}, Counter{cSubReqToE2, 1}, - Counter{cSubRespToXapp, 2}, - Counter{cSubDelReqFromXapp, 2}, + Counter{cSubReqTimerExpiry, 2}, + Counter{cSubReReqToE2, 1}, + Counter{cRestSubFailNotifToXapp, 2}, + Counter{cRestSubDelReqFromXapp, 2}, Counter{cSubDelReqToE2, 1}, Counter{cSubDelRespFromE2, 1}, - Counter{cSubDelRespToXapp, 2}, + Counter{cRestSubDelRespToXapp, 2}, }) - const subReqCount int = 1 // Req1 @@ -3454,9 +4453,9 @@ func TestRESTSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) e2SubsIdA := <-xappConn1.ListedRESTNotifications - xapp.Logger.Info("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) + xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) e2SubsIdB := <-xappConn1.ListedRESTNotifications - xapp.Logger.Info("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) + xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) // Del1 xappConn1.SendRESTSubsDelReq(t, &restSubId1) @@ -3470,6 +4469,7 @@ func TestRESTSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -3503,12 +4503,8 @@ func TestRESTSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { // | RESTNotif2 | | // | | unsuccess | | // |<------------------------------| | -// | | | SubDelReq | -// | | |------------->| -// | | | SubDelResp | -// | | |<-------------| // | | | | -// | | RESTSubDelReq1 | | +// | | RESTSubDelReq1 | | There is no need for xApp to send delete for failed subscriptions but some xApp might do so. // | |---------------->| | // | | | | // | | RESTSubDelResp1 | | @@ -3525,14 +4521,14 @@ func TestRESTSubReqAndSubDelNokSameActionParallel(t *testing.T) { CaseBegin("TestRESTSubReqAndSubDelNokSameActionParallel") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cSubReqFromXapp, 2}, + Counter{cRestSubReqFromXapp, 2}, + Counter{cMergedSubscriptions, 1}, + Counter{cRestSubRespToXapp, 2}, Counter{cSubReqToE2, 1}, Counter{cSubFailFromE2, 1}, - Counter{cSubRespToXapp, 2}, - Counter{cSubDelReqFromXapp, 2}, - Counter{cSubDelReqToE2, 1}, - Counter{cSubDelRespFromE2, 1}, - Counter{cSubDelRespToXapp, 2}, + Counter{cRestSubFailNotifToXapp, 2}, + Counter{cRestSubDelReqFromXapp, 2}, + Counter{cRestSubDelRespToXapp, 2}, }) const subReqCount int = 1 @@ -3554,15 +4550,11 @@ func TestRESTSubReqAndSubDelNokSameActionParallel(t *testing.T) { fparams1.Set(crereq1) e2termConn1.SendSubsFail(t, fparams1, cremsg1) - // E2t: internal delete - delreq, delmsg := e2termConn1.RecvSubsDelReq(t) xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) - e2termConn1.SendSubsDelResp(t, delreq, delmsg) - e2SubsIdA := <-xappConn1.ListedRESTNotifications - xapp.Logger.Info("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) + xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) e2SubsIdB := <-xappConn1.ListedRESTNotifications - xapp.Logger.Info("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) + xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) // Del1 xappConn1.SendRESTSubsDelReq(t, &restSubId1) @@ -3575,6 +4567,7 @@ func TestRESTSubReqAndSubDelNokSameActionParallel(t *testing.T) { waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } func TestRESTSubReqPolicyAndSubDelOk(t *testing.T) { @@ -3582,27 +4575,26 @@ func TestRESTSubReqPolicyAndSubDelOk(t *testing.T) { // Init counter check mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cSubReqFromXapp, 1}, + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, Counter{cSubReqToE2, 1}, Counter{cSubRespFromE2, 1}, - Counter{cSubRespToXapp, 1}, - Counter{cSubDelReqFromXapp, 1}, + Counter{cRestSubNotifToXapp, 1}, + Counter{cRestSubDelReqFromXapp, 1}, Counter{cSubDelReqToE2, 1}, Counter{cSubDelRespFromE2, 1}, - Counter{cSubDelRespToXapp, 1}, + Counter{cRestSubDelRespToXapp, 1}, }) - const subReqCount int = 1 - params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) restSubId := xappConn1.SendRESTSubsReq(t, params) - xapp.Logger.Info("Send REST Policy subscriber request for subscriberId : %v", restSubId) + xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) xappConn1.ExpectRESTNotification(t, restSubId) e2termConn1.SendSubsResp(t, crereq1, cremsg1) e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) - xapp.Logger.Info("REST notification received e2SubsId=%v", e2SubsId) + xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) xappConn1.SendRESTSubsDelReq(t, &restSubId) delreq, delmsg := e2termConn1.RecvSubsDelReq(t) @@ -3611,6 +4603,7 @@ func TestRESTSubReqPolicyAndSubDelOk(t *testing.T) { // Wait that subs is cleaned waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -3666,27 +4659,33 @@ func TestRESTSubReqPolicyChangeAndSubDelOk(t *testing.T) { CaseBegin("TestRESTSubReqPolicyAndSubDelOk") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cSubReqFromXapp, 2}, + Counter{cRestSubReqFromXapp, 2}, + Counter{cRestSubRespToXapp, 2}, Counter{cSubReqToE2, 2}, Counter{cSubRespFromE2, 2}, - Counter{cSubRespToXapp, 2}, - Counter{cSubDelReqFromXapp, 1}, + Counter{cRestSubNotifToXapp, 2}, + Counter{cRestSubDelReqFromXapp, 1}, Counter{cSubDelReqToE2, 1}, Counter{cSubDelRespFromE2, 1}, - Counter{cSubDelRespToXapp, 1}, + Counter{cRestSubDelRespToXapp, 1}, }) const subReqCount int = 1 + const e2Timeout int64 = 1 + const e2RetryCount int64 = 0 + const routingNeeded bool = true // Req params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) + params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) // Policy change - instanceId := int64(e2SubsId) - // GetRESTSubsReqPolicyParams sets some coutners on tc side. + // GetRESTSubsReqPolicyParams sets some counters on tc side. + params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) - params.SubsReqParams.SubscriptionDetails[0].InstanceID = &instanceId + params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) + params.SetSubscriptionID(&restSubId) params.SetTimeToWait("w200ms") restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params) @@ -3699,6 +4698,89 @@ func TestRESTSubReqPolicyChangeAndSubDelOk(t *testing.T) { // Wait that subs is cleaned waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) +} + +//----------------------------------------------------------------------------- +// TestRESTSubReqPolicyChangeNOk +// +// stub stub +// +-------+ +---------+ +---------+ +// | xapp | | submgr | | e2term | +// +-------+ +---------+ +---------+ +// | | | +// | RESTSubReq | | +// |---------------->| | +// | | | +// | RESTSubResp | | +// |<----------------| | +// | | SubReq | +// | |------------->| +// | | | +// | | SubResp | +// | |<-------------| +// | | | +// | RESTNotif | | +// |<----------------| | +// | | | +// | RESTSubReq | | +// |---------------->| | +// | | | +// | RESTSubUpdateFail(400 Bad request) +// | | | +// | 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}, + }) + + // Req + params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) + restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) + + // Policy change + params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) + + restSubIdUpd := strings.ToUpper(restSubId) // This makes RESTSubReq to fail + 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) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -3747,14 +4829,15 @@ func TestRESTSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { // Init counter check mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cSubReqFromXapp, 2}, + Counter{cRestSubReqFromXapp, 2}, + Counter{cRestSubRespToXapp, 2}, Counter{cSubReqToE2, 2}, Counter{cSubRespFromE2, 2}, - Counter{cSubRespToXapp, 2}, - Counter{cSubDelReqFromXapp, 2}, + Counter{cRestSubNotifToXapp, 2}, + Counter{cRestSubDelReqFromXapp, 2}, Counter{cSubDelReqToE2, 2}, Counter{cSubDelRespFromE2, 2}, - Counter{cSubDelRespToXapp, 2}, + Counter{cRestSubDelRespToXapp, 2}, }) const subReqCount int = 1 @@ -3776,13 +4859,13 @@ func TestRESTSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { xappConn1.ExpectRESTNotification(t, restSubId1) e2termConn1.SendSubsResp(t, crereq1, cremsg1) e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) - xapp.Logger.Info("TEST: REST notification received e2SubsId1=%v", e2SubsId1) + xapp.Logger.Debug("TEST: REST notification received e2SubsId1=%v", e2SubsId1) // Resp2 xappConn2.ExpectRESTNotification(t, restSubId2) e2termConn2.SendSubsResp(t, crereq2, cremsg2) e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) - xapp.Logger.Info("TEST: REST notification received e2SubsId2=%v", e2SubsId2) + xapp.Logger.Debug("TEST: REST notification received e2SubsId2=%v", e2SubsId2) // Delete1 xappConn1.SendRESTSubsDelReq(t, &restSubId1) @@ -3801,6 +4884,7 @@ func TestRESTSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { waitSubsCleanup(t, e2SubsId2, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -3828,7 +4912,7 @@ func TestRESTSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { func TestRESTSubReqAsn1EncodeFail(t *testing.T) { CaseBegin("TestRESTSubReqAsn1EncodeFail") - xapp.Logger.Info("Xapp-frame, v0.8.1 sufficient REST API validation") + xapp.Logger.Debug("Xapp-frame, v0.8.1 sufficient REST API validation") } @@ -3872,14 +4956,15 @@ func TestRESTSubReqInsertAndSubDelOk(t *testing.T) { CaseBegin("TestRESTInsertSubReqAndSubDelOk") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cSubReqFromXapp, 1}, + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, Counter{cSubReqToE2, 1}, Counter{cSubRespFromE2, 1}, - Counter{cSubRespToXapp, 1}, - Counter{cSubDelReqFromXapp, 1}, + Counter{cRestSubNotifToXapp, 1}, + Counter{cRestSubDelReqFromXapp, 1}, Counter{cSubDelReqToE2, 1}, Counter{cSubDelRespFromE2, 1}, - Counter{cSubDelRespToXapp, 1}, + Counter{cRestSubDelRespToXapp, 1}, }) const subReqCount int = 1 @@ -3899,6 +4984,7 @@ func TestRESTSubReqInsertAndSubDelOk(t *testing.T) { // Wait that subs is cleaned waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -3933,11 +5019,13 @@ func TestRESTSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { CaseBegin("TestRESTSubReqNokAndSubDelOkWithRestartInMiddle") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cSubReqFromXapp, 1}, + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, Counter{cSubReqToE2, 1}, Counter{cSubDelReqFromXapp, 1}, Counter{cSubDelReqToE2, 1}, Counter{cSubDelRespFromE2, 1}, + Counter{cRestSubFailNotifToXapp, 1}, }) const subReqCount int = 1 @@ -3950,7 +5038,7 @@ func TestRESTSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { //Req mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription restSubId := xappConn1.SendRESTSubsReq(t, params) - xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId) + xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) e2termConn1.RecvSubsReq(t) @@ -3969,6 +5057,7 @@ func TestRESTSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { mainCtrl.wait_registry_empty(t, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -4009,19 +5098,21 @@ func TestRESTSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { // |<----------------| | // //----------------------------------------------------------------------------- + func TestRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { CaseBegin("TestRESTSubReqAndSubDelOkWithRestartInMiddle") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cSubReqFromXapp, 1}, + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, Counter{cSubReqToE2, 1}, Counter{cSubRespFromE2, 1}, - Counter{cSubRespToXapp, 1}, - Counter{cSubDelReqFromXapp, 1}, + Counter{cRestSubNotifToXapp, 1}, + Counter{cRestSubDelReqFromXapp, 1}, Counter{cSubDelReqToE2, 1}, - Counter{cSubDelRespToXapp, 1}, + Counter{cSubDelRespFromE2, 1}, + Counter{cRestSubDelRespToXapp, 1}, }) - // Remove possible existing subscription mainCtrl.removeExistingSubscriptions(t) @@ -4029,17 +5120,13 @@ func TestRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { // Create subscription restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) - xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId) + xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) // Check subscription queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) - // When SDL support for the REST Interface is added - // the submgr restart statement below should be removed - // from the comment. - - // mainCtrl.SimulateRestart(t) - // xapp.Logger.Debug("mainCtrl.SimulateRestart done") + mainCtrl.SimulateRestart(t) + xapp.Logger.Debug("mainCtrl.SimulateRestart done") // Check subscription queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) @@ -4051,6 +5138,7 @@ func TestRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -4107,20 +5195,22 @@ func TestRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { // | | | | // //----------------------------------------------------------------------------- + func TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { CaseBegin("TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cSubReqFromXapp, 2}, + Counter{cRestSubReqFromXapp, 2}, + Counter{cRestSubRespToXapp, 2}, Counter{cSubReqToE2, 1}, Counter{cSubRespFromE2, 1}, - Counter{cSubRespToXapp, 2}, + Counter{cRestSubNotifToXapp, 2}, Counter{cMergedSubscriptions, 1}, Counter{cUnmergedSubscriptions, 1}, - Counter{cSubDelReqFromXapp, 2}, + Counter{cRestSubDelReqFromXapp, 2}, Counter{cSubDelReqToE2, 1}, Counter{cSubDelRespFromE2, 1}, - Counter{cSubDelRespToXapp, 2}, + Counter{cRestSubDelRespToXapp, 2}, }) // Remove possible existing subscription @@ -4130,38 +5220,30 @@ func TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { // Create subscription 1 restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) - xapp.Logger.Info("Send REST subscriber request for subscriber 1 : %v", restSubId1) + xapp.Logger.Debug("Send REST subscriber request for subscriber 1 : %v", restSubId1) // Create subscription 2 with same action params = xappConn2.GetRESTSubsReqReportParams(subReqCount) params.SetMeid("RAN_NAME_1") xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) - xappConn2.WaitRESTNotificationForAnySubscriptionId(t) + xappConn2.ExpectAnyNotification(t) restSubId2 := xappConn2.SendRESTSubsReq(t, params) - xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) - e2SubsId2 := <-xappConn2.RESTNotification - xapp.Logger.Info("REST notification received e2SubsId=%v", e2SubsId2) + xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) + e2SubsId2 := xappConn2.WaitAnyRESTNotification(t) + xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId2) queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) - // When SDL support for the REST Interface is added - // the submgr restart statement below should be removed - // from the comment. - - // mainCtrl.SimulateRestart(t) - // xapp.Logger.Debug("mainCtrl.SimulateRestart done") + mainCtrl.SimulateRestart(t) + xapp.Logger.Debug("mainCtrl.SimulateRestart done") // Delete subscription 1, and wait until it has removed the first endpoint subepcnt := mainCtrl.get_subs_entrypoint_cnt(t, e2SubsId1) xappConn1.SendRESTSubsDelReq(t, &restSubId1) mainCtrl.wait_subs_entrypoint_cnt_change(t, e2SubsId1, subepcnt, 10) - // When SDL support for the REST Interface is added - // the submgr restart statement below should be removed - // from the comment. - - // mainCtrl.SimulateRestart(t) - // xapp.Logger.Debug("mainCtrl.SimulateRestart done") + mainCtrl.SimulateRestart(t) + xapp.Logger.Debug("mainCtrl.SimulateRestart done") queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13660"}) // Delete subscription 2 @@ -4171,6 +5253,7 @@ func TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { waitSubsCleanup(t, e2SubsId2, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -4217,15 +5300,16 @@ func TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { // |<----------------| | // //----------------------------------------------------------------------------- + func TestRESTReportSubReqAndSubDelOk(t *testing.T) { CaseBegin("TestRESTReportSubReqAndSubDelOk") - subReqCount := 1 + const subReqCount int = 1 testIndex := 1 RESTReportSubReqAndSubDelOk(t, subReqCount, testIndex) } func RESTReportSubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { - xapp.Logger.Info("TEST: TestRESTReportSubReqAndSubDelOk with testIndex %v", testIndex) + xapp.Logger.Debug("TEST: TestRESTReportSubReqAndSubDelOk with testIndex %v", testIndex) // Req params := xappConn1.GetRESTSubsReqReportParams(subReqCount) @@ -4238,7 +5322,7 @@ func RESTReportSubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { e2termConn1.SendSubsResp(t, crereq, cremsg) instanceId := xappConn1.WaitRESTNotification(t, restSubId) - xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", instanceId) + xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) e2SubsId = append(e2SubsId, instanceId) resp, _ := xapp.Subscription.QuerySubscriptions() assert.Equal(t, resp[i].SubscriptionID, (int64)(instanceId)) @@ -4263,6 +5347,7 @@ func RESTReportSubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { xappConn1.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) + //mainCtrl.VerifyAllClean(t) } /* @@ -4279,13 +5364,11 @@ func TestRESTPolicySubReqAndSubDelOk(t *testing.T) { } */ func RESTPolicySubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { - xapp.Logger.Info("TEST: TestRESTPolicySubReqAndSubDelOk with testIndex %v", testIndex) + xapp.Logger.Debug("TEST: TestRESTPolicySubReqAndSubDelOk with testIndex %v", testIndex) // Req params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) restSubId := xappConn1.SendRESTSubsReq(t, params) - //params := xappConn1.GetRESTSubsReqPolicyParams1(subReqCount) - //restSubId := xappConn1.SendRESTPolicySubsReq(t, params) var e2SubsId []uint32 for i := 0; i < subReqCount; i++ { @@ -4293,7 +5376,7 @@ func RESTPolicySubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { xappConn1.ExpectRESTNotification(t, restSubId) e2termConn1.SendSubsResp(t, crereq, cremsg) instanceId := xappConn1.WaitRESTNotification(t, restSubId) - xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", instanceId) + xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) e2SubsId = append(e2SubsId, instanceId) } @@ -4312,23 +5395,25 @@ func RESTPolicySubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { xappConn1.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) + //mainCtrl.VerifyAllClean(t) } func TestRESTTwoPolicySubReqAndSubDelOk(t *testing.T) { - subReqCount := 2 - mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cSubReqFromXapp, 1}, + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, Counter{cSubReqToE2, 2}, Counter{cSubRespFromE2, 2}, - Counter{cSubRespToXapp, 2}, - Counter{cSubDelReqFromXapp, 1}, + Counter{cRestSubNotifToXapp, 2}, + Counter{cRestSubDelReqFromXapp, 1}, Counter{cSubDelReqToE2, 2}, Counter{cSubDelRespFromE2, 2}, - Counter{cSubDelRespToXapp, 1}, + Counter{cRestSubDelRespToXapp, 1}, }) + const subReqCount int = 2 + // Req params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) restSubId := xappConn1.SendRESTSubsReq(t, params) @@ -4345,22 +5430,23 @@ func TestRESTTwoPolicySubReqAndSubDelOk(t *testing.T) { mainCtrl.wait_registry_empty(t, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } func TestRESTPolicySubReqAndSubDelOkFullAmount(t *testing.T) { - subReqCount := 19 - mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cSubReqFromXapp, 1}, + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, Counter{cSubReqToE2, 19}, Counter{cSubRespFromE2, 19}, - Counter{cSubRespToXapp, 19}, - Counter{cSubDelReqFromXapp, 1}, + Counter{cRestSubNotifToXapp, 19}, + Counter{cRestSubDelReqFromXapp, 1}, Counter{cSubDelReqToE2, 19}, Counter{cSubDelRespFromE2, 19}, - Counter{cSubDelRespToXapp, 1}, + Counter{cRestSubDelRespToXapp, 1}, }) + const subReqCount int = 19 // Req params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) restSubId := xappConn1.SendRESTSubsReq(t, params) @@ -4376,20 +5462,23 @@ func TestRESTPolicySubReqAndSubDelOkFullAmount(t *testing.T) { mainCtrl.wait_registry_empty(t, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } + func TestRESTTwoReportSubReqAndSubDelOk(t *testing.T) { subReqCount := 2 mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cSubReqFromXapp, 1}, + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, Counter{cSubReqToE2, uint64(subReqCount)}, Counter{cSubRespFromE2, uint64(subReqCount)}, - Counter{cSubRespToXapp, uint64(subReqCount)}, - Counter{cSubDelReqFromXapp, 1}, + Counter{cRestSubNotifToXapp, uint64(subReqCount)}, + Counter{cRestSubDelReqFromXapp, 1}, Counter{cSubDelReqToE2, uint64(subReqCount)}, Counter{cSubDelRespFromE2, uint64(subReqCount)}, - Counter{cSubDelRespToXapp, 1}, + Counter{cRestSubDelRespToXapp, 1}, }) // Req @@ -4408,6 +5497,7 @@ func TestRESTTwoReportSubReqAndSubDelOk(t *testing.T) { mainCtrl.wait_registry_empty(t, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } func TestRESTTwoReportSubReqAndSubDelOkNoActParams(t *testing.T) { @@ -4415,14 +5505,15 @@ func TestRESTTwoReportSubReqAndSubDelOkNoActParams(t *testing.T) { subReqCount := 2 mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cSubReqFromXapp, 1}, + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, Counter{cSubReqToE2, uint64(subReqCount)}, Counter{cSubRespFromE2, uint64(subReqCount)}, - Counter{cSubRespToXapp, uint64(subReqCount)}, - Counter{cSubDelReqFromXapp, 1}, + Counter{cRestSubNotifToXapp, uint64(subReqCount)}, + Counter{cRestSubDelReqFromXapp, 1}, Counter{cSubDelReqToE2, uint64(subReqCount)}, Counter{cSubDelRespFromE2, uint64(subReqCount)}, - Counter{cSubDelRespToXapp, 1}, + Counter{cRestSubDelRespToXapp, 1}, }) // Req @@ -4441,6 +5532,7 @@ func TestRESTTwoReportSubReqAndSubDelOkNoActParams(t *testing.T) { mainCtrl.wait_registry_empty(t, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } func TestRESTFullAmountReportSubReqAndSubDelOk(t *testing.T) { @@ -4448,14 +5540,15 @@ func TestRESTFullAmountReportSubReqAndSubDelOk(t *testing.T) { subReqCount := 19 mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cSubReqFromXapp, 1}, + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, Counter{cSubReqToE2, uint64(subReqCount)}, Counter{cSubRespFromE2, uint64(subReqCount)}, - Counter{cSubRespToXapp, uint64(subReqCount)}, - Counter{cSubDelReqFromXapp, 1}, + Counter{cRestSubNotifToXapp, uint64(subReqCount)}, + Counter{cRestSubDelReqFromXapp, 1}, Counter{cSubDelReqToE2, uint64(subReqCount)}, Counter{cSubDelRespFromE2, uint64(subReqCount)}, - Counter{cSubDelRespToXapp, 1}, + Counter{cRestSubDelRespToXapp, 1}, }) // Req @@ -4474,20 +5567,22 @@ func TestRESTFullAmountReportSubReqAndSubDelOk(t *testing.T) { mainCtrl.wait_registry_empty(t, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } func TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen(t *testing.T) { CaseBegin("TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cSubReqFromXapp, 2}, + Counter{cRestSubReqFromXapp, 2}, + Counter{cRestSubRespToXapp, 2}, Counter{cSubReqToE2, 2}, Counter{cSubRespFromE2, 2}, - Counter{cSubRespToXapp, 2}, - Counter{cSubDelReqFromXapp, 2}, + Counter{cRestSubNotifToXapp, 2}, + Counter{cRestSubDelReqFromXapp, 2}, Counter{cSubDelReqToE2, 2}, Counter{cSubDelRespFromE2, 2}, - Counter{cSubDelRespToXapp, 2}, + Counter{cRestSubDelRespToXapp, 2}, }) // Req1 @@ -4495,18 +5590,18 @@ func TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen(t *testing.T) { //Subs Create restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) - xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId1) + xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) // Req2 params = xappConn2.GetRESTSubsReqReportParams(subReqCount) params.SetMeid("RAN_NAME_1") - eventTriggerDefinition := "1234" + eventTriggerDefinition := []int64{1234, 1} params.SetSubEventTriggerDefinition(eventTriggerDefinition) restSubId2 := xappConn2.SendRESTSubsReq(t, params) - xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) + xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) crereq, cremsg := e2termConn1.RecvSubsReq(t) xappConn2.ExpectRESTNotification(t, restSubId2) e2termConn1.SendSubsResp(t, crereq, cremsg) @@ -4519,21 +5614,22 @@ func TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen(t *testing.T) { waitSubsCleanup(t, e2SubsId2, 10) mainCtrl.VerifyCounterValues(t) - + //mainCtrl.VerifyAllClean(t) } func TestRESTSubReqReportSameActionDiffActionListLen(t *testing.T) { CaseBegin("TestRESTSubReqReportSameActionDiffActionListLen") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cSubReqFromXapp, 2}, + Counter{cRestSubReqFromXapp, 2}, + Counter{cRestSubRespToXapp, 2}, Counter{cSubReqToE2, 2}, Counter{cSubRespFromE2, 2}, - Counter{cSubRespToXapp, 2}, - Counter{cSubDelReqFromXapp, 2}, + Counter{cRestSubNotifToXapp, 2}, + Counter{cRestSubDelReqFromXapp, 2}, Counter{cSubDelReqToE2, 2}, Counter{cSubDelRespFromE2, 2}, - Counter{cSubDelRespToXapp, 2}, + Counter{cRestSubDelRespToXapp, 2}, }) // Req1 @@ -4541,7 +5637,7 @@ func TestRESTSubReqReportSameActionDiffActionListLen(t *testing.T) { //Subs Create restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) - xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId1) + xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) @@ -4551,13 +5647,13 @@ 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) restSubId2 := xappConn2.SendRESTSubsReq(t, params) - xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) + xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) crereq, cremsg := e2termConn1.RecvSubsReq(t) xappConn2.ExpectRESTNotification(t, restSubId2) e2termConn1.SendSubsResp(t, crereq, cremsg) @@ -4570,21 +5666,22 @@ func TestRESTSubReqReportSameActionDiffActionListLen(t *testing.T) { waitSubsCleanup(t, e2SubsId2, 10) mainCtrl.VerifyCounterValues(t) - + //mainCtrl.VerifyAllClean(t) } func TestRESTSubReqReportSameActionDiffActionID(t *testing.T) { CaseBegin("TestRESTSubReqReportSameActionDiffActionID") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cSubReqFromXapp, 2}, + Counter{cRestSubReqFromXapp, 2}, + Counter{cRestSubRespToXapp, 2}, Counter{cSubReqToE2, 2}, Counter{cSubRespFromE2, 2}, - Counter{cSubRespToXapp, 2}, - Counter{cSubDelReqFromXapp, 2}, + Counter{cRestSubNotifToXapp, 2}, + Counter{cRestSubDelReqFromXapp, 2}, Counter{cSubDelReqToE2, 2}, Counter{cSubDelRespFromE2, 2}, - Counter{cSubDelRespToXapp, 2}, + Counter{cRestSubDelRespToXapp, 2}, }) // Req1 @@ -4592,7 +5689,7 @@ func TestRESTSubReqReportSameActionDiffActionID(t *testing.T) { //Subs Create restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) - xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId1) + xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) @@ -4602,7 +5699,7 @@ func TestRESTSubReqReportSameActionDiffActionID(t *testing.T) { params.SetSubActionIDs(int64(2)) restSubId2 := xappConn2.SendRESTSubsReq(t, params) - xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) + xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) crereq, cremsg := e2termConn1.RecvSubsReq(t) xappConn2.ExpectRESTNotification(t, restSubId2) e2termConn1.SendSubsResp(t, crereq, cremsg) @@ -4615,38 +5712,45 @@ func TestRESTSubReqReportSameActionDiffActionID(t *testing.T) { waitSubsCleanup(t, e2SubsId2, 10) mainCtrl.VerifyCounterValues(t) - + //mainCtrl.VerifyAllClean(t) } func TestRESTSubReqDiffActionType(t *testing.T) { CaseBegin("TestRESTSubReqDiffActionType") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cSubReqFromXapp, 2}, + Counter{cRestSubReqFromXapp, 2}, + Counter{cRestSubRespToXapp, 2}, Counter{cSubReqToE2, 2}, Counter{cSubRespFromE2, 2}, - Counter{cSubRespToXapp, 2}, - Counter{cSubDelReqFromXapp, 2}, + Counter{cRestSubNotifToXapp, 2}, + Counter{cRestSubDelReqFromXapp, 2}, Counter{cSubDelReqToE2, 2}, Counter{cSubDelRespFromE2, 2}, - Counter{cSubDelRespToXapp, 2}, + Counter{cRestSubDelRespToXapp, 2}, }) + const e2Timeout int64 = 2 + const e2RetryCount int64 = 2 + const routingNeeded bool = true + // Req1 params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) + params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) //Subs Create restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) - xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId1) + xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) // Req2 params = xappConn2.GetRESTSubsReqReportParams(subReqCount) + params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) params.SetMeid("RAN_NAME_1") restSubId2 := xappConn2.SendRESTSubsReq(t, params) - xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) + xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) crereq, cremsg := e2termConn1.RecvSubsReq(t) xappConn2.ExpectRESTNotification(t, restSubId2) e2termConn1.SendSubsResp(t, crereq, cremsg) @@ -4659,38 +5763,45 @@ func TestRESTSubReqDiffActionType(t *testing.T) { waitSubsCleanup(t, e2SubsId2, 10) mainCtrl.VerifyCounterValues(t) - + //mainCtrl.VerifyAllClean(t) } func TestRESTSubReqPolicyAndSubDelOkSameAction(t *testing.T) { CaseBegin("TestRESTSubReqPolicyAndSubDelOkSameAction") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cSubReqFromXapp, 2}, + Counter{cRestSubReqFromXapp, 2}, + Counter{cRestSubRespToXapp, 2}, Counter{cSubReqToE2, 2}, Counter{cSubRespFromE2, 2}, - Counter{cSubRespToXapp, 2}, - Counter{cSubDelReqFromXapp, 2}, + Counter{cRestSubNotifToXapp, 2}, + Counter{cRestSubDelReqFromXapp, 2}, Counter{cSubDelReqToE2, 2}, Counter{cSubDelRespFromE2, 2}, - Counter{cSubDelRespToXapp, 2}, + Counter{cRestSubDelRespToXapp, 2}, }) + const e2Timeout int64 = 2 + const e2RetryCount int64 = 2 + const routingNeeded bool = true + // Req1 params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) + params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) //Subs Create restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) - xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId1) + xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) // Req2 params = xappConn2.GetRESTSubsReqPolicyParams(subReqCount) + params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) params.SetMeid("RAN_NAME_1") restSubId2 := xappConn2.SendRESTSubsReq(t, params) - xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) + xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) crereq, cremsg := e2termConn1.RecvSubsReq(t) xappConn2.ExpectRESTNotification(t, restSubId2) e2termConn1.SendSubsResp(t, crereq, cremsg) @@ -4703,21 +5814,22 @@ func TestRESTSubReqPolicyAndSubDelOkSameAction(t *testing.T) { waitSubsCleanup(t, e2SubsId2, 10) mainCtrl.VerifyCounterValues(t) - + //mainCtrl.VerifyAllClean(t) } func TestRESTSubReqReportSameActionDiffActionDefinitionLen(t *testing.T) { CaseBegin("TestRESTSubReqReportSameActionDiffActionDefinitionLen") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cSubReqFromXapp, 2}, + Counter{cRestSubReqFromXapp, 2}, + Counter{cRestSubRespToXapp, 2}, Counter{cSubReqToE2, 2}, Counter{cSubRespFromE2, 2}, - Counter{cSubRespToXapp, 2}, - Counter{cSubDelReqFromXapp, 2}, + Counter{cRestSubNotifToXapp, 2}, + Counter{cRestSubDelReqFromXapp, 2}, Counter{cSubDelReqToE2, 2}, Counter{cSubDelRespFromE2, 2}, - Counter{cSubDelRespToXapp, 2}, + Counter{cRestSubDelRespToXapp, 2}, }) // Req1 @@ -4725,18 +5837,18 @@ func TestRESTSubReqReportSameActionDiffActionDefinitionLen(t *testing.T) { //Subs Create restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) - xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId1) + xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) // Req2 params = xappConn2.GetRESTSubsReqReportParams(subReqCount) params.SetMeid("RAN_NAME_1") - actionDefinition := "5678" + actionDefinition := []int64{5678, 1} params.SetSubActionDefinition(actionDefinition) restSubId2 := xappConn2.SendRESTSubsReq(t, params) - xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) + xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) crereq, cremsg := e2termConn1.RecvSubsReq(t) xappConn2.ExpectRESTNotification(t, restSubId2) e2termConn1.SendSubsResp(t, crereq, cremsg) @@ -4749,21 +5861,22 @@ func TestRESTSubReqReportSameActionDiffActionDefinitionLen(t *testing.T) { waitSubsCleanup(t, e2SubsId2, 10) mainCtrl.VerifyCounterValues(t) - + //mainCtrl.VerifyAllClean(t) } func TestRESTSubReqReportSameActionDiffActionDefinitionContents(t *testing.T) { CaseBegin("TestRESTSubReqReportSameActionDiffActionDefinitionContents") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cSubReqFromXapp, 2}, + Counter{cRestSubReqFromXapp, 2}, + Counter{cRestSubRespToXapp, 2}, Counter{cSubReqToE2, 2}, Counter{cSubRespFromE2, 2}, - Counter{cSubRespToXapp, 2}, - Counter{cSubDelReqFromXapp, 2}, + Counter{cRestSubNotifToXapp, 2}, + Counter{cRestSubDelReqFromXapp, 2}, Counter{cSubDelReqToE2, 2}, Counter{cSubDelRespFromE2, 2}, - Counter{cSubDelRespToXapp, 2}, + Counter{cRestSubDelRespToXapp, 2}, }) // Req1 @@ -4771,18 +5884,18 @@ func TestRESTSubReqReportSameActionDiffActionDefinitionContents(t *testing.T) { //Subs Create restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) - xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId1) + xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) // Req2 params = xappConn2.GetRESTSubsReqReportParams(subReqCount) params.SetMeid("RAN_NAME_1") - actionDefinition := "56782" + actionDefinition := []int64{56782} params.SetSubActionDefinition(actionDefinition) restSubId2 := xappConn2.SendRESTSubsReq(t, params) - xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) + xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) crereq, cremsg := e2termConn1.RecvSubsReq(t) xappConn2.ExpectRESTNotification(t, restSubId2) e2termConn1.SendSubsResp(t, crereq, cremsg) @@ -4795,21 +5908,22 @@ func TestRESTSubReqReportSameActionDiffActionDefinitionContents(t *testing.T) { waitSubsCleanup(t, e2SubsId2, 10) mainCtrl.VerifyCounterValues(t) - + //mainCtrl.VerifyAllClean(t) } func TestRESTSubReqReportSameActionDiffSubsAction(t *testing.T) { CaseBegin("TestRESTSubReqReportSameActionDiffSubsAction") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cSubReqFromXapp, 2}, + Counter{cRestSubReqFromXapp, 2}, + Counter{cRestSubRespToXapp, 2}, Counter{cSubReqToE2, 2}, Counter{cSubRespFromE2, 2}, - Counter{cSubRespToXapp, 2}, - Counter{cSubDelReqFromXapp, 2}, + Counter{cRestSubNotifToXapp, 2}, + Counter{cRestSubDelReqFromXapp, 2}, Counter{cSubDelReqToE2, 2}, Counter{cSubDelRespFromE2, 2}, - Counter{cSubDelRespToXapp, 2}, + Counter{cRestSubDelRespToXapp, 2}, }) // Req1 @@ -4817,7 +5931,7 @@ func TestRESTSubReqReportSameActionDiffSubsAction(t *testing.T) { //Subs Create restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) - xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId1) + xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) @@ -4826,7 +5940,7 @@ func TestRESTSubReqReportSameActionDiffSubsAction(t *testing.T) { params.SetMeid("RAN_NAME_1") params.SetTimeToWait("w200ms") restSubId2 := xappConn2.SendRESTSubsReq(t, params) - xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) + xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) crereq, cremsg := e2termConn1.RecvSubsReq(t) xappConn2.ExpectRESTNotification(t, restSubId2) e2termConn1.SendSubsResp(t, crereq, cremsg) @@ -4839,7 +5953,7 @@ func TestRESTSubReqReportSameActionDiffSubsAction(t *testing.T) { waitSubsCleanup(t, e2SubsId2, 10) mainCtrl.VerifyCounterValues(t) - + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -4869,16 +5983,13 @@ func TestRESTSubReqReportSameActionDiffSubsAction(t *testing.T) { // | |<-------------| // | RESTNotif (fail)| | // |<----------------| | -// | | SubDelReq | -// | |------------->| // | | | -// | | SubDelResp | -// | |<-------------| // //----------------------------------------------------------------------------- + func TestRESTUnpackSubscriptionResponseDecodeFail(t *testing.T) { - xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionResponseDecodeFail") - subReqCount := 1 + xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionResponseDecodeFail") + const subReqCount int = 1 // Req params := xappConn1.GetRESTSubsReqReportParams(subReqCount) @@ -4890,7 +6001,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{} @@ -4898,11 +6009,8 @@ func TestRESTUnpackSubscriptionResponseDecodeFail(t *testing.T) { fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action e2termConn1.SendSubsFail(t, fparams, cremsg) - delreq, delmsg := e2termConn1.RecvSubsDelReq(t) - e2termConn1.SendSubsDelResp(t, delreq, delmsg) - instanceId := xappConn1.WaitRESTNotification(t, restSubId) - xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", instanceId) + xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) // Wait that subs is cleaned mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) @@ -4910,6 +6018,7 @@ func TestRESTUnpackSubscriptionResponseDecodeFail(t *testing.T) { xappConn1.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -4946,9 +6055,10 @@ func TestRESTUnpackSubscriptionResponseDecodeFail(t *testing.T) { // | |<-------------| // //----------------------------------------------------------------------------- + func TestRESTUnpackSubscriptionResponseUnknownInstanceId(t *testing.T) { - xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionResponseUnknownInstanceId") - subReqCount := 1 + xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionResponseUnknownInstanceId") + const subReqCount int = 1 // Req params := xappConn1.GetRESTSubsReqReportParams(subReqCount) @@ -4963,7 +6073,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{} @@ -4975,7 +6085,7 @@ func TestRESTUnpackSubscriptionResponseUnknownInstanceId(t *testing.T) { e2termConn1.SendSubsDelResp(t, delreq, delmsg) instanceId := xappConn1.WaitRESTNotification(t, restSubId) - xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", instanceId) + xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) // Wait that subs is cleaned mainCtrl.wait_subs_clean(t, orgInstanceId, 10) @@ -4983,6 +6093,7 @@ func TestRESTUnpackSubscriptionResponseUnknownInstanceId(t *testing.T) { xappConn1.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -5026,8 +6137,8 @@ func TestRESTUnpackSubscriptionResponseUnknownInstanceId(t *testing.T) { // //----------------------------------------------------------------------------- func TestRESTUnpackSubscriptionResponseNoTransaction(t *testing.T) { - xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionResponseNoTransaction") - subReqCount := 1 + xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionResponseNoTransaction") + const subReqCount int = 1 // Req params := xappConn1.GetRESTSubsReqReportParams(subReqCount) @@ -5041,7 +6152,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{} @@ -5057,7 +6168,7 @@ func TestRESTUnpackSubscriptionResponseNoTransaction(t *testing.T) { e2termConn1.SendSubsDelResp(t, delreq, delmsg) instanceId := xappConn1.WaitRESTNotification(t, restSubId) - xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", instanceId) + xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) // Wait that subs is cleaned mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) @@ -5065,7 +6176,7 @@ func TestRESTUnpackSubscriptionResponseNoTransaction(t *testing.T) { xappConn1.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) - + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -5095,16 +6206,12 @@ func TestRESTUnpackSubscriptionResponseNoTransaction(t *testing.T) { // | |<-------------| // | RESTNotif (fail)| | // |<----------------| | -// | | SubDelReq | -// | |------------->| // | | | -// | | SubDelResp | -// | |<-------------| // //----------------------------------------------------------------------------- func TestRESTUnpackSubscriptionFailureDecodeFail(t *testing.T) { - xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionFailureDecodeFail") - subReqCount := 1 + xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionFailureDecodeFail") + const subReqCount int = 1 // Req params := xappConn1.GetRESTSubsReqReportParams(subReqCount) @@ -5117,7 +6224,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{} @@ -5125,11 +6232,8 @@ func TestRESTUnpackSubscriptionFailureDecodeFail(t *testing.T) { fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action e2termConn1.SendSubsFail(t, fparams, cremsg) - delreq, delmsg := e2termConn1.RecvSubsDelReq(t) - e2termConn1.SendSubsDelResp(t, delreq, delmsg) - instanceId := xappConn1.WaitRESTNotification(t, restSubId) - xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", instanceId) + xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) // Wait that subs is cleaned mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) @@ -5137,6 +6241,7 @@ func TestRESTUnpackSubscriptionFailureDecodeFail(t *testing.T) { xappConn1.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -5174,8 +6279,8 @@ func TestRESTUnpackSubscriptionFailureDecodeFail(t *testing.T) { // //----------------------------------------------------------------------------- func TestRESTUnpackSubscriptionFailureUnknownInstanceId(t *testing.T) { - xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionFailureUnknownInstanceId") - subReqCount := 1 + xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionFailureUnknownInstanceId") + const subReqCount int = 1 // Req params := xappConn1.GetRESTSubsReqReportParams(subReqCount) @@ -5191,7 +6296,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 @@ -5201,7 +6306,7 @@ func TestRESTUnpackSubscriptionFailureUnknownInstanceId(t *testing.T) { e2termConn1.SendSubsDelResp(t, delreq, delmsg) instanceId := xappConn1.WaitRESTNotification(t, restSubId) - xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", instanceId) + xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) // Wait that subs is cleaned mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) @@ -5209,6 +6314,7 @@ func TestRESTUnpackSubscriptionFailureUnknownInstanceId(t *testing.T) { xappConn1.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -5246,8 +6352,8 @@ func TestRESTUnpackSubscriptionFailureUnknownInstanceId(t *testing.T) { // //----------------------------------------------------------------------------- func TestRESTUnpackSubscriptionFailureNoTransaction(t *testing.T) { - xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionFailureNoTransaction") - subReqCount := 1 + xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionFailureNoTransaction") + const subReqCount int = 1 // Req params := xappConn1.GetRESTSubsReqReportParams(subReqCount) @@ -5264,7 +6370,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 @@ -5278,7 +6384,7 @@ func TestRESTUnpackSubscriptionFailureNoTransaction(t *testing.T) { e2termConn1.SendSubsDelResp(t, delreq, delmsg) instanceId := xappConn1.WaitRESTNotification(t, restSubId) - xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", instanceId) + xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) // Wait that subs is cleaned mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) @@ -5286,6 +6392,7 @@ func TestRESTUnpackSubscriptionFailureNoTransaction(t *testing.T) { xappConn1.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -5320,7 +6427,7 @@ func TestRESTUnpackSubscriptionFailureNoTransaction(t *testing.T) { // //----------------------------------------------------------------------------- func TestRESTUnpackSubscriptionDeleteResponseDecodeFail(t *testing.T) { - xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionDeleteResponseDecodeFail") + xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteResponseDecodeFail") // Req var params *teststube2ap.RESTSubsReqParams = nil @@ -5347,6 +6454,7 @@ func TestRESTUnpackSubscriptionDeleteResponseDecodeFail(t *testing.T) { xappConn1.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -5380,7 +6488,7 @@ func TestRESTUnpackSubscriptionDeleteResponseDecodeFail(t *testing.T) { // //----------------------------------------------------------------------------- func TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId(t *testing.T) { - xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId") + xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId") // Req var params *teststube2ap.RESTSubsReqParams = nil @@ -5408,6 +6516,7 @@ func TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId(t *testing.T) { xappConn1.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -5441,7 +6550,7 @@ func TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId(t *testing.T) { // //----------------------------------------------------------------------------- func TestRESTUnpackSubscriptionDeleteResponseNoTransaction(t *testing.T) { - xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionDeleteResponseNoTransaction") + xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteResponseNoTransaction") // Req var params *teststube2ap.RESTSubsReqParams = nil @@ -5470,6 +6579,7 @@ func TestRESTUnpackSubscriptionDeleteResponseNoTransaction(t *testing.T) { xappConn1.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -5503,7 +6613,7 @@ func TestRESTUnpackSubscriptionDeleteResponseNoTransaction(t *testing.T) { // //----------------------------------------------------------------------------- func TestRESTUnpackSubscriptionDeleteFailureDecodeFail(t *testing.T) { - xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionDeleteFailureDecodeFail") + xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteFailureDecodeFail") // Req var params *teststube2ap.RESTSubsReqParams = nil @@ -5530,6 +6640,7 @@ func TestRESTUnpackSubscriptionDeleteFailureDecodeFail(t *testing.T) { xappConn1.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -5563,7 +6674,7 @@ func TestRESTUnpackSubscriptionDeleteFailureDecodeFail(t *testing.T) { // //----------------------------------------------------------------------------- func TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId(t *testing.T) { - xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId") + xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId") // Req var params *teststube2ap.RESTSubsReqParams = nil @@ -5591,6 +6702,7 @@ func TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId(t *testing.T) { xappConn1.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -5624,7 +6736,7 @@ func TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId(t *testing.T) { // //----------------------------------------------------------------------------- func TestRESTUnpackSubscriptionDeleteFailureNoTransaction(t *testing.T) { - xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionDeleteFailureNoTransaction") + xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteFailureNoTransaction") // Req var params *teststube2ap.RESTSubsReqParams = nil @@ -5653,6 +6765,7 @@ func TestRESTUnpackSubscriptionDeleteFailureNoTransaction(t *testing.T) { xappConn1.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -5688,13 +6801,12 @@ func TestRESTUnpackSubscriptionDeleteFailureNoTransaction(t *testing.T) { func TestRESTSubReqFailAsn1PackSubReqError(t *testing.T) { mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cSubReqFromXapp, 1}, - Counter{cSubDelReqToE2, 1}, - Counter{cSubDelFailFromE2, 1}, - Counter{cSubRespToXapp, 1}, + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, + Counter{cRestSubFailNotifToXapp, 1}, }) - subReqCount := 1 + const subReqCount int = 1 var params *teststube2ap.RESTSubsReqParams = nil params = xappConn1.GetRESTSubsReqReportParams(subReqCount) @@ -5702,22 +6814,196 @@ func TestRESTSubReqFailAsn1PackSubReqError(t *testing.T) { // Req restSubId := xappConn1.SendRESTSubsReq(t, params) - xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId) + xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) // E2t: Receive SubsDelReq - delreq, delmsg := e2termConn1.RecvSubsDelReq(t) - xappConn1.ExpectRESTNotification(t, restSubId) - - // Subscription does not exist in in E2 Node. - e2termConn1.SendSubsDelFail(t, delreq, delmsg) + xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) - xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", e2SubsId) + xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, true) // Wait that subs is cleaned waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) +} + +func TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction(t *testing.T) { + CaseBegin("TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction") + + mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ + Counter{cRestSubReqFromXapp, 2}, + Counter{cRestSubRespToXapp, 2}, + Counter{cSubReqToE2, 2}, + Counter{cSubReqTimerExpiry, 1}, + Counter{cSubRespFromE2, 1}, + Counter{cRestSubNotifToXapp, 1}, + Counter{cRestSubFailNotifToXapp, 1}, + Counter{cRestSubDelReqFromXapp, 1}, + Counter{cSubDelReqToE2, 1}, + Counter{cSubDelRespFromE2, 1}, + Counter{cRestSubDelRespToXapp, 1}, + }) + + const e2Timeout int64 = 1 + const e2RetryCount int64 = 0 + const routingNeeded bool = false + + // Req1 + params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) + params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) + + // Subs Create + restSubId := xappConn1.SendRESTSubsReq(t, params) + xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) + + crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) + xappConn1.ExpectRESTNotification(t, restSubId) + e2termConn1.SendSubsResp(t, crereq1, cremsg1) + e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) + xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) + + // Policy change + params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) + params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) + params.SetSubscriptionID(&restSubId) + params.SetTimeToWait("w200ms") + restSubId = xappConn1.SendRESTSubsReq(t, params) + xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) + + crereq1, cremsg1 = e2termConn1.RecvSubsReq(t) + xappConn1.ExpectRESTNotification(t, restSubId) + // SubsResp is missing, e2SubsId will be 0 + zeroE2SubsId := xappConn1.WaitRESTNotification(t, restSubId) + xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", zeroE2SubsId) + + // Del + xappConn1.SendRESTSubsDelReq(t, &restSubId) + delreq, delmsg := e2termConn1.RecvSubsDelReq(t) + e2termConn1.SendSubsDelResp(t, delreq, delmsg) + + waitSubsCleanup(t, e2SubsId, 10) + + mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) +} + +//----------------------------------------------------------------------------- +// TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle +// +// stub stub +// +-------+ +---------+ +---------+ +// | xapp | | submgr | | e2term | +// +-------+ +---------+ +---------+ +// | | | +// | RESTSubReq | | +// |---------------->| | +// | | | +// | RESTSubResp | | +// |<----------------| | +// | | SubReq | +// | |------------->| +// | | | +// | | SubResp | +// | |<-------------| +// | | | +// | RESTNotif | | +// |<----------------| | +// | | | +// | RESTSubReq | | +// |---------------->| | +// | | | +// | RESTSubResp | | +// |<----------------| | +// | | SubReq | +// | |------------->| +// | | +// | Submgr restart | +// | | | +// | RESTSubDelReq | | +// |---------------->| | +// | | | +// | | SubDelReq | +// | |------------->| +// | | | +// | | SubDelResp | +// | |<-------------| +// | | | +// | RESTSubDelResp | | +// |<----------------| | +// +//----------------------------------------------------------------------------- + +func TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { + CaseBegin("TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle") + + mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ + Counter{cRestSubReqFromXapp, 2}, + Counter{cRestSubRespToXapp, 2}, + Counter{cSubReqToE2, 2}, + Counter{cSubRespFromE2, 1}, + Counter{cRestSubNotifToXapp, 1}, + Counter{cRestSubFailNotifToXapp, 1}, + Counter{cRestSubDelReqFromXapp, 1}, + Counter{cSubDelReqToE2, 1}, + Counter{cSubDelRespFromE2, 1}, + Counter{cRestSubDelRespToXapp, 1}, + }) + + // Remove possible existing subscription + mainCtrl.removeExistingSubscriptions(t) + + const e2Timeout int64 = 1 + const e2RetryCount int64 = 0 + const routingNeeded bool = false + + // Req1 + params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) + params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) + // Create subscription + restSubId := xappConn1.SendRESTSubsReq(t, params) + xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) + + crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) + xappConn1.ExpectRESTNotification(t, restSubId) + e2termConn1.SendSubsResp(t, crereq1, cremsg1) + e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) + xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) + + // Check subscription + queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) + + // Policy change + params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) + params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) + params.SetSubscriptionID(&restSubId) + params.SetTimeToWait("w200ms") + mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription + restSubId = xappConn1.SendRESTSubsReq(t, params) + xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) + + crereq1, cremsg1 = e2termConn1.RecvSubsReq(t) + mainCtrl.SetResetTestFlag(t, false) + + // SubsResp is missing due to submgr restart + + mainCtrl.SimulateRestart(t) + xapp.Logger.Debug("mainCtrl.SimulateRestart done") + + // Check subscription + queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) + + // Delete subscription + 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) + //mainCtrl.VerifyAllClean(t) } //////////////////////////////////////////////////////////////////////////////////// @@ -5731,13 +7017,13 @@ func createSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2ter params = fromXappConn.GetRESTSubsReqReportParams(subReqCount) } restSubId := fromXappConn.SendRESTSubsReq(t, params) - xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId) + xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) crereq1, cremsg1 := toE2termConn.RecvSubsReq(t) fromXappConn.ExpectRESTNotification(t, restSubId) toE2termConn.SendSubsResp(t, crereq1, cremsg1) e2SubsId := fromXappConn.WaitRESTNotification(t, restSubId) - xapp.Logger.Info("REST notification received e2SubsId=%v", e2SubsId) + xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) return restSubId, e2SubsId } @@ -5751,23 +7037,24 @@ func createXapp2MergedSubscription(t *testing.T, meid string) (string, uint32) { xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) restSubId := xappConn2.SendRESTSubsReq(t, params) xappConn2.ExpectRESTNotification(t, restSubId) - xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId) + xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) e2SubsId := xappConn2.WaitRESTNotification(t, restSubId) - xapp.Logger.Info("REST notification received e2SubsId=%v", e2SubsId) + xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) return restSubId, e2SubsId } func createXapp1PolicySubscription(t *testing.T) (string, uint32) { + params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) restSubId := xappConn1.SendRESTSubsReq(t, params) - xapp.Logger.Info("Send REST Policy subscriber request for subscriberId : %v", restSubId) + xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) xappConn1.ExpectRESTNotification(t, restSubId) e2termConn1.SendSubsResp(t, crereq1, cremsg1) e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) - xapp.Logger.Info("REST notification received e2SubsId=%v", e2SubsId) + xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) return restSubId, e2SubsId } @@ -5785,7 +7072,7 @@ func createXapp1ReportSubscriptionE2Fail(t *testing.T) (string, uint32) { xappConn1.ExpectRESTNotification(t, restSubId) e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) - xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", e2SubsId) + xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) return restSubId, e2SubsId } @@ -5830,14 +7117,14 @@ func sendAndReceiveMultipleE2SubReqs(t *testing.T, count int, fromXappConn *test var e2SubsId []uint32 for i := 0; i < count; i++ { - xapp.Logger.Info("TEST: %d ===================================== BEGIN CRE ============================================", i+1) + xapp.Logger.Debug("TEST: %d ===================================== BEGIN CRE ============================================", i+1) crereq, cremsg := toE2termConn.RecvSubsReq(t) fromXappConn.ExpectRESTNotification(t, restSubId) toE2termConn.SendSubsResp(t, crereq, cremsg) instanceId := fromXappConn.WaitRESTNotification(t, restSubId) e2SubsId = append(e2SubsId, instanceId) - xapp.Logger.Info("TEST: %v", e2SubsId) - xapp.Logger.Info("TEST: %d ===================================== END CRE ============================================", i+1) + xapp.Logger.Debug("TEST: %v", e2SubsId) + xapp.Logger.Debug("TEST: %d ===================================== END CRE ============================================", i+1) <-time.After(100 * time.Millisecond) } return e2SubsId @@ -5846,11 +7133,11 @@ func sendAndReceiveMultipleE2SubReqs(t *testing.T, count int, fromXappConn *test func sendAndReceiveMultipleE2DelReqs(t *testing.T, e2SubsIds []uint32, toE2termConn *teststube2ap.E2Stub) { for i := 0; i < len(e2SubsIds); i++ { - xapp.Logger.Info("TEST: %d ===================================== BEGIN DEL ============================================", i+1) + xapp.Logger.Debug("TEST: %d ===================================== BEGIN DEL ============================================", i+1) delreq, delmsg := toE2termConn.RecvSubsDelReq(t) toE2termConn.SendSubsDelResp(t, delreq, delmsg) <-time.After(1 * time.Second) - xapp.Logger.Info("TEST: %d ===================================== END DEL ============================================", i+1) + xapp.Logger.Debug("TEST: %d ===================================== END DEL ============================================", i+1) <-time.After(100 * time.Millisecond) }