Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-SMF
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
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-SMF
Commits
0ecceac7
Commit
0ecceac7
authored
Jan 16, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issue for multiple SNSSAI
parent
5ff8b7f4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
29 deletions
+39
-29
src/smf_app/smf_app.cpp
src/smf_app/smf_app.cpp
+21
-11
src/smf_app/smf_n11.cpp
src/smf_app/smf_n11.cpp
+18
-18
No files found.
src/smf_app/smf_app.cpp
View file @
0ecceac7
...
...
@@ -581,12 +581,12 @@ void smf_app::handle_itti_msg(itti_n11_release_sm_context_response& m) {
//------------------------------------------------------------------------------
void
smf_app
::
handle_itti_msg
(
itti_n11_register_nf_instance_response
&
r
)
{
Logger
::
smf_app
().
debug
(
"NF Instance Registration response"
);
Logger
::
smf_app
().
debug
(
"
Handle
NF Instance Registration response"
);
nf_instance_profile
=
r
.
profile
;
// Set heartbeat timer
Logger
::
smf_app
().
debug
(
"Set
NRF Heartbeat timer (%d)
"
,
r
.
profile
.
get_nf_heartBeat_timer
());
"Set
value of NRF Heartbeat timer to %d
"
,
r
.
profile
.
get_nf_heartBeat_timer
());
timer_nrf_heartbeat
=
itti_inst
->
timer_setup
(
r
.
profile
.
get_nf_heartBeat_timer
(),
0
,
TASK_SMF_APP
,
TASK_SMF_APP_TIMEOUT_NRF_HEARTBEAT
,
...
...
@@ -1881,7 +1881,7 @@ void smf_app::generate_smf_profile() {
// TODO: custom info
int
i
=
0
;
for
(
auto
s
:
smf_cfg
.
session_management_subscription
)
{
for
(
auto
s
ms
:
smf_cfg
.
session_management_subscription
)
{
if
(
i
<
smf_cfg
.
num_session_management_subscription
)
i
++
;
else
...
...
@@ -1889,16 +1889,26 @@ void smf_app::generate_smf_profile() {
// SNSSAIS
snssai_t
snssai
=
{};
snssai
.
sD
=
s
.
single_nssai
.
sD
;
snssai
.
sST
=
s
.
single_nssai
.
sST
;
nf_instance_profile
.
add_snssai
(
snssai
);
snssai
.
sD
=
sms
.
single_nssai
.
sD
;
snssai
.
sST
=
sms
.
single_nssai
.
sST
;
// Verify if this SNSSAI exist
std
::
vector
<
snssai_t
>
ss
=
{};
nf_instance_profile
.
get_nf_snssais
(
ss
);
bool
found
=
false
;
for
(
auto
it
:
ss
)
{
if
((
it
.
sD
==
snssai
.
sD
)
and
(
it
.
sST
==
snssai
.
sST
))
{
found
=
true
;
break
;
}
}
if
(
!
found
)
nf_instance_profile
.
add_snssai
(
snssai
);
// SMF info
dnn_smf_info_item_t
dnn_item
=
{.
dnn
=
s
.
dnn
};
dnn_smf_info_item_t
dnn_item
=
{.
dnn
=
s
ms
.
dnn
};
snssai_smf_info_item_t
smf_info_item
=
{};
smf_info_item
.
dnn_smf_info_list
.
push_back
(
dnn_item
);
smf_info_item
.
snssai
.
sD
=
s
.
single_nssai
.
sD
;
smf_info_item
.
snssai
.
sST
=
s
.
single_nssai
.
sST
;
smf_info_item
.
snssai
.
sD
=
s
ms
.
single_nssai
.
sD
;
smf_info_item
.
snssai
.
sST
=
s
ms
.
single_nssai
.
sST
;
nf_instance_profile
.
add_smf_info_item
(
smf_info_item
);
}
...
...
@@ -1956,8 +1966,8 @@ void smf_app::trigger_nf_deregistration() {
//------------------------------------------------------------------------------
void
smf_app
::
trigger_upf_status_notification_subscribe
()
{
Logger
::
smf_app
().
debug
(
"Send ITTI msg to N11 task to
trigger the
UPF status notification "
"
subscribe to
NRF"
);
"Send ITTI msg to N11 task to
subscribe to
UPF status notification "
"
from
NRF"
);
std
::
shared_ptr
<
itti_n11_subscribe_upf_status_notify
>
itti_msg
=
std
::
make_shared
<
itti_n11_subscribe_upf_status_notify
>
(
...
...
src/smf_app/smf_n11.cpp
View file @
0ecceac7
...
...
@@ -682,7 +682,7 @@ void smf_n11::register_nf_instance(
msg
->
profile
.
get_nf_instance_id
();
Logger
::
smf_n11
().
debug
(
"Send NF Instance Registration to NRF
(NRF URL %s)
"
,
url
.
c_str
());
"Send NF Instance Registration to NRF
, NRF URL %s
"
,
url
.
c_str
());
std
::
string
body
=
json_data
.
dump
();
Logger
::
smf_n11
().
debug
(
...
...
@@ -721,7 +721,7 @@ void smf_n11::register_nf_instance(
res
=
curl_easy_perform
(
curl
);
curl_easy_getinfo
(
curl
,
CURLINFO_RESPONSE_CODE
,
&
httpCode
);
Logger
::
smf_n11
().
debug
(
"
Response from NRF, Http
Code: %d"
,
httpCode
);
Logger
::
smf_n11
().
debug
(
"
NF Instance Registration, response from NRF, HTTP
Code: %d"
,
httpCode
);
if
(
static_cast
<
http_response_codes_e
>
(
httpCode
)
==
http_response_codes_e
::
HTTP_RESPONSE_CODE_CREATED
)
{
...
...
@@ -729,10 +729,10 @@ void smf_n11::register_nf_instance(
try
{
response_data
=
json
::
parse
(
*
httpData
.
get
());
}
catch
(
json
::
exception
&
e
)
{
Logger
::
smf_n11
().
warn
(
"
C
ould not parse json from the NRF response"
);
Logger
::
smf_n11
().
warn
(
"
NF Instance Registration, c
ould not parse json from the NRF response"
);
}
Logger
::
smf_n11
().
debug
(
"
Response from NRF, J
son data:
\n
%s"
,
response_data
.
dump
().
c_str
());
"
NF Instance Registration, response from NRF, j
son data:
\n
%s"
,
response_data
.
dump
().
c_str
());
// send response to APP to process
std
::
shared_ptr
<
itti_n11_register_nf_instance_response
>
itti_msg
=
...
...
@@ -750,7 +750,7 @@ void smf_n11::register_nf_instance(
itti_msg
->
get_msg_name
());
}
}
else
{
Logger
::
smf_n11
().
warn
(
"
C
ould not get response from NRF"
);
Logger
::
smf_n11
().
warn
(
"
NF Instance Registration, c
ould not get response from NRF"
);
}
curl_slist_free_all
(
headers
);
...
...
@@ -772,7 +772,7 @@ void smf_n11::update_nf_instance(
json_data
.
push_back
(
item
);
}
std
::
string
body
=
json_data
.
dump
();
Logger
::
smf_n11
().
debug
(
"Send NF Update to NRF
(Msg body %s)
"
,
body
.
c_str
());
Logger
::
smf_n11
().
debug
(
"Send NF Update to NRF
, Msg body %s
"
,
body
.
c_str
());
std
::
string
url
=
std
::
string
(
inet_ntoa
(
*
((
struct
in_addr
*
)
&
smf_cfg
.
nrf_addr
.
ipv4_addr
)))
+
...
...
@@ -780,7 +780,7 @@ void smf_n11::update_nf_instance(
smf_cfg
.
nrf_addr
.
api_version
+
NNRF_NF_REGISTER_URL
+
msg
->
smf_instance_id
;
Logger
::
smf_n11
().
debug
(
"Send NF Update to NRF
(NRF URL %s)
"
,
url
.
c_str
());
Logger
::
smf_n11
().
debug
(
"Send NF Update to NRF
, NRF URL %s
"
,
url
.
c_str
());
curl_global_init
(
CURL_GLOBAL_ALL
);
CURL
*
curl
=
curl
=
curl_easy_init
();
...
...
@@ -815,13 +815,13 @@ void smf_n11::update_nf_instance(
res
=
curl_easy_perform
(
curl
);
curl_easy_getinfo
(
curl
,
CURLINFO_RESPONSE_CODE
,
&
httpCode
);
Logger
::
smf_n11
().
debug
(
"
Response from NRF, Http
Code: %d"
,
httpCode
);
Logger
::
smf_n11
().
debug
(
"
NF Update, response from NRF, HTTP
Code: %d"
,
httpCode
);
if
((
static_cast
<
http_response_codes_e
>
(
httpCode
)
==
http_response_codes_e
::
HTTP_RESPONSE_CODE_OK
)
or
(
static_cast
<
http_response_codes_e
>
(
httpCode
)
==
http_response_codes_e
::
HTTP_RESPONSE_CODE_NO_CONTENT
))
{
Logger
::
smf_n11
().
debug
(
"
G
ot successful response from NRF"
);
Logger
::
smf_n11
().
debug
(
"
NF Update, g
ot successful response from NRF"
);
// TODO: in case of response containing NF profile
// send response to APP to process
...
...
@@ -839,7 +839,7 @@ void smf_n11::update_nf_instance(
itti_msg
->
get_msg_name
());
}
}
else
{
Logger
::
smf_n11
().
warn
(
"
C
ould not get response from NRF"
);
Logger
::
smf_n11
().
warn
(
"
NF Update, c
ould not get response from NRF"
);
}
curl_slist_free_all
(
headers
);
...
...
@@ -894,16 +894,16 @@ void smf_n11::deregister_nf_instance(
res
=
curl_easy_perform
(
curl
);
curl_easy_getinfo
(
curl
,
CURLINFO_RESPONSE_CODE
,
&
httpCode
);
Logger
::
smf_n11
().
debug
(
"
Response from NRF, Http
Code: %d"
,
httpCode
);
Logger
::
smf_n11
().
debug
(
"
NF De-register, response from NRF, HTTP
Code: %d"
,
httpCode
);
if
((
static_cast
<
http_response_codes_e
>
(
httpCode
)
==
http_response_codes_e
::
HTTP_RESPONSE_CODE_OK
)
or
(
static_cast
<
http_response_codes_e
>
(
httpCode
)
==
http_response_codes_e
::
HTTP_RESPONSE_CODE_NO_CONTENT
))
{
Logger
::
smf_n11
().
debug
(
"
G
ot successful response from NRF"
);
Logger
::
smf_n11
().
debug
(
"
NF De-register, g
ot successful response from NRF"
);
}
else
{
Logger
::
smf_n11
().
warn
(
"
C
ould not get response from NRF"
);
Logger
::
smf_n11
().
warn
(
"
NF De-register, c
ould not get response from NRF"
);
}
curl_slist_free_all
(
headers
);
...
...
@@ -921,7 +921,7 @@ void smf_n11::subscribe_upf_status_notify(
msg
->
http_version
);
Logger
::
smf_n11
().
debug
(
"Send NFStatusNotify to NRF, NRF URL %s
)
"
,
msg
->
url
.
c_str
());
"Send NFStatusNotify to NRF, NRF URL %s"
,
msg
->
url
.
c_str
());
std
::
string
body
=
msg
->
json_data
.
dump
();
Logger
::
smf_n11
().
debug
(
...
...
@@ -960,16 +960,16 @@ void smf_n11::subscribe_upf_status_notify(
res
=
curl_easy_perform
(
curl
);
curl_easy_getinfo
(
curl
,
CURLINFO_RESPONSE_CODE
,
&
httpCode
);
Logger
::
smf_n11
().
debug
(
"
Response from NRF, Http
Code: %d"
,
httpCode
);
Logger
::
smf_n11
().
debug
(
"
NFSubscribeNotify, response from NRF, HTTP
Code: %d"
,
httpCode
);
if
((
static_cast
<
http_response_codes_e
>
(
httpCode
)
==
http_response_codes_e
::
HTTP_RESPONSE_CODE_
OK
)
or
http_response_codes_e
::
HTTP_RESPONSE_CODE_
CREATED
)
or
(
static_cast
<
http_response_codes_e
>
(
httpCode
)
==
http_response_codes_e
::
HTTP_RESPONSE_CODE_NO_CONTENT
))
{
Logger
::
smf_n11
().
debug
(
"
G
ot successful response from NRF"
);
Logger
::
smf_n11
().
debug
(
"
NFSubscribeNotify, g
ot successful response from NRF"
);
}
else
{
Logger
::
smf_n11
().
warn
(
"
C
ould not get response from NRF"
);
Logger
::
smf_n11
().
warn
(
"
NFSubscribeNotify, c
ould not get response from NRF"
);
}
curl_slist_free_all
(
headers
);
...
...
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