From: Konstantinos Archangelof Date: Tue, 25 May 2021 14:21:51 +0000 (+0000) Subject: Added Test Case to improve e2ap.go coverity coverage i,e PackSubscriptionRequest... X-Git-Tag: 0.7.1~20 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=b3277dceb4d0791961942583781f371222fb12ff;p=ric-plt%2Fsubmgr.git Added Test Case to improve e2ap.go coverity coverage i,e PackSubscriptionRequest() failure Signed-off-by: Konstantinos Archangelof Change-Id: I0b1504b280cff988d5d7e942fce8d44af7609fc4 --- diff --git a/pkg/control/ut_messaging_test.go b/pkg/control/ut_messaging_test.go index e3d6655..b137905 100644 --- a/pkg/control/ut_messaging_test.go +++ b/pkg/control/ut_messaging_test.go @@ -5722,6 +5722,74 @@ func TestRESTUnpackSubscriptionDeleteFailureNoTransaction(t *testing.T) { mainCtrl.wait_registry_empty(t, 10) } +//----------------------------------------------------------------------------- +// TestRESTSubReqFailAsn1PackSubReqError +// +// stub stub +// +-------+ +---------+ +---------+ +// | xapp | | submgr | | e2term | +// +-------+ +---------+ +---------+ +// | | | +// | RESTSubReq | | +// |---------------->| | +// | | | +// | RESTSubResp | | +// |<----------------| | +// | | | +// | ASN.1 encode fails | +// | | | +// | | SubDelReq | +// | |------------->| +// | | | +// | | SubDelFail | +// | |<-------------| +// | | | +// | RESTNotif | | +// | unsuccess | | +// |<----------------| | +// | | | +// | [SUBS DELETE] | +// | | | +// +//----------------------------------------------------------------------------- +func TestRESTSubReqFailAsn1PackSubReqError(t *testing.T) { + + mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ + Counter{cSubReqFromXapp, 1}, + Counter{cSubDelReqToE2, 1}, + Counter{cSubDelFailFromE2, 1}, + Counter{cSubRespToXapp, 1}, + }) + + subReqCount := 1 + parameterSet := 1 // E2SM-gNB-X2 + actionDefinitionPresent := true + actionParamCount := 1 + + var params *teststube2ap.RESTSubsReqParams = nil + params = xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) + e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, false) + + // Req + restSubId := xappConn1.SendRESTSubsReq(t, params) + xapp.Logger.Info("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) + + e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) + xapp.Logger.Info("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) +} + //////////////////////////////////////////////////////////////////////////////////// // Services for UT cases ////////////////////////////////////////////////////////////////////////////////////