Skip to content

Commit

Permalink
fix: MBQE, MAQE's URR
Browse files Browse the repository at this point in the history
  • Loading branch information
brianchennn committed Dec 7, 2023
1 parent a9f0c3a commit 691d252
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 55 deletions.
58 changes: 30 additions & 28 deletions internal/context/datapath.go
Original file line number Diff line number Diff line change
Expand Up @@ -772,39 +772,29 @@ func (p *DataPath) AddChargingRules(smContext *SMContext, chgLevel ChargingLevel
UpfId: node.UPF.UUID(),
}

if smContext.UrrIdMap[N3N6_MBEQ_URR] == 0 {
if id, err := node.UPF.urrIDGenerator.Allocate(); err == nil {
smContext.UrrIdMap[N3N6_MBEQ_URR] = uint32(id)
}
}

if smContext.UrrIdMap[N3N6_MAEQ_URR] == 0 {
if id, err := node.UPF.urrIDGenerator.Allocate(); err == nil {
smContext.UrrIdMap[N3N6_MAEQ_URR] = uint32(id)
}
}

if smContext.UrrIdMap[N9N6_MBEQ_URR] == 0 {
if id, err := node.UPF.urrIDGenerator.Allocate(); err == nil {
smContext.UrrIdMap[N9N6_MBEQ_URR] = uint32(id)
if node.Prev() == nil {
if smContext.UrrIdMap[N3N6_MBQE_URR] == 0 {
if id, err := node.UPF.urrIDGenerator.Allocate(); err == nil {
smContext.UrrIdMap[N3N6_MBQE_URR] = uint32(id)
}
}
}

if smContext.UrrIdMap[N9N6_MAEQ_URR] == 0 {
if id, err := node.UPF.urrIDGenerator.Allocate(); err == nil {
smContext.UrrIdMap[N9N6_MAEQ_URR] = uint32(id)
if smContext.UrrIdMap[N3N6_MAQE_URR] == 0 {
if id, err := node.UPF.urrIDGenerator.Allocate(); err == nil {
smContext.UrrIdMap[N3N6_MAQE_URR] = uint32(id)
}
}
}

if smContext.UrrIdMap[N3N9_MBEQ_URR] == 0 {
if id, err := node.UPF.urrIDGenerator.Allocate(); err == nil {
smContext.UrrIdMap[N3N9_MBEQ_URR] = uint32(id)
} else {
if smContext.UrrIdMap[N9N6_MBQE_URR] == 0 {
if id, err := node.UPF.urrIDGenerator.Allocate(); err == nil {
smContext.UrrIdMap[N9N6_MBQE_URR] = uint32(id)
}
}
}

if smContext.UrrIdMap[N3N9_MAEQ_URR] == 0 {
if id, err := node.UPF.urrIDGenerator.Allocate(); err == nil {
smContext.UrrIdMap[N3N9_MAEQ_URR] = uint32(id)
if smContext.UrrIdMap[N9N6_MAQE_URR] == 0 {
if id, err := node.UPF.urrIDGenerator.Allocate(); err == nil {
smContext.UrrIdMap[N9N6_MAQE_URR] = uint32(id)
}
}
}

Expand Down Expand Up @@ -865,6 +855,18 @@ func (p *DataPath) AddChargingRules(smContext *SMContext, chgLevel ChargingLevel
}
}
}
} else {
if smContext.UrrIdMap[N3N9_MBQE_URR] == 0 {
if id, err := node.UPF.urrIDGenerator.Allocate(); err == nil {
smContext.UrrIdMap[N3N9_MBQE_URR] = uint32(id)
}
}

if smContext.UrrIdMap[N3N9_MAQE_URR] == 0 {
if id, err := node.UPF.urrIDGenerator.Allocate(); err == nil {
smContext.UrrIdMap[N3N9_MAQE_URR] = uint32(id)
}
}
}
}
}
Expand Down
33 changes: 6 additions & 27 deletions internal/context/sm_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ const (
type UrrType int

const (
N3N6_MBEQ_URR UrrType = iota
N3N6_MAEQ_URR
N3N9_MBEQ_URR
N3N9_MAEQ_URR
N9N6_MBEQ_URR
N9N6_MAEQ_URR
N3N6_MBQE_URR UrrType = iota
N3N6_MAQE_URR
N3N9_MBQE_URR
N3N9_MAQE_URR
N9N6_MBQE_URR
N9N6_MAQE_URR
NOT_FOUND_URR
)

Expand Down Expand Up @@ -374,27 +374,6 @@ func GetSMContextBySEID(SEID uint64) *SMContext {
return nil
}

// func (smContext *SMContext) GenerateUrrId() {
// if id, err := smContext.UrrIDGenerator.Allocate(); err == nil {
// smContext.UrrIdMap[N3N6_MBEQ_URR] = uint32(id)
// }
// if id, err := smContext.UrrIDGenerator.Allocate(); err == nil {
// smContext.UrrIdMap[N3N6_MAEQ_URR] = uint32(id)
// }
// if id, err := smContext.UrrIDGenerator.Allocate(); err == nil {
// smContext.UrrIdMap[N9N6_MBEQ_URR] = uint32(id)
// }
// if id, err := smContext.UrrIDGenerator.Allocate(); err == nil {
// smContext.UrrIdMap[N9N6_MAEQ_URR] = uint32(id)
// }
// if id, err := smContext.UrrIDGenerator.Allocate(); err == nil {
// smContext.UrrIdMap[N3N9_MBEQ_URR] = uint32(id)
// }
// if id, err := smContext.UrrIDGenerator.Allocate(); err == nil {
// smContext.UrrIdMap[N3N9_MAEQ_URR] = uint32(id)
// }
// }

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

0 comments on commit 691d252

Please sign in to comment.