X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Fcontrol%2Fut_messaging_test.go;h=3d0b448524d42c2793f5427fa25f88961bcf7f03;hb=84662c4f3e2273152fc849f74880108b6346bcad;hp=2c905137e3a761e8a8e8154a0ca47b06702e1087;hpb=93a5f9e27a6803adce055811c222632bfd69d11c;p=ric-plt%2Fsubmgr.git diff --git a/pkg/control/ut_messaging_test.go b/pkg/control/ut_messaging_test.go index 2c90513..3d0b448 100644 --- a/pkg/control/ut_messaging_test.go +++ b/pkg/control/ut_messaging_test.go @@ -20,7 +20,7 @@ package control import ( - //"os" + "encoding/json" "strings" "testing" "time" @@ -33,6 +33,10 @@ import ( "github.com/stretchr/testify/assert" ) +// In below test cases there is done only one retry for E2 messages +// In Helm chart retry count is currently 2 By default. Retry count +// used in test cases is defined in submgr-config.yaml file. + 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 @@ -46,6 +50,10 @@ func TestSuiteSetup(t *testing.T) { } func TestRanStatusChangeViaSDLNotification(t *testing.T) { + mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ + Counter{cE2StateChangedToUp, 3}, + }) + // Current UT test cases use these ran names xappRnibMock.CreateGnb("RAN_NAME_1", entities.ConnectionStatus_DISCONNECTED) xappRnibMock.CreateGnb("RAN_NAME_11", entities.ConnectionStatus_DISCONNECTED) @@ -57,6 +65,8 @@ func TestRanStatusChangeViaSDLNotification(t *testing.T) { mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") mainCtrl.SetE2State(t, "RAN_NAME_2_CONNECTED") mainCtrl.SetE2State(t, "RAN_NAME_11_CONNECTED") + + mainCtrl.VerifyCounterValues(t) } //----------------------------------------------------------------------------- @@ -78,11 +88,12 @@ func TestRanStatusChangeViaSDLNotification(t *testing.T) { //----------------------------------------------------------------------------- func TestRESTSubReqAfterE2ConnBreak(t *testing.T) { - CaseBegin("TestRESTSubReqAfterE2ConnBreak") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 1}, Counter{cRestReqRejDueE2Down, 1}, + Counter{cE2StateChangedToDown, 1}, + Counter{cE2StateChangedToUp, 1}, }) // E2 disconnect after E2term has received response @@ -95,9 +106,8 @@ func TestRESTSubReqAfterE2ConnBreak(t *testing.T) { // Restore E2 connection for following test cases mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") - mainCtrl.VerifyCounterValues(t) mainCtrl.VerifyAllClean(t) - //os.Exit(0) + mainCtrl.VerifyCounterValues(t) } //----------------------------------------------------------------------------- @@ -127,7 +137,6 @@ func TestRESTSubReqAfterE2ConnBreak(t *testing.T) { // //----------------------------------------------------------------------------- func TestRESTSubReqE2ConnBreak(t *testing.T) { - CaseBegin("TestRESTSubReqE2ConnBreak") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 1}, @@ -135,6 +144,8 @@ func TestRESTSubReqE2ConnBreak(t *testing.T) { Counter{cSubReqToE2, 1}, Counter{cSubRespFromE2, 1}, Counter{cRestSubFailNotifToXapp, 1}, + Counter{cE2StateChangedToDown, 1}, + Counter{cE2StateChangedToUp, 1}, }) // Req @@ -212,6 +223,8 @@ func TestRESTSubscriptionDeleteAfterE2ConnectionBreak(t *testing.T) { Counter{cRestSubNotifToXapp, 1}, Counter{cRestSubDelReqFromXapp, 1}, Counter{cRestSubDelRespToXapp, 1}, + Counter{cE2StateChangedToDown, 1}, + Counter{cE2StateChangedToUp, 1}, }) // Req @@ -289,6 +302,7 @@ func TestRESTOtherE2ConnectionChanges(t *testing.T) { Counter{cSubDelReqToE2, 1}, Counter{cSubDelRespFromE2, 1}, Counter{cRestSubDelRespToXapp, 1}, + Counter{cE2StateChangedToUp, 1}, }) // Req @@ -300,7 +314,7 @@ func TestRESTOtherE2ConnectionChanges(t *testing.T) { e2termConn1.SendSubsResp(t, crereq, cremsg) e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) - // Submgr should not react any other connection state changes than CONNECTED and DISCONNECTED + // Submgr should not react to 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") @@ -418,7 +432,7 @@ func TestRESTSubReqAndE1apDeleteReqPackingError(t *testing.T) { } //----------------------------------------------------------------------------- -// TestRESTSubReqAndE1apDeleteRespUnpackingError +// TestRESTSubReqAndE2APDeleteRespUnpackingError // // stub stub stub // +-------+ +---------+ +---------+ +---------+ @@ -462,7 +476,7 @@ func TestRESTSubReqAndE1apDeleteReqPackingError(t *testing.T) { // //----------------------------------------------------------------------------- -func TestRESTSubReqAndE1apDeleteRespUnpackingError(t *testing.T) { +func TestRESTSubReqAndE2APDeleteRespUnpackingError(t *testing.T) { restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil) @@ -866,6 +880,100 @@ func TestSubReqAndSubDelOk(t *testing.T) { mainCtrl.VerifyCounterValues(t) } +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// TestSubReqAndSubDelOkOutofOrderIEs +// +// stub stub +// +-------+ +---------+ +---------+ +// | xapp | | submgr | | e2term | +// +-------+ +---------+ +---------+ +// | | | +// | SubReq | | +// |------------->| | +// | | | +// | | SubReq | +// | |------------->| +// | | | +// | | SubResp | (Out of Order IEs) +// | |<-------------| +// | | | +// | SubResp | | +// |<-------------| | +// | | | +// | | | +// | SubDelReq | | +// |------------->| | +// | | | +// | | SubDelReq | +// | |------------->| +// | | | +// | | SubDelResp | +// | |<-------------| +// | | | +// | SubDelResp | | +// |<-------------| | +// +//----------------------------------------------------------------------------- + +func TestSubReqAndSubDelOkOutofOrderIEs(t *testing.T) { + CaseBegin("TestSubReqAndSubDelOkOutofOrderIEs") + + mainCtrl.c.e2ap.SetE2IEOrderCheck(0) + // Init counter check + mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ + Counter{cSubReqFromXapp, 1}, + Counter{cSubReqToE2, 1}, + Counter{cSubRespFromE2, 1}, + Counter{cSubRespToXapp, 1}, + Counter{cSubDelReqFromXapp, 1}, + Counter{cSubDelReqToE2, 1}, + Counter{cSubDelRespFromE2, 1}, + Counter{cSubDelRespToXapp, 1}, + }) + + cretrans := xappConn1.SendSubsReq(t, nil, nil) + if cretrans == nil { + t.Logf("Could not send SubsReq") + t.FailNow() + } + crereq, cremsg := e2termConn1.RecvSubsReq(t) + if crereq == nil || cremsg == nil { + t.Logf("Could not recieve SubsReq") + t.FailNow() + } + + e2termConn1.SendSubsResp(t, crereq, cremsg) + + mainCtrl.c.e2ap.SetE2IEOrderCheck(0) + + e2SubsId := xappConn1.RecvSubsResp(t, cretrans) + resp, _ := xapp.Subscription.QuerySubscriptions() + assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) + assert.Equal(t, resp[0].Meid, "RAN_NAME_1") + assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) + + deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) + delreq, delmsg := e2termConn1.RecvSubsDelReq(t) + + e2termConn1.SendSubsDelResp(t, delreq, delmsg) + xappConn1.RecvSubsDelResp(t, deltrans) + + //Wait that subs is cleaned + mainCtrl.wait_subs_clean(t, e2SubsId, 10) + + xappConn1.TestMsgChanEmpty(t) + xappConn2.TestMsgChanEmpty(t) + e2termConn1.TestMsgChanEmpty(t) + mainCtrl.wait_registry_empty(t, 10) + + mainCtrl.VerifyCounterValues(t) + mainCtrl.c.e2ap.SetE2IEOrderCheck(1) +} + +//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- // TestSubReqRetransmission // @@ -2619,128 +2727,460 @@ func TestSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { // | | func TestGetSubscriptions(t *testing.T) { - mainCtrl.sendGetRequest(t, "localhost:8088", "/ric/v1/subscriptions") + mainCtrl.SendGetRequest(t, "localhost:8088", "/ric/v1/subscriptions") } func TestGetSymptomData(t *testing.T) { - mainCtrl.sendGetRequest(t, "localhost:8080", "/ric/v1/symptomdata") + mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/symptomdata") } func TestPostdeleteSubId(t *testing.T) { - mainCtrl.sendPostRequest(t, "localhost:8080", "/ric/v1/test/deletesubid=1") + mainCtrl.SendPostRequest(t, "localhost:8080", "/ric/v1/test/deletesubid=1") } func TestPostEmptyDb(t *testing.T) { - mainCtrl.sendPostRequest(t, "localhost:8080", "/ric/v1/test/emptydb") + mainCtrl.SendPostRequest(t, "localhost:8080", "/ric/v1/test/emptydb") } func TestGetRestSubscriptions(t *testing.T) { - mainCtrl.sendGetRequest(t, "localhost:8080", "/ric/v1/restsubscriptions") + mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/restsubscriptions") } //----------------------------------------------------------------------------- -// TestRESTSubReqAndRouteNok +// TestDelAllE2nodeSubsViaDebugIf // -// stub stub -// +-------+ +---------+ +---------+ -// | xapp | | submgr | | rtmgr | -// +-------+ +---------+ +---------+ -// | | | -// | RESTSubReq | | -// |---------------->| | -// | | | -// | RESTSubResp | | -// |<----------------| | -// | | RouteCreate | -// | |------------->| -// | | | -// | | RouteCreate | -// | | status:400 | -// | |(Bad request) | -// | |<-------------| -// | RESTNotif | | -// |<----------------| | -// | | | -// | [SUBS INT DELETE] | -// | | | -// | RESTSubDelReq | | -// |---------------->| | -// | RESTSubDelResp | | -// |<----------------| | +// stub stub stub +// +-------+ +---------+ +---------+ +---------+ +// | xapp | | submgr | | e2term | | rtmgr | +// +-------+ +---------+ +---------+ +---------+ +// | | | | +// | RESTSubReq | | | +// |---------------->| | | +// | RESTSubResp | | | +// |<----------------| | | +// | | RouteCreate | | +// | |--------------------------->| +// | | RouteResponse| | +// | |<---------------------------| +// | | SubReq | | +// | |------------->| | +// | | SubResp | | +// | |<-------------| | +// | RESTNotif1 | | | +// |<----------------| | | +// | | | | +// | REST get_all_e2nodes | | +// |---------------->| | | +// | OK 200 | | | +// |<----------------| | | +// | REST delete_all_e2node_subscriptions | ranName = RAN_NAME_1 +// |---------------->| | | +// | OK 200 | | | +// |<----------------| | | +// | | SubDelReq | | +// | |------------->| | +// | | SubDelResp | | +// | |<-------------| | +// | | | | +// | | RouteDelete | | +// | |--------------------------->| +// | | RouteResponse| | +// | |<---------------------------| // //----------------------------------------------------------------------------- -func TestRESTSubReqAndRouteNok(t *testing.T) { - CaseBegin("TestRESTSubReqAndRouteNok") +func TestDelAllE2nodeSubsViaDebugIf(t *testing.T) { + + // Init counter check mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 1}, Counter{cRestSubRespToXapp, 1}, - Counter{cRouteCreateFail, 1}, - Counter{cRestSubFailNotifToXapp, 1}, + Counter{cSubReqToE2, 1}, + Counter{cSubRespFromE2, 1}, + Counter{cRestSubNotifToXapp, 1}, Counter{cRestSubDelReqFromXapp, 1}, + Counter{cSubDelReqToE2, 1}, + Counter{cSubDelRespFromE2, 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) - - // Req params := xappConn1.GetRESTSubsReqReportParams(subReqCount) restSubId := xappConn1.SendRESTSubsReq(t, params) - xappConn1.ExpectRESTNotificationNok(t, restSubId, "failAll") - waiter.WaitResult(t) + 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.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) + xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) - // Del - xappConn1.SendRESTSubsDelReq(t, &restSubId) + e2nodesJson := mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/get_all_e2nodes") + + var e2nodesList []string + err := json.Unmarshal(e2nodesJson, &e2nodesList) + if err != nil { + t.Errorf("Unmarshal error: %s", err) + } + assert.Equal(t, true, mainCtrl.VerifyStringExistInSlice("RAN_NAME_1", e2nodesList)) + + e2RestSubsJson := mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/get_e2node_rest_subscriptions/RAN_NAME_1") // RAN_NAME_1 = ranName + var e2RestSubsMap map[string]RESTSubscription + err = json.Unmarshal(e2RestSubsJson, &e2RestSubsMap) + if err != nil { + t.Errorf("Unmarshal error: %s", err) + } + + if len(e2RestSubsMap) != 1 { + t.Errorf("Incorrect e2RestSubsMap length %v", len(e2RestSubsMap)) + } + + // Simulate deletion through REST test and debug interface + mainCtrl.SendDeleteRequest(t, "localhost:8080", "/ric/v1/delete_all_e2node_subscriptions/RAN_NAME_1") // RAN_NAME_1 = ranName + delreq, delmsg := e2termConn1.RecvSubsDelReq(t) + e2termConn1.SendSubsDelResp(t, delreq, delmsg) // Wait that subs is cleaned - mainCtrl.wait_subs_clean(t, newSubsId, 10) waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) mainCtrl.VerifyAllClean(t) } -func TestRESTSubReqAndRouteUpdateNok(t *testing.T) { - CaseBegin("TestSubReqAndRouteUpdateNok") +//----------------------------------------------------------------------------- +// TestDelAllxAppSubsViaDebugIf +// +// stub stub stub +// +-------+ +---------+ +---------+ +---------+ +// | xapp | | submgr | | e2term | | rtmgr | +// +-------+ +---------+ +---------+ +---------+ +// | | | | +// | RESTSubReq | | | +// |---------------->| | | +// | RESTSubResp | | | +// |<----------------| | | +// | | RouteCreate | | +// | |--------------------------->| +// | | RouteResponse| | +// | |<---------------------------| +// | | SubReq | | +// | |------------->| | +// | | SubResp | | +// | |<-------------| | +// | RESTNotif1 | | | +// |<----------------| | | +// | | | | +// | REST get_all_xapps | | +// |---------------->| | | +// | OK 200 | | | +// |<----------------| | | +// | REST delete_all_xapp_subscriptions | xappServiceName = localhost +// |---------------->| | | +// | OK 200 | | | +// |<----------------| | | +// | | SubDelReq | | +// | |------------->| | +// | | SubDelResp | | +// | |<-------------| | +// | | | | +// | | RouteDelete | | +// | |--------------------------->| +// | | RouteResponse| | +// | |<---------------------------| +// +//----------------------------------------------------------------------------- - //Init counter check +func TestDelAllxAppSubsViaDebugIf(t *testing.T) { + + // Init counter check mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cRestSubReqFromXapp, 2}, - Counter{cRestSubRespToXapp, 2}, + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, Counter{cSubReqToE2, 1}, Counter{cSubRespFromE2, 1}, Counter{cRestSubNotifToXapp, 1}, - Counter{cRestSubFailNotifToXapp, 1}, - Counter{cRouteCreateUpdateFail, 1}, - Counter{cRestSubDelReqFromXapp, 2}, + Counter{cRestSubDelReqFromXapp, 1}, Counter{cSubDelReqToE2, 1}, Counter{cSubDelRespFromE2, 1}, - Counter{cRestSubDelRespToXapp, 2}, + Counter{cRestSubDelRespToXapp, 1}, }) - var params *teststube2ap.RESTSubsReqParams = nil + params := xappConn1.GetRESTSubsReqReportParams(subReqCount) + restSubId := xappConn1.SendRESTSubsReq(t, params) + xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) - //Subs Create - restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) + 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) - queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) + xappsJson := mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/get_all_xapps") - // xapp2 ROUTE creation shall fail with 400 from rtmgr -> submgr - waiter := rtmgrHttp.AllocNextEvent(false) - newSubsId := mainCtrl.get_registry_next_subid(t) - params = xappConn2.GetRESTSubsReqReportParams(subReqCount) - params.SetMeid("RAN_NAME_1") - restSubId2 := xappConn2.SendRESTSubsReq(t, params) + var xappList []string + err := json.Unmarshal(xappsJson, &xappList) + if err != nil { + t.Errorf("Unmarshal error: %s", err) + } + assert.Equal(t, true, mainCtrl.VerifyStringExistInSlice("localhost", xappList)) + + // Simulate deletion through REST test and debug interface + mainCtrl.SendDeleteRequest(t, "localhost:8080", "/ric/v1/delete_all_xapp_subscriptions/localhost") // localhost = xappServiceName + 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) +} + +//----------------------------------------------------------------------------- +// TestDelViaxAppSubsIf +// +// stub stub stub +// +-------+ +---------+ +---------+ +---------+ +// | xapp | | submgr | | e2term | | rtmgr | +// +-------+ +---------+ +---------+ +---------+ +// | | | | +// | RESTSubReq | | | +// |---------------->| | | +// | RESTSubResp | | | +// |<----------------| | | +// | | RouteCreate | | +// | |--------------------------->| +// | | RouteResponse| | +// | |<---------------------------| +// | | SubReq | | +// | |------------->| | +// | | SubResp | | +// | |<-------------| | +// | RESTNotif1 | | | +// |<----------------| | | +// | | | | +// | REST get_xapp_rest_restsubscriptions | +// |---------------->| | | +// | OK 200 | | | +// |<----------------| | | +// | RESTSudDel | | | +// |---------------->| | | Via user curl command (port 8088) +// | RESTSudDel | | | +// |<----------------| | | +// | | SubDelReq | | +// | |------------->| | +// | | SubDelResp | | +// | |<-------------| | +// | | | | +// | | RouteDelete | | +// | |--------------------------->| +// | | RouteResponse| | +// | |<---------------------------| +// +//----------------------------------------------------------------------------- + +func TestDelViaxAppSubsIf(t *testing.T) { + + // Init counter check + 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}, + }) + + params := xappConn1.GetRESTSubsReqReportParams(subReqCount) + restSubId := xappConn1.SendRESTSubsReq(t, params) + 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.Debug("REST notification received e2SubsId=%v", e2SubsId) + + restSubsListJson := mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/get_xapp_rest_restsubscriptions/localhost") // localhost = xappServiceName + + var restSubsMap map[string]RESTSubscription + err := json.Unmarshal(restSubsListJson, &restSubsMap) + if err != nil { + t.Errorf("Unmarshal error: %s", err) + } + _, ok := restSubsMap[restSubId] + if !ok { + t.Errorf("REST subscription not found. restSubId=%s", restSubId) + } + + var e2Subscriptions []Subscription + e2SubscriptionsJson := mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/get_e2subscriptions/"+restSubId) + err = json.Unmarshal(e2SubscriptionsJson, &e2Subscriptions) + if err != nil { + t.Errorf("Unmarshal error: %s", err) + } + if len(e2Subscriptions) != 1 { + t.Errorf("Incorrect e2Subscriptions length %v", len(e2Subscriptions)) + } + + // Simulate deletion through xapp REST test interface + mainCtrl.SendDeleteRequest(t, "localhost:8088", "/ric/v1/subscriptions/"+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) +} + +//----------------------------------------------------------------------------- +// TestRESTSubReqAndRouteNok +// +// stub stub +// +-------+ +---------+ +---------+ +// | xapp | | submgr | | rtmgr | +// +-------+ +---------+ +---------+ +// | | | +// | RESTSubReq | | +// |---------------->| | +// | | | +// | RESTSubResp | | +// |<----------------| | +// | | RouteCreate | +// | |------------->| +// | | RouteCreate | +// | | status:400 | +// | |(Bad request) | +// | |<-------------| +// | RESTNotif | | +// |<----------------| | +// | | | +// | [SUBS INT DELETE] | +// | | | +// | RESTSubDelReq | | +// |---------------->| | +// | RESTSubDelResp | | +// |<----------------| | +// +//----------------------------------------------------------------------------- +func TestRESTSubReqAndRouteNok(t *testing.T) { + + mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, + Counter{cRouteCreateFail, 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) + + // Req + params := xappConn1.GetRESTSubsReqReportParams(subReqCount) + restSubId := xappConn1.SendRESTSubsReq(t, params) + xappConn1.ExpectRESTNotificationNok(t, restSubId, "failAll") + waiter.WaitResult(t) + + e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) + xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) + + // Del + xappConn1.SendRESTSubsDelReq(t, &restSubId) + + // Wait that subs is cleaned + mainCtrl.wait_subs_clean(t, newSubsId, 10) + waitSubsCleanup(t, e2SubsId, 10) + mainCtrl.VerifyCounterValues(t) + mainCtrl.VerifyAllClean(t) +} + +//----------------------------------------------------------------------------- +// TestRESTSubReqAndRouteUpdateNok +// +// stub stub stub stub +// +-------+ +-------+ +---------+ +---------+ +---------+ +// | xapp1 | | xapp2 | | submgr | | rtmgr | | e2term | +// +-------+ +-------+ +---------+ +---------+ +---------+ +// | | | | | +// | RESTSubReq1 | | | +// |------------------------>| | | +// | RESTSubResp2 | | | +// |<------------------------| | | +// | | | | | +// | | | RouteCreate | | +// | | |------------->| | +// | | | CreateResp | | +// | | |<-------------| | +// | | | SubReq | | +// | | |---------------------------->| +// | | | SubResp | | +// | | |<----------------------------| +// | RESTNotif1 | | | +// |<------------------------| | | +// | | | | | +// | | RESTSubReq2 | | | +// | |------------>| | | +// | | RESTSubResp2| | | +// | |<------------| | | +// | | | RouteUpdate | | +// | | |------------->| | +// | | | RouteUpdate | | +// | | | status:400 | | +// | | |(Bad request) | | +// | | |<-------------| | +// | | RESTNotif2(unsuccessful) | | +// | |<------------| | | +// | | | | | +// | [SUBS INT DELETE] | | +// | | | | | +// | RESTSubDelReq1 | | | +// |------------------------>| | | +// | RESTSubDelResp1 | | | +// |<------------------------| | | +// | | | | | +// | | | [SUBS DELETE] | +// +//----------------------------------------------------------------------------- +func TestRESTSubReqAndRouteUpdateNok(t *testing.T) { + + //Init counter check + mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ + Counter{cRestSubReqFromXapp, 2}, + Counter{cRestSubRespToXapp, 2}, + Counter{cSubReqToE2, 1}, + Counter{cSubRespFromE2, 1}, + Counter{cRestSubNotifToXapp, 1}, + Counter{cRestSubFailNotifToXapp, 1}, + Counter{cRouteCreateUpdateFail, 1}, + Counter{cRestSubDelReqFromXapp, 2}, + Counter{cSubDelReqToE2, 1}, + Counter{cSubDelRespFromE2, 1}, + Counter{cRestSubDelRespToXapp, 2}, + }) + + var params *teststube2ap.RESTSubsReqParams = nil + + // Subs create for xapp1 + restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) + + queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) + + // xapp2 ROUTE creation shall fail with 400 from rtmgr -> submgr + waiter := rtmgrHttp.AllocNextEvent(false) + newSubsId := mainCtrl.get_registry_next_subid(t) + params = xappConn2.GetRESTSubsReqReportParams(subReqCount) + params.SetMeid("RAN_NAME_1") + restSubId2 := xappConn2.SendRESTSubsReq(t, params) xapp.Logger.Debug("Send REST subscriber request for second subscriber : %v", restSubId2) xappConn2.ExpectRESTNotificationNok(t, restSubId2, "allFail") waiter.WaitResult(t) @@ -2759,8 +3199,45 @@ func TestRESTSubReqAndRouteUpdateNok(t *testing.T) { mainCtrl.VerifyAllClean(t) } +//----------------------------------------------------------------------------- +// TestRESTSubDelReqAndRouteDeleteNok +// +// stub stub stub +// +-------+ +---------+ +---------+ +---------+ +// | xapp | | submgr | | rtmgr | | e2term | +// +-------+ +---------+ +---------+ +---------+ +// | | | | +// | RESTSubReq | | | +// |---------------->| | | +// | | | | +// | RESTSubResp | | | +// |<----------------| | | +// | | SubReq | | +// | |---------------------------->| +// | | SubResp | | +// | |<----------------------------| +// | RESTNotif | | | +// |<----------------| | | +// | | | | +// | | | | +// | RESTSubDelReq | | | +// |---------------->| | | +// | RESTSubDelResp | | | +// |<----------------| | | +// | | SubSelReq | | +// | |---------------------------->| +// | | SubSelResp | | +// | |<----------------------------| +// | | RouteDelete | | +// | |------------->| | +// | | Routedelete | | +// | | status:400 | | +// | |(Bad request) | | +// | |<-------------| | +// +//----------------------------------------------------------------------------- + func TestRESTSubDelReqAndRouteDeleteNok(t *testing.T) { - CaseBegin("TestRESTSubDelReqAndRouteDeleteNok") // Init counter check mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ @@ -2794,8 +3271,78 @@ func TestRESTSubDelReqAndRouteDeleteNok(t *testing.T) { mainCtrl.VerifyAllClean(t) } +//----------------------------------------------------------------------------- +// TestRESTSubMergeDelAndRouteUpdateNok +// +// stub stub stub stub +// +-------+ +-------+ +---------+ +---------+ +---------+ +// | xapp1 | | xapp2 | | submgr | | rtmgr | | e2term | +// +-------+ +-------+ +---------+ +---------+ +---------+ +// | | | | | +// | RESTSubReq1 | | | +// |------------------------>| | | +// | RESTSubResp2 | | | +// |<------------------------| | | +// | | | | | +// | | | RouteCreate | | +// | | |------------->| | +// | | | CreateResp | | +// | | |<-------------| | +// | | | SubReq | | +// | | |---------------------------->| +// | | | SubResp | | +// | | |<----------------------------| +// | RESTNotif1 | | | +// |<------------------------| | | +// | | | | | +// | | RESTSubReq2 | | | +// | |------------>| | | +// | | RESTSubResp2| | | +// | |<------------| | | +// | | | RouteCreate | | +// | | |------------->| | +// | | | CreateResp | | +// | | |<-------------| | +// | | | SubReq | | +// | | |---------------------------->| +// | | | SubResp | | +// | | |<----------------------------| +// | | RESTNotif2 | | | +// | |<------------| | | +// | | | | | +// | [SUBS INT DELETE] | | +// | | | | | +// | RESTSubDelReq1 | | | +// |------------------------>| | | +// | RESTSubDelResp1 | | | +// |<------------------------| | | +// | | | SubDelReq | | +// | | |---------------------------->| +// | | | SubDelResp | | +// | | |<----------------------------| +// | | | RouteUpdate | | +// | | |------------->| | +// | | | RouteUpdate | | +// | | | status:400 | | +// | | |(Bad request) | | +// | | |<-------------| | +// | | | | | +// | | RESTSubDelReq2 | | +// | |------------>| | | +// | | RESTSubDelResp2 | | +// | |<------------| | | +// | | | SubDelReq | | +// | | |---------------------------->| +// | | | SubdelResp | | +// | | |<----------------------------| +// | | | RouteDelete | | +// | | |------------->| | +// | | | Deleteresp | | +// | | |<-------------| | + +//----------------------------------------------------------------------------- + func TestRESTSubMergeDelAndRouteUpdateNok(t *testing.T) { - CaseBegin("TestRESTSubMergeDelAndRouteUpdateNok") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 2}, @@ -2870,7 +3417,6 @@ func TestRESTSubMergeDelAndRouteUpdateNok(t *testing.T) { //----------------------------------------------------------------------------- func TestRESTSubReqRetransmission(t *testing.T) { - CaseBegin("TestRESTSubReqRetransmission") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 2}, @@ -2961,7 +3507,6 @@ func TestRESTSubReqRetransmission(t *testing.T) { //----------------------------------------------------------------------------- func TestRESTSubReqRetransmissionV2(t *testing.T) { - CaseBegin("TestRESTSubReqRetransmissionV2") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 3}, @@ -3047,7 +3592,6 @@ func TestRESTSubReqRetransmissionV2(t *testing.T) { // //----------------------------------------------------------------------------- func TestRESTSubReqRetransmissionV3(t *testing.T) { - CaseBegin("TestRESTSubReqRetransmissionV3") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 3}, @@ -3151,7 +3695,6 @@ func TestRESTSubReqRetransmissionV3(t *testing.T) { //----------------------------------------------------------------------------- func TestRESTSubReqRetransmissionV4(t *testing.T) { - CaseBegin("TestRESTSubReqRetransmissionV4") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 3}, @@ -3274,7 +3817,6 @@ func TestRESTSubReqRetransmissionV4(t *testing.T) { //----------------------------------------------------------------------------- func TestRESTSubReqRetransmissionV5(t *testing.T) { - CaseBegin("TestRESTSubReqRetransmissionV5") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 3}, @@ -3408,7 +3950,6 @@ func TestRESTSubReqRetransmissionV5(t *testing.T) { // //----------------------------------------------------------------------------- func TestRESTSubReqRetransmissionV6(t *testing.T) { - CaseBegin("TestRESTSubReqRetransmissionV6") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 3}, @@ -3471,8 +4012,43 @@ func TestRESTSubReqRetransmissionV6(t *testing.T) { mainCtrl.VerifyAllClean(t) } +//----------------------------------------------------------------------------- +// TestRESTSubDelReqRetransmission +// +// stub stub +// +-------+ +---------+ +---------+ +// | xapp | | submgr | | e2term | +// +-------+ +---------+ +---------+ +// | | | +// | RESTSubReq | | +// |---------------->| | +// | | | +// | RESTSubResp | | +// |<----------------| | +// | | SubReq | +// | |------------->| +// | | SubResp | +// | |<-------------| +// | RESTNotif1 | | +// |<----------------| | +// | | | +// | RESTSubDelReq | | +// |---------------->| | +// | RESTSubDelResp | | +// |<----------------| | +// | | SubDelReq | +// | |------------->| +// | RESTSubDelReq | | +// |---------------->| | +// | RESTSubDelResp | | +// |<----------------| | +// | | SubDelResp | +// | |<-------------| +// | | | +// +//----------------------------------------------------------------------------- + func TestRESTSubDelReqRetransmission(t *testing.T) { - CaseBegin("TestRESTSubDelReqRetransmission") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 1}, @@ -3497,10 +4073,12 @@ func TestRESTSubDelReqRetransmission(t *testing.T) { xappConn1.SendRESTSubsDelReq(t, &restSubId) delreq, delmsg := e2termConn1.RecvSubsDelReq(t) + //Resend delete req seqBef := mainCtrl.get_msgcounter(t) xappConn1.SendRESTSubsDelReq(t, &restSubId) mainCtrl.wait_msgcounter_change(t, seqBef, 10) + // Del resp e2termConn1.SendSubsDelResp(t, delreq, delmsg) waitSubsCleanup(t, e2SubsId, 10) @@ -3538,7 +4116,6 @@ func TestRESTSubDelReqRetransmission(t *testing.T) { // //----------------------------------------------------------------------------- func TestRESTSubReqDelReq(t *testing.T) { - CaseBegin("TestRESTSubReqDelReq") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 1}, @@ -3580,15 +4157,51 @@ func TestRESTSubReqDelReq(t *testing.T) { mainCtrl.VerifyAllClean(t) } -func TestRESTSubDelReqCollision(t *testing.T) { - CaseBegin("TestRESTSubDelReqCollision - not relevant for REST API") -} - -func TestRESTSubReqAndSubDelOkTwoParallel(t *testing.T) { - CaseBegin("TestRESTSubReqAndSubDelOkTwoParallel") - - mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cRestSubReqFromXapp, 2}, +//----------------------------------------------------------------------------- +// TestRESTSubReqAndSubDelOkTwoParallel +// +// stub stub stub +// +-------+ +-------+ +---------+ +---------+ +// | xapp2 | | xapp1 | | submgr | | e2term | +// +-------+ +-------+ +---------+ +---------+ +// | | | | +// | | RESTSubReq1 | | +// | |------------->| | +// | | RESTSubResp1 | | +// | |<-------------| | +// | | | | +// | | | SubReq1 | +// | | |------------->| +// | | | | +// | RESTSubReq2 | | +// |------------------------>| | +// | RESTSubResp2 | | +// |<------------------------| | +// | | | | +// | | | SubReq2 | +// | | |------------->| +// | | | | +// | | | SubResp1 | +// | | |<-------------| +// | | RESTNotif1 | | +// | |<-------------| | +// | | | | +// | | | SubResp2 | +// | | |<-------------| +// | RESTNotif2 | | +// |<------------------------| | +// | | | | +// | | [SUBS 1 DELETE] | +// | | | | +// | | [SUBS 2 DELETE] | +// | | | | +// +//----------------------------------------------------------------------------- + +func TestRESTSubReqAndSubDelOkTwoParallel(t *testing.T) { + + mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ + Counter{cRestSubReqFromXapp, 2}, Counter{cRestSubRespToXapp, 2}, Counter{cSubReqToE2, 2}, Counter{cSubRespFromE2, 2}, @@ -3638,8 +4251,51 @@ func TestRESTSubReqAndSubDelOkTwoParallel(t *testing.T) { mainCtrl.VerifyAllClean(t) } +//----------------------------------------------------------------------------- +// TestRESTSameSubsDiffRan +// Same subscription to different RANs +// +// stub stub +// +-------+ +---------+ +---------+ +// | xapp | | submgr | | e2term | +// +-------+ +---------+ +---------+ +// | | | +// | RESTSubReq(r1) | | +// |---------------->| | +// | RESTSubResp(r1) | | +// |<----------------| | +// | | | +// | | SubReq(r1) | +// | |------------->| +// | | | +// | | SubResp(r1) | +// | |<-------------| +// | | | +// | RESTNotif(r1) | | +// |<----------------| | +// | | | +// | RESTSubReq(r2) | | +// |---------------->| | +// | | | +// | RESTSubResp(r2) | | +// |<----------------| | +// | | SubReq(r2) | +// | |------------->| +// | | | +// | | SubResp(r2) | +// | |<-------------| +// | | | +// | RESTNotif(r2) | | +// |<----------------| | +// | | | +// | [SUBS r1 DELETE] | +// | | | +// | [SUBS r2 DELETE] | +// | | | +// +//----------------------------------------------------------------------------- + func TestRESTSameSubsDiffRan(t *testing.T) { - CaseBegin("TestRESTSameSubsDiffRan") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 2}, @@ -3675,8 +4331,36 @@ func TestRESTSameSubsDiffRan(t *testing.T) { mainCtrl.VerifyAllClean(t) } +//----------------------------------------------------------------------------- +// TestRESTSubReqRetryInSubmgr +// +// stub stub +// +-------+ +---------+ +---------+ +// | xapp | | submgr | | e2term | +// +-------+ +---------+ +---------+ +// | | | +// | RESTSubReq | | +// |---------------->| | +// | RESTSubResp | | +// |<----------------| | +// | | SubReq | +// | |------------->| +// | | | +// | | | +// | | SubReq | +// | |------------->| +// | | SubResp | +// | |<-------------| +// | | | +// | RESTNotif | | +// |<----------------| | +// | | | +// | [SUBS DELETE] | +// | | | +// +//----------------------------------------------------------------------------- + func TestRESTSubReqRetryInSubmgr(t *testing.T) { - CaseBegin("TestRESTSubReqRetryInSubmgr start") // Init counter check mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ @@ -3710,6 +4394,7 @@ func TestRESTSubReqRetryInSubmgr(t *testing.T) { queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) + // Del deleteSubscription(t, xappConn1, e2termConn1, &restSubId) mainCtrl.wait_subs_clean(t, e2SubsId, 10) @@ -3760,7 +4445,6 @@ func TestRESTSubReqRetryInSubmgr(t *testing.T) { //----------------------------------------------------------------------------- func TestRESTSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { - CaseBegin("TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr start") // Init counter check mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ @@ -3799,8 +4483,41 @@ func TestRESTSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { mainCtrl.VerifyAllClean(t) } +//----------------------------------------------------------------------------- +// TestREST2eTermNotRespondingToSubReq +// +// stub stub +// +-------+ +---------+ +---------+ +// | xapp | | submgr | | e2term | +// +-------+ +---------+ +---------+ +// | | | +// | RESTSubReq | | +// |---------------->| | +// | RESTSubResp | | +// |<----------------| | +// | | SubReq | +// | |------------->| +// | | | +// | | SubReq | +// | |------------->| +// | | | +// | | SubDelReq | +// | |------------->| +// | | | +// | | SubDelReq | +// | |------------->| +// | RESTNotif(Unsuccessful) | +// |<----------------| | +// | | | +// | RESTSubDelReq | | +// |---------------->| | +// | RESTSubDelResp | | +// |<----------------| | +// | | | +// +//----------------------------------------------------------------------------- + func TestREST2eTermNotRespondingToSubReq(t *testing.T) { - CaseBegin("TestREST2eTermNotRespondingToSubReq start") // Init counter check mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ @@ -3882,7 +4599,6 @@ func TestREST2eTermNotRespondingToSubReq(t *testing.T) { // //----------------------------------------------------------------------------- func TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { - CaseBegin("TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr start") // Init counter check mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ @@ -3952,8 +4668,8 @@ func TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { // | | | // //----------------------------------------------------------------------------- + func TestRESTSubReqSubFailRespInSubmgr(t *testing.T) { - CaseBegin("TestRESTSubReqSubFailRespInSubmgr") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 1}, @@ -3993,6 +4709,83 @@ func TestRESTSubReqSubFailRespInSubmgr(t *testing.T) { mainCtrl.VerifyAllClean(t) } +//----------------------------------------------------------------------------- +// TestRESTSubReqPartialResp +// +// stub stub +// +-------+ +---------+ +---------+ +// | xapp | | submgr | | e2term | +// +-------+ +---------+ +---------+ +// | | | +// | RESTSubReq | | +// |---------------->| | +// | RESTSubResp | | +// |<----------------| | +// | | SubReq | +// | |------------->| +// | | SubResp | Partially accepted +// | |<-------------| +// | | | +// | RESTNotif | | +// |<----------------| | +// | | | +// | [SUBS DELETE] | +// | | | +// +//----------------------------------------------------------------------------- + +func TestRESTSubReqPartialResp(t *testing.T) { + + // Init counter check + mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, + Counter{cSubReqToE2, 1}, + Counter{cSubRespFromE2, 1}, + Counter{cPartialSubRespFromE2, 1}, + Counter{cRestSubNotifToXapp, 1}, + Counter{cRestSubDelReqFromXapp, 1}, + Counter{cSubDelReqToE2, 1}, + Counter{cSubDelRespFromE2, 1}, + Counter{cRestSubDelRespToXapp, 1}, + }) + + // Req + params := xappConn1.GetRESTSubsReqReportParams(subReqCount) + + actionId := int64(2) + actionType := "report" + actionDefinition := []int64{5678, 1} + subsequestActionType := "continue" + timeToWait := "w10ms" + params.AppendActionToActionToBeSetupList(actionId, actionType, actionDefinition, subsequestActionType, timeToWait) + + restSubId := xappConn1.SendRESTSubsReq(t, params) + crereq, cremsg := e2termConn1.RecvSubsReq(t) + xappConn1.ExpectRESTNotification(t, restSubId) + + actionNotAdmittedItem := e2ap.ActionNotAdmittedItem{} + actionNotAdmittedItem.ActionId = 1 + actionNotAdmittedItem.Cause.Content = 1 + actionNotAdmittedItem.Cause.Value = 8 + actionNotAdmittedList := e2ap.ActionNotAdmittedList{} + actionNotAdmittedList.Items = append(actionNotAdmittedList.Items, actionNotAdmittedItem) + e2termConn1.SendPartialSubsResp(t, crereq, cremsg, actionNotAdmittedList) + e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) + + queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) + + // Del + deleteSubscription(t, xappConn1, e2termConn1, &restSubId) + + mainCtrl.wait_subs_clean(t, e2SubsId, 10) + //Wait that subs is cleaned + waitSubsCleanup(t, e2SubsId, 10) + + mainCtrl.VerifyCounterValues(t) + mainCtrl.VerifyAllClean(t) +} + //----------------------------------------------------------------------------- // TestRESTSubDelReqRetryInSubmgr // @@ -4021,7 +4814,6 @@ func TestRESTSubReqSubFailRespInSubmgr(t *testing.T) { // //----------------------------------------------------------------------------- func TestRESTSubDelReqRetryInSubmgr(t *testing.T) { - CaseBegin("TestRESTSubDelReqRetryInSubmgr") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 1}, @@ -4082,8 +4874,8 @@ func TestRESTSubDelReqRetryInSubmgr(t *testing.T) { // | | | // //----------------------------------------------------------------------------- + func TestRESTSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { - CaseBegin("TestRESTSubDelReTwoRetriesNoRespInSubmgr") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 1}, @@ -4144,8 +4936,8 @@ func TestRESTSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { // | | | // //----------------------------------------------------------------------------- + func TestRESTSubDelReqSubDelFailRespInSubmgr(t *testing.T) { - CaseBegin("TestRESTSubDelReqSubDelFailRespInSubmgr") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 1}, @@ -4227,8 +5019,8 @@ func TestRESTSubDelReqSubDelFailRespInSubmgr(t *testing.T) { // | | | | // //----------------------------------------------------------------------------- + func TestRESTSubReqAndSubDelOkSameAction(t *testing.T) { - CaseBegin("TestRESTSubReqAndSubDelOkSameAction") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 2}, @@ -4326,7 +5118,6 @@ func TestRESTSubReqAndSubDelOkSameAction(t *testing.T) { // |<---------------------------| | // func TestRESTSubReqAndSubDelOkSameActionParallel(t *testing.T) { - CaseBegin("TestRESTSubReqAndSubDelOkSameActionParallel") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 2}, @@ -4423,8 +5214,8 @@ func TestRESTSubReqAndSubDelOkSameActionParallel(t *testing.T) { // |<------------------------------| | // //----------------------------------------------------------------------------- + func TestRESTSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { - CaseBegin("TestRESTSubReqAndSubDelNoAnswerSameActionParallel") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 2}, @@ -4526,8 +5317,8 @@ func TestRESTSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { // |<------------------------------| | // //----------------------------------------------------------------------------- + func TestRESTSubReqAndSubDelNokSameActionParallel(t *testing.T) { - CaseBegin("TestRESTSubReqAndSubDelNokSameActionParallel") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 2}, @@ -4579,8 +5370,44 @@ func TestRESTSubReqAndSubDelNokSameActionParallel(t *testing.T) { mainCtrl.VerifyAllClean(t) } +//----------------------------------------------------------------------------- +// TestRESTSubReqPolicyAndSubDelOk +// +// stub stub +// +-------+ +---------+ +---------+ +// | xapp | | submgr | | e2term | +// +-------+ +---------+ +---------+ +// | | | +// | RESTSubReq | | +// |--------------->| | +// | RESTSubResp | | +// |<---------------| | +// | | | +// | | SubReq | +// | |------------->| +// | | | +// | | SubResp | +// | |<-------------| +// | | | +// | RESTNotif | | +// |<---------------| | +// | | | +// | | | +// | RESTSubDelReq | | +// |--------------->| | +// | RESTSubDelResp | | +// |<---------------| | +// | | | +// | | SubDelReq | +// | |------------->| +// | | | +// | | SubDelResp | +// | |<-------------| +// | | | +// +//----------------------------------------------------------------------------- + func TestRESTSubReqPolicyAndSubDelOk(t *testing.T) { - CaseBegin("TestRESTSubReqPolicyAndSubDelOk") // Init counter check mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ @@ -4664,8 +5491,8 @@ func TestRESTSubReqPolicyAndSubDelOk(t *testing.T) { // |<----------------| | // //----------------------------------------------------------------------------- + func TestRESTSubReqPolicyChangeAndSubDelOk(t *testing.T) { - CaseBegin("TestRESTSubReqPolicyAndSubDelOk") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 2}, @@ -4750,8 +5577,8 @@ func TestRESTSubReqPolicyChangeAndSubDelOk(t *testing.T) { // |<----------------| | // //----------------------------------------------------------------------------- + func TestRESTSubReqPolicyChangeNOk(t *testing.T) { - CaseBegin("TestRESTSubReqPolicyChangeNOk") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 2}, @@ -4833,8 +5660,8 @@ func TestRESTSubReqPolicyChangeNOk(t *testing.T) { // | | | | // //----------------------------------------------------------------------------- + func TestRESTSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { - CaseBegin("TestRESTSubReqAndSubDelOkTwoE2termParallel") // Init counter check mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ @@ -4896,35 +5723,6 @@ func TestRESTSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { mainCtrl.VerifyAllClean(t) } -//----------------------------------------------------------------------------- -// TestRESTSubReqAsn1EncodeFail -// -// In this case submgr send RICSubscriptionDeleteRequest after encode failure which should not happen! -// stub stub -// +-------+ +---------+ +---------+ -// | xapp | | submgr | | e2term | -// +-------+ +---------+ +---------+ -// | | | -// | RESTSubReq | | -// |---------------->| | -// | | | -// | RESTSubResp | | -// |<----------------| | -// | RESTSubDelReq | | -// |---------------->| | -// | RESTSubDelResp | | -// | unsuccess | | -// |<----------------| | -// | | | -// -//----------------------------------------------------------------------------- -func TestRESTSubReqAsn1EncodeFail(t *testing.T) { - CaseBegin("TestRESTSubReqAsn1EncodeFail") - - xapp.Logger.Debug("Xapp-frame, v0.8.1 sufficient REST API validation") - -} - //----------------------------------------------------------------------------- // TestRESTSubReqInsertAndSubDelOk // @@ -4961,8 +5759,8 @@ func TestRESTSubReqAsn1EncodeFail(t *testing.T) { // |<----------------| | // //----------------------------------------------------------------------------- + func TestRESTSubReqInsertAndSubDelOk(t *testing.T) { - CaseBegin("TestRESTInsertSubReqAndSubDelOk") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 1}, @@ -5035,8 +5833,8 @@ func TestRESTSubReqInsertAndSubDelOk(t *testing.T) { // |<-------------| | // //----------------------------------------------------------------------------- + func TestRESTSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { - CaseBegin("TestRESTSubReqNokAndSubDelOkWithRestartInMiddle") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 1}, @@ -5120,7 +5918,6 @@ func TestRESTSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { //----------------------------------------------------------------------------- func TestRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { - CaseBegin("TestRESTSubReqAndSubDelOkWithRestartInMiddle") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 1}, @@ -5217,7 +6014,6 @@ func TestRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { // //----------------------------------------------------------------------------- func TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { - CaseBegin("TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 2}, @@ -5302,7 +6098,7 @@ func TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { // | |<-------------| // | RESTNotif | | // |<----------------| | -// | | SubReq | +// | | SubReq | // Only one request sent in the teat case // | |------------->| // | | | // | | SubResp | @@ -5327,7 +6123,6 @@ func TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { //----------------------------------------------------------------------------- func TestRESTReportSubReqAndSubDelOk(t *testing.T) { - CaseBegin("TestRESTReportSubReqAndSubDelOk") const subReqCount int = 1 testIndex := 1 RESTReportSubReqAndSubDelOk(t, subReqCount, testIndex) @@ -5388,66 +6183,54 @@ func RESTReportSubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { mainCtrl.VerifyCounterValues(t) } -/* -func TestRESTPolicySubReqAndSubDelOk(t *testing.T) { //Was in comments already. Next case is not run! - CaseBegin("TestRESTPolicySubReqAndSubDelOk") - - subReqCount := 2 - testIndex := 1 - RESTPolicySubReqAndSubDelOk(t, subReqCount, testIndex) - - subReqCount = 19 - testIndex = 2 - RESTPolicySubReqAndSubDelOk(t, subReqCount, testIndex) -} -*/ -func RESTPolicySubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { - xapp.Logger.Debug("TEST: TestRESTPolicySubReqAndSubDelOk with testIndex %v", testIndex) - - mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ - Counter{cRestSubReqFromXapp, 1}, - Counter{cRestSubRespToXapp, 1}, - Counter{cSubReqToE2, uint64(subReqCount)}, - Counter{cSubRespFromE2, uint64(subReqCount)}, - Counter{cRestSubNotifToXapp, 1}, - Counter{cRestSubDelReqFromXapp, 1}, - Counter{cRestSubDelRespToXapp, 1}, - Counter{cSubDelReqToE2, uint64(subReqCount)}, - Counter{cSubDelRespFromE2, uint64(subReqCount)}, - }) - - // Req - params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) - restSubId := xappConn1.SendRESTSubsReq(t, params) - - var e2SubsId []uint32 - for i := 0; i < subReqCount; i++ { - crereq, cremsg := e2termConn1.RecvSubsReq(t) - xappConn1.ExpectRESTNotification(t, restSubId) - e2termConn1.SendSubsResp(t, crereq, cremsg) - instanceId := xappConn1.WaitRESTNotification(t, restSubId) - xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) - e2SubsId = append(e2SubsId, instanceId) - } - - // Del - xappConn1.SendRESTSubsDelReq(t, &restSubId) - - for i := 0; i < subReqCount; i++ { - delreq, delmsg := e2termConn1.RecvSubsDelReq(t) - e2termConn1.SendSubsDelResp(t, delreq, delmsg) - } - - // Wait that subs is cleaned - for i := 0; i < subReqCount; i++ { - mainCtrl.wait_subs_clean(t, e2SubsId[i], 10) - } - xappConn1.TestMsgChanEmpty(t) - e2termConn1.TestMsgChanEmpty(t) - mainCtrl.wait_registry_empty(t, 10) - mainCtrl.VerifyAllClean(t) - mainCtrl.VerifyCounterValues(t) -} +//----------------------------------------------------------------------------- +// TestRESTTwoPolicySubReqAndSubDelOk +// +// stub stub +// +-------+ +---------+ +---------+ +// | xapp | | submgr | | e2term | +// +-------+ +---------+ +---------+ +// | | | +// | RestSubReq | | +// |---------------->| | +// | | | +// | RESTSubResp | | +// |<----------------| | +// | | | +// | | SubReq | +// | |------------->| +// | | | +// | | SubResp | +// | |<-------------| +// | RESTNotif | | +// |<----------------| | +// | | SubReq | +// | |------------->| +// | | | +// | | SubResp | +// | |<-------------| +// | RESTNotif | | +// |<----------------| | +// | | | +// | RESTSubDelReq | | +// |---------------->| | +// | | | +// | RESTSubDelResp| | +// |<----------------| | +// | | SubDelReq | +// | |------------->| +// | | | +// | | SubDelResp | +// | |<-------------| +// | | | +// | | SubDelReq | +// | |------------->| +// | | | +// | | SubDelResp | +// | |<-------------| +// | | | +// +//----------------------------------------------------------------------------- func TestRESTTwoPolicySubReqAndSubDelOk(t *testing.T) { @@ -5483,7 +6266,45 @@ func TestRESTTwoPolicySubReqAndSubDelOk(t *testing.T) { mainCtrl.VerifyCounterValues(t) mainCtrl.VerifyAllClean(t) } -func TestRESTPolicySubReqAndSubDelOkFullAmount(t *testing.T) { + +//----------------------------------------------------------------------------- +// TestRESTPolicySubReqAndSubDelOk19E2Subs +// +// stub stub +// +-------+ +---------+ +---------+ +// | xapp | | submgr | | e2term | +// +-------+ +---------+ +---------+ +// | | | +// | RestSubReq | | +// |---------------->| | +// | | | +// | RESTSubResp | | +// |<----------------| | +// | | | ------ +// | | SubReq | +// | |------------->| +// | | | E2 subscription x 19 +// | | SubResp | +// | |<-------------| +// | RESTNotif | | +// |<----------------| | +// | | | ------ +// | RESTSubDelReq | | +// |---------------->| | +// | | | +// | RESTSubDelResp| | +// |<----------------| | +// | | SubDelReq | ------ +// | |------------->| +// | | | E2 subscription delete x 19 +// | | SubDelResp | +// | |<-------------| +// | | | ------ +// | | | +// +//----------------------------------------------------------------------------- + +func TestRESTPolicySubReqAndSubDelOk19E2Subs(t *testing.T) { mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 1}, @@ -5516,6 +6337,55 @@ func TestRESTPolicySubReqAndSubDelOkFullAmount(t *testing.T) { mainCtrl.VerifyAllClean(t) } +//----------------------------------------------------------------------------- +// TestRESTTwoPolicySubReqAndSubDelOk +// +// stub stub +// +-------+ +---------+ +---------+ +// | xapp | | submgr | | e2term | +// +-------+ +---------+ +---------+ +// | | | +// | RestSubReq | | +// |---------------->| | +// | | | +// | RESTSubResp | | +// |<----------------| | +// | | | +// | | SubReq | +// | |------------->| +// | | | +// | | SubResp | +// | |<-------------| +// | RESTNotif | | +// |<----------------| | +// | | SubReq | +// | |------------->| +// | | | +// | | SubResp | +// | |<-------------| +// | RESTNotif | | +// |<----------------| | +// | | | +// | RESTSubDelReq | | +// |---------------->| | +// | | | +// | RESTSubDelResp| | +// |<----------------| | +// | | SubDelReq | +// | |------------->| +// | | | +// | | SubDelResp | +// | |<-------------| +// | | | +// | | SubDelReq | +// | |------------->| +// | | | +// | | SubDelResp | +// | |<-------------| +// | | | +// +//----------------------------------------------------------------------------- + func TestRESTTwoReportSubReqAndSubDelOk(t *testing.T) { subReqCount := 2 @@ -5551,6 +6421,55 @@ func TestRESTTwoReportSubReqAndSubDelOk(t *testing.T) { mainCtrl.VerifyAllClean(t) } +//----------------------------------------------------------------------------- +// TestRESTTwoReportSubReqAndSubDelOkNoActParams +// +// stub stub +// +-------+ +---------+ +---------+ +// | xapp | | submgr | | e2term | +// +-------+ +---------+ +---------+ +// | | | +// | RestSubReq | | +// |---------------->| | +// | | | +// | RESTSubResp | | +// |<----------------| | +// | | | +// | | SubReq | +// | |------------->| +// | | | +// | | SubResp | +// | |<-------------| +// | RESTNotif | | +// |<----------------| | +// | | SubReq | +// | |------------->| +// | | | +// | | SubResp | +// | |<-------------| +// | RESTNotif | | +// |<----------------| | +// | | | +// | RESTSubDelReq | | +// |---------------->| | +// | | | +// | RESTSubDelResp| | +// |<----------------| | +// | | SubDelReq | +// | |------------->| +// | | | +// | | SubDelResp | +// | |<-------------| +// | | | +// | | SubDelReq | +// | |------------->| +// | | | +// | | SubDelResp | +// | |<-------------| +// | | | +// +//----------------------------------------------------------------------------- + func TestRESTTwoReportSubReqAndSubDelOkNoActParams(t *testing.T) { subReqCount := 2 @@ -5586,7 +6505,44 @@ func TestRESTTwoReportSubReqAndSubDelOkNoActParams(t *testing.T) { mainCtrl.VerifyAllClean(t) } -func TestRESTFullAmountReportSubReqAndSubDelOk(t *testing.T) { +//----------------------------------------------------------------------------- +// TestRESTReportSubReqAndSubDelOk19E2Subs +// +// stub stub +// +-------+ +---------+ +---------+ +// | xapp | | submgr | | e2term | +// +-------+ +---------+ +---------+ +// | | | +// | RestSubReq | | +// |---------------->| | +// | | | +// | RESTSubResp | | +// |<----------------| | +// | | | ------ +// | | SubReq | +// | |------------->| +// | | | E2 subscription x 19 +// | | SubResp | +// | |<-------------| +// | RESTNotif | | +// |<----------------| | +// | | | ------ +// | RESTSubDelReq | | +// |---------------->| | +// | | | +// | RESTSubDelResp| | +// |<----------------| | +// | | SubDelReq | ------ +// | |------------->| +// | | | E2 subscription delete x 19 +// | | SubDelResp | +// | |<-------------| +// | | | ------ +// | | | +// +//----------------------------------------------------------------------------- + +func TestRESTReportSubReqAndSubDelOk19E2Subs(t *testing.T) { subReqCount := 19 @@ -5621,8 +6577,48 @@ func TestRESTFullAmountReportSubReqAndSubDelOk(t *testing.T) { mainCtrl.VerifyAllClean(t) } +//----------------------------------------------------------------------------- +// TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen +// +// stub stub stub +// +-------+ +-------+ +---------+ +---------+ +// | xapp2 | | xapp1 | | submgr | | e2term | +// +-------+ +-------+ +---------+ +---------+ +// | | | | +// | | RESTSubReq1 | | +// | |------------->| | +// | | RESTSubResp1 | | +// | |<-------------| | +// | | | | +// | | | SubReq1 | +// | | |------------->| +// | | | | +// | RESTSubReq2 | | +// |------------------------>| | +// | RESTSubResp2 | | +// |<------------------------| | +// | | | | +// | | | SubReq2 | +// | | |------------->| +// | | | | +// | | | SubResp1 | +// | | |<-------------| +// | | RESTNotif1 | | +// | |<-------------| | +// | | | | +// | | | SubResp2 | +// | | |<-------------| +// | RESTNotif2 | | +// |<------------------------| | +// | | | | +// | | [SUBS 1 DELETE] | +// | | | | +// | | [SUBS 2 DELETE] | +// | | | | +// +//----------------------------------------------------------------------------- + func TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen(t *testing.T) { - CaseBegin("TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 2}, @@ -5668,8 +6664,48 @@ func TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen(t *testing.T) { mainCtrl.VerifyAllClean(t) } +//----------------------------------------------------------------------------- +// TestRESTSubReqReportSameActionDiffActionListLen +// +// stub stub stub +// +-------+ +-------+ +---------+ +---------+ +// | xapp2 | | xapp1 | | submgr | | e2term | +// +-------+ +-------+ +---------+ +---------+ +// | | | | +// | | RESTSubReq1 | | +// | |------------->| | +// | | RESTSubResp1 | | +// | |<-------------| | +// | | | | +// | | | SubReq1 | +// | | |------------->| +// | | | | +// | RESTSubReq2 | | +// |------------------------>| | +// | RESTSubResp2 | | +// |<------------------------| | +// | | | | +// | | | SubReq2 | +// | | |------------->| +// | | | | +// | | | SubResp1 | +// | | |<-------------| +// | | RESTNotif1 | | +// | |<-------------| | +// | | | | +// | | | SubResp2 | +// | | |<-------------| +// | RESTNotif2 | | +// |<------------------------| | +// | | | | +// | | [SUBS 1 DELETE] | +// | | | | +// | | [SUBS 2 DELETE] | +// | | | | +// +//----------------------------------------------------------------------------- + func TestRESTSubReqReportSameActionDiffActionListLen(t *testing.T) { - CaseBegin("TestRESTSubReqReportSameActionDiffActionListLen") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 2}, @@ -5720,8 +6756,48 @@ func TestRESTSubReqReportSameActionDiffActionListLen(t *testing.T) { mainCtrl.VerifyAllClean(t) } +//----------------------------------------------------------------------------- +// TestRESTSubReqReportSameActionDiffActionID +// +// stub stub stub +// +-------+ +-------+ +---------+ +---------+ +// | xapp2 | | xapp1 | | submgr | | e2term | +// +-------+ +-------+ +---------+ +---------+ +// | | | | +// | | RESTSubReq1 | | +// | |------------->| | +// | | RESTSubResp1 | | +// | |<-------------| | +// | | | | +// | | | SubReq1 | +// | | |------------->| +// | | | | +// | RESTSubReq2 | | +// |------------------------>| | +// | RESTSubResp2 | | +// |<------------------------| | +// | | | | +// | | | SubReq2 | +// | | |------------->| +// | | | | +// | | | SubResp1 | +// | | |<-------------| +// | | RESTNotif1 | | +// | |<-------------| | +// | | | | +// | | | SubResp2 | +// | | |<-------------| +// | RESTNotif2 | | +// |<------------------------| | +// | | | | +// | | [SUBS 1 DELETE] | +// | | | | +// | | [SUBS 2 DELETE] | +// | | | | +// +//----------------------------------------------------------------------------- + func TestRESTSubReqReportSameActionDiffActionID(t *testing.T) { - CaseBegin("TestRESTSubReqReportSameActionDiffActionID") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 2}, @@ -5766,8 +6842,48 @@ func TestRESTSubReqReportSameActionDiffActionID(t *testing.T) { mainCtrl.VerifyAllClean(t) } +//----------------------------------------------------------------------------- +// TestRESTSubReqDiffActionType +// +// stub stub stub +// +-------+ +-------+ +---------+ +---------+ +// | xapp2 | | xapp1 | | submgr | | e2term | +// +-------+ +-------+ +---------+ +---------+ +// | | | | +// | | RESTSubReq1 | | +// | |------------->| | +// | | RESTSubResp1 | | +// | |<-------------| | +// | | | | +// | | | SubReq1 | +// | | |------------->| +// | | | | +// | RESTSubReq2 | | +// |------------------------>| | +// | RESTSubResp2 | | +// |<------------------------| | +// | | | | +// | | | SubReq2 | +// | | |------------->| +// | | | | +// | | | SubResp1 | +// | | |<-------------| +// | | RESTNotif1 | | +// | |<-------------| | +// | | | | +// | | | SubResp2 | +// | | |<-------------| +// | RESTNotif2 | | +// |<------------------------| | +// | | | | +// | | [SUBS 1 DELETE] | +// | | | | +// | | [SUBS 2 DELETE] | +// | | | | +// +//----------------------------------------------------------------------------- + func TestRESTSubReqDiffActionType(t *testing.T) { - CaseBegin("TestRESTSubReqDiffActionType") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 2}, @@ -5817,8 +6933,48 @@ func TestRESTSubReqDiffActionType(t *testing.T) { mainCtrl.VerifyAllClean(t) } +//----------------------------------------------------------------------------- +// TestRESTSubReqPolicyAndSubDelOkSameAction +// +// stub stub stub +// +-------+ +-------+ +---------+ +---------+ +// | xapp2 | | xapp1 | | submgr | | e2term | +// +-------+ +-------+ +---------+ +---------+ +// | | | | +// | | RESTSubReq1 | | +// | |------------->| | +// | | RESTSubResp1 | | +// | |<-------------| | +// | | | | +// | | | SubReq1 | +// | | |------------->| +// | | | | +// | RESTSubReq2 | | +// |------------------------>| | +// | RESTSubResp2 | | +// |<------------------------| | +// | | | | +// | | | SubReq2 | +// | | |------------->| +// | | | | +// | | | SubResp1 | +// | | |<-------------| +// | | RESTNotif1 | | +// | |<-------------| | +// | | | | +// | | | SubResp2 | +// | | |<-------------| +// | RESTNotif2 | | +// |<------------------------| | +// | | | | +// | | [SUBS 1 DELETE] | +// | | | | +// | | [SUBS 2 DELETE] | +// | | | | +// +//----------------------------------------------------------------------------- + func TestRESTSubReqPolicyAndSubDelOkSameAction(t *testing.T) { - CaseBegin("TestRESTSubReqPolicyAndSubDelOkSameAction") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 2}, @@ -5868,8 +7024,48 @@ func TestRESTSubReqPolicyAndSubDelOkSameAction(t *testing.T) { mainCtrl.VerifyAllClean(t) } +//----------------------------------------------------------------------------- +// TestRESTSubReqReportSameActionDiffActionDefinitionLen +// +// stub stub stub +// +-------+ +-------+ +---------+ +---------+ +// | xapp2 | | xapp1 | | submgr | | e2term | +// +-------+ +-------+ +---------+ +---------+ +// | | | | +// | | RESTSubReq1 | | +// | |------------->| | +// | | RESTSubResp1 | | +// | |<-------------| | +// | | | | +// | | | SubReq1 | +// | | |------------->| +// | | | | +// | RESTSubReq2 | | +// |------------------------>| | +// | RESTSubResp2 | | +// |<------------------------| | +// | | | | +// | | | SubReq2 | +// | | |------------->| +// | | | | +// | | | SubResp1 | +// | | |<-------------| +// | | RESTNotif1 | | +// | |<-------------| | +// | | | | +// | | | SubResp2 | +// | | |<-------------| +// | RESTNotif2 | | +// |<------------------------| | +// | | | | +// | | [SUBS 1 DELETE] | +// | | | | +// | | [SUBS 2 DELETE] | +// | | | | +// +//----------------------------------------------------------------------------- + func TestRESTSubReqReportSameActionDiffActionDefinitionLen(t *testing.T) { - CaseBegin("TestRESTSubReqReportSameActionDiffActionDefinitionLen") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 2}, @@ -5915,8 +7111,48 @@ func TestRESTSubReqReportSameActionDiffActionDefinitionLen(t *testing.T) { mainCtrl.VerifyAllClean(t) } +//----------------------------------------------------------------------------- +// TestRESTSubReqReportSameActionDiffActionDefinitionContents +// +// stub stub stub +// +-------+ +-------+ +---------+ +---------+ +// | xapp2 | | xapp1 | | submgr | | e2term | +// +-------+ +-------+ +---------+ +---------+ +// | | | | +// | | RESTSubReq1 | | +// | |------------->| | +// | | RESTSubResp1 | | +// | |<-------------| | +// | | | | +// | | | SubReq1 | +// | | |------------->| +// | | | | +// | RESTSubReq2 | | +// |------------------------>| | +// | RESTSubResp2 | | +// |<------------------------| | +// | | | | +// | | | SubReq2 | +// | | |------------->| +// | | | | +// | | | SubResp1 | +// | | |<-------------| +// | | RESTNotif1 | | +// | |<-------------| | +// | | | | +// | | | SubResp2 | +// | | |<-------------| +// | RESTNotif2 | | +// |<------------------------| | +// | | | | +// | | [SUBS 1 DELETE] | +// | | | | +// | | [SUBS 2 DELETE] | +// | | | | +// +//----------------------------------------------------------------------------- + func TestRESTSubReqReportSameActionDiffActionDefinitionContents(t *testing.T) { - CaseBegin("TestRESTSubReqReportSameActionDiffActionDefinitionContents") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 2}, @@ -5962,8 +7198,48 @@ func TestRESTSubReqReportSameActionDiffActionDefinitionContents(t *testing.T) { mainCtrl.VerifyAllClean(t) } +//----------------------------------------------------------------------------- +// TestRESTSubReqReportSameActionDiffSubsAction +// +// stub stub stub +// +-------+ +-------+ +---------+ +---------+ +// | xapp2 | | xapp1 | | submgr | | e2term | +// +-------+ +-------+ +---------+ +---------+ +// | | | | +// | | RESTSubReq1 | | +// | |------------->| | +// | | RESTSubResp1 | | +// | |<-------------| | +// | | | | +// | | | SubReq1 | +// | | |------------->| +// | | | | +// | RESTSubReq2 | | +// |------------------------>| | +// | RESTSubResp2 | | +// |<------------------------| | +// | | | | +// | | | SubReq2 | +// | | |------------->| +// | | | | +// | | | SubResp1 | +// | | |<-------------| +// | | RESTNotif1 | | +// | |<-------------| | +// | | | | +// | | | SubResp2 | +// | | |<-------------| +// | RESTNotif2 | | +// |<------------------------| | +// | | | | +// | | [SUBS 1 DELETE] | +// | | | | +// | | [SUBS 2 DELETE] | +// | | | | +// +//----------------------------------------------------------------------------- + func TestRESTSubReqReportSameActionDiffSubsAction(t *testing.T) { - CaseBegin("TestRESTSubReqReportSameActionDiffSubsAction") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 2}, @@ -6041,7 +7317,6 @@ func TestRESTSubReqReportSameActionDiffSubsAction(t *testing.T) { //----------------------------------------------------------------------------- func TestRESTUnpackSubscriptionResponseDecodeFail(t *testing.T) { - xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionResponseDecodeFail") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 1}, @@ -6130,7 +7405,6 @@ func TestRESTUnpackSubscriptionResponseDecodeFail(t *testing.T) { //----------------------------------------------------------------------------- func TestRESTUnpackSubscriptionResponseUnknownInstanceId(t *testing.T) { - xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionResponseUnknownInstanceId") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 1}, @@ -6231,8 +7505,8 @@ func TestRESTUnpackSubscriptionResponseUnknownInstanceId(t *testing.T) { // | | | // //----------------------------------------------------------------------------- + func TestRESTUnpackSubscriptionResponseNoTransaction(t *testing.T) { - xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionResponseNoTransaction") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 1}, @@ -6327,8 +7601,8 @@ func TestRESTUnpackSubscriptionResponseNoTransaction(t *testing.T) { // | | | // //----------------------------------------------------------------------------- + func TestRESTUnpackSubscriptionFailureDecodeFail(t *testing.T) { - xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionFailureDecodeFail") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 1}, @@ -6416,7 +7690,7 @@ func TestRESTUnpackSubscriptionFailureDecodeFail(t *testing.T) { // //----------------------------------------------------------------------------- func TestRESTUnpackSubscriptionFailureUnknownInstanceId(t *testing.T) { - xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionFailureUnknownInstanceId") + const subReqCount int = 1 mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ @@ -6514,8 +7788,9 @@ func TestRESTUnpackSubscriptionFailureUnknownInstanceId(t *testing.T) { // | | | // //----------------------------------------------------------------------------- + func TestRESTUnpackSubscriptionFailureNoTransaction(t *testing.T) { - xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionFailureNoTransaction") + const subReqCount int = 1 mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ @@ -6610,8 +7885,8 @@ func TestRESTUnpackSubscriptionFailureNoTransaction(t *testing.T) { // | | | // //----------------------------------------------------------------------------- + func TestRESTUnpackSubscriptionDeleteResponseDecodeFail(t *testing.T) { - xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteResponseDecodeFail") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 1}, @@ -6689,8 +7964,8 @@ func TestRESTUnpackSubscriptionDeleteResponseDecodeFail(t *testing.T) { // | [SUBS DELETE] | // | | | //----------------------------------------------------------------------------- + func TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId(t *testing.T) { - xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 1}, @@ -6769,8 +8044,8 @@ func TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId(t *testing.T) { // | [SUBS DELETE] | // | | | //----------------------------------------------------------------------------- + func TestRESTUnpackSubscriptionDeleteResponseNoTransaction(t *testing.T) { - xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteResponseNoTransaction") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 1}, @@ -6850,8 +8125,8 @@ func TestRESTUnpackSubscriptionDeleteResponseNoTransaction(t *testing.T) { // | [SUBS DELETE] | // | | | //----------------------------------------------------------------------------- + func TestRESTUnpackSubscriptionDeleteFailureDecodeFail(t *testing.T) { - xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteFailureDecodeFail") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 1}, @@ -6928,8 +8203,8 @@ func TestRESTUnpackSubscriptionDeleteFailureDecodeFail(t *testing.T) { // | [SUBS DELETE] | // | | | //----------------------------------------------------------------------------- + func TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId(t *testing.T) { - xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 1}, @@ -7007,8 +8282,8 @@ func TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId(t *testing.T) { // | [SUBS DELETE] | // | | | //----------------------------------------------------------------------------- + func TestRESTUnpackSubscriptionDeleteFailureNoTransaction(t *testing.T) { - xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteFailureNoTransaction") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 1}, @@ -7085,6 +8360,7 @@ func TestRESTUnpackSubscriptionDeleteFailureNoTransaction(t *testing.T) { // | | | // //----------------------------------------------------------------------------- + func TestRESTSubReqFailAsn1PackSubReqError(t *testing.T) { mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ @@ -7121,8 +8397,55 @@ func TestRESTSubReqFailAsn1PackSubReqError(t *testing.T) { mainCtrl.VerifyCounterValues(t) } +//----------------------------------------------------------------------------- +// TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction +// +// stub stub +// +-------+ +---------+ +---------+ +// | xapp | | submgr | | e2term | +// +-------+ +---------+ +---------+ +// | | | +// | RESTSubReq | | +// |---------------->| | +// | | | +// | RESTSubResp | | +// |<----------------| | +// | | SubReq | +// | |------------->| +// | | | +// | | SubResp | +// | |<-------------| +// | | | +// | RESTNotif | | +// |<----------------| | +// | | | +// | RESTSubReq | | Policy modification +// |---------------->| | +// | | | +// | RESTSubResp | | +// |<----------------| | +// | | SubReq | +// | |------------->| +// | | | +// | | | +// | RESTNotif(Unsuccessful) | E2 timeout +// |<----------------| | +// | | | +// | RESTSubDelReq | | +// |---------------->| | +// | | | +// | | SubDelReq | +// | |------------->| +// | | | +// | | SubDelResp | +// | |<-------------| +// | | | +// | RESTSubDelResp | | +// |<----------------| | +// +//----------------------------------------------------------------------------- + func TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction(t *testing.T) { - CaseBegin("TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 2}, @@ -7227,7 +8550,6 @@ func TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction(t *testing.T) { //----------------------------------------------------------------------------- func TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { - CaseBegin("TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle") mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 2},