Add docker files for srsRAN_Project based gNB and switch to it

This commit is contained in:
herlesupreeth
2023-06-11 17:14:17 +02:00
parent 5e5c356dd2
commit d3b27d68e4
7 changed files with 179 additions and 6 deletions

View File

@@ -34,6 +34,9 @@ docker build --no-cache --force-rm -t docker_kamailio .
cd ../srslte cd ../srslte
docker build --no-cache --force-rm -t docker_srslte . docker build --no-cache --force-rm -t docker_srslte .
cd ../srsran
docker build --no-cache --force-rm -t docker_srsran .
cd ../ueransim cd ../ueransim
docker build --no-cache --force-rm -t docker_ueransim . docker build --no-cache --force-rm -t docker_ueransim .
``` ```

View File

@@ -1,7 +1,7 @@
version: '3' version: '3'
services: services:
srsgnb: srsgnb:
image: docker_srslte image: docker_srsran
container_name: srsgnb container_name: srsgnb
stdin_open: true stdin_open: true
tty: true tty: true
@@ -11,7 +11,7 @@ services:
volumes: volumes:
- /dev/serial:/dev/serial:ro - /dev/serial:/dev/serial:ro
- /dev/bus/usb:/dev/bus/usb:ro - /dev/bus/usb:/dev/bus/usb:ro
- ./srslte:/mnt/srslte - ./srsran:/mnt/srsran
- /etc/timezone:/etc/timezone:ro - /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro - /etc/localtime:/etc/localtime:ro
env_file: env_file:
@@ -23,7 +23,7 @@ services:
- "2152/udp" - "2152/udp"
networks: networks:
default: default:
ipv4_address: ${SRS_ENB_IP} ipv4_address: ${SRS_GNB_IP}
networks: networks:
default: default:
external: external:

View File

@@ -1,13 +1,13 @@
version: '3' version: '3'
services: services:
srsgnb_zmq: srsgnb_zmq:
image: docker_srslte image: docker_srsran
container_name: srsgnb_zmq container_name: srsgnb_zmq
stdin_open: true stdin_open: true
tty: true tty: true
privileged: true privileged: true
volumes: volumes:
- ./srslte:/mnt/srslte - ./srsran:/mnt/srsran
- /etc/timezone:/etc/timezone:ro - /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro - /etc/localtime:/etc/localtime:ro
env_file: env_file:
@@ -21,7 +21,7 @@ services:
- "2001/tcp" - "2001/tcp"
networks: networks:
default: default:
ipv4_address: ${SRS_ENB_IP} ipv4_address: ${SRS_GNB_IP}
networks: networks:
default: default:
external: external:

50
srsran/Dockerfile Normal file
View File

@@ -0,0 +1,50 @@
# BSD 2-Clause License
# Copyright (c) 2020, Supreeth Herle
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
FROM ubuntu:jammy
ENV DEBIAN_FRONTEND=noninteractive
# Install updates and dependencies
RUN apt-get update && \
apt-get -y install cmake make gcc g++ pkg-config libfftw3-dev libmbedtls-dev libsctp-dev libyaml-cpp-dev libgtest-dev \
libzmq3-dev software-properties-common pkg-config net-tools iputils-ping git
# UHD drivers for USRP
RUN add-apt-repository ppa:ettusresearch/uhd && \
apt update && apt -y install libuhd-dev uhd-host && \
uhd_images_downloader
# Get srsRAN_Project, compile and install
RUN git clone https://github.com/srsran/srsRAN_Project.git && \
cd srsRAN_Project && \
mkdir build && cd build && \
cmake ../ -DENABLE_EXPORT=ON -DENABLE_ZEROMQ=ON && make -j`nproc` && make install && \
ldconfig
ENV UHD_IMAGES_DIR=/usr/share/uhd/images/
CMD cd /mnt/srsran && /mnt/srsran/srsran_init.sh

32
srsran/gnb.yml Normal file
View File

