Merge newe2 into master
[ric-plt/submgr.git] / pkg / control / subscription.go
index c2b5283..b2516bd 100644 (file)
@@ -21,7 +21,9 @@ 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"
        "sync"
 )
 
@@ -34,7 +36,7 @@ type Subscription struct {
        registry  *Registry                     // Registry
        ReqId     RequestId                     // ReqId (Requestor Id + Seq Nro a.k.a subsid)
        Meid      *xapp.RMRMeid                 // Meid/ RanName
-       EpList    RmrEndpointList               // Endpoints
+       EpList    xapptweaks.RmrEndpointList    // Endpoints
        TransLock sync.Mutex                    // Lock transactions, only one executed per time for subs
        TheTrans  TransactionIf                 // Ongoing transaction
        SubReqMsg *e2ap.E2APSubscriptionRequest // Subscription information
@@ -42,7 +44,7 @@ type Subscription struct {
 }
 
 func (s *Subscription) String() string {
-       return "subs(" + s.ReqId.String() + "/" + s.Meid.RanName + "/" + s.EpList.String() + ")"
+       return "subs(" + s.ReqId.String() + "/" + (&xapptweaks.RMRMeid{s.Meid}).String() + "/" + s.EpList.String() + ")"
 }
 
 func (s *Subscription) GetCachedResponse() (interface{}, bool) {
@@ -121,17 +123,13 @@ func (s *Subscription) IsMergeable(trans *TransactionXapp, subReqMsg *e2ap.E2APS
 
        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.Val[0] != subReqMsg.EventTriggerDefinition.InterfaceId.GlobalEnbId.PlmnIdentity.Val[0] ||
-               s.SubReqMsg.EventTriggerDefinition.InterfaceId.GlobalEnbId.PlmnIdentity.Val[1] != subReqMsg.EventTriggerDefinition.InterfaceId.GlobalEnbId.PlmnIdentity.Val[1] ||
-               s.SubReqMsg.EventTriggerDefinition.InterfaceId.GlobalEnbId.PlmnIdentity.Val[2] != subReqMsg.EventTriggerDefinition.InterfaceId.GlobalEnbId.PlmnIdentity.Val[2] {
+               s.SubReqMsg.EventTriggerDefinition.InterfaceId.GlobalEnbId.PlmnIdentity.String() != subReqMsg.EventTriggerDefinition.InterfaceId.GlobalEnbId.PlmnIdentity.String() {
                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.Val[0] != subReqMsg.EventTriggerDefinition.InterfaceId.GlobalGnbId.PlmnIdentity.Val[0] ||
-               s.SubReqMsg.EventTriggerDefinition.InterfaceId.GlobalGnbId.PlmnIdentity.Val[1] != subReqMsg.EventTriggerDefinition.InterfaceId.GlobalGnbId.PlmnIdentity.Val[1] ||
-               s.SubReqMsg.EventTriggerDefinition.InterfaceId.GlobalGnbId.PlmnIdentity.Val[2] != subReqMsg.EventTriggerDefinition.InterfaceId.GlobalGnbId.PlmnIdentity.Val[2] {
+               s.SubReqMsg.EventTriggerDefinition.InterfaceId.GlobalGnbId.PlmnIdentity.String() != subReqMsg.EventTriggerDefinition.InterfaceId.GlobalGnbId.PlmnIdentity.String() {
                return false
        }
 
@@ -153,11 +151,11 @@ func (s *Subscription) IsMergeable(trans *TransactionXapp, subReqMsg *e2ap.E2APS
                                return false
                        }
 
-                       if acts.ActionDefinition.Present != actt.ActionDefinition.Present ||
-                               acts.ActionDefinition.StyleId != actt.ActionDefinition.StyleId ||
-                               acts.ActionDefinition.ParamId != actt.ActionDefinition.ParamId {
+                       if acts.RicActionDefinitionPresent != actt.RicActionDefinitionPresent ||
+                               reflect.DeepEqual(acts.ActionDefinitionChoice, actt.ActionDefinitionChoice) == false {
                                return false
                        }
+
                        if acts.SubsequentAction.Present != actt.SubsequentAction.Present ||
                                acts.SubsequentAction.Type != actt.SubsequentAction.Type ||
                                acts.SubsequentAction.TimetoWait != actt.SubsequentAction.TimetoWait {