Skip to content

Atempt at "Add 5G MAC slice with NVS algo & RC ran func" MR setup

Apbk20 edited this page Nov 27, 2024 · 29 revisions

1 Install

1.1 Install prerequisites and Download the required dependencies.

cd ~
git clone https://github.com/swig/swig.git
cd swig
git checkout release-4.1 
./autogen.sh
./configure --prefix=/usr/
make -j 8
make install
sudo apt install libsctp-dev python3.8 cmake-curses-gui libpcre2-dev python3-dev

2. Deployment

2.1 OAI RAN

2.1.1 Clone the OAI repository brance rebased-5g-nvs-rc-rf

git clone https://gitlab.eurecom.fr/oai/openairinterface5g ~/MAC_slicing_oai_MR
cd ~/MAC_slicing_oai_MR
git fetch origin
git checkout 2b588dd4540dc6dca79e7e454e705ce243b88c0c

2.1.2 Build OAI with E2 Agent

cd ~/MAC_slicing_oai_MR/cmake_targets/
./build_oai -I 
./build_oai -w USRP --gNB --build-e2 --ninja -C

2.2 FlexRIC

2.2.1 Clone the FlexRIC repository

cd 
git clone https://gitlab.eurecom.fr/mosaic5g/flexric flexric
cd flexric/
git checkout 7e2887222eb53bcb52d3032cb7971584e061eece

2.2.2 Change the PLMN(line 131) and percentage of PRB for slicing(line 210) for

code ~/flexric/examples/xApp/c/ctrl/xapp_rc_slice_ctrl.c

Insert the following into line 131

char plmnid_str[] = "00101";

2.2.2 Build FlexRIC

cd ~/flexric && mkdir build && cd build && cmake .. && make -j 8
sudo make install
ctest

By default the service model libraries will be installed in the path /usr/local/lib/flexric while the configuration file in /usr/local/etc/flexric.

2.2.3 change FlexRIC.conf IP address

sudo nano ~/../../usr/local/etc/flexric/flexric.conf

Insert the following

[NEAR-RIC]
NEAR_RIC_IP = 192.168.10.15

[XAPP]
DB_DIR = /tmp/

Change the flexric version used by the gNB

~/MAC_slicing_oai_MR/openair2/E2AP/flexeic
git checkout 01d85049f5196eec77db315bb68747dd1891b1d9

2.2.4 Configure E2 agent, OAI IP addr, and USRP type

Please, add the following block in OAI's configuration file:

code ~/MAC_slicing_oai_MR/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band77.fr1.273PRB.2x2.usrpn300.conf
e2_agent = {
  near_ric_ip_addr = "192.168.10.15";
  sm_dir = "/usr/local/lib/flexric/"
}

And change the IP of AMF and RU USRP to X30xx

RUs = (
{
  local_rf       = "yes"
  nb_tx          = 2;
  nb_rx          = 2;
  att_tx         = 0;
  att_rx         = 0;
  bands          = [77];
  max_pdschReferenceSignalPower = -27;
  max_rxgain                    = 75;
  eNB_instances  = [0];
  ##beamforming 1x2 matrix: 1 layer x 2 antennas
  bf_weights = [0x00007fff, 0x0000];
  #clock_src = "internal";
#  sdr_addrs = "addr=192.168.20.2,clock_source=internal,time_source=internal"
  sdr_addrs = "type=n3xx";
  clock_src = "internal";
}
);
  ////////// AMF parameters:
  amf_ip_address = (
  {ipv4 = "192.168.71.132";} );

  NETWORK_INTERFACES :
  {
    GNB_IPV4_ADDRESS_FOR_NG_AMF              = "192.168.10.15";
    GNB_IPV4_ADDRESS_FOR_NGU                 = "192.168.10.15";
    GNB_PORT_FOR_S1U                         = 2152; # Spec 2152
  }

}
);

Change the PLMN_list in line 13 in gnb conf from

plmn_list = ({ mcc = 001; mnc = 01; mnc_length = 2; snssaiList = ({ sst = 1; }); });

