The environment
The environment file (-c env.yaml) describes your lab:
- the network functions
rksimulates, and the ones it talks to; - the transports that connect them.
Flows don't contain addresses: they name NFs by role, and the environment says where those NFs are. Each key is listed in the generated configuration reference.
Shape
A minimal environment
One simulated gNB that connects to the AMF under test and sends ICMP user-plane traffic:
NFs
nameis unique within the environment.roleis one of:gnb,amf,smf,ausf,udm,pcf,nrf,upf,mme,pgw,af,pcrf,hss,bsf,nssf,udr,nef,external. Useexternalfor non-3GPP REST peers, such as a vendor admin API.transportnames an entry undertransports:.- The role block goes with the role:
gnb:for a gNB,amf:for an AMF. Only the block that matches the role is read.
Each protocol accepts these roles:
| Protocol | Roles |
|---|---|
ngap | gnb (needs gnb.global_id.gnb_id), amf |
diameter | mme, pgw, af, pcrf, hss (each needs plmn.mcc and plmn.mnc) |
sbi | amf, smf, ausf, udm, pcf, nrf, upf, bsf, nssf, udr, nef |
rest | any role |
pfcp | smf, upf |
gtpu | gnb (an N3-only gNB, needs gnb.uplane), upf (needs gtpu.reflector) |
All the gNBs in one environment must be of one kind: all NGAP or all N3-only. Each UE is assigned one of them at random.
The gNB's UE defaults
gnb.ue sets what each simulated UE asks for:
dnn, by defaultinternet;snssai, by default SST 1 with no SD;suci.protection_scheme:0(null, the default),1(profile A) or2(profile B). Schemes 1 and 2 needhn_pubkey(hex) andhn_pubkey_id(up to 254).
The AMF block
amf: sets served_guami, relative_capacity, and allowed_gnbs (matched on the RAN node name in NG Setup). An empty allowed_gnbs accepts any gNB.
Transports
Each transport has a protocol and exactly the matching block.
ngap
local_sctp: the local SCTP address. Give a port to bind one; leave it out to let the kernel pick.local_gtpu: the N3 address.peers: each withaddressandport(default38412), and an optionalprimary.sctp: tuning: RTO, heartbeat, retransmissions, buffers, streams.
Which side rk plays is decided by the NFs, not by mode:
- An environment with an
amfNF listens and accepts gNBs (the AMF side; licence featureserver.mode). - Otherwise, its gNBs connect to the peers and run NG Setup by themselves.
Only the first NGAP transport in an environment is used.
SCTP multi-homing. local_sctp and a peer's address can list several IP addresses, either comma-separated or as a YAML list. rk then dials all of a peer's addresses at once.
- Every listed address must be an IP literal, not a wildcard.
- A port goes in the
portfield, never in a peer's address.
diameter
local:
origin_hostandorigin_realm(required),application_ids(at least one);vendor_id, by default 3GPP;product_name, by defaultrk;watchdog_interval;listento accept peers, over SCTP, TCP, TLS or DTLS;responder.timeout, by default 30s.
peers:
name,transport(sctportcp),addrandport(no default; 3868 is usual);destination_hostanddestination_realm;connection_mode:initiator(the default),responderorboth;tls: trueto dial the peer over TLS (transporttcponly; 5868 is the usual port).ca_fileverifies the peer's certificate (by default the system roots),server_nameis the name it must carry (by defaultaddr), andcert_filewithkey_fileis the client certificaterkpresents. TLS 1.2 or newer. Over SCTP,tls: trueis refused when the file loads: Diameter over SCTP is secured with DTLS, whichrkaccepts onlistenbut doesn't dial.
routes: by realm and application. Each route's local_action is relay (the default), local, proxy or redirect.
Only the first Diameter transport in an environment is used.
sbi and rest
Client or server: give exactly one of
base_url(httporhttps):rkcalls the NF there;listen:rkserves the NF itself.
TLS (tls:):
cert_fileandkey_filego together.- A server needs both.
client_authapplies to servers only. It'srequirewhenca_fileis set, otherwisenone.- A server without a
tls:block serves cleartext HTTP/2 (h2c). http1: trueuses HTTP/1.1.
Authentication:
- SBI takes
oauth2(token URL, client or NF instance ID, scope). The client secret comes from an environment variable. - REST takes
authof typebasic,bearer,api_keyornone. Secrets come only from environment variables (*_env), never from the file.
pfcp
mode:client(needspeer.addrandpeer.port) orserver(needslocalashost:port).node_idis required:ipv4,ipv6orfqdn, with a value.
gtpu
local(IPv4, required) and an optionalpeer. The port is always 2152.- A gNB on a
gtputransport is an N3 endpoint with no N2: it sends user-plane traffic, but no NGAP. See Test a UPF. - A
upfon agtputransport withreflector:answers GTP-U itself: it echoes uplink traffic back as downlink.
Validate
rk check -c env.yaml loads and validates the file, then probes it (see Use rk in CI). A key the config doesn't have is refused when the file loads, with the file, line and key, for example env.yaml: parse config: line 11: unknown key "prot" in transports.n2.ngap.peers[0] (did you mean "port"?). Validation errors name the key too, for example:
transport "n3" not declared in transports:exactly one of base_url (client mode) or listen (server mode) is required
A file that doesn't load or validate stops every command with exit code 4.
Every key
The environment configuration reference lists every key, generated from the source code. The CLI reference lists every command and flag.