Skip to content
Snippets Groups Projects
Commit b44995ac authored by Raphael Defosseux's avatar Raphael Defosseux
Browse files

CI: add simple SMF deployment

parent 81af5646
No related branches found
No related tags found
No related merge requests found
archives/
DS-TEST-RESULTS/
ci-scripts/mysql-complete.cmd
ci-scripts/temp/ci-generate_amf_conf.sh
ci-scripts/temp/ci-*.sh
......@@ -176,6 +176,8 @@ pipeline {
myShCmd('python3 ./ci-scripts/dsTestDeployTools.py --action=DeployMySqlServer', new_host_flag, new_host_user, new_host)
// Deploy and configure AMF
myShCmd('python3 ./ci-scripts/dsTestDeployTools.py --action=DeployAMF --tag=' + amfTag, new_host_flag, new_host_user, new_host)
// Deploy and configure SMF
myShCmd('python3 ./ci-scripts/dsTestDeployTools.py --action=DeploySMF --tag=' + smfTag, new_host_flag, new_host_user, new_host)
}
}
}
......
......@@ -32,6 +32,7 @@ CICD_PUBLIC_NETWORK_RANGE='192.168.61.192/26'
CICD_MYSQL_PUBLIC_ADDR='192.168.61.194'
CICD_AMF_PUBLIC_ADDR='192.168.61.195'
CICD_SMF_PUBLIC_ADDR='192.168.61.196'
CICD_UPF_PUBLIC_ADDR='192.168.61.197'
CICD_DUMMY_SMF_PUBLIC_ADDR='192.168.61.200'
class deployForDsTester():
......@@ -105,9 +106,27 @@ class deployForDsTester():
subprocess_run_w_echo('docker cp ci-scripts/temp/ci-generate_amf_conf.sh cicd-oai-amf:/openair-amf/generate_amf_conf.sh')
subprocess_run_w_echo('docker exec -it cicd-oai-amf /bin/bash -c "chmod 755 generate_amf_conf.sh && ./generate_amf_conf.sh" > archives/amf_config.log')
def deploySMF(self):
res = ''
# first check if tag exists
try:
res = subprocess.check_output('docker image inspect oai-smf:' + self.tag, shell=True, universal_newlines=True)
except:
sys.exit(-1)
# check if there is an entrypoint
entrypoint = re.search('entrypoint', str(res))
if entrypoint is not None:
print('not supported yet')
else:
subprocess_run_w_echo('docker run --privileged --name cicd-oai-smf --network cicd-oai-public-net --ip ' + CICD_SMF_PUBLIC_ADDR + ' -d oai-smf:' + self.tag + ' /bin/bash -c "sleep infinity"')
subprocess_run_w_echo('sed -e "s@CI_N4_IF_NAME@eth0@" -e "s@CI_SBI_IF_NAME@eth0@" -e "s@CI_AMF_IP_ADDR@' + CICD_AMF_PUBLIC_ADDR + '@" -e "s@CI_UPF_IP_ADDR@' + CICD_UPF_PUBLIC_ADDR + '@" ci-scripts/temp/generate_smf_conf.sh > ci-scripts/temp/ci-generate_smf_conf.sh')
subprocess_run_w_echo('docker cp ci-scripts/temp/ci-generate_smf_conf.sh cicd-oai-smf:/openair-smf/generate_smf_conf.sh')
subprocess_run_w_echo('docker exec -it cicd-oai-smf /bin/bash -c "chmod 755 generate_smf_conf.sh && ./generate_smf_conf.sh" > archives/smf_config.log')
def removeAllContainers(self):
try:
subprocess_run_w_echo('docker rm -f cicd-mysql-svr')
subprocess_run_w_echo('docker rm -f cicd-mysql-svr cicd-oai-amf cicd-oai-smf')
except:
pass
......@@ -157,6 +176,7 @@ while len(argvs) > 1:
action != 'RemoveNetworks' and \
action != 'DeployMySqlServer' and \
action != 'DeployAMF' and \
action != 'DeploySMF' and \
action != 'RemoveAllContainers':
print('Unsupported Action => ' + action)
Usage()
......@@ -178,6 +198,12 @@ elif DFDT.action == 'DeployAMF':
Usage()
sys.exit(-1)
DFDT.deployAMF()
elif DFDT.action == 'DeploySMF':
if DFDT.tag == '':
print('Missing OAI-SMF image tag')
Usage()
sys.exit(-1)
DFDT.deploySMF()
elif DFDT.action == 'RemoveAllContainers':
DFDT.removeAllContainers()
......
# prompt has been removed for easier Ctrl+C Ctrl+V
# please update the following information according to your configuration
INSTANCE=1
PREFIX='/openair-smf/etc'
declare -A SMF_CONF
SMF_CONF[@INSTANCE@]=$INSTANCE
SMF_CONF[@PID_DIRECTORY@]='/var/run'
SMF_CONF[@SMF_INTERFACE_NAME_FOR_N4@]='CI_N4_IF_NAME'
SMF_CONF[@SMF_INTERFACE_NAME_FOR_SBI@]='CI_SBI_IF_NAME'
SMF_CONF[@SMF_INTERFACE_PORT_FOR_SBI@]='80'
SMF_CONF[@SMF_INTERFACE_HTTP2_PORT_FOR_SBI@]='9090'
SMF_CONF[@UDM_IPV4_ADDRESS@]='127.0.0.1'
SMF_CONF[@UDM_PORT@]='80'
SMF_CONF[@AMF_IPV4_ADDRESS@]='CI_AMF_IP_ADDR'
SMF_CONF[@AMF_PORT@]='80'
SMF_CONF[@UPF_IPV4_ADDRESS@]='CI_UPF_IP_ADDR'
SMF_CONF[@DEFAULT_DNS_IPV4_ADDRESS@]='8.8.8.8'
SMF_CONF[@DEFAULT_DNS_SEC_IPV4_ADDRESS@]='4.4.4.4'
for K in "${!SMF_CONF[@]}"; do
egrep -lRZ "$K" $PREFIX/smf.conf | xargs -0 -l sed -i -e "s|$K|${SMF_CONF[$K]}|g"
ret=$?;[[ ret -ne 0 ]] && echo "Tried to replace $K with ${SMF_CONF[$K]}"
done
echo "SMF Configuration Successful"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment