X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Fcontrol%2Fcontrol.go;h=6fc7d33382a7d96b21a9dc6c9f1d834a69cd3c32;hb=b3dc15673967c1c94a52d82ea8b169fefd6f9154;hp=cfe3dfbdaa21cae8884d48ec92608808eb2b0075;hpb=86a462083a043a01f499610209ba7a1b6ee8d652;p=ric-plt%2Fsubmgr.git diff --git a/pkg/control/control.go b/pkg/control/control.go index cfe3dfb..6fc7d33 100755 --- a/pkg/control/control.go +++ b/pkg/control/control.go @@ -447,23 +447,27 @@ func (c *Control) handleSubscriptionDeleteRequest(params *RMRParams) { return } - payloadSeqNum, err := c.e2ap.GetSubscriptionDeleteRequestSequenceNumber(params.Payload) - if err == nil { - subs = c.registry.GetSubscription(payloadSeqNum) + // + // + // + trans.SubDelReqMsg, err = c.e2ap.UnpackSubscriptionDeleteRequest(params.Payload) + if err != nil { + xapp.Logger.Error("SubDelReq: %s Dropping this msg. %s", err.Error(), trans) + trans.Release() + return } + + subs = c.registry.GetSubscription(uint16(trans.SubDelReqMsg.RequestId.Seq)) if subs == nil && params.SubId > 0 { subs = c.registry.GetSubscription(uint16(params.SubId)) } if subs == nil { - xapp.Logger.Error("SubDelReq: Not valid subscription found payloadSeqNum: %d. Dropping this msg. %s", payloadSeqNum, trans) + xapp.Logger.Error("SubDelReq: Not valid subscription found payloadSeqNum: %d, SubId: %d. Dropping this msg. %s", trans.SubDelReqMsg.RequestId.Seq, params.SubId, trans) trans.Release() return } - xapp.Logger.Info("SubDelReq: subscription found payloadSeqNum: %d. %s", payloadSeqNum, trans) - - trans.PayloadLen = params.PayloadLen - trans.Payload = params.Payload + xapp.Logger.Info("SubDelReq: subscription found payloadSeqNum: %d, SubId: %d. %s", trans.SubDelReqMsg.RequestId.Seq, params.SubId, trans) err = subs.SetTransaction(trans) if err != nil { @@ -472,6 +476,25 @@ func (c *Control) handleSubscriptionDeleteRequest(params *RMRParams) { return } + // + // TODO: subscription delete is in fact owned by subscription and not transaction. + // Transaction is toward xapp while Subscription is toward ran. + // In merge several xapps may wake transactions, while only one subscription + // toward ran occurs -> subscription owns subscription creation toward ran + // + // This is intermediate solution while improving message handling + // + packedData, err := c.e2ap.PackSubscriptionDeleteRequest(trans.SubDelReqMsg) + if err != nil { + xapp.Logger.Error("SubDelReq: %s for trans %s", err.Error(), trans) + trans.Release() + return + } + + //Optimize and store packed message to be sent (for retransmission). Again owned by subscription? + trans.Payload = packedData.Buf + trans.PayloadLen = len(packedData.Buf) + subs.UnConfirmed() c.rmrSend("SubDelReq to E2T", subs, trans, trans.Payload, trans.PayloadLen)