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
ed5ea7f3
Commit
ed5ea7f3
authored
Jun 30, 2022
by
Tien Thinh NGUYEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Match SD when provided
parent
505ffdb9
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
105 additions
and
28 deletions
+105
-28
src/amf-app/amf_config.hpp
src/amf-app/amf_config.hpp
+3
-2
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+63
-15
src/amf-app/amf_n11.cpp
src/amf-app/amf_n11.cpp
+17
-3
src/amf-app/amf_n2.cpp
src/amf-app/amf_n2.cpp
+16
-3
src/common/conversions.cpp
src/common/conversions.cpp
+3
-2
src/ngap/ngapMsgs/InitialContextSetupRequest.cpp
src/ngap/ngapMsgs/InitialContextSetupRequest.cpp
+1
-1
src/ngap/ngapMsgs/NGSetupResponse.cpp
src/ngap/ngapMsgs/NGSetupResponse.cpp
+1
-1
src/ngap/ngapMsgs/RerouteNASRequest.cpp
src/ngap/ngapMsgs/RerouteNASRequest.cpp
+1
-1
No files found.
src/amf-app/amf_config.hpp
View file @
ed5ea7f3
...
...
@@ -254,14 +254,15 @@ typedef struct slice_s {
nlohmann
::
json
to_json
()
const
{
nlohmann
::
json
json_data
=
{};
json_data
[
"sst"
]
=
this
->
sst
;
if
(
sst
>
SST_MAX_STANDARDIZED
_VALUE
)
json_data
[
"sd"
]
=
this
->
sd
;
if
(
this
->
sd
!=
SD_NO
_VALUE
)
json_data
[
"sd"
]
=
this
->
sd
;
return
json_data
;
}
void
from_json
(
nlohmann
::
json
&
json_data
)
{
this
->
sst
=
json_data
[
"sst"
].
get
<
int
>
();
if
(
this
->
sst
>
SST_MAX_STANDARDIZED_VALUE
)
if
(
json_data
.
find
(
"sd"
)
!=
json_data
.
end
())
{
this
->
sd
=
json_data
[
"sd"
].
get
<
int
>
();
}
}
}
slice_t
;
...
...
src/amf-app/amf_n1.cpp
View file @
ed5ea7f3
...
...
@@ -4140,7 +4140,7 @@ bool amf_n1::check_requested_nssai(const std::shared_ptr<nas_context>& nc) {
for
(
auto
s
:
p
.
slice_list
)
{
std
::
string
sd
=
std
::
to_string
(
s
.
sd
);
if
(
s
.
sst
==
n
.
sst
)
{
if
(
(
s
.
sst
<=
SST_MAX_STANDARDIZED_VALUE
)
or
(
s
.
sd
==
n
.
sd
)
)
{
if
(
s
.
sd
==
n
.
sd
)
{
found_nssai
=
true
;
Logger
::
amf_n1
().
debug
(
"Found S-NSSAI (SST %d, SD %d)"
,
s
.
sst
,
n
.
sd
);
...
...
@@ -4188,32 +4188,56 @@ bool amf_n1::check_subscribed_nssai(
"NSSAIs"
);
std
::
vector
<
oai
::
amf
::
model
::
Snssai
>
common_snssais
;
for
(
auto
s
:
nc
->
requestedNssai
)
{
std
::
string
sd
=
std
::
to_string
(
s
.
sd
);
//
std::string sd = std::to_string(s.sd);
// Check with default subscribed NSSAIs
for
(
auto
n
:
nssai
.
getDefaultSingleNssais
())
{
if
(
s
.
sst
==
n
.
getSst
())
{
if
((
s
.
sst
<=
SST_MAX_STANDARDIZED_VALUE
)
or
(
n
.
sdIsSet
()
and
(
n
.
getSd
().
compare
(
sd
)
==
0
))
or
(
!
n
.
sdIsSet
()
and
sd
.
empty
()))
{
uint32_t
sd
=
SD_NO_VALUE
;
if
(
!
n
.
getSd
().
empty
())
{
conv
::
sd_string_to_int
(
n
.
getSd
(),
sd
);
}
if
(
sd
==
s
.
sd
)
{
common_snssais
.
push_back
(
n
);
Logger
::
amf_n1
().
debug
(
"Common S-NSSAI (SST %d, SD %
s)"
,
s
.
sst
,
sd
.
c_str
()
);
"Common S-NSSAI (SST %d, SD %
ld)"
,
s
.
sst
,
sd
);
break
;
}
/*
if ((s.sst <= SST_MAX_STANDARDIZED_VALUE) or
(n.sdIsSet() and (n.getSd().compare(sd) == 0)) or
(!n.sdIsSet() and sd.empty())) {
common_snssais.push_back(n);
Logger::amf_n1().debug(
"Common S-NSSAI (SST %d, SD %s)", s.sst, sd.c_str());
break;
}
*/
}
}
// check with other subscribed NSSAIs
for
(
auto
n
:
nssai
.
getSingleNssais
())
{
if
(
s
.
sst
==
n
.
getSst
())
{
if
((
s
.
sst
<=
SST_MAX_STANDARDIZED_VALUE
)
or
(
n
.
sdIsSet
()
and
(
n
.
getSd
().
compare
(
sd
)
==
0
))
or
(
!
n
.
sdIsSet
()
and
sd
.
empty
()))
{
uint32_t
sd
=
SD_NO_VALUE
;
if
(
!
n
.
getSd
().
empty
())
{
conv
::
sd_string_to_int
(
n
.
getSd
(),
sd
);
}
if
(
sd
==
s
.
sd
)
{
common_snssais
.
push_back
(
n
);
Logger
::
amf_n1
().
debug
(
"Common S-NSSAI (SST %d, SD %
s)"
,
s
.
sst
,
sd
.
c_str
()
);
"Common S-NSSAI (SST %d, SD %
ld)"
,
s
.
sst
,
sd
);
break
;
}
/*
if ((s.sst <= SST_MAX_STANDARDIZED_VALUE) or
(n.sdIsSet() and (n.getSd().compare(sd) == 0)) or
(!n.sdIsSet() and sd.empty())) {
common_snssais.push_back(n);
Logger::amf_n1().debug(
"Common S-NSSAI (SST %d, SD %s)", s.sst, sd.c_str());
break;
}
*/
}
}
}
...
...
@@ -4226,8 +4250,19 @@ bool amf_n1::check_subscribed_nssai(
for
(
auto
n
:
nssai
.
getDefaultSingleNssais
())
{
bool
found_nssai
=
false
;
for
(
auto
s
:
p
.
slice_list
)
{
std
::
string
sd
=
std
::
to_string
(
s
.
sd
);
//
std::string sd = std::to_string(s.sd);
if
(
s
.
sst
==
n
.
getSst
())
{
uint32_t
sd
=
SD_NO_VALUE
;
if
(
!
n
.
getSd
().
empty
())
{
conv
::
sd_string_to_int
(
n
.
getSd
(),
sd
);
}
if
(
sd
==
s
.
sd
)
{
found_nssai
=
true
;
Logger
::
amf_n1
().
debug
(
"Found S-NSSAI (SST %d, SD %s)"
,
s
.
sst
,
n
.
getSd
().
c_str
());
break
;
}
/*
if ((s.sst <= SST_MAX_STANDARDIZED_VALUE) or
(n.sdIsSet() and (n.getSd().compare(sd) == 0)) or
(!n.sdIsSet() and sd.empty())) {
...
...
@@ -4236,6 +4271,7 @@ bool amf_n1::check_subscribed_nssai(
"Found S-NSSAI (SST %d, SD %s)", s.sst, n.getSd().c_str());
break;
}
*/
}
}
...
...
@@ -4249,16 +4285,28 @@ bool amf_n1::check_subscribed_nssai(
for
(
auto
n
:
common_snssais
)
{
bool
found_nssai
=
false
;
for
(
auto
s
:
p
.
slice_list
)
{
std
::
string
sd
=
std
::
to_string
(
s
.
sd
);
//
std::string sd = std::to_string(s.sd);
if
(
s
.
sst
==
n
.
getSst
())
{
if
((
s
.
sst
<=
SST_MAX_STANDARDIZED_VALUE
)
or
(
n
.
sdIsSet
()
and
(
n
.
getSd
().
compare
(
sd
)
==
0
))
or
(
!
n
.
sdIsSet
()
and
sd
.
empty
()))
{
uint32_t
sd
=
SD_NO_VALUE
;
if
(
!
n
.
getSd
().
empty
())
{
conv
::
sd_string_to_int
(
n
.
getSd
(),
sd
);
}
if
(
sd
==
s
.
sd
)
{
found_nssai
=
true
;
Logger
::
amf_n1
().
debug
(
"Found S-NSSAI (SST %d, SD %s)"
,
s
.
sst
,
n
.
getSd
().
c_str
());
break
;
}
/*
if ((s.sst <= SST_MAX_STANDARDIZED_VALUE) or
(n.sdIsSet() and (n.getSd().compare(sd) == 0)) or
(!n.sdIsSet() and sd.empty())) {
found_nssai = true;
Logger::amf_n1().debug(
"Found S-NSSAI (SST %d, SD %s)", s.sst, n.getSd().c_str());
break;
}
*/
}
}
...
...
src/amf-app/amf_n11.cpp
View file @
ed5ea7f3
...
...
@@ -893,11 +893,24 @@ bool amf_n11::discover_smf(
for
(
auto
&
s
:
instance_json
[
"sNssais"
].
items
())
{
nlohmann
::
json
Snssai
=
s
.
value
();
int
sst
=
0
;
std
::
string
sd
=
{};
uint32_t
sd
=
SD_NO_VALUE
;
// Default value
if
(
Snssai
.
count
(
"sst"
)
>
0
)
sst
=
Snssai
[
"sst"
].
get
<
int
>
();
if
(
Snssai
.
count
(
"sd"
)
>
0
)
sd
=
Snssai
[
"sd"
].
get
<
string
>
();
if
(
Snssai
.
count
(
"sd"
)
>
0
)
{
conv
::
sd_string_to_int
(
Snssai
[
"sd"
].
get
<
string
>
(),
sd
);
}
if
(
sst
==
snssai
.
sST
)
{
// Match SD (optional) only if it is provided
uint32_t
input_sd
=
SD_NO_VALUE
;
// Default value
conv
::
sd_string_to_int
(
snssai
.
sD
,
input_sd
);
if
(
sd
==
input_sd
)
{
Logger
::
amf_n11
().
debug
(
"S-NSSAI [SST- %d, SD -%s] is matched for SMF profile"
,
snssai
.
sST
,
snssai
.
sD
.
c_str
());
result
=
true
;
break
;
// NSSAI is included in the list of supported slices
// from SMF
}
/*
// Match SD (optional) only if it is provided
if ((sst <= SST_MAX_STANDARDIZED_VALUE) or sd.empty() or
(snssai.sD.compare(sd) == 0)) {
Logger::amf_n11().debug(
...
...
@@ -907,6 +920,7 @@ bool amf_n11::discover_smf(
break; // NSSAI is included in the list of supported slices
// from SMF
}
*/
}
}
}
...
...
src/amf-app/amf_n2.cpp
View file @
ed5ea7f3
...
...
@@ -2326,15 +2326,28 @@ bool amf_n2::get_common_plmn(
"S-NSSAI from AMF (SST %d, SD %s)"
,
s2
.
sst
,
std
::
to_string
(
s2
.
sd
).
c_str
());
if
(
s1
.
sst
.
compare
(
std
::
to_string
(
s2
.
sst
))
==
0
)
{
if
((
s2
.
sst
<=
SST_MAX_STANDARDIZED_VALUE
)
or
(
s1
.
sd
.
compare
(
std
::
to_string
(
s2
.
sd
))
==
0
))
{
// don't need to check SD for standard NSSAI
uint32_t
s1_sd
=
SD_NO_VALUE
;
if
(
!
s1
.
sd
.
empty
())
{
conv
::
sd_string_to_int
(
s1
.
sd
,
s1_sd
);
}
if
(
s1_sd
==
s2
.
sd
)
{
Logger
::
amf_n2
().
debug
(
"Common S-NSSAI (SST %s, SD %s)"
,
s1
.
sst
.
c_str
(),
s1
.
sd
.
c_str
());
plmn_slice_support_item
.
slice_list
.
push_back
(
s1
);
found_common_plmn
=
true
;
}
/*
if ((s2.sst <= SST_MAX_STANDARDIZED_VALUE) or
(s1.sd.compare(std::to_string(s2.sd)) ==
0)) { // don't need to check SD for
standard NSSAI Logger::amf_n2().debug( "Common S-NSSAI (SST
%s, SD %s)", s1.sst.c_str(), s1.sd.c_str());
plmn_slice_support_item.slice_list.push_back(s1);
found_common_plmn = true;
}
*/
}
}
}
...
...
src/common/conversions.cpp
View file @
ed5ea7f3
...
...
@@ -26,6 +26,7 @@
*/
#include "conversions.hpp"
#include "amf.hpp"
#include "logger.hpp"
#include <arpa/inet.h>
...
...
@@ -268,7 +269,7 @@ void conv::bstring_2_octet_string(bstring& b_str, OCTET_STRING_t& octet_str) {
//------------------------------------------------------------------------------
void
conv
::
sd_string_to_int
(
const
std
::
string
&
sd_str
,
uint32_t
&
sd
)
{
sd
=
0xFFFFFF
;
sd
=
SD_NO_VALUE
;
if
(
sd_str
.
empty
())
return
;
uint8_t
base
=
10
;
try
{
...
...
@@ -282,6 +283,6 @@ void conv::sd_string_to_int(const std::string& sd_str, uint32_t& sd) {
Logger
::
amf_app
().
error
(
"Error when converting from string to int for S-NSSAI SD, error: %s"
,
e
.
what
());
sd
=
0xFFFFFF
;
sd
=
SD_NO_VALUE
;
}
}
src/ngap/ngapMsgs/InitialContextSetupRequest.cpp
View file @
ed5ea7f3
...
...
@@ -291,7 +291,7 @@ void InitialContextSetupRequestMsg::setAllowedNssai(
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++
)
{
S_NSSAI
snssai
=
{};
snssai
.
setSst
(
list
[
i
].
sst
);
uint32_t
sd
=
0xFFFFFF
;
uint32_t
sd
=
SD_NO_VALUE
;
if
(
!
list
[
i
].
sd
.
empty
())
{
conv
::
sd_string_to_int
(
list
[
i
].
sd
,
sd
);
}
...
...
src/ngap/ngapMsgs/NGSetupResponse.cpp
View file @
ed5ea7f3
...
...
@@ -140,7 +140,7 @@ void NGSetupResponseMsg::setPlmnSupportList(
S_NSSAI
snssai
=
{};
snssai
.
setSst
(
list
[
i
].
slice_list
[
j
].
sst
);
uint32_t
sd
=
0xFFFFFF
;
uint32_t
sd
=
SD_NO_VALUE
;
if
(
!
list
[
i
].
slice_list
[
j
].
sd
.
empty
())
{
conv
::
sd_string_to_int
(
list
[
i
].
slice_list
[
j
].
sd
,
sd
);
}
...
...
src/ngap/ngapMsgs/RerouteNASRequest.cpp
View file @
ed5ea7f3
...
...
@@ -113,7 +113,7 @@ void RerouteNASRequest::setAllowedNssai(const std::vector<S_Nssai>& list) {
S_NSSAI
snssai
=
{};
snssai
.
setSst
(
list
[
i
].
sst
);
uint32_t
sd
=
0xFFFFFF
;
uint32_t
sd
=
SD_NO_VALUE
;
if
(
!
list
[
i
].
sd
.
empty
())
{
conv
::
sd_string_to_int
(
list
[
i
].
sd
,
sd
);
}
...
...
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