Skip to content

Commit

Permalink
Find UP IP based on N6 uplink PDR
Browse files Browse the repository at this point in the history
  • Loading branch information
pudelkoM committed Jan 19, 2022
1 parent 825dd0d commit 7cabef1
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 8 deletions.
15 changes: 7 additions & 8 deletions pfcpiface/bess.go
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,10 @@ func (b *bess) sessionStats(pc *PfcpNodeCollector, ch chan<- prometheus.Metric)
break
}

if con == nil {
log.Warnln("No active PFCP connection, UE IP lookup disabled")
}

// Prepare session stats.
createStats := func(preResp, postResp *pb.FlowMeasureReadResponse) {
for i := 0; i < len(postResp.Statistics); i++ {
Expand Down Expand Up @@ -486,20 +490,15 @@ func (b *bess) sessionStats(pc *PfcpNodeCollector, ch chan<- prometheus.Metric)
continue
}

// Try to find the N6 uplink PDR with the UE IP.
for _, p := range session.pdrs {
if uint64(p.pdrID) != pre.Pdr {
continue
}
// Only downlink PDRs contain the UE address.
if p.srcIP > 0 {
if p.IsUplink() && p.srcIP > 0 {
ueIpString = int2ip(p.srcIP).String()
log.Warnln(p.fseID, " -> ", ueIpString)
log.Traceln(p.fseID, " -> ", ueIpString)

break
}
}
} else {
log.Warnln("No active PFCP connection, IP lookup disabled")
}

ch <- prometheus.MustNewConstMetric(
Expand Down
23 changes: 23 additions & 0 deletions pfcpiface/metrics.txt
Original file line number Diff line number Diff line change
Expand Up @@ -376,3 +376,26 @@ upf_packets_count{dir="rx",iface="Access"} 3.20726192e+08
upf_packets_count{dir="rx",iface="Core"} 3.2073401e+08
upf_packets_count{dir="tx",iface="Access"} 1.26494177e+08
upf_packets_count{dir="tx",iface="Core"} 1.27662469e+08
# HELP upf_session_jitter_ns Shows the jitter of a session in UPF
# TYPE upf_session_jitter_ns summary
upf_session_jitter_ns{fseid="805306368",pdr="1",ue_ip="10.0.0.1",quantile="50"} 0
upf_session_jitter_ns{fseid="805306368",pdr="1",ue_ip="10.0.0.1",quantile="90"} 0
upf_session_jitter_ns{fseid="805306368",pdr="1",ue_ip="10.0.0.1",quantile="99"} 0
upf_session_jitter_ns_sum{fseid="805306368",pdr="1",ue_ip="10.0.0.1"} 0
upf_session_jitter_ns_count{fseid="805306368",pdr="1",ue_ip="10.0.0.1"} 736733
# HELP upf_session_latency_ns Shows the latency of a session in UPF
# TYPE upf_session_latency_ns summary
upf_session_latency_ns{fseid="805306368",pdr="1",ue_ip="10.0.0.1",quantile="50"} 16000
upf_session_latency_ns{fseid="805306368",pdr="1",ue_ip="10.0.0.1",quantile="90"} 17000
upf_session_latency_ns{fseid="805306368",pdr="1",ue_ip="10.0.0.1",quantile="99"} 18000
upf_session_latency_ns_sum{fseid="805306368",pdr="1",ue_ip="10.0.0.1"} 0
upf_session_latency_ns_count{fseid="805306368",pdr="1",ue_ip="10.0.0.1"} 736733
# HELP upf_session_rx_packets Shows the total number of packets received for a given session in UPF
# TYPE upf_session_rx_packets gauge
upf_session_rx_packets{fseid="805306368",pdr="1",ue_ip="10.0.0.1"} 736733
# HELP upf_session_tx_bytes Shows the total number of bytes for a given session in UPF
# TYPE upf_session_tx_bytes gauge
upf_session_tx_bytes{fseid="805306368",pdr="1",ue_ip="10.0.0.1"} 1.20824212e+08
# HELP upf_session_tx_packets Shows the total number of packets sent for a given session in UPF
# TYPE upf_session_tx_packets gauge
upf_session_tx_packets{fseid="805306368",pdr="1",ue_ip="10.0.0.1"} 736733

0 comments on commit 7cabef1

Please sign in to comment.