[[Include(WikiToC)]] == srsRAN 5G network in COSMOS SB1 == srsRAN is an open-source software radio suite for 4G/5G provided by SRS(Software Radio Systems). The srsRAN suite includes: srsUE - a full-stack SDR 4G/5G UE application srsENB - a full-stack SDR 4G/5G e(g)NodeB application srsEPC - a light-weight 4G core network implementation with MME, HSS and S/P-GW Source code for srsRAN can be found [https://github.com/srsran/srsRAN here] and documentation can be found [https://docs.srsran.com/en/latest/ here] === Description === This tutorial contains instructions for setting up a 4G/5G network in COSMOS SB1. === 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 === 1 COSMOS server, 1 USRP (N310/X310), node equipped with 5G modems and/or node equipped with 5G phones 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 Weeks hall 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 a server srv1-lg1, USRP N310 sdr1-s1-lg1, and sdr2-md1 that has a [https://www.waveshare.com/sim8200-m2.htm Waveshare SIM8200-EA] and Quectel RM510Q-GL attached over USB. 1. Load srsran-cosmos.ndz on srv1-lg1 {{{#!shell omf load -i srsran-cosmos.ndz -t srv1-lg1 }}} {{{#!shell omf load -i 5G-UE-cosmos.ndz -t sdr2-md1 }}} 1. Turn all the required resources on and check the status {{{#!shell omf tell -a on -t srv1-lg1,sdr2-md1,sdr1-s1-lg1 }}} {{{#!shell omf stat -t system:topo:allres }}} 1. ssh to the nodes === Tutorial Execution === ==== Check the USRP ==== * Upon logging into srv1-lg1, run the shell script eth_config.sh that sets up appropriate IP addresses for the Ethernet interfaces and network buffer sizes on the server. {{{#!shell root@srv1-lg1:~# ./eth_config.sh net.core.rmem_max = 62500000 net.core.wmem_max = 62500000 root@srv1-lg1:~# ifconfig -a eno1np0: 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 909 bytes 80670 (80.6 KB) RX errors 0 dropped 561 overruns 0 frame 0 TX packets 193 bytes 16622 (16.6 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 eno2np1: 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 827 bytes 82338 (82.3 KB) RX errors 0 dropped 562 overruns 0 frame 0 TX packets 291 bytes 23782 (23.7 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 }}} * With the interfaces configured as above, the server should be able to access the SDRs in the domain. Test with {{{#!shell root@srv1-lg1:~# uhd_find_devices --args="addr=10.38.2.1" [INFO] [UHD] linux; GNU C++ version 11.4.0; Boost_107400; UHD_4.4.0.HEAD-0-g3cf9529f -------------------------------------------------- -- UHD Device 0 -------------------------------------------------- Device Address: serial: 3176DF5 claimed: False fpga: XG mgmt_addr: 10.38.2.1 name: ni-n3xx-3176DF5 product: n310 type: n3xx }}} ==== Setup 5G Core ==== * For this tutorial, we use [https://open5gs.org/ Open5GS] Core. All the components of the core are setup to run as systemd services. To reconfigure the services, please refer this [https://open5gs.org/open5gs/docs/guide/01-quickstart/ guide]. * Follow the AMF log {{{#!shell root@srv1-lg1:~# tail -f /var/log/open5gs/amf.log }}} {{{#!shell Open5GS daemon v2.7.1 04/04 20:47:27.874: [app] INFO: Configuration: '/etc/open5gs/amf.yaml' (../lib/app/ogs-init.c:133) 04/04 20:47:27.874: [app] INFO: File Logging: '/var/log/open5gs/amf.log' (../lib/app/ogs-init.c:136) 04/04 20:47:27.877: [metrics] INFO: metrics_server() [http://127.0.0.5]:9090 (../lib/metrics/prometheus/context.c:299) 04/04 20:47:27.877: [sbi] INFO: NF Service [namf-comm] (../lib/sbi/context.c:1841) 04/04 20:47:27.877: [sbi] INFO: nghttp2_server() [http://127.0.0.5]:7777 (../lib/sbi/nghttp2-server.c:414) 04/04 20:47:27.908: [amf] INFO: ngap_server() [127.0.0.5]:38412 (../src/amf/ngap-sctp.c:61) 04/04 20:47:27.908: [sctp] INFO: AMF initialize...done (../src/amf/app.c:33) }}} ==== Run srsran gNB ==== * Run the gnb application in band n41 at 20MHz with 1T1R. {{{#!shell root@srv1-lg1:~# gnb -c ~/srsRAN_Project/configs/gnb_rf_n310_tdd_n41_20mhz.yml --== srsRAN gNB (commit 40b17b429) ==-- The PRACH detector will not meet the performance requirements with the configuration {Format B4, ZCZ 0, SCS 30kHz, Rx ports 1}. Lower PHY in quad executor mode. N2: Connection to AMF on 127.0.0.5:38412 completed Cell pci=1, bw=20 MHz, 1T1R, dl_arfcn=518670 (n41), dl_freq=2593.35 MHz, dl_ssb_arfcn=517710, ul_freq=2593.35 MHz Available radio types: uhd and zmq. [INFO] [UHD] linux; GNU C++ version 11.4.0; Boost_107400; UHD_4.4.0.HEAD-0-g3cf9529f [INFO] [LOGGING] Fastpath logging disabled at runtime. Making USRP object with args 'type=n3xx,addr=10.39.3.1,master_clock_rate=122.88e6,send_frame_size=8000,recv_frame_size=8000' [INFO] [MPMD] Initializing 1 device(s) in parallel with args: mgmt_addr=10.39.3.1,type=n3xx,product=n310,serial=3196937,name=ni-n3xx-3196937,fpga=XG,claimed=False,addr=10.39.3.1,master_clock_rate=122.88e6,send_frame_size=8000,recv_frame_size=8000 [INFO] [MPM.PeriphManager] init() called with device args `fpga=XG,master_clock_rate=122.88e6,mgmt_addr=10.39.3.1,name=ni-n3xx-3196937,product=n310,recv_frame_size=8000,send_frame_size=8000,clock_source=internal,time_source=internal'. [WARNING] [0/Radio#0] Attempting to set tick rate to 0. Skipping. ==== gNB started === Type to view help }}} * In the AMF log, you should see the gNB connected to the core {{{#!shell 04/04 21:22:32.078: [amf] INFO: gNB-N2 accepted[127.0.0.1]:52741 in ng-path module (../src/amf/ngap-sctp.c:113) 04/04 21:22:32.079: [amf] INFO: gNB-N2 accepted[127.0.0.1] in master_sm module (../src/amf/amf-sm.c:757) 04/04 21:22:32.090: [amf] INFO: [Added] Number of gNBs is now 1 (../src/amf/context.c:1236) }}} ==== UEs ==== * As the base station runs, the modems can be seen registering at the AMF {{{#!shell 04/04 21:31:17.641: [gmm] INFO: [imsi-310014000000011] Registration complete (../src/amf/gmm-sm.c:2313) 04/04 21:31:17.641: [amf] INFO: [imsi-310014000000011] Configuration update command (../src/amf/nas-path.c:591) 04/04 21:31:18.189: [gmm] INFO: [imsi-310014000000013] Registration complete (../src/amf/gmm-sm.c:2313) 04/04 21:31:18.189: [amf] INFO: [imsi-310014000000013] Configuration update command (../src/amf/nas-path.c:591) }}} * Run connection manager scripts on sdr2-md1 for the modems to establish PDU sessions {{{#!shell root@sdr2b-md1:~/SIM8200_code/Goonline# ./simcom-cm [04-04_16:14:40:249] Build Version: 2020-07-14 10:20:15 [04-04_16:14:40:249] SIMCOM_CM START... [04-04_16:14:40:249] ./simcom-cm profile[1] = (null)/(null)/(null)/0, pincode = (null) [04-04_16:14:40:249] Find /sys/bus/usb/devices/2-1 idVendor=2c7c idProduct=0800 [04-04_16:14:40:249] Cannot open directory: /sys/bus/usb/devices/2-1:1.5/net, errno: 2 (No such file or directory) [04-04_16:14:40:250] Find /sys/bus/usb/devices/2-2 idVendor=1e0e idProduct=9001 [04-04_16:14:40:250] Find /sys/bus/usb/devices/2-2:1.5/net/wwan0 [04-04_16:14:40:250] Find usbnet_adapter = wwan0 [04-04_16:14:40:250] Find /sys/bus/usb/devices/2-2:1.5/usbmisc/cdc-wdm0 [04-04_16:14:40:250] Find qmichannel = /dev/cdc-wdm0 [04-04_16:14:40:251] netcard driver = qmi_wwan [04-04_16:14:40:254] cdc_wdm_fd = 7 [04-04_16:14:40:342] Get clientWDS = 15 [04-04_16:14:40:374] Get clientDMS = 1 [04-04_16:14:40:406] Get clientNAS = 2 [04-04_16:14:40:438] Get clientUIM = 1 [04-04_16:14:40:470] Get clientWDA = 1 [04-04_16:14:40:502] requestBaseBandVersion MPSS.HI.2.0.c3-00246-SDX55_CPEALL_PACK-1 1 [Oct 26 2020 16:00:00] [04-04_16:14:40:566] requestGetSIMStatus SIMStatus: SIM_READY [04-04_16:14:40:598] requestGetProfile[1] cosmos-5G///0 [04-04_16:14:40:630] requestRegistrationState2 MCC: 310, MNC: 14, PS: Attached, DataCap: NR5G [04-04_16:14:40:662] requestQueryDataCall IPv4ConnectionStatus: DISCONNECTED [04-04_16:14:40:726] requestRegistrationState2 MCC: 310, MNC: 14, PS: Attached, DataCap: NR5G [04-04_16:14:41:238] requestSetupDataCall WdsConnectionIPv4Handle: 0xf9438980 [04-04_16:14:41:302] requestQueryDataCall IPv4ConnectionStatus: CONNECTED [04-04_16:14:41:334] ifconfig wwan0 up [04-04_16:14:41:339] Fail to access /usr/share/udhcpc/default.script, errno: 2 (No such file or directory) [04-04_16:14:41:339] busybox udhcpc -f -n -q -t 5 -s /usr/share/udhcpc/default.script -i wwan0 udhcpc: started, v1.30.1 udhcpc: sending discover udhcpc: sending select for 10.45.0.6 udhcpc: lease of 10.45.0.6 obtained, lease time 7200 }}} {{{#!shell root@sdr2b-md1:~/quectel-CM_0319# ./quectel-CM -s cosmos-5G [04-04_16:19:54:415] QConnectManager_Linux_V1.6.6_beta0319 [04-04_16:19:54:416] Find /sys/bus/usb/devices/2-1 idVendor=0x2c7c idProduct=0x800, bus=0x002, dev=0x004 [04-04_16:19:54:417] Auto find qmichannel = /dev/cdc-wdm1 [04-04_16:19:54:417] Auto find usbnet_adapter = wwan1 [04-04_16:19:54:417] netcard driver = cdc_mbim, driver version = 5.15.0-78-generic [04-04_16:19:54:417] Modem works in MBIM mode [04-04_16:19:54:421] cdc_wdm_fd = 7 [04-04_16:19:54:421] mbim_open_device() [04-04_16:19:54:935] mbim_device_caps_query() [04-04_16:19:54:967] DeviceId: 867034040030133 [04-04_16:19:54:967] FirmwareInfo: RM510QGLHAR11A03M4G [04-04_16:19:54:967] HardwareInfo: RM510QGLHA_VB [04-04_16:19:54:967] mbim_device_services_query() [04-04_16:19:55:031] mbim_set_radio_state( 1 ) [04-04_16:19:55:063] HwRadioState: 1, SwRadioState: 1 [04-04_16:19:55:063] mbim_subscriber_status_query() [04-04_16:19:55:095] SubscriberId: 310014000000011 [04-04_16:19:55:095] SimIccId: 8901310014000000114F [04-04_16:19:55:095] SubscriberReadyState NotInitialized -> Initialized [04-04_16:19:55:095] mbim_register_state_query() [04-04_16:19:55:127] RegisterState Unknown -> Home [04-04_16:19:55:127] mbim_packet_service_query() [04-04_16:19:55:159] PacketServiceState Unknown -> Attached [04-04_16:19:55:159] CurrentDataClass = Custom [04-04_16:19:55:159] mbim_query_connect(sessionID=0) [04-04_16:19:55:191] ActivationState Unknown -> Deactivated [04-04_16:19:55:191] ip addr flush dev wwan1 [04-04_16:19:55:197] ip link set dev wwan1 down [04-04_16:19:55:204] mbim_set_connect(onoff=1, sessionID=0) [04-04_16:19:55:319] ActivationState Deactivated -> Activated [04-04_16:19:55:319] mbim_ip_config(sessionID=0) [04-04_16:19:55:351] < SessionId = 0 [04-04_16:19:55:351] < IPv4ConfigurationAvailable = 0xf [04-04_16:19:55:351] < IPv6ConfigurationAvailable = 0x0 [04-04_16:19:55:351] < IPv4AddressCount = 0x1 [04-04_16:19:55:351] < IPv4AddressOffset = 0x3c [04-04_16:19:55:351] < IPv6AddressCount = 0x0 [04-04_16:19:55:351] < IPv6AddressOffset = 0x0 [04-04_16:19:55:351] < IPv4 = 10.45.0.7/28 [04-04_16:19:55:351] < gw = 10.45.0.8 [04-04_16:19:55:351] < dns1 = 8.8.8.8 [04-04_16:19:55:351] < dns2 = 8.8.4.4 [04-04_16:19:55:351] < ipv4 mtu = 1400 [04-04_16:19:55:383] ip link set dev wwan1 up [04-04_16:19:55:390] ip -4 address flush dev wwan1 [04-04_16:19:55:393] ip -4 address add 10.45.0.7/28 dev wwan1 [04-04_16:19:55:395] ip -4 route add default via 10.45.0.8 dev wwan1 }}} ==== Throughput test ==== * Make sure wwan interfaces on sdr2-md1 have the right IP addresses obtained above {{{#!shell wwan0: flags=4305 mtu 1400 inet 10.45.0.6 netmask 255.255.0.0 destination 10.45.0.6 inet6 fe80::82e2:1b17:b212:b481 prefixlen 64 scopeid 0x20 unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 1000 (UNSPEC) RX packets 244834 bytes 342703175 (342.7 MB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 28435 bytes 1521098 (1.5 MB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 wwan1: flags=4291 mtu 1500 inet 10.45.0.7 netmask 255.255.255.252 broadcast 0.0.0.0 inet6 fe80::c037:1fff:fe08:4f16 prefixlen 64 scopeid 0x20 ether c2:37:1f:08:4f:16 txqueuelen 1000 (Ethernet) RX packets 4 bytes 336 (336.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 107 bytes 8678 (8.6 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 }}} * iperf3 server {{{#!shell root@sdr2b-md1:~# iperf3 -s -B 10.45.0.6 ----------------------------------------------------------- Server listening on 5201 ----------------------------------------------------------- }}} * iperf2 client on srv1-lg1 {{{#!shell root@srv1-lg1:~# iperf3 -c 10.45.0.6 -i 1 -t 50 Connecting to host 10.45.0.6, port 5201 [ 5] local 10.45.0.1 port 40004 connected to 10.45.0.6 port 5201 [ ID] Interval Transfer Bitrate Retr Cwnd [ 5] 0.00-1.00 sec 1.30 MBytes 10.9 Mbits/sec 3 52.7 KBytes . . . [ 5] 47.00-48.00 sec 1.42 MBytes 11.9 Mbits/sec 3 36.9 KBytes [ 5] 48.00-49.00 sec 1.23 MBytes 10.4 Mbits/sec 3 44.8 KBytes [ 5] 49.00-50.00 sec 1.48 MBytes 12.4 Mbits/sec 2 47.4 KBytes - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate Retr [ 5] 0.00-50.00 sec 83.3 MBytes 14.0 Mbits/sec 179 sender [ 5] 0.00-50.04 sec 83.0 MBytes 13.9 Mbits/sec receiver }}}