Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-AMF
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenXG
OpenXG-AMF
Commits
8da86738
Commit
8da86738
authored
Sep 18, 2021
by
dukl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stateless support
parent
b2a7610d
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
425 additions
and
47 deletions
+425
-47
etc/stateless-amf-1.conf
etc/stateless-amf-1.conf
+135
-0
etc/stateless-amf-2.conf
etc/stateless-amf-2.conf
+9
-7
src/amf-app/amf_app.cpp
src/amf-app/amf_app.cpp
+121
-12
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+58
-15
src/amf-app/amf_n11.cpp
src/amf-app/amf_n11.cpp
+26
-3
src/amf-app/amf_n2.cpp
src/amf-app/amf_n2.cpp
+67
-9
src/itti/itti.hpp
src/itti/itti.hpp
+2
-1
src/oai-amf/main.cpp
src/oai-amf/main.cpp
+7
-0
No files found.
etc/stateless-amf-1.conf
0 → 100755
View file @
8da86738
################################################################################
# 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
################################################################################
AMF
=
{
INSTANCE_ID
=
10
;
# 0 is the default
PID_DIRECTORY
=
"/var/run"
;
# /var/run is the default
AMF_NAME
=
"OAI-AMF"
;
RELATIVE_CAPACITY
=
30
;
# Display statistics about whole system (in seconds)
STATISTICS_TIMER_INTERVAL
=
20
;
# YOUR CONFIG HERE
AMF_ID_REGION
=
11000
;
CORE_CONFIGURATION
:
{
EMERGENCY_SUPPORT
=
"false"
;
};
GUAMI
:
{
MCC
=
"460"
;
MNC
=
"99"
;
RegionID
=
"128"
;
AMFSetID
=
"1"
;
AMFPointer
=
"1"
# YOUR GUAMI CONFIG HERE
}
SERVED_GUAMI_LIST
= (
{
MCC
=
"460"
;
MNC
=
"99"
;
RegionID
=
"128"
;
AMFSetID
=
"1"
;
AMFPointer
=
"0"
}
#48bits <MCC><MNC><RegionID><AMFSetID><AMFPointer>
#{MCC = "110"; MNC = "11"; RegionID = "10"; AMFSetID = "1"; AMFPointer = "1"} #48bits <MCC><MNC><RegionID><AMFSetID><AMFPointer>
);
PLMN_SUPPORT_LIST
= (
{
MCC
=
"460"
;
MNC
=
"99"
;
TAC
=
100
;
# YOUR PLMN CONFIG HERE
SLICE_SUPPORT_LIST
= (
{
SST
=
"1"
;
SD
=
"none"
}
# YOUR NSSAI CONFIG HERE
# {SST = "1"; SD = "12"} # YOUR NSSAI CONFIG HERE
)
}
);
INTERFACES
:
{
# AMF binded interface for N1/N2 interface (NGAP)
NGAP_AMF
:
{
INTERFACE_NAME
=
"ens34"
;
# YOUR NETWORK CONFIG HERE
IPV4_ADDRESS
=
"read"
;
PORT
=
9999
;
# YOUR NETWORK CONFIG HERE
PPID
=
60
;
# YOUR NETWORK CONFIG HERE
};
# AMF binded interface for Nausf interface
NAUSF
:
{
INTERFACE_NAME
=
"ens18"
;
# YOUR NETWORK CONFIG HERE
IPV4_ADDRESS
=
"10.103.239.53/16"
;
PORT
=
8383
;
# YOUR NETWORK CONFIG HERE
};
NRF
:
{
IPV4_ADDRESS
=
"10.103.239.54"
;
# YOUR NRF CONFIG HERE
PORT
=
80
;
# YOUR NRF CONFIG HERE (default: 80)
API_VERSION
=
"v1"
;
# YOUR NRF API VERSION FOR SBI CONFIG HERE
};
SUPPORT_FEATURES
:
{
# STRING, {"yes", "no"},
NF_REGISTRATION
=
"yes"
;
# Set to yes if AMF resgisters to an NRF
SMF_SELECTION
=
"no"
;
# Set to yes to enable SMF discovery and selection
EXTERNAL_AUSF
=
"yes"
;
# Set to yes if AMF works with an external AUSF
EXTERNAL_UDM
=
"no"
;
# Set to yes if AMF works with an external UDM
};
# AMF binded interface for N11
N11
:
{
INTERFACE_NAME
=
"ens19"
;
# YOUR NETWORK CONFIG HERE
IPV4_ADDRESS
=
"read"
;
PORT
=
8282
;
# YOUR NETWORK CONFIG HERE
SMF_INSTANCES_POOL
= (
{
SMF_INSTANCE_ID
=
1
;
IPV4_ADDRESS
=
"10.103.239.53"
;
PORT
=
"8889"
;
VERSION
=
"v2"
;
SELECTED
=
"true"
},
# YOUR SMF CONFIG HERE
{
SMF_INSTANCE_ID
=
2
;
IPV4_ADDRESS
=
"192.168.122.2"
;
PORT
=
"80"
;
VERSION
=
"v1"
;
SELECTED
=
"false"
}
# YOUR SMF CONFIG HERE
);
};
};
AUTHENTICATION
:
{
## MySQL mandatory options
MYSQL_server
=
"127.0.0.1"
;
# MySQL Server address
MYSQL_user
=
"witcomm"
;
# Database server login
MYSQL_pass
=
"123456"
;
# Database server password
MYSQL_db
=
"witcomm"
;
# Your database name
## OP
OPERATOR_key
=
"63bfa50ee6523365ff14c1f45f88737d"
;
# OP key matching your database
RANDOM
=
"true"
;
};
NAS
:
{
ORDERED_SUPPORTED_INTEGRITY_ALGORITHM_LIST
= [
"NIA1"
,
"NIA1"
,
"NIA1"
];
ORDERED_SUPPORTED_CIPHERING_ALGORITHM_LIST
= [
"NEA0"
,
"NEA1"
,
"NEA2"
];
};
};
MODULES
=
{
NGAP_MESSAGE
= (
{
MSG_NAME
=
"NGSetupRequest"
;
ProcedureCode
=
21
;
TypeOfMessage
=
"initialMessage"
}
);
};
etc/stateless-amf-2.conf
View file @
8da86738
...
...
@@ -28,8 +28,10 @@ AMF =
RELATIVE_CAPACITY
=
30
;
# Display statistics about whole system (in seconds)
STATISTICS_TIMER_INTERVAL
=
20
;
# YOUR CONFIG HERE
STATISTICS_TIMER_INTERVAL
=
4
;
# YOUR CONFIG HERE
AMF_ID_REGION
=
4000
;
CORE_CONFIGURATION
:
{
EMERGENCY_SUPPORT
=
"false"
;
...
...
@@ -70,7 +72,7 @@ AMF =
NAUSF
:
{
INTERFACE_NAME
=
"ens18"
;
# YOUR NETWORK CONFIG HERE
IPV4_ADDRESS
=
"
read
"
;
IPV4_ADDRESS
=
"
10.103.239.53/16
"
;
PORT
=
8383
;
# YOUR NETWORK CONFIG HERE
};
...
...
@@ -84,19 +86,19 @@ AMF =
{
# STRING, {"yes", "no"},
NF_REGISTRATION
=
"yes"
;
# Set to yes if AMF resgisters to an NRF
SMF_SELECTION
=
"
yes
"
;
# Set to yes to enable SMF discovery and selection
SMF_SELECTION
=
"
no
"
;
# Set to yes to enable SMF discovery and selection
EXTERNAL_AUSF
=
"yes"
;
# Set to yes if AMF works with an external AUSF
EXTERNAL_UDM
=
"no"
;
# Set to yes if AMF works with an external UDM
};
# AMF binded interface for N11
N11
:
{
INTERFACE_NAME
=
"ens1
9
"
;
# YOUR NETWORK CONFIG HERE
INTERFACE_NAME
=
"ens1
8
"
;
# YOUR NETWORK CONFIG HERE
IPV4_ADDRESS
=
"read"
;
PORT
=
828
3
;
# YOUR NETWORK CONFIG HERE
PORT
=
828
2
;
# YOUR NETWORK CONFIG HERE
SMF_INSTANCES_POOL
= (
{
SMF_INSTANCE_ID
=
1
;
IPV4_ADDRESS
=
"10.103.239.53"
;
PORT
=
"8889"
;
VERSION
=
"v2"
;
SELECTED
=
"
fals
e"
},
# YOUR SMF CONFIG HERE
{
SMF_INSTANCE_ID
=
1
;
IPV4_ADDRESS
=
"10.103.239.53"
;
PORT
=
"8889"
;
VERSION
=
"v2"
;
SELECTED
=
"
tru
e"
},
# YOUR SMF CONFIG HERE
{
SMF_INSTANCE_ID
=
2
;
IPV4_ADDRESS
=
"192.168.122.2"
;
PORT
=
"80"
;
VERSION
=
"v1"
;
SELECTED
=
"false"
}
# YOUR SMF CONFIG HERE
);
};
...
...
src/amf-app/amf_app.cpp
View file @
8da86738
...
...
@@ -43,13 +43,18 @@
#include "amf_n2.hpp"
#include "amf_statistics.hpp"
#include "ngap_app.hpp"
#include <time.h>
#include <sys/time.h>
#include <numeric>
#include <fstream>
#include <curl/curl.h>
#include <nlohmann/json.hpp>
using
namespace
ngap
;
using
namespace
nas
;
//using namespace amf ;
using
namespace
amf_application
;
using
namespace
config
;
extern
void
print_buffer
(
const
std
::
string
app
,
const
std
::
string
commit
,
uint8_t
*
buf
,
int
len
);
extern
amf_app
*
amf_app_inst
;
...
...
@@ -59,9 +64,19 @@ amf_n1* amf_n1_inst = nullptr;
amf_n11
*
amf_n11_inst
=
nullptr
;
extern
amf_config
amf_cfg
;
extern
statistics
stacs
;
extern
std
::
vector
<
long
>
delay_nudsf
;
extern
ofstream
timeline
;
void
amf_app_task
(
void
*
);
uint32_t
golbal_tmsi
=
1
;
int
last_delay_nudsf_size
=
0
;
std
::
vector
<
long
>
sig_delay_amf_n2
;
std
::
vector
<
long
>
sig_delay_amf_n1
;
std
::
vector
<
long
>
sig_delay_amf_n11
;
std
::
vector
<
long
>
sig_delay_amf_app
;
std
::
vector
<
long
>
amf_capability
;
//------------------------------------------------------------------------------
amf_app
::
amf_app
(
const
amf_config
&
amf_cfg
)
{
...
...
@@ -98,6 +113,51 @@ void amf_app::allRegistredModulesInit(const amf_modules& modules) {
Logger
::
amf_app
().
info
(
"Initiating all registered modules"
);
}
std
::
size_t
callback_plugin
(
const
char
*
in
,
std
::
size_t
size
,
std
::
size_t
num
,
std
::
string
*
out
)
{
const
std
::
size_t
totalBytes
(
size
*
num
);
out
->
append
(
in
,
totalBytes
);
return
totalBytes
;
}
void
send_algorithm_omf_info_to_plugin
(
long
len
,
long
cap
){
nlohmann
::
json
j_data
;
j_data
[
"ip_address"
]
=
"10.103.239.116"
;
j_data
[
"current_message_queue_len"
]
=
len
;
j_data
[
"capability"
]
=
cap
;
std
::
string
jsonData
=
j_data
.
dump
();
curl_global_init
(
CURL_GLOBAL_ALL
);
CURL
*
curl
=
curl_easy_init
();
if
(
curl
)
{
CURLcode
res
=
{};
struct
curl_slist
*
headers
=
nullptr
;
headers
=
curl_slist_append
(
headers
,
"content-type: application/json"
);
headers
=
curl_slist_append
(
headers
,
"Expect:"
);
curl_easy_setopt
(
curl
,
CURLOPT_HTTPHEADER
,
headers
);
curl_easy_setopt
(
curl
,
CURLOPT_URL
,
"http://10.103.239.53:38414/nplugin-dr/v1/1/algorithm/omf"
);
curl_easy_setopt
(
curl
,
CURLOPT_HTTPGET
,
1
);
curl_easy_setopt
(
curl
,
CURLOPT_CUSTOMREQUEST
,
"POST"
);
curl_easy_setopt
(
curl
,
CURLOPT_TIMEOUT_MS
,
100
);
// Response information.
long
httpCode
=
{
0
};
std
::
unique_ptr
<
std
::
string
>
httpData
(
new
std
::
string
());
std
::
unique_ptr
<
std
::
string
>
httpHeaderData
(
new
std
::
string
());
// Hook up data handling function.
curl_easy_setopt
(
curl
,
CURLOPT_WRITEFUNCTION
,
&
callback_plugin
);
curl_easy_setopt
(
curl
,
CURLOPT_WRITEDATA
,
httpData
.
get
());
curl_easy_setopt
(
curl
,
CURLOPT_HEADERDATA
,
httpHeaderData
.
get
());
curl_easy_setopt
(
curl
,
CURLOPT_POSTFIELDSIZE
,
jsonData
.
length
());
curl_easy_setopt
(
curl
,
CURLOPT_POSTFIELDS
,
jsonData
.
c_str
());
res
=
curl_easy_perform
(
curl
);
curl_easy_getinfo
(
curl
,
CURLINFO_RESPONSE_CODE
,
&
httpCode
);
if
(
httpCode
!=
0
)
Logger
::
amf_app
().
debug
(
"received info: %s"
,(
*
httpData
.
get
()).
c_str
());
}
}
//------------------------------------------------------------------------------
void
amf_app_task
(
void
*
)
{
const
task_id_t
task_id
=
TASK_AMF_APP
;
...
...
@@ -110,6 +170,7 @@ void amf_app_task(void*) {
do
{
std
::
shared_ptr
<
itti_msg
>
shared_msg
=
itti_inst
->
receive_msg
(
task_id
);
auto
*
msg
=
shared_msg
.
get
();
struct
timeval
tv1
;
struct
timezone
tz1
;
gettimeofday
(
&
tv1
,
&
tz1
);
long
t1
=
tv1
.
tv_sec
*
1000000
+
tv1
.
tv_usec
;
timer_id_t
tid
;
switch
(
msg
->
msg_type
)
{
case
NAS_SIG_ESTAB_REQ
:
{
...
...
@@ -148,12 +209,52 @@ void amf_app_task(void*) {
case
TIME_OUT
:
if
(
itti_msg_timeout
*
to
=
dynamic_cast
<
itti_msg_timeout
*>
(
msg
))
{
switch
(
to
->
arg1_user
)
{
case
TASK_AMF_APP_PERIODIC_STATISTICS
:
case
TASK_AMF_APP_PERIODIC_STATISTICS
:
{
tid
=
itti_inst
->
timer_setup
(
amf_cfg
.
statistics_interval
,
0
,
TASK_AMF_APP
,
TASK_AMF_APP_PERIODIC_STATISTICS
,
0
);
stacs
.
display
();
break
;
long
average_cap
=
0
;
for
(
int
i
=
0
;
i
<
amf_capability
.
size
();
i
++
){
average_cap
+=
amf_capability
[
i
];
}
if
(
amf_capability
.
size
()
!=
0
)
average_cap
=
(
double
)
average_cap
/
amf_capability
.
size
();
Logger
::
amf_app
().
debug
(
"Average processing capability of this AMF instance %d us/msgs"
,
average_cap
);
//amf_capability.swap(std::vector<long>());
std
::
vector
<
long
>
().
swap
(
amf_capability
);
struct
timeval
tv
;
struct
timezone
tz
;
gettimeofday
(
&
tv
,
&
tz
);
long
start
=
tv
.
tv_sec
*
1000000
+
tv
.
tv_usec
;
ofstream
tsm
(
"/home/xgcore/total_signaling_msg.txt"
,
ios
::
app
);
tsm
<<
start
<<
" "
;
tsm
<<
"TASK_AMF_N2 "
<<
itti_inst
->
itti_task_ctxts
[
TASK_AMF_N2
]
->
msg_queue
.
size
()
<<
" "
;
tsm
<<
"TASK_AMF_N1 "
<<
itti_inst
->
itti_task_ctxts
[
TASK_AMF_N1
]
->
msg_queue
.
size
()
<<
" "
;
tsm
<<
"TASK_AMF_N11 "
<<
itti_inst
->
itti_task_ctxts
[
TASK_AMF_N11
]
->
msg_queue
.
size
()
<<
" "
;
tsm
<<
"TASK_AMF_APP "
<<
itti_inst
->
itti_task_ctxts
[
TASK_AMF_APP
]
->
msg_queue
.
size
()
<<
" "
;
tsm
<<
"capability "
<<
average_cap
<<
" "
<<
std
::
endl
;
send_algorithm_omf_info_to_plugin
(
itti_inst
->
itti_task_ctxts
[
TASK_AMF_N2
]
->
msg_queue
.
size
()
+
itti_inst
->
itti_task_ctxts
[
TASK_AMF_N1
]
->
msg_queue
.
size
()
+
itti_inst
->
itti_task_ctxts
[
TASK_AMF_N11
]
->
msg_queue
.
size
()
+
itti_inst
->
itti_task_ctxts
[
TASK_AMF_APP
]
->
msg_queue
.
size
(),
average_cap
);
//stacs.display();
//double sumValue = accumulate(begin(delay_nudsf), end(delay_nudsf), 0.0);
//double meanValue = sumValue / delay_nudsf.size();
//Logger::amf_app().debug("dukl meanValue %4f", meanValue);
#if 0
if(delay_nudsf.size() == last_delay_nudsf_size && delay_nudsf.size()!=0){
Logger::amf_app().debug("total time %9f", accumulate(begin(delay_nudsf), end(delay_nudsf), 0.0));
timeline.open("/home/xgcore/dukl.txt", ios::out);
timeline.setf(ios::fixed, ios::floatfield);
timeline.precision(6);
if(!timeline.is_open()){
Logger::amf_app().error("cannot open file dukl.txt");
}else{
Logger::amf_app().debug("open file dukl.txt");
}
Logger::amf_app().debug("Recording statics");
for(int i=0; i<delay_nudsf.size();i++){
timeline << delay_nudsf.at(i) << std::endl;
}
timeline.close();
}
last_delay_nudsf_size = delay_nudsf.size();
#endif
}
break
;
case
TASK_AMF_APP_TIMEOUT_NRF_HEARTBEAT
:
amf_app_inst
->
timer_nrf_heartbeat_timeout
(
to
->
timer_id
,
to
->
arg2_user
);
...
...
@@ -168,6 +269,8 @@ void amf_app_task(void*) {
default:
Logger
::
amf_app
().
info
(
"no handler for msg type %d"
,
msg
->
msg_type
);
}
struct
timeval
tv2
;
struct
timezone
tz2
;
gettimeofday
(
&
tv2
,
&
tz2
);
long
t2
=
tv2
.
tv_sec
*
1000000
+
tv2
.
tv_usec
;
//long one_time = t2 - t1; amf_capability.push_back(one_time);
}
while
(
true
);
}
...
...
@@ -320,15 +423,18 @@ void amf_app::handle_itti_message(
std
::
shared_ptr
<
ue_context
>
uc
=
std
::
shared_ptr
<
ue_context
>
(
new
ue_context
());
string
ue_context_key
=
"app_ue_ranid_"
+
to_string
(
itti_msg
.
ran_ue_ngap_id
)
+
"-amfid_"
+
to_string
(
amf_ue_ngap_id
);
std
::
string
record_id
=
"amf_ue_ngap_id=
\'
"
+
to_string
(
amf_ue_ngap_id
)
+
"
\'
"
;
//
std::string udsf_url = "http://10.103.239.53:7123/nudsf-dr/v1/amfdata/" + std::string("ue_context/records/") + record_id ;
std
::
string
udsf_url
=
"http://10.103.239.53:7123/nudsf-dr/v1/amfdata/"
+
std
::
string
(
"ue_context/records/"
)
+
"RECORD_ID=
\'
"
+
ue_context_key
+
"
\'
"
;
std
::
string
udsf_url
=
"http://10.103.239.53:7123/nudsf-dr/v1/amfdata/"
+
std
::
string
(
"ue_context/records/"
)
+
record_id
;
//
std::string udsf_url = "http://10.103.239.53:7123/nudsf-dr/v1/amfdata/" + std::string("ue_context/records/") + "RECORD_ID=\'" + ue_context_key + "\'";
if
(
!
amf_n2_inst
->
curl_http_client_udsf
(
udsf_url
,
""
,
"GET"
,
udsf_response
)){
Logger
::
amf_n2
().
error
(
"No existing ue_context with ue_context_key ..."
);
}
else
if
(
udsf_response
.
dump
().
length
()
<
8
){
Logger
::
amf_n2
().
error
(
"No existing ue_context with ue_context_key ....."
);
}
else
{
Logger
::
amf_n2
().
debug
(
"udsf_response: %s"
,
udsf_response
.
dump
().
c_str
());
struct
timeval
tv1
;
struct
timezone
tz1
;
gettimeofday
(
&
tv1
,
&
tz1
);
long
start
=
tv1
.
tv_sec
*
1000000
+
tv1
.
tv_usec
;
uc
.
get
()
->
ue_context_from_json
(
udsf_response
);
struct
timeval
tv2
;
struct
timezone
tz2
;
gettimeofday
(
&
tv2
,
&
tz2
);
long
end
=
tv2
.
tv_sec
*
1000000
+
tv2
.
tv_usec
;
long
one_time
=
end
-
start
;
//delay_nudsf.push_back(one_time);
}
set_ran_amf_id_2_ue_context
(
ue_context_key
,
uc
);
// Update ue_context
...
...
@@ -346,8 +452,8 @@ void amf_app::handle_itti_message(
//Update ue_context to UDSF
Logger
::
amf_app
().
debug
(
"Update ue_context to UDSF"
);
record_id
=
"amf_ue_ngap_id=
\'
"
+
to_string
(
amf_ue_ngap_id
)
+
"
\'
"
;
//
udsf_url = "http://10.103.239.53:7123/nudsf-dr/v1/amfdata/" + std::string("ue_context/records/") + record_id ;
udsf_url
=
"http://10.103.239.53:7123/nudsf-dr/v1/amfdata/"
+
std
::
string
(
"ue_context/records/"
)
+
"RECORD_ID=
\'
"
+
ue_context_key
+
"
\'
"
;
udsf_url
=
"http://10.103.239.53:7123/nudsf-dr/v1/amfdata/"
+
std
::
string
(
"ue_context/records/"
)
+
record_id
;
//
udsf_url = "http://10.103.239.53:7123/nudsf-dr/v1/amfdata/" + std::string("ue_context/records/") + "RECORD_ID=\'" + ue_context_key + "\'";
nlohmann
::
json
udsf_ue_context
;
nlohmann
::
json
cgi
;
cgi
[
"Content-ID"
]
=
"cgi"
;
...
...
@@ -564,16 +670,19 @@ bool amf_app::generate_5g_guti(
// uc = ran_amf_id_2_ue_context(ue_context_key);
std
::
shared_ptr
<
ue_context
>
uc
=
std
::
shared_ptr
<
ue_context
>
(
new
ue_context
());
nlohmann
::
json
udsf_response
;
std
::
string
record_id
=
"RECORD_ID=
\'
"
+
to_string
(
amfid
)
+
"
\'
"
;
//
std::string record_id = "RECORD_ID=\'" + ue_context_key + "\'";
//
std::string udsf_url = "http://10.103.239.53:7123/nudsf-dr/v1/amfdata/" + std::string("ue_context/records/") + record_id;
std
::
string
udsf_url
=
"http://10.103.239.53:7123/nudsf-dr/v1/amfdata/"
+
std
::
string
(
"ue_context/records/"
)
+
"RECORD_ID=
\'
"
+
ue_context_key
+
"
\'
"
;
//
std::string record_id = "RECORD_ID=\'" + to_string(amfid) + "\'";
std
::
string
record_id
=
"RECORD_ID=
\'
"
+
ue_context_key
+
"
\'
"
;
std
::
string
udsf_url
=
"http://10.103.239.53:7123/nudsf-dr/v1/amfdata/"
+
std
::
string
(
"ue_context/records/"
)
+
record_id
;
//
std::string udsf_url = "http://10.103.239.53:7123/nudsf-dr/v1/amfdata/" + std::string("ue_context/records/") + "RECORD_ID=\'" + ue_context_key + "\'";
if
(
!
amf_n2_inst
->
curl_http_client_udsf
(
udsf_url
,
""
,
"GET"
,
udsf_response
)){
Logger
::
amf_n2
().
error
(
"No existing gNG context with assoc_id"
);
return
false
;
}
Logger
::
amf_n2
().
debug
(
"udsf_response: %s"
,
udsf_response
.
dump
().
c_str
());
struct
timeval
tv1
;
struct
timezone
tz1
;
gettimeofday
(
&
tv1
,
&
tz1
);
long
start
=
tv1
.
tv_sec
*
1000000
+
tv1
.
tv_usec
;
uc
.
get
()
->
ue_context_from_json
(
udsf_response
);
struct
timeval
tv2
;
struct
timezone
tz2
;
gettimeofday
(
&
tv2
,
&
tz2
);
long
end
=
tv2
.
tv_sec
*
1000000
+
tv2
.
tv_usec
;
long
one_time
=
end
-
start
;
//delay_nudsf.push_back(one_time);
...
...
src/amf-app/amf_n1.cpp
View file @
8da86738
...
...
@@ -87,6 +87,10 @@ extern amf_n11 *amf_n11_inst;
extern
amf_config
amf_cfg
;
extern
amf_app
*
amf_app_inst
;
extern
amf_n2
*
amf_n2_inst
;
extern
std
::
vector
<
long
>
delay_nudsf
;
extern
std
::
vector
<
long
>
amf_capability
;
extern
statistics
stacs
;
extern
void
convert_string_2_hex
(
std
::
string
&
input
,
std
::
string
&
output
);
extern
unsigned
char
*
format_string_as_hex
(
std
::
string
str
);
...
...
@@ -106,6 +110,7 @@ void amf_n1_task(void *) {
do
{
std
::
shared_ptr
<
itti_msg
>
shared_msg
=
itti_inst
->
receive_msg
(
task_id
);
auto
*
msg
=
shared_msg
.
get
();
struct
timeval
tv1
;
struct
timezone
tz1
;
gettimeofday
(
&
tv1
,
&
tz1
);
long
t1
=
tv1
.
tv_sec
*
1000000
+
tv1
.
tv_usec
;
switch
(
msg
->
msg_type
)
{
case
UL_NAS_DATA_IND
:
{
// receive nas message buffer from amf_n2
...
...
@@ -123,6 +128,8 @@ void amf_n1_task(void *) {
default:
Logger
::
amf_n1
().
error
(
"No handler for msg type %d"
,
msg
->
msg_type
);
}
struct
timeval
tv2
;
struct
timezone
tz2
;
gettimeofday
(
&
tv2
,
&
tz2
);
long
t2
=
tv2
.
tv_sec
*
1000000
+
tv2
.
tv_usec
;
long
one_time
=
t2
-
t1
;
amf_capability
.
push_back
(
one_time
);
}
while
(
true
);
}
...
...
@@ -157,7 +164,10 @@ void amf_n1::handle_itti_message(itti_downlink_nas_transfer &itti_msg) {
}
else
{
Logger
::
amf_n1
().
debug
(
"udsf_response %s"
,
udsf_response
.
dump
().
c_str
());
nc
=
std
::
shared_ptr
<
nas_context
>
(
new
nas_context
());
struct
timeval
tv1
;
struct
timezone
tz1
;
gettimeofday
(
&
tv1
,
&
tz1
);
long
start
=
tv1
.
tv_sec
*
1000000
+
tv1
.
tv_usec
;
nc
.
get
()
->
nas_context_from_json
(
udsf_response
);
struct
timeval
tv2
;
struct
timezone
tz2
;
gettimeofday
(
&
tv2
,
&
tz2
);
long
end
=
tv2
.
tv_sec
*
1000000
+
tv2
.
tv_usec
;
long
one_time
=
end
-
start
;
//delay_nudsf.push_back(one_time);
set_amf_ue_ngap_id_2_nas_context
(
amf_ue_ngap_id
,
nc
);
Logger
::
amf_n1
().
debug
(
"GET nas_context (%p) from UDSF using amf_ue_ngap_id (%d) ....."
,
nc
.
get
(),
amf_ue_ngap_id
);
}
...
...
@@ -320,7 +330,10 @@ void amf_n1::handle_itti_message(itti_uplink_nas_data_ind &nas_data_ind) {
}
else
{
Logger
::
amf_n1
().
debug
(
"udsf_response %s"
,
udsf_response
.
dump
().
c_str
());
nc
=
std
::
shared_ptr
<
nas_context
>
(
new
nas_context
());
struct
timeval
tv1
;
struct
timezone
tz1
;
gettimeofday
(
&
tv1
,
&
tz1
);
long
start
=
tv1
.
tv_sec
*
1000000
+
tv1
.
tv_usec
;
nc
.
get
()
->
nas_context_from_json
(
udsf_response
);
struct
timeval
tv2
;
struct
timezone
tz2
;
gettimeofday
(
&
tv2
,
&
tz2
);
long
end
=
tv2
.
tv_sec
*
1000000
+
tv2
.
tv_usec
;
long
one_time
=
end
-
start
;
//delay_nudsf.push_back(one_time);
set_amf_ue_ngap_id_2_nas_context
(
amf_ue_ngap_id
,
nc
);
Logger
::
amf_n1
().
debug
(
"GET nas_context (%p) from UDSF using amf_ue_ngap_id (%d) ....."
,
nc
.
get
(),
amf_ue_ngap_id
);
}
...
...
@@ -653,10 +666,10 @@ void amf_n1::nas_signalling_establishment_request_handle(
// udsf_url = "http://10.103.239.53:7123/nudsf-dr/v1/amfdata/" + std::string("nas_context/records/") + std::to_string(nc.get()->amf_ue_ngap_id) ;
// if(!amf_n2_inst->curl_http_client_udsf(udsf_url,"","GET",udsf_response)){
// Logger::amf_n
2
().error("No existing nas context with amf_ue_ngap_id (%d)", nc.get()->amf_ue_ngap_id);
// Logger::amf_n
1
().error("No existing nas context with amf_ue_ngap_id (%d)", nc.get()->amf_ue_ngap_id);
// return;
// }
// Logger::amf_n
2
().debug("udsf_response: %s", udsf_response.dump().c_str());
// Logger::amf_n
1
().debug("udsf_response: %s", udsf_response.dump().c_str());
// nas_context *nc1 = new nas_context();
...
...
@@ -1004,11 +1017,14 @@ void amf_n1::service_request_handle(bool isNasSig,
std
::
string
udsf_url
=
"http://10.103.239.53:7123/nudsf-dr/v1/amfdata/"
+
std
::
string
(
"pdu_session_context/records/"
)
+
record_id
;
bool
is_supi_to_pdu_ctx_udsf
=
amf_n2_inst
->
curl_http_client_udsf
(
udsf_url
,
""
,
"GET"
,
udsf_response
);
if
(
!
is_supi_to_pdu_ctx_udsf
){
Logger
::
amf_n
2
().
error
(
"No existing pdu_session_context with assoc_id "
);
Logger
::
amf_n
1
().
error
(
"No existing pdu_session_context with assoc_id "
);
}
else
{
Logger
::
amf_n2
().
debug
(
"udsf_response: %s"
,
udsf_response
.
dump
().
c_str
());
Logger
::
amf_n1
().
debug
(
"udsf_response: %s"
,
udsf_response
.
dump
().
c_str
());
struct
timeval
tv1
;
struct
timezone
tz1
;
gettimeofday
(
&
tv1
,
&
tz1
);
long
start
=
tv1
.
tv_sec
*
1000000
+
tv1
.
tv_usec
;
psc
.
get
()
->
pdu_session_context_from_json
(
udsf_response
);
struct
timeval
tv2
;
struct
timezone
tz2
;
gettimeofday
(
&
tv2
,
&
tz2
);
long
end
=
tv2
.
tv_sec
*
1000000
+
tv2
.
tv_usec
;
long
one_time
=
end
-
start
;
//delay_nudsf.push_back(one_time);
//psc = std::shared_ptr<pdu_session_context>(psc1);
}
psc
.
get
()
->
ran_ue_ngap_id
=
ran_ue_ngap_id
;
...
...
@@ -1701,10 +1717,10 @@ void amf_n1::registration_request_handle(bool isNasSig,
#endif
// udsf_url = "http://10.103.239.53:7123/nudsf-dr/v1/amfdata/" + std::string("nas_context/records/") + std::to_string(nc.get()->amf_ue_ngap_id) ;
// if(!amf_n2_inst->curl_http_client_udsf(udsf_url,"","GET",udsf_response)){
// Logger::amf_n
2
().error("No existing gNG context with assoc_id (%d)", nc.get()->amf_ue_ngap_id);
// Logger::amf_n
1
().error("No existing gNG context with assoc_id (%d)", nc.get()->amf_ue_ngap_id);
// return;
// }
// Logger::amf_n
2
().debug("udsf_response: %s", udsf_response.dump().c_str());
// Logger::amf_n
1
().debug("udsf_response: %s", udsf_response.dump().c_str());
// nas_context *nc1 = new nas_context();
...
...
@@ -1829,6 +1845,7 @@ std::shared_ptr<nas_context> amf_n1::guti_2_nas_context_in_udsf(const std::strin
bool
amf_n1
::
is_amf_ue_id_2_nas_context_in_udsf
(
const
long
&
amf_ue_ngap_id
)
const
{
Logger
::
amf_n1
().
debug
(
"try to get "
);
nlohmann
::
json
udsf_response
;
//std::string record_id = "amf_ue_ngap_id=\'" + to_string(amf_ue_ngap_id) + "\'";
std
::
string
record_id
=
"RECORD_ID=
\'
"
+
to_string
(
amf_ue_ngap_id
)
+
"
\'
"
;
std
::
string
udsf_url
=
"http://10.103.239.53:7123/nudsf-dr/v1/amfdata/"
+
std
::
string
(
"nas_context/records/"
)
+
record_id
;
return
(
amf_n2_inst
->
curl_http_client_udsf
(
udsf_url
,
""
,
"GET"
,
udsf_response
));
...
...
@@ -1836,6 +1853,7 @@ bool amf_n1::is_amf_ue_id_2_nas_context_in_udsf(const long& amf_ue_ngap_id) cons
//std::shared_ptr<nas_context> amf_n1::amf_ue_id_2_nas_context_in_udsf(const long& amf_ue_ngap_id) const {
void
amf_n1
::
amf_ue_id_2_nas_context_in_udsf
(
const
long
&
amf_ue_ngap_id
,
std
::
shared_ptr
<
nas_context
>&
nc
)
const
{
nlohmann
::
json
udsf_response
;
//std::string record_id = "amf_ue_ngap_id=\'" + to_string(amf_ue_ngap_id) + "\'";
std
::
string
record_id
=
"RECORD_ID=
\'
"
+
to_string
(
amf_ue_ngap_id
)
+
"
\'
"
;
std
::
string
udsf_url
=
"http://10.103.239.53:7123/nudsf-dr/v1/amfdata/"
+
std
::
string
(
"nas_context/records/"
)
+
record_id
;
if
(
!
amf_n2_inst
->
curl_http_client_udsf
(
udsf_url
,
""
,
"GET"
,
udsf_response
))
...
...
@@ -1843,7 +1861,10 @@ void amf_n1::amf_ue_id_2_nas_context_in_udsf(const long& amf_ue_ngap_id, std::sh
Logger
::
amf_n1
().
error
(
"No existing nas_context with amf_ue_ngap_id %s"
,
to_string
(
amf_ue_ngap_id
).
c_str
());
return
;
}
struct
timeval
tv1
;
struct
timezone
tz1
;
gettimeofday
(
&
tv1
,
&
tz1
);
long
start
=
tv1
.
tv_sec
*
1000000
+
tv1
.
tv_usec
;
nc
.
get
()
->
nas_context_from_json
(
udsf_response
);
struct
timeval
tv2
;
struct
timezone
tz2
;
gettimeofday
(
&
tv2
,
&
tz2
);
long
end
=
tv2
.
tv_sec
*
1000000
+
tv2
.
tv_usec
;
long
one_time
=
end
-
start
;
//delay_nudsf.push_back(one_time);
return
;
}
...
...
@@ -3215,15 +3236,24 @@ void amf_n1::security_mode_complete_handle(uint32_t ran_ue_ngap_id,
//uc = amf_app_inst->ran_amf_id_2_ue_context(ue_context_key);
nlohmann
::
json
udsf_response
;
//std::string udsf_url = "http://10.103.239.53:7123/nudsf-dr/v1/amfdata/" + std::string("ue_context/records/") + "RECORD_ID=\'" + to_string(amf_ue_ngap_id) + "\'";
std
::
string
udsf_url
=
"http://10.103.239.53:7123/nudsf-dr/v1/amfdata/"
+
std
::
string
(
"ue_context/records/"
)
+
"RECORD_ID=
\'
"
+
ue_context_key
+
"
\'
"
;
if
(
!
amf_n2_inst
->
curl_http_client_udsf
(
udsf_url
,
""
,
"GET"
,
udsf_response
)){
Logger
::
amf_n2
().
error
(
"No existing ue_context with ue_context_key ..."
);
Logger
::
amf_n1
().
error
(
"No existing ue_context with ue_context_key ..."
);
return
;
}
else
if
(
udsf_response
.
dump
().
length
()
<
8
){
Logger
::
amf_n2
().
error
(
"No existing ue_context with ue_context_key ....."
);
Logger
::
amf_n1
().
error
(
"No existing ue_context with ue_context_key ....."
);
Logger
::
amf_n1
().
debug
(
"udsf_response: %s"
,
udsf_response
.
dump
().
c_str
());
return
;
}
else
{
Logger
::
amf_n
2
().
debug
(
"udsf_response: %s"
,
udsf_response
.
dump
().
c_str
());
Logger
::
amf_n
1
().
debug
(
"udsf_response: %s"
,
udsf_response
.
dump
().
c_str
());
uc
=
std
::
shared_ptr
<
ue_context
>
(
new
ue_context
());
Logger
::
amf_n1
().
debug
(
"Parse Start"
);
struct
timeval
tv1
;
struct
timezone
tz1
;
gettimeofday
(
&
tv1
,
&
tz1
);
long
start
=
tv1
.
tv_sec
*
1000000
+
tv1
.
tv_usec
;
uc
.
get
()
->
ue_context_from_json
(
udsf_response
);
struct
timeval
tv2
;
struct
timezone
tz2
;
gettimeofday
(
&
tv2
,
&
tz2
);
long
end
=
tv2
.
tv_sec
*
1000000
+
tv2
.
tv_usec
;
long
one_time
=
end
-
start
;
//delay_nudsf.push_back(one_time);
Logger
::
amf_n1
().
debug
(
"Parse End"
);
}
amf_app_inst
->
set_ran_amf_id_2_ue_context
(
ue_context_key
,
uc
);
...
...
@@ -3244,12 +3274,14 @@ void amf_n1::security_mode_complete_handle(uint32_t ran_ue_ngap_id,
std
::
string
mcc
;
std
::
string
mnc
;
uint32_t
tmsi
=
0
;
Logger
::
amf_n1
().
debug
(
"???????????????/ -1"
);
if
(
!
amf_app_inst
->
generate_5g_guti
(
ran_ue_ngap_id
,
amf_ue_ngap_id
,
mcc
,
mnc
,
tmsi
))
{
Logger
::
amf_n1
().
error
(
"Generate 5G GUTI error! exit"
);
// TODO:
return
;
}
Logger
::
amf_n1
().
debug
(
"???????????????/ -2"
);
regAccept
->
set5G_GUTI
(
mcc
,
mnc
,
amf_cfg
.
guami
.
regionID
,
amf_cfg
.
guami
.
AmfSetID
,
amf_cfg
.
guami
.
AmfPointer
,
tmsi
);
...
...
@@ -3263,6 +3295,7 @@ void amf_n1::security_mode_complete_handle(uint32_t ran_ue_ngap_id,
item0
.
tac_list
.
push_back
(
amf_cfg
.
plmn_list
[
0
].
tac
);
tai_list
.
push_back
(
item0
);
regAccept
->
setTaiList
(
tai_list
);
Logger
::
amf_n1
().
debug
(
"???????????????/ -3"
);
std
::
vector
<
struct
SNSSAI_s
>
nssai
=
{};
SNSSAI_t
snssai
=
{};
...
...
@@ -3277,6 +3310,7 @@ void amf_n1::security_mode_complete_handle(uint32_t ran_ue_ngap_id,
amf_cfg
.
guami
.
AmfSetID
+
amf_cfg
.
guami
.
AmfPointer
+
std
::
to_string
(
tmsi
);
Logger
::
amf_n1
().
debug
(
"Allocated GUTI %s"
,
guti
.
c_str
());
Logger
::
amf_n1
().
debug
(
"???????????????/ -4"
);
// TODO: remove hardcoded values
regAccept
->
set_5GS_Network_Feature_Support
(
0x01
,
0x00
);
...
...
@@ -4296,11 +4330,14 @@ void amf_n1::run_mobility_registration_update_procedure(
std
::
string
record_id
=
"RECORD_ID=
\'
"
+
supi
+
"
\'
"
;
std
::
string
udsf_url
=
"http://10.103.239.53:7123/nudsf-dr/v1/amfdata/"
+
std
::
string
(
"pdu_session_context/records/"
)
+
record_id
;
if
(
!
amf_n2_inst
->
curl_http_client_udsf
(
udsf_url
,
""
,
"GET"
,
udsf_response
)){
Logger
::
amf_n
2
().
error
(
"No existing pdu_session_context with assoc_id "
);
Logger
::
amf_n
1
().
error
(
"No existing pdu_session_context with assoc_id "
);
return
;
}
Logger
::
amf_n2
().
debug
(
"udsf_response: %s"
,
udsf_response
.
dump
().
c_str
());
Logger
::
amf_n1
().
debug
(
"udsf_response: %s"
,
udsf_response
.
dump
().
c_str
());
struct
timeval
tv1
;
struct
timezone
tz1
;
gettimeofday
(
&
tv1
,
&
tz1
);
long
start
=
tv1
.
tv_sec
*
1000000
+
tv1
.
tv_usec
;
psc
.
get
()
->
pdu_session_context_from_json
(
udsf_response
);
struct
timeval
tv2
;
struct
timezone
tz2
;
gettimeofday
(
&
tv2
,
&
tz2
);
long
end
=
tv2
.
tv_sec
*
1000000
+
tv2
.
tv_usec
;
long
one_time
=
end
-
start
;
//delay_nudsf.push_back(one_time);
// psc = std::shared_ptr<pdu_session_context>(psc1);
//***************************stateless
...
...
@@ -4405,11 +4442,14 @@ std::shared_ptr<pdu_session_context> psc = std::shared_ptr<pdu_session_context>(
std
::
string
record_id
=
"RECORD_ID=
\'
"
+
supi
+
"
\'
"
;
std
::
string
udsf_url
=
"http://10.103.239.53:7123/nudsf-dr/v1/amfdata/"
+
std
::
string
(
"pdu_session_context/records/"
)
+
record_id
;
if
(
!
amf_n2_inst
->
curl_http_client_udsf
(
udsf_url
,
""
,
"GET"
,
udsf_response
)){
Logger
::
amf_n
2
().
error
(
"No existing pdu_session_context with assoc_id "
);
Logger
::
amf_n
1
().
error
(
"No existing pdu_session_context with assoc_id "
);
}
else
{
Logger
::
amf_n2
().
debug
(
"udsf_response: %s"
,
udsf_response
.
dump
().
c_str
());
Logger
::
amf_n1
().
debug
(
"udsf_response: %s"
,
udsf_response
.
dump
().
c_str
());
struct
timeval
tv1
;
struct
timezone
tz1
;
gettimeofday
(
&
tv1
,
&
tz1
);
long
start
=
tv1
.
tv_sec
*
1000000
+
tv1
.
tv_usec
;
psc
.
get
()
->
pdu_session_context_from_json
(
udsf_response
);
struct
timeval
tv2
;
struct
timezone
tz2
;
gettimeofday
(
&
tv2
,
&
tz2
);
long
end
=
tv2
.
tv_sec
*
1000000
+
tv2
.
tv_usec
;
long
one_time
=
end
-
start
;
//delay_nudsf.push_back(one_time);
// psc = std::shared_ptr<pdu_session_context>(psc1);
}
//***************************stateless
...
...
@@ -4511,11 +4551,14 @@ void amf_n1::run_periodic_registration_update_procedure(
std
::
string
record_id
=
"RECORD_ID=
\'
"
+
supi
+
"
\'
"
;
std
::
string
udsf_url
=
"http://10.103.239.53:7123/nudsf-dr/v1/amfdata/"
+
std
::
string
(
"pdu_session_context/records/"
)
+
record_id
;
if
(
!
amf_n2_inst
->
curl_http_client_udsf
(
udsf_url
,
""
,
"GET"
,
udsf_response
)){
Logger
::
amf_n
2
().
error
(
"No existing pdu_session_context with assoc_id "
);
Logger
::
amf_n
1
().
error
(
"No existing pdu_session_context with assoc_id "
);
}
else
{
Logger
::
amf_n2
().
debug
(
"udsf_response: %s"
,
udsf_response
.
dump
().
c_str
());
Logger
::
amf_n1
().
debug
(
"udsf_response: %s"
,
udsf_response
.
dump
().
c_str
());
struct
timeval
tv1
;
struct
timezone
tz1
;
gettimeofday
(
&
tv1
,
&
tz1
);
long
start
=
tv1
.
tv_sec
*
1000000
+
tv1
.
tv_usec
;
psc
.
get
()
->
pdu_session_context_from_json
(
udsf_response
);
struct
timeval
tv2
;
struct
timezone
tz2
;
gettimeofday
(
&
tv2
,
&
tz2
);
long
end
=
tv2
.
tv_sec
*
1000000
+
tv2
.
tv_usec
;
long
one_time
=
end
-
start
;
//delay_nudsf.push_back(one_time);
//psc = std::shared_ptr<pdu_session_context>(psc1);
}
//***************************stateless
...
...
src/amf-app/amf_n11.cpp
View file @
8da86738
...
...
@@ -45,7 +45,7 @@
#include "SmContextCreateData.h"
#include "mime_parser.hpp"
#include "ue_context.hpp"
#include <sys/time.h>
extern
"C"
{
#include "dynamic_memory_check.h"
}
...
...
@@ -65,6 +65,8 @@ extern amf_n1* amf_n1_inst;
extern
amf_n2
*
amf_n2_inst
;
extern
amf_app
*
amf_app_inst
;
extern
statistics
stacs
;
extern
std
::
vector
<
long
>
delay_nudsf
;
extern
std
::
vector
<
long
>
amf_capability
;
extern
void
msg_str_2_msg_hex
(
std
::
string
msg
,
bstring
&
b
);
extern
void
convert_string_2_hex
(
std
::
string
&
input
,
std
::
string
&
output
);
...
...
@@ -108,6 +110,7 @@ void amf_n11_task(void*) {
do
{
std
::
shared_ptr
<
itti_msg
>
shared_msg
=
itti_inst
->
receive_msg
(
task_id
);
auto
*
msg
=
shared_msg
.
get
();
struct
timeval
tv1
;
struct
timezone
tz1
;
gettimeofday
(
&
tv1
,
&
tz1
);
long
t1
=
tv1
.
tv_sec
*
1000000
+
tv1
.
tv_usec
;
switch
(
msg
->
msg_type
)
{
case
SMF_SERVICES_CONSUMER
:
{
Logger
::
amf_n11
().
info
(
"Running SMF_SERVICES_CONSUMER"
);
...
...
@@ -148,6 +151,8 @@ void amf_n11_task(void*) {
"Receive unknown message type %d"
,
msg
->
msg_type
);
}
}
struct
timeval
tv2
;
struct
timezone
tz2
;
gettimeofday
(
&
tv2
,
&
tz2
);
long
t2
=
tv2
.
tv_sec
*
1000000
+
tv2
.
tv_usec
;
//long one_time = t2 - t1; amf_capability.push_back(one_time);
}
while
(
true
);
}
...
...
@@ -193,7 +198,10 @@ void amf_n11::handle_itti_message(
}
else
{
Logger
::
amf_n2
().
debug
(
"udsf_response: %s"
,
udsf_response
.
dump
().
c_str
());
struct
timeval
tv1
;
struct
timezone
tz1
;
gettimeofday
(
&
tv1
,
&
tz1
);
long
start
=
tv1
.
tv_sec
*
1000000
+
tv1
.
tv_usec
;
nc
.
get
()
->
nas_context_from_json
(
udsf_response
);
struct
timeval
tv2
;
struct
timezone
tz2
;
gettimeofday
(
&
tv2
,
&
tz2
);
long
end
=
tv2
.
tv_sec
*
1000000
+
tv2
.
tv_usec
;
long
one_time
=
end
-
start
;
//delay_nudsf.push_back(one_time);
}
std
::
string
supi
=
"imsi-"
+
nc
.
get
()
->
imsi
;
Logger
::
amf_n11
().
debug
(
...
...
@@ -209,7 +217,10 @@ return ;
}
else
{
Logger
::
amf_n2
().
debug
(
"udsf_response: %s"
,
udsf_response
.
dump
().
c_str
());
struct
timeval
tv1
;
struct
timezone
tz1
;
gettimeofday
(
&
tv1
,
&
tz1
);
long
start
=
tv1
.
tv_sec
*
1000000
+
tv1
.
tv_usec
;
psc
.
get
()
->
pdu_session_context_from_json
(
udsf_response
);
struct
timeval
tv2
;
struct
timezone
tz2
;
gettimeofday
(
&
tv2
,
&
tz2
);
long
end
=
tv2
.
tv_sec
*
1000000
+
tv2
.
tv_usec
;
long
one_time
=
end
-
start
;
//delay_nudsf.push_back(one_time);
}
// std::shared_ptr<nas_context> nc = std::shared_ptr<nas_context>(new nas_context());
...
...
@@ -263,7 +274,10 @@ return ;
smf_addr
=
psc
->
smf_addr
;
std
::
string
smf_ip_addr
,
remote_uri
;
std
::
shared_ptr
<
pdu_session_context
>
context
=
std
::
shared_ptr
<
pdu_session_context
>
(
new
pdu_session_context
());
context
.
get
()
->
pdu_session_context_from_json
(
udsf_response
);
struct
timeval
tv1
;
struct
timezone
tz1
;
gettimeofday
(
&
tv1
,
&
tz1
);
long
start
=
tv1
.
tv_sec
*
1000000
+
tv1
.
tv_usec
;
context
.
get
()
->
pdu_session_context_from_json
(
udsf_response
);
struct
timeval
tv2
;
struct
timezone
tz2
;
gettimeofday
(
&
tv2
,
&
tz2
);
long
end
=
tv2
.
tv_sec
*
1000000
+
tv2
.
tv_usec
;
long
one_time
=
end
-
start
;
//delay_nudsf.push_back(one_time);
//context = supi_to_pdu_ctx(supi);
// remove http port from the URI if existed
std
::
size_t
found_port
=
smf_addr
.
find
(
":"
);
...
...
@@ -322,7 +336,10 @@ void amf_n11::handle_itti_message(itti_smf_services_consumer& smf) {
else
{
Logger
::
amf_n2
().
debug
(
"udsf_response: %s"
,
udsf_response
.
dump
().
c_str
());
psc
=
std
::
shared_ptr
<
pdu_session_context
>
(
new
pdu_session_context
());
struct
timeval
tv1
;
struct
timezone
tz1
;
gettimeofday
(
&
tv1
,
&
tz1
);
long
start
=
tv1
.
tv_sec
*
1000000
+
tv1
.
tv_usec
;
psc
.
get
()
->
pdu_session_context_from_json
(
udsf_response
);
struct
timeval
tv2
;
struct
timezone
tz2
;
gettimeofday
(
&
tv2
,
&
tz2
);
long
end
=
tv2
.
tv_sec
*
1000000
+
tv2
.
tv_usec
;
long
one_time
=
end
-
start
;
//delay_nudsf.push_back(one_time);
if
(
psc
.
get
()
->
isn2sm_avaliable
==
false
)
{
psc
=
std
::
shared_ptr
<
pdu_session_context
>
(
new
pdu_session_context
());
...
...
@@ -539,7 +556,7 @@ void amf_n11::handle_pdu_session_initial_request(
// TODO: Remove hardcoded values
std
::
string
remote_uri
=
smf_addr
+
"
:8889
/nsmf-pdusession/v2/sm-contexts"
;
smf_addr
+
"/nsmf-pdusession/v2/sm-contexts"
;
nlohmann
::
json
pdu_session_establishment_request
;
pdu_session_establishment_request
[
"supi"
]
=
supi
.
c_str
();
pdu_session_establishment_request
[
"pei"
]
=
"imei-200000000000001"
;
...
...
@@ -591,7 +608,10 @@ void amf_n11::handle_itti_message(
}
else
{
Logger
::
amf_n2
().
debug
(
"udsf_response: %s"
,
udsf_response
.
dump
().
c_str
());
struct
timeval
tv1
;
struct
timezone
tz1
;
gettimeofday
(
&
tv1
,
&
tz1
);
long
start
=
tv1
.
tv_sec
*
1000000
+
tv1
.
tv_usec
;
psc
.
get
()
->
pdu_session_context_from_json
(
udsf_response
);
struct
timeval
tv2
;
struct
timezone
tz2
;
gettimeofday
(
&
tv2
,
&
tz2
);
long
end
=
tv2
.
tv_sec
*
1000000
+
tv2
.
tv_usec
;
long
one_time
=
end
-
start
;
//delay_nudsf.push_back(one_time);
//psc = std::shared_ptr<pdu_session_context>(psc1);
}
//***************************stateless
...
...
@@ -705,7 +725,10 @@ void amf_n11::curl_http_client(
Logger
::
amf_n2
().
debug
(
"udsf_response: %s"
,
udsf_response
.
dump
().
c_str
());
//psc1->pdu_session_context_from_json(udsf_response);
//psc = std::shared_ptr<pdu_session_context>(psc1);
struct
timeval
tv1
;
struct
timezone
tz1
;
gettimeofday
(
&
tv1
,
&
tz1
);
long
start
=
tv1
.
tv_sec
*
1000000
+
tv1
.
tv_usec
;
psc
.
get
()
->
pdu_session_context_from_json
(
udsf_response
);
struct
timeval
tv2
;
struct
timezone
tz2
;
gettimeofday
(
&
tv2
,
&
tz2
);
long
end
=
tv2
.
tv_sec
*
1000000
+
tv2
.
tv_usec
;
long
one_time
=
end
-
start
;
//delay_nudsf.push_back(one_time);
//***************************stateless
// if (is_supi_to_pdu_ctx(supi)) {
...
...
src/amf-app/amf_n2.cpp
View file @
8da86738
...
...
@@ -57,7 +57,8 @@
#include <nlohmann/json.hpp>
#include "ServiceRequest.hpp"
#include "Record.h"
#include <sys/time.h>
#include <chrono>
extern
"C"
{
#include "dynamic_memory_check.h"
}
...
...
@@ -69,6 +70,8 @@ using namespace std;
using
namespace
nas
;
using
namespace
oai
::
amf
::
model
;
extern
std
::
vector
<
long
>
delay_nudsf
;
extern
std
::
vector
<
long
>
amf_capability
;
extern
itti_mw
*
itti_inst
;
extern
amf_n2
*
amf_n2_inst
;
extern
amf_n1
*
amf_n1_inst
;
...
...
@@ -84,6 +87,8 @@ uint32_t AMF_TARGET_ran_id_global = 0;
sctp_assoc_id_t
downlink_sctp_assoc_id
=
0
;
sctp_assoc_id_t
source_assoc_id
=
0
;
int
ncc
=
0
;
extern
std
::
vector
<
long
>
sig_delay_amf_n2
;
void
amf_n2_task
(
void
*
);
extern
void
octet_stream_2_hex_stream
(
uint8_t
*
buf
,
int
len
,
std
::
string
&
out
);
...
...
@@ -99,6 +104,7 @@ void amf_n2_task(void* args_p) {
do
{
std
::
shared_ptr
<
itti_msg
>
shared_msg
=
itti_inst
->
receive_msg
(
task_id
);
auto
*
msg
=
shared_msg
.
get
();
struct
timeval
tv1
;
struct
timezone
tz1
;
gettimeofday
(
&
tv1
,
&
tz1
);
long
t1
=
tv1
.
tv_sec
*
1000000
+
tv1
.
tv_usec
;
switch
(
msg
->
msg_type
)
{
case
NEW_SCTP_ASSOCIATION
:
{
Logger
::
amf_n2
().
info
(
"Received NEW_SCTP_ASSOCIATION"
);
...
...
@@ -201,6 +207,8 @@ void amf_n2_task(void* args_p) {
default:
Logger
::
amf_n2
().
info
(
"No handler for msg type %d"
,
msg
->
msg_type
);
}
struct
timeval
tv2
;
struct
timezone
tz2
;
gettimeofday
(
&
tv2
,
&
tz2
);
long
t2
=
tv2
.
tv_sec
*
1000000
+
tv2
.
tv_usec
;
//long one_time = t2 - t1; amf_capability.push_back(one_time);
}
while
(
true
);
}
...
...
@@ -497,6 +505,9 @@ std::size_t callback_udsf(const char *in, std::size_t size, std::size_t num, std
}
bool
amf_n2
::
curl_http_client_udsf
(
std
::
string
remoteUrl
,
std
::
string
jsonData
,
std
::
string
http_mothed
,
nlohmann
::
json
&
udsf_response
)
{
struct
timeval
tv1
;
struct
timezone
tz1
;
gettimeofday
(
&
tv1
,
&
tz1
);
long
start
=
tv1
.
tv_sec
*
1000000
+
tv1
.
tv_usec
;
Logger
::
amf_n2
().
debug
(
"dukl_time start %d"
,
start
);
Logger
::
sctp
().
debug
(
"Send to UDSF , UDSF URL %s"
,
remoteUrl
.
c_str
());
bool
exist
=
true
;
curl_global_init
(
CURL_GLOBAL_ALL
);
...
...
@@ -529,11 +540,16 @@ bool amf_n2::curl_http_client_udsf(std::string remoteUrl,std::string jsonData,st
curl_easy_getinfo
(
curl
,
CURLINFO_RESPONSE_CODE
,
&
httpCode
);
std
::
string
response
=
*
httpData
.
get
();
//
Logger::amf_n2().debug("response from udsf =(%d) %s ",response.length(),response.c_str());
Logger
::
amf_n2
().
debug
(
"response from udsf =(%d) %s "
,
response
.
length
(),
response
.
c_str
());
nlohmann
::
json
response_data
=
{};
Logger
::
amf_n2
().
debug
(
"Send message to UDSF, response from UDSF, HTTP Code: %d"
,
httpCode
);
if
(
static_cast
<
http_response_codes_e
>
(
httpCode
)
==
http_response_codes_e
::
HTTP_RESPONSE_CODE_0
)
{
Logger
::
sctp
().
info
(
"Cannot get response when calling %s"
,
remoteUrl
.
c_str
());
struct
timeval
tv2
;
struct
timezone
tz2
;
gettimeofday
(
&
tv2
,
&
tz2
);
long
end
=
tv2
.
tv_sec
*
1000000
+
tv2
.
tv_usec
;
Logger
::
amf_n2
().
debug
(
"dukl_time end %d"
,
end
);
Logger
::
amf_n2
().
debug
(
"dukl_time go-back http_code=0 udsf %d"
,
end
-
start
);
long
one_time
=
end
-
start
;
//delay_nudsf.push_back(one_time);
curl_slist_free_all
(
headers
);
curl_easy_cleanup
(
curl
);
exist
=
false
;
...
...
@@ -541,7 +557,11 @@ bool amf_n2::curl_http_client_udsf(std::string remoteUrl,std::string jsonData,st
}
if
(
static_cast
<
http_response_codes_e
>
(
httpCode
)
==
http_response_codes_e
::
HTTP_RESPONSE_CODE_200_OK
)
{
Logger
::
sctp
().
info
(
"sending successful when calling %s"
,
remoteUrl
.
c_str
());
struct
timeval
tv2
;
struct
timezone
tz2
;
gettimeofday
(
&
tv2
,
&
tz2
);
long
end
=
tv2
.
tv_sec
*
1000000
+
tv2
.
tv_usec
;
Logger
::
amf_n2
().
debug
(
"dukl_time end %d"
,
end
);
Logger
::
amf_n2
().
debug
(
"dukl_time go-back http_code = 200 udsf %d"
,
end
-
start
);
long
one_time
=
end
-
start
;
//delay_nudsf.push_back(one_time);
try
{
//response_data = nlohmann::json::parse(response);
udsf_response
=
nlohmann
::
json
::
parse
(
response
);
...
...
@@ -556,6 +576,11 @@ bool amf_n2::curl_http_client_udsf(std::string remoteUrl,std::string jsonData,st
}
if
(
static_cast
<
http_response_codes_e
>
(
httpCode
)
==
http_response_codes_e
::
HTTP_RESPONSE_CODE_201_CREATED
)
{
Logger
::
sctp
().
info
(
"sending successful when calling %s"
,
remoteUrl
.
c_str
());
struct
timeval
tv2
;
struct
timezone
tz2
;
gettimeofday
(
&
tv2
,
&
tz2
);
long
end
=
tv2
.
tv_sec
*
1000000
+
tv2
.
tv_usec
;
Logger
::
amf_n2
().
debug
(
"dukl_time end %d"
,
end
);
Logger
::
amf_n2
().
debug
(
"dukl_time go-back http_code = 201 udsf %d"
,
end
-
start
);
long
one_time
=
end
-
start
;
//delay_nudsf.push_back(one_time);
curl_slist_free_all
(
headers
);
curl_easy_cleanup
(
curl
);
return
exist
;
...
...
@@ -690,7 +715,10 @@ void amf_n2::handle_itti_message(itti_initial_ue_message& init_ue_msg) {
Logger
::
amf_n1
().
error
(
"No existing nas_context with GUTI %s ..."
,
guti
.
c_str
());
}
else
{
nc
=
std
::
shared_ptr
<
nas_context
>
(
new
nas_context
());
struct
timeval
tv1
;
struct
timezone
tz1
;
gettimeofday
(
&
tv1
,
&
tz1
);
long
start
=
tv1
.
tv_sec
*
1000000
+
tv1
.
tv_usec
;
nc
.
get
()
->
nas_context_from_json
(
udsf_response
);
struct
timeval
tv2
;
struct
timezone
tz2
;
gettimeofday
(
&
tv2
,
&
tz2
);
long
end
=
tv2
.
tv_sec
*
1000000
+
tv2
.
tv_usec
;
long
one_time
=
end
-
start
;
//delay_nudsf.push_back(one_time);
is_ran_ue_ngap_id_new
=
false
;
itti_msg
->
amf_ue_ngap_id
=
nc
.
get
()
->
amf_ue_ngap_id
;
itti_msg
->
ran_ue_ngap_id
=
nc
.
get
()
->
ran_ue_ngap_id
;
...
...
@@ -704,9 +732,9 @@ void amf_n2::handle_itti_message(itti_initial_ue_message& init_ue_msg) {
nlohmann
::
json
udsf_response
;
std
::
string
record_id
,
udsf_url
;
if
(
is_ran_ue_ngap_id_new
){
record_id
=
"RECORD_ID=
\'
"
+
std
::
to_string
(
ran_ue_ngap_id
)
+
"
\'
"
;
record_id
=
"RECORD_ID=
\'
"
+
std
::
to_string
(
ran_ue_ngap_id
)
+
"
\'
"
;
}
else
{
record_id
=
"RECORD_ID=
\'
"
+
std
::
to_string
(
nc
.
get
()
->
ran_ue_ngap_id
)
+
"
\'
"
;
record_id
=
"RECORD_ID=
\'
"
+
std
::
to_string
(
nc
.
get
()
->
ran_ue_ngap_id
)
+
"
\'
"
;
}
udsf_url
=
"http://10.103.239.53:7123/nudsf-dr/v1/amfdata/"
+
std
::
string
(
"ue_ngap_context/records/"
)
+
record_id
;
if
(
!
amf_n2_inst
->
curl_http_client_udsf
(
udsf_url
,
""
,
"GET"
,
udsf_response
)){
...
...
@@ -715,7 +743,10 @@ void amf_n2::handle_itti_message(itti_initial_ue_message& init_ue_msg) {
Logger
::
amf_n2
().
error
(
"No existing ue_ngap context with ran_ue_ngap_id ....."
);
}
else
{
Logger
::
amf_n2
().
debug
(
"udsf_response: %s"
,
udsf_response
.
dump
().
c_str
());
struct
timeval
tv1
;
struct
timezone
tz1
;
gettimeofday
(
&
tv1
,
&
tz1
);
long
start
=
tv1
.
tv_sec
*
1000000
+
tv1
.
tv_usec
;
unc
.
get
()
->
ue_ngap_context_from_json
(
udsf_response
);
struct
timeval
tv2
;
struct
timezone
tz2
;
gettimeofday
(
&
tv2
,
&
tz2
);
long
end
=
tv2
.
tv_sec
*
1000000
+
tv2
.
tv_usec
;
long
one_time
=
end
-
start
;
//delay_nudsf.push_back(one_time);
}
set_ran_ue_ngap_id_2_ue_ngap_context
(
ran_ue_ngap_id
,
unc
);
...
...
@@ -1095,7 +1126,10 @@ void amf_n2::handle_itti_message(itti_ul_nas_transport& ul_nas_transport) {
return
;
}
Logger
::
amf_n2
().
debug
(
"udsf_response: %s"
,
udsf_response
.
dump
().
c_str
());
struct
timeval
tv1
;
struct
timezone
tz1
;
gettimeofday
(
&
tv1
,
&
tz1
);
long
start
=
tv1
.
tv_sec
*
1000000
+
tv1
.
tv_usec
;
gc
.
get
()
->
gnb_context_from_json
(
udsf_response
);
struct
timeval
tv2
;
struct
timezone
tz2
;
gettimeofday
(
&
tv2
,
&
tz2
);
long
end
=
tv2
.
tv_sec
*
1000000
+
tv2
.
tv_usec
;
long
one_time
=
end
-
start
;
//delay_nudsf.push_back(one_time);
std
::
shared_ptr
<
ue_ngap_context
>
unc
=
std
::
shared_ptr
<
ue_ngap_context
>
(
new
ue_ngap_context
());
...
...
@@ -1109,7 +1143,10 @@ void amf_n2::handle_itti_message(itti_ul_nas_transport& ul_nas_transport) {
return
;
}
Logger
::
amf_n2
().
debug
(
"udsf_response_ue_ngap_context: %s"
,
udsf_response_ue_ngap_context
.
dump
().
c_str
());
struct
timeval
tv3
;
struct
timezone
tz3
;
gettimeofday
(
&
tv3
,
&
tz3
);
long
start3
=
tv3
.
tv_sec
*
1000000
+
tv3
.
tv_usec
;
unc
.
get
()
->
ue_ngap_context_from_json
(
udsf_response_ue_ngap_context
);
struct
timeval
tv4
;
struct
timezone
tz4
;
gettimeofday
(
&
tv4
,
&
tz4
);
long
end4
=
tv4
.
tv_sec
*
1000000
+
tv4
.
tv_usec
;
one_time
=
end4
-
start3
;
//delay_nudsf.push_back(one_time);
// std::shared_ptr<gnb_context> gc;
// if (!is_assoc_id_2_gnb_context(ul_nas_transport.assoc_id)) {
...
...
@@ -1197,7 +1234,10 @@ void amf_n2::handle_itti_message(itti_dl_nas_transport& dl_nas_transport) {
Logger
::
amf_n2
().
debug
(
"udsf_response: %s"
,
udsf_response
.
dump
().
c_str
());
//printf("---------------std::to_string(unc.get()->gnb_assoc_id) ----------------%s",std::to_string(unc.get()->gnb_assoc_id) );
struct
timeval
tv1
;
struct
timezone
tz1
;
gettimeofday
(
&
tv1
,
&
tz1
);
long
start
=
tv1
.
tv_sec
*
1000000
+
tv1
.
tv_usec
;
unc
.
get
()
->
ue_ngap_context_from_json
(
udsf_response
);
struct
timeval
tv2
;
struct
timezone
tz2
;
gettimeofday
(
&
tv2
,
&
tz2
);
long
end
=
tv2
.
tv_sec
*
1000000
+
tv2
.
tv_usec
;
long
one_time
=
end
-
start
;
//delay_nudsf.push_back(one_time);
std
::
shared_ptr
<
gnb_context
>
gc
=
std
::
shared_ptr
<
gnb_context
>
(
new
gnb_context
());
...
...
@@ -1212,7 +1252,10 @@ void amf_n2::handle_itti_message(itti_dl_nas_transport& dl_nas_transport) {
return
;
}
Logger
::
amf_n2
().
debug
(
"udsf_response: %s"
,
udsf_response
.
dump
().
c_str
());
struct
timeval
tv3
;
struct
timezone
tz3
;
gettimeofday
(
&
tv3
,
&
tz3
);
long
start3
=
tv3
.
tv_sec
*
1000000
+
tv3
.
tv_usec
;
gc
.
get
()
->
gnb_context_from_json
(
udsf_response
);
struct
timeval
tv4
;
struct
timezone
tz4
;
gettimeofday
(
&
tv4
,
&
tz4
);
long
end4
=
tv4
.
tv_sec
*
1000000
+
tv4
.
tv_usec
;
one_time
=
end4
-
start3
;
//delay_nudsf.push_back(one_time);
/***************hsx add***************/
/* std::shared_ptr<ue_ngap_context> unc;
...
...
@@ -1291,7 +1334,10 @@ void amf_n2::handle_itti_message(itti_initial_context_setup_request& itti_msg) {
return
;
}
Logger
::
amf_n2
().
debug
(
"udsf_response_ue_ngap_context: %s"
,
udsf_response_ue_ngap_context
.
dump
().
c_str
());
struct
timeval
tv1
;
struct
timezone
tz1
;
gettimeofday
(
&
tv1
,
&
tz1
);
long
start
=
tv1
.
tv_sec
*
1000000
+
tv1
.
tv_usec
;
unc
.
get
()
->
ue_ngap_context_from_json
(
udsf_response_ue_ngap_context
);
struct
timeval
tv2
;
struct
timezone
tz2
;
gettimeofday
(
&
tv2
,
&
tz2
);
long
end
=
tv2
.
tv_sec
*
1000000
+
tv2
.
tv_usec
;
long
one_time
=
end
-
start
;
//delay_nudsf.push_back(one_time);
std
::
shared_ptr
<
gnb_context
>
gc
=
std
::
shared_ptr
<
gnb_context
>
(
new
gnb_context
());
nlohmann
::
json
udsf_response
;
...
...
@@ -1303,7 +1349,10 @@ void amf_n2::handle_itti_message(itti_initial_context_setup_request& itti_msg) {
return
;
}
Logger
::
amf_n2
().
debug
(
"udsf_response: %s"
,
udsf_response
.
dump
().
c_str
());
gettimeofday
(
&
tv1
,
&
tz1
);
start
=
tv1
.
tv_sec
*
1000000
+
tv1
.
tv_usec
;
gc
.
get
()
->
gnb_context_from_json
(
udsf_response
);
gettimeofday
(
&
tv2
,
&
tz2
);
end
=
tv2
.
tv_sec
*
1000000
+
tv2
.
tv_usec
;
one_time
=
end
-
start
;
//delay_nudsf.push_back(one_time);
InitialContextSetupRequestMsg
*
msg
=
new
InitialContextSetupRequestMsg
();
...
...
@@ -1391,9 +1440,12 @@ void amf_n2::handle_itti_message(
if
(
!
amf_n2_inst
->
curl_http_client_udsf
(
udsf_url_ue_ngap_context
,
""
,
"GET"
,
udsf_response_ue_ngap_context
)){
Logger
::
amf_n2
().
error
(
"No existing ue_ngap context with ran_ue_ngap_id "
);
return
;
}
}
Logger
::
amf_n2
().
debug
(
"udsf_response_ue_ngap_context: %s"
,
udsf_response_ue_ngap_context
.
dump
().
c_str
());
struct
timeval
tv1
;
struct
timezone
tz1
;
gettimeofday
(
&
tv1
,
&
tz1
);
long
start
=
tv1
.
tv_sec
*
1000000
+
tv1
.
tv_usec
;
unc
.
get
()
->
ue_ngap_context_from_json
(
udsf_response_ue_ngap_context
);
struct
timeval
tv2
;
struct
timezone
tz2
;
gettimeofday
(
&
tv2
,
&
tz2
);
long
end
=
tv2
.
tv_sec
*
1000000
+
tv2
.
tv_usec
;
long
one_time
=
end
-
start
;
//delay_nudsf.push_back(one_time);
std
::
shared_ptr
<
gnb_context
>
gc
=
std
::
shared_ptr
<
gnb_context
>
(
new
gnb_context
());
nlohmann
::
json
udsf_response
;
...
...
@@ -1406,7 +1458,10 @@ void amf_n2::handle_itti_message(
return
;
}
Logger
::
amf_n2
().
debug
(
"udsf_response: %s"
,
udsf_response
.
dump
().
c_str
());
gettimeofday
(
&
tv1
,
&
tz1
);
start
=
tv1
.
tv_sec
*
1000000
+
tv1
.
tv_usec
;
gc
.
get
()
->
gnb_context_from_json
(
udsf_response
);
gettimeofday
(
&
tv2
,
&
tz2
);
end
=
tv2
.
tv_sec
*
1000000
+
tv2
.
tv_usec
;
one_time
=
end
-
start
;
//delay_nudsf.push_back(one_time);
// std::shared_ptr<ue_ngap_context> unc;
// unc = ran_ue_id_2_ue_ngap_context(itti_msg.ran_ue_ngap_id);
...
...
@@ -1465,7 +1520,10 @@ std::shared_ptr<pdu_session_context> psc = std::shared_ptr<pdu_session_context>(
}
else
{
Logger
::
amf_n2
().
debug
(
"udsf_response: %s"
,
udsf_response
.
dump
().
c_str
());
struct
timeval
tv1
;
struct
timezone
tz1
;
gettimeofday
(
&
tv1
,
&
tz1
);
long
start
=
tv1
.
tv_sec
*
1000000
+
tv1
.
tv_usec
;
psc
.
get
()
->
pdu_session_context_from_json
(
udsf_response
);
struct
timeval
tv2
;
struct
timezone
tz2
;
gettimeofday
(
&
tv2
,
&
tz2
);
long
end
=
tv2
.
tv_sec
*
1000000
+
tv2
.
tv_usec
;
long
one_time
=
end
-
start
;
//delay_nudsf.push_back(one_time);
// psc = std::shared_ptr<pdu_session_context>(psc1);
}
//***************************stateless
...
...
@@ -1498,7 +1556,7 @@ std::shared_ptr<pdu_session_context> psc = std::shared_ptr<pdu_session_context>(
Logger
::
amf_n2
().
debug
(
" (%d bytes)
\n
"
,
encoded_size
);
bstring
b
=
blk2bstr
(
buffer
,
encoded_size
);
// sctp_s_38412.sctp_send_msg(gc.get()->sctp_assoc_id, unc.get()->sctp_stream_send,
b);
//sctp_s_38412.sctp_send_msg(gc.get()->sctp_assoc_id, unc.get()->sctp_stream_send, &
b);
sctp_s_38412
.
curl_http_client_Plugin
(
gc
.
get
()
->
sctp_assoc_id
,
unc
.
get
()
->
sctp_stream_send
,
b
);
// free memory
free_wrapper
((
void
**
)
&
buffer
);
...
...
@@ -1914,7 +1972,7 @@ std::shared_ptr<pdu_session_context> psc = std::shared_ptr<pdu_session_context>(
std
::
shared_ptr
<
gnb_context
>
gc_target
;
gc_target
=
gnb_id_2_gnb_context
(
gnbid
->
getValue
());
downlink_sctp_assoc_id
=
gc_target
.
get
()
->
sctp_assoc_id
;
//
sctp_s_38412.sctp_send_msg(gc_target.get()->sctp_assoc_id, 0, &b);
//
sctp_s_38412.sctp_send_msg(gc_target.get()->sctp_assoc_id, 0, &b);
sctp_s_38412
.
curl_http_client_Plugin
(
gc_target
.
get
()
->
sctp_assoc_id
,
0
,
b
);
}
...
...
@@ -2042,7 +2100,7 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) {
// ran_ue_id_2_ue_ngap_context(nc.get()->ran_ue_ngap_id);
// std::shared_ptr<ue_ngap_context> ngc =
// ran_ue_id_2_ue_ngap_context(ran_id_Global);
// sctp_s_38412.sctp_send_msg(ngc.get()->gnb_assoc_id, 0, &b);
//
//
sctp_s_38412.sctp_send_msg(ngc.get()->gnb_assoc_id, 0, &b);
//sctp_s_38412.sctp_send_msg(unc.get()->gnb_assoc_id, 0, &b);
sctp_s_38412
.
curl_http_client_Plugin
(
unc
.
get
()
->
gnb_assoc_id
,
0
,
b
);
...
...
src/itti/itti.hpp
View file @
8da86738
...
...
@@ -124,7 +124,8 @@ class itti_task_ctxt {
};
class
itti_mw
{
private:
//private:
public:
itti_task_ctxt
*
itti_task_ctxts
[
TASK_MAX
];
/*
...
...
src/oai-amf/main.cpp
View file @
8da86738
...
...
@@ -40,6 +40,7 @@
#include "amf_module_from_config.hpp"
#include "amf_statistics.hpp"
#include <fstream>
#include <string>
#include <cstring>
#include "normalizer.hh"
...
...
@@ -57,6 +58,10 @@ amf_modules modules;
itti_mw
*
itti_inst
=
nullptr
;
amf_app
*
amf_app_inst
=
nullptr
;
statistics
stacs
;
std
::
vector
<
long
>
delay_nudsf
;
std
::
vector
<
long
>
delay_processing
;
ofstream
timeline
;
//------------------------------------------------------------------------------
int
main
(
int
argc
,
char
**
argv
)
{
...
...
@@ -67,6 +72,8 @@ int main(int argc, char** argv) {
return
1
;
}
//timeline.open("stacs.log", ios::app);
Logger
::
init
(
"AMF"
,
Options
::
getlogStdout
(),
Options
::
getlogRotFilelog
());
Logger
::
amf_app
().
startup
(
"Options parsed!"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment