diff --git a/ci-scripts/Jenkinsfile-GitLab-Docker b/ci-scripts/Jenkinsfile-GitLab-Docker index cd0a3da349a799198ddb08827ff34f20511780cf..1839cce213af4c1e9d7284b25a0b08eef0bf9399 100644 --- a/ci-scripts/Jenkinsfile-GitLab-Docker +++ b/ci-scripts/Jenkinsfile-GitLab-Docker @@ -38,9 +38,6 @@ def cn_ci_host = params.Host_CN_CI_Server def cn_ci_resource = params.DockerContainers def ds_tester_ci_resource = params.DsTester -// Location of the DsTester workspace -def dsTestFrameworkLocation = params.dsTestFrameworkLocation - // When triggered by upstream, specify which tag to use def upstreamTagToUse = params.upstreamTagToUse @@ -238,16 +235,10 @@ pipeline { stage ('Deploy Whole 5G Core Network') { steps { script { - echo '\u2705 \u001B[32mDeploy CN5G in idle mode\u001B[0m' + echo '\u2705 \u001B[32mDeploy CN5G using Docker-Compose\u001B[0m' // Prepare all needed files for docker-compose // First put all correct tags to test sh 'sed -e "s#NRF_IMAGE_TAG#' + nrfTag + '#" -e "s#AMF_IMAGE_TAG#' + amfTag + '#" -e "s#SMF_IMAGE_TAG#' + smfTag + '#" -e "s#SPGWU_IMAGE_TAG#' + spgwuTag + '#" ci-scripts/dsTesterDockerCompose/docker-compose.tplt > ci-scripts/dsTesterDockerCompose/docker-compose.yml' - // Entrypoints are modified to be inactive for dsTester framework - sh 'sed -e "s@exec.*@sleep infinity@" component/oai-nrf/scripts/entrypoint.sh > ci-scripts/dsTesterDockerCompose/nrf-entrypoint-sleep.sh' - sh 'sed -e "s@exec.*@sleep infinity@" component/oai-amf/scripts/entrypoint.sh > ci-scripts/dsTesterDockerCompose/amf-entrypoint-sleep.sh' - sh 'sed -e "s@exec.*@sleep infinity@" component/oai-smf/scripts/entrypoint.sh > ci-scripts/dsTesterDockerCompose/smf-entrypoint-sleep.sh' - sh 'sed -e "s@exec.*@sleep infinity@" component/oai-upf-equivalent/scripts/entrypoint.sh > ci-scripts/dsTesterDockerCompose/upf-entrypoint-sleep.sh' - sh 'chmod 775 ci-scripts/dsTesterDockerCompose/*entrypoint-sleep.sh' dir('ci-scripts/dsTesterDockerCompose') { sh 'docker-compose up -d > ../../archives/compose_5gcn_up.log 2>&1' sh 'sleep 100' @@ -273,25 +264,25 @@ pipeline { } // Do docker logs to recover the configuration results try { - sh 'docker logs cicd-oai-nrf > archives/nrf_config.log 2>&1' + //sh 'docker logs cicd-oai-nrf > archives/nrf_config.log 2>&1' sh 'docker inspect --format=\'STATUS: {{.State.Health.Status}}\' cicd-oai-nrf >> archives/nrf_config.log' } catch (Exception e) { sh 'echo "STATUS: KO" >> archives/nrf_config.log' } try { - sh 'docker logs cicd-oai-amf > archives/amf_config.log 2>&1' + //sh 'docker logs cicd-oai-amf > archives/amf_config.log 2>&1' sh 'docker inspect --format=\'STATUS: {{.State.Health.Status}}\' cicd-oai-amf >> archives/amf_config.log' } catch (Exception e) { sh 'echo "STATUS: KO" >> archives/amf_config.log' } try { - sh 'docker logs cicd-oai-smf > archives/smf_config.log 2>&1' + //sh 'docker logs cicd-oai-smf > archives/smf_config.log 2>&1' sh 'docker inspect --format=\'STATUS: {{.State.Health.Status}}\' cicd-oai-smf >> archives/smf_config.log' } catch (Exception e) { sh 'echo "STATUS: OK" >> archives/smf_config.log' } try { - sh 'docker logs cicd-oai-upf > archives/spgwu_config.log 2>&1' + //sh 'docker logs cicd-oai-upf > archives/spgwu_config.log 2>&1' sh 'docker inspect --format=\'STATUS: {{.State.Health.Status}}\' cicd-oai-upf >> archives/spgwu_config.log' } catch (Exception e) { sh 'echo "STATUS: KO" >> archives/spgwu_config.log' @@ -315,12 +306,27 @@ pipeline { steps { lock (ds_tester_ci_resource) { script { - sh 'cd ' + dsTestFrameworkLocation + ' && git clean -x -d -f > /dev/null' - sh 'cd ' + dsTestFrameworkLocation + '/scripts && export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:.:/usr/local/devsol/bin && CI_ENV=True SRC_BASE_DIR=' + WORKSPACE + ' ./run-5gc.bash -pt --shark --detach --get-results --5g --pcap-test > ' + WORKSPACE + '/archives/run-5g-dstester.log 2>&1' - sh 'cd ' + dsTestFrameworkLocation + ' && git stash > /dev/null' - sh 'cd ' + dsTestFrameworkLocation + ' && git stash clear > /dev/null' - sh 'cd ' + WORKSPACE + ' && python3 ./ci-scripts/toCheckDSTesterResult.py' - } + echo '\u2705 \u001B[32mTesting with DS Tester\u001B[0m' + 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 develop >> ../git_clone.log 2>&1" + try { + sh "python3 jenkins/dogmatix-agent.py -f jenkins/suit-docker-compose.yaml | tee ../DS-TEST-RESULTS/dsTester_Summary.txt" + } catch (Exception e) { + currentBuild.result = 'FAILURE' + echo "dsTester Running FAILED" + } + } + } + sh "python3 ./ci-scripts/toCheckDSTesterResult1.py" + } } } } @@ -343,10 +349,10 @@ pipeline { sh 'docker-compose down > ../../archives/compose_l_down.log 2>&1' } // Generating the HTML report - sh 'python3 ./ci-scripts/dsTestGenerateHTMLReport.py --job_name=' + JOB_NAME + ' --job_id=' + BUILD_ID + ' --job_url=' + BUILD_URL + sh 'python3 ./ci-scripts/dsTestGenerateHTMLReport2.py --job_name=' + JOB_NAME + ' --job_id=' + BUILD_ID + ' --job_url=' + BUILD_URL // Zipping all archived log files - sh "zip -r -qq cn5g_fed_docker_logs.zip archives DS-TEST-RESULTS/*.tar DS-TEST-RESULTS/status.txt" + sh "zip -r -qq cn5g_fed_docker_logs.zip archives DS-TEST-RESULTS" if (fileExists('cn5g_fed_docker_logs.zip')) { archiveArtifacts artifacts: 'cn5g_fed_docker_logs.zip' } diff --git a/ci-scripts/dsTestGenerateHTMLReport2.py b/ci-scripts/dsTestGenerateHTMLReport2.py new file mode 100644 index 0000000000000000000000000000000000000000..eb18279b000a39089672fc8f50afd698e8af80f0 --- /dev/null +++ b/ci-scripts/dsTestGenerateHTMLReport2.py @@ -0,0 +1,320 @@ +#/* +# * 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 +import subprocess +import yaml + +class HtmlReport(): + def __init__(self): + self.job_name = '' + self.job_id = '' + self.job_url = '' + self.job_start_time = 'TEMPLATE_TIME' + + def generate(self): + cwd = os.getcwd() + self.file = open(cwd + '/test_results_oai_cn5g.html', 'w') + self.generateHeader() + self.deploymentSummaryHeader() + finalStatus = self.testSummaryHeader() + self.testSummaryDetails() + self.testSummaryFooter() + + self.generateFooter() + self.file.close() + + if finalStatus: + sys.exit(0) + else: + print("DS-TESTER testing FAILED") + + def generateHeader(self): + # HTML Header + self.file.write('<!DOCTYPE html>\n') + self.file.write('<html class="no-js" lang="en-US">\n') + self.file.write('<head>\n') + self.file.write(' <meta name="viewport" content="width=device-width, initial-scale=1">\n') + self.file.write(' <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">\n') + self.file.write(' <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>\n') + self.file.write(' <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>\n') + self.file.write(' <title>OAI 5G Core Network Test Results for ' + self.job_name + ' job build #' + self.job_id + '</title>\n') + self.file.write('</head>\n') + self.file.write('<body><div class="container">\n') + self.file.write(' <table width = "100%" style="border-collapse: collapse; border: none;">\n') + self.file.write(' <tr style="border-collapse: collapse; border: none;">\n') + self.file.write(' <td style="border-collapse: collapse; border: none;">\n') + self.file.write(' <a href="http://www.openairinterface.org/">\n') + self.file.write(' <img src="http://www.openairinterface.org/wp-content/uploads/2016/03/cropped-oai_final_logo2.png" alt="" border="none" height=50 width=150>\n') + self.file.write(' </img>\n') + self.file.write(' </a>\n') + self.file.write(' </td>\n') + self.file.write(' <td style="border-collapse: collapse; border: none; vertical-align: center;">\n') + self.file.write(' <b><font size = "6">Job Summary -- Job: ' + self.job_name + ' -- Build-ID: <a href="' + self.job_url + '">' + self.job_id + '</a></font></b>\n') + self.file.write(' </td>\n') + self.file.write(' </tr>\n') + self.file.write(' </table>\n') + self.file.write(' <br>\n') + + def generateFooter(self): + self.file.write(' <div class="well well-lg">End of Test Report -- Copyright <span class="glyphicon glyphicon-copyright-mark"></span> 2020 <a href="http://www.openairinterface.org/">OpenAirInterface</a>. All Rights Reserved.</div>\n') + self.file.write('</div></body>\n') + self.file.write('</html>\n') + + def deploymentSummaryHeader(self): + self.file.write(' <h2>Deployment Summary</h2>\n') + cwd = os.getcwd() + if os.path.isfile(cwd + '/archives/deployment_status.log'): + cmd = 'egrep -c "DEPLOYMENT: OK" archives/deployment_status.log || true' + status = False + ret = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, encoding='utf-8') + if ret.stdout is not None: + if ret.stdout.strip() == '1': + status = True + if status: + self.file.write(' <div class="alert alert-success">\n') + self.file.write(' <strong>Successful Deployment! <span class="glyphicon glyphicon-warning-sign"></span></strong>\n') + self.file.write(' </div>\n') + else: + self.file.write(' <div class="alert alert-danger">\n') + self.file.write(' <strong>Failed Deployment! <span class="glyphicon glyphicon-warning-sign"></span></strong>\n') + self.file.write(' </div>\n') + else: + self.file.write(' <div class="alert alert-warning">\n') + self.file.write(' <strong>LogFile not available! <span class="glyphicon glyphicon-warning-sign"></span></strong>\n') + self.file.write(' </div>\n') + self.file.write(' <br>\n') + self.file.write(' <button data-toggle="collapse" data-target="#deployment-details">More details on Deployment</button>\n') + self.file.write(' <br>\n') + self.file.write(' <div id="deployment-details" class="collapse">\n') + self.file.write(' <br>\n') + self.file.write(' <table class="table-bordered" width = "80%" align = "center" border = 1>\n') + self.file.write(' <tr bgcolor = "#33CCFF" >\n') + self.file.write(' <th>Container Name</th>\n') + self.file.write(' <th>Used Image Tag</th>\n') + self.file.write(' <th>Image Creation Date</th>\n') + self.file.write(' <th>Used Image Size</th>\n') + 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') + self.file.write(' </table>\n') + self.file.write(' </div>\n') + + def addImageRow(self, imageInfoPrefix): + cwd = os.getcwd() + if imageInfoPrefix == 'oai_amf': + containerName = 'oai-amf' + tagPattern = 'OAI_AMF_TAG' + statusPrefix = 'amf' + if imageInfoPrefix == 'oai_smf': + containerName = 'oai-smf' + tagPattern = 'OAI_SMF_TAG' + statusPrefix = 'smf' + if imageInfoPrefix == 'oai_nrf': + containerName = 'oai-nrf' + tagPattern = 'OAI_NRF_TAG' + statusPrefix = 'nrf' + if imageInfoPrefix == 'oai_spgwu': + containerName = 'oai-spgwu-tiny' + tagPattern = 'OAI_SPGWU_TAG' + statusPrefix = 'spgwu' + if imageInfoPrefix == 'mysql': + containerName = imageInfoPrefix + tagPattern = 'N/A' + if os.path.isfile(cwd + '/archives/' + imageInfoPrefix + '_image_info.log'): + usedTag = '' + createDate = '' + size = '' + with open(cwd + '/archives/' + imageInfoPrefix + '_image_info.log') as imageLog: + for line in imageLog: + line = line.strip() + result = re.search(tagPattern + ': (?P<tag>[a-zA-Z0-9\-\_:]+)', line) + if result is not None: + usedTag = result.group('tag') + result = re.search('Date = (?P<date>[a-zA-Z0-9\-\_:]+)', line) + if result is not None: + createDate = result.group('date') + result = re.search('Size = (?P<size>[0-9]+) bytes', line) + if result is not None: + sizeInt = int(result.group('size')) + if sizeInt < 1000000: + sizeInt = int(sizeInt / 1000) + size = str(sizeInt) + ' kB' + else: + sizeInt = int(sizeInt / 1000000) + size = str(sizeInt) + ' MB' + imageLog.close() + configState = 'KO' + cmd = 'egrep -c "STATUS: healthy" archives/' + statusPrefix + '_config.log || true' + ret = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, encoding='utf-8') + if ret.stdout is not None: + if ret.stdout.strip() == '1': + configState = 'OK' + self.file.write(' <tr>\n') + self.file.write(' <td>' + containerName + '</td>\n') + self.file.write(' <td>' + usedTag + '</td>\n') + self.file.write(' <td>' + createDate + '</td>\n') + self.file.write(' <td>' + size + '</td>\n') + if configState == 'OK': + self.file.write(' <td bgcolor = "DarkGreen"><b><font color="white">' + configState + '</font></b></td>\n') + else: + self.file.write(' <td bgcolor = "Red"><b><font color="white">' + configState + '</font></b></td>\n') + self.file.write(' </tr>\n') + else: + if imageInfoPrefix == 'mysql': + self.file.write(' <tr>\n') + self.file.write(' <td>' + containerName + '</td>\n') + self.file.write(' <td>mysql:5.7</td>\n') + self.file.write(' <td>N/A</td>\n') + self.file.write(' <td>449MB</td>\n') + configState = 'KO' + cmd = 'egrep -c "STATUS: healthy" archives/mysql_status.log || true' + ret = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, encoding='utf-8') + if ret.stdout is not None: + if ret.stdout.strip() == '1': + configState = 'OK' + if configState == 'OK': + self.file.write(' <td bgcolor = "DarkGreen"><b><font color="white">OK</font></b></td>\n') + else: + self.file.write(' <td bgcolor = "Red"><b><font color="white">KO</font></b></td>\n') + self.file.write(' </tr>\n') + else: + self.file.write(' <tr>\n') + self.file.write(' <td>' + containerName + '</td>\n') + self.file.write(' <td>UNKNOWN</td>\n') + self.file.write(' <td>N/A</td>\n') + self.file.write(' <td>N/A</td>\n') + self.file.write(' <td bgcolor = "DarkOrange"><b><font color="white">UNKNOW</font></b></td>\n') + self.file.write(' </tr>\n') + + def testSummaryHeader(self): + self.file.write(' <h2>DS Tester Summary</h2>\n') + cwd = os.getcwd() + finalStatusOK = False + if os.path.isfile(cwd + '/DS-TEST-RESULTS/5gcn.yaml'): + cmd = f'egrep -c "final-result: pass" DS-TEST-RESULTS/5gcn.yaml || true' + ret = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, encoding='utf-8') + if ret.stdout is not None: + if ret.stdout.strip() == '1': + finalStatusOK = True + if finalStatusOK: + self.file.write(' <div class="alert alert-success">\n') + self.file.write(' <strong>Successful DsTester suite! <span class="glyphicon glyphicon-warning-sign"></span></strong>\n') + self.file.write(' </div>\n') + else: + self.file.write(' <div class="alert alert-danger">\n') + self.file.write(' <strong>Failed DsTester suite! <span class="glyphicon glyphicon-warning-sign"></span></strong>\n') + self.file.write(' </div>\n') + else: + self.file.write(' <div class="alert alert-warning">\n') + self.file.write(' <strong>LogFile not available! <span class="glyphicon glyphicon-warning-sign"></span></strong>\n') + self.file.write(' </div>\n') + return finalStatusOK + + def testSummaryFooter(self): + self.file.write(' <br>\n') + + def testSummaryDetails(self): + self.file.write(' <br>\n') + self.file.write(' <button data-toggle="collapse" data-target="#ds-tester-details">More details on DsTester results</button>\n') + self.file.write(' <div id="ds-tester-details" class="collapse">\n') + self.file.write(' <table class="table-bordered" width = "60%" align = "center" border = 1>\n') + self.file.write(' <tr bgcolor = "#33CCFF" >\n') + self.file.write(' <th>Test Name</th>\n') + self.file.write(' <th>Test Status</th>\n') + self.file.write(' <th>Test Details</th>\n') + self.file.write(' </tr>\n') + cwd = os.getcwd() + if os.path.isfile(cwd + '/DS-TEST-RESULTS/5gcn.yaml'): + with open(cwd + '/DS-TEST-RESULTS/5gcn.yaml') as f: + data = yaml.load(f) + nScenarios = len(data['scenarios']) + for scenario in range(nScenarios): + self.file.write(' <tr>\n') + self.file.write(' <td>' + data['scenarios'][scenario]['name'] + '</td>\n') + if data['scenarios'][scenario]['result'] == 'fail': + self.file.write(' <td bgcolor = "Red"><b><font color="white">KO</font></b></td>\n') + elif data['scenarios'][scenario]['result'] == 'pass': + self.file.write(' <td bgcolor = "DarkGreen"><b><font color="white">OK</font></b></td>\n') + else: + self.file.write(' <td bgcolor = "DarkOrange"><b><font color="white">UNKNOW</font></b></td>\n') + testDetails = '' + for x,y in data['scenarios'][scenario]['conditions'].items(): + testDetails += str(x) + ': ' + str(y) + '\n' + #details += '\n' + self.file.write(' <td><pre>' + testDetails + '</pre></td>\n') + self.file.write(' </tr>\n') + else: + print ('no details???') + self.file.write(' </table>\n') + self.file.write(' </div>\n') + +def Usage(): + print('----------------------------------------------------------------------------------------------------------------------') + print('dsTestGenerateHTMLReport.py') + print(' Generate an HTML report for the Jenkins pipeline on oai-cn5g-fed.') + print('----------------------------------------------------------------------------------------------------------------------') + print('Usage: python3 generateHtmlReport.py [options]') + print(' --help Show this help.') + print('---------------------------------------------------------------------------------------------- Mandatory Options -----') + print(' --job_name=[Jenkins Job name]') + print(' --job_id=[Jenkins Job Build ID]') + print(' --job_url=[Jenkins Job Build URL]') + +#-------------------------------------------------------------------------------------------------------- +# +# Start of main +# +#-------------------------------------------------------------------------------------------------------- + +argvs = sys.argv +argc = len(argvs) + +HTML = HtmlReport() + +while len(argvs) > 1: + myArgv = argvs.pop(1) + if re.match('^\-\-help$', myArgv, re.IGNORECASE): + Usage() + sys.exit(0) + elif re.match('^\-\-job_name=(.+)$', myArgv, re.IGNORECASE): + matchReg = re.match('^\-\-job_name=(.+)$', myArgv, re.IGNORECASE) + HTML.job_name = matchReg.group(1) + elif re.match('^\-\-job_id=(.+)$', myArgv, re.IGNORECASE): + matchReg = re.match('^\-\-job_id=(.+)$', myArgv, re.IGNORECASE) + HTML.job_id = matchReg.group(1) + elif re.match('^\-\-job_url=(.+)$', myArgv, re.IGNORECASE): + matchReg = re.match('^\-\-job_url=(.+)$', myArgv, re.IGNORECASE) + HTML.job_url = matchReg.group(1) + else: + sys.exit('Invalid Parameter: ' + myArgv) + +if HTML.job_name == '' or HTML.job_id == '' or HTML.job_url == '': + sys.exit('Missing Parameter in job description') + +HTML.generate() diff --git a/ci-scripts/dsTesterDockerCompose/docker-compose.tplt b/ci-scripts/dsTesterDockerCompose/docker-compose.tplt index b675cef6e973ce6b91b0b122911fd4e2844da39c..51774c70aaff9356e0ada4afa21d835c2d2effcb 100644 --- a/ci-scripts/dsTesterDockerCompose/docker-compose.tplt +++ b/ci-scripts/dsTesterDockerCompose/docker-compose.tplt @@ -41,9 +41,7 @@ services: cicd_public_net: ipv4_address: 192.168.61.195 volumes: - - ./nrf-entrypoint-sleep.sh:/openair-nrf/bin/nrf-entrypoint-sleep.sh - ./nrf-healthy-check.sh:/openair-nrf/bin/nrf-healthy-check.sh - entrypoint: /bin/bash -c "/openair-nrf/bin/nrf-entrypoint-sleep.sh" healthcheck: test: /bin/bash -c "/openair-nrf/bin/nrf-healthy-check.sh" interval: 10s @@ -108,9 +106,7 @@ services: cicd_public_net: ipv4_address: 192.168.61.196 volumes: - - ./amf-entrypoint-sleep.sh:/openair-amf/bin/amf-entrypoint-sleep.sh - ./amf-healthy-check.sh:/openair-amf/bin/amf-healthy-check.sh - entrypoint: /bin/bash -c "/openair-amf/bin/amf-entrypoint-sleep.sh" healthcheck: test: /bin/bash -c "/openair-amf/bin/amf-healthy-check.sh" interval: 10s @@ -153,9 +149,7 @@ services: cicd_public_net: ipv4_address: 192.168.61.197 volumes: - - ./smf-entrypoint-sleep.sh:/oai-cn5g-smf/bin/smf-entrypoint-sleep.sh - ./smf-healthy-check.sh:/oai-cn5g-smf/bin/smf-healthy-check.sh - entrypoint: /bin/bash -c "/oai-cn5g-smf/bin/smf-entrypoint-sleep.sh" healthcheck: test: /bin/bash -c "/oai-cn5g-smf/bin/smf-healthy-check.sh" interval: 10s @@ -207,9 +201,7 @@ services: cicd_public_net: ipv4_address: 192.168.61.198 volumes: - - ./upf-entrypoint-sleep.sh:/openair-spgwu-tiny/bin/upf-entrypoint-sleep.sh - ./upf-healthy-check.sh:/openair-spgwu-tiny/bin/upf-healthy-check.sh - entrypoint: /bin/bash -c "/openair-spgwu-tiny/bin/upf-entrypoint-sleep.sh" healthcheck: test: /bin/bash -c "/openair-spgwu-tiny/bin/upf-healthy-check.sh" interval: 10s diff --git a/ci-scripts/toCheckDSTesterResult1.py b/ci-scripts/toCheckDSTesterResult1.py new file mode 100644 index 0000000000000000000000000000000000000000..27701b8f69bfe2d9b4394730f6b70475acea8020 --- /dev/null +++ b/ci-scripts/toCheckDSTesterResult1.py @@ -0,0 +1,51 @@ +#/* +# * 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 re +import sys +import subprocess +import yaml +import os +import time + +locexist = False +cwd = os.getcwd() +try: + with open(cwd + '/DS-TEST-RESULTS/dsTester_Summary.txt') as f: + for line in f: + if re.search('Result file is available here', str(line)): + result = re.search('(?:\/.+?\/)(.+?)(?:\/.+)', str(line)) + if result: + result1 = re.search('^(.*/)([^/]*)$', str(result.group(0))) + subprocess.check_output(f'cp {result1.group(1)}* DS-TEST-RESULTS/', stderr=subprocess.STDOUT, shell=True, universal_newlines=True) + locexist = True +except IOError: + sys.exit("File not accessible to check DSTester Summary: DS-TEST-RESULTS/dsTester_Summary.txt") + +if locexist: + try: + with open(cwd + '/DS-TEST-RESULTS/5gcn.yaml') as f: + data = yaml.load(f) + if data["final-result"] == 'fail': + sys.exit('DsTester final result FAILED') + except IOError: + sys.exit("File not accessible to check DSTester result: DS-TEST-RESULTS/5gcn.yaml") \ No newline at end of file