[[Include(WikiToC)]] == Amarisoft 4G/5G SDR System == === Description === This tutorial contains instructions for setting up [https://www.amarisoft.com/ amarisoft] 5G NR network using SDRs(USRP N310/USRP 2974) in COSMOS SB1. Amarisoft provides software based gNB, 5GCore (eNB,EPC), and UE simulator that run on commodity off-the-shelf devices. A typical software-based cellular basestation/UE consists of a host PC and an SDR, where host PC is used for processing the baseband signals sent to and received from the SDR. Amarisoft supports various SDRs such as Amarisoft PCIe SDR50, SDR100, and USRPs such as N310, X310, 2974. In this tutorial, we run 5GCore, gNB(SA) on a host server+USRP N310 in COSMOS SB1, and the UE simulator on another host server+USRP 2974. The UE simulator can simulate one or more UEs, enabling experiments with large number of users connected to a base station. === Prerequisites === In order to access the test bed, create a reservation and have it approved by the reservation service. Access to the resources is granted after the reservation is confirmed. Please follow the process shown on the COSMOS [wiki:GettingStarted getting started] page to get started. === Resources required === 2 servers and 2 SDRs in [https://wiki.cosmos-lab.org/wiki/Architecture/Domains/cosmos_sb1 COSMOS SB1] domain === Tutorial Setup === Follow the steps below to gain access to the [wiki:/Architecture/Domains/cosmos_sb1 sandbox 1 console] and set up nodes with appropriate images. 1. If you don't have one already, sign up for a [https://www.cosmos-lab.org/portal-2/ COSMOS account] 1. [wiki:/GettingStarted#MakeaReservation Create a resource reservation] on sandbox 1 1. [wiki:/GettingStarted#LogintoyourReservation Login] into sandbox 1 console (console.sb1.cosmos-lab.org) with two SSH sessions. 1. Make sure all the resources in the domain are turned off: {{{#!shell omf tell -a offh -t system:topo:allres }}} For this tutorial we will be using the SB1 servers, srv1-lg1, srv2-lg1, USRP N310s in large and medium nodes, sdr1-s1-lg1 and sdr1-md1. 1. Load amarisoft-tutorial-cosmos.ndz on srv1-lg1,srv2-lg1. {{{#!shell omf load -i amarisoft-tutorial-cosmos.ndz -t srv1-lg1,srv2-lg1 }}} 1. Turn all the required resources on and check the status {{{#!shell omf tell -a on -t srv1-lg1,srv2-lg1,sdr1-s1-lg1,sdr1-md1 }}} {{{#!shell omf stat -t system:topo:allres }}} 1. ssh to the servers, use option -Y for using GUI. {{{#!shell ssh root@srv1-lg1 }}} {{{#!shell ssh root@srv2-lg1 }}} === Tutorial Execution === [[CollapsibleStart(Check the USRPs)]] * Upon logging into the nodes, run eth_config.sh script on both the nodes. This sets up the 10G data interfaces DATA1, DATA2. After running the script, you should see that the data interfaces have the appropriate IP addresses assigned, as per this [https://wiki.cosmos-lab.org/wiki/Architecture/Domains/cosmos_sb1#IPAddressAssignment table]. The nodes should then be able to access the SDRs which can be checked by running uhd_find_devices. {{{#!td {{{#!shell root@srv1-lg1:~# ./eth_config.sh }}} {{{#!shell root@srv1-lg1:~# ifconfig DATA1 DATA1: flags=4163 mtu 9000 inet 10.38.1.1 netmask 255.255.0.0 broadcast 10.38.255.255 inet6 fe80::1e34:daff:fe42:c3c prefixlen 64 scopeid 0x20 ether 1c:34:da:42:0c:3c txqueuelen 1000 (Ethernet) RX packets 61195963 bytes 199994153268 (199.9 GB) RX errors 0 dropped 6680 overruns 0 frame 0 TX packets 58734853 bytes 190912589303 (190.9 GB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 root@srv1-lg1:~# ifconfig DATA2 DATA2: flags=4163 mtu 9000 inet 10.39.1.1 netmask 255.255.0.0 broadcast 10.39.255.255 inet6 fe80::1e34:daff:fe42:c3d prefixlen 64 scopeid 0x20 ether 1c:34:da:42:0c:3d txqueuelen 1000 (Ethernet) RX packets 7378 bytes 651944 (651.9 KB) RX errors 0 dropped 6682 overruns 0 frame 0 TX packets 282 bytes 82239 (82.2 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 }}} }}} {{{#!td {{{#!shell root@srv1-lg1:~# uhd_find_devices [INFO] [UHD] linux; GNU C++ version 7.5.0; Boost_106501; UHD_3.15.0.0-release -------------------------------------------------- -- UHD Device 0 -------------------------------------------------- Device Address: serial: 3176DF5 addr: 10.38.2.1 claimed: False mgmt_addr: 10.37.2.1 mgmt_addr: 10.38.2.1 mgmt_addr: 10.39.2.1 product: n310 type: n3xx -------------------------------------------------- -- UHD Device 1 -------------------------------------------------- Device Address: serial: 3196937 addr: 10.38.3.1 claimed: False mgmt_addr: 10.37.3.1 mgmt_addr: 10.38.3.1 mgmt_addr: 10.39.3.1 product: n310 type: n3xx }}} }}} [[CollapsibleEnd]] [[CollapsibleStart(Run MME)]] * We are going to run the MME, gNodeB on srv1-lg1 and the UE simulator on srv2-lg1. * Run the Amarisoft MME on srv1-lg1. Run lte_init.sh to setup IP forwarding so that the UEs can connect to the Internet, once they establish a connection with the base station. This network uses PLMN 310014 (USA Test network) as configured in mme.cfg. {{{#!shell root@srv1-lg1:/opt/amarisoft/ltemme-linux-2022-09-16# ./lte_init.sh Select CTRL default interface Configure NAT for CTRL net.ipv4.tcp_congestion_control = bbr net.core.rmem_max = 62500000 net.core.wmem_max = 62500000 root@srv1-lg1:/opt/amarisoft/ltemme-linux-2022-09-16# ./ltemme config/mme.cfg Core version 2022-09-16, Copyright (C) 2012-2022 Amarisoft This software is licensed to Rutgers University (The State University of New Jersey). License server: license.orbit-lab.org (0b-b4-46-dc-2f-83-58-cb) Support and software update available until 2023-08-18. (mme) }}} * Type 'help' at the prompt to explore the available mme commands. [[CollapsibleEnd]] [[CollapsibleStart(Run eNodeB/gNodeB)]] * Run Amarisoft 5G NR Stand alone gNodeB as shown below by passing the gNodeB configuration file as an argument. The configuration file defines SDR(USRP N310) address, operating band, bandwidth and other parameters. To run 4G LTE eNodeB, please use enb-n310.cfg {{{#!shell root@srv1-lg1:~# cd /opt/amarisoft/lteenb-linux-2022-09-16 root@srv1-lg1:/opt/amarisoft/lteenb-linux-2022-09-16# ./lteenb config/gnb-sa-n310.cfg Base Station version 2022-09-16, Copyright (C) 2012-2022 Amarisoft This software is licensed to Rutgers University (The State University of New Jersey). License server: license.orbit-lab.org (0b-b4-46-dc-2f-83-58-cb) Support and software update available until 2023-08-18. [INFO] [UHD] linux; GNU C++ version 7.5.0; Boost_106501; UHD_3.15.0.0-release [INFO] [MPMD] Initializing 1 device(s) in parallel with args: mgmt_addr=10.38.2.1,type=n3xx,product=n310,serial=3176DF5,claimed=False,addr=10.38.2.1,master_clock_rate=122.88e6 [INFO] [MPM.PeriphManager] init() called with device args `master_clock_rate=122.88e6,mgmt_addr=10.38.2.1,product=n310,time_source=internal,clock_source=internal'. [INFO] [0/Replay_0] Initializing block control (NOC ID: 0x4E91A00000000004) [INFO] [0/Radio_0] Initializing block control (NOC ID: 0x12AD100000011312) [INFO] [0/Radio_1] Initializing block control (NOC ID: 0x12AD100000011312) [INFO] [0/DDC_0] Initializing block control (NOC ID: 0xDDC0000000000000) [INFO] [0/DDC_1] Initializing block control (NOC ID: 0xDDC0000000000000) [INFO] [0/DUC_0] Initializing block control (NOC ID: 0xD0C0000000000002) [INFO] [0/DUC_1] Initializing block control (NOC ID: 0xD0C0000000000002) [INFO] [0/FIFO_0] Initializing block control (NOC ID: 0xF1F0000000000000) [INFO] [0/FIFO_1] Initializing block control (NOC ID: 0xF1F0000000000000) [INFO] [0/FIFO_2] Initializing block control (NOC ID: 0xF1F0000000000000) [INFO] [0/FIFO_3] Initializing block control (NOC ID: 0xF1F0000000000000) RF0: sample_rate=30.720 MHz dl_freq=2589.420 MHz ul_freq=2589.420 MHz (band n41) dl_ant=2 ul_ant=1 (enb) WARNING: The GPS is not locked. If you need time synchronization, you should restart the program when the GPS is locked. Chan Gain(dB) Freq(MHz) TX1 45.0 2589.420000 TX2 45.0 2589.420000 RX1 50.0 2589.420000 (enb) ng gNB NG connection state: - server=127.0.1.100:38412 state=setup_done PLMN=310014 (enb) cell phy [gnb0012345] PLMN=310014 gNB_ID=0x12345 --------Global-------- -----------DL---------- -----------UL---------- -----SSB--- Cell RAT BAND BW P ARFCN ANT NL SCS QAM ARCFN ANT NL SCS QAM ARFCN SCS 0x001 NR n41 20 0 517884 2 2 30 256 517884 1 1 30 256 517710 30 (enb) }}} * Type 'help' at the prompt and use commands like 'cell phy' to look at the various parameters of the base station. [[CollapsibleEnd]] [[CollapsibleStart(Run Amarisoft UE Simulator)]] * Run the Amarisoft UE simulator on srv2-lg1 by passing the configuration file ue-nr-sa-n310.cfg as an argument. To run UE simulator in 4G LTE mode, please use ue-n310.cfg. {{{#!shell root@srv2-lg1:~# cd /opt/amarisoft/lteue-linux-2022-09-16/ root@srv2-lg1:/opt/amarisoft/lteue-linux-2022-09-16# ./lteue config/ue-nr-sa-n310.cfg LTE UE version 2022-09-16, Copyright (C) 2012-2022 Amarisoft This software is licensed to Rutgers University (The State University of New Jersey). License server: license.orbit-lab.org (0b-b4-46-dc-2f-83-58-cb) Support and software update available until 2023-08-18. [INFO] [UHD] linux; GNU C++ version 7.5.0; Boost_106501; UHD_3.15.0.0-release [INFO] [MPMD] Initializing 1 device(s) in parallel with args: mgmt_addr=10.38.3.1,type=n3xx,product=n310,serial=3196937,claimed=False,addr=10.38.3.1,master_clock_rate=122.88e6 [INFO] [MPM.PeriphManager] init() called with device args `clock_source=internal,master_clock_rate=122.88e6,time_source=internal,product=n310,mgmt_addr=10.38.3.1'. [INFO] [0/Replay_0] Initializing block control (NOC ID: 0x4E91A00000000004) [INFO] [0/Radio_0] Initializing block control (NOC ID: 0x12AD100000011312) [INFO] [0/Radio_1] Initializing block control (NOC ID: 0x12AD100000011312) [INFO] [0/DDC_0] Initializing block control (NOC ID: 0xDDC0000000000000) [INFO] [0/DDC_1] Initializing block control (NOC ID: 0xDDC0000000000000) [INFO] [0/DUC_0] Initializing block control (NOC ID: 0xD0C0000000000002) [INFO] [0/DUC_1] Initializing block control (NOC ID: 0xD0C0000000000002) [INFO] [0/FIFO_0] Initializing block control (NOC ID: 0xF1F0000000000000) [INFO] [0/FIFO_1] Initializing block control (NOC ID: 0xF1F0000000000000) [INFO] [0/FIFO_2] Initializing block control (NOC ID: 0xF1F0000000000000) [INFO] [0/FIFO_3] Initializing block control (NOC ID: 0xF1F0000000000000) RF0: sample_rate=30.720 MHz dl_freq=2589.420 MHz ul_freq=2589.420 MHz (band n41) dl_ant=2 ul_ant=1 (ue) WARNING: The GPS is not locked. If you need time synchronization, you should restart the program when the GPS is locked. Chan Gain(dB) Freq(MHz) TX1 45.0 2589.420000 RX1 50.0 2589.420000 RX2 50.0 2589.420000 Cell 0: SIB found (ue) ue # UE_ID CL RNTI RRC_STATE EMM_STATE #ERAB IP_ADDR 5G 0 1 0 0 offline power off 0 5G 1 2 0 0 offline power off 0 5G 2 3 0 0 offline power off 0 5G 3 4 0 0 offline power off 0 5G 4 5 0 0 offline power off 0 (ue) power_on 1 2 3 (ue) ue # UE_ID CL RNTI RRC_STATE EMM_STATE #ERAB IP_ADDR 5G 0 1 0 4608 running registered 1 192.168.2.6 5G 1 2 0 460a running registered 1 192.168.2.2 5G 2 3 0 4609 running registered 1 192.168.2.10 5G 3 4 0 0 offline power off 0 5G 4 5 0 0 offline power off 0 (ue) }}} * Type 'ue' at the prompt to see the status of the UEs and type 'power_on' to start a UE. The above simulation shows 5 UEs, and the number of UEs is specified as UE_COUNT in the configuration file. * Go back to 'mme' prompt in srv1-lg1 and check the gnb, ue list. {{{#!shell (mme) gnb PLMN RAN_ID IP:Port #UEctx TACs 310014 0x12345 127.0.1.1:43436 0 0x64 (mme) ue SUPI IMEISV CN M-TMSI/5G-TMSI REG TAC #BEARER IP_ADDR 001010123456789 8646780506839210 5GC 0x1af5c9e9 Y 310014. 0x64 0 001010123456790 0123456700000201 5GC 0x46f7250d Y 310014. 0x64 1 192.168.2.2 001010123456789 0123456700000101 5GC 0xde3218e2 Y 310014. 0x64 1 192.168.2.6 001010123456791 0123456700000301 5GC 0x801c89e1 Y 310014. 0x64 1 192.168.2.10 (mme) }}} * The base station (srv1-lg1) can now talk to the UEs via the IP addresses assigned above. [[CollapsibleEnd]] [[CollapsibleStart(Iperf test)]] * Network name space and tunnels for each UE. {{{#!shell root@srv2-lg1:~# ip netns list ue1 (id: 4) ue2 (id: 3) ue4 (id: 2) ue5 (id: 1) ue3 (id: 0) root@srv2-lg1:~# ip netns exec ue1 ip addr 1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 10: pdn0: mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 500 link/none inet 192.168.2.18/24 scope global pdn0 valid_lft forever preferred_lft forever root@srv2-lg1:~# ip netns exec ue1 ping 192.168.2.1 PING 192.168.2.1 (192.168.2.1) 56(84) bytes of data. 64 bytes from 192.168.2.1: icmp_seq=1 ttl=64 time=104 ms 64 bytes from 192.168.2.1: icmp_seq=2 ttl=64 time=41.9 ms 64 bytes from 192.168.2.1: icmp_seq=3 ttl=64 time=33.9 ms 64 bytes from 192.168.2.1: icmp_seq=4 ttl=64 time=40.6 ms 64 bytes from 192.168.2.1: icmp_seq=5 ttl=64 time=42.9 ms 64 bytes from 192.168.2.1: icmp_seq=6 ttl=64 time=40.9 ms 64 bytes from 192.168.2.1: icmp_seq=7 ttl=64 time=32.9 ms 64 bytes from 192.168.2.1: icmp_seq=8 ttl=64 time=30.8 ms 64 bytes from 192.168.2.1: icmp_seq=9 ttl=64 time=28.8 ms 64 bytes from 192.168.2.1: icmp_seq=10 ttl=64 time=26.8 ms ^C --- 192.168.2.1 ping statistics --- 10 packets transmitted, 10 received, 0% packet loss, time 9015ms rtt min/avg/max/mdev = 26.891/42.475/104.831/21.496 ms }}} * Iperf server on the UE {{{#!shell root@srv2-lg1:~# ip netns exec ue1 iperf3 -s -B 192.168.2.18 ----------------------------------------------------------- Server listening on 5201 ----------------------------------------------------------- }}} * Iperf client on the base station {{{#!shell root@srv1-lg1:~# iperf3 -c 192.168.2.18 -b 0 -i 1 Connecting to host 192.168.2.18, port 5201 [ 4] local 192.168.2.1 port 50836 connected to 192.168.2.18 port 5201 [ ID] Interval Transfer Bandwidth Retr Cwnd [ 4] 0.00-1.00 sec 7.31 MBytes 61.3 Mbits/sec 0 925 KBytes [ 4] 1.00-2.00 sec 6.09 MBytes 51.1 Mbits/sec 0 1004 KBytes [ 4] 2.00-3.00 sec 5.78 MBytes 48.5 Mbits/sec 0 916 KBytes [ 4] 3.00-4.00 sec 6.09 MBytes 51.1 Mbits/sec 0 829 KBytes [ 4] 4.00-5.00 sec 5.78 MBytes 48.5 Mbits/sec 0 687 KBytes [ 4] 5.00-6.00 sec 5.65 MBytes 47.4 Mbits/sec 0 648 KBytes [ 4] 6.00-7.00 sec 6.15 MBytes 51.6 Mbits/sec 0 679 KBytes [ 4] 7.00-8.00 sec 6.09 MBytes 51.1 Mbits/sec 0 707 KBytes [ 4] 8.00-9.00 sec 6.03 MBytes 50.6 Mbits/sec 0 1.02 MBytes [ 4] 9.00-10.00 sec 6.34 MBytes 53.2 Mbits/sec 0 950 KBytes - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bandwidth Retr [ 4] 0.00-10.00 sec 61.3 MBytes 51.4 Mbits/sec 0 sender [ 4] 0.00-10.00 sec 57.8 MBytes 48.5 Mbits/sec receiver iperf Done. }}} [[CollapsibleEnd]] [[CollapsibleStart(Using the Web Interface)]] * Amarisoft Web Interface can be used to analyse software logs and get information in real time. It can also be used to execute UE scenarios. * Point your web browser to http://10.37.1.1/lte/ (10.37.1.1 is the CTRL IP address of srv1-lg1, where the MME and gNodeB are running) * Click 'server' in the left client panel, and add MME, gNodeB, UE to look at the logs. Use the appropriate IP addresses and ports as shown below {{{#!td [[Image(web_client_creation.png, width=500px)]] }}} {{{#!td ||= Server =||= IP addr =||= Port =|| || MME || 10.37.1.1 || 9000 || || gNodeB || 10.37.1.1 || 9001 || || UE || 10.37.1.2 || 9002 || }}} [[Image(amarisoft_web_interface.png, width=1000px)]] [[CollapsibleEnd]]