@@ -0,0 +1,32 @@
amf:
addr: AMF_IP # The address or hostname of the AMF.
bind_addr: SRS_GNB_IP # A local IP that the gNB binds to for traffic from the AMF.
ru_sdr:
device_driver: uhd # The RF driver name.
device_args: type=b200,num_recv_frames=64,num_send_frames=64 # Optionally pass arguments to the selected RF driver.
clock: external # Specify the clock source used by the RF.
sync: external # Specify the sync source used by the RF.
srate: 23.04 # RF sample rate might need to be adjusted according to selected bandwidth.
otw_format: sc12
tx_gain: 80 # Transmit gain of the RF might need to adjusted to the given situation.
rx_gain: 40 # Receive gain of the RF might need to adjusted to the given situation.
cell_cfg:
dl_arfcn: 632628 # ARFCN of the downlink carrier (center frequency).
band: 78 # The NR band.
channel_bandwidth_MHz: 20 # Bandwith in MHz. Number of PRBs will be automatically derived.
common_scs: 30 # Subcarrier spacing in kHz used for data.
plmn: "PLMN" # PLMN broadcasted by the gNB.
tac: 1 # Tracking area code (needs to match the core configuration).
pci: 1 # Physical cell ID.
log:
filename: /mnt/srsran/gnb.log # Path of the log file.
all_level: warning # Logging level applied to all layers.
pcap:
mac_enable: false # Set to true to enable MAC-layer PCAPs.
mac_filename: /mnt/srsran/gnb_mac.pcap # Path where the MAC PCAP is stored.
ngap_enable: false # Set to true to enable NGAP PCAPs.
ngap_filename: /mnt/srsran/gnb_ngap.pcap # Path where the NGAP PCAP is stored.

32
srsran/gnb_zmq.yml Normal file
View File

@@ -0,0 +1,32 @@
amf:
addr: AMF_IP # The address or hostname of the AMF.
bind_addr: SRS_GNB_IP # A local IP that the gNB binds to for traffic from the AMF.
ru_sdr:
device_driver: zmq # The RF driver name.
device_args: tx_port=tcp://SRS_GNB_IP:2000,rx_port=tcp://SRS_UE_IP:2001,base_srate=11.52e6 # Optionally pass arguments to the selected RF driver.
srate: 11.52 # RF sample rate might need to be adjusted according to selected bandwidth.
tx_gain: 75 # Transmit gain of the RF might need to adjusted to the given situation.
rx_gain: 75 # Receive gain of the RF might need to adjusted to the given situation.
cell_cfg:
dl_arfcn: 368500 # ARFCN of the downlink carrier (center frequency).
band: 3 # The NR band.
channel_bandwidth_MHz: 10 # Bandwith in MHz. Number of PRBs will be automatically derived.
common_scs: 15 # Subcarrier spacing in kHz used for data.
plmn: "PLMN" # PLMN broadcasted by the gNB.
tac: 1 # Tracking area code (needs to match the core configuration).
pci: 1 # Physical cell ID.
pdcch:
ss_type: common # Search Space type, has to be set to common
dci_format_0_1_and_1_1: false # Set correct DCI format (fallback)
log:
filename: /mnt/srsran/gnb.log # Path of the log file.
all_level: warning # Logging level applied to all layers.
pcap:
mac_enable: false # Set to true to enable MAC-layer PCAPs.
mac_filename: /mnt/srsran/gnb_mac.pcap # Path where the MAC PCAP is stored.
ngap_enable: false # Set to true to enable NGAP PCAPs.
ngap_filename: /mnt/srsran/gnb_ngap.pcap # Path where the NGAP PCAP is stored.

56
srsran/srsran_init.sh Executable file
View File

@@ -0,0 +1,56 @@
#!/bin/bash
# BSD 2-Clause License
# Copyright (c) 2020, Supreeth Herle
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
export IP_ADDR=$(awk 'END{print $1}' /etc/hosts)
mkdir -p /etc/srsran
if [[ -z "$COMPONENT_NAME" ]]; then
echo "Error: COMPONENT_NAME environment variable not set"; exit 1;
elif [[ "$COMPONENT_NAME" =~ ^(gnb$) ]]; then
echo "Configuring component: '$COMPONENT_NAME'"
cp /mnt/srsran/gnb.yml /etc/srsran/gnb.yml
elif [[ "$COMPONENT_NAME" =~ ^(gnb_zmq$) ]]; then
echo "Configuring component: '$COMPONENT_NAME'"
cp /mnt/srsran/gnb_zmq.yml /etc/srsran/gnb.yml
else
echo "Error: Invalid component name: '$COMPONENT_NAME'"
fi
sed -i 's|PLMN|'$MCC''$MNC'|g' /etc/srsran/gnb.yml
sed -i 's|AMF_IP|'$AMF_IP'|g' /etc/srsran/gnb.yml
sed -i 's|SRS_GNB_IP|'$SRS_GNB_IP'|g' /etc/srsran/gnb.yml
sed -i 's|SRS_UE_IP|'$SRS_UE_IP'|g' /etc/srsran/gnb.yml
# For dbus not started issue when host machine is running Ubuntu 22.04
service dbus start && service avahi-daemon start
gnb -c /etc/srsran/gnb.yml
# Sync docker time
#ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone