X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=pkg%2Fcontrol%2Fsubscription.go;h=9342ccc3d30378271f4e383f95a5bc088a62e85e;hb=refs%2Fchanges%2F99%2F4999%2F2;hp=b2516bd505c662d70529976306bc21b9399ee087;hpb=aada64566a3a77cf9a20a98f9ddd7cd6f37529ae;p=ric-plt%2Fsubmgr.git diff --git a/pkg/control/subscription.go b/pkg/control/subscription.go index b2516bd..9342ccc 100644 --- a/pkg/control/subscription.go +++ b/pkg/control/subscription.go @@ -21,9 +21,8 @@ package control import ( "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap" - "gerrit.o-ran-sc.org/r/ric-plt/submgr/pkg/xapptweaks" "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp" - "reflect" + //"reflect" "sync" ) @@ -36,7 +35,7 @@ type Subscription struct { registry *Registry // Registry ReqId RequestId // ReqId (Requestor Id + Seq Nro a.k.a subsid) Meid *xapp.RMRMeid // Meid/ RanName - EpList xapptweaks.RmrEndpointList // Endpoints + EpList xapp.RmrEndpointList // Endpoints TransLock sync.Mutex // Lock transactions, only one executed per time for subs TheTrans TransactionIf // Ongoing transaction SubReqMsg *e2ap.E2APSubscriptionRequest // Subscription information @@ -44,7 +43,11 @@ type Subscription struct { } func (s *Subscription) String() string { - return "subs(" + s.ReqId.String() + "/" + (&xapptweaks.RMRMeid{s.Meid}).String() + "/" + s.EpList.String() + ")" + meidstr := "N/A" + if s.Meid != nil { + meidstr = s.Meid.String() + } + return "subs(" + s.ReqId.String() + "/" + meidstr + "/" + s.EpList.String() + ")" } func (s *Subscription) GetCachedResponse() (interface{}, bool) { @@ -115,22 +118,13 @@ func (s *Subscription) IsMergeable(trans *TransactionXapp, subReqMsg *e2ap.E2APS } // EventTrigger check - if s.SubReqMsg.EventTriggerDefinition.InterfaceDirection != subReqMsg.EventTriggerDefinition.InterfaceDirection || - s.SubReqMsg.EventTriggerDefinition.ProcedureCode != subReqMsg.EventTriggerDefinition.ProcedureCode || - s.SubReqMsg.EventTriggerDefinition.TypeOfMessage != subReqMsg.EventTriggerDefinition.TypeOfMessage { - return false - } - - if s.SubReqMsg.EventTriggerDefinition.InterfaceId.GlobalEnbId.Present != subReqMsg.EventTriggerDefinition.InterfaceId.GlobalEnbId.Present || - s.SubReqMsg.EventTriggerDefinition.InterfaceId.GlobalEnbId.NodeId != subReqMsg.EventTriggerDefinition.InterfaceId.GlobalEnbId.NodeId || - s.SubReqMsg.EventTriggerDefinition.InterfaceId.GlobalEnbId.PlmnIdentity.String() != subReqMsg.EventTriggerDefinition.InterfaceId.GlobalEnbId.PlmnIdentity.String() { + if s.SubReqMsg.EventTriggerDefinition.Data.Length != subReqMsg.EventTriggerDefinition.Data.Length { return false } - - if s.SubReqMsg.EventTriggerDefinition.InterfaceId.GlobalGnbId.Present != subReqMsg.EventTriggerDefinition.InterfaceId.GlobalGnbId.Present || - s.SubReqMsg.EventTriggerDefinition.InterfaceId.GlobalGnbId.NodeId != subReqMsg.EventTriggerDefinition.InterfaceId.GlobalGnbId.NodeId || - s.SubReqMsg.EventTriggerDefinition.InterfaceId.GlobalGnbId.PlmnIdentity.String() != subReqMsg.EventTriggerDefinition.InterfaceId.GlobalGnbId.PlmnIdentity.String() { - return false + for i := uint64(0); i < s.SubReqMsg.EventTriggerDefinition.Data.Length; i++ { + if s.SubReqMsg.EventTriggerDefinition.Data.Data[i] != subReqMsg.EventTriggerDefinition.Data.Data[i] { + return false + } } // Actions check @@ -151,10 +145,19 @@ func (s *Subscription) IsMergeable(trans *TransactionXapp, subReqMsg *e2ap.E2APS return false } - if acts.RicActionDefinitionPresent != actt.RicActionDefinitionPresent || - reflect.DeepEqual(acts.ActionDefinitionChoice, actt.ActionDefinitionChoice) == false { + if acts.RicActionDefinitionPresent != actt.RicActionDefinitionPresent { + return false + } + + if acts.ActionDefinitionChoice.Data.Length != actt.ActionDefinitionChoice.Data.Length { return false } + for i := uint64(0); i < acts.ActionDefinitionChoice.Data.Length; i++ { + if acts.ActionDefinitionChoice.Data.Data[i] != actt.ActionDefinitionChoice.Data.Data[i] { + return false + } + } + //reflect.DeepEqual(acts.ActionDefinitionChoice, actt.ActionDefinitionChoice) if acts.SubsequentAction.Present != actt.SubsequentAction.Present || acts.SubsequentAction.Type != actt.SubsequentAction.Type ||