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
7db4fc19
Commit
7db4fc19
authored
Sep 08, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unnecessary code
parent
7d160e83
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1 addition
and
243 deletions
+1
-243
src/amf-app/amf_app.cpp
src/amf-app/amf_app.cpp
+1
-71
src/amf-app/amf_profile.cpp
src/amf-app/amf_profile.cpp
+0
-89
src/amf-app/amf_profile.hpp
src/amf-app/amf_profile.hpp
+0
-83
No files found.
src/amf-app/amf_app.cpp
View file @
7db4fc19
...
...
@@ -449,77 +449,7 @@ bool amf_app::handle_nf_status_notification(
"Handle a NF status notification from NRF (HTTP version "
"%d)"
,
msg
->
http_version
);
data_notification_msg
notification_msg
=
msg
.
get
()
->
notification_msg
;
std
::
string
event_type
=
""
;
// notification_msg.get_notification_event_type(event_type);
if
(
event_type
.
compare
(
"NF_REGISTERED"
)
==
0
)
{
std
::
shared_ptr
<
nf_profile
>
profile
=
{};
// notification_msg.get_profile(profile);
if
(
profile
.
get
()
!=
nullptr
)
{
std
::
string
nf_type
=
profile
.
get
()
->
get_nf_type
();
if
(
nf_type
.
compare
(
"UPF"
)
==
0
)
{
// UPF
upf_info_t
upf_info
=
{};
std
::
static_pointer_cast
<
upf_profile
>
(
profile
).
get
()
->
get_upf_info
(
upf_info
);
// Verify if the UPF is already exist
// if not, add to the DB and send Association request
// UPF N4 ipv4 address
std
::
vector
<
struct
in_addr
>
ipv4_addrs
=
{};
profile
.
get
()
->
get_nf_ipv4_addresses
(
ipv4_addrs
);
if
(
ipv4_addrs
.
size
()
<
1
)
{
Logger
::
amf_app
().
debug
(
"No IP Addr found"
);
return
false
;
}
bool
found
=
false
;
// for (auto node : amf_cfg.upfs) {
// if (node.u1.ipv4_address.s_addr == ipv4_addrs[0].s_addr) {
// found = false;
// break;
// }
//}
if
(
!
found
)
{
// Add a new UPF node
Logger
::
amf_app
().
debug
(
"Add a new UPF node, Ipv4 Addr %s"
,
inet_ntoa
(
ipv4_addrs
[
0
]));
// pfcp::node_id_t n = {};
// n.node_id_type = pfcp::NODE_ID_TYPE_IPV4_ADDRESS;
// n.u1.ipv4_address.s_addr = ipv4_addrs[0].s_addr;
// memcpy(&n.u1.ipv4_address, &ipv4_addrs[0], sizeof(struct in_addr));
// amf_cfg.upfs.push_back(n);
// upf_profile* upf_node_profile =
// dynamic_cast<upf_profile*>(profile.get());
// start_upf_association(n, std::ref(*upf_node_profile));
// start_upf_association(n,
// std::static_pointer_cast<upf_profile>(profile));
}
else
{
Logger
::
amf_app
().
debug
(
"UPF node already exist (%s)"
,
inet_ntoa
(
ipv4_addrs
[
0
]));
}
}
}
else
{
return
false
;
}
}
if
(
event_type
.
compare
(
"NF_DEREGISTERED"
)
==
0
)
{
Logger
::
amf_app
().
debug
(
"This event (%s) has not been supported yet!"
,
event_type
);
// TODO: Remove UPF from the list UPFs if received DE-REGISTERED Event
/* std::string nf_instance_uri = {};
notification_msg.get_nf_instance_uri(nf_instance_uri);
std::vector<std::string> split_result;
boost::split(
split_result, nf_instance_uri, boost::is_any_of("/"));
if (split_result.size() > 0) {
std::string instance_id = split_result[split_result.size() -1];
pfcp_associations::get_instance().remove_association(instance_id);
}
*/
}
// TODO
return
true
;
}
...
...
src/amf-app/amf_profile.cpp
View file @
7db4fc19
...
...
@@ -443,92 +443,3 @@ void amf_profile::handle_heartbeart_timeout(uint64_t ms) {
ms
);
set_nf_status
(
"SUSPENDED"
);
}
//------------------------------------------------------------------------------
void
upf_profile
::
add_upf_info_item
(
const
snssai_upf_info_item_t
&
s
)
{
upf_info
.
snssai_upf_info_list
.
push_back
(
s
);
}
//------------------------------------------------------------------------------
void
upf_profile
::
get_upf_info
(
upf_info_t
&
s
)
const
{
s
=
upf_info
;
}
//------------------------------------------------------------------------------
void
upf_profile
::
display
()
const
{
// display NF part
nf_profile
::
display
();
// UPF info
if
(
upf_info
.
snssai_upf_info_list
.
size
()
>
0
)
{
Logger
::
amf_app
().
debug
(
"
\t
UPF Info:"
);
}
for
(
auto
s
:
upf_info
.
snssai_upf_info_list
)
{
Logger
::
amf_app
().
debug
(
"
\t\t
Parameters supported by the UPF:"
);
Logger
::
amf_app
().
debug
(
"
\t\t\t
SNSSAI (SST %d, SD %s)"
,
s
.
snssai
.
sST
,
s
.
snssai
.
sD
.
c_str
());
for
(
auto
d
:
s
.
dnn_upf_info_list
)
{
Logger
::
amf_app
().
debug
(
"
\t\t\t
DNN %s"
,
d
.
dnn
.
c_str
());
}
}
}
//------------------------------------------------------------------------------
void
upf_profile
::
to_json
(
nlohmann
::
json
&
data
)
const
{
nf_profile
::
to_json
(
data
);
// UPF info
data
[
"upfInfo"
]
=
{};
data
[
"upfInfo"
][
"sNssaiUpfInfoList"
]
=
nlohmann
::
json
::
array
();
for
(
auto
s
:
upf_info
.
snssai_upf_info_list
)
{
nlohmann
::
json
tmp
=
{};
tmp
[
"sNssai"
][
"sst"
]
=
s
.
snssai
.
sST
;
tmp
[
"sNssai"
][
"sd"
]
=
s
.
snssai
.
sD
;
tmp
[
"dnnAmfInfoList"
]
=
nlohmann
::
json
::
array
();
for
(
auto
d
:
s
.
dnn_upf_info_list
)
{
nlohmann
::
json
dnn_json
=
{};
dnn_json
[
"dnn"
]
=
d
.
dnn
;
tmp
[
"dnnAmfInfoList"
].
push_back
(
dnn_json
);
}
data
[
"upfInfo"
][
"sNssaiUpfInfoList"
].
push_back
(
tmp
);
}
Logger
::
amf_app
().
debug
(
"UPF profile to json:
\n
%s"
,
data
.
dump
().
c_str
());
}
//------------------------------------------------------------------------------
void
upf_profile
::
from_json
(
const
nlohmann
::
json
&
data
)
{
nf_profile
::
from_json
(
data
);
// UPF info
if
(
data
.
find
(
"upfInfo"
)
!=
data
.
end
())
{
nlohmann
::
json
info
=
data
[
"upfInfo"
];
dnn_upf_info_item_t
dnn_item
=
{};
if
(
info
.
find
(
"sNssaiUpfInfoList"
)
!=
info
.
end
())
{
nlohmann
::
json
snssai_upf_info_list
=
data
[
"upfInfo"
][
"sNssaiUpfInfoList"
];
for
(
auto
it
:
snssai_upf_info_list
)
{
snssai_upf_info_item_t
upf_info_item
=
{};
if
(
it
.
find
(
"sNssai"
)
!=
it
.
end
())
{
if
(
it
[
"sNssai"
].
find
(
"sst"
)
!=
it
[
"sNssai"
].
end
())
upf_info_item
.
snssai
.
sST
=
it
[
"sNssai"
][
"sst"
].
get
<
int
>
();
if
(
it
[
"sNssai"
].
find
(
"sd"
)
!=
it
[
"sNssai"
].
end
())
upf_info_item
.
snssai
.
sD
=
it
[
"sNssai"
][
"sd"
].
get
<
std
::
string
>
();
}
if
(
it
.
find
(
"dnnUpfInfoList"
)
!=
it
.
end
())
{
for
(
auto
d
:
it
[
"dnnUpfInfoList"
])
{
if
(
d
.
find
(
"dnn"
)
!=
d
.
end
())
{
dnn_item
.
dnn
=
d
[
"dnn"
].
get
<
std
::
string
>
();
upf_info_item
.
dnn_upf_info_list
.
push_back
(
dnn_item
);
}
}
}
upf_info
.
snssai_upf_info_list
.
push_back
(
upf_info_item
);
}
}
}
display
();
}
src/amf-app/amf_profile.hpp
View file @
7db4fc19
...
...
@@ -411,89 +411,6 @@ class amf_profile : public nf_profile {
amf_info_t
amf_info
;
};
class
upf_profile
:
public
nf_profile
{
public:
upf_profile
()
:
nf_profile
()
{
// custom_info = {};
nf_type
=
"UPF"
;
}
upf_profile
(
const
std
::
string
&
id
)
:
nf_profile
(
id
)
{
// custom_info = {};
}
upf_profile
&
operator
=
(
const
upf_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
;
// custom_info = s.custom_info;
upf_info
=
s
.
upf_info
;
return
*
this
;
}
// upf_profile(upf_profile &b) = delete;
virtual
~
upf_profile
()
{
Logger
::
amf_app
().
debug
(
"Delete UPF Profile instance..."
);
}
/*
* Set upf info
* @param [upf_info_t &] s: upf info
* @return void
*/
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_upf_info_item
* @return void
*/
void
add_upf_info_item
(
const
snssai_upf_info_item_t
&
s
);
/*
* Get NF instance upf info
* @param [upf_info_t &] s: store instance's upf info
* @return void:
*/
void
get_upf_info
(
upf_info_t
&
s
)
const
;
/*
* Print related-information for NF profile
* @param void
* @return void:
*/
void
display
()
const
;
/*
* Represent NF profile as json object
* @param [nlohmann::json &] data: Json data
* @return void
*/
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
);
/*
* Handle heartbeart timeout event
* @param [uint64_t] ms: current time
* @return void
*/
void
handle_heartbeart_timeout
(
uint64_t
ms
);
protected:
nlohmann
::
json
custom_info
;
// store extra json data
upf_info_t
upf_info
;
};
}
// namespace amf_application
#endif
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