Skip to content
Snippets Groups Projects
Commit fe7b8257 authored by Mohammed Ismail's avatar Mohammed Ismail
Browse files

CI: adding the nssf slicing test onto the FED pipeline

parent d562af5e
No related branches found
No related tags found
No related merge requests found
......@@ -54,6 +54,8 @@ def scmEvent = false
def upstreamEvent = false
def deployed = true
def mini = false
def basic = false
def slice = false
// Default tags / branches --> could be passed on by upstream job or by PR content
def nrfTag = params.nrfTag
......@@ -71,6 +73,8 @@ def udmTag = params.udmTag
def udmBranch = params.udmBranch
def udrTag = params.udrTag
def udrBranch = params.udrBranch
def nssfTag = params.udrTag
def nssfBranch = params.udrBranch
//-------------------------------------------------------------------------------
// Pipeline start
......@@ -132,6 +136,7 @@ pipeline {
nrfTag = params.NRF_TAG
echo "Upstream Job passed NRF_TAG to use: ${nrfTag}"
mini = true
basic = true
}
if (params.NRF_BRANCH != null) {
nrfBranch = params.NRF_BRANCH
......@@ -141,6 +146,7 @@ pipeline {
amfTag = params.AMF_TAG
echo "Upstream Job passed AMF_TAG to use: ${amfTag}"
mini = true
basic = true
}
if (params.AMF_BRANCH != null) {
amfBranch = params.AMF_BRANCH
......@@ -150,6 +156,7 @@ pipeline {
smfTag = params.SMF_TAG
echo "Upstream Job passed SMF_TAG to use: ${smfTag}"
mini = true
basic = true
}
if (params.SMF_BRANCH != null) {
smfBranch = params.SMF_BRANCH
......@@ -159,6 +166,7 @@ pipeline {
spgwuTag = params.SPGWU_TAG
echo "Upstream Job passed SPGWU_TAG to use: ${spgwuTag}"
mini = true
basic = true
}
if (params.SPGWU_BRANCH != null) {
spgwuBranch = params.SPGWU_BRANCH
......@@ -167,26 +175,38 @@ pipeline {
if (params.AUSF_TAG != null) {
ausfTag = params.AUSF_TAG
echo "Upstream Job passed AUSF_TAG to use: ${ausfTag}"
basic = true
}
if (params.AUSF_BRANCH != null) {
ausfBranch = params.AUSF_BRANCH
echo "Upstream Job passed AUSF_TAG to use: ${ausfBranch}"
echo "Upstream Job passed AUSF_BRANCH to use: ${ausfBranch}"
}
if (params.UDM_TAG != null) {
udmTag = params.UDM_TAG
echo "Upstream Job passed UDM_TAG to use: ${udmTag}"
basic = true
}
if (params.UDM_BRANCH != null) {
udmBranch = params.UDM_BRANCH
echo "Upstream Job passed UDM_TAG to use: ${udmBranch}"
echo "Upstream Job passed UDM_BRANCH to use: ${udmBranch}"
}
if (params.UDR_TAG != null) {
udrTag = params.UDR_TAG
echo "Upstream Job passed UDR_TAG to use: ${udrTag}"
basic = true
}
if (params.UDR_BRANCH != null) {
udrBranch = params.UDR_BRANCH
echo "Upstream Job passed UDR_TAG to use: ${udrBranch}"
echo "Upstream Job passed UDR_BRANCH to use: ${udrBranch}"
}
if (params.NSSF_TAG != null) {
nssfTag = params.NSSF_TAG
echo "Upstream Job passed NSSF_TAG to use: ${nssfTag}"
slice = true
}
if (params.NSSF_BRANCH != null) {
nssfBranch = params.NSSF_BRANCH
echo "Upstream Job passed NSSF_BRANCH to use: ${nssfBranch}"
}
sh "git clean -x -d -f > /dev/null 2>&1"
sh "git fetch --prune > /dev/null 2>&1"
......@@ -197,6 +217,8 @@ pipeline {
}
if (scmEvent) {
mini = true
basic = true
slice = true
sh "git clean -x -d -f > /dev/null 2>&1"
if ("MERGE".equals(env.gitlabActionType)) {
sh "./ci-scripts/doGitLabMerge.sh --src-branch ${env.gitlabSourceBranch} --src-commit ${env.gitlabMergeRequestLastCommit} --target-branch ${env.gitlabTargetBranch} --target-commit ${GIT_COMMIT}"
......@@ -207,6 +229,8 @@ pipeline {
}
if ((!upstreamEvent) && (!scmEvent)) {
mini = true
basic = true
slice = true
sh "git clean -x -d -f > /dev/null 2>&1"
sh './scripts/syncComponents.sh --nrf-branch ' + nrfBranch + ' --amf-branch ' + amfBranch + ' --smf-branch ' + smfBranch + ' --spgwu-tiny-branch ' + spgwuBranch + ' --ausf-branch ' + ausfBranch + ' --udm-branch ' + udmBranch + ' --udr-branch ' + udrBranch
sh "mkdir -p archives"
......@@ -261,6 +285,13 @@ pipeline {
} catch (Exception e) {
error "OAI UDR Image tag to test does not exist!"
}
try {
sh 'echo "OAI_NSSF_TAG: oai-nssf:' + nssfTag +'" > archives/oai_nssf_image_info.log'
sh 'docker image inspect --format=\'Size = {{.Size}} bytes\' oai-nssf:' + nssfTag + ' >> archives/oai_nssf_image_info.log'
sh 'docker image inspect --format=\'Date = {{.Created}}\' oai-nssf:' + nssfTag + ' >> archives/oai_nssf_image_info.log'
} catch (Exception e) {
error "OAI NSSF Image tag to test does not exist!"
}
}
}
}
......@@ -305,14 +336,19 @@ pipeline {
sh "python3 ./ci-scripts/toCheckDSTesterResult.py --type mini"
} catch (Exception e) {
currentBuild.result = 'FAILURE'
echo "dsTester ResultCheck FAILED"
echo "dsTester Mini ResultCheck FAILED"
}
}
}
}
}
stage ('Deploy Whole 5G Core Network (Basic) and Test with DS Tester') {
when { expression {dsT_host_flag} }
when {
allOf {
expression {dsT_host_flag}
expression {basic == true}
}
}
steps {
lock (ds_tester_ci_resource) {
script {
......@@ -347,7 +383,54 @@ pipeline {
sh "python3 ./ci-scripts/toCheckDSTesterResult.py --type basic"
} catch (Exception e) {
currentBuild.result = 'FAILURE'
echo "dsTester ResultCheck FAILED"
echo "dsTester Basic ResultCheck FAILED"
}
}
}
}
}
stage ('Deploy 5G Core Network (slice) and Test with DS Tester') {
when {
allOf {
expression {dsT_host_flag}
expression {slice == true}
}
}
steps {
lock (ds_tester_ci_resource) {
script {
echo '\u2705 \u001B[32mDeploy CN5G-Slicing using Docker-Compose and Testing with DS Tester\u001B[0m'
sh "mkdir -p RESULTS-SLICE"
if (fileExists("dstester")) {
sh "rm -Rf dstester > /dev/null 2>&1"
}
sh "mkdir -p dstester"
dir ('dstester') {
withCredentials([
[$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.dsTesterGitLabRepository_Credentials}", usernameVariable: 'git_username', passwordVariable: 'git_token']
]) {
sh "git clone https://${git_username}:${git_token}@github.com/OPENAIRINTERFACE/chasseur.git . > ../git_clone.log 2>&1"
sh "git checkout -f " + dsTesterTag + " >> ../git_clone.log 2>&1"
// First put all correct tags to test
sh 'sed -i -e "s#NRF_TAG#' + nrfTag + '#" -i -e "s#AMF_TAG#' + amfTag + '#" -i -e "s#SMF_TAG#' + smfTag + '#" -i -e "s#UPF_TAG#' + spgwuTag + '#" -i -e "s#AUSF_TAG#' + ausfTag + '#" -i -e "s#UDM_TAG#' + udmTag + '#" -i -e "s#UDR_TAG#' + udrTag + '#" -i -e "s#NSSF_TAG#' + nssfTag + '#" ./jenkins/suits/dc/integration/integration-slice.yaml'
// Check the route b/w the container and DSTester n/w and add
sh 'python3 ../ci-scripts/routeCheck.py --mode Add --userName ' + dsT_host_user + ' --hostName ' + dsT_host + ' --docker_compose docker-compose/integration/integration-slice/integration.tplt'
dir ('jenkins') {
try {
sh "python3 ./chasseurdocker.py -f ./suits/dc/integration/integration-slice.yaml | tee ../../RESULTS-SLICE/dsTester_Summary_slice.txt"
} catch (Exception e) {
currentBuild.result = 'FAILURE'
echo "dsTester FrameWork FAILED"
}
}
sh 'python3 ../ci-scripts/routeCheck.py --mode Delete --userName ' + dsT_host_user + ' --hostName ' + dsT_host + ' --docker_compose docker-compose/integration/integration-slice/integration.tplt'
}
}
try {
sh "python3 ./ci-scripts/toCheckDSTesterResult.py --type slice"
} catch (Exception e) {
currentBuild.result = 'FAILURE'
echo "dsTester Slicing ResultCheck FAILED"
}
}
}
......@@ -361,13 +444,20 @@ pipeline {
if (mini == true){
sh 'python3 ./ci-scripts/dsTestGenerateHTMLReport.py --job_name ' + JOB_NAME + ' --job_id ' + BUILD_ID + ' --job_url ' + BUILD_URL + ' --type mini'
}
if (slice == true){
sh 'python3 ./ci-scripts/dsTestGenerateHTMLReport.py --job_name ' + JOB_NAME + ' --job_id ' + BUILD_ID + ' --job_url ' + BUILD_URL + ' --type slice'
}
if (basic == true){
sh 'python3 ./ci-scripts/dsTestGenerateHTMLReport.py --job_name ' + JOB_NAME + ' --job_id ' + BUILD_ID + ' --job_url ' + BUILD_URL + ' --type basic'
}
// Zipping all archived log files
if (mini == true){
if (mini == true && basic == true && slice == true){
sh "zip -r -qq cn5g_fed_docker_logs.zip archives RESULTS-MINI RESULTS-BASIC RESULTS-SLICE"
} else if (mini == true && basic == true){
sh "zip -r -qq cn5g_fed_docker_logs.zip archives RESULTS-MINI RESULTS-BASIC"
} else {
sh "zip -r -qq cn5g_fed_docker_logs.zip archives RESULTS-BASIC"
} else if (slice == true && mini == false && basic == false){
sh "zip -r -qq cn5g_fed_docker_logs.zip archives RESULTS-SLICE"
}
if (fileExists('cn5g_fed_docker_logs.zip')) {
archiveArtifacts artifacts: 'cn5g_fed_docker_logs.zip'
......@@ -378,6 +468,9 @@ pipeline {
if (fileExists('test_results_oai_cn5g_basic.html')) {
archiveArtifacts artifacts: 'test_results_oai_cn5g_basic.html'
}
if (fileExists('test_results_oai_cn5g_slice.html')) {
archiveArtifacts artifacts: 'test_results_oai_cn5g_slice.html'
}
}
}
}
......
......@@ -73,7 +73,7 @@ class HtmlReport():
'--type',
action='store',
required=True,
choices=['mini', 'basic'],
choices=['mini', 'basic', 'slice'],
help='Type of function',
)
return parser.parse_args()
......@@ -172,48 +172,94 @@ class HtmlReport():
self.file.write(' <th>Configuration Status</th>\n')
self.file.write(' </tr>\n')
self.addImageRow('mysql')
self.addImageRow('oai_nrf')
self.addImageRow('oai_amf')
self.addImageRow('oai_smf')
self.addImageRow('oai_spgwu')
if self.type == 'basic':
if self.type == 'basic' or self.type == 'mini':
self.addImageRow('oai_nrf')
self.addImageRow('oai_smf')
self.addImageRow('oai_spgwu')
if self.type == 'basic' or self.type == 'slice':
self.addImageRow('oai_ausf')
self.addImageRow('oai_udm')
self.addImageRow('oai_udr')
if self.type == 'slice':
self.addImageRow('oai_nrf_1', )
self.addImageRow('oai_nrf_2')
self.addImageRow('oai_smf_1')
self.addImageRow('oai_smf_2')
self.addImageRow('oai_upf_1')
self.addImageRow('oai_upf_2')
self.file.write(' </table>\n')
self.file.write(' </div>\n')
def addImageRow(self, imageInfoPrefix):
def addImageRow(self, prefix):
cwd = os.getcwd()
if imageInfoPrefix == 'oai_amf':
if prefix == 'oai_nrf_1':
imageInfoPrefix = 'oai_nrf'
containerName = 'oai-nrf_1'
tagPattern = 'OAI_NRF_TAG'
statusPrefix = 'cicd-oai-nrf_1'
if prefix == 'oai_nrf_2':
imageInfoPrefix = 'oai_nrf'
containerName = 'oai-nrf_2'
tagPattern = 'OAI_NRF_TAG'
statusPrefix = 'cicd-oai-nrf_2'
if prefix == 'oai_smf_1':
imageInfoPrefix = 'oai_smf'
containerName = 'oai-smf_1'
tagPattern = 'OAI_SMF_TAG'
statusPrefix = 'cicd-oai-smf_1'
if prefix == 'oai_smf_2':
imageInfoPrefix = 'oai_smf'
containerName = 'oai-smf_2'
tagPattern = 'OAI_SMF_TAG'
statusPrefix = 'cicd-oai-smf_2'
if prefix == 'oai_upf_1':
imageInfoPrefix = 'oai_spgwu'
containerName = 'oai-spgwu-tiny_1'
tagPattern = 'OAI_SPGWU_TAG'
statusPrefix = 'cicd-oai-upf_1'
if prefix == 'oai_upf_2':
imageInfoPrefix = 'oai_spgwu'
containerName = 'oai-spgwu-tiny_2'
tagPattern = 'OAI_SPGWU_TAG'
statusPrefix = 'cicd-oai-upf_2'
if prefix == 'oai_amf':
imageInfoPrefix = 'oai_amf'
containerName = 'oai-amf'
tagPattern = 'OAI_AMF_TAG'
statusPrefix = 'cicd-oai-amf'
if imageInfoPrefix == 'oai_smf':
if prefix == 'oai_smf':
imageInfoPrefix = 'oai_smf'
containerName = 'oai-smf'
tagPattern = 'OAI_SMF_TAG'
statusPrefix = 'cicd-oai-smf'
if imageInfoPrefix == 'oai_nrf':
if prefix == 'oai_nrf':
imageInfoPrefix = 'oai_nrf'
containerName = 'oai-nrf'
tagPattern = 'OAI_NRF_TAG'
statusPrefix = 'cicd-oai-nrf'
if imageInfoPrefix == 'oai_spgwu':
if prefix == 'oai_spgwu':
imageInfoPrefix = 'oai_spgwu'
containerName = 'oai-spgwu-tiny'
tagPattern = 'OAI_SPGWU_TAG'
statusPrefix = 'cicd-oai-upf'
if imageInfoPrefix == 'oai_ausf':
if prefix == 'oai_ausf':
imageInfoPrefix = 'oai_ausf'
containerName = 'oai-ausf'
tagPattern = 'OAI_AUSF_TAG'
statusPrefix = 'cicd-oai-ausf'
if imageInfoPrefix == 'oai_udm':
if prefix == 'oai_udm':
imageInfoPrefix = 'oai_udm'
containerName = 'oai-udm'
tagPattern = 'OAI_UDM_TAG'
statusPrefix = 'cicd-oai-udm'
if imageInfoPrefix == 'oai_udr':
if prefix == 'oai_udr':
imageInfoPrefix = 'oai_udr'
containerName = 'oai-udr'
tagPattern = 'OAI_UDR_TAG'
statusPrefix = 'cicd-oai-udr'
if imageInfoPrefix == 'mysql':
if prefix == 'mysql':
imageInfoPrefix = 'mysql'
containerName = imageInfoPrefix
tagPattern = 'N/A'
statusPrefix = 'cicd-mysql-svr'
......@@ -390,4 +436,8 @@ elif HTML.type == 'basic':
HTML.path = '/RESULTS-BASIC/bvc.yaml'
HTML.file_name = '/test_results_oai_cn5g_basic.html'
HTML.containers = 8
elif HTML.type == 'slice':
HTML.path = '/RESULTS-SLICE/slice.yaml'
HTML.file_name = '/test_results_oai_cn5g_slice.html'
HTML.containers = 12
HTML.generate()
......@@ -37,6 +37,9 @@ def main() -> None:
elif args.type == 'basic':
path = '/RESULTS-BASIC/dsTester_Summary_basic.txt'
folder = 'RESULTS-BASIC/'
elif args.type == 'slice':
path = '/RESULTS-SLICE/dsTester_Summary_slice.txt'
folder = 'RESULTS-SLICE/'
locexist = False
cwd = os.getcwd()
......@@ -78,7 +81,7 @@ def _parse_args() -> argparse.Namespace:
'--type',
action='store',
required=True,
choices=['mini', 'basic'],
choices=['mini', 'basic', 'slice'],
help='Type of function',
)
return parser.parse_args()
......
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