to

 
  plmn_list = ({ 
                mcc = 001;
                mnc = 01;
                mnc_length = 2;
                snssaiList = ( {
                                  sst = 1;
                                  sd  = 0x000001; // 0 false, else true
                                },
                                {
                                  sst = 1;
                                  sd  = 0x000005; // 0 false, else true
                                }
                               );
                });

3. 5G CN setup

I am using this tutorial

5G CN toturial

cd ~/MAC_slicing_oai_MR/doc/tutorial_resources/oai-cn5g/
docker compose pull

Change all xxx.xxx.70.xxx to xxx.xxx.71.xxx and 127.0.0.1 to 192.168.10.15 in

code ~/MAC_slicing_oai_MR/doc/tutorial_resources/oai-cn5g/conf/config.yaml
code ~/MAC_slicing_oai_MR/doc/tutorial_resources/oai-cn5g/docker-compose.yaml

3.1 Update UE database

navigate to

code  ~/MAC_slicing_oai_MR/doc/tutorial_resources/oai-cn5g/database/oai_db.sql

change SD to 1 or 5 in line 213 - 221

INSERT INTO `SessionManagementSubscriptionData` (`ueid`, `servingPlmnid`, `singleNssai`, `dnnConfigurations`) VALUES
('001010000000001', '00101', '{\"sst\": 1, \"sd\": \"1\"}','{\"oai\":{\"pduSessionTypes\":{ \"defaultSessionType\": \"IPV4\"},\"sscModes\": {\"defaultSscMode\": \"SSC_MODE_1\"},\"5gQosProfile\": {\"5qi\": 6,\"arp\":{\"priorityLevel\": 15,\"preemptCap\": \"NOT_PREEMPT\",\"preemptVuln\":\"PREEMPTABLE\"},\"priorityLevel\":1},\"sessionAmbr\":{\"uplink\":\"1000Mbps\", \"downlink\":\"1000Mbps\"},\"staticIpAddress\":[{\"ipv4Addr\": \"12.1.1.101\"}]},\"ims\":{\"pduSessionTypes\":{ \"defaultSessionType\": \"IPV4V6\"},\"sscModes\": {\"defaultSscMode\": \"SSC_MODE_1\"},\"5gQosProfile\": {\"5qi\": 2,\"arp\":{\"priorityLevel\": 15,\"preemptCap\": \"NOT_PREEMPT\",\"preemptVuln\":\"PREEMPTABLE\"},\"priorityLevel\":1},\"sessionAmbr\":{\"uplink\":\"1000Mbps\", \"downlink\":\"1000Mbps\"}}}');
INSERT INTO `SessionManagementSubscriptionData` (`ueid`, `servingPlmnid`, `singleNssai`, `dnnConfigurations`) VALUES
('001010000000002', '00101', '{\"sst\": 1, \"sd\": \"1\"}','{\"oai\":{\"pduSessionTypes\":{ \"defaultSessionType\": \"IPV4\"},\"sscModes\": {\"defaultSscMode\": \"SSC_MODE_1\"},\"5gQosProfile\": {\"5qi\": 6,\"arp\":{\"priorityLevel\": 15,\"preemptCap\": \"NOT_PREEMPT\",\"preemptVuln\":\"PREEMPTABLE\"},\"priorityLevel\":1},\"sessionAmbr\":{\"uplink\":\"1000Mbps\", \"downlink\":\"1000Mbps\"},\"staticIpAddress\":[{\"ipv4Addr\": \"12.1.1.102\"}]},\"ims\":{\"pduSessionTypes\":{ \"defaultSessionType\": \"IPV4V6\"},\"sscModes\": {\"defaultSscMode\": \"SSC_MODE_1\"},\"5gQosProfile\": {\"5qi\": 2,\"arp\":{\"priorityLevel\": 15,\"preemptCap\": \"NOT_PREEMPT\",\"preemptVuln\":\"PREEMPTABLE\"},\"priorityLevel\":1},\"sessionAmbr\":{\"uplink\":\"1000Mbps\", \"downlink\":\"1000Mbps\"}}}');
INSERT INTO `SessionManagementSubscriptionData` (`ueid`, `servingPlmnid`, `singleNssai`, `dnnConfigurations`) VALUES
('001010000000003', '00101', '{\"sst\": 1, \"sd\": \"1\"}','{\"oai\":{\"pduSessionTypes\":{ \"defaultSessionType\": \"IPV4\"},\"sscModes\": {\"defaultSscMode\": \"SSC_MODE_1\"},\"5gQosProfile\": {\"5qi\": 6,\"arp\":{\"priorityLevel\": 15,\"preemptCap\": \"NOT_PREEMPT\",\"preemptVuln\":\"PREEMPTABLE\"},\"priorityLevel\":1},\"sessionAmbr\":{\"uplink\":\"1000Mbps\", \"downlink\":\"1000Mbps\"},\"staticIpAddress\":[{\"ipv4Addr\": \"12.1.1.103\"}]},\"ims\":{\"pduSessionTypes\":{ \"defaultSessionType\": \"IPV4V6\"},\"sscModes\": {\"defaultSscMode\": \"SSC_MODE_1\"},\"5gQosProfile\": {\"5qi\": 2,\"arp\":{\"priorityLevel\": 15,\"preemptCap\": \"NOT_PREEMPT\",\"preemptVuln\":\"PREEMPTABLE\"},\"priorityLevel\":1},\"sessionAmbr\":{\"uplink\":\"1000Mbps\", \"downlink\":\"1000Mbps\"}}}');
INSERT INTO `SessionManagementSubscriptionData` (`ueid`, `servingPlmnid`, `singleNssai`, `dnnConfigurations`) VALUES
('001010000000004', '00101', '{\"sst\": 1, \"sd\": \"1\"}','{\"oai\":{\"pduSessionTypes\":{ \"defaultSessionType\": \"IPV4\"},\"sscModes\": {\"defaultSscMode\": \"SSC_MODE_1\"},\"5gQosProfile\": {\"5qi\": 6,\"arp\":{\"priorityLevel\": 15,\"preemptCap\": \"NOT_PREEMPT\",\"preemptVuln\":\"PREEMPTABLE\"},\"priorityLevel\":1},\"sessionAmbr\":{\"uplink\":\"1000Mbps\", \"downlink\":\"1000Mbps\"},\"staticIpAddress\":[{\"ipv4Addr\": \"12.1.1.104\"}]},\"ims\":{\"pduSessionTypes\":{ \"defaultSessionType\": \"IPV4V6\"},\"sscModes\": {\"defaultSscMode\": \"SSC_MODE_1\"},\"5gQosProfile\": {\"5qi\": 2,\"arp\":{\"priorityLevel\": 15,\"preemptCap\": \"NOT_PREEMPT\",\"preemptVuln\":\"PREEMPTABLE\"},\"priorityLevel\":1},\"sessionAmbr\":{\"uplink\":\"1000Mbps\", \"downlink\":\"1000Mbps\"}}}');

4. Testing

4.1 Start core Network

cd ~/MAC_slicing_oai_MR/doc/tutorial_resources/oai-cn5g/
docker compose up -d

Wait a few seconds. comfirm it is set up correct

cd ~/MAC_slicing_oai_MR/doc/tutorial_resources/oai-cn5g/
docker compose ps -a

Monitor AMF

docker logs oai-upf -f

4.2 Start gNB

in a new terminal

cd ~/MAC_slicing_oai_MR/cmake_targets/ran_build/build
sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band77.fr1.273PRB.2x2.usrpn300.conf --sa --usrp-tx-thread-config 1

4.3 start flexric

In a new terminal

cd ~/flexric/build/examples/ 
./ric/nearRT-RIC

4.4 Connect COST UE

Set up the UE as How-to-setup-UE,-from-SIMcard-to-the-internet

Clone this wiki locally