Skip to main content

Lab 1: Simple 5G SA

The first experiment is to deploy a simple 5G Standalone (SA) network using OpenAirInterface (OAI) RF Simulator gNB and OAI minimal 5GC to analyze the control plane and data plane. In this lab we use OAI T-Tracer which traces the protocol stack and messages as well as the radio signals.

simple-sa.yaml
apiVersion: athena.trirematics.io/v1
kind: Network
metadata:
name: eurecom
namespace: trirematics
spec:
slices:
- plmn: "00101"
dnn: "internet"
network-mode: "IPv4"
service-type: eMBB
differentiator: 0x000000
ipv4-range: "12.1.1.0/24"
ipv6-range: "2001:db8:1::/64"
access:
- name: oai-gnb
stack: 5g-sa
model: oai-ran/monolithic-gnb
profiles:
- t-tracer
identity:
an-id: 50
radio:
device: rf-sim
cells:
- band: n78
arfcn: 641280
bandwidth: 40MHz
subcarrier-spacing: 30kHz
tdd-config:
period: 5ms
dl-slots: 7
dl-symbols: 6
ul-slots: 2
ul-symbols: 4
core-networks:
- minimal.eurecom
core:
- name: minimal
stack: 5g-sa
model: oai-cn/minimal
identity:
region: 0
cn-group: 4
cn-id: 5
dns:
ipv4:
default: 8.8.8.8
secondary: 8.8.4.4
---
apiVersion: athena.trirematics.io/v1
kind: Terminal
metadata:
name: ue1
namespace: trirematics
spec:
vendor: oai
stack: 5g-sa
model: terminal/nr-rfsim
preferred-access: oai-gnb.eurecom
target-cores:
- minimal.eurecom
identity:
imsi: "001010000000001"
pin: "1234"
opc: "0xc42449363bbad02b66d16bc975d77cc1"
key: "0xfec86ba6eb707ed08905757b1bb44b8f"
sqn: "0xff9bb4000001"
slice:
dnn: "internet"
network-mode: "IPv4"
service-type: eMBB
differentiator: 0x000000
radio:
bands:
- n78
readiness-check:
method: ping
target: google-ip
interface-name: oaitun_ue0
---
apiVersion: athena.trirematics.io/v1
kind: Terminal
metadata:
name: ue2
namespace: trirematics
spec:
vendor: oai
stack: 5g-sa
model: terminal/nr-rfsim
preferred-access: oai-gnb.eurecom
target-cores:
- minimal.eurecom
identity:
imsi: "001010000000002"
pin: "1234"
opc: "0xc42449363bbad02b66d16bc975d77cc1"
key: "0xfec86ba6eb707ed08905757b1bb44b8f"
sqn: "0xff9bb4000001"
slice:
dnn: "internet"
network-mode: "IPv4"
service-type: eMBB
differentiator: 0x000000
radio:
bands:
- n78
readiness-check:
method: ping
target: google-ip
interface-name: oaitun_ue0

Deployment

Use the command cli install network sample-sa.yaml to deploy the network. It should finish without errors and printout the two Kubernetes resource names that were created. Check for the status of the deployment using the command cli observe. Wait until all the Elements other than the UE are in the STATUS set to 1/1 Y state.

💬 Questions

  1. Explain the role of each of the Elements in the deployment.
  2. Record the output of the observe by taking a screenshot.

PCAP Extraction

We need to extract the PCAP from the gNB to analyze the control plane and data plane traffic. To do so, we specify a set of ports to be captured and then extract the PCAP file. Port 9999 is used by OAI gNB to dump the MAC layer packets internally. The $element is a placeholder for the name of the element. Press the Tab key (multiple times) to see the list of available elements and then pick the right one. If you start typing the name of the element, pressing the Tab key will complete the name.

udp_ports="2123 or 2152 or 9999"
sctp_ports="38412 or 38472 or 36421"
filter="(sctp port $sctp_ports) or (udp port $udp_ports)"
cli extract pcap $element -- "$filter" | wireshark -k -i -

OAI gNB is using TTracer which is waiting for the user to call the starting function. On a separate terminal, run the following command to start the gNB:

cli cic $element run -- t-dumper

Use Ctrl+C to stop the command, after you see the line is printed.

