Commit 20ee94ba authored by kharade's avatar kharade

Merge branch 'develop' of https://gitlab.eurecom.fr/oai/cn5g/oai-cn5g-amf into validate_smf_info

parents cc001a5a 6653e38a
......@@ -3,3 +3,4 @@ tags
*.log
archives/
*.html
*.swp
......@@ -133,6 +133,9 @@ check_supported_distribution() {
"rhel8.2") return 0 ;;
"rhel8.3") return 0 ;;
"rhel8.4") return 0 ;;
"rhel8.5") return 0 ;;
"rhel8.6") return 0 ;;
"rhel8.7") return 0 ;;
#"centos7") return 0 ;;
esac
return 1
......
......@@ -437,7 +437,6 @@ check_install_amf_deps(){
# removed libspdlog-dev
PACKAGE_LIST="\
$specific_packages \
libboost1.67-dev \
mysql-server \
mysql-client \
libmysqlclient-dev \
......@@ -494,6 +493,17 @@ check_install_amf_deps(){
fi
echo "Install distro libs"
$SUDO $INSTALLER install $OPTION $PACKAGE_LIST
# fix issue with libboost in U18 for a bare metal deployment
if [[ $OS_DISTRO == "ubuntu" ]]; then
case "$(get_distribution_release)" in
"ubuntu18.04")
$SUDO $INSTALLER remove $OPTION libboost1.65-dev || true
$SUDO $INSTALLER install $OPTION libboost1.67-dev
;;
esac
fi
ret=$?;[[ $ret -ne 0 ]] && return $ret
echo "distro libs installation complete"
......
......@@ -53,7 +53,6 @@ install_fb_folly_from_source(){
gcc-c++ \
$CMAKE \
make \
boost-devel \
libevent-devel \
double-conversion-devel \
glog-devel \
......
......@@ -371,7 +371,7 @@ pipeline {
always {
script {
copyArtifacts(projectName: params.AMF_BT_PipelineName,
filter: '*_results_oai_amf_bt.html',
filter: '*_results_oai_amf_bt*.html',
selector: lastCompleted())
}
}
......@@ -403,7 +403,7 @@ pipeline {
always {
script {
copyArtifacts(projectName: params.CN5G_FED_PipelineName,
filter: '*_results_oai_cn5g.html',
filter: '*_results_oai_cn5g*.html',
selector: lastCompleted())
}
}
......@@ -433,7 +433,7 @@ pipeline {
always {
script {
copyArtifacts(projectName: params.CN5G_FED_OC_PipelineName,
filter: '*_results_oai_cn5g_oc.html',
filter: '*_results_oai_cn5g_oc*.html',
selector: lastCompleted())
}
}
......@@ -520,44 +520,21 @@ pipeline {
archiveArtifacts artifacts: 'docker_logs.zip'
}
// Generating the HTML report
// Generating the HTML report(s)
if ("MERGE".equals(env.gitlabActionType)) {
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=${env.gitlabSourceBranch} --git_src_commit=${env.gitlabMergeRequestLastCommit} --git_pull_request=True --git_target_branch=${env.gitlabTargetBranch} --git_target_commit=${GIT_COMMIT}"
if (fileExists('test_results_oai_amf.html')) {
sh "sed -i -e 's#TEMPLATE_MERGE_REQUEST_LINK#${gitlabMergeRequestLink}#g' test_results_oai_amf.html"
sh "sed -i -e 's#TEMPLATE_MERGE_REQUEST_TEMPLATE#${env.gitlabMergeRequestTitle}#' test_results_oai_amf.html"
}
if (fileExists('test_results_oai_cn5g.html')) {
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}"
}
sh "sed -i -e 's#TEMPLATE_TIME#${JOB_TIMESTAMP}#' test_results_oai_amf.html"
if (fileExists('test_results_oai_amf.html')) {
sh "sed -i -e 's#TEMPLATE_TIME#${JOB_TIMESTAMP}#' test_results_oai_amf.html"
archiveArtifacts artifacts: 'test_results_oai_amf.html'
}
if (fileExists('test_results_oai_cn5g.html')) {
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'
listOfFiles = sh returnStdout: true, script: 'ls test_results*.html'
String[] htmlFiles = listOfFiles.split("\\n")
for (htmlFile in htmlFiles) {
if ("MERGE".equals(env.gitlabActionType)) {
sh "sed -i -e 's#TEMPLATE_MERGE_REQUEST_LINK#${gitlabMergeRequestLink}#g' ${htmlFile}"
sh "sed -i -e 's#TEMPLATE_MERGE_REQUEST_TEMPLATE#${env.gitlabMergeRequestTitle}#' ${htmlFile}"
}
sh "sed -i -e 's#TEMPLATE_TIME#${JOB_TIMESTAMP}#' ${htmlFile}"
archiveArtifacts artifacts: htmlFile
}
// Sending email to commiter
......
......@@ -191,6 +191,16 @@ std::shared_ptr<ue_context> amf_app::ran_amf_id_2_ue_context(
return ue_ctx_key.at(ue_context_key);
}
bool amf_app::ran_amf_id_2_ue_context(
const std::string& ue_context_key, std::shared_ptr<ue_context>& uc) const {
std::shared_lock lock(m_ue_ctx_key);
if (ue_ctx_key.count(ue_context_key) > 0) {
uc = ue_ctx_key.at(ue_context_key);
if (uc.get() == nullptr) return false;
return true;
} else
return false;
}
//------------------------------------------------------------------------------
void amf_app::set_ran_amf_id_2_ue_context(
const string& ue_context_key, std::shared_ptr<ue_context> uc) {
......
......@@ -55,6 +55,8 @@ static uint32_t amf_app_ue_ngap_id_generator = 1;
namespace amf_application {
#define TASK_AMF_APP_PERIODIC_STATISTICS (0)
#define TASK_AMF_MOBILE_REACHABLE_TIMER_EXPIRE (1)
#define TASK_AMF_IMPLICIT_DEREGISTRATION_TIMER_EXPIRE (2)
class amf_app {
private:
......@@ -91,6 +93,10 @@ class amf_app {
bool is_ran_amf_id_2_ue_context(const std::string& ue_context_key) const;
std::shared_ptr<ue_context> ran_amf_id_2_ue_context(
const std::string& ue_context_key) const;
bool ran_amf_id_2_ue_context(
const std::string& ue_context_key, std::shared_ptr<ue_context>& uc) const;
void set_ran_amf_id_2_ue_context(
const std::string& ue_context_key, std::shared_ptr<ue_context> uc);
......
This diff is collapsed.
......@@ -46,6 +46,8 @@
#include "pdu_session_context.hpp"
#include "amf_event.hpp"
#include "RegistrationAccept.hpp"
#include "ue_context.hpp"
#include "itti.hpp"
namespace amf_application {
......@@ -62,6 +64,22 @@ typedef enum {
class amf_n1 {
public:
std::map<long, std::shared_ptr<nas_context>>
amfueid2nas_context; // amf ue ngap id
std::map<std::string, std::shared_ptr<nas_context>> imsi2nas_context;
std::map<std::string, long> supi2amfId;
std::map<std::string, uint32_t> supi2ranId;
mutable std::shared_mutex m_nas_context;
std::map<std::string, std::shared_ptr<nas_context>> guti2nas_context;
mutable std::shared_mutex m_guti2nas_context;
static std::map<std::string, std::string> rand_record;
static uint8_t no_random_delta;
random_state_t random_state;
database_t* db_desc;
amf_n1();
~amf_n1();
void handle_itti_message(itti_uplink_nas_data_ind&);
......@@ -76,16 +94,6 @@ class amf_n1 {
plmn_t plmn);
bool check_security_header_type(SecurityHeaderType& type, uint8_t* buffer);
std::map<long, std::shared_ptr<nas_context>>
amfueid2nas_context; // amf ue ngap id
std::map<std::string, std::shared_ptr<nas_context>> imsi2nas_context;
std::map<std::string, long> supi2amfId;
std::map<std::string, uint32_t> supi2ranId;
mutable std::shared_mutex m_nas_context;
std::map<std::string, std::shared_ptr<nas_context>> guti2nas_context;
mutable std::shared_mutex m_guti2nas_context;
bool is_guti_2_nas_context(const std::string& guti) const;
std::shared_ptr<nas_context> guti_2_nas_context(
const std::string& guti) const;
......@@ -98,7 +106,6 @@ class amf_n1 {
const long& amf_ue_ngap_id) const;
void set_amf_ue_ngap_id_2_nas_context(
const long& amf_ue_ngap_id, std::shared_ptr<nas_context> nc);
database_t* db_desc;
// procedures
// specific procedures running logic
......@@ -161,6 +168,11 @@ class amf_n1 {
void set_5gmm_state(std::shared_ptr<nas_context> nc, _5gmm_state_t state);
void get_5gmm_state(std::shared_ptr<nas_context> nc, _5gmm_state_t& state);
void set_5gcm_state(
std::shared_ptr<nas_context>& nc, const cm_state_t& state);
void get_5gcm_state(
const std::shared_ptr<nas_context>& nc, cm_state_t& state) const;
void handle_ue_reachability_status_change(
std::string supi, uint8_t http_version);
......@@ -170,6 +182,29 @@ class amf_n1 {
void initialize_registration_accept(
std::unique_ptr<nas::RegistrationAccept>& registration_accept);
bool find_ue_context(
const std::shared_ptr<nas_context>& nc, std::shared_ptr<ue_context>& uc);
bool find_ue_context(
uint32_t ran_ue_ngap_id, long amf_ue_ngap_id,
std::shared_ptr<ue_context>& uc);
void mobile_reachable_timer_timeout(
timer_id_t timer_id, uint64_t amf_ue_ngap_id);
void set_mobile_reachable_timer_timeout(
std::shared_ptr<nas_context>& nc, const bool& b);
void get_mobile_reachable_timer_timeout(
const std::shared_ptr<nas_context>& nc, bool& b) const;
bool get_mobile_reachable_timer_timeout(
const std::shared_ptr<nas_context>& nc) const;
void set_mobile_reachable_timer(
std::shared_ptr<nas_context>& nc, const timer_id_t& t);
void set_implicit_deregistration_timer(
std::shared_ptr<nas_context>& nc, const timer_id_t& t);
void implicit_deregistration_timer_timeout(
timer_id_t timer_id, uint64_t amf_ue_ngap_id);
private:
void ue_initiate_de_registration_handle(
uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, bstring nas);
......
......@@ -61,7 +61,6 @@ using namespace oai::smf::model;
using namespace oai::smf::api;
using namespace web;
using namespace web::http;
// Common features like URIs.
using namespace web::http::client;
using namespace config;
using namespace amf_application;
......
......@@ -53,6 +53,7 @@
#include "itti_msg_amf_app.hpp"
#include "logger.hpp"
#include "sctp_server.hpp"
#include "3gpp_24.501.h"
#include <boost/chrono.hpp>
#include <boost/chrono/chrono.hpp>
......@@ -74,8 +75,6 @@ extern amf_n11* amf_n11_inst;
extern amf_config amf_cfg;
extern amf_app* amf_app_inst;
extern statistics stacs;
extern void print_buffer(
const std::string app, const std::string commit, uint8_t* buf, int len);
void amf_n2_task(void*);
......@@ -261,6 +260,21 @@ void amf_n2::handle_itti_message(itti_paging& itti_msg) {
// TODO: check UE reachability status
// get NAS context
std::shared_ptr<nas_context> nc = {};
if (amf_n1_inst->is_amf_ue_id_2_nas_context(itti_msg.amf_ue_ngap_id))
nc = amf_n1_inst->amf_ue_id_2_nas_context(itti_msg.amf_ue_ngap_id);
else {
Logger::amf_n2().warn(
"No existed nas_context with amf_ue_ngap_id(0x%x)",
itti_msg.amf_ue_ngap_id);
}
// Network stops sending paging messages since the mobile reachable timer
// expires
if (amf_n1_inst->get_mobile_reachable_timer_timeout(nc)) {
return;
}
PagingMsg paging_msg = {};
paging_msg.setMessageType();
Logger::amf_n2().debug(
......@@ -1265,6 +1279,25 @@ void amf_n2::handle_itti_message(itti_ue_context_release_complete& itti_msg) {
Logger::amf_n2().debug("Handle UE Context Release Complete ...");
unsigned long amf_ue_ngap_id = itti_msg.ueCtxRelCmpl->getAmfUeNgapId();
uint32_t ran_ue_ngap_id = itti_msg.ueCtxRelCmpl->getRanUeNgapId();
// Change UE status from CM-CONNECTED to CM-IDLE
std::shared_ptr<nas_context> nc;
if (amf_n1_inst->is_amf_ue_id_2_nas_context(amf_ue_ngap_id))
nc = amf_n1_inst->amf_ue_id_2_nas_context(amf_ue_ngap_id);
else {
Logger::amf_n2().warn(
"No existed nas_context with amf_ue_ngap_id(0x%x)", amf_ue_ngap_id);
}
amf_n1_inst->set_5gcm_state(nc, CM_IDLE);
// Start/reset the Mobile Reachable Timer
timer_id_t tid = itti_inst->timer_setup(
MOBILE_REACHABLE_TIMER_NO_EMERGENCY_SERVICES_MIN * 60, 0, TASK_AMF_N1,
TASK_AMF_MOBILE_REACHABLE_TIMER_EXPIRE, amf_ue_ngap_id);
Logger::amf_app().startup("Started mobile reachable timer (tid %d)", tid);
amf_n1_inst->set_mobile_reachable_timer(nc, tid);
amf_n1_inst->set_mobile_reachable_timer_timeout(nc, false);
// TODO: User Location Information IE
// TODO: Information on Recommended Cells & RAN Nodes for Paging IE
......
/*
* 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
*/
#ifndef FILE_3GPP_24_501_SEEN
#define FILE_3GPP_24_501_SEEN
// Table 10.3.1 @3GPP TS 24.501 V16.1.0 (2019-06)
#define T3512_TIMER_VALUE_SEC 3240 // 54 minutes
#define T3512_TIMER_VALUE_MIN 54 // 54 minutes
#define MOBILE_REACHABLE_TIMER_NO_EMERGENCY_SERVICES_MIN \
(T3512_TIMER_VALUE_MIN + 4) // T3512 + 4, not for emergency services
#define IMPLICIT_DEREGISTRATION_TIMER_MIN (T3512_TIMER_VALUE_MIN + 4)
#endif
......@@ -64,7 +64,10 @@ nas_context::nas_context() : _vector(), _5g_he_av(), _5g_av(), kamf() {
is_auth_vectors_present = false;
to_be_register_by_new_suci = false;
ueSecurityCaplen = 0;
nas_status = {};
nas_status = CM_IDLE;
is_mobile_reachable_timer_timeout = false;
mobile_reachable_timer = ITTI_INVALID_TIMER_ID;
implicit_deregistration_timer = ITTI_INVALID_TIMER_ID;
}
//------------------------------------------------------------------------------
......
......@@ -37,6 +37,7 @@
#include "nas_security_context.hpp"
#include "security_def.hpp"
#include "struct.hpp"
#include "itti.hpp"
typedef enum {
_5GMM_STATE_MIN = 0,
......@@ -71,6 +72,9 @@ class nas_context {
uint32_t ran_ue_ngap_id;
cm_state_t nas_status;
_5gmm_state_t _5gmm_state;
bool is_mobile_reachable_timer_timeout;
timer_id_t mobile_reachable_timer;
timer_id_t implicit_deregistration_timer;
// parameters from Registration request
uint8_t registration_type : 3;
......
......@@ -116,11 +116,13 @@ class itti_nsmf_pdusession_release_sm_context : public itti_msg_n11 {
itti_nsmf_pdusession_release_sm_context(
const itti_nsmf_pdusession_release_sm_context& i)
: itti_msg_n11(i) {
supi = i.supi;
supi = i.supi;
pdu_session_id = i.pdu_session_id;
}
public:
std::string supi;
uint8_t pdu_session_id;
};
//-----------------------------------------------------------------------------
......
......@@ -144,9 +144,9 @@ void ULNASTransport::setS_NSSAI(SNSSAI_s snssai) {
bool ULNASTransport::getSnssai(SNSSAI_s& snssai) {
if (ie_s_nssai) {
ie_s_nssai->getValue(snssai);
return 0;
return true;
} else {
return -1;
return false;
}
}
......
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