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

CI: simple AMF deployment

parent ce70096f
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
......@@ -172,7 +172,10 @@ pipeline {
stage ('Deploy Containers') {
steps {
script {
sh "sleep 10"
// Deploy and configure MySQL Server
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)
}
}
}
......@@ -194,8 +197,7 @@ pipeline {
steps {
script {
// Remove the containers
//myShCmd('python3 ./ci-scripts/dsTestDeployTools.py --action=RemoveAllContainers', new_host_flag, new_host_user, new_host)
sh "sleep 10"
myShCmd('python3 ./ci-scripts/dsTestDeployTools.py --action=RemoveAllContainers', new_host_flag, new_host_user, new_host)
}
}
}
......
......@@ -31,6 +31,8 @@ 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_DUMMY_SMF_PUBLIC_ADDR='192.168.61.200'
class deployForDsTester():
def __init__(self):
......@@ -85,6 +87,24 @@ class deployForDsTester():
time.sleep(2)
subprocess_run_w_echo('docker exec -it cicd-mysql-svr /bin/bash -c "mysql -uroot -psecretPassword < /home/mysql-complete.cmd"')
def deployAMF(self):
res = ''
# first check if tag exists
try:
res = subprocess.check_output('docker image inspect oai-amf:' + 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-amf --network cicd-oai-public-net --ip ' + CICD_AMF_PUBLIC_ADDR + ' -d oai-amf:' + self.tag + ' /bin/bash -c "sleep infinity"')
subprocess_run_w_echo('sed -e "s@CI_NGAP_IF_NAME@eth0@" -e "s@CI_N11_IF_NAME@eth0@" -e "s@CI_SMF0_IP_ADDRESS@' + CICD_SMF_PUBLIC_ADDR + '@" -e "s@CI_SMF1_IP_ADDRESS@' + CICD_DUMMY_SMF_PUBLIC_ADDR + '@" -e "s@CI_MYSQL_IP_ADDRESS@' + CICD_MYSQL_PUBLIC_ADDR + '@" ci-scripts/temp/generate_amf_conf.sh > ci-scripts/temp/ci-generate_amf_conf.sh')
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 removeAllContainers(self):
try:
subprocess_run_w_echo('docker rm -f cicd-mysql-svr')
......@@ -111,6 +131,7 @@ def Usage():
print('python3 dsTestDeployTools.py --action=CreateNetworks')
print('python3 dsTestDeployTools.py --action=RemoveNetworks')
print('python3 dsTestDeployTools.py --action=DeployMySqlServer')
print('python3 dsTestDeployTools.py --action=DeployAMF --tag=[tag]')
print('python3 dsTestDeployTools.py --action=RemoveAllContainers')
#--------------------------------------------------------------------------------------------------------
......@@ -135,6 +156,7 @@ while len(argvs) > 1:
if action != 'CreateNetworks' and \
action != 'RemoveNetworks' and \
action != 'DeployMySqlServer' and \
action != 'DeployAMF' and \
action != 'RemoveAllContainers':
print('Unsupported Action => ' + action)
Usage()
......@@ -150,6 +172,12 @@ elif DFDT.action == 'RemoveNetworks':
DFDT.removeNetworks()
elif DFDT.action == 'DeployMySqlServer':
DFDT.deployMySqlServer()
elif DFDT.action == 'DeployAMF':
if DFDT.tag == '':
print('Missing OAI-AMF image tag')
Usage()
sys.exit(-1)
DFDT.deployAMF()
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-amf/etc'
declare -A AMF_CONF
AMF_CONF[@INSTANCE@]=$INSTANCE
AMF_CONF[@PID_DIRECTORY@]='/var/run'
AMF_CONF[@MCC@]='208'
AMF_CONF[@MNC@]='95'
AMF_CONF[@REGION_ID@]='128'
AMF_CONF[@AMF_SET_ID@]='1'
AMF_CONF[@SERVED_GUAMI_MCC_0@]='208'
AMF_CONF[@SERVED_GUAMI_MNC_0@]='95'
AMF_CONF[@SERVED_GUAMI_REGION_ID_0@]='128'
AMF_CONF[@SERVED_GUAMI_AMF_SET_ID_0@]='1'
AMF_CONF[@SERVED_GUAMI_MCC_1@]='460'
AMF_CONF[@SERVED_GUAMI_MNC_1@]='11'
AMF_CONF[@SERVED_GUAMI_REGION_ID_1@]='10'
AMF_CONF[@SERVED_GUAMI_AMF_SET_ID_1@]='1'
AMF_CONF[@PLMN_SUPPORT_MCC@]='208'
AMF_CONF[@PLMN_SUPPORT_MNC@]='95'
AMF_CONF[@PLMN_SUPPORT_TAC@]='0xa000'
AMF_CONF[@SST_0@]='222'
AMF_CONF[@SD_0@]='123'
AMF_CONF[@SST_1@]='1'
AMF_CONF[@SD_1@]='12'
AMF_CONF[@AMF_INTERFACE_NAME_FOR_NGAP@]='CI_NGAP_IF_NAME'
AMF_CONF[@AMF_INTERFACE_NAME_FOR_N11@]='CI_N11_IF_NAME'
AMF_CONF[@SMF_INSTANCE_ID_0@]='1'
AMF_CONF[@SMF_IPV4_ADDR_0@]='CI_SMF0_IP_ADDRESS'
AMF_CONF[@SMF_HTTP_VERSION_0@]='v1'
AMF_CONF[@SMF_INSTANCE_ID_1@]='2'
AMF_CONF[@SMF_IPV4_ADDR_1@]='CI_SMF1_IP_ADDRESS'
AMF_CONF[@SMF_HTTP_VERSION_1@]='v1'
AMF_CONF[@MYSQL_SERVER@]='CI_MYSQL_IP_ADDRESS'
AMF_CONF[@MYSQL_USER@]='root'
AMF_CONF[@MYSQL_PASS@]='linux'
AMF_CONF[@MYSQL_DB@]='oai_db'
AMF_CONF[@OPERATOR_KEY@]='63bfa50ee6523365ff14c1f45f88737d'
for K in "${!AMF_CONF[@]}"; do
egrep -lRZ "$K" $PREFIX/amf.conf | xargs -0 -l sed -i -e "s|$K|${AMF_CONF[$K]}|g"
ret=$?;[[ ret -ne 0 ]] && echo "Tried to replace $K with ${AMF_CONF[$K]}"
done
echo "AMF 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