Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Support Converged Charging #94

Merged
merged 37 commits into from
Mar 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
12ef5ab
support converged charging
May 15, 2023
481e5e5
flow status
May 19, 2023
ec5aa75
add pdu level charging urr to default data path
May 23, 2023
9a3e372
fix: only onlince charging need to request unit
May 23, 2023
699ff1f
fix: release charging session in all pdu session release case
May 23, 2023
0ac191e
fix: don't send charging request for non-charging urr
May 24, 2023
e3d950d
rm untested code
May 25, 2023
3f4e722
update openapi/pfcp hash
tim-ywliu Aug 11, 2023
070ea03
add nil & error checking
ianchen0119 Sep 6, 2023
0015421
update go.sum
free5gc-org Sep 6, 2023
61d864a
add more error checking
free5gc-org Sep 6, 2023
25dc327
fix test fail
free5gc-org Sep 6, 2023
835d69a
fix ci error
free5gc-org Sep 6, 2023
2144023
add comment for addPduLevelChargingRuleToFlow()
ianchen0119 Sep 19, 2023
3c386ca
add comment & fix potential synchronization issues
ianchen0119 Sep 20, 2023
ce5be8f
fix typo & linter error
ianchen0119 Sep 20, 2023
bf5eebb
handle assigned when IP in ipFilterRule is assigned
brianchennn Oct 10, 2023
b5900c3
fix typo
brianchennn Oct 13, 2023
c8e3dfc
fix typo & set default value of RequestedUnit
ianchen0119 Oct 25, 2023
19f46fc
fix NewSMContext
ianchen0119 Oct 25, 2023
cd9185f
fix: remove SwapSrcAndDst()
brianchennn Nov 23, 2023
b629113
fix: UL, DL flow description should be same
brianchennn Nov 23, 2023
0e4550b
remove SMF's default data path to reduce redundant PDRs
brianchennn Nov 24, 2023
6f38f8b
fix: testcase's ip.dst should not be any
brianchennn Nov 24, 2023
e5b8f9a
style: fix naked return
brianchennn Nov 24, 2023
d16c9c4
update util's hash
brianchennn Nov 27, 2023
281005e
fix: duplicated URRs in PDR
brianchennn Nov 28, 2023
af08b38
fix: Volume Threshold IE should be added to PFCP Session Modification…
brianchennn Dec 1, 2023
c044918
remove SMContext.UrrIDGenerator
brianchennn Dec 7, 2023
c1976a4
fix: MBQE, MAQE's URR
brianchennn Dec 7, 2023
ba2794a
comment out these variable: N3N6, N3N9, N9N6
brianchennn Dec 7, 2023
660afcf
remove FlowDescription judgement
brianchennn Dec 12, 2023
eb3caea
remove unused code and add comments
andy89923 Jan 31, 2024
847082d
Fix: resolve conflicts
andy89923 Feb 21, 2024
2b5e305
Add back defalt urr rule
andy89923 Feb 23, 2024
27db307
Fix: Add GetTokenCtx() in CHF Selection
andy89923 Feb 26, 2024
c38f762
Remove unused comments
andy89923 Feb 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 28 additions & 16 deletions internal/context/datapath.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,32 +385,43 @@ func (node DataPathNode) addUrrToNode(smContext *SMContext, urrId uint32, isMeas
}
}

