Commit fd4c9227 authored by Robert Schmidt's avatar Robert Schmidt

Entry point scripts: do not generate configuration files

parent dd532554
......@@ -3,59 +3,24 @@
set -uo pipefail
PREFIX=/opt/oai-enb
RRC_INACTIVITY_THRESHOLD=${RRC_INACTIVITY_THRESHOLD:-0}
ENABLE_MEASUREMENT_REPORTS=${ENABLE_MEASUREMENT_REPORTS:-no}
ENABLE_X2=${ENABLE_X2:-no}
THREAD_PARALLEL_CONFIG=${THREAD_PARALLEL_CONFIG:-PARALLEL_SINGLE_THREAD}
CONFIGFILE=$PREFIX/etc/enb.conf
# Based another env var, pick one template to use
if [[ -v USE_FDD_CU ]]; then cp $PREFIX/etc/cu.fdd.conf $PREFIX/etc/enb.conf; fi
if [[ -v USE_FDD_DU ]]; then cp $PREFIX/etc/du.fdd.conf $PREFIX/etc/enb.conf; fi
if [[ -v USE_FDD_MONO ]]; then cp $PREFIX/etc/enb.fdd.conf $PREFIX/etc/enb.conf; fi
if [[ -v USE_TDD_MONO ]]; then cp $PREFIX/etc/enb.tdd.conf $PREFIX/etc/enb.conf; fi
if [[ -v USE_FDD_FAPI_RCC ]]; then cp $PREFIX/etc/rcc.nfapi.fdd.conf $PREFIX/etc/enb.conf; fi
if [[ -v USE_FDD_IF4P5_RCC ]]; then cp $PREFIX/etc/rcc.if4p5.fdd.conf $PREFIX/etc/enb.conf; fi
if [[ -v USE_TDD_IF4P5_RCC ]]; then cp $PREFIX/etc/rcc.if4p5.tdd.conf $PREFIX/etc/enb.conf; fi
if [[ -v USE_FDD_RRU ]]; then cp $PREFIX/etc/rru.fdd.conf $PREFIX/etc/enb.conf; fi
if [[ -v USE_TDD_RRU ]]; then cp $PREFIX/etc/rru.tdd.conf $PREFIX/etc/enb.conf; fi
if [[ -v USE_NFAPI_VNF ]]; then cp $PREFIX/etc/enb.nfapi.vnf.conf $PREFIX/etc/enb.conf; fi
# Sometimes, the templates are not enough. We mount a conf file on $PREFIX/etc. It can be a template itself.
if [[ -v USE_VOLUMED_CONF ]]; then cp $PREFIX/etc/mounted.conf $PREFIX/etc/enb.conf; fi
# Only this template will be manipulated
CONFIG_FILES=`ls $PREFIX/etc/enb.conf || true`
for c in ${CONFIG_FILES}; do
# Sometimes templates have no pattern to be replaced.
if ! grep -oP '@[a-zA-Z0-9_]+@' ${c}; then
echo "Configuration is already set"
break
fi
# 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."
if [[ -v USE_VOLUMED_CONF ]]; then
cp $PREFIX/etc/mounted.conf $PREFIX/etc/enb.conf
else
echo "ERROR: No configuration file provided."
echo "Please set USE_VOLUMED_CONF and mount a configuration file at $PREFIX/etc/mounted.conf"
exit 1
fi
EXPRESSIONS="${EXPRESSIONS};s|${v}|${!NEW_VAR}|g"
done
EXPRESSIONS="${EXPRESSIONS#';'}"
fi
# render template and inline replace config file
sed -i "${EXPRESSIONS}" ${c}
if [ ! -f $CONFIGFILE ]; then
echo "No configuration file found: please mount at $CONFIGFILE"
exit 255
fi
echo "=================================="
echo "== Configuration file: ${c}"
cat ${c}
done
echo "=================================="
echo "== Configuration file:"
cat $CONFIGFILE
# Load the USRP binaries
echo "=================================="
......
#/*
# * 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: cu.band7.tm1.25PRB
outputfilename: "cu.fdd.conf"
config:
- key: Active_eNBs
env: "@ENB_NAME@"
- key: eNB_name
env: "@ENB_NAME@"
- key: mcc
env: "@MCC@"
- key: mnc
env: "@MNC@"
- key: mnc_length
env: "@MNC_LENGTH@"
- key: tracking_area_code
env: "@TAC@"
- key: local_s_if_name
env: "@F1_IF_NAME@"
- key: remote_s_address
env: "@F1_DU_IP_ADDRESS@"
- key: local_s_address
env: "@F1_CU_IP_ADDRESS@"
- key: eutra_band
env: "@UTRA_BAND_ID@"
- key: downlink_frequency
env: "@DL_FREQUENCY_IN_MHZ@000000"
- key: uplink_frequency_offset
env: "@UL_FREQUENCY_OFFSET_IN_MHZ@000000"
- key: Nid_cell
env: "@NID_CELL@"
- key: N_RB_DL
env: "@NB_PRB@"
- key: ipv4
env: "@MME_S1C_IP_ADDRESS@"
- key: ENB_INTERFACE_NAME_FOR_S1_MME
env: "@S1C_IF_NAME@"
- key: ENB_IPV4_ADDRESS_FOR_S1_MME
env: "@F1_CU_IP_ADDRESS@"
- key: ENB_INTERFACE_NAME_FOR_S1U
env: "@S1U_IF_NAME@"
- key: ENB_IPV4_ADDRESS_FOR_S1U
env: "@F1_CU_IP_ADDRESS@"
- key: ENB_IPV4_ADDRESS_FOR_X2C
env: "@F1_CU_IP_ADDRESS@"
- filePrefix: du.band7.tm1.25PRB
outputfilename: "du.fdd.conf"
config:
- key: Active_eNBs
env: "@ENB_NAME@"
- key: eNB_name
env: "@ENB_NAME@"
- key: mcc
env: "@MCC@"
- key: mnc
env: "@MNC@"
- key: mnc_length
env: "@MNC_LENGTH@"
- key: tracking_area_code
env: "@TAC@"
- key: local_n_if_name
env: "@F1_IF_NAME@"
- key: remote_n_address
env: "@F1_DU_IP_ADDRESS@"
- key: local_n_address
env: "@F1_CU_IP_ADDRESS@"
- key: eutra_band
env: "@UTRA_BAND_ID@"
- key: downlink_frequency
env: "@DL_FREQUENCY_IN_MHZ@000000"
- key: uplink_frequency_offset
env: "@UL_FREQUENCY_OFFSET_IN_MHZ@000000"
- key: Nid_cell
env: "@NID_CELL@"
- key: N_RB_DL
env: "@NB_PRB@"
- key: parallel_config
env: "@THREAD_PARALLEL_CONFIG@"
- filePrefix: rru.fdd
outputfilename: "rru.fdd.conf"
config:
- key: local_if_name
env: "@RRU_IF4P5_IF_NAME@"
- key: remote_address
env: "@RCC_REMOTE_IP_ADDRESS@"
- key: local_address
env: "@RRU_LOCAL_IP_ADDRESS@"
- key: bands
env: "@UTRA_BAND_ID@"
- key: parallel_config
env: "@THREAD_PARALLEL_CONFIG@"
- filePrefix: rru.tdd
outputfilename: "rru.tdd.conf"
config:
- key: local_if_name
env: "@RRU_IF4P5_IF_NAME@"
- key: remote_address
env: "@RCC_REMOTE_IP_ADDRESS@"
- key: local_address
env: "@RRU_LOCAL_IP_ADDRESS@"
- key: bands
env: "@UTRA_BAND_ID@"
- key: parallel_config
env: "@THREAD_PARALLEL_CONFIG@"
- filePrefix: enb.band7.tm1.fr1.25PRB.usrpb210.conf
outputfilename: "enb.fdd.conf"
config:
- key: Active_eNBs
env: "@ENB_NAME@"
- key: eNB_name
env: "@ENB_NAME@"
- key: mcc
env: "@MCC@"
- key: mnc
env: "@MNC@"
- key: mnc_length
env: "@MNC_LENGTH@"
- key: tracking_area_code
env: "@TAC@"
- key: eutra_band
env: "@UTRA_BAND_ID@"
- key: downlink_frequency
env: "@DL_FREQUENCY_IN_MHZ@000000"
- key: uplink_frequency_offset
env: "@UL_FREQUENCY_OFFSET_IN_MHZ@000000"
- key: Nid_cell
env: "@NID_CELL@"
- key: N_RB_DL
env: "@NB_PRB@"
- key: enable_measurement_reports
env: "@ENABLE_MEASUREMENT_REPORTS@"
- key: enable_x2
env: "@ENABLE_X2@"
- key: ipv4
env: "@MME_S1C_IP_ADDRESS@"
- key: ENB_INTERFACE_NAME_FOR_S1_MME
env: "@ENB_S1C_IF_NAME@"
- key: ENB_IPV4_ADDRESS_FOR_S1_MME
env: "@ENB_S1C_IP_ADDRESS@"
- key: ENB_INTERFACE_NAME_FOR_S1U
env: "@ENB_S1U_IF_NAME@"
- key: ENB_IPV4_ADDRESS_FOR_S1U
env: "@ENB_S1U_IP_ADDRESS@"
- key: ENB_IPV4_ADDRESS_FOR_X2C
env: "@ENB_X2_IP_ADDRESS@"
- key: rrc_inactivity_threshold
env: "@RRC_INACTIVITY_THRESHOLD@"
- key: parallel_config
env: "@THREAD_PARALLEL_CONFIG@"
- filePrefix: enb.band40.tm1.25PRB.FairScheduler.usrpb210
outputfilename: "enb.tdd.conf"
config:
- key: Active_eNBs
env: "@ENB_NAME@"
- key: eNB_name
env: "@ENB_NAME@"
- key: mcc
env: "@MCC@"
- key: mnc
env: "@MNC@"
- key: mnc_length
env: "@MNC_LENGTH@"
- key: tracking_area_code
env: "@TAC@"
- key: eutra_band
env: "@UTRA_BAND_ID@"
- key: downlink_frequency
env: "@DL_FREQUENCY_IN_MHZ@000000"
- key: uplink_frequency_offset
env: "@UL_FREQUENCY_OFFSET_IN_MHZ@000000"
- key: Nid_cell
env: "@NID_CELL@"
- key: N_RB_DL
env: "@NB_PRB@"
- key: ipv4
env: "@MME_S1C_IP_ADDRESS@"
- key: ENB_INTERFACE_NAME_FOR_S1_MME
env: "@S1C_IF_NAME@"
- key: ENB_IPV4_ADDRESS_FOR_S1_MME
env: "@F1_CU_IP_ADDRESS@"
- key: ENB_INTERFACE_NAME_FOR_S1U
env: "@S1U_IF_NAME@"
- key: ENB_IPV4_ADDRESS_FOR_S1U
env: "@F1_CU_IP_ADDRESS@"
- key: ENB_IPV4_ADDRESS_FOR_X2C
env: "@F1_CU_IP_ADDRESS@"
- key: parallel_config
env: "@THREAD_PARALLEL_CONFIG@"
- filePrefix: "rcc.band7.tm1.nfapi"
outputfilename: "rcc.nfapi.fdd.conf"
config:
- key: Active_eNBs
env: "@ENB_NAME@"
- key: eNB_name
env: "@ENB_NAME@"
- key: mcc
env: "@MCC@"
- key: mnc
env: "@MNC@"
- key: mnc_length
env: "@MNC_LENGTH@"
- key: tracking_area_code
env: "@TAC@"
- key: local_s_if_name
env: "@F1_IF_NAME@"
- key: remote_s_address
env: "@F1_DU_IP_ADDRESS@"
- key: local_s_address
env: "@F1_CU_IP_ADDRESS@"
- key: eutra_band
env: "@UTRA_BAND_ID@"
- key: downlink_frequency
env: "@DL_FREQUENCY_IN_MHZ@000000"
- key: uplink_frequency_offset
env: "@UL_FREQUENCY_OFFSET_IN_MHZ@000000"
- key: Nid_cell
env: "@NID_CELL@"
- key: N_RB_DL
env: "@NB_PRB@"
- key: ipv4
env: "@MME_S1C_IP_ADDRESS@"
- key: ENB_INTERFACE_NAME_FOR_S1_MME
env: "@S1C_IF_NAME@"
- key: ENB_IPV4_ADDRESS_FOR_S1_MME
env: "@F1_CU_IP_ADDRESS@"
- key: ENB_INTERFACE_NAME_FOR_S1U
env: "@S1U_IF_NAME@"
- key: ENB_IPV4_ADDRESS_FOR_S1U
env: "@F1_CU_IP_ADDRESS@"
- key: ENB_IPV4_ADDRESS_FOR_X2C
env: "@F1_CU_IP_ADDRESS@"
- key: parallel_config
env: "@THREAD_PARALLEL_CONFIG@"
- filePrefix: "rcc.band7.tm1.if4p5.lo.25PRB"
outputfilename: "rcc.if4p5.fdd.conf"
config:
- key: Active_eNBs
env: "@ENB_NAME@"
- key: eNB_name
env: "@ENB_NAME@"
- key: mcc
env: "@MCC@"
- key: mnc
env: "@MNC@"
- key: mnc_length
env: "@MNC_LENGTH@"
- key: tracking_area_code
env: "@TAC@"
- key: eutra_band
env: "@UTRA_BAND_ID@"
- key: downlink_frequency
env: "@DL_FREQUENCY_IN_MHZ@000000"
- key: uplink_frequency_offset
env: "@UL_FREQUENCY_OFFSET_IN_MHZ@000000"
- key: Nid_cell
env: "@NID_CELL@"
- key: N_RB_DL
env: "@NB_PRB@"
- key: ipv4
env: "@MME_S1C_IP_ADDRESS@"
- key: ENB_INTERFACE_NAME_FOR_S1_MME
env: "@RCC_IF_NAME@"
- key: ENB_IPV4_ADDRESS_FOR_S1_MME
env: "@RCC_S1C_IP_ADDRESS@"
- key: ENB_INTERFACE_NAME_FOR_S1U
env: "@RCC_IF_NAME@"
- key: ENB_IPV4_ADDRESS_FOR_S1U
env: "@RCC_IP_ADDRESS@"
- key: ENB_IPV4_ADDRESS_FOR_X2C
env: "@RCC_IP_ADDRESS@"
- key: local_if_name
env: "@IF4P5_IF_NAME@"
- key: remote_address
env: "@IF4P5_RRU_IP_ADDRESS@"
- key: local_address
env: "@IF4P5_RCC_IP_ADDRESS@"
- key: parallel_config
env: "@THREAD_PARALLEL_CONFIG@"
- filePrefix: "rcc.band40.tm1.25PRB"
outputfilename: "rcc.if4p5.tdd.conf"
config:
- key: Active_eNBs
env: "@ENB_NAME@"
- key: eNB_name
env: "@ENB_NAME@"
- key: mcc
env: "@MCC@"
- key: mnc
env: "@MNC@"
- key: mnc_length
env: "@MNC_LENGTH@"
- key: tracking_area_code
env: "@TAC@"
- key: eutra_band
env: "@UTRA_BAND_ID@"
- key: downlink_frequency
env: "@DL_FREQUENCY_IN_MHZ@000000"
- key: uplink_frequency_offset
env: "@UL_FREQUENCY_OFFSET_IN_MHZ@000000"
- key: Nid_cell
env: "@NID_CELL@"
- key: N_RB_DL
env: "@NB_PRB@"
- key: ipv4
env: "@MME_S1C_IP_ADDRESS@"
- key: ENB_INTERFACE_NAME_FOR_S1_MME
env: "@RCC_IF_NAME@"
- key: ENB_IPV4_ADDRESS_FOR_S1_MME
env: "@RCC_S1C_IP_ADDRESS@"
- key: ENB_INTERFACE_NAME_FOR_S1U
env: "@RCC_IF_NAME@"
- key: ENB_IPV4_ADDRESS_FOR_S1U
env: "@RCC_IP_ADDRESS@"
- key: ENB_IPV4_ADDRESS_FOR_X2C
env: "@RCC_IP_ADDRESS@"
- key: local_if_name
env: "@IF4P5_IF_NAME@"
- key: remote_address
env: "@IF4P5_RRU_IP_ADDRESS@"
- key: local_address
env: "@IF4P5_RCC_IP_ADDRESS@"
- key: parallel_config
env: "@THREAD_PARALLEL_CONFIG@"
- filePrefix: "proxy_rcc.band7.tm1.nfapi.conf"
outputfilename: "enb.nfapi.vnf.conf"
config:
- key: Active_eNBs
env: "@ENB_NAME@"
- key: eNB_name
env: "@ENB_NAME@"
- key: mcc
env: "@MCC@"
- key: mnc
env: "@MNC@"
- key: mnc_length
env: "@MNC_LENGTH@"
- key: tracking_area_code
env: "@TAC@"
- key: eutra_band
env: "@UTRA_BAND_ID@"
- key: downlink_frequency
env: "@DL_FREQUENCY_IN_MHZ@000000"
- key: uplink_frequency_offset
env: "@UL_FREQUENCY_OFFSET_IN_MHZ@000000"
- key: Nid_cell
env: "@NID_CELL@"
- key: N_RB_DL
env: "@NB_PRB@"
- key: ipv4
env: "@MME_S1C_IP_ADDRESS@"
- key: ENB_INTERFACE_NAME_FOR_S1_MME
env: "@ENB_INTERFACE_NAME_FOR_S1_MME@"
- key: ENB_IPV4_ADDRESS_FOR_S1_MME
env: "@ENB_IPV4_ADDRESS_FOR_S1_MME@"
- key: ENB_INTERFACE_NAME_FOR_S1U
env: "@ENB_INTERFACE_NAME_FOR_S1U@"
- key: ENB_IPV4_ADDRESS_FOR_S1U
env: "@ENB_IPV4_ADDRESS_FOR_S1U@"
- key: ENB_IPV4_ADDRESS_FOR_X2C
env: "@ENB_IPV4_ADDRESS_FOR_X2C@"
- key: LOCAL_S_IF_NAME
env: "@LOCAL_S_IF_NAME@"
- key: REMOTE_S_ADDRESS
env: "@REMOTE_S_ADDRESS@"
- key: LOCAL_S_ADDRESS
env: "@LOCAL_S_ADDRESS@"
#/*
# * 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
# */
#---------------------------------------------------------------------
#-----------------------------------------------------------
# Import
#-----------------------------------------------------------
import glob
import re
import yaml
import os
import sys
def main():
#read yaml input parameters
f = open(f'{sys.argv[1]}',)
data = yaml.full_load(f)
initial_path = f'{data[0]["paths"]["source_dir"]}'
dir = glob.glob(initial_path + '/**/*.conf', recursive=True)
#identify configs, read and replace corresponding values
for config in data[1]["configurations"]:
filePrefix = config["filePrefix"]
outputfilename = config["outputfilename"]
print('================================================')
print('filePrefix = ' + filePrefix)
print('outputfilename = ' + outputfilename)
found = False
for inputfile in dir:
if found:
continue
if inputfile.find(filePrefix) >=0:
prefix_outputfile = {"cu.band7.tm1.25PRB": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
"du.band7.tm1.25PRB": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
"rru.fdd": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
"rru.tdd": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
"enb.band7.tm1.fr1.25PRB.usrpb210.conf": 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.if4p5.lo.25PRB": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
"rcc.band40.tm1.25PRB": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
"gnb.band78.tm1.fr1.106PRB.usrpb210.conf": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
"gnb.band78.sa.fr1.106PRB.usrpn310.conf": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
"gnb.sa.band78.fr1.51PRB.usrpb210.conf": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
"gnb.sa.band66.fr1.106PRB.usrpn300.conf": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
"gNB_SA_CU.conf": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
"gNB_SA_DU.conf": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
"proxy_gnb.band78.sa.fr1.106PRB.usrpn310.conf": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
"proxy_rcc.band7.tm1.nfapi.conf": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
"proxy_nr-ue.nfapi.conf": 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}'
}
print('inputfile = ' + inputfile)
found = True
if filePrefix in prefix_outputfile:
outputfile1 = prefix_outputfile[filePrefix]
directory = f'{data[0]["paths"]["dest_dir"]}'
if not os.path.exists(directory):
os.makedirs(directory, exist_ok=True)
with open(f'{inputfile}', mode='r') as inputfile, \
open(outputfile1, mode='w') as outputfile:
for line in inputfile:
if re.search(r'EHPLMN_LIST', line):
outputfile.write(line)
continue
templine = line
for key in config["config"]:
if templine.find(key["key"]) >= 0:
if re.search(r'preference', templine): # false positive
continue
if key["key"] != 'sdr_addrs' and re.search(r'sdr_addrs', templine): # false positive
continue
elif re.search('downlink_frequency', line):
templine = re.sub(r'[0-9]+', key["env"], line)
elif re.search('uplink_frequency_offset', line):
templine = re.sub(r'[0-9]+', key["env"], line)
# next: matches key = ( "SOMETHING" ) or key = [ "SOMETHING" ]
elif re.search(key["key"] + "\s*=\s*[\(\[]\s*\"[0-9.a-zA-Z:_-]+\"\s*[\)\]]", templine):
templine = re.sub("(" + key["key"] + "\s*=\s*[\(\[]\s*\")[0-9.a-zA-Z:_-]+(\"[\)\]])",
r'\1' + key["env"] + r"\2", templine)
# next: matches key = "SOMETHING" or key = [SOMETHING],
elif re.search(key["key"] + "\s*=\s*[\"\[][0-9.a-zA-Z:_/-]+[\"\]]", templine):
templine = re.sub("(" + key["key"] + "\s*=\s*[\"\[])[0-9.a-zA-Z:_/-]+([\"\]])",
r'\1' + key["env"] + r"\2", templine)
# next: matches key = NUMBER
elif re.search(key["key"] + "\s*=\s*[x0-9]+", templine): # x for "0x" hex start
templine = re.sub("(" + key["key"] + "\s*=\s*(?:0x)?)[x0-9a-fA-F]+", r"\1" + key["env"], templine)
# next: special case for sdr_addrs
elif key["key"] == 'sdr_addrs' and re.search(key["key"] + "\s*=\s*", templine):
templine = re.sub("(" + key["key"] + "\s*=\s*.*$)", key["key"] + " = \"" + key["env"] + "\"", templine)
outputfile.write(templine)
if __name__ == "__main__":
main()
......@@ -3,6 +3,7 @@
set -uo pipefail
PREFIX=/opt/oai-gnb-aw2s
CONFIGFILE=$PREFIX/etc/gnb.conf
if [[ -v USE_VOLUMED_CONF ]]; then
cp $PREFIX/etc/mounted.conf $PREFIX/etc/gnb.conf
......@@ -12,9 +13,14 @@ else
exit 1
fi
if [ ! -f $CONFIGFILE ]; then
echo "No configuration file found: please mount at $CONFIGFILE"
exit 255
fi
echo "=================================="
echo "== Configuration file:"
cat $PREFIX/etc/enb.conf
cat $CONFIGFILE
# enable printing of stack traces on assert
export gdbStacks=1
......
......@@ -3,62 +3,22 @@
set -uo pipefail
PREFIX=/opt/oai-gnb
ENABLE_X2=${ENABLE_X2:-yes}
THREAD_PARALLEL_CONFIG=${THREAD_PARALLEL_CONFIG:-PARALLEL_SINGLE_THREAD}
CONFIGFILE=$PREFIX/etc/gnb.conf
# Based another env var, pick one template to use
if [[ -v USE_NSA_TDD_MONO ]]; then cp $PREFIX/etc/gnb.nsa.tdd.conf $PREFIX/etc/gnb.conf; fi
if [[ -v USE_SA_TDD_MONO ]]; then cp $PREFIX/etc/gnb.sa.tdd.conf $PREFIX/etc/gnb.conf; fi
if [[ -v USE_SA_TDD_MONO_B2XX ]]; then cp $PREFIX/etc/gnb.sa.tdd.b2xx.conf $PREFIX/etc/gnb.conf; fi
if [[ -v USE_SA_FDD_MONO ]]; then cp $PREFIX/etc/gnb.sa.fdd.conf $PREFIX/etc/gnb.conf; fi
if [[ -v USE_SA_CU ]]; then cp $PREFIX/etc/gnb.sa.cu.conf $PREFIX/etc/gnb.conf; fi
if [[ -v USE_SA_TDD_DU ]]; then cp $PREFIX/etc/gnb.sa.du.tdd.conf $PREFIX/etc/gnb.conf; fi
if [[ -v USE_SA_NFAPI_VNF ]]; then cp $PREFIX/etc/gnb.sa.nfapi.vnf.conf $PREFIX/etc/gnb.conf; fi
# Sometimes, the templates are not enough. We mount a conf file on $PREFIX/etc. It can be a template itself.
if [[ -v USE_VOLUMED_CONF ]]; then cp $PREFIX/etc/mounted.conf $PREFIX/etc/gnb.conf; fi
# Defualt Parameters
GNB_ID=${GNB_ID:-e00}
NSSAI_SD=${NSSAI_SD:-ffffff}
# AMF_IP_ADDRESS can be amf ip address of amf fqdn
if [[ -v AMF_IP_ADDRESS ]] && [[ "${AMF_IP_ADDRESS}" =~ [a-zA-Z] ]] && [[ -z `getent hosts $AMF_IP_ADDRESS | awk '{print $1}'` ]]; then echo "not able to resolve AMF FQDN" && exit 1 ; fi
[[ -v AMF_IP_ADDRESS ]] && [[ "${AMF_IP_ADDRESS}" =~ [a-zA-Z] ]] && AMF_IP_ADDRESS=$(getent hosts $AMF_IP_ADDRESS | awk '{print $1}')
# Only this template will be manipulated
CONFIG_FILES=`ls $PREFIX/etc/gnb.conf || true`
for c in ${CONFIG_FILES}; do
# Sometimes templates have no pattern to be replaced.
if ! grep -oP '@[a-zA-Z0-9_]+@' ${c}; then
echo "Configuration is already set"
break
fi
# 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#';'}"
if [[ -v USE_VOLUMED_CONF ]]; then
cp $PREFIX/etc/mounted.conf $PREFIX/etc/gnb.conf
else
echo "Using default configuration"
fi
# render template and inline replace config file
sed -i "${EXPRESSIONS}" ${c}
if [ ! -f $CONFIGFILE ]; then
echo "No configuration file found: please mount at $CONFIGFILE"
exit 255
fi
echo "=================================="
echo "== Configuration file: ${c}"
cat ${c}
done
echo "=================================="
echo "== Configuration file:"
cat $CONFIGFILE
# Load the USRP binaries
echo "=================================="
......
#/*
# * 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: gnb.band78.tm1.fr1.106PRB.usrpb210.conf
outputfilename: "gnb.nsa.tdd.conf"
config:
- key: gNB_ID
env: "@GNB_ID@"
- key: Active_gNBs
env: "@GNB_NAME@"
- key: gNB_name
env: "@GNB_NAME@"
- key: mcc
env: "@MCC@"
- key: mnc
env: "@MNC@"
- key: mnc_length
env: "@MNC_LENGTH@"
- key: sst
env: "@NSSAI_SST@"
- key: sd
env: "@NSSAI_SD@"
- key: tracking_area_code
env: "@TAC@"
- key: enable_x2
env: "@ENABLE_X2@"
- key: ipv4
env: "@ENB_X2_IP_ADDRESS@"
- key: GNB_INTERFACE_NAME_FOR_S1_MME
env: "@GNB_S1C_IF_NAME@"
- key: GNB_IPV4_ADDRESS_FOR_S1_MME
env: "@GNB_S1C_IP_ADDRESS@"
- key: GNB_INTERFACE_NAME_FOR_S1U
env: "@GNB_S1U_IF_NAME@"
- key: GNB_IPV4_ADDRESS_FOR_S1U
env: "@GNB_S1U_IP_ADDRESS@"
- key: GNB_IPV4_ADDRESS_FOR_X2C
env: "@GNB_X2_IP_ADDRESS@"
- key: rrc_inactivity_threshold
env: "@RRC_INACTIVITY_THRESHOLD@"
- key: parallel_config
env: "@THREAD_PARALLEL_CONFIG@"
- filePrefix: gnb.band78.sa.fr1.106PRB.usrpn310.conf
outputfilename: "gnb.sa.tdd.conf"
config:
- key: gNB_ID
env: "@GNB_ID@"
- key: Active_gNBs
env: "@GNB_NAME@"
- key: gNB_name
env: "@GNB_NAME@"
- key: mcc
env: "@MCC@"
- key: mnc
env: "@MNC@"
- key: mnc_length
env: "@MNC_LENGTH@"
- key: tracking_area_code
env: "@TAC@"
- key: sst
env: "@NSSAI_SST@"
- key: sd
env: "@NSSAI_SD@"
- key: tracking_area_code
env: "@TAC@"
- key: ipv4
env: "@AMF_IP_ADDRESS@"
- key: GNB_INTERFACE_NAME_FOR_NG_AMF
env: "@GNB_NGA_IF_NAME@"
- key: GNB_IPV4_ADDRESS_FOR_NG_AMF
env: "@GNB_NGA_IP_ADDRESS@"
- key: GNB_INTERFACE_NAME_FOR_NGU
env: "@GNB_NGU_IF_NAME@"
- key: GNB_IPV4_ADDRESS_FOR_NGU
env: "@GNB_NGU_IP_ADDRESS@"
- key: sdr_addrs
env: "@SDR_ADDRS@"
- key: parallel_config
env: "@THREAD_PARALLEL_CONFIG@"
- filePrefix: gnb.sa.band78.fr1.51PRB.usrpb210.conf
outputfilename: "gnb.sa.tdd.b2xx.conf"
config:
- key: gNB_ID
env: "@GNB_ID@"
- key: Active_gNBs
env: "@GNB_NAME@"
- key: gNB_name
env: "@GNB_NAME@"
- key: mcc
env: "@MCC@"
- key: mnc
env: "@MNC@"
- key: mnc_length
env: "@MNC_LENGTH@"
- key: tracking_area_code
env: "@TAC@"
- key: sst
env: "@NSSAI_SST@"
- key: sd
env: "@NSSAI_SD@"
- key: tracking_area_code
env: "@TAC@"
- key: ipv4
env: "@AMF_IP_ADDRESS@"
- key: GNB_INTERFACE_NAME_FOR_NG_AMF
env: "@GNB_NGA_IF_NAME@"
- key: GNB_IPV4_ADDRESS_FOR_NG_AMF
env: "@GNB_NGA_IP_ADDRESS@"
- key: GNB_INTERFACE_NAME_FOR_NGU
env: "@GNB_NGU_IF_NAME@"
- key: GNB_IPV4_ADDRESS_FOR_NGU
env: "@GNB_NGU_IP_ADDRESS@"
- key: parallel_config
env: "@THREAD_PARALLEL_CONFIG@"
- filePrefix: gnb.sa.band66.fr1.106PRB.usrpn300.conf
outputfilename: "gnb.sa.fdd.conf"
config:
- key: gNB_ID
env: "@GNB_ID@"
- key: Active_gNBs
env: "@GNB_NAME@"
- key: gNB_name
env: "@GNB_NAME@"
- key: mcc
env: "@MCC@"
- key: mnc
env: "@MNC@"
- key: mnc_length
env: "@MNC_LENGTH@"
- key: tracking_area_code
env: "@TAC@"
- key: sst
env: "@NSSAI_SST@"
- key: sd
env: "@NSSAI_SD@"
- key: tracking_area_code
env: "@TAC@"
- key: ipv4
env: "@AMF_IP_ADDRESS@"
- key: GNB_INTERFACE_NAME_FOR_NG_AMF
env: "@GNB_NGA_IF_NAME@"
- key: GNB_IPV4_ADDRESS_FOR_NG_AMF
env: "@GNB_NGA_IP_ADDRESS@"
- key: GNB_INTERFACE_NAME_FOR_NGU
env: "@GNB_NGU_IF_NAME@"
- key: GNB_IPV4_ADDRESS_FOR_NGU
env: "@GNB_NGU_IP_ADDRESS@"
- key: parallel_config
env: "@THREAD_PARALLEL_CONFIG@"
- filePrefix: gNB_SA_CU.conf
outputfilename: "gnb.sa.cu.conf"
config:
- key: gNB_ID
env: "@GNB_ID@"
- key: Active_gNBs
env: "@GNB_NAME@"
- key: gNB_name
env: "@GNB_NAME@"
- key: mcc
env: "@MCC@"
- key: mnc
env: "@MNC@"
- key: mnc_length
env: "@MNC_LENGTH@"
- key: tracking_area_code
env: "@TAC@"
- key: sst
env: "@NSSAI_SST@"
- key: sd
env: "@NSSAI_SD@"
- key: tracking_area_code
env: "@TAC@"
- key: ipv4
env: "@AMF_IP_ADDRESS@"
- key: GNB_INTERFACE_NAME_FOR_NG_AMF
env: "@GNB_NGA_IF_NAME@"
- key: GNB_IPV4_ADDRESS_FOR_NG_AMF
env: "@GNB_NGA_IP_ADDRESS@"
- key: GNB_INTERFACE_NAME_FOR_NGU
env: "@GNB_NGU_IF_NAME@"
- key: GNB_IPV4_ADDRESS_FOR_NGU
env: "@GNB_NGU_IP_ADDRESS@"
- key: local_s_if_name
env: "@F1_IF_NAME@"
- key: local_s_address
env: "@F1_CU_IP_ADDRESS@"
- key: local_s_portd
env: "@F1_CU_D_PORT@"
- key: remote_s_address
env: "@F1_DU_IP_ADDRESS@"
- key: remote_s_portd
env: "@F1_DU_D_PORT@"
- filePrefix: gNB_SA_DU.conf
outputfilename: "gnb.sa.du.tdd.conf"
config:
- key: gNB_ID
env: "@GNB_ID@"
- key: Active_gNBs
env: "@GNB_NAME@"
- key: gNB_name
env: "@GNB_NAME@"
- key: mcc
env: "@MCC@"
- key: mnc
env: "@MNC@"
- key: mnc_length
env: "@MNC_LENGTH@"
- key: tracking_area_code
env: "@TAC@"
- key: sst
env: "@NSSAI_SST@"
- key: sd
env: "@NSSAI_SD@"
- key: tracking_area_code
env: "@TAC@"
- key: ipv4
env: "@AMF_IP_ADDRESS@"
- key: GNB_INTERFACE_NAME_FOR_NG_AMF
env: "@GNB_NGA_IF_NAME@"
- key: GNB_IPV4_ADDRESS_FOR_NG_AMF
env: "@GNB_NGA_IP_ADDRESS@"
- key: GNB_INTERFACE_NAME_FOR_NGU
env: "@GNB_NGU_IF_NAME@"
- key: GNB_IPV4_ADDRESS_FOR_NGU
env: "@GNB_NGU_IP_ADDRESS@"
- key: parallel_config
env: "@THREAD_PARALLEL_CONFIG@"
- key: local_n_if_name
env: "@F1_IF_NAME@"
- key: local_n_address
env: "@F1_DU_IP_ADDRESS@"
- key: local_n_portd
env: "@F1_DU_D_PORT@"
- key: remote_n_address
env: "@F1_CU_IP_ADDRESS@"
- key: remote_n_portd
env: "@F1_CU_D_PORT@"
- filePrefix: proxy_gnb.band78.sa.fr1.106PRB.usrpn310.conf
outputfilename: "gnb.sa.nfapi.vnf.conf"
config:
- key: gNB_ID
env: "@GNB_ID@"
- key: Active_gNBs
env: "@GNB_NAME@"
- key: gNB_name
env: "@GNB_NAME@"
- key: mcc
env: "@MCC@"
- key: mnc
env: "@MNC@"
- key: mnc_length
env: "@MNC_LENGTH@"
- key: tracking_area_code
env: "@TAC@"
- key: sst
env: "@NSSAI_SST@"
- key: sd
env: "@NSSAI_SD@"
- key: tracking_area_code
env: "@TAC@"
- key: ipv4
env: "@AMF_IP_ADDRESS@"
- key: GNB_INTERFACE_NAME_FOR_NG_AMF
env: "@GNB_NGA_IF_NAME@"
- key: GNB_IPV4_ADDRESS_FOR_NG_AMF
env: "@GNB_NGA_IP_ADDRESS@"
- key: GNB_INTERFACE_NAME_FOR_NGU
env: "@GNB_NGU_IF_NAME@"
- key: GNB_IPV4_ADDRESS_FOR_NGU
env: "@GNB_NGU_IP_ADDRESS@"
- key: parallel_config
env: "@THREAD_PARALLEL_CONFIG@"
- key: local_s_if_name
env: "@LOCAL_S_IF_NAME@"
- key: remote_s_address
env: "@REMOTE_S_ADDRESS@"
- key: local_s_address
env: "@LOCAL_S_ADDRESS@"
......@@ -3,39 +3,25 @@
set -uo pipefail
PREFIX=/opt/oai-lte-ru
CONFIGFILE=$PREFIX/etc/rru.conf
# Based another env var, pick one template to use
if [[ -v USE_FDD_RRU ]]; then cp $PREFIX/etc/rru.fdd.conf $PREFIX/etc/rru.conf; fi
if [[ -v USE_TDD_RRU ]]; then cp $PREFIX/etc/rru.tdd.conf $PREFIX/etc/rru.conf; fi
# Only this template will be manipulated
CONFIG_FILES=`ls $PREFIX/etc/rru.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."
if [[ -v USE_VOLUMED_CONF ]]; then
cp $PREFIX/etc/rru.fdd.conf $PREFIX/etc/rru.conf
else
echo "ERROR: No configuration file provided."
echo "Please set USE_VOLUMED_CONF and mount a configuration file at $PREFIX/etc/mounted.conf"
exit 1
fi
EXPRESSIONS="${EXPRESSIONS};s|${v}|${!NEW_VAR}|g"
done
EXPRESSIONS="${EXPRESSIONS#';'}"
fi
# render template and inline replace config file
sed -i "${EXPRESSIONS}" ${c}
if [ ! -f $CONFIGFILE ]; then
echo "No configuration file found: please mount at $CONFIGFILE"
exit 255
fi
echo "=================================="
echo "== Configuration file: ${c}"
cat ${c}
done
echo "=================================="
echo "== Configuration file:"
cat $CONFIGFILE
# Load the USRP binaries
echo "=================================="
......
......@@ -3,6 +3,16 @@
set -uo pipefail
PREFIX=/opt/oai-lte-ue
CONFIGFILE=$PREFIX/etc/ue_usim.conf
if [ ! -f $CONFIGFILE ]; then
echo "No configuration file found: please mount at $CONFIGFILE"
exit 255
fi
echo "=================================="
echo "== Configuration file:"
cat $CONFIGFILE
# Based another env var, pick one template to use
if [[ -v USE_NFAPI ]]; then cp $PREFIX/etc/ue.nfapi.conf $PREFIX/etc/ue.conf; fi
......@@ -39,7 +49,7 @@ 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
$PREFIX/bin/conf2uedata -c $CONFIGFILE -o $PREFIX
# Load the USRP binaries
echo "=================================="
......
#/*
# * 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@"
......@@ -3,52 +3,22 @@
set -uo pipefail
PREFIX=/opt/oai-nr-ue
CONFIGFILE=$PREFIX/etc/nr-ue.conf
# Based another env var, pick one template to use
if [[ -v USE_NFAPI ]]; then cp $PREFIX/etc/nr-ue.nfapi.conf $PREFIX/etc/nr-ue.conf; fi
# Sometimes, the templates are not enough. We mount a conf file on $PREFIX/etc. It can be a template itself.
if [[ -v USE_VOLUMED_CONF ]]; then cp $PREFIX/etc/mounted.conf $PREFIX/etc/nr-ue.conf; fi
# if none, pick the default
if [ ! -f $PREFIX/etc/nr-ue.conf ]; then cp $PREFIX/etc/nr-ue-sim.conf $PREFIX/etc/nr-ue.conf; fi
# RFSIMULATOR can have ip-address or service name
if [[ -v RFSIMULATOR ]] && [[ "${RFSIMULATOR}" =~ [a-zA-Z] ]] && [[ -z `getent hosts $RFSIMULATOR | awk '{print $1}'` ]]; then echo "not able to resolve RFSIMULATOR FQDN" && exit 1 ; fi
[[ -v RFSIMULATOR ]] && [[ "${RFSIMULATOR}" =~ [a-zA-Z] ]] && RFSIMULATOR=$(getent hosts $RFSIMULATOR | awk '{print $1}')
# Only this template will be manipulated
CONFIG_FILES=`ls $PREFIX/etc/nr-ue.conf || true`
for c in ${CONFIG_FILES}; do
# Sometimes templates have no pattern to be replaced.
if ! grep -oP '@[a-zA-Z0-9_]+@' ${c}; then
echo "Configuration is already set"
break
fi
# 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#';'}"
if [[ -v USE_VOLUMED_CONF ]]; then
cp $PREFIX/etc/mounted.conf $PREFIX/etc/nr-ue.conf
else
echo "Using default configuration"
fi
# render template and inline replace config file
sed -i "${EXPRESSIONS}" ${c}
if [ ! -f $CONFIGFILE ]; then
echo "No configuration file found: please mount at $CONFIGFILE"
exit 255
fi
echo "=================================="
echo "== Configuration file: ${c}"
cat ${c}
done
echo "=================================="
echo "== Configuration file:"
cat $CONFIGFILE
# Load the USRP binaries
echo "=================================="
......
#/*
# * 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: proxy_nr-ue.nfapi.conf
outputfilename: "nr-ue.nfapi.conf"
config:
- key: imsi
env: "@FULL_IMSI@"
- key: key
env: "@FULL_KEY@"
- key: opc
env: "@OPC@"
- key: dnn
env: "@DNN@"
- key: nssai_sst
env: "@NSSAI_SST@"
- key: nssai_sd
env: "@NSSAI_SD@"
- key: remote_n_address
env: "@GNB_IP_ADDRESS@"
- key: local_n_address
env: "@NR_UE_IP_ADDRESS@"
- key: local_n_if_name
env: "@NR_UE_NFAPI_IF_NAME@"
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