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
d7bf4cd8
Commit
d7bf4cd8
authored
Dec 17, 2021
by
kharade
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added retry for PFCP association request
parent
a7d777ee
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
4 deletions
+47
-4
src/smf_app/smf_app.cpp
src/smf_app/smf_app.cpp
+25
-2
src/smf_app/smf_pfcp_association.cpp
src/smf_app/smf_pfcp_association.cpp
+22
-2
No files found.
src/smf_app/smf_app.cpp
View file @
d7bf4cd8
...
...
@@ -63,6 +63,7 @@
#include "string.hpp"
#include "fqdn.hpp"
#include "smf_config.hpp"
#include "smf_pfcp_association.hpp"
extern
"C"
{
#include "dynamic_memory_check.h"
...
...
@@ -71,6 +72,9 @@ extern "C" {
using
namespace
smf
;
#define PFCP_ASSOC_RETRY_COUNT 10
#define PFCP_ASSOC_RESP_WAIT 2
extern
util
::
async_shell_cmd
*
async_shell_cmd_inst
;
extern
smf_app
*
smf_app_inst
;
extern
smf_config
smf_cfg
;
...
...
@@ -367,7 +371,16 @@ void smf_app::start_nf_registration_discovery() {
// verified)
for
(
std
::
vector
<
pfcp
::
node_id_t
>::
const_iterator
it
=
smf_cfg
.
upfs
.
begin
();
it
!=
smf_cfg
.
upfs
.
end
();
++
it
)
{
start_upf_association
(
*
it
);
for
(
int
i
=
0
;
i
<
PFCP_ASSOC_RETRY_COUNT
;
i
++
)
{
start_upf_association
(
*
it
);
sleep
(
PFCP_ASSOC_RESP_WAIT
);
std
::
shared_ptr
<
pfcp_association
>
sa
=
{};
if
(
not
pfcp_associations
::
get_instance
().
get_association
(
*
it
,
sa
))
Logger
::
smf_app
().
warn
(
"Failed to receive PFCP Association Response, Retrying .....!!"
);
else
break
;
}
}
}
...
...
@@ -1412,7 +1425,17 @@ bool smf_app::handle_nf_status_notification(
smf_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
));
for
(
int
i
=
0
;
i
<
PFCP_ASSOC_RETRY_COUNT
;
i
++
)
{
start_upf_association
(
n
,
std
::
ref
(
*
upf_node_profile
));
sleep
(
PFCP_ASSOC_RESP_WAIT
);
std
::
shared_ptr
<
pfcp_association
>
sa
=
{};
if
(
not
pfcp_associations
::
get_instance
().
get_association
(
n
,
sa
))
Logger
::
smf_app
().
warn
(
"Failed to receive PFCP Association Response, Retrying "
".....!!"
);
else
break
;
}
}
else
{
Logger
::
smf_app
().
debug
(
"No IP Addr/FQDN found"
);
return
false
;
...
...
src/smf_app/smf_pfcp_association.cpp
View file @
d7bf4cd8
...
...
@@ -270,9 +270,29 @@ bool pfcp_associations::get_association(
std
::
shared_ptr
<
pfcp_association
>&
sa
)
const
{
std
::
size_t
hash_node_id
=
std
::
hash
<
pfcp
::
node_id_t
>
{}(
node_id
);
auto
pit
=
associations
.
find
((
int32_t
)
hash_node_id
);
if
(
pit
==
associations
.
end
())
if
(
pit
==
associations
.
end
())
{
// We didn't found association, may be because hash map is made with
// node_id_type FQDN
if
(
node_id
.
node_id_type
==
pfcp
::
NODE_ID_TYPE_IPV4_ADDRESS
)
{
struct
hostent
*
hostname
=
gethostbyaddr
(
&
node_id
.
u1
.
ipv4_address
.
s_addr
,
sizeof
(
node_id
.
u1
.
ipv4_address
.
s_addr
),
AF_INET
);
pfcp
::
node_id_t
node_id_tmp
=
{};
node_id_tmp
.
node_id_type
=
pfcp
::
NODE_ID_TYPE_FQDN
;
node_id_tmp
.
fqdn
=
hostname
->
h_name
;
Logger
::
smf_app
().
debug
(
"Hash lookup for association retry: Associated Hostname -> %s"
,
hostname
->
h_name
);
std
::
size_t
hash_node_id
=
std
::
hash
<
pfcp
::
node_id_t
>
{}(
node_id_tmp
);
auto
pit
=
associations
.
find
((
int32_t
)
hash_node_id
);
if
(
get_association
(
node_id_tmp
,
sa
))
return
true
;
}
// We didn't found association, may be because hash map is made with
// node_id_type IP ADDR
// ToDo (Might stuck in recursive loop here)
return
false
;
else
{
}
else
{
sa
=
pit
->
second
;
return
true
;
}
...
...
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