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

CI: adding simple deployment of SPGW-U as UPF

parent b44995ac
No related branches found
No related tags found
No related merge requests found
......@@ -2,3 +2,4 @@ archives/
DS-TEST-RESULTS/
ci-scripts/mysql-complete.cmd
ci-scripts/temp/ci-*.sh
spgw_u.conf
......@@ -178,6 +178,15 @@ pipeline {
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)
// Deploy and configure UPF
myShCmd('python3 ./ci-scripts/dsTestDeployTools.py --action=DeployUPF --tag=develop', new_host_flag, new_host_user, new_host)
}
}
post {
always {
script {
copyFrom2ndServer('archives/*_config.log', 'archives', new_host_flag, new_host_user, new_host)
}
}
}
}
......@@ -221,9 +230,9 @@ pipeline {
// Removing the network
myShCmd('python3 ./ci-scripts/dsTestDeployTools.py --action=RemoveNetworks', new_host_flag, new_host_user, new_host)
// Zipping all archived log files
sh "zip -r -qq fed_docker_logs.zip archives DS-TEST-RESULTS/*.tar DS-TEST-RESULTS/status.txt"
if (fileExists('fed_docker_logs.zip')) {
archiveArtifacts artifacts: 'fed_docker_logs.zip'
sh "zip -r -qq cn5g_fed_docker_logs.zip archives DS-TEST-RESULTS/*.tar DS-TEST-RESULTS/status.txt"
if (fileExists('cn5g_fed_docker_logs.zip')) {
archiveArtifacts artifacts: 'cn5g_fed_docker_logs.zip'
}
if (fileExists('test_results_oai_epc.html')) {
archiveArtifacts artifacts: 'test_results_oai_epc.html'
......
......@@ -124,9 +124,27 @@ class deployForDsTester():
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 deployUPF(self):
res = ''
# first check if tag exists
try:
res = subprocess.check_output('docker image inspect oai-spgwu-tiny:' + 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:
subprocess_run_w_echo('docker run --privileged --name cicd-oai-upf --network cicd-oai-public-net --ip ' + CICD_UPF_PUBLIC_ADDR + ' -d --entrypoint "/bin/bash" oai-spgwu-tiny:' + self.tag + ' -c "sleep infinity"')
else:
subprocess_run_w_echo('docker run --privileged --name cicd-oai-upf --network cicd-oai-public-net --ip ' + CICD_UPF_PUBLIC_ADDR + ' -d oai-spgwu-tiny:' + self.tag + ' /bin/bash -c "sleep infinity"')
subprocess_run_w_echo('python3 ci-scripts/generate_spgwu-tiny_config_script.py --kind=SPGW-U --sxc_ip_addr=' + CICD_SMF_PUBLIC_ADDR + ' --sxu=eth0 --s1u=eth0 --sgi=eth0 --pdn_list="12.0.0.0/24 12.1.0.0/24" --prefix=/openair-spgwu-tiny/etc --from_docker_file')
subprocess_run_w_echo('docker cp ./spgw_u.conf cicd-oai-upf:/openair-spgwu-tiny/etc')
subprocess_run_w_echo('touch archives/spgwu_config.log')
def removeAllContainers(self):
try:
subprocess_run_w_echo('docker rm -f cicd-mysql-svr cicd-oai-amf cicd-oai-smf')
subprocess_run_w_echo('docker rm -f cicd-mysql-svr cicd-oai-amf cicd-oai-smf cicd-oai-upf')
except:
pass
......@@ -151,6 +169,8 @@ def Usage():
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=DeploySMF --tag=[tag]')
print('python3 dsTestDeployTools.py --action=DeployUPF --tag=[tag]')
print('python3 dsTestDeployTools.py --action=RemoveAllContainers')
#--------------------------------------------------------------------------------------------------------
......@@ -177,6 +197,7 @@ while len(argvs) > 1:
action != 'DeployMySqlServer' and \
action != 'DeployAMF' and \
action != 'DeploySMF' and \
action != 'DeployUPF' and \
action != 'RemoveAllContainers':
print('Unsupported Action => ' + action)
Usage()
......@@ -204,6 +225,12 @@ elif DFDT.action == 'DeploySMF':
Usage()
sys.exit(-1)
DFDT.deploySMF()
elif DFDT.action == 'DeployUPF':
if DFDT.tag == '':
print('Missing OAI-UPF image tag')
Usage()
sys.exit(-1)
DFDT.deployUPF()
elif DFDT.action == 'RemoveAllContainers':
DFDT.removeAllContainers()
......
#/*
# * 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 os
import re
import sys
class spgwuConfigGen():
def __init__(self):
self.kind = ''
self.s1u_name = ''
self.sgi_name = ''
self.sxu_name = ''
self.spgwc0_ip_addr = ''
self.pdn_list = ''
self.prefix = ''
self.fromDockerFile = False
def GenerateSpgwuConfigurer(self):
pdns = self.pdn_list.split();
conf_file = open('./spgw_u.conf', 'w')
conf_file.write('# generated by generate_spgwu-tiny_config_scripts.py\n')
conf_file.write('SPGW-U =\n')
conf_file.write('{\n')
conf_file.write(' INSTANCE = 0; # 0 is the default\n')
conf_file.write(' PID_DIRECTORY = "/var/run"; # /var/run is the default\n')
conf_file.write(' #ITTI_TASKS :\n')
conf_file.write(' #{\n')
conf_file.write(' #ITTI_TIMER_SCHED_PARAMS :\n')
conf_file.write(' #{\n')
conf_file.write(' #CPU_ID = 1;\n')
conf_file.write(' #SCHED_POLICY = "SCHED_FIFO"; # Values in { SCHED_OTHER, SCHED_IDLE, SCHED_BATCH, SCHED_FIFO, SCHED_RR }\n')
conf_file.write(' #SCHED_PRIORITY = 85;\n')
conf_file.write(' #};\n')
conf_file.write(' #S1U_SCHED_PARAMS :\n')
conf_file.write(' #{\n')
conf_file.write(' #CPU_ID = 1;\n')
conf_file.write(' #SCHED_POLICY = "SCHED_FIFO"; # Values in { SCHED_OTHER, SCHED_IDLE, SCHED_BATCH, SCHED_FIFO, SCHED_RR }\n')
conf_file.write(' #SCHED_PRIORITY = 84;\n')
conf_file.write(' #};\n')
conf_file.write(' #SX_SCHED_PARAMS :\n')
conf_file.write(' #{\n')
conf_file.write(' #CPU_ID = 1;\n')
conf_file.write(' #SCHED_POLICY = "SCHED_FIFO"; # Values in { SCHED_OTHER, SCHED_IDLE, SCHED_BATCH, SCHED_FIFO, SCHED_RR }\n')
conf_file.write(' #SCHED_PRIORITY = 84;\n')
conf_file.write(' #};\n')
conf_file.write(' #ASYNC_CMD_SCHED_PARAMS :\n')
conf_file.write(' #{\n')
conf_file.write(' #CPU_ID = 1;\n')
conf_file.write(' #SCHED_POLICY = "SCHED_FIFO"; # Values in { SCHED_OTHER, SCHED_IDLE, SCHED_BATCH, SCHED_FIFO, SCHED_RR }\n')
conf_file.write(' #SCHED_PRIORITY = 84;\n')
conf_file.write(' #};\n')
conf_file.write(' #};\n')
conf_file.write(' INTERFACES :\n')
conf_file.write(' {\n')
conf_file.write(' S1U_S12_S4_UP :\n')
conf_file.write(' {\n')
conf_file.write(' # S-GW binded interface for S1-U communication (GTPV1-U) can be ethernet interface, virtual ethernet interface, we don\'t advise wireless interfaces\n')
conf_file.write(' INTERFACE_NAME = "'+self.s1u_name+'"; # STRING, interface name, YOUR NETWORK CONFIG HERE\n')
conf_file.write(' IPV4_ADDRESS = "read"; # STRING, CIDR or "read to let app read interface configured IP address\n')
conf_file.write(' #PORT = 2152; # Default is 2152\n')
conf_file.write(' #SCHED_PARAMS :\n')
conf_file.write(' #{\n')
conf_file.write(' #CPU_ID = 2;\n')
conf_file.write(' #SCHED_POLICY = "SCHED_FIFO"; # Values in { SCHED_OTHER, SCHED_IDLE, SCHED_BATCH, SCHED_FIFO, SCHED_RR }\n')
conf_file.write(' #SCHED_PRIORITY = 98;\n')
conf_file.write(' #};\n')
conf_file.write(' };\n')
conf_file.write(' SX :\n')
conf_file.write(' {\n')
conf_file.write(' # S/P-GW binded interface for SX communication\n')
conf_file.write(' INTERFACE_NAME = "'+self.sxu_name+'"; # STRING, interface name\n')
conf_file.write(' IPV4_ADDRESS = "read"; # STRING, CIDR or "read" to let app read interface configured IP address\n')
conf_file.write(' #PORT = 8805; # Default is 8805\n')
conf_file.write(' #SCHED_PARAMS :\n')
conf_file.write(' #{\n')
conf_file.write(' #CPU_ID = 1;\n')
conf_file.write(' #SCHED_POLICY = "SCHED_FIFO"; # Values in { SCHED_OTHER, SCHED_IDLE, SCHED_BATCH, SCHED_FIFO, SCHED_RR }\n')
conf_file.write(' #SCHED_PRIORITY = 95;\n')
conf_file.write(' #};\n')
conf_file.write(' };\n')
conf_file.write(' SGI :\n')
conf_file.write(' {\n')
conf_file.write(' # No config to set, the software will set the SGi interface to the interface used for the default route.\n')
conf_file.write(' INTERFACE_NAME = "'+self.sgi_name+'"; # STRING, interface name or "default_gateway"\n')
conf_file.write(' IPV4_ADDRESS = "read"; # STRING, CIDR or "read" to let app read interface configured IP address\n')
conf_file.write(' #SCHED_PARAMS :\n')
conf_file.write(' #{\n')
conf_file.write(' #CPU_ID = 3;\n')
conf_file.write(' #SCHED_POLICY = "SCHED_FIFO"; # Values in { SCHED_OTHER, SCHED_IDLE, SCHED_BATCH, SCHED_FIFO, SCHED_RR }\n')
conf_file.write(' #SCHED_PRIORITY = 98;\n')
conf_file.write(' #};\n')
conf_file.write(' };\n')
conf_file.write(' };\n')
conf_file.write(' PDN_NETWORK_LIST = (\n')
for pdn in pdns[ 0:len(pdns)-1 ]:
conf_file.write(' {NETWORK_IPV4 = "'+pdn+'"; SNAT = "no";},\n')
pdn = pdns[len(pdns) - 1]
conf_file.write(' {NETWORK_IPV4 = "'+pdn+'"; SNAT = "no";}\n')
conf_file.write(' );\n')
conf_file.write(' SPGW-C_LIST = (\n')
conf_file.write(' {IPV4_ADDRESS="' + self.spgwc0_ip_addr + '" ;}\n')
conf_file.write(' );\n')
conf_file.write('};\n')
conf_file.close()
#-----------------------------------------------------------
# Usage()
#-----------------------------------------------------------
def Usage():
print('--------------------------------------------------------------------')
print('generate_spgwu-tiny_config_scripts.py')
print(' Prepare a bash script to be run in the workspace where SPGW-U-TINY is being built.')
print(' That bash script will copy configuration template files and adapt to your configuration.')
print('--------------------------------------------------------------------')
print('Usage: python3 generate_spgwu-tiny_config_scripts.py [options]')
print(' --help Show this help.')
print('--------------- SPGW-U Options -----')
print(' --kind=SPGW-U')
print(' --sxc_ip_addr=[SPGW-C SX IP address]')
print(' --sxu=[SPGW-U SX Interface Name]')
print(' --s1u=[SPGW-U S1-U Interface Name]')
print(' --sgi=[SPGW-U SGi Interface Name]')
print(' --pdn_list=["PDNs"]')
print(' --prefix=["Prefix for configuration files"]')
print(' --from_docker_file')
argvs = sys.argv
argc = len(argvs)
cwd = os.getcwd()
mySpgwuCfg = spgwuConfigGen()
while len(argvs) > 1:
myArgv = argvs.pop(1)
if re.match('^\-\-help$', myArgv, re.IGNORECASE):
Usage()
sys.exit(0)
elif re.match('^\-\-kind=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-kind=(.+)$', myArgv, re.IGNORECASE)
mySpgwuCfg.kind = matchReg.group(1)
elif re.match('^\-\-sxu=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-sxu=(.+)$', myArgv, re.IGNORECASE)
mySpgwuCfg.sxu_name = matchReg.group(1)
elif re.match('^\-\-sxc_ip_addr=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-sxc_ip_addr=(.+)$', myArgv, re.IGNORECASE)
mySpgwuCfg.spgwc0_ip_addr = matchReg.group(1)
elif re.match('^\-\-s1u=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-s1u=(.+)$', myArgv, re.IGNORECASE)
mySpgwuCfg.s1u_name = matchReg.group(1)
elif re.match('^\-\-sgi=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-sgi=(.+)$', myArgv, re.IGNORECASE)
mySpgwuCfg.sgi_name = matchReg.group(1)
elif re.match('^\-\-pdn_list=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-pdn_list=(.+)$', myArgv, re.IGNORECASE)
mySpgwuCfg.pdn_list = str(matchReg.group(1))
elif re.match('^\-\-prefix=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-prefix=(.+)$', myArgv, re.IGNORECASE)
mySpgwuCfg.prefix = matchReg.group(1)
elif re.match('^\-\-from_docker_file', myArgv, re.IGNORECASE):
mySpgwuCfg.fromDockerFile = True
else:
Usage()
sys.exit('Invalid Parameter: ' + myArgv)
if mySpgwuCfg.kind == '':
Usage()
sys.exit('missing kind parameter')
if mySpgwuCfg.kind == 'SPGW-U':
if mySpgwuCfg.sxu_name == '':
Usage()
sys.exit('missing SX Interface Name on SPGW-U container')
elif mySpgwuCfg.s1u_name == '':
Usage()
sys.exit('missing S1-U Interface Name on SPGW-U container')
elif mySpgwuCfg.sgi_name == '':
Usage()
sys.exit('missing SGi Interface Name on SPGW-U container')
elif mySpgwuCfg.pdn_list == '':
Usage()
sys.exit('missing pdn_list')
elif mySpgwuCfg.spgwc0_ip_addr == '':
Usage()
sys.exit('missing SPGW-C #0 IP address on SX interface')
elif mySpgwuCfg.prefix == '':
Usage()
sys.exit('missing prefix')
else:
mySpgwuCfg.GenerateSpgwuConfigurer()
sys.exit(0)
else:
Usage()
sys.exit('invalid kind parameter')
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