X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Fteststube2ap%2FstubE2.go;h=5d28d3bff674d7c05369e75417eb509dc4115fe7;hb=ac8bde486e4453d613db6ae05f6839661068a4ab;hp=56043937510a5b8b437daa096489982337d70bf1;hpb=39d94ea1dd0e04ee6da8742d133393ce6ed3200c;p=ric-plt%2Fsubmgr.git diff --git a/pkg/teststube2ap/stubE2.go b/pkg/teststube2ap/stubE2.go index 5604393..5d28d3b 100644 --- a/pkg/teststube2ap/stubE2.go +++ b/pkg/teststube2ap/stubE2.go @@ -324,6 +324,38 @@ func (tc *E2Stub) SendSubsResp(t *testing.T, req *e2ap.E2APSubscriptionRequest, } } +//----------------------------------------------------------------------------- +// +//----------------------------------------------------------------------------- +func (tc *E2Stub) SendInvalidE2Asn1Resp(t *testing.T, msg *xapp.RMRParams, msgType int) { + + params := &xapp.RMRParams{} + params.Mtype = msgType + params.SubId = -1 + params.Payload = []byte{1, 2, 3, 4, 5} + params.PayloadLen = 5 + params.Meid = msg.Meid + params.Xid = "" + params.Mbuf = nil + + if params.Mtype == xapp.RIC_SUB_RESP { + tc.Info("SEND INVALID ASN.1 SUB RESP") + + } else if params.Mtype == xapp.RIC_SUB_FAILURE { + tc.Info("SEND INVALID ASN.1 SUB FAILURE") + + } else if params.Mtype == xapp.RIC_SUB_DEL_RESP { + tc.Info("SEND INVALID ASN.1 SUB DEL RESP") + + } else if params.Mtype == xapp.RIC_SUB_DEL_FAILURE { + tc.Info("SEND INVALID ASN.1 SUB DEL FAILURE") + } + snderr := tc.SendWithRetry(params, false, 5) + if snderr != nil { + tc.TestError(t, "RMR SEND FAILED: %s", snderr.Error()) + } +} + //----------------------------------------------------------------------------- // //----------------------------------------------------------------------------- @@ -597,7 +629,7 @@ func (tc *E2Stub) SendSubsDelFail(t *testing.T, req *e2ap.E2APSubscriptionDelete resp.RequestId.Id = req.RequestId.Id resp.RequestId.InstanceId = req.RequestId.InstanceId resp.FunctionId = req.FunctionId - resp.Cause.Content = 4 // CauseMisc + resp.Cause.Content = 5 // CauseMisc resp.Cause.Value = 3 // unspecified packerr, packedMsg := e2SubsDelFail.Pack(resp) @@ -631,7 +663,11 @@ func (tc *E2Stub) SendSubsDelFail(t *testing.T, req *e2ap.E2APSubscriptionDelete // Callback handler for subscription response notifications //----------------------------------------------------------------------------- func (tc *E2Stub) SubscriptionRespHandler(resp *clientmodel.SubscriptionResponse) { - if tc.subscriptionId == *resp.SubscriptionID { + if tc.subscriptionId == "SUBSCRIPTIONID NOT SET" { + tc.Info("REST notification received for %v while no SubscriptionID was not set for InstanceID=%v, RequestorID=%v (%v)", + *resp.SubscriptionID, *resp.SubscriptionInstances[0].InstanceID, *resp.SubscriptionInstances[0].RequestorID, tc) + tc.CallBackNotification <- *resp.SubscriptionInstances[0].InstanceID + } else if tc.subscriptionId == *resp.SubscriptionID { tc.Info("REST notification received SubscriptionID=%s, InstanceID=%v, RequestorID=%v (%v)", *resp.SubscriptionID, *resp.SubscriptionInstances[0].InstanceID, *resp.SubscriptionInstances[0].RequestorID, tc) tc.CallBackNotification <- *resp.SubscriptionInstances[0].InstanceID @@ -771,6 +807,8 @@ func (tc *E2Stub) SendRESTSubsReq(t *testing.T, params *RESTSubsReqParams) strin return "" } + tc.subscriptionId = "SUBSCIPTIONID NOT SET" + resp, err := xapp.Subscription.Subscribe(¶ms.SubsReqParams) if err != nil { // Swagger generated code makes checks for the values that are inserted the subscription function