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-Simple
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
CommunityXG
OpenXG-SMF-Simple
Commits
54b1f5c4
Commit
54b1f5c4
authored
Jan 13, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add NF Services info
parent
f8572110
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
146 additions
and
23 deletions
+146
-23
build/scripts/smf_conf.sh
build/scripts/smf_conf.sh
+6
-2
etc/smf.conf
etc/smf.conf
+5
-5
src/common/smf.h
src/common/smf.h
+45
-0
src/smf_app/smf_app.cpp
src/smf_app/smf_app.cpp
+24
-12
src/smf_app/smf_profile.cpp
src/smf_app/smf_profile.cpp
+42
-0
src/smf_app/smf_profile.hpp
src/smf_app/smf_profile.hpp
+24
-4
No files found.
build/scripts/smf_conf.sh
View file @
54b1f5c4
...
...
@@ -12,8 +12,8 @@ SMF_CONF[@INSTANCE@]=$INSTANCE
SMF_CONF[@PREFIX@]
=
$PREFIX
SMF_CONF[@PID_DIRECTORY@]
=
'/var/run'
SMF_CONF[@SMF_INTERFACE_NAME_FOR_N4@]
=
'
ens3
'
SMF_CONF[@SMF_INTERFACE_NAME_FOR_SBI@]
=
'
ens3
'
SMF_CONF[@SMF_INTERFACE_NAME_FOR_N4@]
=
'
wlo1
'
SMF_CONF[@SMF_INTERFACE_NAME_FOR_SBI@]
=
'
wlo1
'
SMF_CONF[@SMF_INTERFACE_PORT_FOR_SBI@]
=
'80'
SMF_CONF[@SMF_INTERFACE_HTTP2_PORT_FOR_SBI@]
=
'9090'
...
...
@@ -29,6 +29,10 @@ SMF_CONF[@AMF_API_VERSION@]='v1'
SMF_CONF[@UPF_IPV4_ADDRESS@]
=
'192.168.122.151'
SMF_CONF[@NRF_IPV4_ADDRESS@]
=
'192.168.1.23'
SMF_CONF[@NRF_PORT@]
=
'8080'
SMF_CONF[@NRF_API_VERSION@]
=
'v1'
SMF_CONF[@DEFAULT_DNS_IPV4_ADDRESS@]
=
'8.8.8.8'
SMF_CONF[@DEFAULT_DNS_SEC_IPV4_ADDRESS@]
=
'4.4.4.4'
...
...
etc/smf.conf
View file @
54b1f5c4
src/common/smf.h
View file @
54b1f5c4
...
...
@@ -238,4 +238,49 @@ typedef struct smf_info_s {
std
::
vector
<
snssai_smf_info_item_t
>
snssai_smf_info_list
;
}
smf_info_t
;
typedef
struct
nf_service_version_s
{
std
::
string
api_version_in_uri
;
// apiVersionInUri
std
::
string
api_full_version
;
// apiFullVersion
nf_service_version_s
&
operator
=
(
const
nf_service_version_s
&
s
)
{
api_version_in_uri
=
s
.
api_version_in_uri
;
api_full_version
=
s
.
api_full_version
;
}
std
::
string
to_string
()
const
{
std
::
string
s
=
{};
s
.
append
(
", Version ("
);
s
.
append
(
"apiVersionInUri: "
);
s
.
append
(
api_version_in_uri
);
s
.
append
(
", apiFullVersion: "
);
s
.
append
(
api_full_version
);
s
.
append
(
" )"
);
return
s
;
}
}
nf_service_version_t
;
typedef
struct
nf_service_s
{
std
::
string
service_instance_id
;
std
::
string
service_name
;
std
::
vector
<
nf_service_version_t
>
versions
;
std
::
string
scheme
;
std
::
string
nf_service_status
;
std
::
string
to_string
()
const
{
std
::
string
s
=
{};
s
.
append
(
"Service Instance ID: "
);
s
.
append
(
service_instance_id
);
s
.
append
(
", Service name: "
);
s
.
append
(
service_name
);
for
(
auto
v
:
versions
)
{
s
.
append
(
v
.
to_string
());
}
s
.
append
(
", Scheme: "
);
s
.
append
(
scheme
);
s
.
append
(
", Service status: "
);
s
.
append
(
nf_service_status
);
return
s
;
}
}
nf_service_t
;
#endif
src/smf_app/smf_app.cpp
View file @
54b1f5c4
...
...
@@ -587,11 +587,11 @@ void smf_app::handle_itti_msg(itti_n11_register_nf_instance_response &r) {
TASK_SMF_APP
,
TASK_SMF_APP_TIMEOUT_NRF_HEARTBEAT
,
0
);
// TODO arg2_user
//Set timer to send NF Deregistration (for testing purpose)
/*
itti_inst->timer_setup(50, 0,
TASK_SMF_APP, TASK_SMF_APP_TIMEOUT_NRF_DEREGISTRATION
,
0); // TODO arg2_user
*/
/
* /
/Set timer to send NF Deregistration (for testing purpose)
itti_inst->timer_setup(50, 0,
TASK_SMF_APP
,
TASK_SMF_APP_TIMEOUT_NRF_DEREGISTRATION,
0); // TODO arg2_user
*/
}
//------------------------------------------------------------------------------
...
...
@@ -796,7 +796,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(
request_type
.
c_str
());
//"Existing PDU Session", AMF should use PDUSession_UpdateSMContext instead
//(see step 3, section 4.3.2.2.1 @ 3GPP TS 23.502 v16.0.0) ignore the
//message
//
message
return
;
}
...
...
@@ -1460,11 +1460,11 @@ void smf_app::timer_nrf_heartbeat_timeout(timer_id_t timer_id,
}
}
//---------------------------------------------------------------------------------------------
void
smf_app
::
timer_nrf_deregistration
(
timer_id_t
timer_id
,
uint64_t
arg2_user
)
{
Logger
::
smf_app
().
debug
(
"Send ITTI msg to N11 task to trigger NRF Deregistratino"
);
Logger
::
smf_app
().
debug
(
"Send ITTI msg to N11 task to trigger NRF Deregistratino"
);
trigger_nf_deregistration
();
}
...
...
@@ -1786,6 +1786,19 @@ void smf_app::generate_smf_profile() {
nf_profile
.
set_nf_priority
(
1
);
nf_profile
.
set_nf_capacity
(
100
);
nf_profile
.
add_nf_ipv4_addresses
(
smf_cfg
.
sbi
.
addr4
);
// NF services
nf_service_t
nf_service
=
{};
nf_service
.
service_instance_id
=
smf_instance_id
;
nf_service
.
service_name
=
"nsmf-pdusession"
;
nf_service_version_t
version
=
{};
version
.
api_version_in_uri
=
"v1"
;
version
.
api_version_in_uri
=
"1.0.0"
;
// TODO: to be updated
nf_service
.
versions
.
push_back
(
version
);
nf_service
.
scheme
=
"http"
;
nf_service
.
nf_service_status
=
"REGISTERED"
;
nf_profile
.
add_nf_service
(
nf_service
);
// TODO: custom info
int
i
=
0
;
...
...
@@ -1860,4 +1873,3 @@ void smf_app::trigger_nf_deregistration() {
itti_msg
->
get_msg_name
());
}
}
src/smf_app/smf_profile.cpp
View file @
54b1f5c4
...
...
@@ -140,6 +140,21 @@ void smf_profile::get_nf_ipv4_addresses(std::vector<struct in_addr> &a) const {
a
=
ipv4_addresses
;
}
//------------------------------------------------------------------------------
void
smf_profile
::
set_nf_services
(
const
std
::
vector
<
nf_service_t
>
&
n
)
{
nf_services
=
n
;
}
//------------------------------------------------------------------------------
void
smf_profile
::
add_nf_service
(
const
nf_service_t
&
n
)
{
nf_services
.
push_back
(
n
);
}
//------------------------------------------------------------------------------
void
smf_profile
::
get_nf_services
(
std
::
vector
<
nf_service_t
>
&
n
)
const
{
n
=
nf_services
;
}
//------------------------------------------------------------------------------
void
smf_profile
::
set_custom_info
(
const
nlohmann
::
json
&
c
)
{
custom_info
=
c
;
}
...
...
@@ -185,6 +200,14 @@ void smf_profile::display() {
Logger
::
smf_app
().
debug
(
"
\t\t
%s"
,
inet_ntoa
(
address
));
}
// NF services
if
(
nf_services
.
size
()
>
0
)
{
Logger
::
smf_app
().
debug
(
"
\t
NF Service"
);
}
for
(
auto
service
:
nf_services
)
{
Logger
::
smf_app
().
debug
(
"
\t\t
%s"
,
service
.
to_string
().
c_str
());
}
if
(
!
custom_info
.
empty
())
{
Logger
::
smf_app
().
debug
(
"
\t
Custom info: %s"
,
custom_info
.
dump
().
c_str
());
}
...
...
@@ -228,6 +251,25 @@ void smf_profile::to_json(nlohmann::json &data) const {
data
[
"priority"
]
=
priority
;
data
[
"capacity"
]
=
capacity
;
// NF services
data
[
"nfServices"
]
=
nlohmann
::
json
::
array
();
for
(
auto
service
:
nf_services
)
{
nlohmann
::
json
srv_tmp
=
{};
srv_tmp
[
"serviceInstanceId"
]
=
service
.
service_instance_id
;
srv_tmp
[
"serviceName"
]
=
service
.
service_name
;
srv_tmp
[
"versions"
]
=
nlohmann
::
json
::
array
();
for
(
auto
v
:
service
.
versions
)
{
nlohmann
::
json
v_tmp
=
{};
v_tmp
[
"apiVersionInUri"
]
=
v
.
api_version_in_uri
;
v_tmp
[
"apiFullVersion"
]
=
v
.
api_full_version
;
srv_tmp
[
"versions"
].
push_back
(
v_tmp
);
}
srv_tmp
[
"scheme"
]
=
service
.
scheme
;
srv_tmp
[
"nfServiceStatus"
]
=
service
.
nf_service_status
;
data
[
"nfServices"
].
push_back
(
srv_tmp
);
}
data
[
"custom_info"
]
=
custom_info
;
// SMF info
...
...
src/smf_app/smf_profile.hpp
View file @
54b1f5c4
...
...
@@ -54,8 +54,7 @@ class smf_profile : public std::enable_shared_from_this<smf_profile> {
snssais
(),
ipv4_addresses
(),
priority
(
0
),
capacity
(
0
)
{
capacity
(
0
)
{
nf_instance_name
=
""
;
nf_status
=
""
;
custom_info
=
{};
...
...
@@ -68,8 +67,7 @@ class smf_profile : public std::enable_shared_from_this<smf_profile> {
ipv4_addresses
(),
priority
(
0
),
capacity
(
0
),
nf_type
(
"NF_TYPE_UNKNOWN"
)
{
nf_type
(
"NF_TYPE_UNKNOWN"
)
{
nf_instance_name
=
""
;
nf_status
=
""
;
custom_info
=
{};
...
...
@@ -275,6 +273,27 @@ class smf_profile : public std::enable_shared_from_this<smf_profile> {
*/
void
get_nf_ipv4_addresses
(
std
::
vector
<
struct
in_addr
>
&
a
)
const
;
/*
* Set NF instance services
* @param [std::vector<nf_service_t> &] n: nf_service
* @return void
*/
void
set_nf_services
(
const
std
::
vector
<
nf_service_t
>
&
n
);
/*
* Add nf service
* @param [snssai_t &] n: nf service
* @return void
*/
void
add_nf_service
(
const
nf_service_t
&
n
);
/*
* Get NF services
* @param [std::vector<snssai_t> &] n: store instance's nf services
* @return void:
*/
void
get_nf_services
(
std
::
vector
<
nf_service_t
>
&
n
)
const
;
/*
* Set custom info
* @param [const nlohmann::json &] c: custom info to be set
...
...
@@ -349,6 +368,7 @@ class smf_profile : public std::enable_shared_from_this<smf_profile> {
std
::
vector
<
struct
in_addr
>
ipv4_addresses
;
uint16_t
priority
;
uint16_t
capacity
;
std
::
vector
<
nf_service_t
>
nf_services
;
nlohmann
::
json
custom_info
;
// store extra json data
smf_info_t
smf_info
;
};
...
...
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