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
e4afe859
Commit
e4afe859
authored
Feb 02, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update SMF selection procedure
parent
f1d18f30
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
24 deletions
+56
-24
src/amf-app/amf_n11.cpp
src/amf-app/amf_n11.cpp
+52
-21
src/amf-app/amf_n11.hpp
src/amf-app/amf_n11.hpp
+2
-2
src/contexts/pdu_session_context.hpp
src/contexts/pdu_session_context.hpp
+2
-1
No files found.
src/amf-app/amf_n11.cpp
View file @
e4afe859
...
...
@@ -192,20 +192,12 @@ void amf_n11::handle_itti_message(
std
::
string
smf_addr
;
std
::
string
smf_api_version
;
if
(
!
psc
.
get
()
->
smf_available
)
{
// TODO:
if
(
!
smf_selection_from_configuration
(
smf_addr
,
smf_api_version
))
{
// use NRF to find suitable SMF based on snssai, plmn and dnn
if
(
!
discover_smf
(
smf_addr
,
psc
.
get
()
->
snssai
,
psc
.
get
()
->
plmn
,
psc
.
get
()
->
dnn
))
{
Logger
::
amf_n11
().
error
(
"No SMF candidate is available"
);
return
;
}
}
Logger
::
amf_n11
().
error
(
"No SMF is available for this PDU session"
);
}
else
{
smf_addr
=
psc
->
smf_addr
;
smf_api_version
=
psc
->
smf_api_version
;
// smf_selection_from_context(smf_addr, smf_api_version);
}
std
::
string
smf_ip_addr
,
remote_uri
;
...
...
@@ -287,17 +279,43 @@ void amf_n11::handle_itti_message(itti_smf_services_consumer& smf) {
Logger
::
amf_n11
().
debug
(
"Requested DNN: %s"
,
dnn
.
c_str
());
psc
.
get
()
->
dnn
=
dnn
;
/* std::string smf_addr;
std::string smf_api_version;
if (!psc.get()->smf_available) {
if (!smf_selection_from_configuration(smf_addr, smf_api_version)) {
Logger::amf_n11().error("No candidate for SMF is available");
return;
}
} else {
smf_addr = psc->smf_addr;
smf_api_version = psc->smf_api_version;
// smf_selection_from_context(smf_addr, smf_api_version);
}
*/
std
::
string
smf_addr
;
std
::
string
smf_api_version
;
if
(
!
psc
.
get
()
->
smf_available
)
{
if
(
!
smf_selection_from_configuration
(
smf_addr
,
smf_api_version
))
{
Logger
::
amf_n11
().
error
(
"No candidate for SMF is available"
);
if
(
amf_cfg
.
enable_smf_selection
)
{
// use NRF to find suitable SMF based on snssai, plmn and dnn
if
(
!
discover_smf
(
smf_addr
,
smf_api_version
,
psc
.
get
()
->
snssai
,
psc
.
get
()
->
plmn
,
psc
.
get
()
->
dnn
))
{
Logger
::
amf_n11
().
error
(
"SMF Selection, no SMF candidate is available"
);
return
;
}
}
else
if
(
!
smf_selection_from_configuration
(
smf_addr
,
smf_api_version
))
{
Logger
::
amf_n11
().
error
(
"No SMF candidate is available (from configuration file)"
);
return
;
}
// store smf info to be used with this PDU session
psc
.
get
()
->
smf_available
=
true
;
psc
->
smf_addr
=
smf_addr
;
psc
->
smf_api_version
=
smf_api_version
;
}
else
{
smf_addr
=
psc
->
smf_addr
;
smf_api_version
=
psc
->
smf_api_version
;
// smf_selection_from_context(smf_addr, smf_api_version);
}
switch
(
smf
.
req_type
&
0x07
)
{
...
...
@@ -437,16 +455,14 @@ void amf_n11::handle_itti_message(
std
::
shared_ptr
<
pdu_session_context
>
psc
=
supi_to_pdu_ctx
(
itti_msg
.
supi
);
string
smf_addr
;
std
::
string
smf_api_version
;
if
(
!
psc
.
get
()
->
smf_available
)
{
if
(
!
smf_selection_from_configuration
(
smf_addr
,
smf_api_version
))
{
Logger
::
amf_n11
().
error
(
"No candidate smf is avaliable"
);
return
;
}
Logger
::
amf_n11
().
error
(
"No SMF is available for this PDU session"
);
}
else
{
smf_addr
=
psc
->
smf_addr
;
smf_api_version
=
psc
->
smf_api_version
;
// smf_selection_from_context(smf_addr, smf_api_version);
}
string
remote_uri
=
psc
.
get
()
->
location
+
"release"
;
nlohmann
::
json
pdu_session_release_request
;
pdu_session_release_request
[
"supi"
]
=
itti_msg
.
supi
.
c_str
();
...
...
@@ -743,10 +759,11 @@ void amf_n11::curl_http_client(
}
bool
amf_n11
::
discover_smf
(
std
::
string
&
smf_addr
,
const
snssai_t
snssai
,
const
plmn_t
plmn
,
const
std
::
string
dnn
)
{
std
::
string
&
smf_addr
,
std
::
string
&
smf_api_version
,
const
snssai_t
snssai
,
const
plmn_t
plmn
,
const
std
::
string
dnn
)
{
Logger
::
amf_n11
().
debug
(
"Send NFDiscovery to NRF to discover the available SMF"
);
bool
result
=
true
;
// curl -X GET
// "http://192.168.1.23/nnrf-disc/v1/nf-instances?target-nf-type=SMF&requester-nf-type=AMF"
...
...
@@ -816,17 +833,31 @@ bool amf_n11::discover_smf(
if
(
instance_json
[
"ipv4Addresses"
].
size
()
>
0
)
smf_addr
=
instance_json
[
"ipv4Addresses"
].
at
(
0
).
get
<
std
::
string
>
();
// break;
}
if
(
instance_json
.
find
(
"nfServices"
)
!=
instance_json
.
end
())
{
if
(
instance_json
[
"nfServices"
].
size
()
>
0
)
{
nlohmann
::
json
nf_service
=
instance_json
[
"nfServices"
].
at
(
0
);
if
(
nf_service
.
find
(
"versions"
)
!=
nf_service
.
end
())
{
nlohmann
::
json
nf_version
=
nf_service
[
"versions"
].
at
(
0
);
if
(
nf_version
.
find
(
"apiVersionInUri"
)
!=
nf_version
.
end
())
{
smf_api_version
=
nf_version
[
"apiVersionInUri"
].
get
<
std
::
string
>
();
}
}
}
break
;
}
}
}
}
else
{
Logger
::
amf_n11
().
warn
(
"NFDiscovery, could not get response from NRF"
);
result
=
false
;
}
curl_slist_free_all
(
headers
);
curl_easy_cleanup
(
curl
);
}
curl_global_cleanup
();
return
true
;
return
result
;
}
src/amf-app/amf_n11.hpp
View file @
e4afe859
...
...
@@ -79,8 +79,8 @@ class amf_n11 {
std
::
string
n2SmMsg
,
std
::
string
supi
,
uint8_t
pdu_session_id
);
bool
discover_smf
(
std
::
string
&
smf_addr
,
const
snssai_t
snssai
,
const
plmn_t
plm
n
,
const
std
::
string
dnn
);
std
::
string
&
smf_addr
,
std
::
string
&
smf_api_versio
n
,
const
s
nssai_t
snssai
,
const
plmn_t
plmn
,
const
s
td
::
string
dnn
);
};
}
// namespace amf_application
...
...
src/contexts/pdu_session_context.hpp
View file @
e4afe859
...
...
@@ -47,7 +47,8 @@ class pdu_session_context {
bstring
n1sm
;
bool
isn1sm_avaliable
;
std
::
string
dnn
;
std
::
string
remote_smf_addr
[
0
];
//"192.168.12.10:8080"
std
::
string
smf_addr
;
//"192.168.12.10:8080"
std
::
string
smf_api_version
;
bool
smf_available
;
std
::
string
location
;
snssai_t
snssai
;
...
...
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