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
68ccbac0
Commit
68ccbac0
authored
Apr 09, 2020
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
correct indentation for Smf_app/config
parent
c47c7d80
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
43 deletions
+32
-43
src/smf_app/smf_app.cpp
src/smf_app/smf_app.cpp
+14
-15
src/smf_app/smf_config.cpp
src/smf_app/smf_config.cpp
+18
-28
No files found.
src/smf_app/smf_app.cpp
View file @
68ccbac0
...
...
@@ -495,13 +495,13 @@ void smf_app::handle_pdu_session_create_sm_context_request(std::shared_ptr<itti_
Logger
::
smf_app
().
info
(
"Handle a PDU Session Create SM Context Request message from AMF, supi "
SUPI_64_FMT
", dnn %s, snssai_sst %d"
,
supi64
,
dnn
.
c_str
(),
snssai
.
sST
);
//If no DNN information from UE, set to default value
if
(
dnn
.
length
()
==
0
){
if
(
dnn
.
length
()
==
0
)
{
dnn
==
smf_cfg
.
get_default_dnn
();
}
//Step 2. Verify Procedure transaction id, pdu session id, message type, request type, etc.
//check pti
if
((
pti
.
procedure_transaction_id
==
PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED
)
||
(
pti
.
procedure_transaction_id
>
PROCEDURE_TRANSACTION_IDENTITY_LAST
)){
if
((
pti
.
procedure_transaction_id
==
PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED
)
||
(
pti
.
procedure_transaction_id
>
PROCEDURE_TRANSACTION_IDENTITY_LAST
))
{
Logger
::
smf_app
().
warn
(
" Invalid PTI value (pti = %d)"
,
pti
.
procedure_transaction_id
);
problem_details
.
setCause
(
pdu_session_application_error_e2str
[
PDU_SESSION_APPLICATION_ERROR_N1_SM_ERROR
]);
smContextCreateError
.
setError
(
problem_details
);
...
...
@@ -515,7 +515,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(std::shared_ptr<itti_
}
//check pdu session id
if
((
pdu_session_id
==
PDU_SESSION_IDENTITY_UNASSIGNED
)
||
(
pdu_session_id
>
PDU_SESSION_IDENTITY_LAST
)){
if
((
pdu_session_id
==
PDU_SESSION_IDENTITY_UNASSIGNED
)
||
(
pdu_session_id
>
PDU_SESSION_IDENTITY_LAST
))
{
Logger
::
smf_app
().
warn
(
" Invalid PDU Session ID value (psi = %d)"
,
pdu_session_id
);
//section 7.3.2@3GPP TS 24.501; NAS N1 SM message: ignore the message
return
;
...
...
@@ -535,7 +535,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(std::shared_ptr<itti_
}
//check request type
if
(
request_type
.
compare
(
"INITIAL_REQUEST"
)
!=
0
){
if
(
request_type
.
compare
(
"INITIAL_REQUEST"
)
!=
0
)
{
Logger
::
smf_app
().
warn
(
"Invalid request type (request type = %s)"
,
"INITIAL_REQUEST"
);
//TODO:
//return
...
...
@@ -576,7 +576,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(std::shared_ptr<itti_
std
::
shared_ptr
<
dnn_context
>
sd
=
{};
if
(
!
sc
.
get
()
->
find_dnn_context
(
snssai
,
dnn
,
sd
))
{
if
(
nullptr
==
sd
.
get
()){
if
(
nullptr
==
sd
.
get
())
{
//create a new one and insert to the list
Logger
::
smf_app
().
debug
(
"Create a DNN context and add to the SMF context"
);
sd
=
std
::
shared_ptr
<
dnn_context
>
(
new
dnn_context
(
dnn
));
...
...
@@ -590,8 +590,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(std::shared_ptr<itti_
//Step 6. retrieve Session Management Subscription data from UDM if not available (step 4, section 4.3.2 3GPP TS 23.502)
//TODO: Test with UDM (TESTER)
std
::
string
dnn_selection_mode
=
smreq
->
req
.
get_dnn_selection_mode
();
if
(
not
use_local_configuration_subscription_data
(
dnn_selection_mode
)
&&
not
is_supi_dnn_snssai_subscription_data
(
supi
,
dnn
,
snssai
))
{
if
(
not
use_local_configuration_subscription_data
(
dnn_selection_mode
)
&&
not
is_supi_dnn_snssai_subscription_data
(
supi
,
dnn
,
snssai
))
{
//uses a dummy UDM to test this part
Logger
::
smf_app
().
debug
(
"Retrieve Session Management Subscription data from an UDM"
);
session_management_subscription
*
s
=
new
session_management_subscription
(
snssai
);
...
...
@@ -838,22 +837,22 @@ bool smf_app::is_create_sm_context_request_valid()
}
//---------------------------------------------------------------------------------------------
void
smf_app
::
convert_string_2_hex
(
std
::
string
&
input_str
,
std
::
string
&
output_str
)
{
void
smf_app
::
convert_string_2_hex
(
std
::
string
&
input_str
,
std
::
string
&
output_str
)
{
Logger
::
smf_app
().
debug
(
"Convert string to Hex"
);
unsigned
char
*
data
=
(
unsigned
char
*
)
malloc
(
input_str
.
length
()
+
1
);
memset
(
data
,
0
,
input_str
.
length
()
+
1
);
memcpy
((
void
*
)
data
,
(
void
*
)
input_str
.
c_str
(),
input_str
.
length
());
Logger
::
smf_app
().
debug
(
"Input: "
);
for
(
int
i
=
0
;
i
<
input_str
.
length
();
i
++
)
{
for
(
int
i
=
0
;
i
<
input_str
.
length
();
i
++
)
{
printf
(
"%02x "
,
data
[
i
]);
}
printf
(
"
\n
"
);
char
*
datahex
=
(
char
*
)
malloc
(
input_str
.
length
()
*
2
+
1
);
memset
(
datahex
,
0
,
input_str
.
length
()
*
2
+
1
);
for
(
int
i
=
0
;
i
<
input_str
.
length
();
i
++
)
for
(
int
i
=
0
;
i
<
input_str
.
length
();
i
++
)
sprintf
(
datahex
+
i
*
2
,
"%02x"
,
data
[
i
]);
output_str
=
reinterpret_cast
<
char
*>
(
datahex
);
...
...
@@ -861,8 +860,8 @@ void smf_app::convert_string_2_hex(std::string& input_str, std::string& output_s
}
//---------------------------------------------------------------------------------------------
unsigned
char
*
smf_app
::
format_string_as_hex
(
std
::
string
str
)
{
unsigned
char
*
smf_app
::
format_string_as_hex
(
std
::
string
str
)
{
unsigned
int
str_len
=
str
.
length
();
char
*
data
=
(
char
*
)
malloc
(
str_len
+
1
);
memset
(
data
,
0
,
str_len
+
1
);
...
...
@@ -874,7 +873,7 @@ unsigned char * smf_app::format_string_as_hex(std::string str){
Logger
::
smf_app
().
debug
(
"[Format string as Hex] Input string (%d bytes): %s "
,
str_len
,
str
.
c_str
());
Logger
::
smf_app
().
debug
(
"Data (formatted):"
);
for
(
int
i
=
0
;
i
<
str_len
/
2
;
i
++
)
for
(
int
i
=
0
;
i
<
str_len
/
2
;
i
++
)
printf
(
" %02x "
,
data_hex
[
i
]);
printf
(
"
\n
"
);
...
...
@@ -933,7 +932,7 @@ void smf_app::update_pdu_session_status(const scid_t scid, const pdu_session_sta
//---------------------------------------------------------------------------------------------
void
smf_app
::
timer_t3591_timeout
(
timer_id_t
timer_id
,
uint64_t
arg2_user
)
{
//send session modification request again...
//
TODO:
send session modification request again...
}
//---------------------------------------------------------------------------------------------
...
...
src/smf_app/smf_config.cpp
View file @
68ccbac0
...
...
@@ -90,7 +90,7 @@ int smf_config::load_thread_sched_params(const Setting& thread_sched_params_cfg,
try
{
thread_sched_params_cfg
.
lookupValue
(
SMF_CONFIG_STRING_THREAD_RD_CPU_ID
,
cfg
.
cpu_id
);
}
catch
(
const
SettingNotFoundException
&
nfex
)
{
}
catch
(
const
SettingNotFoundException
&
nfex
)
{
Logger
::
smf_app
().
info
(
"%s : %s, using defaults"
,
nfex
.
what
(),
nfex
.
getPath
());
}
try
{
...
...
@@ -111,7 +111,7 @@ int smf_config::load_thread_sched_params(const Setting& thread_sched_params_cfg,
Logger
::
smf_app
().
error
(
"thread_rd_sched_policy: %s, unknown in config file"
,
thread_rd_sched_policy
.
c_str
());
return
RETURNerror
;
}
}
catch
(
const
SettingNotFoundException
&
nfex
)
{
}
catch
(
const
SettingNotFoundException
&
nfex
)
{
Logger
::
smf_app
().
info
(
"%s : %s, using defaults"
,
nfex
.
what
(),
nfex
.
getPath
());
}
...
...
@@ -121,7 +121,7 @@ int smf_config::load_thread_sched_params(const Setting& thread_sched_params_cfg,
Logger
::
smf_app
().
error
(
"thread_rd_sched_priority: %d, must be in interval [1..99] in config file"
,
cfg
.
sched_priority
);
return
RETURNerror
;
}
}
catch
(
const
SettingNotFoundException
&
nfex
)
{
}
catch
(
const
SettingNotFoundException
&
nfex
)
{
Logger
::
smf_app
().
info
(
"%s : %s, using defaults"
,
nfex
.
what
(),
nfex
.
getPath
());
}
return
RETURNok
;
...
...
@@ -132,28 +132,28 @@ int smf_config::load_itti(const Setting& itti_cfg, itti_cfg_t& cfg)
try
{
const
Setting
&
itti_timer_sched_params_cfg
=
itti_cfg
[
SMF_CONFIG_STRING_ITTI_TIMER_SCHED_PARAMS
];
load_thread_sched_params
(
itti_timer_sched_params_cfg
,
cfg
.
itti_timer_sched_params
);
}
catch
(
const
SettingNotFoundException
&
nfex
)
{
}
catch
(
const
SettingNotFoundException
&
nfex
)
{
Logger
::
smf_app
().
info
(
"%s : %s, using defaults"
,
nfex
.
what
(),
nfex
.
getPath
());
}
try
{
const
Setting
&
n4_sched_params_cfg
=
itti_cfg
[
SMF_CONFIG_STRING_N4_SCHED_PARAMS
];
load_thread_sched_params
(
n4_sched_params_cfg
,
cfg
.
n4_sched_params
);
}
catch
(
const
SettingNotFoundException
&
nfex
)
{
}
catch
(
const
SettingNotFoundException
&
nfex
)
{
Logger
::
smf_app
().
info
(
"%s : %s, using defaults"
,
nfex
.
what
(),
nfex
.
getPath
());
}
try
{
const
Setting
&
smf_app_sched_params_cfg
=
itti_cfg
[
SMF_CONFIG_STRING_SMF_APP_SCHED_PARAMS
];
load_thread_sched_params
(
smf_app_sched_params_cfg
,
cfg
.
smf_app_sched_params
);
}
catch
(
const
SettingNotFoundException
&
nfex
)
{
}
catch
(
const
SettingNotFoundException
&
nfex
)
{
Logger
::
smf_app
().
info
(
"%s : %s, using defaults"
,
nfex
.
what
(),
nfex
.
getPath
());
}
try
{
const
Setting
&
async_cmd_sched_params_cfg
=
itti_cfg
[
SMF_CONFIG_STRING_ASYNC_CMD_SCHED_PARAMS
];
load_thread_sched_params
(
async_cmd_sched_params_cfg
,
cfg
.
async_cmd_sched_params
);
}
catch
(
const
SettingNotFoundException
&
nfex
)
{
}
catch
(
const
SettingNotFoundException
&
nfex
)
{
Logger
::
smf_app
().
info
(
"%s : %s, using defaults"
,
nfex
.
what
(),
nfex
.
getPath
());
}
...
...
@@ -195,7 +195,7 @@ int smf_config::load_interface(const Setting& if_cfg, interface_cfg_t & cfg)
try
{
const
Setting
&
sched_params_cfg
=
if_cfg
[
SMF_CONFIG_STRING_SCHED_PARAMS
];
load_thread_sched_params
(
sched_params_cfg
,
cfg
.
thread_rd_sched_params
);
}
catch
(
const
SettingNotFoundException
&
nfex
)
{
}
catch
(
const
SettingNotFoundException
&
nfex
)
{
Logger
::
smf_app
().
info
(
"%s : %s, using defaults"
,
nfex
.
what
(),
nfex
.
getPath
());
}
}
...
...
@@ -227,27 +227,21 @@ int smf_config::load(const string& config_file)
unsigned
char
buf_in6_addr
[
sizeof
(
struct
in6_addr
)];
// Read the file. If there is an error, report it and exit.
try
{
try
{
cfg
.
readFile
(
config_file
.
c_str
());
}
catch
(
const
FileIOException
&
fioex
)
{
}
catch
(
const
FileIOException
&
fioex
)
{
Logger
::
smf_app
().
error
(
"I/O error while reading file %s - %s"
,
config_file
.
c_str
(),
fioex
.
what
());
throw
;
}
catch
(
const
ParseException
&
pex
)
{
}
catch
(
const
ParseException
&
pex
)
{
Logger
::
smf_app
().
error
(
"Parse error at %s:%d - %s"
,
pex
.
getFile
(),
pex
.
getLine
(),
pex
.
getError
());
throw
;
}
const
Setting
&
root
=
cfg
.
getRoot
();
try
{
try
{
const
Setting
&
smf_cfg
=
root
[
SMF_CONFIG_STRING_SMF_CONFIG
];
}
catch
(
const
SettingNotFoundException
&
nfex
)
{
}
catch
(
const
SettingNotFoundException
&
nfex
)
{
Logger
::
smf_app
().
error
(
"%s : %s"
,
nfex
.
what
(),
nfex
.
getPath
());
return
RETURNerror
;
}
...
...
@@ -256,20 +250,20 @@ int smf_config::load(const string& config_file)
try
{
smf_cfg
.
lookupValue
(
SMF_CONFIG_STRING_INSTANCE
,
instance
);
}
catch
(
const
SettingNotFoundException
&
nfex
)
{
}
catch
(
const
SettingNotFoundException
&
nfex
)
{
Logger
::
smf_app
().
info
(
"%s : %s, using defaults"
,
nfex
.
what
(),
nfex
.
getPath
());
}
try
{
smf_cfg
.
lookupValue
(
SMF_CONFIG_STRING_PID_DIRECTORY
,
pid_dir
);
}
catch
(
const
SettingNotFoundException
&
nfex
)
{
}
catch
(
const
SettingNotFoundException
&
nfex
)
{
Logger
::
smf_app
().
info
(
"%s : %s, using defaults"
,
nfex
.
what
(),
nfex
.
getPath
());
}
try
{
const
Setting
&
itti_cfg
=
smf_cfg
[
SMF_CONFIG_STRING_ITTI_TASKS
];
load_itti
(
itti_cfg
,
itti
);
}
catch
(
const
SettingNotFoundException
&
nfex
)
{
}
catch
(
const
SettingNotFoundException
&
nfex
)
{
Logger
::
smf_app
().
info
(
"%s : %s, using defaults"
,
nfex
.
what
(),
nfex
.
getPath
());
}
...
...
@@ -282,7 +276,7 @@ int smf_config::load(const string& config_file)
const
Setting
&
n11_cfg
=
nw_if_cfg
[
SMF_CONFIG_STRING_INTERFACE_N11
];
load_interface
(
n11_cfg
,
n11
);
}
catch
(
const
SettingNotFoundException
&
nfex
)
{
}
catch
(
const
SettingNotFoundException
&
nfex
)
{
Logger
::
smf_app
().
error
(
"%s : %s"
,
nfex
.
what
(),
nfex
.
getPath
());
return
RETURNerror
;
}
...
...
@@ -415,7 +409,6 @@ int smf_config::load(const string& config_file)
smf_cfg
.
lookupValue
(
SMF_CONFIG_STRING_DEFAULT_DNS_SEC_IPV4_ADDRESS
,
astring
);
IPV4_STR_ADDR_TO_INADDR
(
util
::
trim
(
astring
).
c_str
(),
default_dns_secv4
,
"BAD IPv4 ADDRESS FORMAT FOR DEFAULT DNS !"
);
smf_cfg
.
lookupValue
(
SMF_CONFIG_STRING_DEFAULT_DNS_IPV6_ADDRESS
,
astring
);
if
(
inet_pton
(
AF_INET6
,
util
::
trim
(
astring
).
c_str
(),
buf_in6_addr
)
==
1
)
{
memcpy
(
&
default_dnsv6
,
buf_in6_addr
,
sizeof
(
struct
in6_addr
));
...
...
@@ -476,7 +469,6 @@ int smf_config::load(const string& config_file)
}
udm_addr
.
port
=
udm_port
;
//UPF list
unsigned
char
buf_in_addr
[
sizeof
(
struct
in_addr
)
+
1
];
const
Setting
&
upf_list_cfg
=
smf_cfg
[
SMF_CONFIG_STRING_UPF_LIST
];
...
...
@@ -500,9 +492,7 @@ int smf_config::load(const string& config_file)
throw
(
"Bad value in section %s : item no %d in config file %s"
,
SMF_CONFIG_STRING_UPF_LIST
,
i
,
config_file
.
c_str
());
}
}
}
catch
(
const
SettingNotFoundException
&
nfex
)
{
}
catch
(
const
SettingNotFoundException
&
nfex
)
{
Logger
::
smf_app
().
error
(
"%s : %s"
,
nfex
.
what
(),
nfex
.
getPath
());
return
RETURNerror
;
}
...
...
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