Code Review
/
ric-plt
/
submgr.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Merge newe2 into master
[ric-plt/submgr.git]
/
pkg
/
control
/
registry.go
diff --git
a/pkg/control/registry.go
b/pkg/control/registry.go
index
2570960
..
5e16c0a
100644
(file)
--- a/
pkg/control/registry.go
+++ b/
pkg/control/registry.go
@@
-55,7
+55,7
@@
func (r *Registry) QueryHandler() (models.SubscriptionList, error) {
resp := models.SubscriptionList{}
for _, subs := range r.register {
subs.mutex.Lock()
resp := models.SubscriptionList{}
for _, subs := range r.register {
subs.mutex.Lock()
- resp = append(resp, &models.SubscriptionData{SubscriptionID: int64(subs.ReqId.
Seq
), Meid: subs.Meid.RanName, Endpoint: subs.EpList.StringList()})
+ resp = append(resp, &models.SubscriptionData{SubscriptionID: int64(subs.ReqId.
InstanceId
), Meid: subs.Meid.RanName, Endpoint: subs.EpList.StringList()})
subs.mutex.Unlock()
}
return resp, nil
subs.mutex.Unlock()
}
return resp, nil
@@
-63,10
+63,10
@@
func (r *Registry) QueryHandler() (models.SubscriptionList, error) {
func (r *Registry) allocateSubs(trans *TransactionXapp, subReqMsg *e2ap.E2APSubscriptionRequest) (*Subscription, error) {
if len(r.subIds) > 0 {
func (r *Registry) allocateSubs(trans *TransactionXapp, subReqMsg *e2ap.E2APSubscriptionRequest) (*Subscription, error) {
if len(r.subIds) > 0 {
- s
equenceNumber
:= r.subIds[0]
+ s
ubId
:= r.subIds[0]
r.subIds = r.subIds[1:]
r.subIds = r.subIds[1:]
- if _, ok := r.register[s
equenceNumber
]; ok == true {
- r.subIds = append(r.subIds, s
equenceNumber
)
+ if _, ok := r.register[s
ubId
]; ok == true {
+ r.subIds = append(r.subIds, s
ubId
)
return nil, fmt.Errorf("Registry: Failed to reserve subscription exists")
}
subs := &Subscription{
return nil, fmt.Errorf("Registry: Failed to reserve subscription exists")
}
subs := &Subscription{
@@
-76,10
+76,10
@@
func (r *Registry) allocateSubs(trans *TransactionXapp, subReqMsg *e2ap.E2APSubs
valid: true,
}
subs.ReqId.Id = 123
valid: true,
}
subs.ReqId.Id = 123
- subs.ReqId.
Seq = sequenceNumber
+ subs.ReqId.
InstanceId = subId
if subs.EpList.AddEndpoint(trans.GetEndpoint()) == false {
if subs.EpList.AddEndpoint(trans.GetEndpoint()) == false {
- r.subIds = append(r.subIds, subs.ReqId.
Seq
)
+ r.subIds = append(r.subIds, subs.ReqId.
InstanceId
)
return nil, fmt.Errorf("Registry: Endpoint existing already in subscription")
}
return nil, fmt.Errorf("Registry: Endpoint existing already in subscription")
}
@@
-169,23
+169,23
@@
func (r *Registry) AssignToSubscription(trans *TransactionXapp, subReqMsg *e2ap.
// Subscription route updates
//
if epamount == 1 {
// Subscription route updates
//
if epamount == 1 {
- subRouteAction := SubRouteInfo{subs.EpList, uint16(subs.ReqId.
Seq
)}
+ subRouteAction := SubRouteInfo{subs.EpList, uint16(subs.ReqId.
InstanceId
)}
err = r.rtmgrClient.SubscriptionRequestCreate(subRouteAction)
} else {
err = r.rtmgrClient.SubscriptionRequestCreate(subRouteAction)
} else {
- subRouteAction := SubRouteInfo{subs.EpList, uint16(subs.ReqId.
Seq
)}
+ subRouteAction := SubRouteInfo{subs.EpList, uint16(subs.ReqId.
InstanceId
)}
err = r.rtmgrClient.SubscriptionRequestUpdate(subRouteAction)
}
r.mutex.Lock()
if err != nil {
if newAlloc {
err = r.rtmgrClient.SubscriptionRequestUpdate(subRouteAction)
}
r.mutex.Lock()
if err != nil {
if newAlloc {
- r.subIds = append(r.subIds, subs.ReqId.
Seq
)
+ r.subIds = append(r.subIds, subs.ReqId.
InstanceId
)
}
return nil, err
}
if newAlloc {
}
return nil, err
}
if newAlloc {
- r.register[subs.ReqId.
Seq
] = subs
+ r.register[subs.ReqId.
InstanceId
] = subs
}
xapp.Logger.Debug("CREATE %s", subs.String())
xapp.Logger.Debug("Registry: substable=%v", r.register)
}
xapp.Logger.Debug("CREATE %s", subs.String())
xapp.Logger.Debug("Registry: substable=%v", r.register)
@@
-226,7
+226,7
@@
func (r *Registry) RemoveFromSubscription(subs *Subscription, trans *Transaction
delStatus := subs.EpList.DelEndpoint(trans.GetEndpoint())
epamount := subs.EpList.Size()
delStatus := subs.EpList.DelEndpoint(trans.GetEndpoint())
epamount := subs.EpList.Size()
- s
eqId := subs.ReqId.Seq
+ s
ubId := subs.ReqId.InstanceId
if delStatus == false {
return nil
if delStatus == false {
return nil
@@
-247,7
+247,7
@@
func (r *Registry) RemoveFromSubscription(subs *Subscription, trans *Transaction
//
tmpList := xapptweaks.RmrEndpointList{}
tmpList.AddEndpoint(trans.GetEndpoint())
//
tmpList := xapptweaks.RmrEndpointList{}
tmpList.AddEndpoint(trans.GetEndpoint())
- subRouteAction := SubRouteInfo{tmpList, uint16(s
eq
Id)}
+ subRouteAction := SubRouteInfo{tmpList, uint16(s
ub
Id)}
r.rtmgrClient.SubscriptionRequestDelete(subRouteAction)
//
r.rtmgrClient.SubscriptionRequestDelete(subRouteAction)
//
@@
-256,18
+256,18
@@
func (r *Registry) RemoveFromSubscription(subs *Subscription, trans *Transaction
r.mutex.Lock()
defer r.mutex.Unlock()
r.mutex.Lock()
defer r.mutex.Unlock()
- if _, ok := r.register[s
eq
Id]; ok {
+ if _, ok := r.register[s
ub
Id]; ok {
xapp.Logger.Debug("RELEASE %s", subs.String())
xapp.Logger.Debug("RELEASE %s", subs.String())
- delete(r.register, s
eq
Id)
+ delete(r.register, s
ub
Id)
xapp.Logger.Debug("Registry: substable=%v", r.register)
}
xapp.Logger.Debug("Registry: substable=%v", r.register)
}
- r.subIds = append(r.subIds, s
eq
Id)
+ r.subIds = append(r.subIds, s
ub
Id)
} else if subs.EpList.Size() > 0 {
//
// Subscription route updates
//
} else if subs.EpList.Size() > 0 {
//
// Subscription route updates
//
- subRouteAction := SubRouteInfo{subs.EpList, uint16(s
eq
Id)}
+ subRouteAction := SubRouteInfo{subs.EpList, uint16(s
ub
Id)}
r.rtmgrClient.SubscriptionRequestUpdate(subRouteAction)
}
r.rtmgrClient.SubscriptionRequestUpdate(subRouteAction)
}
@@
-276,22
+276,22
@@
func (r *Registry) RemoveFromSubscription(subs *Subscription, trans *Transaction
return nil
}
return nil
}
-func (r *Registry) GetSubscription(s
n
uint32) *Subscription {
+func (r *Registry) GetSubscription(s
ubId
uint32) *Subscription {
r.mutex.Lock()
defer r.mutex.Unlock()
r.mutex.Lock()
defer r.mutex.Unlock()
- if _, ok := r.register[s
n
]; ok {
- return r.register[s
n
]
+ if _, ok := r.register[s
ubId
]; ok {
+ return r.register[s
ubId
]
}
return nil
}
}
return nil
}
-func (r *Registry) GetSubscriptionFirstMatch(
i
ds []uint32) (*Subscription, error) {
+func (r *Registry) GetSubscriptionFirstMatch(
subI
ds []uint32) (*Subscription, error) {
r.mutex.Lock()
defer r.mutex.Unlock()
r.mutex.Lock()
defer r.mutex.Unlock()
- for _,
id := range i
ds {
- if _, ok := r.register[
i
d]; ok {
- return r.register[
i
d], nil
+ for _,
subId := range subI
ds {
+ if _, ok := r.register[
subI
d]; ok {
+ return r.register[
subI
d], nil
}
}
}
}
- return nil, fmt.Errorf("No valid subscription found with
ids %v", i
ds)
+ return nil, fmt.Errorf("No valid subscription found with
subIds %v", subI
ds)
}
}