X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Fcontrol%2Fut_messaging_test.go;h=e6d6646b2900a7359bae8dc0dc5c546debdec10c;hb=refs%2Fchanges%2F36%2F6136%2F4;hp=e3d6655649d27079be71c95ca7328033b3a741da;hpb=5112239fe7bf1a53f43d8898d2862921594b1f80;p=ric-plt%2Fsubmgr.git diff --git a/pkg/control/ut_messaging_test.go b/pkg/control/ut_messaging_test.go index e3d6655..e6d6646 100644 --- a/pkg/control/ut_messaging_test.go +++ b/pkg/control/ut_messaging_test.go @@ -30,14 +30,56 @@ import ( "github.com/stretchr/testify/assert" ) -func TestRESTSubReqAndDeleteOkWithE2apUtWrapper(t *testing.T) { - +func TestSuiteSetup(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: + // like this:git log // SetPackerIf(e2ap_wrapper.NewAsn1E2APPacker()) SetPackerIf(e2ap_wrapper.NewUtAsn1E2APPacker()) +} + +//----------------------------------------------------------------------------- +// 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) @@ -46,6 +88,114 @@ func TestRESTSubReqAndDeleteOkWithE2apUtWrapper(t *testing.T) { waitSubsCleanup(t, e2SubsId, 10) } +//----------------------------------------------------------------------------- +// 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) +} + +//----------------------------------------------------------------------------- +// 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) +} + //----------------------------------------------------------------------------- // TestSubReqAndRouteNok //