// Add reserve urr to datapath UPF
func (datapath *DataPath) addUrrToPath(smContext *SMContext) {
if smContext.UrrReportTime == 0 && smContext.UrrReportThreshold == 0 {
logger.PduSessLog.Errorln("URR Report time and threshold is 0")
return
}

for curDataPathNode := datapath.FirstDPNode; curDataPathNode != nil; curDataPathNode = curDataPathNode.Next() {
var MBQEUrrId int64
var MAQEUrrId int64
var err error
// If more than two data path will use the same UPF
// It may cause urr be created multiple times
// There may be some mechanism to make sure that existed URR should not be create again
var MBQEUrrId uint32
var MAQEUrrId uint32

if curDataPathNode.IsANUPF() {
MBQEUrrId, err = curDataPathNode.UPF.urrIDGenerator.Allocate()
if err != nil {
logger.CtxLog.Warnf("MBQE URR ID allocate error: %v\n", err)
}
MAQEUrrId, err = curDataPathNode.UPF.urrIDGenerator.Allocate()
if err != nil {
logger.CtxLog.Warnf("MAQE URR ID allocate error: %v\n", err)
if curDataPathNode.Next() == nil {
MBQEUrrId = smContext.UrrIdMap[N3N6_MBQE_URR]
MAQEUrrId = smContext.UrrIdMap[N3N6_MAQE_URR]
} else {
MBQEUrrId = smContext.UrrIdMap[N3N9_MBQE_URR]
MAQEUrrId = smContext.UrrIdMap[N3N9_MAQE_URR]
}
} else {
MBQEUrrId = smContext.UrrIdMap[N9N6_MBQE_URR]
MAQEUrrId = smContext.UrrIdMap[N9N6_MAQE_URR]
}

curDataPathNode.addUrrToNode(smContext, uint32(MBQEUrrId), true, true)
curDataPathNode.addUrrToNode(smContext, uint32(MAQEUrrId), true, false)
// if curDataPathNode.IsANUPF() {
// MBQEUrrId, err = curDataPathNode.UPF.urrIDGenerator.Allocate()
// if err != nil {
// logger.CtxLog.Warnf("MBQE URR ID allocate error: %v\n", err)
// }
// MAQEUrrId, err = curDataPathNode.UPF.urrIDGenerator.Allocate()
// if err != nil {
// logger.CtxLog.Warnf("MAQE URR ID allocate error: %v\n", err)
// }
// }

curDataPathNode.addUrrToNode(smContext, MBQEUrrId, true, true)
curDataPathNode.addUrrToNode(smContext, MAQEUrrId, true, false)
}
}

Expand Down Expand Up @@ -771,7 +782,8 @@ func (p *DataPath) AddChargingRules(smContext *SMContext, chgLevel ChargingLevel
UpfId: node.UPF.UUID(),
}

urrId, err := node.UPF.urrIDGenerator.Allocate()
// urrId, err := node.UPF.urrIDGenerator.Allocate()
urrId, err := smContext.UrrIDGenerator.Allocate()
if err != nil {
logger.PduSessLog.Errorln("Generate URR Id failed")
return
Expand Down
44 changes: 41 additions & 3 deletions internal/context/sm_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package context
import (
"context"
"fmt"
"math"
"net"
"net/http"
"strings"
Expand Down Expand Up @@ -45,6 +46,22 @@ const (

type UrrType int

// Reserved URR report for ID = 0 ~ 6
const (
N3N6_MBQE_URR UrrType = iota
N3N6_MAQE_URR
N3N9_MBQE_URR
N3N9_MAQE_URR
N9N6_MBQE_URR
N9N6_MAQE_URR
NOT_FOUND_URR
)

func (t UrrType) String() string {
urrTypeList := []string{"N3N6_MBQE", "N3N6_MAQE", "N3N9_MBQE", "N3N9_MAQE", "N9N6_MBQE", "N9N6_MAQE"}
return urrTypeList[t]
}

func (t UrrType) IsBeforeQos() bool {
urrTypeList := []bool{true, false, true, false, true, false}
return urrTypeList[t]
Expand Down Expand Up @@ -181,7 +198,7 @@ type SMContext struct {
AdditonalQosFlows map[uint8]*QoSFlow // Key: qfi

// URR
// UrrIDGenerator *idgenerator.IDGenerator // should be deprecated
UrrIDGenerator *idgenerator.IDGenerator
UrrIdMap map[UrrType]uint32
UrrUpfMap map[string]*URR
UrrReportTime time.Duration
Expand Down Expand Up @@ -282,9 +299,9 @@ func NewSMContext(id string, pduSessID int32) *SMContext {
smContext.AMBRQerMap = make(map[uuid.UUID]uint32)
smContext.QerUpfMap = make(map[string]uint32)
smContext.AdditonalQosFlows = make(map[uint8]*QoSFlow)
// smContext.UrrIDGenerator = idgenerator.NewGenerator(1, math.MaxUint32)
smContext.UrrIDGenerator = idgenerator.NewGenerator(1, math.MaxUint32)
smContext.UrrIdMap = make(map[UrrType]uint32)
// smContext.GenerateUrrId()
smContext.GenerateUrrId()
smContext.UrrUpfMap = make(map[string]*URR)

smContext.ChargingInfo = make(map[uint32]*ChargingInfo)
Expand Down Expand Up @@ -361,6 +378,27 @@ func GetSMContextBySEID(SEID uint64) *SMContext {
return nil
}

func (smContext *SMContext) GenerateUrrId() {
if id, err := smContext.UrrIDGenerator.Allocate(); err == nil {
smContext.UrrIdMap[N3N6_MBQE_URR] = uint32(id)
}
if id, err := smContext.UrrIDGenerator.Allocate(); err == nil {
smContext.UrrIdMap[N3N6_MAQE_URR] = uint32(id)
}
if id, err := smContext.UrrIDGenerator.Allocate(); err == nil {
smContext.UrrIdMap[N9N6_MBQE_URR] = uint32(id)
}
if id, err := smContext.UrrIDGenerator.Allocate(); err == nil {
smContext.UrrIdMap[N9N6_MAQE_URR] = uint32(id)
}
if id, err := smContext.UrrIDGenerator.Allocate(); err == nil {
smContext.UrrIdMap[N3N9_MBQE_URR] = uint32(id)
}
if id, err := smContext.UrrIDGenerator.Allocate(); err == nil {
smContext.UrrIdMap[N3N9_MAQE_URR] = uint32(id)
}
}

func (smContext *SMContext) BuildCreatedData() *models.SmContextCreatedData {
return &models.SmContextCreatedData{
SNssai: smContext.SNssai,
Expand Down
Loading