From 7cabef10f0af59f650bfca85a9e6d64ca3f0cc45 Mon Sep 17 00:00:00 2001 From: pudelkoM Date: Wed, 19 Jan 2022 12:12:47 -0800 Subject: [PATCH] Find UP IP based on N6 uplink PDR --- pfcpiface/bess.go | 15 +++++++-------- pfcpiface/metrics.txt | 23 +++++++++++++++++++++++ 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/pfcpiface/bess.go b/pfcpiface/bess.go index a4aee5ad6..8f0c8c888 100644 --- a/pfcpiface/bess.go +++ b/pfcpiface/bess.go @@ -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++ { @@ -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( diff --git a/pfcpiface/metrics.txt b/pfcpiface/metrics.txt index 238ede22b..1950ee203 100644 --- a/pfcpiface/metrics.txt +++ b/pfcpiface/metrics.txt @@ -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