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
5cc80e85
Commit
5cc80e85
authored
Aug 05, 2021
by
Niuhaiwen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bugs
parent
2bfc95f2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
7 deletions
+42
-7
src/amf-app/amf_app.cpp
src/amf-app/amf_app.cpp
+5
-5
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+15
-1
src/contexts/ue_context.cpp
src/contexts/ue_context.cpp
+19
-1
src/contexts/ue_context.hpp
src/contexts/ue_context.hpp
+3
-0
No files found.
src/amf-app/amf_app.cpp
View file @
5cc80e85
...
...
@@ -174,9 +174,9 @@ void amf_app_task(void*) {
//------------------------------------------------------------------------------
long
amf_app
::
generate_amf_ue_ngap_id
()
{
long
tmp
=
0
;
tmp
=
__sync_fetch_and_add
(
&
amf_app_ue_ngap_id_generator
,
1
);
//
tmp = __sync_fetch_and_add(&amf_app_ue_ngap_id_generator, 1);
//srand(time(NULL));
//
tmp = rand()%1000 + 1;
tmp
=
rand
()
%
1000
+
1
;
//return tmp & 0xffffffffff;
return
tmp
;
}
...
...
@@ -317,7 +317,7 @@ void amf_app::handle_itti_message(
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
=
\'
"
+
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
){
...
...
@@ -343,7 +343,7 @@ void amf_app::handle_itti_message(
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
=
\'
"
+
ue_context_key
+
"
\'
"
;
nlohmann
::
json
udsf_ue_context
;
nlohmann
::
json
cgi
;
cgi
[
"Content-ID"
]
=
"cgi"
;
...
...
@@ -563,7 +563,7 @@ bool amf_app::generate_5g_guti(
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
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
;
...
...
src/amf-app/amf_n1.cpp
View file @
5cc80e85
...
...
@@ -3203,7 +3203,21 @@ void amf_n1::security_mode_complete_handle(uint32_t ran_ue_ngap_id,
string
ue_context_key
=
"app_ue_ranid_"
+
to_string
(
ran_ue_ngap_id
)
+
"-amfid_"
+
to_string
(
amf_ue_ngap_id
);
std
::
shared_ptr
<
ue_context
>
uc
;
uc
=
amf_app_inst
->
ran_amf_id_2_ue_context
(
ue_context_key
);
//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=
\'
"
+
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
());
uc
=
std
::
shared_ptr
<
ue_context
>
(
new
ue_context
());
uc
.
get
()
->
ue_context_from_json
(
udsf_response
);
}
amf_app_inst
->
set_ran_amf_id_2_ue_context
(
ue_context_key
,
uc
);
if
(
uc
.
get
()
==
nullptr
)
{
// TODO:
Logger
::
amf_n1
().
error
(
...
...
src/contexts/ue_context.cpp
View file @
5cc80e85
...
...
@@ -83,7 +83,24 @@ void ue_context::ue_context_tai_from_json(nlohmann::json j,Tai_t &Tai_json)
Logger
::
amf_server
().
error
(
"get_value from json is error"
);
}
bool
ue_context
::
ue_context_isUeContextRequest_from_json
(
nlohmann
::
json
j
)
{
Record
record
;
nlohmann
::
json
::
parse
(
j
.
dump
()).
get_to
(
record
);
std
::
set
<
nlohmann
::
json
>
block_set
=
record
.
getBlocks
();
std
::
set
<
nlohmann
::
json
>::
iterator
it_block
;
for
(
it_block
=
block_set
.
begin
();
it_block
!=
block_set
.
end
();)
{
if
(
it_block
->
at
(
"Content-ID"
)
==
"isUeContextRequest"
)
{
string
s
=
it_block
->
at
(
"content"
);
return
atoi
(
s
.
c_str
());
}
block_set
.
erase
(
it_block
++
);
}
Logger
::
amf_server
().
error
(
"get_value from json is error"
);
}
bool
ue_context
::
ue_context_from_json
(
nlohmann
::
json
j
)
{
...
...
@@ -93,6 +110,7 @@ bool ue_context::ue_context_from_json(nlohmann::json j)
// ng_state = amf_ng_gnb_state_s(gnb_context_ng_state_from_json(j));
// next_sctp_stream = gnb_context_next_sctp_stream_from_json(j);
// next_sctp_stream = gnb_context_instreams_from_json(j);
isUeContextRequest
=
ue_context_isUeContextRequest_from_json
(
j
);
ue_context_tai_from_json
(
j
,
tai
);
ran_ue_ngap_id
=
ue_context_ran_ue_ngap_id_from_json
(
j
);
// printf("gnbname-%s\n",gnb_name.c_str());
...
...
src/contexts/ue_context.hpp
View file @
5cc80e85
...
...
@@ -43,6 +43,9 @@ class ue_context {
public:
void
ue_context_tai_from_json
(
nlohmann
::
json
j
,
Tai_t
&
tai_json
);
bool
ue_context_from_json
(
nlohmann
::
json
j
);
bool
ue_context_isUeContextRequest_from_json
(
nlohmann
::
json
j
);
uint32_t
ue_context_ran_ue_ngap_id_from_json
(
nlohmann
::
json
j
);
uint32_t
ran_ue_ngap_id
;
// 32bits
long
amf_ue_ngap_id
:
40
;
// 40bits
...
...
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