Skip to content

Commit

Permalink
fix: fix online charging problem in ULCL
Browse files Browse the repository at this point in the history
  • Loading branch information
lyz508 committed Jan 14, 2025
1 parent 8daa2c2 commit 2d10b21
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions internal/sbi/processor/ulcl_procedure.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package processor

import (
"fmt"
"net"
"reflect"

Expand Down Expand Up @@ -157,6 +158,45 @@ func EstablishULCL(smContext *context.SMContext) {
}
}

// For online charging, create new URR
urrId := pduLevelChargingUrrs[0].URRID
if smContext.ChargingInfo[urrId].ChargingMethod == models.QuotaManagementIndicator_ONLINE_CHARGING {
var urr *context.URR
newChgInfo := &context.ChargingInfo{
RatingGroup: smContext.ChargingInfo[urrId].RatingGroup,
ChargingLevel: smContext.ChargingInfo[urrId].ChargingLevel,
UpfId: curDPNode.UPF.UUID(),
}

newUrrId, err := smContext.UrrIDGenerator.Allocate()
if err != nil {
logger.PduSessLog.Errorln("Generate URR Id failed")
return
}

currentUUID := curDPNode.UPF.UUID()
id := fmt.Sprintf("%s:%d", currentUUID, newUrrId)

if oldURR, ok := smContext.UrrUpfMap[id]; !ok {
if newURR, err2 := curDPNode.UPF.AddURR(uint32(newUrrId),
context.NewMeasureInformation(false, false),
context.SetStartOfSDFTrigger()); err2 != nil {
logger.PduSessLog.Errorln("new URR failed")
urr = pduLevelChargingUrrs[0]
} else {
urr = newURR
newChgInfo.ChargingMethod = models.QuotaManagementIndicator_ONLINE_CHARGING
smContext.UrrUpfMap[id] = urr
}
} else {
urr = oldURR
}
smContext.Log.Tracef("Successfully add URR %d for Rating group %d", urr.URRID, smContext.ChargingInfo[urrId].RatingGroup)

Check failure on line 194 in internal/sbi/processor/ulcl_procedure.go

View workflow job for this annotation

GitHub Actions / lint (1.21)

line is 125 characters (lll)
smContext.ChargingInfo[urr.URRID] = newChgInfo
pduLevelChargingUrrs = pduLevelChargingUrrs[:0]
pduLevelChargingUrrs = append(pduLevelChargingUrrs, urr)
}

// Append URRs to anchor UPF
if curDPNode.UpLinkTunnel != nil && curDPNode.UpLinkTunnel.PDR != nil {
curDPNode.UpLinkTunnel.PDR.AppendURRs(pduLevelChargingUrrs)
Expand Down

0 comments on commit 2d10b21

Please sign in to comment.