Commit 599f5627 authored by Raphael Defosseux's avatar Raphael Defosseux

[DOCKER] adding entrypoint to LTE-UE image

Signed-off-by: default avatarRaphael Defosseux <raphael.defosseux@eurecom.fr>
parent 875e2906
...@@ -37,6 +37,10 @@ RUN /bin/sh oaienv && \ ...@@ -37,6 +37,10 @@ RUN /bin/sh oaienv && \
mkdir -p log && \ mkdir -p log && \
./build_oai --eNB --ninja -w USRP --verbose-ci ./build_oai --eNB --ninja -w USRP --verbose-ci
RUN yum install -y python3-pip && \
pip3 install --ignore-installed pyyaml && \
python3 ./docker/scripts/generateTemplate.py ./docker/scripts/enb_parameters.yaml
# debug # debug
#RUN ldconfig -v && ldd /oai-ran/targets/bin/lte-softmodem.Rel15 #RUN ldconfig -v && ldd /oai-ran/targets/bin/lte-softmodem.Rel15
#RUN ls -ls /oai-ran/targets/bin #RUN ls -ls /oai-ran/targets/bin
...@@ -59,6 +63,7 @@ RUN yum update -y && \ ...@@ -59,6 +63,7 @@ RUN yum update -y && \
WORKDIR /opt/oai-enb/bin WORKDIR /opt/oai-enb/bin
COPY --from=enb-build /oai-ran/targets/bin/lte-softmodem.Rel15 . COPY --from=enb-build /oai-ran/targets/bin/lte-softmodem.Rel15 .
COPY --from=enb-build /oai-ran/docker/scripts/enb_entrypoint.sh entrypoint.sh
WORKDIR /usr/local/lib/ WORKDIR /usr/local/lib/
COPY --from=enb-build /oai-ran/targets/bin/liboai_eth_transpro.so.Rel15 . COPY --from=enb-build /oai-ran/targets/bin/liboai_eth_transpro.so.Rel15 .
...@@ -106,21 +111,14 @@ RUN ldconfig ...@@ -106,21 +111,14 @@ RUN ldconfig
# Copy the relevant configuration files for eNB # Copy the relevant configuration files for eNB
WORKDIR /opt/oai-enb/etc WORKDIR /opt/oai-enb/etc
COPY --from=enb-build /oai-ran/ci-scripts/conf_files/enb.* . COPY --from=enb-build /oai-ran/docker/etc .
COPY --from=enb-build /oai-ran/ci-scripts/conf_files/rcc.* .
COPY --from=enb-build /oai-ran/ci-scripts/conf_files/cu.* .
COPY --from=enb-build /oai-ran/ci-scripts/conf_files/du.* .
COPY --from=enb-build /oai-ran/ci-scripts/conf_files/rru.* .
WORKDIR /opt/oai-enb WORKDIR /opt/oai-enb
#EXPOSE 2152/udp # S1U, GTP/UDP # 2152 --> S1U, GTP/UDP
#EXPOSE 22100/tcp # ? # 36412 --> S1C, SCTP/UDP
#EXPOSE 36412/udp # S1C, SCTP/UDP # 36422 --> X2C, SCTP/UDP
#EXPOSE 36422/udp # X2C, SCTP/UDP EXPOSE 2152/udp 36412/udp 36422/udp
#EXPOSE 50000/udp # IF5 / ORI (control)
#EXPOSE 50001/udp # IF5 / ECPRI (data)
#CMD ["/opt/oai-enb/bin/lte-softmodem", "-O", "/opt/oai-enb/etc/enb.conf"] ENTRYPOINT ["/opt/oai-enb/bin/entrypoint.sh"]
#ENTRYPOINT ["/opt/oai-enb/bin/entrypoint.sh"] CMD ["/opt/oai-enb/bin/lte-softmodem.Rel15", "-O", "/opt/oai-enb/etc/enb.conf"]
CMD ["sleep", "infinity"]
...@@ -37,6 +37,10 @@ RUN /bin/sh oaienv && \ ...@@ -37,6 +37,10 @@ RUN /bin/sh oaienv && \
mkdir -p log && \ mkdir -p log && \
./build_oai --UE --ninja -w USRP --verbose-ci ./build_oai --UE --ninja -w USRP --verbose-ci
RUN yum install -y python3-pip && \
pip3 install --ignore-installed pyyaml && \
python3 ./docker/scripts/generateTemplate.py ./docker/scripts/lte_ue_parameters.yaml
# debug # debug
#RUN ldconfig -v && ldd /oai-ran/targets/bin/lte-uesoftmodem.Rel15 #RUN ldconfig -v && ldd /oai-ran/targets/bin/lte-uesoftmodem.Rel15
#RUN ls -lst /oai-ran/targets/bin #RUN ls -lst /oai-ran/targets/bin
...@@ -116,7 +120,6 @@ RUN ldconfig ...@@ -116,7 +120,6 @@ RUN ldconfig
# Copy the relevant configuration files for eNB # Copy the relevant configuration files for eNB
WORKDIR /opt/oai-lte-ue/etc WORKDIR /opt/oai-lte-ue/etc
COPY --from=lte-ue-build /oai-ran/ci-scripts/conf_files/ue.* . COPY --from=lte-ue-build /oai-ran/ci-scripts/conf_files/ue.* .
COPY --from=lte-ue-build /oai-ran/openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf ./ue_usim.conf
WORKDIR /opt/oai-lte-ue WORKDIR /opt/oai-lte-ue
#CMD ["/opt/oai-lte-ue/bin/lte-uesoftmodem", "-O", "/opt/oai-lte-ue/etc/enb.conf"] #CMD ["/opt/oai-lte-ue/bin/lte-uesoftmodem", "-O", "/opt/oai-lte-ue/etc/enb.conf"]
......
...@@ -37,6 +37,10 @@ RUN /bin/sh oaienv && \ ...@@ -37,6 +37,10 @@ RUN /bin/sh oaienv && \
mkdir -p log && \ mkdir -p log && \
./build_oai --UE --ninja -w USRP --verbose-ci ./build_oai --UE --ninja -w USRP --verbose-ci
RUN apt-get install -y python3-pip && \
pip3 install --ignore-installed pyyaml && \
python3 ./docker/scripts/generateTemplate.py ./docker/scripts/lte_ue_parameters.yaml
# debug # debug
#RUN ldconfig -v #RUN ldconfig -v
#RUN ldd /oai-ran/targets/bin/lte-uesoftmodem.Rel15 #RUN ldd /oai-ran/targets/bin/lte-uesoftmodem.Rel15
...@@ -76,6 +80,7 @@ RUN apt-get update && \ ...@@ -76,6 +80,7 @@ RUN apt-get update && \
WORKDIR /opt/oai-lte-ue/bin WORKDIR /opt/oai-lte-ue/bin
COPY --from=lte-ue-build /oai-ran/targets/bin/lte-uesoftmodem.Rel15 . COPY --from=lte-ue-build /oai-ran/targets/bin/lte-uesoftmodem.Rel15 .
COPY --from=lte-ue-build /oai-ran/docker/scripts/lte_ue_entrypoint.sh entrypoint.sh
COPY --from=lte-ue-build /oai-ran/targets/bin/conf2uedata . COPY --from=lte-ue-build /oai-ran/targets/bin/conf2uedata .
COPY --from=lte-ue-build /oai-ran/targets/bin/nvram . COPY --from=lte-ue-build /oai-ran/targets/bin/nvram .
COPY --from=lte-ue-build /oai-ran/targets/bin/usim . COPY --from=lte-ue-build /oai-ran/targets/bin/usim .
...@@ -114,12 +119,10 @@ RUN ldconfig ...@@ -114,12 +119,10 @@ RUN ldconfig
#RUN ldd /usr/local/lib/libSIMU.so #RUN ldd /usr/local/lib/libSIMU.so
#RUN ldd /usr/local/lib/libdfts.so #RUN ldd /usr/local/lib/libdfts.so
# Copy the relevant configuration files for eNB # Copy the relevant configuration files for UE
WORKDIR /opt/oai-lte-ue/etc WORKDIR /opt/oai-lte-ue/etc
COPY --from=lte-ue-build /oai-ran/ci-scripts/conf_files/ue.* ./ COPY --from=lte-ue-build /oai-ran/docker/etc .
COPY --from=lte-ue-build /oai-ran/openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf ./ue_usim.conf
WORKDIR /opt/oai-lte-ue WORKDIR /opt/oai-lte-ue
#CMD ["/opt/oai-lte-ue/bin/lte-uesoftmodem", "-O", "/opt/oai-lte-ue/etc/enb.conf"] CMD ["/opt/oai-lte-ue/bin/lte-uesoftmodem.Rel15"]
#ENTRYPOINT ["/opt/oai-lte-ue/bin/entrypoint.sh"] ENTRYPOINT ["/opt/oai-lte-ue/bin/entrypoint.sh"]
CMD ["sleep", "infinity"]
...@@ -2,17 +2,19 @@ ...@@ -2,17 +2,19 @@
set -euo pipefail set -euo pipefail
PREFIX=/opt/oai-enb
# Based another env var, pick one template to use # Based another env var, pick one template to use
if [[ -v USE_FDD_CU ]]; then ln -s /opt/oai-enb/etc/cu.fdd.conf /opt/oai-enb/etc/enb.conf; fi if [[ -v USE_FDD_CU ]]; then ln -s $PREFIX/etc/cu.fdd.conf $PREFIX/etc/enb.conf; fi
if [[ -v USE_FDD_DU ]]; then ln -s /opt/oai-enb/etc/du.fdd.conf /opt/oai-enb/etc/enb.conf; fi if [[ -v USE_FDD_DU ]]; then ln -s $PREFIX/etc/du.fdd.conf $PREFIX/etc/enb.conf; fi
if [[ -v USE_FDD_MONO ]]; then ln -s /opt/oai-enb/etc/enb.fdd.conf /opt/oai-enb/etc/enb.conf; fi if [[ -v USE_FDD_MONO ]]; then ln -s $PREFIX/etc/enb.fdd.conf $PREFIX/etc/enb.conf; fi
if [[ -v USE_TDD_MONO ]]; then ln -s /opt/oai-enb/etc/enb.tdd.conf /opt/oai-enb/etc/enb.conf; fi if [[ -v USE_TDD_MONO ]]; then ln -s $PREFIX/etc/enb.tdd.conf $PREFIX/etc/enb.conf; fi
if [[ -v USE_FDD_RCC ]]; then ln -s /opt/oai-enb/etc/rcc.if4p5.enb.fdd.conf /opt/oai-enb/etc/enb.conf; fi if [[ -v USE_FDD_FAPI_RCC ]]; then ln -s $PREFIX/etc/rcc.nfapi.fdd.conf $PREFIX/etc/enb.conf; fi
if [[ -v USE_FDD_RRU ]]; then ln -s /opt/oai-enb/etc/rru.fdd.conf /opt/oai-enb/etc/enb.conf; fi if [[ -v USE_FDD_RRU ]]; then ln -s $PREFIX/etc/rru.fdd.conf $PREFIX/etc/enb.conf; fi
if [[ -v USE_TDD_RRU ]]; then ln -s /opt/oai-enb/etc/rru.tdd.conf /opt/oai-enb/etc/enb.conf; fi if [[ -v USE_TDD_RRU ]]; then ln -s $PREFIX/etc/rru.tdd.conf $PREFIX/etc/enb.conf; fi
# Only this template will be manipulated # Only this template will be manipulated
CONFIG_FILES=`ls /opt/oai-enb/etc/enb.conf` CONFIG_FILES=`ls $PREFIX/etc/enb.conf || true`
for c in ${CONFIG_FILES}; do for c in ${CONFIG_FILES}; do
# grep variable names (format: ${VAR}) from template to be rendered # grep variable names (format: ${VAR}) from template to be rendered
......
...@@ -204,7 +204,7 @@ ...@@ -204,7 +204,7 @@
env: "@F1_CU_IP_ADDRESS@" env: "@F1_CU_IP_ADDRESS@"
- filePrefix: "rcc.band7.tm1.nfapi" - filePrefix: "rcc.band7.tm1.nfapi"
outputfilename: "rcc.if4p5.enb.fdd.conf" outputfilename: "rcc.nfapi.fdd.conf"
config: config:
- key: Active_eNBs - key: Active_eNBs
env: "@ENB_NAME@" env: "@ENB_NAME@"
......
...@@ -35,11 +35,12 @@ def main(): ...@@ -35,11 +35,12 @@ def main():
data = yaml.full_load(f) data = yaml.full_load(f)
dir = os.listdir(f'{data[0]["paths"]["source_dir"]}') dir = os.listdir(f'{data[0]["paths"]["source_dir"]}')
#identify configs, read and replace corresponding values #identify configs, read and replace corresponding values
for config in data[1]["configurations"]: for config in data[1]["configurations"]:
filePrefix = config["filePrefix"] filePrefix = config["filePrefix"]
outputfilename = config["outputfilename"] outputfilename = config["outputfilename"]
print('filePrefix = ' + filePrefix)
print('outputfilename = ' + outputfilename)
for inputfile in dir: for inputfile in dir:
if inputfile.find(filePrefix) >=0: if inputfile.find(filePrefix) >=0:
prefix_outputfile = {"cu": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}', prefix_outputfile = {"cu": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
...@@ -48,7 +49,9 @@ def main(): ...@@ -48,7 +49,9 @@ def main():
"rru.tdd": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}', "rru.tdd": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
"enb.band7.tm1.25PRB.usrpb210": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}', "enb.band7.tm1.25PRB.usrpb210": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
"enb.band40.tm1.25PRB.FairScheduler.usrpb210": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}', "enb.band40.tm1.25PRB.FairScheduler.usrpb210": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
"rcc.band7.tm1.nfapi": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}' "rcc.band7.tm1.nfapi": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
"ue.nfapi": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
"ue_sim_ci": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}'
} }
if filePrefix in prefix_outputfile: if filePrefix in prefix_outputfile:
outputfile1 = prefix_outputfile[filePrefix] outputfile1 = prefix_outputfile[filePrefix]
...@@ -61,6 +64,9 @@ def main(): ...@@ -61,6 +64,9 @@ def main():
open(outputfile1, mode='w') as outputfile: open(outputfile1, mode='w') as outputfile:
for line in inputfile: for line in inputfile:
count = 0 count = 0
if re.search(r'EHPLMN_LIST', line):
outputfile.write(line)
continue
for key in config["config"]: for key in config["config"]:
if line.find(key["key"]) >= 0: if line.find(key["key"]) >= 0:
count += 1 count += 1
......
#!/bin/bash
set -euo pipefail
PREFIX=/opt/oai-lte-ue
# Based another env var, pick one template to use
if [[ -v USE_NFAPI ]]; then ln -s $PREFIX/etc/ue.nfapi.conf $PREFIX/etc/ue.conf; fi
# Only this template will be manipulated and the USIM one!
CONFIG_FILES=`ls $PREFIX/etc/ue.conf $PREFIX/etc/ue_usim.conf || true`
for c in ${CONFIG_FILES}; do
# grep variable names (format: ${VAR}) from template to be rendered
VARS=$(grep -oP '@[a-zA-Z0-9_]+@' ${c} | sort | uniq | xargs)
# create sed expressions for substituting each occurrence of ${VAR}
# with the value of the environment variable "VAR"
EXPRESSIONS=""
for v in ${VARS}; do
NEW_VAR=`echo $v | sed -e "s#@##g"`
if [[ "${!NEW_VAR}x" == "x" ]]; then
echo "Error: Environment variable '${NEW_VAR}' is not set." \
"Config file '$(basename $c)' requires all of $VARS."
exit 1
fi
EXPRESSIONS="${EXPRESSIONS};s|${v}|${!NEW_VAR}|g"
done
EXPRESSIONS="${EXPRESSIONS#';'}"
# render template and inline replace config file
sed -i "${EXPRESSIONS}" ${c}
done
#now generate USIM files
# At this point all operations will be run from $PREFIX!
cd $PREFIX
$PREFIX/bin/conf2uedata -c $PREFIX/etc/ue_usim.conf -o $PREFIX
# Load the USRP binaries
if [[ -v USE_B2XX ]]; then
/usr/lib/uhd/utils/uhd_images_downloader.py -t b2xx
elif [[ -v USE_X3XX ]]; then
/usr/lib/uhd/utils/uhd_images_downloader.py -t x3xx
elif [[ -v USE_N3XX ]]; then
/usr/lib/uhd/utils/uhd_images_downloader.py -t n3xx
fi
# in case we have conf file, append
new_args=()
while [[ $# -gt 0 ]]; do
new_args+=("$1")
shift
done
if [[ -v USE_NFAPI ]]; then
new_args+=("-O")
new_args+=("$PREFIX/etc/ue.conf")
fi
echo "=================================="
echo "== Starting LTE UE soft modem"
if [[ -v USE_ADDITIONAL_OPTIONS ]]; then
echo "Additional option(s): ${USE_ADDITIONAL_OPTIONS}"
for word in ${USE_ADDITIONAL_OPTIONS}; do
new_args+=("$word")
done
echo "${new_args[@]}"
exec "${new_args[@]}"
else
echo "${new_args[@]}"
exec "${new_args[@]}"
fi
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
# * except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
---
- paths:
source_dir: "ci-scripts/conf_files/"
dest_dir: docker/etc
- configurations:
- filePrefix: ue.nfapi
outputfilename: "ue.nfapi.conf"
config:
- key: remote_n_address
env: "@ENB_IP_ADDRESS@"
- key: local_n_address
env: "@LTE_UE_IP_ADDRESS@"
- key: local_n_if_name
env: "@UE_NFAPI_IF_NAME@"
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
# * except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
---
- paths:
source_dir: "openair3/NAS/TOOLS/"
dest_dir: docker/etc
- configurations:
- filePrefix: ue_sim_ci
outputfilename: "ue_usim.conf"
config:
- key: MNC
env: "@MNC@"
- key: MCC
env: "@MCC@"
- key: MSIN
env: "@SHORT_IMSI@"
- key: USIM_API_K
env: "@LTE_KEY@"
- key: OPC
env: "@OPC@"
- key: MSISDN
env: "@MSISDN@"
- key: HPLMN
env: "@HPLMN@"
- key: OPLMN_LIST
env: "@HPLMN@"
# List of known PLMNS
PLMN: {
PLMN0: {
FULLNAME="OpenAirInterface";
SHORTNAME="OAICN";
MNC="96";
MCC="208";
};
};
UE0:
{
USER: {
IMEI="356113022094149";
MANUFACTURER="OAI";
MODEL="LTE SoftModem";
PIN="0000";
};
SIM: {
MSIN="0100001111";
USIM_API_K="8baf473f2f8fd09487cccbd7097c6862";
OPC="e734f8734007d6c5ce7a0508809e7e9c";
MSISDN="33611123456";
};
# Home PLMN Selector with Access Technology
HPLMN= "20896";
# User controlled PLMN Selector with Access Technology
UCPLMN_LIST = ();
# Operator PLMN List
OPLMN_LIST = ("20896");
# Operator controlled PLMN Selector with Access Technology
OCPLMN_LIST = ();
# Forbidden plmns
FPLMN_LIST = ();
# Equivalent home plmns
EHPLMN_LIST = ();
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment