Commit 20f6ebef authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Merge branch 'develop' into n2_handover

parents 5f499912 025c481c
......@@ -128,6 +128,7 @@ check_supported_distribution() {
local distribution=$(get_distribution_release)
case "$distribution" in
"ubuntu18.04") return 0 ;;
"ubuntu20.04") return 0 ;;
"rhel8") return 0 ;;
"rhel8.2") return 0 ;;
"rhel8.3") return 0 ;;
......
......@@ -300,6 +300,7 @@ check_install_amf_deps(){
doxygen \
flex \
gdb \
wget \
git"
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
PACKAGE_LIST="\
......@@ -324,6 +325,18 @@ check_install_amf_deps(){
if [[ $OS_DISTRO == "ubuntu" ]]; then
case "$(get_distribution_release)" in
"ubuntu18.04")
# Currently Ubuntu18.04 has boost 1.65 as the latest
# We need at least 1.66
# PPA has 1.67
$SUDO add-apt-repository ppa:mhier/libboost-latest --yes
$SUDO $INSTALLER update
if [ $IS_CONTAINER -eq 0 ]; then
specific_packages="libconfig++-dev libasio-dev libboost-all-dev mysql-server"
else
specific_packages="libconfig++-dev"
fi
;;
*)
if [ $IS_CONTAINER -eq 0 ]; then
specific_packages="libconfig++-dev libasio-dev libboost-all-dev mysql-server"
else
......@@ -334,10 +347,10 @@ check_install_amf_deps(){
# removed libspdlog-dev
PACKAGE_LIST="\
$specific_packages \
libboost1.67-dev \
mysql-server \
mysql-client \
libmysqlclient-dev \
libcpprest-dev \
guile-2.0-dev \
libcurl4-gnutls-dev \
libevent-dev \
......@@ -359,6 +372,7 @@ check_install_amf_deps(){
net-tools \
pkg-config \
ninja-build \
wget \
libasan2"
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
PACKAGE_LIST="\
......@@ -396,8 +410,8 @@ check_install_amf_deps(){
ret=$?;[[ $ret -ne 0 ]] && return $ret
# Use fmt lib included in spdlog
install_fmt $1
ret=$?;[[ $ret -ne 0 ]] && return $ret
# install_fmt $1
# ret=$?;[[ $ret -ne 0 ]] && return $ret
install_spdlog_from_git $1 $2
ret=$?;[[ $ret -ne 0 ]] && return $ret
......
......@@ -34,23 +34,30 @@ AMF_CONF[@SD_0@]='123'
AMF_CONF[@SST_1@]='1'
AMF_CONF[@SD_1@]='12'
AMF_CONF[@AMF_INTERFACE_NAME_FOR_NGAP@]='enx0050b6f4ba5b'
AMF_CONF[@AMF_INTERFACE_NAME_FOR_N11@]='enx0050b6f4ba5b'
AMF_CONF[@AMF_INTERFACE_NAME_FOR_NGAP@]='wlo1'
AMF_CONF[@AMF_INTERFACE_NAME_FOR_N11@]='wlo1'
AMF_CONF[@NF_REGISTRATION@]='no'
AMF_CONF[@SMF_SELECTION@]='no'
AMF_CONF[@SMF_INSTANCE_ID_0@]='1'
AMF_CONF[@SMF_IPV4_ADDR_0@]='192.168.122.1'
AMF_CONF[@SMF_HTTP_VERSION_0@]='v1'
AMF_CONF[@SMF_FQDN_0@]='localhost'
AMF_CONF[@SMF_INSTANCE_ID_1@]='2'
AMF_CONF[@SMF_IPV4_ADDR_1@]='192.168.122.2'
AMF_CONF[@SMF_HTTP_VERSION_1@]='v1'
AMF_CONF[@SMF_FQDN_1@]='localhost'
AMF_CONF[@NRF_IPV4_ADDRESS@]='192.168.1.23'
AMF_CONF[@NRF_PORT@]='80'
AMF_CONF[@NRF_API_VERSION@]='v1'
AMF_CONF[@NRF_FQDN@]='localhost'
AMF_CONF[@AUSF_IPV4_ADDRESS@]='192.168.1.23'
AMF_CONF[@AUSF_PORT@]='80'
AMF_CONF[@AUSF_API_VERSION@]='v1'
AMF_CONF[@AUSF_FQDN@]='localhost'
AMF_CONF[@MYSQL_SERVER@]='127.0.0.1'
AMF_CONF[@MYSQL_USER@]='root'
......
#!/bin/groovy
/*
* 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
*/
//-------------------------------------------------------------------------------
// Location of the CN executor node
def cn_ci_host = params.Host_CN_CI_Server
// for lock
def cn_ci_resource = params.DockerContainers
def ds_tester_ci_resource = params.DsTester
// Location of the 2nd CN executor
def new_host_flag = false
def new_host = ""
def new_host_user = ""
// Location of the CN tester
def dsT_host_flag = false
def dsT_host = ""
def dsT_host_user = ""
def dsT_host_ip_addr = ""
// Flags
def scmEvent = false
def upstreamEvent = false
def deployed = true
// Default tag --> could be passed on by upstream job or by PR content
def amfTag = params.amfTag
//-------------------------------------------------------------------------------
// Pipeline start
pipeline {
agent {
label cn_ci_host
}
options {
disableConcurrentBuilds()
timestamps()
ansiColor('xterm')
lock(cn_ci_resource)
}
stages {
stage ('Verify Parameters') {
steps {
script {
echo '\u2705 \u001B[32mVerify Parameters\u001B[0m'
JOB_TIMESTAMP = sh returnStdout: true, script: 'date --utc --rfc-3339=seconds | sed -e "s#+00:00##"'
JOB_TIMESTAMP = JOB_TIMESTAMP.trim()
if (params.Host_CN_CI_2nd_Server_Flag != null) {
new_host_flag = params.Host_CN_CI_2nd_Server_Flag
if (new_host_flag) {
new_host = params.Host_CN_CI_2nd_Server
new_host_user = params.Host_CN_CI_2nd_Server_Login
echo "1st Node is ${NODE_NAME}"
echo "2nd Node is ${new_host}"
} else {
echo "Node is ${NODE_NAME}"
}
} else {
echo "Node is ${NODE_NAME}"
}
if (params.DS_Tester_Server_Flag != null) {
dsT_host_flag = params.DS_Tester_Server_Flag
if (dsT_host_flag) {
def allParametersPresent = true
if (params.DS_Tester_Server_Name == null) {
allParametersPresent = false
} else {
dsT_host = params.DS_Tester_Server_Name
}
if (params.DS_Tester_Server_Login == null) {
allParametersPresent = false
} else {
dsT_host_user = params.DS_Tester_Server_Login
}
if (params.DS_Tester_Server_IP_Addr == null) {
allParametersPresent = false
} else {
dsT_host_ip_addr = params.DS_Tester_Server_IP_Addr
}
if (allParametersPresent) {
echo "DS Tester is on ${dsT_host}"
} else {
echo "Some DS Tester parameters are missing!"
sh "./ci-scripts/fail.sh"
}
}
}
// Find out the cause of the trigger
for (cause in currentBuild.getBuildCauses()) {
if (cause.toString() ==~ /.*UpstreamCause.*/) {
upstreamEvent = true
//} else {
// scmEvent = true
}
}
if (upstreamEvent) {
if (params.AMF_TAG != null) {
amfTag = params.AMF_TAG
echo "Upstream Job passed AMF_TAG to use: ${amfTag}"
}
sh "git clean -x -d -f > /dev/null 2>&1"
sh "git fetch --prune > /dev/null 2>&1"
}
sh "mkdir -p archives DS-TEST-RESULTS"
// Verify that the images are available
try {
sh 'echo "OAI_AMF_TAG: oai-amf:' + amfTag +'" > archives/oai_amf_image_info.log'
sh 'docker image inspect --format=\'Size = {{.Size}} bytes\' oai-amf:' + amfTag + ' >> archives/oai_amf_image_info.log'
sh 'docker image inspect --format=\'Date = {{.Created}}\' oai-amf:' + amfTag + ' >> archives/oai_amf_image_info.log'
} catch (Exception e) {
error "OAI AMF Image tag to test does not exist!"
}
}
}
}
stage ('Deploy AMF-U18') {
steps {
script {
echo '\u2705 \u001B[32mDeploy AMF using Docker-Compose\u001B[0m'
// Prepare all needed files for docker-compose
// First put all correct tags to test
sh 'sed -e "s#AMF_IMAGE_TAG#' + amfTag + '#" ci-scripts/dsTesterDockerCompose/docker-compose.tplt > ci-scripts/dsTesterDockerCompose/docker-compose.yml'
dir('ci-scripts/dsTesterDockerCompose') {
sh 'docker-compose up -d > ../../archives/compose_amf_up.log 2>&1'
sh 'sleep 60'
// Do a check on number of healthy containers
// 2 == mysql + amf
ret = sh returnStdout: true, script: 'docker-compose ps -a | grep -v unhealthy | grep -c healthy || true'
ret = ret.trim()
if (ret != '2') {
error "Deployment went wrong!"
}
}
}
}
post {
always {
script {
// Check status on mysql.
try {
sh 'docker exec cicd-mysql-svr /bin/bash -c "mysqladmin -u root --password=linux ping" > archives/mysql_status.log 2>&1'
sh 'docker inspect --format=\'STATUS: {{.State.Health.Status}}\' cicd-mysql-svr >> archives/mysql_status.log'
} catch (Exception e) {
sh 'echo "STATUS: KO" >> archives/mysql_status.log'
}
// Do docker logs to recover the configuration results
try {
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'
}
}
}
success {
script {
sh 'echo "DEPLOYMENT: OK" > archives/deployment_status.log'
sh 'python3 ./ci-scripts/routeCheck.py --mode=Add --userName=' + dsT_host_user + ' --hostName=' + dsT_host
}
}
unsuccessful {
script {
sh 'echo "DEPLOYMENT: KO" > archives/deployment_status.log'
deployed = false
}
}
}
}
stage ('Bracket Testing with dsTester') {
when { expression {dsT_host_flag} }
steps {
lock (ds_tester_ci_resource) {
script {
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 edge >> ../git_clone.log 2>&1"
dir ('jenkins') {
try {
sh "python3 ./dogmatix-agent.py -f ./suits/dc/amf-bracket.yaml -d true | tee ../../DS-TEST-RESULTS/dsTester_Summary.txt"
} catch (Exception e) {
currentBuild.result = 'FAILURE'
echo "dsTester Running FAILED"
}
}
}
}
sh "python3 ./ci-scripts/toCheckDSTesterResult.py"
}
}
}
post {
always {
script {
// Copy the pcap and log from the container
sh "mkdir -p archives/pcaps archives/logs"
try {
sh 'docker cp cicd-oai-amf:/tmp/amf.pcap archives/pcaps/oai_amf.pcap'
sh 'docker cp cicd-oai-amf:/tmp/amf.log archives/logs/oai_amf.log'
} catch (Exception e) {
sh 'echo "Error in copying pcap & log from the container"'
}
}
}
}
}
stage ('Undeploy AMF') {
steps {
script {
echo '\u2705 \u001B[32mUn-Deploy AMF\u001B[0m'
sh 'python3 ./ci-scripts/routeCheck.py --mode=Delete --userName=' + dsT_host_user + ' --hostName=' + dsT_host
dir('ci-scripts/dsTesterDockerCompose') {
sh 'docker-compose down > ../../archives/compose_normal_down.log 2>&1'
}
}
}
}
}
post {
always {
script {
// Get logs if deployment fails
if (deployed != true) {
sh 'mkdir -p archives/logs'
sh 'docker logs cicd-oai-amf > archives/logs/oai_amf.log'
}
// Remove any leftover containers/networks
sh 'python3 ./ci-scripts/routeCheck.py --mode=Delete --userName=' + dsT_host_user + ' --hostName=' + dsT_host
dir('ci-scripts/dsTesterDockerCompose') {
sh 'docker-compose down > ../../archives/compose_l_down.log 2>&1'
}
// Generating the HTML report
sh 'python3 ./ci-scripts/bracketTestHTMLReport.py --job_name=' + JOB_NAME + ' --job_id=' + BUILD_ID + ' --job_url=' + BUILD_URL
// Zipping all archived log files
sh "zip -r -qq cn5g_amf_docker_logs.zip archives DS-TEST-RESULTS"
if (fileExists('cn5g_amf_docker_logs.zip')) {
archiveArtifacts artifacts: 'cn5g_amf_docker_logs.zip'
}
if (fileExists('test_results_oai_amf_bt.html')) {
archiveArtifacts artifacts: 'test_results_oai_amf_bt.html'
}
}
}
}
}
......@@ -121,7 +121,8 @@ pipeline {
script {
sh "git clean -x -d -f > /dev/null 2>&1"
if ("MERGE".equals(env.gitlabActionType)) {
gitlabMergeRequestLink = sh "curl --silent \"https://gitlab.eurecom.fr/api/v4/projects/oai%2Fcn5g%2Foai-cn5g-amf/merge_requests/${env.gitlabMergeRequestIid}\" | jq .web_url | sed 's#\"##g'"
gitlabMergeRequestLink = sh returnStdout: true, script: "curl --silent 'https://gitlab.eurecom.fr/api/v4/projects/oai%2Fcn5g%2Foai-cn5g-amf/merge_requests/${env.gitlabMergeRequestIid}' | jq .web_url | sed 's#\"##g'"
gitlabMergeRequestLink = gitlabMergeRequestLink.trim()
echo "========= THIS IS A MERGE REQUEST =========="
echo "MR ID is ${env.gitlabMergeRequestIid}"
echo "MR LINK is ${gitlabMergeRequestLink}"
......@@ -337,10 +338,41 @@ pipeline {
}
}
}
stage ('Testing in CN-5G-FED environment') {
stage ('Bracket Testing with DsTester') {
steps {
script {
gitlabCommitStatus(name: "Test with DsTester") {
gitlabCommitStatus(name: "Bracket Test with DsTester") {
localStatus = build job: params.AMF_BT_PipelineName,
parameters: [
string(name: 'AMF_TAG', value: String.valueOf(amf_tag))
], propagate: false
localResult = localStatus.getResult()
if (localStatus.resultIsBetterOrEqualTo('SUCCESS')) {
echo "Bracket Test Job is OK"
} else {
echo "Bracket Test Job is KO"
sh "ci-scripts/fail.sh"
}
}
}
}
post {
always {
script {
copyArtifacts(projectName: params.AMF_BT_PipelineName,
filter: '*_results_oai_amf_bt.html',
selector: lastCompleted())
}
}
}
}
stage('Testing whole 5g Core Network Functions') {
parallel {
stage ('Testing in CN-5G-FED Docker environment') {
steps {
script {
gitlabCommitStatus(name: "Test with DsTester on Docker environment") {
localStatus = build job: params.CN5G_FED_PipelineName,
parameters: [
string(name: 'AMF_TAG', value: String.valueOf(amf_tag)),
......@@ -349,9 +381,9 @@ pipeline {
localResult = localStatus.getResult()
if (localStatus.resultIsBetterOrEqualTo('SUCCESS')) {
echo "Federation Test Job is OK"
echo "Docker Federation Test Job is OK"
} else {
echo "Federation Test Job is KO"
echo "Docker Federation Test Job is KO"
sh "ci-scripts/fail.sh"
}
}
......@@ -367,6 +399,38 @@ pipeline {
}
}
}
stage ('Testing in CN-5G-FED OC environment') {
steps {
script {
gitlabCommitStatus(name: "Test with DsTester on OC environment") {
localStatus = build job: params.CN5G_FED_OC_PipelineName,
parameters: [
string(name: 'AMF_TAG', value: String.valueOf(amf_tag)),
string(name: 'AMF_BRANCH', value: String.valueOf(amf_branch))
], propagate: false
localResult = localStatus.getResult()
if (localStatus.resultIsBetterOrEqualTo('SUCCESS')) {
echo "OC Federation Test Job is OK"
} else {
echo "OC Federation Test Job is KO"
sh "ci-scripts/fail.sh"
}
}
}
}
post {
always {
script {
copyArtifacts(projectName: params.CN5G_FED_OC_PipelineName,
filter: '*_results_oai_cn5g_oc.html',
selector: lastCompleted())
}
}
}
}
}
}
}
post {
success {
......@@ -438,6 +502,14 @@ pipeline {
sh "sed -i -e 's#TEMPLATE_MERGE_REQUEST_LINK#${gitlabMergeRequestLink}#g' *_results_oai_cn5g.html"
sh "sed -i -e 's#TEMPLATE_MERGE_REQUEST_TEMPLATE#${env.gitlabMergeRequestTitle}#' *_results_oai_cn5g.html"
}
if (fileExists('test_results_oai_amf_bt.html')) {
sh "sed -i -e 's#TEMPLATE_MERGE_REQUEST_LINK#${gitlabMergeRequestLink}#g' *_results_oai_amf_bt.html"
sh "sed -i -e 's#TEMPLATE_MERGE_REQUEST_TEMPLATE#${env.gitlabMergeRequestTitle}#' *_results_oai_amf_bt.html"
}
if (fileExists('test_results_oai_cn5g_oc.html')) {
sh "sed -i -e 's#TEMPLATE_MERGE_REQUEST_LINK#${gitlabMergeRequestLink}#g' *_results_oai_cn5g_oc.html"
sh "sed -i -e 's#TEMPLATE_MERGE_REQUEST_TEMPLATE#${env.gitlabMergeRequestTitle}#' *_results_oai_cn5g_oc.html"
}
} else {
sh "python3 ci-scripts/generateHtmlReport.py --job_name=${JOB_NAME} --job_id=${BUILD_ID} --job_url=${BUILD_URL} --git_url=${GIT_URL} --git_src_branch=${GIT_BRANCH} --git_src_commit=${GIT_COMMIT}"
}
......@@ -450,6 +522,14 @@ pipeline {
sh "sed -i -e 's#TEMPLATE_TIME#${JOB_TIMESTAMP}#' *_results_oai_cn5g.html"
archiveArtifacts artifacts: '*_results_oai_cn5g.html'
}
if (fileExists('test_results_oai_amf_bt.html')) {
sh "sed -i -e 's#TEMPLATE_TIME#${JOB_TIMESTAMP}#' *_results_oai_amf_bt.html"
archiveArtifacts artifacts: '*_results_oai_amf_bt.html'
}
if (fileExists('test_results_oai_cn5g_oc.html')) {
sh "sed -i -e 's#TEMPLATE_TIME#${JOB_TIMESTAMP}#' *_results_oai_cn5g_oc.html"
archiveArtifacts artifacts: '*_results_oai_cn5g_oc.html'
}
// Sending email to commiter
if (params.sendToCommitterEmail != null) {
......
#/*
# * 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_amf_bt.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_amf')
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 == '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/dcamf.yaml'):
cmd = f'egrep -c "final-result: pass" DS-TEST-RESULTS/dcamf.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/dcamf.yaml'):
with open(cwd + '/DS-TEST-RESULTS/dcamf.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-amf-bt.')
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()
......@@ -52,7 +52,11 @@ RUN apt-get update && \
psmisc \
net-tools \
bc \
openssl \
perl \
tshark \
libasan4 \
libldap-2.4-2 \
libconfig++9v5 \
libsctp1 \
&& rm -rf /var/lib/apt/lists/*
......@@ -64,29 +68,14 @@ COPY --from=oai-amf-builder /openair-amf/scripts/entrypoint.sh entrypoint.sh
WORKDIR /usr/lib/x86_64-linux-gnu
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libmysqlclient.so.20 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libboost_system.so.1.65.1 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libcpprest.so.2.10 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libssl.so.1.1 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/librtmp.so.1 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libpsl.so.5 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libldap_r-2.4.so.2 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/liblber-2.4.so.2 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libsasl2.so.2 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libgssapi.so.3 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libheimntlm.so.0 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libheimbase.so.1 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libkrb5.so.26 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libasn1.so.8 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libhcrypto.so.4 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libroken.so.18 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libwind.so.0 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libhx509.so.5 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libasan.so.4 .
WORKDIR /usr/local/lib
COPY --from=oai-amf-builder /usr/lib/libboost_system.so.1.67.0 .
COPY --from=oai-amf-builder /usr/lib/libboost_thread.so.1.67.0 .
COPY --from=oai-amf-builder /usr/local/lib/libpistache.so .
RUN ldconfig
......
#!/bin/bash
STATUS=0
RESULT=$(ps aux | grep -v nohup || true)
SUB='/openair-amf/bin/oai_amf -c /openair-amf/etc/amf.conf -o'
if [[ $RESULT =~ $SUB ]]; then
STATUS=0
else
STATUS=-1
fi
exit $STATUS
version: '3.8'
services:
cicd_mysql:
container_name: cicd-mysql-svr
image: mysql:5.7
ports:
- 3306
command: --init-file /docker-entrypoint-initdb.d/oai_db.sql
volumes:
- ./oai_db.sql:/docker-entrypoint-initdb.d/oai_db.sql:rw
environment:
- TZ=Europe/Paris
- MYSQL_DATABASE=oai_db
- MYSQL_USER=test
- MYSQL_PASSWORD=test
- MYSQL_ROOT_PASSWORD=linux
healthcheck:
test: "/usr/bin/mysql --user=root --password=linux -e 'show databases;'"
interval: 10s
timeout: 5s
retries: 5
networks:
cicd_public_net:
ipv4_address: 192.168.61.194
cicd_oai_amf:
container_name: cicd-oai-amf
image: oai-amf:AMF_IMAGE_TAG
ports:
- 38412
- 80
command: >
bash -c "nohup tshark -i eth0 -w /tmp/amf.pcap 2>&1 > /dev/null &
/openair-amf/bin/oai_amf -c /openair-amf/etc/amf.conf -o | tee /tmp/amf.log 2>&1
"
cap_add:
- NET_ADMIN
environment:
- INSTANCE=1
- PID_DIRECTORY=/var/run
- MCC=208
- MNC=95
- REGION_ID=128
- AMF_SET_ID=1
- SERVED_GUAMI_MCC_0=208
- SERVED_GUAMI_MNC_0=95
- SERVED_GUAMI_REGION_ID_0=128
- SERVED_GUAMI_AMF_SET_ID_0=1
- SERVED_GUAMI_MCC_1=460
- SERVED_GUAMI_MNC_1=11
- SERVED_GUAMI_REGION_ID_1=10
- SERVED_GUAMI_AMF_SET_ID_1=1
- PLMN_SUPPORT_MCC=208
- PLMN_SUPPORT_MNC=95
- PLMN_SUPPORT_TAC=0xa000
- SST_0=222
- SD_0=123
- SST_1=1
- SD_1=12
- AMF_INTERFACE_NAME_FOR_NGAP=eth0
- AMF_INTERFACE_NAME_FOR_N11=eth0
- SMF_INSTANCE_ID_0=1
- SMF_FQDN_0=localhost
- SMF_IPV4_ADDR_0=192.168.18.184
- SMF_HTTP_VERSION_0=v1
- SELECTED_0=true
- SMF_INSTANCE_ID_1=2
- SMF_FQDN_1=localhost
- SMF_IPV4_ADDR_1=0.0.0.0
- SMF_HTTP_VERSION_1=v1
- SELECTED_1=false
- MYSQL_SERVER=cicd-mysql-svr
- MYSQL_USER=root
- MYSQL_PASS=linux
- MYSQL_DB=oai_db
- OPERATOR_KEY=63bfa50ee6523365ff14c1f45f88737d
- NRF_IPV4_ADDRESS=0.0.0.0
- NRF_PORT=80
- NF_REGISTRATION=no
- SMF_SELECTION=no
- USE_FQDN_DNS=no
- NRF_API_VERSION=v1
- NRF_FQDN=localhost
- AUSF_IPV4_ADDRESS=0.0.0.0
- AUSF_PORT=80
- AUSF_API_VERSION=v1
depends_on:
- cicd_mysql
networks:
cicd_public_net:
ipv4_address: 192.168.61.196
volumes:
- ./amf-healthy-check.sh:/openair-amf/bin/amf-healthy-check.sh
healthcheck:
test: /bin/bash -c "/openair-amf/bin/amf-healthy-check.sh"
interval: 10s
timeout: 5s
retries: 5
networks:
cicd_public_net:
name: cicd-oai-public-net
driver: bridge
ipam:
config:
- subnet: 192.168.61.192/26
-- MySQL dump 10.13 Distrib 5.7.46, for debian-linux-gnu (x86_64)
--
-- Host: localhost Database: oai_db
-- ------------------------------------------------------
-- Server version 5.5.46-0ubuntu0.14.04.2
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `apn`
--
DROP TABLE IF EXISTS `apn`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `apn` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`apn-name` varchar(60) NOT NULL,
`pdn-type` enum('IPv4','IPv6','IPv4v6','IPv4_or_IPv6') NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `apn-name` (`apn-name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `apn`
--
LOCK TABLES `apn` WRITE;
/*!40000 ALTER TABLE `apn` DISABLE KEYS */;
/*!40000 ALTER TABLE `apn` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `mmeidentity`
--
DROP TABLE IF EXISTS `mmeidentity`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mmeidentity` (
`idmmeidentity` int(11) NOT NULL AUTO_INCREMENT,
`mmehost` varchar(255) DEFAULT NULL,
`mmerealm` varchar(200) DEFAULT NULL,
`UE-Reachability` tinyint(1) NOT NULL COMMENT 'Indicates whether the MME supports UE Reachability Notifcation',
PRIMARY KEY (`idmmeidentity`)
) ENGINE=MyISAM AUTO_INCREMENT=46 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `mmeidentity`
--
LOCK TABLES `mmeidentity` WRITE;
/*!40000 ALTER TABLE `mmeidentity` DISABLE KEYS */;
INSERT INTO `mmeidentity` VALUES (2,'mme2.openair4G.eur','openair4G.eur',0),(1,'nano.openair4G.eur','openair4G.eur',0),(5,'abeille.openair4G.eur','openair4G.eur',0),(4,'yang.openair4G.eur','openair4G.eur',0),(3,'mme3.openair4G.eur','openair4G.eur',0),(6,'calisson.openair4G.eur','openair4G.eur',0);
/*!40000 ALTER TABLE `mmeidentity` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `pdn`
--
DROP TABLE IF EXISTS `pdn`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `pdn` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`apn` varchar(60) NOT NULL,
`pdn_type` enum('IPv4','IPv6','IPv4v6','IPv4_or_IPv6') NOT NULL DEFAULT 'IPv4',
`pdn_ipv4` varchar(15) DEFAULT '0.0.0.0',
`pdn_ipv6` varchar(45) CHARACTER SET latin1 COLLATE latin1_general_ci DEFAULT '0:0:0:0:0:0:0:0',
`aggregate_ambr_ul` int(10) unsigned DEFAULT '50000000',
`aggregate_ambr_dl` int(10) unsigned DEFAULT '100000000',
`pgw_id` int(11) NOT NULL,
`users_imsi` varchar(15) NOT NULL,
`qci` tinyint(3) unsigned NOT NULL DEFAULT '9',
`priority_level` tinyint(3) unsigned NOT NULL DEFAULT '15',
`pre_emp_cap` enum('ENABLED','DISABLED') DEFAULT 'DISABLED',
`pre_emp_vul` enum('ENABLED','DISABLED') DEFAULT 'DISABLED',
`LIPA-Permissions` enum('LIPA-prohibited','LIPA-only','LIPA-conditional') NOT NULL DEFAULT 'LIPA-only',
PRIMARY KEY (`id`,`pgw_id`,`users_imsi`),
KEY `fk_pdn_pgw1_idx` (`pgw_id`),
KEY `fk_pdn_users1_idx` (`users_imsi`)
) ENGINE=MyISAM AUTO_INCREMENT=60 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `pdn`
--
LOCK TABLES `pdn` WRITE;
/*!40000 ALTER TABLE `pdn` DISABLE KEYS */;
INSERT INTO `pdn` VALUES (1,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930000000001',9,15,'DISABLED','ENABLED','LIPA-only'),(41,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'20834123456789',9,15,'DISABLED','ENABLED','LIPA-only'),(40,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'20810000001234',9,15,'DISABLED','ENABLED','LIPA-only'),(42,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'31002890832150',9,15,'DISABLED','ENABLED','LIPA-only'),(16,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000002',9,15,'DISABLED','ENABLED','LIPA-only'),(43,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'001010123456789',9,15,'DISABLED','ENABLED','LIPA-only'),(2,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930000000002',9,15,'DISABLED','ENABLED','LIPA-only'),(3,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930000000003',9,15,'DISABLED','ENABLED','LIPA-only'),(4,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930000000004',9,15,'DISABLED','ENABLED','LIPA-only'),(5,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930000000005',9,15,'DISABLED','ENABLED','LIPA-only'),(6,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930000000006',9,15,'DISABLED','ENABLED','LIPA-only'),(7,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930000000007',9,15,'DISABLED','ENABLED','LIPA-only'),(8,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208940000000001',9,15,'DISABLED','ENABLED','LIPA-only'),(9,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208940000000002',9,15,'DISABLED','ENABLED','LIPA-only'),(10,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208940000000003',9,15,'DISABLED','ENABLED','LIPA-only'),(11,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208940000000004',9,15,'DISABLED','ENABLED','LIPA-only'),(12,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208940000000005',9,15,'DISABLED','ENABLED','LIPA-only'),(13,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208940000000006',9,15,'DISABLED','ENABLED','LIPA-only'),(14,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208940000000007',9,15,'DISABLED','ENABLED','LIPA-only'),(15,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000001',9,15,'DISABLED','ENABLED','LIPA-only'),(17,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000003',9,15,'DISABLED','ENABLED','LIPA-only'),(18,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000004',9,15,'DISABLED','ENABLED','LIPA-only'),(19,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000005',9,15,'DISABLED','ENABLED','LIPA-only'),(20,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000006',9,15,'DISABLED','ENABLED','LIPA-only'),(21,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000007',9,15,'DISABLED','ENABLED','LIPA-only'),(22,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001100',9,15,'DISABLED','ENABLED','LIPA-only'),(23,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001101',9,15,'DISABLED','ENABLED','LIPA-only'),(24,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001102',9,15,'DISABLED','ENABLED','LIPA-only'),(25,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001103',9,15,'DISABLED','ENABLED','LIPA-only'),(26,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001104',9,15,'DISABLED','ENABLED','LIPA-only'),(27,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001105',9,15,'DISABLED','ENABLED','LIPA-only'),(28,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001106',9,15,'DISABLED','ENABLED','LIPA-only'),(29,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001107',9,15,'DISABLED','ENABLED','LIPA-only'),(30,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001108',9,15,'DISABLED','ENABLED','LIPA-only'),(31,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001109',9,15,'DISABLED','ENABLED','LIPA-only'),(32,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001110',9,15,'DISABLED','ENABLED','LIPA-only'),(33,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930100001111',9,15,'DISABLED','ENABLED','LIPA-only'),(34,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930100001112',9,15,'DISABLED','ENABLED','LIPA-only'),(35,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930100001113',9,15,'DISABLED','ENABLED','LIPA-only'),(44,'operator','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930100001113',9,15,'DISABLED','ENABLED','LIPA-only'),(45,'operator','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930100001112',9,15,'DISABLED','ENABLED','LIPA-only'),(46,'operator','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930100001111',9,15,'DISABLED','ENABLED','LIPA-only'),(47,'operator','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000002',9,15,'DISABLED','ENABLED','LIPA-only'),(48,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000008',9,15,'DISABLED','ENABLED','LIPA-only'),(49,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000009',9,15,'DISABLED','ENABLED','LIPA-only'),(50,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000010',9,15,'DISABLED','ENABLED','LIPA-only'),(51,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000011',9,15,'DISABLED','ENABLED','LIPA-only'),(52,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000012',9,15,'DISABLED','ENABLED','LIPA-only'),(53,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000013',9,15,'DISABLED','ENABLED','LIPA-only'),(54,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000014',9,15,'DISABLED','ENABLED','LIPA-only'),(55,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000015',9,15,'DISABLED','ENABLED','LIPA-only'),(56,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001118',9,15,'DISABLED','ENABLED','LIPA-only'),(57,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001121',9,15,'DISABLED','ENABLED','LIPA-only'),(58,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001120',9,15,'DISABLED','ENABLED','LIPA-only'),(59,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001119',9,15,'DISABLED','ENABLED','LIPA-only');
/*!40000 ALTER TABLE `pdn` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `pgw`
--
DROP TABLE IF EXISTS `pgw`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `pgw` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`ipv4` varchar(15) NOT NULL,
`ipv6` varchar(39) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `ipv4` (`ipv4`),
UNIQUE KEY `ipv6` (`ipv6`)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `pgw`
--
LOCK TABLES `pgw` WRITE;
/*!40000 ALTER TABLE `pgw` DISABLE KEYS */;
INSERT INTO `pgw` VALUES (1,'127.0.0.1','0:0:0:0:0:0:0:1'),(2,'192.168.56.101',''),(3,'10.0.0.2','0');
/*!40000 ALTER TABLE `pgw` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `terminal-info`
--
DROP TABLE IF EXISTS `terminal-info`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `terminal-info` (
`imei` varchar(15) NOT NULL,
`sv` varchar(2) NOT NULL,
UNIQUE KEY `imei` (`imei`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `terminal-info`
--
LOCK TABLES `terminal-info` WRITE;
/*!40000 ALTER TABLE `terminal-info` DISABLE KEYS */;
/*!40000 ALTER TABLE `terminal-info` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `users`
--
DROP TABLE IF EXISTS `users`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `users` (
`imsi` varchar(15) NOT NULL COMMENT 'IMSI is the main reference key.',
`msisdn` varchar(46) DEFAULT NULL COMMENT 'The basic MSISDN of the UE (Presence of MSISDN is optional).',
`imei` varchar(15) DEFAULT NULL COMMENT 'International Mobile Equipment Identity',
`imei_sv` varchar(2) DEFAULT NULL COMMENT 'International Mobile Equipment Identity Software Version Number',
`ms_ps_status` enum('PURGED','NOT_PURGED') DEFAULT 'PURGED' COMMENT 'Indicates that ESM and EMM status are purged from MME',
`rau_tau_timer` int(10) unsigned DEFAULT '120',
`ue_ambr_ul` bigint(20) unsigned DEFAULT '50000000' COMMENT 'The Maximum Aggregated uplink MBRs to be shared across all Non-GBR bearers according to the subscription of the user.',
`ue_ambr_dl` bigint(20) unsigned DEFAULT '100000000' COMMENT 'The Maximum Aggregated downlink MBRs to be shared across all Non-GBR bearers according to the subscription of the user.',
`access_restriction` int(10) unsigned DEFAULT '60' COMMENT 'Indicates the access restriction subscription information. 3GPP TS.29272 #7.3.31',
`mme_cap` int(10) unsigned zerofill DEFAULT NULL COMMENT 'Indicates the capabilities of the MME with respect to core functionality e.g. regional access restrictions.',
`mmeidentity_idmmeidentity` int(11) NOT NULL DEFAULT '0',
`key` varbinary(16) NOT NULL DEFAULT '0' COMMENT 'UE security key',
`RFSP-Index` smallint(5) unsigned NOT NULL DEFAULT '1' COMMENT 'An index to specific RRM configuration in the E-UTRAN. Possible values from 1 to 256',
`urrp_mme` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'UE Reachability Request Parameter indicating that UE activity notification from MME has been requested by the AUSF.',
`sqn` bigint(20) unsigned zerofill NOT NULL,
`rand` varbinary(16) NOT NULL,
`OPc` varbinary(16) DEFAULT NULL COMMENT 'Can be computed by AUSF',
PRIMARY KEY (`imsi`,`mmeidentity_idmmeidentity`),
KEY `fk_users_mmeidentity_idx1` (`mmeidentity_idmmeidentity`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `users`
--
LOCK TABLES `users` WRITE;
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
INSERT INTO `users` VALUES ('208950000000030','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d);
INSERT INTO `users` VALUES ('208950000000031','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d);
INSERT INTO `users` VALUES ('208950000000032','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d);
INSERT INTO `users` VALUES ('208950000000033','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d);
INSERT INTO `users` VALUES ('208950000000034','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d);
INSERT INTO `users` VALUES ('208950000000035','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d);
INSERT INTO `users` VALUES ('208950000000036','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d);
INSERT INTO `users` VALUES ('208950000000037','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d);
INSERT INTO `users` VALUES ('208950000000038','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d);
INSERT INTO `users` VALUES ('208950000000039','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d);
INSERT INTO `users` VALUES ('208950000000040','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d);
INSERT INTO `users` VALUES ('208950000000041','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d);
INSERT INTO `users` VALUES ('208950000000042','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d);
INSERT INTO `users` VALUES ('208950000000043','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d);
INSERT INTO `users` VALUES ('208950000000044','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d);
INSERT INTO `users` VALUES ('208950000000045','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d);
INSERT INTO `users` VALUES ('208950000000046','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d);
INSERT INTO `users` VALUES ('208950000000047','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d);
INSERT INTO `users` VALUES ('208950000000048','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d);
INSERT INTO `users` VALUES ('208950000000049','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d);
INSERT INTO `users` VALUES ('208950000000050','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d);
INSERT INTO `users` VALUES ('208950000000051','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d);
INSERT INTO `users` VALUES ('208950000000052','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d);
INSERT INTO `users` VALUES ('208950000000053','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d);
INSERT INTO `users` VALUES ('208950000000054','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d);
INSERT INTO `users` VALUES ('208950000000055','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d);
/*!40000 ALTER TABLE `users` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40000 ALTER TABLE `users` ENABLE KEYS */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2016-06-28 11:41:40
......@@ -111,7 +111,7 @@ class HtmlReport():
buildSummary += ' </tr>\n'
if self.git_pull_request:
buildSummary += ' <tr>\n'
buildSummary += ' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-log-out"></span> Source Branch</td>\n'
buildSummary += ' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-log-out"></span> Merge Request URL</td>\n'
buildSummary += ' <td><a href="TEMPLATE_MERGE_REQUEST_LINK">TEMPLATE_MERGE_REQUEST_LINK</a></td>\n'
buildSummary += ' </tr>\n'
buildSummary += ' <tr>\n'
......@@ -158,7 +158,9 @@ class HtmlReport():
self.file.write(buildSummary)
cwd = os.getcwd()
for reportFile in glob.glob('./*results_oai_cn5g.html'):
for reportFile in glob.glob('./*results_oai_*.html'):
if reportFile == './test_results_oai_amf.html':
continue
newEpcReport = open(cwd + '/' + str(reportFile) + '.new', 'w')
buildSummaryDone = True
with open(cwd + '/' + str(reportFile), 'r') as originalEpcReport:
......@@ -461,8 +463,6 @@ class HtmlReport():
section_end_pattern = 'build_amf --clean --Verbose --build-type Release --jobs'
section_status = False
package_install = False
fmt_build_start = False
fmt_build_status = False
folly_build_start = False
folly_build_status = False
spdlog_build_start = False
......@@ -498,12 +498,6 @@ class HtmlReport():
result = re.search('cpprestsdk installation complete', line)
if result is not None and cpprest_build_start:
cpprest_build_status = True
result = re.search('Starting to install fmt', line)
if result is not None:
fmt_build_start = True
result = re.search('fmt installation complete', line)
if result is not None and fmt_build_start:
fmt_build_status = True
result = re.search('Starting to install folly', line)
if result is not None:
folly_build_start = True
......@@ -551,12 +545,6 @@ class HtmlReport():
cell_msg += ' ** cpprestsdk Installation: OK\n'
else:
cell_msg += ' ** cpprestsdk Installation: KO\n'
if base_image:
cell_msg += ' ** fmt Installation: N/A\n'
elif fmt_build_status:
cell_msg += ' ** fmt Installation: OK\n'
else:
cell_msg += ' ** fmt Installation: KO\n'
if base_image:
cell_msg += ' ** folly Installation: N/A\n'
elif folly_build_status:
......@@ -850,9 +838,11 @@ class HtmlReport():
else:
result = re.search('oai-amf *develop', line)
if result is not None:
result = re.search('ago *([0-9A-Z]+)', line)
result = re.search('ago *([0-9A-Z ]+)', line)
if result is not None:
size = result.group(1)
if variant == 'docker':
size = re.sub('MB', ' MB', size)
status = True
logfile.close()
if status:
......
#/*
# * 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 IpRouteCheck():
def __init__(self):
self.mode = ''
self.userName = ''
self.hostName = ''
self.subnet = ''
self.gatwayIp = ''
self.interfaceName = ''
def getSubnet(self):
cmd = "egrep 'subnet' ci-scripts/dsTesterDockerCompose/docker-compose.yml"
ret = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, encoding='utf-8')
if ret.returncode == 0:
if ret.stdout is not None:
result = re.search("(?:[0-9]{1,3}[.]){3}[0-9]{1,3}/[0-9]{1,2}", ret.stdout.strip())
if result is not None:
self.subnet = result.group(0)
#print("found subnet:", self.subnet)
else:
print("subnet not found in docker compose")
sys.exit(-1)
else:
print("docker-compose file not found")
sys.exit(-1)
def getGatwayIp(self):
cmd = "ifconfig | grep 192.168.18"
ret = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, encoding='utf-8')
if ret.returncode == 0:
result = re.search("inet (?:[0-9]{1,3}[.]){3}[0-9]{1,3}", ret.stdout.strip())
self.gatwayIp = result.group(0)
#print("Gatway IP Address:", self.gatwayIp)
else:
print("No Gatway IP address starts with 196.168.18")
sys.exit(-1)
def routeCheck(self):
# Get the interface name
cmd = "ip route | grep 192.168.18.0/24 | awk {'print $3'}"
ret = subprocess.run(f'ssh {self.userName}@{self.hostName} {cmd} || true', shell=True, stdout=subprocess.PIPE, encoding='utf-8')
#print('interface name:', ret.stdout.strip())
self.interfaceName = ret.stdout.strip()
# Check whether or not ip route exist
cmd = f'ip route | grep -c "{self.subnet}"'
ret = subprocess.run(f'ssh {self.userName}@{self.hostName} {cmd} || true', shell=True, stdout=subprocess.PIPE, encoding='utf-8')
if ret.stdout is not None:
if ret.stdout.strip() == '1':
#print('Route exits')
if IPRC.mode == 'Delete':
IPRC.routeDel()
else:
sys.exit(0)
else:
#print("Route not found")
if IPRC.mode == 'Add':
IPRC.routeAdd()
else:
sys.exit(0)
def routeAdd(self):
# Add the route
cmd = f"sudo ip route add {self.subnet} via {self.gatwayIp} dev {self.interfaceName}"
ret = subprocess.run(f'ssh {self.userName}@{self.hostName} {cmd} || true', shell=True, stdout=subprocess.PIPE, encoding='utf-8')
print("Added ip route")
def routeDel(self):
# Delete the route
cmd = f"sudo ip route del {self.subnet} via {self.gatwayIp} dev {self.interfaceName}"
ret = subprocess.run(f'ssh {self.userName}@{self.hostName} {cmd} || true', shell=True, stdout=subprocess.PIPE, encoding='utf-8')
print("Deleted ip route")
def Usage():
print('----------------------------------------------------------------------------------------------------------------------')
print('routecheck.py')
print(' Add and Delete the ip route on the Server.')
print('----------------------------------------------------------------------------------------------------------------------')
print('Usage: python3 routecheck.py [options]')
print(' --help Show this help.')
print('---------------------------------------------------------------------------------------------- Mandatory Options -----')
print(' --mode=[Add/Delete]')
print(' --userName=[server userName where to add/delete]')
print(' --hostName=[server hostName where to add/delete]')
print('------------------------------------------------------------------------------------------------- Actions Syntax -----')
print('python3 routeCheck.py --mode=Add [Mandatory Options]')
print('python3 routeCheck.py --mode=Delete [Mandatory Options]')
#--------------------------------------------------------------------------------------------------------
#
# Start of main
#
#--------------------------------------------------------------------------------------------------------
argvs = sys.argv
IPRC = IpRouteCheck()
while len(argvs) > 1:
myArgv = argvs.pop(1)
if re.match('^\-\-help$', myArgv, re.IGNORECASE):
Usage()
sys.exit(0)
elif re.match('^\-\-mode=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-mode=(.+)$', myArgv, re.IGNORECASE)
IPRC.mode = matchReg.group(1)
elif re.match('^\-\-userName=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-userName=(.+)$', myArgv, re.IGNORECASE)
IPRC.userName = matchReg.group(1)
elif re.match('^\-\-hostName=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-hostName=(.+)$', myArgv, re.IGNORECASE)
IPRC.hostName = matchReg.group(1)
else:
sys.exit('Invalid Parameter: ' + myArgv)
if IPRC.mode == '' or IPRC.userName == '' or IPRC.hostName == '':
sys.exit('Missing Parameter in job description')
IPRC.getSubnet()
IPRC.getGatwayIp()
IPRC.routeCheck()
#/*
# * 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/dcamf.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/dcamf.yaml")
......@@ -34,9 +34,11 @@ ARG NEEDED_GIT_PROXY
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && DEBIAN_FRONTEND=noninteractive apt-get install --yes \
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \
DEBIAN_FRONTEND=noninteractive apt-get install --yes \
psmisc \
software-properties-common \
git \
vim \
&& rm -rf /var/lib/apt/lists/*
......@@ -63,14 +65,19 @@ RUN ./build_amf --clean --Verbose --build-type Release --jobs
FROM ubuntu:bionic as oai-amf
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Paris
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# We install some debug tools for the moment in addition of mandatory libraries
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && DEBIAN_FRONTEND=noninteractive apt-get install --yes \
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \
DEBIAN_FRONTEND=noninteractive apt-get install --yes \
tzdata \
psmisc \
net-tools \
bc \
openssl \
perl \
tshark \
libasan4 \
libldap-2.4-2 \
libconfig++9v5 \
libsctp1 \
&& rm -rf /var/lib/apt/lists/*
......@@ -82,29 +89,14 @@ COPY --from=oai-amf-builder /openair-amf/scripts/entrypoint.sh entrypoint.sh
WORKDIR /usr/lib/x86_64-linux-gnu
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libmysqlclient.so.20 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libboost_system.so.1.65.1 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libcpprest.so.2.10 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libssl.so.1.1 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/librtmp.so.1 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libpsl.so.5 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libldap_r-2.4.so.2 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/liblber-2.4.so.2 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libsasl2.so.2 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libgssapi.so.3 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libheimntlm.so.0 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libheimbase.so.1 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libkrb5.so.26 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libasn1.so.8 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libhcrypto.so.4 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libroken.so.18 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libwind.so.0 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libhx509.so.5 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libasan.so.4 .
WORKDIR /usr/local/lib
COPY --from=oai-amf-builder /usr/lib/libboost_system.so.1.67.0 .
COPY --from=oai-amf-builder /usr/lib/libboost_thread.so.1.67.0 .
COPY --from=oai-amf-builder /usr/local/lib/libpistache.so .
RUN ldconfig
......@@ -119,5 +111,4 @@ WORKDIR /openair-amf
EXPOSE 80/tcp 9090/tcp 38412/sctp
ENTRYPOINT ["/bin/bash","/openair-amf/bin/entrypoint.sh"]
CMD ["/openair-amf/bin/oai_amf", "-c", "/openair-amf/etc/amf.conf", "-o"]
......@@ -74,10 +74,9 @@ AMF =
PORT = 80; # YOUR NETWORK CONFIG HERE
API_VERSION = "v1"; # YOUR AMF API VERSION CONFIG HERE
SMF_INSTANCES_POOL = (
{SMF_INSTANCE_ID = @SMF_INSTANCE_ID_0@; IPV4_ADDRESS = "@SMF_IPV4_ADDR_0@"; PORT = "80"; VERSION = "@SMF_HTTP_VERSION_0@"; SELECTED = "true"}, # YOUR SMF CONFIG HERE
{SMF_INSTANCE_ID = @SMF_INSTANCE_ID_1@; IPV4_ADDRESS = "@SMF_IPV4_ADDR_1@"; PORT = "80"; VERSION = "@SMF_HTTP_VERSION_1@"; SELECTED = "false"} # YOUR SMF CONFIG HERE
{SMF_INSTANCE_ID = @SMF_INSTANCE_ID_0@; IPV4_ADDRESS = "@SMF_IPV4_ADDR_0@"; PORT = "80"; VERSION = "@SMF_HTTP_VERSION_0@"; FQDN = "@SMF_FQDN_0@", SELECTED = "true"}, # YOUR SMF CONFIG HERE
{SMF_INSTANCE_ID = @SMF_INSTANCE_ID_1@; IPV4_ADDRESS = "@SMF_IPV4_ADDR_1@"; PORT = "80"; VERSION = "@SMF_HTTP_VERSION_1@"; FQDN = "@SMF_FQDN_1@", SELECTED = "false"} # YOUR SMF CONFIG HERE
);
};
......@@ -86,6 +85,7 @@ AMF =
IPV4_ADDRESS = "@NRF_IPV4_ADDRESS@"; # YOUR NRF CONFIG HERE
PORT = @NRF_PORT@; # YOUR NRF CONFIG HERE (default: 80)
API_VERSION = "@NRF_API_VERSION@"; # YOUR NRF API VERSION FOR SBI CONFIG HERE
FQDN = "@NRF_FQDN@"
};
AUSF :
......@@ -104,6 +104,7 @@ AMF =
SMF_SELECTION = "@SMF_SELECTION@"; # Set to yes to enable SMF discovery and selection
EXTERNAL_AUSF = "no"; # Set to yes if AMF works with an external AUSF
EXTERNAL_UDM = "no"; # Set to yes if AMF works with an external UDM
USE_FQDN_DNS = "@USE_FQDN_DNS@"; # Set to yes if AMF relies on a DNS to resolve NRF/SMF/UDM/AUSF's FQDN
}
AUTHENTICATION:
......
......@@ -417,11 +417,7 @@ void amf_app::generate_amf_profile() {
nf_service.nf_service_status = "REGISTERED";
// IP Endpoint
ip_endpoint_t endpoint = {};
std::vector<struct in_addr> addrs;
nf_instance_profile.get_nf_ipv4_addresses(addrs);
for (auto a : addrs) {
endpoint.ipv4_addresses.push_back(a);
}
endpoint.ipv4_address = amf_cfg.n11.addr4;
endpoint.transport = "TCP";
endpoint.port = amf_cfg.n11.port;
nf_service.ip_endpoints.push_back(endpoint);
......@@ -465,12 +461,17 @@ void amf_app::trigger_nf_registration_request() {
std::make_shared<itti_n11_register_nf_instance_request>(
TASK_AMF_APP, TASK_AMF_N11);
itti_msg->profile = nf_instance_profile;
amf_n11_inst->register_nf_instance(itti_msg);
/*
int ret = itti_inst->send_msg(itti_msg);
if (RETURNok != ret) {
Logger::amf_app().error(
"Could not send ITTI message %s to task TASK_AMF_N11",
itti_msg->get_msg_name());
}
*/
}
//------------------------------------------------------------------------------
......
......@@ -40,6 +40,7 @@
#include "logger.hpp"
#include "string.hpp"
#include "thread_sched.hpp"
#include "fqdn.hpp"
extern "C" {
#include <arpa/inet.h>
......@@ -79,6 +80,7 @@ amf_config::amf_config() {
enable_smf_selection = false;
enable_external_ausf = false;
enable_external_udm = false;
use_fqdn_dns = false;
struct {
struct in_addr ipv4_addr;
......@@ -104,6 +106,8 @@ int amf_config::load(const std::string& config_file) {
"\nLoad AMF system configuration file(%s)", config_file.c_str());
Config cfg;
unsigned char buf_in6_addr[sizeof(struct in6_addr)];
// Config file
try {
cfg.readFile(config_file.c_str());
} catch (const FileIOException& fioex) {
......@@ -117,13 +121,18 @@ int amf_config::load(const std::string& config_file) {
pex.getError());
throw;
}
const Setting& root = cfg.getRoot();
// AMF config
try {
const Setting& amf_cfg = root[AMF_CONFIG_STRING_AMF_CONFIG];
} catch (const SettingNotFoundException& nfex) {
Logger::amf_app().error("%s : %s", nfex.what(), nfex.getPath());
return -1;
}
// Instance
const Setting& amf_cfg = root[AMF_CONFIG_STRING_AMF_CONFIG];
try {
amf_cfg.lookupValue(AMF_CONFIG_STRING_INSTANCE_ID, instance);
......@@ -131,6 +140,8 @@ int amf_config::load(const std::string& config_file) {
Logger::amf_app().error(
"%s : %s, using defaults", nfex.what(), nfex.getPath());
}
// Statistic Timer interval
try {
amf_cfg.lookupValue(
AMF_CONFIG_STRING_STATISTICS_TIMER_INTERVAL, statistics_interval);
......@@ -138,18 +149,24 @@ int amf_config::load(const std::string& config_file) {
Logger::amf_app().error(
"%s : %s, using defaults", nfex.what(), nfex.getPath());
}
// PID Dir
try {
amf_cfg.lookupValue(AMF_CONFIG_STRING_PID_DIRECTORY, pid_dir);
} catch (const SettingNotFoundException& nfex) {
Logger::amf_app().error(
"%s : %s, using defaults", nfex.what(), nfex.getPath());
}
// AMF Name
try {
amf_cfg.lookupValue(AMF_CONFIG_STRING_AMF_NAME, AMF_Name);
} catch (const SettingNotFoundException& nfex) {
Logger::amf_app().error(
"%s : %s, using defaults", nfex.what(), nfex.getPath());
}
// GUAMI
try {
const Setting& guami_cfg = amf_cfg[AMF_CONFIG_STRING_GUAMI];
guami_cfg.lookupValue(AMF_CONFIG_STRING_MCC, guami.mcc);
......@@ -161,6 +178,8 @@ int amf_config::load(const std::string& config_file) {
Logger::amf_app().error(
"%s : %s, using defaults", nfex.what(), nfex.getPath());
}
// GUAMI List
try {
const Setting& guami_list_cfg =
amf_cfg[AMF_CONFIG_STRING_SERVED_GUAMI_LIST];
......@@ -179,6 +198,8 @@ int amf_config::load(const std::string& config_file) {
Logger::amf_app().error(
"%s : %s, using defaults", nfex.what(), nfex.getPath());
}
// AMF Capacity
try {
amf_cfg.lookupValue(
AMF_CONFIG_STRING_RELATIVE_AMF_CAPACITY, relativeAMFCapacity);
......@@ -186,6 +207,8 @@ int amf_config::load(const std::string& config_file) {
Logger::amf_app().error(
"%s : %s, using defaults", nfex.what(), nfex.getPath());
}
// PLMN List
try {
const Setting& plmn_list_cfg = amf_cfg[AMF_CONFIG_STRING_PLMN_SUPPORT_LIST];
int count = plmn_list_cfg.getLength();
......@@ -211,13 +234,72 @@ int amf_config::load(const std::string& config_file) {
Logger::amf_app().error(
"%s : %s, using defaults", nfex.what(), nfex.getPath());
}
// Supported features
try {
const Setting& support_features =
amf_cfg[AMF_CONFIG_STRING_SUPPORT_FEATURES];
string opt;
support_features.lookupValue(
AMF_CONFIG_STRING_SUPPORT_FEATURES_NF_REGISTRATION, opt);
if (boost::iequals(opt, "yes")) {
enable_nf_registration = true;
} else {
enable_nf_registration = false;
}
support_features.lookupValue(
AMF_CONFIG_STRING_SUPPORT_FEATURES_SMF_SELECTION, opt);
if (boost::iequals(opt, "yes")) {
enable_smf_selection = true;
} else {
enable_smf_selection = false;
}
support_features.lookupValue(
AMF_CONFIG_STRING_SUPPORT_FEATURES_EXTERNAL_AUSF, opt);
if (boost::iequals(opt, "yes")) {
enable_external_ausf = true;
} else {
enable_external_ausf = false;
}
support_features.lookupValue(
AMF_CONFIG_STRING_SUPPORT_FEATURES_EXTERNAL_UDM, opt);
if (boost::iequals(opt, "yes")) {
enable_external_udm = true;
} else {
enable_external_udm = false;
}
support_features.lookupValue(
AMF_CONFIG_STRING_SUPPORT_FEATURES_USE_FQDN_DNS, opt);
if (boost::iequals(opt, "yes")) {
use_fqdn_dns = true;
} else {
use_fqdn_dns = false;
}
} catch (const SettingNotFoundException& nfex) {
Logger::amf_app().error(
"%s : %s, using defaults", nfex.what(), nfex.getPath());
return -1;
}
// Network interfaces
// TODO: should move SMF/NRF/AUSF out of this section
try {
const Setting& new_if_cfg = amf_cfg[AMF_CONFIG_STRING_INTERFACES];
// N2
const Setting& n2_amf_cfg =
new_if_cfg[AMF_CONFIG_STRING_INTERFACE_NGAP_AMF];
load_interface(n2_amf_cfg, n2);
// N11
const Setting& n11_cfg = new_if_cfg[AMF_CONFIG_STRING_INTERFACE_N11];
load_interface(n11_cfg, n11);
// SBI API VERSION
if (!(n11_cfg.lookupValue(
AMF_CONFIG_STRING_API_VERSION, sbi_api_version))) {
......@@ -225,22 +307,47 @@ int amf_config::load(const std::string& config_file) {
throw(AMF_CONFIG_STRING_API_VERSION "failed");
}
// SMF
const Setting& smf_addr_pool =
n11_cfg[AMF_CONFIG_STRING_SMF_INSTANCES_POOL];
int count = smf_addr_pool.getLength();
for (int i = 0; i < count; i++) {
const Setting& smf_addr_item = smf_addr_pool[i];
smf_inst_t smf_inst;
std::string selected;
smf_inst_t smf_inst = {};
struct in_addr smf_ipv4_addr = {};
unsigned int smf_port = {};
std::string smf_api_version = {};
std::string selected = {};
smf_addr_item.lookupValue(AMF_CONFIG_STRING_SMF_INSTANCE_ID, smf_inst.id);
smf_addr_item.lookupValue(AMF_CONFIG_STRING_IPV4_ADDRESS, smf_inst.ipv4);
if (!use_fqdn_dns) {
smf_addr_item.lookupValue(
AMF_CONFIG_STRING_SMF_INSTANCE_PORT, smf_inst.port);
AMF_CONFIG_STRING_IPV4_ADDRESS, smf_inst.ipv4);
IPV4_STR_ADDR_TO_INADDR(
util::trim(smf_inst.ipv4).c_str(), smf_ipv4_addr,
"BAD IPv4 ADDRESS FORMAT FOR SMF !");
if (!(smf_addr_item.lookupValue(
AMF_CONFIG_STRING_SMF_INSTANCE_PORT, smf_inst.port))) {
Logger::amf_app().error(AMF_CONFIG_STRING_SMF_INSTANCE_PORT "failed");
throw(AMF_CONFIG_STRING_SMF_INSTANCE_PORT "failed");
}
smf_addr_item.lookupValue(
AMF_CONFIG_STRING_SMF_INSTANCE_VERSION, smf_inst.version);
if (!(smf_addr_item.lookupValue(
AMF_CONFIG_STRING_SMF_INSTANCE_VERSION, smf_inst.version))) {
Logger::amf_app().error(AMF_CONFIG_STRING_SMF_INSTANCE_VERSION
"failed");
throw(AMF_CONFIG_STRING_SMF_INSTANCE_VERSION "failed");
}
} else {
std::string smf_fqdn = {};
smf_addr_item.lookupValue(AMF_CONFIG_STRING_FQDN_DNS, smf_fqdn);
smf_inst.fqdn = smf_fqdn;
}
smf_addr_item.lookupValue(
AMF_CONFIG_STRING_SMF_INSTANCE_SELECTED, selected);
if (!selected.compare("true"))
if (boost::iequals(selected, "true"))
smf_inst.selected = true;
else
smf_inst.selected = false;
......@@ -249,10 +356,12 @@ int amf_config::load(const std::string& config_file) {
// NRF
const Setting& nrf_cfg = new_if_cfg[AMF_CONFIG_STRING_NRF];
struct in_addr nrf_ipv4_addr;
struct in_addr nrf_ipv4_addr = {};
unsigned int nrf_port = 0;
std::string nrf_api_version;
string address;
std::string nrf_api_version = {};
string address = {};
if (!use_fqdn_dns) {
nrf_cfg.lookupValue(AMF_CONFIG_STRING_NRF_IPV4_ADDRESS, address);
IPV4_STR_ADDR_TO_INADDR(
util::trim(address).c_str(), nrf_ipv4_addr,
......@@ -263,20 +372,36 @@ int amf_config::load(const std::string& config_file) {
throw(AMF_CONFIG_STRING_NRF_PORT "failed");
}
nrf_addr.port = nrf_port;
if (!(nrf_cfg.lookupValue(
AMF_CONFIG_STRING_API_VERSION, nrf_api_version))) {
Logger::amf_app().error(AMF_CONFIG_STRING_API_VERSION "failed");
throw(AMF_CONFIG_STRING_API_VERSION "failed");
}
nrf_addr.api_version = nrf_api_version;
} else {
std::string nrf_fqdn = {};
nrf_cfg.lookupValue(AMF_CONFIG_STRING_FQDN_DNS, nrf_fqdn);
uint8_t addr_type = {};
fqdn::resolve(nrf_fqdn, address, nrf_port, addr_type);
if (addr_type != 0) { // IPv6: TODO
throw("DO NOT SUPPORT IPV6 ADDR FOR NRF!");
} else { // IPv4
IPV4_STR_ADDR_TO_INADDR(
util::trim(address).c_str(), nrf_ipv4_addr,
"BAD IPv4 ADDRESS FORMAT FOR NRF !");
nrf_addr.ipv4_addr = nrf_ipv4_addr;
nrf_addr.port = nrf_port;
nrf_addr.api_version = "v1"; // TODO: get API version
}
}
// AUSF
// TODO: add FQDN option
const Setting& ausf_cfg = new_if_cfg[AMF_CONFIG_STRING_AUSF];
struct in_addr ausf_ipv4_addr;
unsigned int ausf_port = 0;
std::string ausf_api_version;
// string address;
struct in_addr ausf_ipv4_addr = {};
unsigned int ausf_port = {};
std::string ausf_api_version = {};
ausf_cfg.lookupValue(AMF_CONFIG_STRING_IPV4_ADDRESS, address);
IPV4_STR_ADDR_TO_INADDR(
util::trim(address).c_str(), ausf_ipv4_addr,
......@@ -300,6 +425,8 @@ int amf_config::load(const std::string& config_file) {
"%s : %s, using defaults", nfex.what(), nfex.getPath());
return -1;
}
// Emergency support
try {
const Setting& core_config = amf_cfg[AMF_CONFIG_STRING_CORE_CONFIGURATION];
core_config.lookupValue(
......@@ -309,6 +436,9 @@ int amf_config::load(const std::string& config_file) {
"%s : %s, using defaults", nfex.what(), nfex.getPath());
return -1;
}
// Authentication Info
// TODO: remove operator_key, random
try {
const Setting& auth = amf_cfg[AMF_CONFIG_STRING_AUTHENTICATION];
auth.lookupValue(
......@@ -324,6 +454,8 @@ int amf_config::load(const std::string& config_file) {
"%s : %s, using defaults", nfex.what(), nfex.getPath());
return -1;
}
// Integrity/Ciphering algorithms (NAS)
try {
const Setting& nas = amf_cfg[AMF_CONFIG_STRING_NAS];
const Setting& intAlg =
......@@ -364,47 +496,6 @@ int amf_config::load(const std::string& config_file) {
return -1;
}
try {
const Setting& support_features =
amf_cfg[AMF_CONFIG_STRING_SUPPORT_FEATURES];
string opt;
support_features.lookupValue(
AMF_CONFIG_STRING_SUPPORT_FEATURES_NF_REGISTRATION, opt);
if (boost::iequals(opt, "yes")) {
enable_nf_registration = true;
} else {
enable_nf_registration = false;
}
support_features.lookupValue(
AMF_CONFIG_STRING_SUPPORT_FEATURES_SMF_SELECTION, opt);
if (boost::iequals(opt, "yes")) {
enable_smf_selection = true;
} else {
enable_smf_selection = false;
}
support_features.lookupValue(
AMF_CONFIG_STRING_SUPPORT_FEATURES_EXTERNAL_AUSF, opt);
if (boost::iequals(opt, "yes")) {
enable_external_ausf = true;
} else {
enable_external_ausf = false;
}
support_features.lookupValue(
AMF_CONFIG_STRING_SUPPORT_FEATURES_EXTERNAL_UDM, opt);
if (boost::iequals(opt, "yes")) {
enable_external_udm = true;
} else {
enable_external_udm = false;
}
} catch (const SettingNotFoundException& nfex) {
Logger::amf_app().error(
"%s : %s, using defaults", nfex.what(), nfex.getPath());
return -1;
}
return 1;
}
......@@ -453,54 +544,50 @@ void amf_config::display() {
"- MySQL pass ..............: %s", auth_para.mysql_pass.c_str());
Logger::config().info(
"- MySQL DB ................: %s", auth_para.mysql_db.c_str());
Logger::config().info(
"- operator key ............: %s", auth_para.operator_key.c_str());
Logger::config().info(
"- random ..................: %s", auth_para.random.c_str());
Logger::config().info("- N2 Networking:");
Logger::config().info(" iface .................: %s", n2.if_name.c_str());
Logger::config().info(" ip ....................: %s", inet_ntoa(n2.addr4));
Logger::config().info(" port ..................: %d", n2.port);
Logger::config().info(" Iface .................: %s", n2.if_name.c_str());
Logger::config().info(" IP Addr ...............: %s", inet_ntoa(n2.addr4));
Logger::config().info(" Port ..................: %d", n2.port);
Logger::config().info("- SBI Networking:");
Logger::config().info(" iface .................: %s", n11.if_name.c_str());
Logger::config().info(" Iface .................: %s", n11.if_name.c_str());
Logger::config().info(
" ip ....................: %s", inet_ntoa(n11.addr4));
Logger::config().info(" port ..................: %d", n11.port);
" IP Addr ...............: %s", inet_ntoa(n11.addr4));
Logger::config().info(" Port ..................: %d", n11.port);
Logger::config().info(
" API version............: %s", sbi_api_version.c_str());
if (enable_nf_registration or enable_smf_selection) {
Logger::config().info("- NRF:");
Logger::config().info(
" IP addr ...............: %s", inet_ntoa(nrf_addr.ipv4_addr));
" IP Addr ...............: %s", inet_ntoa(nrf_addr.ipv4_addr));
Logger::config().info(" Port ..................: %d", nrf_addr.port);
Logger::config().info(
" Api version ...........: %s", nrf_addr.api_version.c_str());
" API version ...........: %s", nrf_addr.api_version.c_str());
}
if (enable_external_ausf) {
Logger::config().info("- AUSF:");
Logger::config().info(
" IP addr ...............: %s", inet_ntoa(ausf_addr.ipv4_addr));
" IP Addr ...............: %s", inet_ntoa(ausf_addr.ipv4_addr));
Logger::config().info(" Port ..................: %d", ausf_addr.port);
Logger::config().info(
" Api version ...........: %s", ausf_addr.api_version.c_str());
" API version ...........: %s", ausf_addr.api_version.c_str());
}
Logger::config().info("- Remote SMF Pool.........: ");
if (!enable_smf_selection) {
Logger::config().info("- SMF Pool.........: ");
for (int i = 0; i < smf_pool.size(); i++) {
std::string selected;
if (smf_pool[i].selected)
selected = "true";
else
selected = "false";
std::string selected = smf_pool[i].selected ? "true" : "false";
std::string smf_info =
use_fqdn_dns ? smf_pool[i].fqdn : smf_pool[i].ipv4.c_str();
Logger::config().info(
" SMF_INSTANCE_ID %d (%s:%s, version %s) is selected: %s",
smf_pool[i].id, smf_pool[i].ipv4.c_str(), smf_pool[i].port.c_str(),
smf_pool[i].id, smf_info.c_str(), smf_pool[i].port.c_str(),
smf_pool[i].version.c_str(), selected.c_str());
}
}
Logger::config().info("- Supported Features:");
Logger::config().info(
......@@ -511,6 +598,8 @@ void amf_config::display() {
" External AUSF .........: %s", enable_external_ausf ? "Yes" : "No");
Logger::config().info(
" External UDM ..........: %s", enable_external_udm ? "Yes" : "No");
Logger::config().info(
" Use FQDN ..............: %s", use_fqdn_dns ? "Yes" : "No");
}
//------------------------------------------------------------------------------
......
......@@ -104,6 +104,8 @@
#define AMF_CONFIG_STRING_SUPPORT_FEATURES_SMF_SELECTION "SMF_SELECTION"
#define AMF_CONFIG_STRING_SUPPORT_FEATURES_EXTERNAL_AUSF "EXTERNAL_AUSF"
#define AMF_CONFIG_STRING_SUPPORT_FEATURES_EXTERNAL_UDM "EXTERNAL_UDM"
#define AMF_CONFIG_STRING_SUPPORT_FEATURES_USE_FQDN_DNS "USE_FQDN_DNS"
#define AMF_CONFIG_STRING_FQDN_DNS "FQDN"
using namespace libconfig;
......@@ -166,6 +168,7 @@ typedef struct {
std::string port;
std::string version;
bool selected;
std::string fqdn;
} smf_inst_t;
class amf_config {
......@@ -196,6 +199,7 @@ class amf_config {
bool enable_smf_selection;
bool enable_external_ausf;
bool enable_external_udm;
bool use_fqdn_dns;
struct {
struct in_addr ipv4_addr;
......
......@@ -437,7 +437,7 @@ void amf_n1::nas_signalling_establishment_request_handle(
case SERVICE_REQUEST: {
Logger::amf_n1().debug("Received service request message, handling...");
nc.get()->security_ctx->ul_count.seq_num = ulCount;
if (nc.get()) nc.get()->security_ctx->ul_count.seq_num = ulCount;
service_request_handle(
true, nc, ran_ue_ngap_id, amf_ue_ngap_id, plain_msg);
} break;
......@@ -1028,15 +1028,15 @@ void amf_n1::registration_request_handle(
if (!regReq->getUeSecurityCapability(
encrypt_alg, integrity_alg, security_cap_eea, security_cap_eia)) {
Logger::amf_n1().warn("No Optional IE UESecurityCapability available");
nc.get()->ueSecurityCaplen = regReq->ie_ue_security_capability->getLength();
}
nc.get()->ueSecurityCapEnc = encrypt_alg;
nc.get()->ueSecurityCapInt = integrity_alg;
nc.get()->ueSecurityCapEEA = security_cap_eea;
nc.get()->ueSecurityCapEIA = security_cap_eia;
nc.get()->ueSecurityCaplen = regReq->ie_ue_security_capability->getLength();
// Get Requested NSSAI (Optional IE), if provided
std::vector<SNSSAI_t> requestedNssai = {};
if (!regReq->getRequestedNssai(requestedNssai)) {
......
......@@ -47,6 +47,7 @@
#include "SmContextCreateData.h"
#include "mime_parser.hpp"
#include "ue_context.hpp"
#include "fqdn.hpp"
extern "C" {
#include "dynamic_memory_check.h"
......@@ -124,6 +125,14 @@ void amf_n11_task(void*) {
dynamic_cast<itti_pdu_session_resource_setup_response*>(msg);
amf_n11_inst->handle_itti_message(ref(*m));
} break;
case N11_REGISTER_NF_INSTANCE_REQUEST: {
Logger::amf_n11().info(
"Receive Register NF Instance Request, handling ...");
itti_n11_register_nf_instance_request* m =
dynamic_cast<itti_n11_register_nf_instance_request*>(msg);
// TODO: Handle ITTI
} break;
default: {
Logger::amf_n11().info(
"Receive unknown message type %d", msg->msg_type);
......@@ -435,9 +444,27 @@ bool amf_n11::smf_selection_from_configuration(
std::string& smf_addr, std::string& smf_api_version) {
for (int i = 0; i < amf_cfg.smf_pool.size(); i++) {
if (amf_cfg.smf_pool[i].selected) {
if (!amf_cfg.use_fqdn_dns) {
smf_addr = amf_cfg.smf_pool[i].ipv4 + ":" + amf_cfg.smf_pool[i].port;
smf_api_version = amf_cfg.smf_pool[i].version;
return true;
} else {
// resolve IP addr from a FQDN/DNS name
uint8_t addr_type = 0;
uint32_t smf_port = 0;
fqdn::resolve(
amf_cfg.smf_pool[i].fqdn, amf_cfg.smf_pool[i].ipv4, smf_port,
addr_type);
if (addr_type != 0) { // IPv6: TODO
Logger::amf_n11().warn("Do not support IPv6 Addr for SMF");
return false;
} else { // IPv4
smf_addr = amf_cfg.smf_pool[i].ipv4 + ":" + std::to_string(smf_port);
smf_api_version = "v1"; // TODO: get API version
return true;
}
}
return true;
}
}
return false;
......@@ -793,6 +820,80 @@ bool amf_n11::discover_smf(
return result;
}
//-----------------------------------------------------------------------------------------------------
void amf_n11::register_nf_instance(
std::shared_ptr<itti_n11_register_nf_instance_request> msg) {
Logger::amf_n11().debug(
"Send NF Instance Registration to NRF (HTTP version %d)",
msg->http_version);
nlohmann::json json_data = {};
msg->profile.to_json(json_data);
std::string url =
std::string(inet_ntoa(*((struct in_addr*) &amf_cfg.nrf_addr.ipv4_addr))) +
":" + std::to_string(amf_cfg.nrf_addr.port) + "/nnrf-nfm/" +
amf_cfg.nrf_addr.api_version + "/nf-instances/" +
msg->profile.get_nf_instance_id();
Logger::amf_n11().debug(
"Send NF Instance Registration to NRF, NRF URL %s", url.c_str());
std::string body = json_data.dump();
Logger::amf_n11().debug(
"Send NF Instance Registration to NRF, msg body: \n %s", body.c_str());
curl_global_init(CURL_GLOBAL_ALL);
CURL* curl = curl = curl_easy_init();
if (curl) {
CURLcode res = {};
struct curl_slist* headers = nullptr;
// headers = curl_slist_append(headers, "charsets: utf-8");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_HTTPGET, 1);
curl_easy_setopt(curl, CURLOPT_TIMEOUT_MS, NRF_CURL_TIMEOUT_MS);
curl_easy_setopt(curl, CURLOPT_INTERFACE, amf_cfg.n11.if_name.c_str());
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "PUT");
// Response information.
long httpCode = {0};
std::unique_ptr<std::string> httpData(new std::string());
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &callback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, httpData.get());
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, body.length());
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, body.c_str());
res = curl_easy_perform(curl);
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &httpCode);
Logger::amf_n11().debug(
"NFDiscovery, response from NRF, HTTP Code: %d", httpCode);
if (httpCode == 200) {
Logger::amf_n11().debug(
"NFRegistration, got successful response from NRF");
nlohmann::json response_data = {};
try {
response_data = nlohmann::json::parse(*httpData.get());
} catch (nlohmann::json::exception& e) {
Logger::amf_n11().warn(
"NFDiscovery, could not parse json from the NRF "
"response");
}
Logger::amf_n11().debug(
"NFDiscovery, response from NRF, json data: \n %s",
response_data.dump().c_str());
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
}
curl_global_cleanup();
}
}
//-----------------------------------------------------------------------------------------------------
bool amf_n11::send_ue_authentication_request(
oai::amf::model::AuthenticationInfo& auth_info,
......
......@@ -76,7 +76,8 @@ class amf_n11 {
bool discover_smf(
std::string& smf_addr, std::string& smf_api_version,
const snssai_t snssai, const plmn_t plmn, const std::string dnn);
void register_nf_instance(
std::shared_ptr<itti_n11_register_nf_instance_request> msg);
bool send_ue_authentication_request(
oai::amf::model::AuthenticationInfo& auth_info,
oai::amf::model::UEAuthenticationCtx& ue_auth_ctx, uint8_t http_version);
......
......@@ -371,9 +371,7 @@ void amf_profile::to_json(nlohmann::json& data) const {
for (auto endpoint : service.ip_endpoints) {
nlohmann::json ep_tmp = {};
ep_tmp["ipv4Address"] = nlohmann::json::array();
for (auto address : endpoint.ipv4_addresses) {
ep_tmp["ipv4Address"].push_back(inet_ntoa(address));
}
ep_tmp["ipv4Address"] = inet_ntoa(endpoint.ipv4_address);
ep_tmp["transport"] = endpoint.transport;
ep_tmp["port"] = endpoint.port;
srv_tmp["ipEndPoints"].push_back(ep_tmp);
......
......@@ -276,16 +276,14 @@ typedef struct nf_service_version_s {
} nf_service_version_t;
typedef struct ip_endpoint_s {
std::vector<struct in_addr> ipv4_addresses;
// std::vector<struct in6_addr> ipv6_addresses;
struct in_addr ipv4_address;
// struct in6_addr ipv6_address;
std::string transport; // TCP
unsigned int port;
std::string to_string() const {
std::string s = {};
s.append("Ipv4 Addresses: ");
for (auto ipv4 : ipv4_addresses) {
s.append(inet_ntoa(ipv4));
}
s.append("Ipv4 Address: ");
s.append(inet_ntoa(ipv4_address));
s.append(", TransportProtocol: ");
s.append(transport);
s.append(", Port: ");
......
......@@ -35,32 +35,32 @@ using namespace nas;
//------------------------------------------------------------------------------
RegistrationRequest::RegistrationRequest() {
plain_header = NULL;
ie_5gsregistrationtype = NULL;
ie_ngKSI = NULL;
ie_5gs_mobility_id = NULL;
ie_non_current_native_nas_ksi = NULL;
ie_5g_mm_capability = NULL;
ie_ue_security_capability = NULL;
ie_requested_NSSAI = NULL;
ie_s1_ue_network_capability = NULL;
ie_uplink_data_status = NULL;
ie_last_visited_registered_TAI = NULL;
ie_PDU_session_status = NULL;
ie_MICO_indicationl = NULL;
ie_ue_status = NULL;
ie_additional_guti = NULL;
ie_allowed_PDU_session_status = NULL;
ie_ues_usage_setting = NULL;
ie_5gs_drx_parameters = NULL;
ie_eps_nas_message_container = NULL;
ie_ladn_indication = NULL;
ie_payload_container_type = NULL;
ie_payload_container = NULL;
ie_network_slicing_indication = NULL;
ie_5gs_update_type = NULL;
ie_nas_message_container = NULL;
ie_eps_bearer_context_status = NULL;
plain_header = nullptr;
ie_5gsregistrationtype = nullptr;
ie_ngKSI = nullptr;
ie_5gs_mobility_id = nullptr;
ie_non_current_native_nas_ksi = nullptr;
ie_5g_mm_capability = nullptr;
ie_ue_security_capability = nullptr;
ie_requested_NSSAI = nullptr;
ie_s1_ue_network_capability = nullptr;
ie_uplink_data_status = nullptr;
ie_last_visited_registered_TAI = nullptr;
ie_PDU_session_status = nullptr;
ie_MICO_indicationl = nullptr;
ie_ue_status = nullptr;
ie_additional_guti = nullptr;
ie_allowed_PDU_session_status = nullptr;
ie_ues_usage_setting = nullptr;
ie_5gs_drx_parameters = nullptr;
ie_eps_nas_message_container = nullptr;
ie_ladn_indication = nullptr;
ie_payload_container_type = nullptr;
ie_payload_container = nullptr;
ie_network_slicing_indication = nullptr;
ie_5gs_update_type = nullptr;
ie_nas_message_container = nullptr;
ie_eps_bearer_context_status = nullptr;
}
//------------------------------------------------------------------------------
......@@ -94,11 +94,11 @@ void RegistrationRequest::setngKSI(uint8_t tsc, uint8_t key_set_id) {
//------------------------------------------------------------------------------
uint8_t RegistrationRequest::getngKSI() {
if (ie_ngKSI) {
uint8_t a = 0;
a = (ie_ngKSI->getTypeOfSecurityContext()) | ie_ngKSI->getasKeyIdentifier();
return a;
return (
(ie_ngKSI->getTypeOfSecurityContext()) |
ie_ngKSI->getasKeyIdentifier());
} else {
return -1;
return 0;
}
}
......@@ -122,7 +122,7 @@ uint8_t RegistrationRequest::getMobilityIdentityType() {
if (ie_5gs_mobility_id) {
return ie_5gs_mobility_id->gettypeOfIdentity();
} else {
return -1;
return 0;
}
}
......@@ -169,9 +169,9 @@ void RegistrationRequest::setAdditional_GUTI_SUCI_SUPI_format_IMSI(
bool RegistrationRequest::getAdditionalGuti(nas::_5G_GUTI_t& guti) {
if (ie_additional_guti) {
ie_additional_guti->get5GGUTI(guti);
return 0;
return true;
} else {
return -1;
return false;
}
}
......@@ -203,7 +203,7 @@ uint8_t RegistrationRequest::getNonCurrentNativeNasKSI() {
(ie_non_current_native_nas_ksi->getasKeyIdentifier());
return a;
} else {
return -1;
return 0;
}
}
......@@ -217,7 +217,7 @@ uint8_t RegistrationRequest::get5GMMCapability() {
if (ie_5g_mm_capability)
return ie_5g_mm_capability->getValue();
else
return -1;
return 0;
}
//------------------------------------------------------------------------------
......@@ -239,7 +239,7 @@ bool RegistrationRequest::getUeSecurityCapability(uint8_t& ea, uint8_t& ia) {
ea = ie_ue_security_capability->getEASel();
ia = ie_ue_security_capability->getIASel();
} else {
return -1;
return false;
}
return true;
}
......@@ -255,7 +255,7 @@ bool RegistrationRequest::getUeSecurityCapability(
eia = ie_ue_security_capability->getEIASel();
}
} else {
return -1;
return false;
}
return true;
}
......@@ -272,7 +272,7 @@ bool RegistrationRequest::getRequestedNssai(
if (ie_requested_NSSAI) {
ie_requested_NSSAI->getValue(nssai);
} else {
return -1;
return false;
}
return true;
}
......@@ -297,7 +297,7 @@ bool RegistrationRequest::getS1UeNetworkCapability(uint8_t& eea, uint8_t& eia) {
eea = ie_s1_ue_network_capability->getEEASel();
eia = ie_s1_ue_network_capability->getEIASel();
} else {
return -1;
return false;
}
return true;
}
......@@ -312,7 +312,7 @@ uint16_t RegistrationRequest::getUplinkDataStatus() {
if (ie_uplink_data_status) {
return ie_uplink_data_status->getValue();
} else {
return -1;
return 0;
}
}
......@@ -326,7 +326,7 @@ uint16_t RegistrationRequest::getPduSessionStatus() {
if (ie_PDU_session_status) {
return ie_PDU_session_status->getValue();
} else {
return -1;
return 0;
}
}
......@@ -340,9 +340,9 @@ bool RegistrationRequest::getMicoIndication(uint8_t& sprti, uint8_t& raai) {
if (ie_PDU_session_status) {
sprti = ie_MICO_indicationl->getSPRTI();
raai = ie_MICO_indicationl->getRAAI();
return 0;
return true;
} else {
return -1;
return false;
}
}
......@@ -356,9 +356,9 @@ bool RegistrationRequest::getUeStatus(uint8_t& n1ModeReg, uint8_t& s1ModeReg) {
if (ie_ue_status) {
n1ModeReg = ie_ue_status->getN1();
s1ModeReg = ie_ue_status->getS1();
return 0;
return true;
} else {
return -1;
return false;
}
}
......@@ -372,7 +372,7 @@ uint16_t RegistrationRequest::getAllowedPduSessionStatus() {
if (ie_allowed_PDU_session_status) {
return ie_allowed_PDU_session_status->getValue();
} else {
return -1;
return 0;
}
}
......@@ -386,7 +386,7 @@ uint8_t RegistrationRequest::getUEsUsageSetting() {
if (ie_ues_usage_setting) {
return ie_ues_usage_setting->getValue();
} else {
return -1;
return 0;
}
}
......@@ -400,7 +400,7 @@ uint8_t RegistrationRequest::get5GSDrxParameters() {
if (ie_5gs_drx_parameters) {
return ie_5gs_drx_parameters->getValue();
} else {
return -1;
return 0;
}
}
......@@ -413,9 +413,9 @@ void RegistrationRequest::setEPS_NAS_Message_Container(bstring value) {
bool RegistrationRequest::getEpsNasMessageContainer(bstring& epsNas) {
if (ie_eps_nas_message_container) {
ie_eps_nas_message_container->getValue(epsNas);
return 0;
return true;
} else {
return -1;
return false;
}
}
......@@ -429,7 +429,7 @@ bool RegistrationRequest::getLadnIndication(std::vector<bstring>& ladnValue) {
if (ie_ladn_indication) {
return ie_ladn_indication->getValue(ladnValue);
} else {
return -1;
return 0;
}
}
......@@ -443,7 +443,7 @@ uint8_t RegistrationRequest::getPayloadContainerType() {
if (ie_payload_container_type) {
return ie_payload_container_type->getValue();
} else {
return -1;
return 0;
}
}
......@@ -458,9 +458,9 @@ bool RegistrationRequest::getPayloadContainer(
std::vector<PayloadContainerEntry>& content) {
if (ie_payload_container) {
ie_payload_container->getValue(content);
return 0;
return true;
} else {
return -1;
return false;
}
}
......@@ -476,9 +476,9 @@ bool RegistrationRequest::getNetworkSlicingIndication(
if (ie_network_slicing_indication) {
dcni = ie_network_slicing_indication->getDCNI();
nssci = ie_network_slicing_indication->getNSSCI();
return 0;
return true;
} else {
return -1;
return false;
}
}
......@@ -498,9 +498,9 @@ bool RegistrationRequest::get5GSUpdateType(
_5gs_pnb_ciot = ie_5gs_update_type->get_5GS_PNB_CIoT();
ng_ran_rcu = ie_5gs_update_type->getNG_RAN();
sms_requested = ie_5gs_update_type->getSMS();
return 0;
return true;
} else {
return -1;
return false;
}
}
......@@ -513,9 +513,9 @@ void RegistrationRequest::setNAS_Message_Container(bstring value) {
bool RegistrationRequest::getNasMessageContainer(bstring& nas) {
if (ie_nas_message_container) {
ie_nas_message_container->getValue(nas);
return 0;
return true;
} else {
return -1;
return false;
}
}
......@@ -529,7 +529,7 @@ uint16_t RegistrationRequest::getEpsBearerContextStatus() {
if (ie_eps_bearer_context_status) {
return ie_eps_bearer_context_status->getValue();
} else {
return -1;
return 0;
}
}
......
......@@ -35,5 +35,6 @@ add_library (AMF_UTILS STATIC
${CMAKE_CURRENT_SOURCE_DIR}/string.cpp
${CMAKE_CURRENT_SOURCE_DIR}/thread_sched.cpp
${CMAKE_CURRENT_SOURCE_DIR}/mime_parser.cpp
${CMAKE_CURRENT_SOURCE_DIR}/fqdn.cpp
)
/*
* 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
*/
#include "fqdn.hpp"
#include "logger.hpp"
#include <boost/asio.hpp>
#include <iostream>
bool fqdn::resolve(
const std::string& host_name, std::string& address, uint32_t& port,
uint8_t& addr_type, const std::string& protocol) {
try {
boost::asio::io_context io_context = {};
boost::asio::ip::tcp::resolver resolver{io_context};
boost::asio::ip::tcp::resolver::results_type endpoints =
resolver.resolve(host_name, protocol);
addr_type = 0; // IPv4 by default
for (auto it = endpoints.cbegin(); it != endpoints.cend(); it++) {
// get the first Endpoint
boost::asio::ip::tcp::endpoint endpoint = *it;
address = endpoint.address().to_string();
port = endpoint.port();
Logger::amf_app().debug(
"Resolve a DNS (name %s, protocol %s): Ip Addr %s, port %u",
host_name.c_str(), protocol.c_str(), address.c_str(), port);
if (endpoint.address().is_v4())
addr_type = 0;
else
addr_type = 1;
return true;
}
} catch (std::exception& e) {
throw std::runtime_error(
"Cannot resolve a DNS name " + std::string(e.what()));
return false;
}
return false;
}
/*
* 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
*/
/*! \file fqdn.hpp
\brief
\author
\company Eurecom
\email:
*/
#ifndef FILE_FQDN_HPP_SEEN
#define FILE_FQDN_HPP_SEEN
#include <string>
class fqdn {
public:
/*
* Resolve a DNS name to get host's IP Addr
* @param [const std::string &] host_name: host's name/url
* @param [const std::string &] protocol: protocol
* @param [uint8_t &] addr_type: addr_type (Ipv4/v6)
* @return void
*/
static bool resolve(
const std::string& host_name, std::string& address, uint32_t& port,
uint8_t& addr_type, const std::string& protocol = "http");
};
#endif /* FILE_FQDN_HPP_SEEN */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment