packedData, err := c.e2ap.PackSubscriptionFailure(trans.SubFailMsg)
if err != nil {
//TODO error handling improvement
- xapp.Logger.Error("SubFail: %s for trans %s (continue still)", err.Error(), trans)
+ xapp.Logger.Error("SubFail: %s for trans %s (continuing cleaning)", err.Error(), trans)
} else {
//Optimize and store packed message to be sent.
trans.Payload = packedData.Buf
func (c *Control) handleSubscriptionDeleteResponse(params *RMRParams) (err error) {
xapp.Logger.Info("SubDelResp from E2T:%s", params.String())
- payloadSeqNum, err := c.e2ap.GetSubscriptionDeleteResponseSequenceNumber(params.Payload)
+ //
+ //
+ //
+ SubDelRespMsg, err := c.e2ap.UnpackSubscriptionDeleteResponse(params.Payload)
if err != nil {
- xapp.Logger.Error("SubDelResp: Unable to get Sequence Number from Payload. Dropping this msg. Err: %v, SubId: %v, Xid: %s, Payload %X", err, params.SubId, params.Xid, params.Payload)
+ xapp.Logger.Error("SubDelResp: %s Dropping this msg. %s", err.Error(), params.String())
return
}
- xapp.Logger.Info("SubDelResp: Received payloadSeqNum: %v", payloadSeqNum)
- subs := c.registry.GetSubscription(payloadSeqNum)
+ //
+ //
+ //
+ subs := c.registry.GetSubscription(uint16(SubDelRespMsg.RequestId.Seq))
+ if subs == nil && params.SubId > 0 {
+ subs = c.registry.GetSubscription(uint16(params.SubId))
+ }
+
if subs == nil {
- xapp.Logger.Error("SubDelResp: Unknown payloadSeqNum. Dropping this msg. PayloadSeqNum: %v, SubId: %v", payloadSeqNum, params.SubId)
+ xapp.Logger.Error("SubDelResp: Not valid subscription found payloadSeqNum: %d, SubId: %d. Dropping this msg. %s", SubDelRespMsg.RequestId.Seq, params.SubId, params.String())
return
}
+ xapp.Logger.Info("SubDelResp: subscription found payloadSeqNum: %d, SubId: %d", SubDelRespMsg.RequestId.Seq, subs.GetSubId())
+ //
+ //
+ //
trans := subs.GetTransaction()
if trans == nil {
- xapp.Logger.Error("SubDelResp: Unknown trans. Dropping this msg. PayloadSeqNum: %v, SubId: %v", subs.GetSubId(), params.SubId)
+ xapp.Logger.Error("SubDelResp: Unknown trans. Dropping this msg. SubId: %d", subs.GetSubId())
return
}
+ trans.SubDelRespMsg = SubDelRespMsg
+
+ //
+ //
+ //
c.timerMap.StopTimer("RIC_SUB_DEL_REQ", int(subs.GetSubId()))
responseReceived := trans.CheckResponseReceived()
return
}
- if trans.ForwardRespToXapp == true {
- c.rmrReplyToSender("SubDelResp to xapp", subs, trans, params.Mtype, params.Payload, params.PayloadLen)
- time.Sleep(3 * time.Second)
+ packedData, err := c.e2ap.PackSubscriptionDeleteResponse(trans.SubDelRespMsg)
+ if err != nil {
+ xapp.Logger.Error("SubDelResp: %s for trans %s (continuing cleaning)", err.Error(), trans)
+ } else {
+ //Optimize and store packed message to be sent.
+ trans.Payload = packedData.Buf
+ trans.PayloadLen = len(packedData.Buf)
+
+ if trans.ForwardRespToXapp == true {
+ c.rmrReplyToSender("SubDelResp to xapp", subs, trans, 12021, trans.Payload, trans.PayloadLen)
+ time.Sleep(3 * time.Second)
+ }
+
}
trans.Release()
type E2ap struct {
}
-/* RICsubscriptionDeleteResponse */
-
-// Used by submgr, e2t test stub
-func (c *E2ap) GetSubscriptionDeleteResponseSequenceNumber(payload []byte) (subId uint16, err error) {
- cptr := unsafe.Pointer(&payload[0])
- cret := C.e2ap_get_ric_subscription_delete_response_sequence_number(cptr, C.size_t(len(payload)))
- if cret < 0 {
- return 0, fmt.Errorf("e2ap wrapper is unable to get Subscirption Delete Response Sequence Number due to wrong or invalid payload. Erroxappde: %v", cret)
- }
- subId = uint16(cret)
- return
-}
-
-// Used by e2t test stub
-func (c *E2ap) SetSubscriptionDeleteResponseSequenceNumber(payload []byte, newSubscriptionid uint16) (err error) {
- cptr := unsafe.Pointer(&payload[0])
- size := C.e2ap_set_ric_subscription_delete_response_sequence_number(cptr, C.size_t(len(payload)), C.long(newSubscriptionid))
- if size < 0 {
- return fmt.Errorf("e2ap wrapper is unable to set Subscription Delete Response Sequence Number due to wrong or invalid payload. Erroxappde: %v", size)
- }
- return
-}
-
/* RICsubscriptionDeleteFailure */
// Used by submgr
//-----------------------------------------------------------------------------
type Transaction struct {
mutex sync.Mutex
- tracker *Tracker //tracker instance
- Subs *Subscription //related subscription
- RmrEndpoint RmrEndpoint //xapp endpoint
- Mtype int //type of initiating message
- Xid string //xapp xid in req
- Meid *xapp.RMRMeid //meid transaction related
- SubReqMsg *e2ap.E2APSubscriptionRequest //SubReq TODO: maybe own transactions per type
- SubRespMsg *e2ap.E2APSubscriptionResponse //SubResp TODO: maybe own transactions per type
- SubFailMsg *e2ap.E2APSubscriptionFailure //SubFail TODO: maybe own transactions per type
- SubDelReqMsg *e2ap.E2APSubscriptionDeleteRequest //SubDelReq TODO: maybe own transactions per type
- Payload []byte //packed message to optimize retransmissions
- PayloadLen int //packed message len to optimize retransmissions
+ tracker *Tracker //tracker instance
+ Subs *Subscription //related subscription
+ RmrEndpoint RmrEndpoint //xapp endpoint
+ Mtype int //type of initiating message
+ Xid string //xapp xid in req
+ Meid *xapp.RMRMeid //meid transaction related
+ SubReqMsg *e2ap.E2APSubscriptionRequest //SubReq TODO: maybe own transactions per type
+ SubRespMsg *e2ap.E2APSubscriptionResponse //SubResp TODO: maybe own transactions per type
+ SubFailMsg *e2ap.E2APSubscriptionFailure //SubFail TODO: maybe own transactions per type
+ SubDelReqMsg *e2ap.E2APSubscriptionDeleteRequest //SubDelReq TODO: maybe own transactions per type
+ SubDelRespMsg *e2ap.E2APSubscriptionDeleteResponse //SubDelResp TODO: maybe own transactions per type
+ Payload []byte //packed message to optimize retransmissions
+ PayloadLen int //packed message len to optimize retransmissions
RespReceived bool
ForwardRespToXapp bool
}