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
559db73e
Commit
559db73e
authored
Dec 07, 2022
by
Tien Thinh NGUYEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add function to covert structure to json for logging purpose
parent
c2397656
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
113 additions
and
8 deletions
+113
-8
src/common/3gpp_24.501.h
src/common/3gpp_24.501.h
+8
-1
src/common/3gpp_29.503.h
src/common/3gpp_29.503.h
+65
-1
src/common/3gpp_29.571.h
src/common/3gpp_29.571.h
+30
-0
src/smf_app/smf_config.cpp
src/smf_app/smf_config.cpp
+1
-1
src/smf_app/smf_context.cpp
src/smf_app/smf_context.cpp
+5
-3
src/smf_app/smf_n1.cpp
src/smf_app/smf_n1.cpp
+1
-1
src/smf_app/smf_n7.hpp
src/smf_app/smf_n7.hpp
+1
-1
src/smf_app/smf_sbi.cpp
src/smf_app/smf_sbi.cpp
+2
-0
No files found.
src/common/3gpp_24.501.h
View file @
559db73e
...
@@ -32,6 +32,7 @@
...
@@ -32,6 +32,7 @@
#include <netinet/in.h>
#include <netinet/in.h>
#ifdef __cplusplus
#ifdef __cplusplus
#include <nlohmann/json.hpp>
extern
"C"
{
extern
"C"
{
#endif
#endif
...
@@ -338,10 +339,16 @@ typedef struct pdu_session_type_s {
...
@@ -338,10 +339,16 @@ typedef struct pdu_session_type_s {
return
(
p
==
pdu_session_type
);
return
(
p
==
pdu_session_type
);
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
const
std
::
string
&
to
S
tring
()
const
{
const
std
::
string
&
to
_s
tring
()
const
{
return
pdu_session_type_e2str
.
at
(
pdu_session_type
);
return
pdu_session_type_e2str
.
at
(
pdu_session_type
);
}
}
nlohmann
::
json
to_json
()
const
{
nlohmann
::
json
json_data
=
{};
json_data
=
to_string
();
return
json_data
;
}
}
pdu_session_type_t
;
}
pdu_session_type_t
;
//-------------------------------------
//-------------------------------------
...
...
src/common/3gpp_29.503.h
View file @
559db73e
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
#include "smf.h"
#include "smf.h"
#include "3gpp_29.571.h"
#include "3gpp_29.571.h"
#include <nlohmann/json.hpp>
enum
ssc_mode_e
{
enum
ssc_mode_e
{
SSC_MODE_1
=
1
,
SSC_MODE_1
=
1
,
...
@@ -31,7 +32,7 @@ enum ssc_mode_e {
...
@@ -31,7 +32,7 @@ enum ssc_mode_e {
SSC_MODE_3
=
3
,
SSC_MODE_3
=
3
,
};
};
static
const
std
::
vector
<
std
::
string
>
ssc_mode_e2str
=
{
static
const
std
::
vector
<
std
::
string
>
ssc_mode_e2str
=
{
"
Error
"
,
"SSC_MODE_1"
,
"SSC_MODE_2"
,
"SSC_MODE_3"
};
"
SSC_MODE_ERROR
"
,
"SSC_MODE_1"
,
"SSC_MODE_2"
,
"SSC_MODE_3"
};
typedef
struct
ssc_mode_s
{
typedef
struct
ssc_mode_s
{
uint8_t
ssc_mode
;
uint8_t
ssc_mode
;
...
@@ -58,16 +59,48 @@ typedef struct ssc_mode_s {
...
@@ -58,16 +59,48 @@ typedef struct ssc_mode_s {
virtual
~
ssc_mode_s
(){};
virtual
~
ssc_mode_s
(){};
const
std
::
string
&
to_string
()
const
{
return
ssc_mode_e2str
.
at
(
ssc_mode
);
}
nlohmann
::
json
to_json
()
const
{
nlohmann
::
json
json_data
=
to_string
();
return
json_data
;
}
}
ssc_mode_t
;
}
ssc_mode_t
;
typedef
struct
pdu_session_types_s
{
typedef
struct
pdu_session_types_s
{
pdu_session_type_t
default_session_type
;
pdu_session_type_t
default_session_type
;
std
::
vector
<
pdu_session_type_t
>
allowed_session_types
;
std
::
vector
<
pdu_session_type_t
>
allowed_session_types
;
nlohmann
::
json
to_json
()
const
{
nlohmann
::
json
json_data
=
{};
json_data
[
"pdu_session_types"
]
=
default_session_type
.
to_string
();
if
(
allowed_session_types
.
size
()
>
0
)
{
json_data
[
"allowed_session_types"
]
=
nlohmann
::
json
::
array
();
}
for
(
const
auto
&
a
:
allowed_session_types
)
{
nlohmann
::
json
json_item
=
a
.
to_string
();
json_data
[
"allowed_session_types"
].
push_back
(
json_item
);
}
return
json_data
;
}
}
pdu_session_types_t
;
}
pdu_session_types_t
;
typedef
struct
ssc_modes_s
{
typedef
struct
ssc_modes_s
{
ssc_mode_t
default_ssc_mode
;
ssc_mode_t
default_ssc_mode
;
std
::
vector
<
ssc_mode_t
>
allowed_ssc_modes
;
std
::
vector
<
ssc_mode_t
>
allowed_ssc_modes
;
nlohmann
::
json
to_json
()
const
{
nlohmann
::
json
json_data
=
{};
json_data
[
"default_ssc_mode"
]
=
default_ssc_mode
.
to_string
();
if
(
allowed_ssc_modes
.
size
()
>
0
)
{
json_data
[
"allowed_ssc_modes"
]
=
nlohmann
::
json
::
array
();
}
for
(
const
auto
&
a
:
allowed_ssc_modes
)
{
nlohmann
::
json
json_item
=
a
.
to_string
();
json_data
[
"allowed_ssc_modes"
].
push_back
(
json_item
);
}
return
json_data
;
}
}
ssc_modes_t
;
}
ssc_modes_t
;
enum
ip_address_type_value_e
{
enum
ip_address_type_value_e
{
...
@@ -76,6 +109,10 @@ enum ip_address_type_value_e {
...
@@ -76,6 +109,10 @@ enum ip_address_type_value_e {
IP_ADDRESS_TYPE_IPV6_PREFIX
=
2
IP_ADDRESS_TYPE_IPV6_PREFIX
=
2
};
};
static
const
std
::
vector
<
std
::
string
>
ip_address_type_value_e2str
=
{
"IP_ADDRESS_TYPE_IPV4_ADDRESS"
,
"IP_ADDRESS_TYPE_IPV6_ADDRESS"
,
"IP_ADDRESS_TYPE_IPV6_PREFIX"
};
typedef
struct
ipv6_prefix_s
{
typedef
struct
ipv6_prefix_s
{
struct
in6_addr
prefix
;
struct
in6_addr
prefix
;
uint8_t
prefix_len
;
uint8_t
prefix_len
;
...
@@ -189,6 +226,15 @@ typedef struct ip_address_s {
...
@@ -189,6 +226,15 @@ typedef struct ip_address_s {
}
}
return
std
::
string
(
"Unknown IP Address Type"
);
return
std
::
string
(
"Unknown IP Address Type"
);
}
}
nlohmann
::
json
to_json
()
const
{
nlohmann
::
json
json_data
=
{};
json_data
[
"ip_address_type"
]
=
ip_address_type_value_e2str
.
at
(
ip_address_type
);
json_data
[
"addr"
]
=
to_string
();
return
json_data
;
}
}
ip_address_t
;
}
ip_address_t
;
typedef
struct
dnn_configuration_s
{
typedef
struct
dnn_configuration_s
{
...
@@ -197,6 +243,24 @@ typedef struct dnn_configuration_s {
...
@@ -197,6 +243,24 @@ typedef struct dnn_configuration_s {
session_ambr_t
session_ambr
;
session_ambr_t
session_ambr
;
subscribed_default_qos_t
_5g_qos_profile
;
subscribed_default_qos_t
_5g_qos_profile
;
std
::
vector
<
ip_address_t
>
static_ip_addresses
;
std
::
vector
<
ip_address_t
>
static_ip_addresses
;
nlohmann
::
json
to_json
()
const
{
nlohmann
::
json
json_data
=
{};
json_data
[
"pdu_session_types"
]
=
pdu_session_types
.
to_json
();
json_data
[
"ssc_modes"
]
=
ssc_modes
.
to_json
();
json_data
[
"session_ambr"
]
=
session_ambr
.
to_json
();
json_data
[
"_5g_qos_profile"
]
=
_5g_qos_profile
.
to_json
();
if
(
static_ip_addresses
.
size
()
>
0
)
{
json_data
[
"static_ip_addresses"
]
=
nlohmann
::
json
::
array
();
}
for
(
const
auto
&
a
:
static_ip_addresses
)
{
nlohmann
::
json
json_item
=
a
.
to_string
();
json_data
[
"static_ip_addresses"
].
push_back
(
json_item
);
}
return
json_data
;
}
}
dnn_configuration_t
;
}
dnn_configuration_t
;
#endif
#endif
src/common/3gpp_29.571.h
View file @
559db73e
...
@@ -25,6 +25,13 @@
...
@@ -25,6 +25,13 @@
typedef
struct
session_ambr_s
{
typedef
struct
session_ambr_s
{
std
::
string
uplink
;
std
::
string
uplink
;
std
::
string
downlink
;
std
::
string
downlink
;
nlohmann
::
json
to_json
()
const
{
nlohmann
::
json
json_data
=
{};
json_data
[
"uplink"
]
=
uplink
;
json_data
[
"downlink"
]
=
downlink
;
return
json_data
;
}
}
session_ambr_t
;
}
session_ambr_t
;
enum
preemtion_capability_e
{
NOT_PREEMPT
=
1
,
MAY_PREEMPT
=
2
};
enum
preemtion_capability_e
{
NOT_PREEMPT
=
1
,
MAY_PREEMPT
=
2
};
...
@@ -37,6 +44,14 @@ typedef struct arp_5gc_s {
...
@@ -37,6 +44,14 @@ typedef struct arp_5gc_s {
uint8_t
priority_level
;
// (integer 1-15)
uint8_t
priority_level
;
// (integer 1-15)
std
::
string
preempt_cap
;
std
::
string
preempt_cap
;
std
::
string
preempt_vuln
;
// NOT_PREEMPTABLE, PREEMPTABLE
std
::
string
preempt_vuln
;
// NOT_PREEMPTABLE, PREEMPTABLE
nlohmann
::
json
to_json
()
const
{
nlohmann
::
json
json_data
=
{};
json_data
[
"priority_level"
]
=
priority_level
;
json_data
[
"preempt_cap"
]
=
preempt_cap
;
json_data
[
"preempt_vuln"
]
=
preempt_vuln
;
return
json_data
;
}
}
arp_5gc_t
;
}
arp_5gc_t
;
// see section 5.4.4.1@TS 29.571
// see section 5.4.4.1@TS 29.571
...
@@ -44,6 +59,14 @@ typedef struct subscribed_default_qos_s {
...
@@ -44,6 +59,14 @@ typedef struct subscribed_default_qos_s {
uint8_t
_5qi
;
uint8_t
_5qi
;
arp_5gc_t
arp
;
arp_5gc_t
arp
;
uint8_t
priority_level
;
// 1-127
uint8_t
priority_level
;
// 1-127
nlohmann
::
json
to_json
()
const
{
nlohmann
::
json
json_data
=
{};
json_data
[
"_5qi"
]
=
_5qi
;
json_data
[
"arp"
]
=
arp
.
to_json
();
json_data
[
"priority_level"
]
=
priority_level
;
return
json_data
;
}
}
subscribed_default_qos_t
;
}
subscribed_default_qos_t
;
enum
reflective_qos_attribute_e
{
RQOS
=
1
,
NO_RQOS
=
2
};
enum
reflective_qos_attribute_e
{
RQOS
=
1
,
NO_RQOS
=
2
};
...
@@ -54,6 +77,12 @@ static const std::vector<std::string> reflective_qos_attribute_e2str = {
...
@@ -54,6 +77,12 @@ static const std::vector<std::string> reflective_qos_attribute_e2str = {
typedef
struct
gNB_id_s
{
typedef
struct
gNB_id_s
{
uint8_t
bit_length
;
uint8_t
bit_length
;
std
::
string
gNB_value
;
std
::
string
gNB_value
;
nlohmann
::
json
to_json
()
const
{
nlohmann
::
json
json_data
=
{};
json_data
[
"bit_length"
]
=
bit_length
;
json_data
[
"gNB_value"
]
=
gNB_value
;
return
json_data
;
}
}
gNB_id_t
;
// 22bits to 32bits
}
gNB_id_t
;
// 22bits to 32bits
typedef
struct
global_ran_node_id_s
{
typedef
struct
global_ran_node_id_s
{
...
@@ -61,6 +90,7 @@ typedef struct global_ran_node_id_s {
...
@@ -61,6 +90,7 @@ typedef struct global_ran_node_id_s {
// n3IwfId:
// n3IwfId:
gNB_id_t
gNbId
;
gNB_id_t
gNbId
;
// ngeNbId:
// ngeNbId:
}
global_ran_node_id_t
;
}
global_ran_node_id_t
;
#endif
#endif
src/smf_app/smf_config.cpp
View file @
559db73e
...
@@ -1083,7 +1083,7 @@ void smf_config::display() {
...
@@ -1083,7 +1083,7 @@ void smf_config::display() {
it
++
)
{
it
++
)
{
Logger
::
smf_app
().
info
(
Logger
::
smf_app
().
info
(
" DNN..........: %s (%s)"
,
it
->
second
.
dnn
.
c_str
(),
" DNN..........: %s (%s)"
,
it
->
second
.
dnn
.
c_str
(),
it
->
second
.
pdu_session_type
.
to
S
tring
().
c_str
());
it
->
second
.
pdu_session_type
.
to
_s
tring
().
c_str
());
if
((
it
->
second
.
pdu_session_type
.
pdu_session_type
==
if
((
it
->
second
.
pdu_session_type
.
pdu_session_type
==
pdu_session_type_e
::
PDU_SESSION_TYPE_E_IPV4
)
or
pdu_session_type_e
::
PDU_SESSION_TYPE_E_IPV4
)
or
...
...
src/smf_app/smf_context.cpp
View file @
559db73e
...
@@ -379,7 +379,7 @@ std::string smf_pdu_session::toString() const {
...
@@ -379,7 +379,7 @@ std::string smf_pdu_session::toString() const {
s
.
append
(
"
\t
DNN:
\t\t\t
"
).
append
(
dnn
).
append
(
"
\n
"
);
s
.
append
(
"
\t
DNN:
\t\t\t
"
).
append
(
dnn
).
append
(
"
\n
"
);
s
.
append
(
"
\t
SNSSAI:
\t\t\t
"
).
append
(
snssai
.
toString
()).
append
(
"
\n
"
);
s
.
append
(
"
\t
SNSSAI:
\t\t\t
"
).
append
(
snssai
.
toString
()).
append
(
"
\n
"
);
s
.
append
(
"
\t
PDN type:
\t\t
"
)
s
.
append
(
"
\t
PDN type:
\t\t
"
)
.
append
(
pdu_session_type
.
to
S
tring
())
.
append
(
pdu_session_type
.
to
_s
tring
())
.
append
(
"
\n
"
);
.
append
(
"
\n
"
);
}
}
if
(
ipv4
)
if
(
ipv4
)
...
@@ -3127,6 +3127,8 @@ bool smf_context::handle_pdu_session_update_sm_context_request(
...
@@ -3127,6 +3127,8 @@ bool smf_context::handle_pdu_session_update_sm_context_request(
sm_context_rel_req_msg
.
get_snssai
());
sm_context_rel_req_msg
.
get_snssai
());
sm_context_rel_resp_pending
->
res
.
set_dnn
(
sm_context_rel_resp_pending
->
res
.
set_dnn
(
sm_context_rel_req_msg
.
get_dnn
());
sm_context_rel_req_msg
.
get_dnn
());
sm_context_rel_resp_pending
->
res
.
set_pti
(
sm_context_rel_req_msg
.
get_pti
());
auto
proc
=
std
::
make_shared
<
session_release_sm_context_procedure
>
(
sp
);
auto
proc
=
std
::
make_shared
<
session_release_sm_context_procedure
>
(
sp
);
std
::
shared_ptr
<
smf_procedure
>
sproc
=
proc
;
std
::
shared_ptr
<
smf_procedure
>
sproc
=
proc
;
...
@@ -4425,7 +4427,7 @@ void smf_context::handle_flexcn_event(
...
@@ -4425,7 +4427,7 @@ void smf_context::handle_flexcn_event(
}
}
}
}
cj
[
"pdu_session_type"
]
=
cj
[
"pdu_session_type"
]
=
sp
->
pdu_session_type
.
to
S
tring
();
// PDU Session Type
sp
->
pdu_session_type
.
to
_s
tring
();
// PDU Session Type
// NSSAI
// NSSAI
cj
[
"snssai"
][
"sst"
]
=
sp
->
get_snssai
().
sst
;
cj
[
"snssai"
][
"sst"
]
=
sp
->
get_snssai
().
sst
;
cj
[
"snssai"
][
"sd"
]
=
std
::
to_string
(
sp
->
get_snssai
().
sd
);
cj
[
"snssai"
][
"sd"
]
=
std
::
to_string
(
sp
->
get_snssai
().
sd
);
...
@@ -4552,7 +4554,7 @@ void smf_context::handle_pdusesest(
...
@@ -4552,7 +4554,7 @@ void smf_context::handle_pdusesest(
}
}
}
}
ev_notif
.
set_pdu_session_type
(
ev_notif
.
set_pdu_session_type
(
sp
->
pdu_session_type
.
to
S
tring
());
// PDU Session Type
sp
->
pdu_session_type
.
to
_s
tring
());
// PDU Session Type
ev_notif
.
set_sst
(
sp
->
get_snssai
().
sst
);
ev_notif
.
set_sst
(
sp
->
get_snssai
().
sst
);
ev_notif
.
set_sd
(
std
::
to_string
(
sp
->
get_snssai
().
sd
));
ev_notif
.
set_sd
(
std
::
to_string
(
sp
->
get_snssai
().
sd
));
ev_notif
.
set_dnn
(
sp
->
get_dnn
());
ev_notif
.
set_dnn
(
sp
->
get_dnn
());
...
...
src/smf_app/smf_n1.cpp
View file @
559db73e
...
@@ -166,7 +166,7 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(
...
@@ -166,7 +166,7 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(
// PDUAddress
// PDUAddress
paa_t
paa
=
sm_context_res
.
get_paa
();
paa_t
paa
=
sm_context_res
.
get_paa
();
Logger
::
smf_n1
().
debug
(
Logger
::
smf_n1
().
debug
(
"PDU Session Type %s"
,
paa
.
pdu_session_type
.
to
S
tring
().
c_str
());
"PDU Session Type %s"
,
paa
.
pdu_session_type
.
to
_s
tring
().
c_str
());
sm_msg
->
pdu_session_establishment_accept
.
pduaddress
.
pdu_session_type_value
=
sm_msg
->
pdu_session_establishment_accept
.
pduaddress
.
pdu_session_type_value
=
static_cast
<
uint8_t
>
(
paa
.
pdu_session_type
.
pdu_session_type
);
static_cast
<
uint8_t
>
(
paa
.
pdu_session_type
.
pdu_session_type
);
if
(
paa
.
pdu_session_type
.
pdu_session_type
==
PDU_SESSION_TYPE_E_IPV4
)
{
if
(
paa
.
pdu_session_type
.
pdu_session_type
==
PDU_SESSION_TYPE_E_IPV4
)
{
...
...
src/smf_app/smf_n7.hpp
View file @
559db73e
...
@@ -94,7 +94,7 @@ struct policy_association {
...
@@ -94,7 +94,7 @@ struct policy_association {
context
.
setSupi
(
"imsi-"
+
supi
);
context
.
setSupi
(
"imsi-"
+
supi
);
oai
::
smf_server
::
model
::
PduSessionType
pdu_session_type_model
;
oai
::
smf_server
::
model
::
PduSessionType
pdu_session_type_model
;
// hacky
// hacky
from_json
(
pdu_session_type
.
to
S
tring
(),
pdu_session_type_model
);
from_json
(
pdu_session_type
.
to
_s
tring
(),
pdu_session_type_model
);
context
.
setPduSessionType
(
pdu_session_type_model
);
context
.
setPduSessionType
(
pdu_session_type_model
);
context
.
setDnn
(
dnn
);
context
.
setDnn
(
dnn
);
context
.
setSliceInfo
(
snssai_model
);
context
.
setSliceInfo
(
snssai_model
);
...
...
src/smf_app/smf_sbi.cpp
View file @
559db73e
...
@@ -937,6 +937,8 @@ bool smf_sbi::get_sm_data(
...
@@ -937,6 +937,8 @@ bool smf_sbi::get_sm_data(
// Verify DNN configurations
// Verify DNN configurations
if
(
jsonData
.
find
(
"dnnConfigurations"
)
==
jsonData
.
end
())
return
false
;
if
(
jsonData
.
find
(
"dnnConfigurations"
)
==
jsonData
.
end
())
return
false
;
Logger
::
smf_sbi
().
debug
(
"DNN Configurations %s"
,
jsonData
[
"dnnConfigurations"
].
dump
().
c_str
());
// Retrieve SessionManagementSubscription and store in the context
// Retrieve SessionManagementSubscription and store in the context
for
(
nlohmann
::
json
::
iterator
it
=
jsonData
[
"dnnConfigurations"
].
begin
();
for
(
nlohmann
::
json
::
iterator
it
=
jsonData
[
"dnnConfigurations"
].
begin
();
...
...
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