Skip to content

newt2105/5G-testbed-ANSA

Repository files navigation

5G testbed ANSA LAB

This repository provides the instruction to deploy a 5G architechture using Open5GS, srsRAN_Project and ORAN SC RIC.

We also have a dashboard to monitor the data of 5G system on Grfana. 5G Architechture for testbed

Quick start

1. Build Preparation

To deploy 5G Core and RAN, please run the following command to install dependencies:

chmod +x setup.sh

./setup.sh
  1. Install ZeroMQ
git clone https://github.com/zeromq/czmq.git
cd czmq
./autogen.sh
./configure 
make
sudo make install
sudo ldconfig
  1. GNU-Radio Companion This will allow connect multiple UEs, Please install GNU-Radio Companion following the instructions here:
sudo apt-get install gnuradio

2. 5G RAN

We set up an end-to-end 5G network using the srsRAN_Project gNB [docs,code] (that is equipped with an E2 agent) and srsUE from srsRAN-4g project [docs,code]. Please follow the official installation guidelines and remember to compile both projects with ZeroMQ support.

We follow this application note. To this end, we execute gNB and srsUE with the configs provided in the ./config directory (gNB config differs only with the IP address of the RIC compared to the config from the tutorial). Note that, we use ZMQ-based RF devices for emulation of the wireless transmission between gNB and UE, therefore the entire RAN setup can be run on a single host machine.

Use this command to install srsRAN_Project (include Open5gs):

git clone https://github.com/srsran/srsRAN_Project.git
cd srsRAN_Project
mkdir build
cd build
cmake ../ -DENABLE_EXPORT=ON -DENABLE_ZEROMQ=ON -DAUTO_DETECT_ISA=OFF
make -j`nproc` 

3. srsRAN_4G

We use srsUE from srsRAN-4g project [docs,code].

git clone https://github.com/srsRAN/srsRAN_4G.git
cd srsRAN_4G
mkdir build
cd build
cmake ../

4. ORAN SC RIC

git clone https://github.com/newt2105/5G-testbed-ANSA.git

Configuration

Configuration file for gnb, UEs, and GNU-Radio flow graph are stored in config

The configuration file for gnb must be in srsRAN_Project/build/apps/gnb/, for UE: srsRAN_4G/build/srsue/src

Applying network slicing:

To apply network slicing, you have to change some file:

  1. srsRAN_Project/docker/open5gs/open5gs-5gc.yml
amf:
...
 plmn_support:
    - plmn_id:
        mcc: 001
        mnc: 01
      s_nssai:
        - sst: 1
          sd: 000001
        - sst: 1
          sd: 000002
        - sst: 1
          sd: 000003 
  1. czmq/srsRAN_4G/srsue/src/stack/upper/nas_5g.cc Comment these line:
...
# if (cfg.enable_slicing) {
# reg_req.requested_nssai_present = true;
# s_nssai_t nssai;
# set_nssai(nssai);
# reg_req.requested_nssai.s_nssai_list.push_back(nssai);
# }
... 
  1. Move 3 files in open5gs to srsRAN_Project/docker/open5gs

Running the network

  1. Start Open5gs
docker compose up --build 5gc

After that, you should check the information of each UE on http://localhost:9999/

  1. Start Oran-sc-ric:
cd ./oran-sc-ric
docker compose up

The output should be:

ric_submgr          | RMR is ready now ...
  1. Start gnb
cd  ./srsRAN_Project/build/apps/gnb/
sudo ./gnb -c gnb_zmq.yaml 

The output should be similar to:

--== srsRAN gNB (commit 0b2702cca) ==--

Connecting to AMF on 10.53.1.2:38412
Available radio types: zmq.
Connecting to NearRT-RIC on 127.0.0.1:36421
Cell pci=1, bw=10 MHz, dl_arfcn=368500 (n3), dl_freq=1842.5 MHz, dl_ssb_arfcn=368410, ul_freq=1747.5 MHz

==== gNodeB started ===
Type <t> to view trace

The gNB should connect to both the core network and the RIC.
Note: The RIC uses 60s time-to-wait. Therefore, after disconnecting from RIC, an E2 agent (inside gNB) has to wait 60s before trying to connect again. Otherwise, the RIC sends an E2 SETUP FAILURE message and gNB is not connected to the RIC.

  1. Start UEs
cd ./srsRAN_4G/build/srsue/src
sudo ip netns add ue1 
sudo ip netns add ue2 
sudo ip netns add ue3

sudo ./srsue ./ue1_zmq.conf
sudo ./srsue ./ue2_zmq.conf
sudo ./srsue ./ue3_zmq.conf

OR run this command:

sudo bash run_ues.sh

Run GRC flowgraph:

sudo gnuradio-companion ./multi_ue_scenario.grc

If srsUE connects successfully to the network, the following (or similar) should be displayed on the console:

Built in Release mode using commit fa56836b1 on branch master.

Opening 1 channels in RF device=zmq with args=tx_port=tcp://127.0.0.1:2001,rx_port=tcp://127.0.0.1:2000,base_srate=11.52e6
Supported RF device list: UHD zmq file
CHx base_srate=11.52e6
Current sample rate is 1.92 MHz with a base rate of 11.52 MHz (x6 decimation)
CH0 rx_port=tcp://127.0.0.1:2000
CH0 tx_port=tcp://127.0.0.1:2001
Current sample rate is 11.52 MHz with a base rate of 11.52 MHz (x1 decimation)
Current sample rate is 11.52 MHz with a base rate of 11.52 MHz (x1 decimation)
Waiting PHY to initialize ... done!
Attaching UE...
Random Access Transmission: prach_occasion=0, preamble_index=0, ra-rnti=0x39, tti=334
Random Access Complete.     c-rnti=0x4601, ta=0
RRC Connected
PDU Session Establishment successful. IP: 10.45.1.2
RRC NR reconfiguration successful.

IP Traffic with ping

To ping UEs to the core, run this command:

sudo bash traffic.sh

xApp

We provide some xapp xApps designed to monitor any measurement metric exposed by an E2SM_KPM service module within an E2 Agent. These xApps function by sending a RIC Subscription Request message, which includes a RIC Subscription Details Information Element crafted following the E2SM_KPM definition. Subsequently, they receive RIC Indication Messages containing measurement data adhering to the E2SM_KPM_IndicationMessage definition. In addition, we provide one example xApp that demonstrates the usage of the E2SM_RC service module.

One of the custom xApp is: The mon_xapp_db erves as a comprehensive E2SM-KPM monitor, include send the data to the InfluxDB

The xapp_env.py is the RL based xAxpp to control the resource block for slices, before run this app, you need to apply the patch srsRAN_Project.patch to add more measured metrics, just copy them and rebuild srsRAN_Project, and you need to run traffic2UE.sh to run only 2 UEs.

Visualize data on Grafana

Run the mon_xapp_db using this command:

sudo docker compose exec python_xapp_runner python3 ./test_db.py  

Note: If you have some problem/error about library, just sudo docker compose exec python_xapp_runner bash and pip install the needed library.

Access http://localhost:3000/ Username/password: admin/admin

Choose Connection -> Data Source
Input: InfluxDB
Query languge: Flux
URL: http://influxdb:8086/
Organization: srs
Token: 05bc59413b7d5457d181ccf20f9fda15693f81b068d70396cc183081b264f3b
Default bucket: srsran

Click Save and Test

Create new dashboard:

Access Dashboard -> New -> Import, copy file dashboard JSON ./JSON-dashboard/dashboard.json to it.

The visualization of data on Grafana look like below:

5G Architechture for testbed 5G Architechture for testbed

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •