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

fix: period server query multi URRs issue, rollback query report one by one for URRs #31

Merged
merged 1 commit into from
Mar 25, 2023
Merged
Changes from all commits
Commits
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
33 changes: 28 additions & 5 deletions internal/forwarder/gtp5g.go
Original file line number Diff line number Diff line change
Expand Up @@ -1433,7 +1433,23 @@ func (g *Gtp5g) QueryURR(lSeid uint64, urrid uint32) ([]report.USAReport, error)
}

func (g *Gtp5g) psQueryURR(lSeidUrridsMap map[uint64][]uint32) (map[uint64][]report.USAReport, error) {
return g.queryMultiURR(lSeidUrridsMap, true)
seidUsars := make(map[uint64][]report.USAReport)

for lSeid, urrids := range lSeidUrridsMap {
for _, urrid := range urrids {
usars, err := g.queryURR(lSeid, urrid, true)
if err != nil {
g.log.Warnf("psQueryURR: %v", err)
continue
}
if len(usars) == 0 {
g.log.Warnf("psQueryURR: no reports for URR[%#x:%#x]", lSeid, urrid)
continue
}
seidUsars[lSeid] = append(seidUsars[lSeid], usars...)
}
}
return seidUsars, nil
}

func (g *Gtp5g) queryURR(lSeid uint64, urrid uint32, ps bool) ([]report.USAReport, error) {
Expand All @@ -1446,7 +1462,7 @@ func (g *Gtp5g) queryURR(lSeid uint64, urrid uint32, ps bool) ([]report.USARepor
}
rs, err := gtp5gnl.GetReportOID(c, g.link.link, oid)
if err != nil {
return nil, errors.Wrapf(err, "queryURR")
return nil, errors.Wrapf(err, "queryURR[%#x:%#x]", lSeid, urrid)
}

if rs == nil {
Expand Down Expand Up @@ -1475,7 +1491,14 @@ func (g *Gtp5g) queryURR(lSeid uint64, urrid uint32, ps bool) ([]report.USARepor

g.log.Tracef("queryURR: %+v", usars)

return usars, err
return usars, nil
}

// Note: the max size of netlink msg is 16k,
// the number of reports from gtp5g is limited
// depending on the size of report
func (g *Gtp5g) QueryMultiURR(lSeidUrridsMap map[uint64][]uint32) (map[uint64][]report.USAReport, error) {
return g.queryMultiURR(lSeidUrridsMap, false)
}

func (g *Gtp5g) queryMultiURR(lSeidUrridsMap map[uint64][]uint32, ps bool) (map[uint64][]report.USAReport, error) {
Expand All @@ -1492,7 +1515,7 @@ func (g *Gtp5g) queryMultiURR(lSeidUrridsMap map[uint64][]uint32, ps bool) (map[
}
rs, err := gtp5gnl.GetMultiReportsOID(c, g.link.link, oids)
if err != nil {
return nil, errors.Wrapf(err, "queryMultiURR")
return nil, errors.Wrapf(err, "queryMultiURR[%+v]", lSeidUrridsMap)
}

if rs == nil {
Expand Down Expand Up @@ -1521,7 +1544,7 @@ func (g *Gtp5g) queryMultiURR(lSeidUrridsMap map[uint64][]uint32, ps bool) (map[

g.log.Tracef("queryMultiURR: %+v", usars)

return usars, err
return usars, nil
}

func (g *Gtp5g) HandleReport(handler report.Handler) {
Expand Down