Add docker files related to UERANSIM

This commit is contained in:
herlesupreeth
2020-11-16 08:02:22 +01:00
parent c2d9c42821
commit 9996ecea48
6 changed files with 188 additions and 0 deletions

48
ueransim/Dockerfile Normal file
View File

@@ -0,0 +1,48 @@
# 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:bionic
# Install updates and dependencies
RUN apt-get update && \
apt-get -y install make g++ openjdk-11-jdk maven libsctp-dev lksctp-tools git vim
ENV JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"
ENV PATH="$PATH:$JAVA_HOME/bin"
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
# Clone and build UERANSIM
RUN git clone https://github.com/herlesupreeth/UERANSIM && \
cd UERANSIM && \
chmod +x build.sh run.sh && \
./build.sh
# Set the working directory to UERANSIM
WORKDIR UERANSIM
CMD /mnt/ueransim/ueransim_init.sh && \
/UERANSIM/run.sh

40
ueransim/open5gs/gnb.yaml Normal file
View File

@@ -0,0 +1,40 @@
gnbId: 1
tac: 1
nci: '000000000000000000000000000000010000'
host: GNB_UE_IP
gtpPort: 2152
tunPort: 49972
gnbPlmn:
mcc: MCC
mnc: MNC
amfConfigs:
- guami:
mcc: MCC
mnc: MNC
amfRegionId:
hex: '2a'
amfSetId:
hex: '5580'
amfPointer:
hex: 'a8'
host: AMF_IP
port: 38412
supportedTAs:
- tac:
hex: '000001'
broadcastPlmns:
- plmn:
mcc: MCC
mnc: MNC
taiSliceSupportNssais:
- sst:
value: 1
sd:
value:
hex: '010203'
ignoreStreamIds: true

17
ueransim/open5gs/ue.yaml Normal file
View File

@@ -0,0 +1,17 @@
key: 'UE1_KI'
op: 'UE1_OP'
amf: 'UE1_AMF'
imei: 'UE1_IMEI'
supi: 'imsi-UE1_IMSI'
plmn:
mcc: MCC
mnc: MNC
smsOverNasSupported: true
dnn: 'internet'
requestedNssai:
- sst:
value: 1
sd:
hex: '010203'

49
ueransim/ueransim_init.sh Executable file
View File

@@ -0,0 +1,49 @@
#!/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)
cp /mnt/ueransim/open5gs/gnb.yaml /UERANSIM/config/open5gs
cp /mnt/ueransim/open5gs/ue.yaml /UERANSIM/config/open5gs
sed -i 's|MNC|'$MNC'|g' /UERANSIM/config/open5gs/gnb.yaml
sed -i 's|MCC|'$MCC'|g' /UERANSIM/config/open5gs/gnb.yaml
sed -i 's|MNC|'$MNC'|g' /UERANSIM/config/open5gs/ue.yaml
sed -i 's|MCC|'$MCC'|g' /UERANSIM/config/open5gs/ue.yaml
sed -i 's|UE1_KI|'$UE1_KI'|g' /UERANSIM/config/open5gs/ue.yaml
sed -i 's|UE1_OP|'$UE1_OP'|g' /UERANSIM/config/open5gs/ue.yaml
sed -i 's|UE1_AMF|'$UE1_AMF'|g' /UERANSIM/config/open5gs/ue.yaml
sed -i 's|UE1_IMEI|'$UE1_IMEI'|g' /UERANSIM/config/open5gs/ue.yaml
sed -i 's|UE1_IMSI|'$UE1_IMSI'|g' /UERANSIM/config/open5gs/ue.yaml
sed -i 's|GNB_UE_IP|'$GNB_UE_IP'|g' /UERANSIM/config/open5gs/gnb.yaml
sed -i 's|AMF_IP|'$AMF_IP'|g' /UERANSIM/config/open5gs/gnb.yaml
# Sync docker time
#ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone