Test a UPF
You can test a UPF on its own, with no AMF, SMF or rest of the core. rk plays both network functions a UPF talks to:
The gNB sits on a gtpu transport instead of an ngap one. That gives it an N3 endpoint and nothing else: no SCTP, no NG Setup.
This needs the licence features proto.pfcp and proto.gtpu.
The environment
The flow
On N2, a gNB learns its tunnel from the core. Here there's no N2, so the flow does it:
- establish the PFCP session;
- read the F-TEID and the UE address the UPF allocated;
- start traffic with
uplane_start, passingremote_teid,remote_addrandue_ip(see User plane).
d3x-templates has this flow: upf_dut_session_and_traffic.
The check that proves forwarding is the received count. rk counts a packet only when a G-PDU comes back to the gNB's own downlink TEID on its N3 socket. A non-zero count therefore means the UPF forwarded both ways, on the tunnel the two sides agreed over N4.
Answer the traffic on N6
To control the data-network side too, run rk server dn as the destination behind the UPF's N6.
The opposite direction: rk as the UPF
A upf NF on a gtpu transport with a reflector: block makes rk answer GTP-U itself, so you can test the gNB side or the SMF side. The reflector:
- echoes uplink traffic back as downlink;
- handles unknown TEIDs with
unknown_teid: error_indication(the default),dropormirror; - rate-limits the Error Indications and Echo Responses it sends.
rk server uspace and rk server dpdk
To answer plain traffic, or to stand in for the UPF on DPDK, run a server on its own:
server dpdkneeds the licence featuredatapath.dpdkand the full build. It ends with a verdict: it passes when something was reflected and nothing was dropped.-metrics-portserves Prometheus metrics on both, with the licence featureobs.prometheus. See Metrics.- Exit codes:
2for a missing or bad-protocol,5when the licence refuses,4when a port can't be bound. See Exit codes.