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
99a5200c
Commit
99a5200c
authored
Jun 04, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First version for NF registration procedure
parent
9656dbb1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
93 additions
and
2 deletions
+93
-2
src/amf-app/amf_app.cpp
src/amf-app/amf_app.cpp
+5
-0
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+1
-1
src/amf-app/amf_n11.cpp
src/amf-app/amf_n11.cpp
+85
-0
src/amf-app/amf_n11.hpp
src/amf-app/amf_n11.hpp
+2
-1
No files found.
src/amf-app/amf_app.cpp
View file @
99a5200c
...
...
@@ -452,12 +452,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());
}
*/
}
//------------------------------------------------------------------------------
...
...
src/amf-app/amf_n1.cpp
View file @
99a5200c
...
...
@@ -439,7 +439,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
;
...
...
src/amf-app/amf_n11.cpp
View file @
99a5200c
...
...
@@ -127,6 +127,18 @@ 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 PDU Session Resource Setup Response, handling
..."); itti_n11_register_nf_instance_request* m =
dynamic_cast<itti_n11_register_nf_instance_request*>(msg);
amf_n11_inst->register_nf_instance(
std::static_pointer_cast<itti_n11_register_nf_instance_request>(
shared_msg));
} break;
*/
default:
{
Logger
::
amf_n11
().
info
(
"Receive unknown message type %d"
,
msg
->
msg_type
);
...
...
@@ -816,6 +828,79 @@ 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
());
// 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
,
...
...
src/amf-app/amf_n11.hpp
View file @
99a5200c
...
...
@@ -75,7 +75,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
);
...
...
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