Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-Spgwu-Tiny-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-Spgwu-Tiny-Simple
Commits
17550447
Commit
17550447
authored
Jan 14, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
code cleanup
parent
db6b092a
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
169 additions
and
300 deletions
+169
-300
src/spgwu/spgwu_nrf.cpp
src/spgwu/spgwu_nrf.cpp
+33
-176
src/spgwu/spgwu_nrf.hpp
src/spgwu/spgwu_nrf.hpp
+18
-37
src/spgwu/spgwu_profile.cpp
src/spgwu/spgwu_profile.cpp
+80
-49
src/spgwu/spgwu_profile.hpp
src/spgwu/spgwu_profile.hpp
+38
-38
No files found.
src/spgwu/spgwu_nrf.cpp
View file @
17550447
This diff is collapsed.
Click to expand it.
src/spgwu/spgwu_nrf.hpp
View file @
17550447
...
...
@@ -43,52 +43,41 @@ namespace spgwu {
#define TASK_SPGWU_NRF_TIMEOUT_NRF_HEARTBEAT (1)
#define TASK_SPGWU_NRF_TIMEOUT_NRF_DEREGISTRATION (2)
class
spgwu_nrf
{
private:
std
::
thread
::
id
thread_id
;
std
::
thread
thread
;
spgwu_profile
upf_profile
;
// UPF profile
spgwu_profile
upf_profile
;
// UPF profile
std
::
string
upf_instance_id
;
// UPF instance id
timer_id_t
timer_nrf_heartbeat
;
public:
spgwu_nrf
();
spgwu_nrf
(
spgwu_nrf
const
&
)
=
delete
;
void
operator
=
(
spgwu_nrf
const
&
)
=
delete
;
spgwu_nrf
(
spgwu_nrf
const
&
)
=
delete
;
void
operator
=
(
spgwu_nrf
const
&
)
=
delete
;
/*
* Send NF instance registration to NRF
* @param [std::shared_ptr<itti_nrf_register_nf_instance_request>] msg:
* Content of message to be sent
* @param [std::string &] url: NRF's URL
* @return void
*/
void
register_nf_instance
(
std
::
shared_ptr
<
itti_nrf_register_nf_instance_request
>
msg
);
void
send_register_nf_instance
(
std
::
string
&
url
);
void
send_update_nf_instance
(
std
::
string
&
url
,
nlohmann
::
json
&
data
);
void
send_register_nf_instance
(
std
::
string
&
url
);
/*
* Send NF instance
update
to NRF
* @param [std::s
hared_ptr<itti_nrf_update_nf_instance_request>] msg: Content
*
of message
to be sent
* Send NF instance
registration
to NRF
* @param [std::s
tring &] url: NRF's URL
*
@param [nlohmann::json &] data: Json data
to be sent
* @return void
*/
void
send_update_nf_instance
(
std
::
string
&
url
,
nlohmann
::
json
&
data
);
/*
* Send NF deregister to NRF
* @param [std::shared_ptr<itti_nrf_deregister_nf_instance>] msg: Content
* of message to be sent
* @param [std::string &] url: NRF's URL
* @return void
*/
void
deregister_nf_instance
(
std
::
shared_ptr
<
itti_nrf_deregister_nf_instance
>
msg
);
void
send_deregister_nf_instance
(
std
::
string
&
url
);
/*
* Trigger NF instance registration to NRF
...
...
@@ -98,32 +87,26 @@ class spgwu_nrf {
void
register_to_nrf
();
/*
* Generate a random UUID for
SM
F instance
* Generate a random UUID for
UP
F instance
* @param [void]
* @return void
*/
void
generate_uuid
();
/*
* Generate a
SM
F profile for this instance
* Generate a
UP
F profile for this instance
* @param [void]
* @return void
*/
void
generate_upf_profile
();
/*
* Send request to N11 task to trigger NF instance registration to NRF
* @param [void]
* @return void
*/
void
trigger_nf_registration_request
();
/*
* Send request to N11 task to trigger NF instance deregistration to NRF
* @param [void]
* will be executed when NRF Heartbeat timer expires
* @param [timer_id_t] timer_id
* @param [uint64_t] arg2_user
* @return void
*/
void
t
rigger_nf_deregistration
(
);
void
t
imer_nrf_heartbeat_timeout
(
timer_id_t
timer_id
,
uint64_t
arg2_user
);
/*
* will be executed when NRF Heartbeat timer expires
...
...
@@ -131,9 +114,7 @@ class spgwu_nrf {
* @param [uint64_t] arg2_user
* @return void
*/
void
timer_nrf_heartbeat_timeout
(
timer_id_t
timer_id
,
uint64_t
arg2_user
);
void
timer_nrf_deregistration
(
timer_id_t
timer_id
,
uint64_t
arg2_user
);
};
}
// namespace s
mf
}
// namespace s
pgwu
#endif
/* FILE_SPGWU_NRF_HPP_SEEN */
src/spgwu/spgwu_profile.cpp
View file @
17550447
This diff is collapsed.
Click to expand it.
src/spgwu/spgwu_profile.hpp
View file @
17550447
...
...
@@ -44,7 +44,7 @@
namespace
spgwu
{
//using namespace std;
//
using namespace std;
class
spgwu_profile
:
public
std
::
enable_shared_from_this
<
spgwu_profile
>
{
public:
...
...
@@ -56,10 +56,10 @@ class spgwu_profile : public std::enable_shared_from_this<spgwu_profile> {
priority
(
0
),
capacity
(
0
)
{
nf_instance_name
=
""
;
nf_status
=
""
;
nf_status
=
""
;
}
spgwu_profile
(
const
std
::
string
&
id
)
spgwu_profile
(
const
std
::
string
&
id
)
:
nf_instance_id
(
id
),
heartBeat_timer
(
0
),
snssais
(),
...
...
@@ -68,20 +68,20 @@ class spgwu_profile : public std::enable_shared_from_this<spgwu_profile> {
capacity
(
0
),
nf_type
(
"NF_TYPE_UNKNOWN"
)
{
nf_instance_name
=
""
;
nf_status
=
""
;
nf_status
=
""
;
}
spgwu_profile
&
operator
=
(
const
spgwu_profile
&
s
)
{
nf_instance_id
=
s
.
nf_instance_id
;
heartBeat_timer
=
s
.
heartBeat_timer
;
snssais
=
s
.
snssais
;
ipv4_addresses
=
s
.
ipv4_addresses
;
priority
=
s
.
priority
;
capacity
=
s
.
capacity
;
nf_type
=
s
.
nf_type
;
spgwu_profile
&
operator
=
(
const
spgwu_profile
&
s
)
{
nf_instance_id
=
s
.
nf_instance_id
;
heartBeat_timer
=
s
.
heartBeat_timer
;
snssais
=
s
.
snssais
;
ipv4_addresses
=
s
.
ipv4_addresses
;
priority
=
s
.
priority
;
capacity
=
s
.
capacity
;
nf_type
=
s
.
nf_type
;
nf_instance_name
=
s
.
nf_instance_name
;
nf_status
=
s
.
nf_status
;
upf_info
=
s
.
upf_info
;
nf_status
=
s
.
nf_status
;
upf_info
=
s
.
upf_info
;
}
// spgwu_profile(spgwu_profile &b) = delete;
...
...
@@ -94,13 +94,13 @@ class spgwu_profile : public std::enable_shared_from_this<spgwu_profile> {
* @param [const std::string &] instance_id: instance id
* @return void
*/
void
set_nf_instance_id
(
const
std
::
string
&
instance_id
);
void
set_nf_instance_id
(
const
std
::
string
&
instance_id
);
/*
* Get NF instance ID
* @param [std::string &] instance_id: store instance id
* @return void:
*/
void
get_nf_instance_id
(
std
::
string
&
instance_id
)
const
;
void
get_nf_instance_id
(
std
::
string
&
instance_id
)
const
;
/*
* Get NF instance ID
...
...
@@ -114,14 +114,14 @@ class spgwu_profile : public std::enable_shared_from_this<spgwu_profile> {
* @param [const std::string &] instance_name: instance name
* @return void
*/
void
set_nf_instance_name
(
const
std
::
string
&
instance_name
);
void
set_nf_instance_name
(
const
std
::
string
&
instance_name
);
/*
* Get NF instance ID
* @param [std::string &] instance_name: store instance name
* @return void:
*/
void
get_nf_instance_name
(
std
::
string
&
instance_name
)
const
;
void
get_nf_instance_name
(
std
::
string
&
instance_name
)
const
;
/*
* Get NF instance name
...
...
@@ -135,14 +135,14 @@ class spgwu_profile : public std::enable_shared_from_this<spgwu_profile> {
* @param [const std::string &] status: instance status
* @return void
*/
void
set_nf_status
(
const
std
::
string
&
status
);
void
set_nf_status
(
const
std
::
string
&
status
);
/*
* Get NF instance status
* @param [std::string &] status: store instance status
* @return void:
*/
void
get_nf_status
(
std
::
string
&
status
)
const
;
void
get_nf_status
(
std
::
string
&
status
)
const
;
/*
* Get NF status
...
...
@@ -163,21 +163,21 @@ class spgwu_profile : public std::enable_shared_from_this<spgwu_profile> {
* @param [const nf_type_t &] type: nf type
* @return void
*/
void
set_nf_type
(
const
std
::
string
&
type
);
void
set_nf_type
(
const
std
::
string
&
type
);
/*
* Set NF instance heartBeat_timer
* @param [const std::string &] timer: heartBeat_timer
* @return void
*/
void
set_nf_heartBeat_timer
(
const
int32_t
&
timer
);
void
set_nf_heartBeat_timer
(
const
int32_t
&
timer
);
/*
* Get NF instance heartBeat_timer
* @param [std::string &] timer: store heartBeat_timer
* @return void:
*/
void
get_nf_heartBeat_timer
(
int32_t
&
timer
)
const
;
void
get_nf_heartBeat_timer
(
int32_t
&
timer
)
const
;
/*
* Get NF heartBeat_timer
...
...
@@ -191,14 +191,14 @@ class spgwu_profile : public std::enable_shared_from_this<spgwu_profile> {
* @param [const uint16_t] p: instance priority
* @return void
*/
void
set_nf_priority
(
const
uint16_t
&
p
);
void
set_nf_priority
(
const
uint16_t
&
p
);
/*
* Get NF instance priority
* @param [uint16_t] p: store instance priority
* @return void:
*/
void
get_nf_priority
(
uint16_t
&
p
)
const
;
void
get_nf_priority
(
uint16_t
&
p
)
const
;
/*
* Get NF instance priority
...
...
@@ -212,14 +212,14 @@ class spgwu_profile : public std::enable_shared_from_this<spgwu_profile> {
* @param [const uint16_t] c: instance capacity
* @return void
*/
void
set_nf_capacity
(
const
uint16_t
&
c
);
void
set_nf_capacity
(
const
uint16_t
&
c
);
/*
* Get NF instance priority
* @param [uint16_t ] c: store instance capacity
* @return void:
*/
void
get_nf_capacity
(
uint16_t
&
c
)
const
;
void
get_nf_capacity
(
uint16_t
&
c
)
const
;
/*
* Get NF instance priority
...
...
@@ -233,63 +233,63 @@ class spgwu_profile : public std::enable_shared_from_this<spgwu_profile> {
* @param [std::vector<snssai_t> &] s: SNSSAIs
* @return void
*/
void
set_nf_snssais
(
const
std
::
vector
<
snssai_t
>
&
s
);
void
set_nf_snssais
(
const
std
::
vector
<
snssai_t
>
&
s
);
/*
* Add SNSSAI
* @param [snssai_t &] s: SNSSAI
* @return void
*/
void
add_snssai
(
const
snssai_t
&
s
);
void
add_snssai
(
const
snssai_t
&
s
);
/*
* Get NF instance SNSSAIs
* @param [std::vector<snssai_t> &] s: store instance's SNSSAIs
* @return void:
*/
void
get_nf_snssais
(
std
::
vector
<
snssai_t
>
&
s
)
const
;
void
get_nf_snssais
(
std
::
vector
<
snssai_t
>
&
s
)
const
;
/*
* Set NF instance ipv4_addresses
* @param [std::vector<struct in_addr> &] a: ipv4_addresses
* @return void
*/
void
set_nf_ipv4_addresses
(
const
std
::
vector
<
struct
in_addr
>
&
a
);
void
set_nf_ipv4_addresses
(
const
std
::
vector
<
struct
in_addr
>
&
a
);
/*
* Add an IPv4 address to the list of addresses
* @param [const struct in_addr &] a: ipv4_address
* @return void
*/
void
add_nf_ipv4_addresses
(
const
struct
in_addr
&
a
);
void
add_nf_ipv4_addresses
(
const
struct
in_addr
&
a
);
/*
* Get NF instance ipv4_addresses
* @param [std::vector<struct in_addr> &] a: store instance's ipv4_addresses
* @return void:
*/
void
get_nf_ipv4_addresses
(
std
::
vector
<
struct
in_addr
>
&
a
)
const
;
void
get_nf_ipv4_addresses
(
std
::
vector
<
struct
in_addr
>
&
a
)
const
;
/*
* Set upf info
* @param [upf_info_t &] s: upf info
* @return void
*/
void
set_upf_info
(
const
upf_info_t
&
s
);
void
set_upf_info
(
const
upf_info_t
&
s
);
/*
* Add an snssai_upf_info_item to the upf info
* @param [const snssai_upf_info_item_t &] s: snssai_smf_info_item
* @return void
*/
void
add_upf_info_item
(
const
snssai_upf_info_item_t
&
s
);
void
add_upf_info_item
(
const
snssai_upf_info_item_t
&
s
);
/*
* Get NF instance smf info
* @param [smf_info_t &] s: store instance's smf info
* @return void:
*/
void
get_upf_info
(
upf_info_t
&
s
)
const
;
void
get_upf_info
(
upf_info_t
&
s
)
const
;
/*
* Print related-information for NF profile
...
...
@@ -303,14 +303,14 @@ class spgwu_profile : public std::enable_shared_from_this<spgwu_profile> {
* @param [nlohmann::json &] data: Json data
* @return void
*/
void
to_json
(
nlohmann
::
json
&
data
)
const
;
void
to_json
(
nlohmann
::
json
&
data
)
const
;
/*
* Covert from a json represetation to SMF profile
* @param [nlohmann::json &] data: Json data
* @return void
*/
void
from_json
(
const
nlohmann
::
json
&
data
);
void
from_json
(
const
nlohmann
::
json
&
data
);
/*
* Handle heartbeart timeout event
...
...
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