Wait for the cli observe command to indicate your UEs are ready. To verify the E2E connection, let us check the AMF and gNB logs. To do so, run the following command:

cli extract logs $element

You could use the Tab key to complete the name of the element.

💬 Questions

  1. Explain what are each of the ports used for in 4G/5G interfaces and show the protocol stack.
  2. How many Logical Channels are created in the gNB? Explain the role of each and connect them to the DRBs.
  3. Investigate if there is any user traffic in the PCAP already and if any the type of the traffic (after the UEs readiness).
  4. How are we specifying the gNB to wait for the TTracer based on the deployment file?
danger

Continue exercise WITHOUT closing the Wireshark.

Traffic Generation

The next step is to generate traffic between the UE and the gNB and observe the results. Pick one of the UEs at random for this part of the lab. There are two classes of tests that can be performed:

  1. rtt: Round Trip Time (RTT) measurements using ping.
  2. throughput: Throughput measurements using iperf3.

In all the following commands of this section, $terminal is a placeholder for the name of the network terminal (a generic term for the UEs). You could use the Tab key to see the list of available terminals and then pick the right one. If you start typing the name of the terminal, pressing the Tab key will complete the name.

To run the RTT test, use the following command:

cli test rtt $terminal -- -c 100 -s 64 12.1.1.1

The throughput test could be performed in Uplink (UL) and Downlink (DL) directions with TCP or UDP payloads. Use the table below to find the right command for each test.

DirectionProtocolCommand
ULTCPcli test throughput $terminal ul -- gateway --time 10
DLTCPcli test throughput $terminal dl -- gateway --time 10
DLUDPcli test throughput $terminal dl -- gateway --udp --bandwidth 40M

💬 Questions

  1. Run the RTT test and record the statistics.
  2. Run the RTT command again by replacing the packet size of 64 bytes with 768 bytes and record the statistics.
  3. Compare the two previous results in a bar chart for average, min, max, and standard deviation statistics.
  4. Explain where does the IP address 12.1.1.1 in the command come from?
  5. Run all the throughput tests and record the statistics.
  6. Stop the Wireshark capture and save it to a file for further analysis.
  7. Run the TCP downlink tests again and use the option --plot before the terminal name to plot the throughput in real-time and record the results by taking a screenshot.

Extract Configuration

As an extra exercise, you can extract the configuration of the gNB as well as some visuals on your deployment. To extract the configuration, use the following command:

cli extract config $element$ .

This will create the configurations in the current directory. Keep the configuration for verifying the results of your packet analysis.

Uninstall

To uninstall the network, use the following command:

cli remove network simple-sa.yaml

Checking via the cli observe command, you should see that all the elements are removed.


💬 Lab Questions 💬


For the questions below, when applicable, verify the results both from the configuration or the logs and the PCAP. If one piece of information is present in multiple messages, please specify all of them and explain the differences.

  1. What are the IP address of gNB and AMF?
  2. What is the port number of N2-AMF?
  3. What is the gNB identity? Explain the difference between the gNB ID and the cell ID.
  4. What are the frequency and bandwidth of the gNB?
  5. What is the subcarrier spacing of the gNB?
  6. What TDD pattern is used by the gNB?
  7. What preamble index is used for the RACH and what is the type of the RACH?
  8. What are the RNTIs of the connected UE?
  9. What are the IMSIs and PLMNs of the connected UEs?
  10. How did the UEs signal its selected PLMN Identities?
  11. Which (logical) channels are used during the RACH and RRC connection setup?
  12. Map the RRC connection messages to the logical channels and RLC mode.
  13. At which message numbers are the UEs connected to the gNB and can start transmitting data?
  14. At which message numbers are the UEs disconnected from the gNB and from AMF?
  15. Draw the message sequence chart and show the messages and their associated network entity (i.e. UE, gNB, AMF).
  16. Scheduling Request (SR):
  • Describe a SR with your own words.
  • How often are SRs received as per the trace?
  • What is the SR configuration, i.e., how often can a UE request a SR?
  1. By which physical channel is the MIB carried?
  2. By which physical channel is the SIB1 carried?
  3. What are the periods of the SIB1 and MIB messages?
  4. At what message number is the UE connected to the gNB and can start transmitting data?
  5. Use the RRC messages figure and annotate the messages with the time and the message number for each UE.