2 ==================================================================================
3 Copyright (c) 2019 AT&T Intellectual Property.
4 Copyright (c) 2019 Nokia
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
17 ==================================================================================
23 "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap"
24 "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap_wrapper"
25 "gerrit.o-ran-sc.org/r/ric-plt/submgr/pkg/teststub"
26 "gerrit.o-ran-sc.org/r/ric-plt/submgr/pkg/xapptweaks"
27 "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp"
32 //-----------------------------------------------------------------------------
34 //-----------------------------------------------------------------------------
35 var e2asnpacker e2ap.E2APPackerIf = e2ap_wrapper.NewAsn1E2Packer()
37 //-----------------------------------------------------------------------------
39 //-----------------------------------------------------------------------------
40 type RmrTransactionId struct {
45 func (trans *RmrTransactionId) String() string {
46 return "trans(" + trans.xid + "/" + (&xapptweaks.RMRMeid{trans.meid}).String() + ")"
50 teststub.RmrStubControl
54 //-----------------------------------------------------------------------------
56 //-----------------------------------------------------------------------------
57 func CreateNewE2Stub(desc string, srcId teststub.RmrSrcId, rtgSvc teststub.RmrRtgSvc, stat string, mtypeseed int) *E2Stub {
59 tc.RmrStubControl.Init(desc, srcId, rtgSvc, stat, mtypeseed)
65 //-----------------------------------------------------------------------------
67 //-----------------------------------------------------------------------------
68 func CreateNewE2termStub(desc string, srcId teststub.RmrSrcId, rtgSvc teststub.RmrRtgSvc, stat string, mtypeseed int) *E2Stub {
70 tc.RmrStubControl.Init(desc, srcId, rtgSvc, stat, mtypeseed)
76 //-----------------------------------------------------------------------------
78 //-----------------------------------------------------------------------------
79 func (tc *E2Stub) NewRmrTransactionId(xid string, ranname string) *RmrTransactionId {
80 trans := &RmrTransactionId{}
82 trans.xid = tc.GetDesc() + "_XID_" + strconv.FormatUint(uint64(tc.xid_seq), 10)
87 trans.meid = &xapp.RMRMeid{RanName: ranname}
88 tc.Logger.Info("New test %s", trans.String())
92 //-----------------------------------------------------------------------------
94 //-----------------------------------------------------------------------------
95 type E2StubSubsReqParams struct {
96 Req *e2ap.E2APSubscriptionRequest
99 func (p *E2StubSubsReqParams) Init() {
100 p.Req = &e2ap.E2APSubscriptionRequest{}
102 p.Req.RequestId.Id = 1
103 p.Req.RequestId.InstanceId = 0
106 // gnb -> enb outgoing
107 // enb -> gnb incoming
109 p.Req.EventTriggerDefinition.NBX2EventTriggerDefinitionPresent = true
110 p.Req.EventTriggerDefinition.NBNRTEventTriggerDefinitionPresent = false
111 if p.Req.EventTriggerDefinition.NBX2EventTriggerDefinitionPresent == true {
112 p.Req.EventTriggerDefinition.InterfaceId.GlobalEnbId.Present = true
113 p.Req.EventTriggerDefinition.InterfaceId.GlobalEnbId.PlmnIdentity.Set("310150")
114 p.Req.EventTriggerDefinition.InterfaceId.GlobalEnbId.NodeId.Id = 123
115 p.Req.EventTriggerDefinition.InterfaceId.GlobalEnbId.NodeId.Bits = e2ap.E2AP_ENBIDHomeBits28
117 p.Req.EventTriggerDefinition.InterfaceDirection = e2ap.E2AP_InterfaceDirectionIncoming
118 p.Req.EventTriggerDefinition.ProcedureCode = 5 //28 35
119 p.Req.EventTriggerDefinition.TypeOfMessage = e2ap.E2AP_InitiatingMessage
120 } else if p.Req.EventTriggerDefinition.NBNRTEventTriggerDefinitionPresent == true {
121 p.Req.EventTriggerDefinition.NBNRTEventTriggerDefinition.TriggerNature = e2ap.NRTTriggerNature_now
124 p.Req.ActionSetups = make([]e2ap.ActionToBeSetupItem, 1)
126 p.Req.ActionSetups[0].ActionId = 0
127 p.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypeReport
128 p.Req.ActionSetups[0].RicActionDefinitionPresent = true
129 p.Req.ActionSetups[0].ActionDefinitionChoice.ActionDefinitionX2Format1Present = false
130 p.Req.ActionSetups[0].ActionDefinitionChoice.ActionDefinitionX2Format2Present = true
131 p.Req.ActionSetups[0].ActionDefinitionChoice.ActionDefinitionNRTFormat1Present = false
133 if p.Req.ActionSetups[0].ActionDefinitionChoice.ActionDefinitionX2Format1Present {
134 p.Req.ActionSetups[0].ActionDefinitionChoice.ActionDefinitionX2Format1.StyleID = 99
136 for index := 0; index < 1; index++ {
137 actionParameterItem := e2ap.ActionParameterItem{}
138 actionParameterItem.ParameterID = 11
139 actionParameterItem.ActionParameterValue.ValueIntPresent = true
140 actionParameterItem.ActionParameterValue.ValueInt = 100
141 p.Req.ActionSetups[0].ActionDefinitionChoice.ActionDefinitionX2Format1.ActionParameterItems =
142 append(p.Req.ActionSetups[0].ActionDefinitionChoice.ActionDefinitionX2Format1.ActionParameterItems, actionParameterItem)
144 } else if p.Req.ActionSetups[0].ActionDefinitionChoice.ActionDefinitionX2Format2Present {
146 for index := 0; index < 1; index++ {
147 ranUEgroupItem := e2ap.RANueGroupItem{}
149 for index2 := 0; index2 < 1; index2++ {
150 ranUEGroupDefItem := e2ap.RANueGroupDefItem{}
151 ranUEGroupDefItem.RanParameterID = 22
152 ranUEGroupDefItem.RanParameterTest = e2ap.RANParameterTest_equal
153 ranUEGroupDefItem.RanParameterValue.ValueIntPresent = true
154 ranUEGroupDefItem.RanParameterValue.ValueInt = 100
155 ranUEgroupItem.RanUEgroupDefinition.RanUEGroupDefItems = append(ranUEgroupItem.RanUEgroupDefinition.RanUEGroupDefItems, ranUEGroupDefItem)
158 for index3 := 0; index3 < 1; index3++ {
159 ranParameterItem := e2ap.RANParameterItem{}
160 ranParameterItem.RanParameterID = 33
161 ranParameterItem.RanParameterValue.ValueIntPresent = true
162 ranParameterItem.RanParameterValue.ValueInt = 100
163 ranUEgroupItem.RanPolicy.RanParameterItems = append(ranUEgroupItem.RanPolicy.RanParameterItems, ranParameterItem)
165 ranUEgroupItem.RanUEgroupID = 2
166 p.Req.ActionSetups[0].ActionDefinitionChoice.ActionDefinitionX2Format2.RanUEgroupItems =
167 append(p.Req.ActionSetups[0].ActionDefinitionChoice.ActionDefinitionX2Format2.RanUEgroupItems, ranUEgroupItem)
169 } else if p.Req.ActionSetups[0].ActionDefinitionChoice.ActionDefinitionNRTFormat1Present {
171 for index := 0; index < 1; index++ {
172 ranParameterItem := e2ap.RANParameterItem{}
173 ranParameterItem.RanParameterID = 33
174 ranParameterItem.RanParameterValue.ValueIntPresent = true
175 ranParameterItem.RanParameterValue.ValueInt = 100
176 p.Req.ActionSetups[0].ActionDefinitionChoice.ActionDefinitionNRTFormat1.RanParameterList =
177 append(p.Req.ActionSetups[0].ActionDefinitionChoice.ActionDefinitionNRTFormat1.RanParameterList, ranParameterItem)
180 p.Req.ActionSetups[0].SubsequentAction.Present = true
181 p.Req.ActionSetups[0].SubsequentAction.Type = e2ap.E2AP_SubSeqActionTypeContinue
182 p.Req.ActionSetups[0].SubsequentAction.TimetoWait = e2ap.E2AP_TimeToWaitZero
185 //-----------------------------------------------------------------------------
187 //-----------------------------------------------------------------------------
189 type E2StubSubsFailParams struct {
190 Req *e2ap.E2APSubscriptionRequest
191 Fail *e2ap.E2APSubscriptionFailure
194 func (p *E2StubSubsFailParams) Set(req *e2ap.E2APSubscriptionRequest) {
197 p.Fail = &e2ap.E2APSubscriptionFailure{}
198 p.Fail.RequestId.Id = p.Req.RequestId.Id
199 p.Fail.RequestId.InstanceId = p.Req.RequestId.InstanceId
200 p.Fail.FunctionId = p.Req.FunctionId
201 p.Fail.ActionNotAdmittedList.Items = make([]e2ap.ActionNotAdmittedItem, len(p.Req.ActionSetups))
202 for index := int(0); index < len(p.Fail.ActionNotAdmittedList.Items); index++ {
203 p.Fail.ActionNotAdmittedList.Items[index].ActionId = p.Req.ActionSetups[index].ActionId
204 p.SetCauseVal(index, 5, 1)
208 func (p *E2StubSubsFailParams) SetCauseVal(ind int, content uint8, causeval uint8) {
211 for index := int(0); index < len(p.Fail.ActionNotAdmittedList.Items); index++ {
212 p.Fail.ActionNotAdmittedList.Items[index].Cause.Content = content
213 p.Fail.ActionNotAdmittedList.Items[index].Cause.Value = causeval
217 p.Fail.ActionNotAdmittedList.Items[ind].Cause.Content = content
218 p.Fail.ActionNotAdmittedList.Items[ind].Cause.Value = causeval
221 //-----------------------------------------------------------------------------
223 //-----------------------------------------------------------------------------
225 func (tc *E2Stub) SendSubsReq(t *testing.T, rparams *E2StubSubsReqParams, oldTrans *RmrTransactionId) *RmrTransactionId {
229 trans = tc.NewRmrTransactionId("", "RAN_NAME_1")
232 tc.Logger.Info("SendSubsReq %s", trans.String())
233 e2SubsReq := e2asnpacker.NewPackerSubscriptionRequest()
235 //---------------------------------
236 // xapp activity: Send Subs Req
237 //---------------------------------
241 myparams = &E2StubSubsReqParams{}
245 err, packedMsg := e2SubsReq.Pack(myparams.Req)
247 tc.TestError(t, "pack NOK %s %s", trans.String(), err.Error())
250 tc.Logger.Debug("%s %s", trans.String(), e2SubsReq.String())
252 params := xapptweaks.NewParams(nil)
253 params.Mtype = xapp.RIC_SUB_REQ
255 params.Payload = packedMsg.Buf
256 params.PayloadLen = len(packedMsg.Buf)
257 params.Meid = trans.meid
258 params.Xid = trans.xid
261 tc.Logger.Info("SEND SUB REQ: %s", params.String())
262 snderr := tc.RmrSend(params, 5)
264 tc.TestError(t, "RMR SEND FAILED: %s %s", trans.String(), snderr.Error())
270 //-----------------------------------------------------------------------------
272 //-----------------------------------------------------------------------------
273 func (tc *E2Stub) RecvSubsReq(t *testing.T) (*e2ap.E2APSubscriptionRequest, *xapptweaks.RMRParams) {
274 tc.Logger.Info("RecvSubsReq")
275 e2SubsReq := e2asnpacker.NewPackerSubscriptionRequest()
277 //---------------------------------
278 // e2term activity: Recv Subs Req
279 //---------------------------------
280 msg := tc.WaitMsg(15)
282 if msg.Mtype != xapp.RICMessageTypes["RIC_SUB_REQ"] {
283 tc.TestError(t, "Received wrong mtype expected %s got %s, error", "RIC_SUB_REQ", xapp.RicMessageTypeToName[msg.Mtype])
285 tc.Logger.Info("Recv Subs Req")
286 packedData := &e2ap.PackedData{}
287 packedData.Buf = msg.Payload
288 unpackerr, req := e2SubsReq.UnPack(packedData)
289 if unpackerr != nil {
290 tc.TestError(t, "RIC_SUB_REQ unpack failed err: %s", unpackerr.Error())
295 tc.TestError(t, "Not Received msg within %d secs", 15)
301 //-----------------------------------------------------------------------------
303 //-----------------------------------------------------------------------------
304 func (tc *E2Stub) SendSubsResp(t *testing.T, req *e2ap.E2APSubscriptionRequest, msg *xapptweaks.RMRParams) {
305 tc.Logger.Info("SendSubsResp")
306 e2SubsResp := e2asnpacker.NewPackerSubscriptionResponse()
308 //---------------------------------
309 // e2term activity: Send Subs Resp
310 //---------------------------------
311 resp := &e2ap.E2APSubscriptionResponse{}
313 resp.RequestId.Id = req.RequestId.Id
314 resp.RequestId.InstanceId = req.RequestId.InstanceId
315 resp.FunctionId = req.FunctionId
317 resp.ActionAdmittedList.Items = make([]e2ap.ActionAdmittedItem, len(req.ActionSetups))
318 for index := int(0); index < len(req.ActionSetups); index++ {
319 resp.ActionAdmittedList.Items[index].ActionId = req.ActionSetups[index].ActionId
322 for index := uint64(0); index < 1; index++ {
323 item := e2ap.ActionNotAdmittedItem{}
324 item.ActionId = index
325 item.Cause.Content = 1
327 resp.ActionNotAdmittedList.Items = append(resp.ActionNotAdmittedList.Items, item)
330 packerr, packedMsg := e2SubsResp.Pack(resp)
332 tc.TestError(t, "pack NOK %s", packerr.Error())
334 tc.Logger.Debug("%s", e2SubsResp.String())
336 params := xapptweaks.NewParams(nil)
337 params.Mtype = xapp.RIC_SUB_RESP
338 //params.SubId = msg.SubId
340 params.Payload = packedMsg.Buf
341 params.PayloadLen = len(packedMsg.Buf)
342 params.Meid = msg.Meid
343 //params.Xid = msg.Xid
346 tc.Logger.Info("SEND SUB RESP: %s", params.String())
347 snderr := tc.RmrSend(params, 5)
349 tc.TestError(t, "RMR SEND FAILED: %s", snderr.Error())
353 //-----------------------------------------------------------------------------
355 //-----------------------------------------------------------------------------
356 func (tc *E2Stub) RecvSubsResp(t *testing.T, trans *RmrTransactionId) uint32 {
357 tc.Logger.Info("RecvSubsResp")
358 e2SubsResp := e2asnpacker.NewPackerSubscriptionResponse()
361 //---------------------------------
362 // xapp activity: Recv Subs Resp
363 //---------------------------------
364 msg := tc.WaitMsg(15)
366 if msg.Mtype != xapp.RICMessageTypes["RIC_SUB_RESP"] {
367 tc.TestError(t, "Received RIC_SUB_RESP wrong mtype expected %s got %s, error", "RIC_SUB_RESP", xapp.RicMessageTypeToName[msg.Mtype])
369 } else if msg.Xid != trans.xid {
370 tc.TestError(t, "Received RIC_SUB_RESP wrong xid expected %s got %s, error", trans.xid, msg.Xid)
373 packedData := &e2ap.PackedData{}
374 packedData.Buf = msg.Payload
376 e2SubsId = uint32(msg.SubId)
380 unpackerr, resp := e2SubsResp.UnPack(packedData)
381 if unpackerr != nil {
382 tc.TestError(t, "RIC_SUB_RESP unpack failed err: %s", unpackerr.Error())
384 tc.Logger.Info("Recv Subs Resp rmr: xid=%s subid=%d, asn: instanceid=%d", msg.Xid, msg.SubId, resp.RequestId.InstanceId)
388 tc.TestError(t, "Not Received msg within %d secs", 15)
393 //-----------------------------------------------------------------------------
395 //-----------------------------------------------------------------------------
397 func (tc *E2Stub) SendSubsFail(t *testing.T, fparams *E2StubSubsFailParams, msg *xapptweaks.RMRParams) {
398 tc.Logger.Info("SendSubsFail")
399 e2SubsFail := e2asnpacker.NewPackerSubscriptionFailure()
401 //---------------------------------
402 // e2term activity: Send Subs Fail
403 //---------------------------------
404 packerr, packedMsg := e2SubsFail.Pack(fparams.Fail)
406 tc.TestError(t, "pack NOK %s", packerr.Error())
408 tc.Logger.Debug("%s", e2SubsFail.String())
410 params := xapptweaks.NewParams(nil)
411 params.Mtype = xapp.RIC_SUB_FAILURE
412 params.SubId = msg.SubId
413 params.Payload = packedMsg.Buf
414 params.PayloadLen = len(packedMsg.Buf)
415 params.Meid = msg.Meid
419 tc.Logger.Info("SEND SUB FAIL: %s", params.String())
420 snderr := tc.RmrSend(params, 5)
422 tc.TestError(t, "RMR SEND FAILED: %s", snderr.Error())
426 //-----------------------------------------------------------------------------
428 //-----------------------------------------------------------------------------
429 func (tc *E2Stub) RecvSubsFail(t *testing.T, trans *RmrTransactionId) uint32 {
430 tc.Logger.Info("RecvSubsFail")
431 e2SubsFail := e2asnpacker.NewPackerSubscriptionFailure()
434 //-------------------------------
435 // xapp activity: Recv Subs Fail
436 //-------------------------------
437 msg := tc.WaitMsg(15)
439 if msg.Mtype != xapp.RICMessageTypes["RIC_SUB_FAILURE"] {
440 tc.TestError(t, "Received RIC_SUB_FAILURE wrong mtype expected %s got %s, error", "RIC_SUB_FAILURE", xapp.RicMessageTypeToName[msg.Mtype])
442 } else if msg.Xid != trans.xid {
443 tc.TestError(t, "Received RIC_SUB_FAILURE wrong xid expected %s got %s, error", trans.xid, msg.Xid)
446 packedData := &e2ap.PackedData{}
447 packedData.Buf = msg.Payload
449 e2SubsId = uint32(msg.SubId)
453 unpackerr, resp := e2SubsFail.UnPack(packedData)
454 if unpackerr != nil {
455 tc.TestError(t, "RIC_SUB_FAILURE unpack failed err: %s", unpackerr.Error())
457 tc.Logger.Info("Recv Subs Fail rmr: xid=%s subid=%d, asn: instanceid=%d", msg.Xid, msg.SubId, resp.RequestId.InstanceId)
461 tc.TestError(t, "Not Received msg within %d secs", 15)
466 //-----------------------------------------------------------------------------
468 //-----------------------------------------------------------------------------
469 func (tc *E2Stub) SendSubsDelReq(t *testing.T, oldTrans *RmrTransactionId, e2SubsId uint32) *RmrTransactionId {
473 trans = tc.NewRmrTransactionId("", "RAN_NAME_1")
476 tc.Logger.Info("SendSubsDelReq %s", trans.String())
477 e2SubsDelReq := e2asnpacker.NewPackerSubscriptionDeleteRequest()
478 //---------------------------------
479 // xapp activity: Send Subs Del Req
480 //---------------------------------
481 req := &e2ap.E2APSubscriptionDeleteRequest{}
483 req.RequestId.InstanceId = e2SubsId
486 err, packedMsg := e2SubsDelReq.Pack(req)
488 tc.TestError(t, "pack NOK %s %s", trans.String(), err.Error())
491 tc.Logger.Debug("%s %s", trans.String(), e2SubsDelReq.String())
493 params := xapptweaks.NewParams(nil)
494 params.Mtype = xapp.RIC_SUB_DEL_REQ
495 params.SubId = int(e2SubsId)
496 params.Payload = packedMsg.Buf
497 params.PayloadLen = len(packedMsg.Buf)
498 params.Meid = trans.meid
499 params.Xid = trans.xid
502 tc.Logger.Info("SEND SUB DEL REQ: %s", params.String())
503 snderr := tc.RmrSend(params, 5)
505 tc.TestError(t, "RMR SEND FAILED: %s %s", trans.String(), snderr.Error())
511 //-----------------------------------------------------------------------------
513 //-----------------------------------------------------------------------------
514 func (tc *E2Stub) RecvSubsDelReq(t *testing.T) (*e2ap.E2APSubscriptionDeleteRequest, *xapptweaks.RMRParams) {
515 tc.Logger.Info("RecvSubsDelReq")
516 e2SubsDelReq := e2asnpacker.NewPackerSubscriptionDeleteRequest()
518 //---------------------------------
519 // e2term activity: Recv Subs Del Req
520 //---------------------------------
521 msg := tc.WaitMsg(15)
523 if msg.Mtype != xapp.RICMessageTypes["RIC_SUB_DEL_REQ"] {
524 tc.TestError(t, "Received wrong mtype expected %s got %s, error", "RIC_SUB_DEL_REQ", xapp.RicMessageTypeToName[msg.Mtype])
526 tc.Logger.Info("Recv Subs Del Req")
528 packedData := &e2ap.PackedData{}
529 packedData.Buf = msg.Payload
530 unpackerr, req := e2SubsDelReq.UnPack(packedData)
531 if unpackerr != nil {
532 tc.TestError(t, "RIC_SUB_DEL_REQ unpack failed err: %s", unpackerr.Error())
537 tc.TestError(t, "Not Received msg within %d secs", 15)
542 //-----------------------------------------------------------------------------
544 //-----------------------------------------------------------------------------
545 func (tc *E2Stub) SendSubsDelResp(t *testing.T, req *e2ap.E2APSubscriptionDeleteRequest, msg *xapptweaks.RMRParams) {
546 tc.Logger.Info("SendSubsDelResp")
547 e2SubsDelResp := e2asnpacker.NewPackerSubscriptionDeleteResponse()
549 //---------------------------------
550 // e2term activity: Send Subs Del Resp
551 //---------------------------------
552 resp := &e2ap.E2APSubscriptionDeleteResponse{}
553 resp.RequestId.Id = req.RequestId.Id
554 resp.RequestId.InstanceId = req.RequestId.InstanceId
555 resp.FunctionId = req.FunctionId
557 packerr, packedMsg := e2SubsDelResp.Pack(resp)
559 tc.TestError(t, "pack NOK %s", packerr.Error())
561 tc.Logger.Debug("%s", e2SubsDelResp.String())
563 params := xapptweaks.NewParams(nil)
564 params.Mtype = xapp.RIC_SUB_DEL_RESP
565 params.SubId = msg.SubId
566 params.Payload = packedMsg.Buf
567 params.PayloadLen = len(packedMsg.Buf)
568 params.Meid = msg.Meid
572 tc.Logger.Info("SEND SUB DEL RESP: %s", params.String())
573 snderr := tc.RmrSend(params, 5)
575 tc.TestError(t, "RMR SEND FAILED: %s", snderr.Error())
579 //-----------------------------------------------------------------------------
581 //-----------------------------------------------------------------------------
582 func (tc *E2Stub) RecvSubsDelResp(t *testing.T, trans *RmrTransactionId) {
583 tc.Logger.Info("RecvSubsDelResp")
584 e2SubsDelResp := e2asnpacker.NewPackerSubscriptionDeleteResponse()
586 //---------------------------------
587 // xapp activity: Recv Subs Del Resp
588 //---------------------------------
589 msg := tc.WaitMsg(15)
591 if msg.Mtype != xapp.RICMessageTypes["RIC_SUB_DEL_RESP"] {
592 tc.TestError(t, "Received RIC_SUB_DEL_RESP wrong mtype expected %s got %s, error", "RIC_SUB_DEL_RESP", xapp.RicMessageTypeToName[msg.Mtype])
594 } else if trans != nil && msg.Xid != trans.xid {
595 tc.TestError(t, "Received RIC_SUB_DEL_RESP wrong xid expected %s got %s, error", trans.xid, msg.Xid)
598 packedData := &e2ap.PackedData{}
599 packedData.Buf = msg.Payload
600 unpackerr, resp := e2SubsDelResp.UnPack(packedData)
601 if unpackerr != nil {
602 tc.TestError(t, "RIC_SUB_DEL_RESP unpack failed err: %s", unpackerr.Error())
604 tc.Logger.Info("Recv Subs Del Resp rmr: xid=%s subid=%d, asn: instanceid=%d", msg.Xid, msg.SubId, resp.RequestId.InstanceId)
608 tc.TestError(t, "Not Received msg within %d secs", 15)
612 //-----------------------------------------------------------------------------
614 //-----------------------------------------------------------------------------
615 func (tc *E2Stub) SendSubsDelFail(t *testing.T, req *e2ap.E2APSubscriptionDeleteRequest, msg *xapptweaks.RMRParams) {
616 tc.Logger.Info("SendSubsDelFail")
617 e2SubsDelFail := e2asnpacker.NewPackerSubscriptionDeleteFailure()
619 //---------------------------------
620 // e2term activity: Send Subs Del Fail
621 //---------------------------------
622 resp := &e2ap.E2APSubscriptionDeleteFailure{}
623 resp.RequestId.Id = req.RequestId.Id
624 resp.RequestId.InstanceId = req.RequestId.InstanceId
625 resp.FunctionId = req.FunctionId
626 resp.Cause.Content = 4 // CauseMisc
627 resp.Cause.Value = 3 // unspecified
629 packerr, packedMsg := e2SubsDelFail.Pack(resp)
631 tc.TestError(t, "pack NOK %s", packerr.Error())
633 tc.Logger.Debug("%s", e2SubsDelFail.String())
635 params := xapptweaks.NewParams(nil)
636 params.Mtype = xapp.RIC_SUB_DEL_FAILURE
637 params.SubId = msg.SubId
638 params.Payload = packedMsg.Buf
639 params.PayloadLen = len(packedMsg.Buf)
640 params.Meid = msg.Meid
644 tc.Logger.Info("SEND SUB DEL FAIL: %s", params.String())
645 snderr := tc.RmrSend(params, 5)
647 tc.TestError(t, "RMR SEND FAILED: %s", snderr.Error())