From 00e4b4e06bf44688f64f6a6f456c675b32643b9b Mon Sep 17 00:00:00 2001 From: yzlin Date: Mon, 23 Dec 2024 15:07:12 +0000 Subject: [PATCH] feat: Add session level charging URRs to ULCL created path --- internal/context/sm_context.go | 7 +++++-- internal/sbi/processor/ulcl_procedure.go | 24 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/internal/context/sm_context.go b/internal/context/sm_context.go index 9a115d79..af9b7df1 100644 --- a/internal/context/sm_context.go +++ b/internal/context/sm_context.go @@ -586,8 +586,11 @@ func (c *SMContext) SelectDefaultDataPath() error { if GetSelf().ULCLSupport && CheckUEHasPreConfig(c.Supi) { c.Log.Infof("Has pre-config default path") uePreConfigPaths := GetUEPreConfigPaths(c.Supi, c.SelectedUPF.Name) - c.Tunnel.DataPathPool = uePreConfigPaths.DataPathPool - c.Tunnel.PathIDGenerator = uePreConfigPaths.PathIDGenerator + for _, dp := range uePreConfigPaths.DataPathPool { + if !dp.IsDefaultPath { + c.Tunnel.AddDataPath(dp) + } + } defaultPath = uePreConfigPaths.DataPathPool.GetDefaultPath() } else if c.Tunnel.DataPathPool.GetDefaultPath() == nil { // UE has no pre-config path and default path diff --git a/internal/sbi/processor/ulcl_procedure.go b/internal/sbi/processor/ulcl_procedure.go index f19d9455..4aaef7a7 100644 --- a/internal/sbi/processor/ulcl_procedure.go +++ b/internal/sbi/processor/ulcl_procedure.go @@ -142,6 +142,30 @@ func EstablishULCL(smContext *context.SMContext) { // find updatedUPF in activatingPath for curDPNode := activatingPath.FirstDPNode; curDPNode != nil; curDPNode = curDPNode.Next() { + smContext.Log.Traceln("Current DP Node IP: ", curDPNode.UPF.NodeID.ResolveNodeIdToIp().String()) + + if curDPNode.IsAnchorUPF() { + var pduLevelChargingUrrs []*context.URR + + // Select PDU session level charging URRs from pcc rule + for _, pccRule := range smContext.PCCRules { + if chargingLevel, err := pccRule.IdentifyChargingLevel(); err != nil { + continue + } else if chargingLevel == context.PduSessionCharging { + pduLevelChargingUrrs = pccRule.Datapath.GetChargingUrr(smContext) + break + } + } + + // Append URRs to anchor UPF + if curDPNode.UpLinkTunnel != nil && curDPNode.UpLinkTunnel.PDR != nil { + curDPNode.UpLinkTunnel.PDR.AppendURRs(pduLevelChargingUrrs) + } + if curDPNode.DownLinkTunnel != nil && curDPNode.DownLinkTunnel.PDR != nil { + curDPNode.DownLinkTunnel.PDR.AppendURRs(pduLevelChargingUrrs) + } + } + if reflect.DeepEqual(ulcl.NodeID, curDPNode.UPF.NodeID) { UPLinkPDR := curDPNode.UpLinkTunnel.PDR DownLinkPDR := curDPNode.DownLinkTunnel.PDR