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-Simple
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
CommunityXG
OpenXG-SMF-Simple
Commits
36d4db36
Commit
36d4db36
authored
Sep 28, 2020
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use pfcp's f-teid instead of gtp2's f-teid
parent
4a0d36de
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
107 additions
and
100 deletions
+107
-100
src/common/3gpp_29.244.h
src/common/3gpp_29.244.h
+32
-0
src/common/smf.h
src/common/smf.h
+3
-0
src/smf_app/smf_context.cpp
src/smf_app/smf_context.cpp
+9
-11
src/smf_app/smf_context.hpp
src/smf_app/smf_context.hpp
+2
-2
src/smf_app/smf_msg.cpp
src/smf_app/smf_msg.cpp
+4
-4
src/smf_app/smf_msg.hpp
src/smf_app/smf_msg.hpp
+7
-7
src/smf_app/smf_n2.cpp
src/smf_app/smf_n2.cpp
+36
-40
src/smf_app/smf_procedure.cpp
src/smf_app/smf_procedure.cpp
+14
-36
No files found.
src/common/3gpp_29.244.h
View file @
36d4db36
...
...
@@ -451,6 +451,38 @@ struct fteid_s {
and
(
ipv6_address
.
s6_addr32
[
3
]
==
f
.
ipv6_address
.
s6_addr32
[
3
])
and
(
v4
==
f
.
v4
)
and
(
v6
==
f
.
v6
);
}
bool
operator
=
(
const
struct
fteid_s
&
f
)
{
v4
==
f
.
v4
;
v6
==
f
.
v6
;
chid
==
f
.
chid
;
ch
==
f
.
ch
;
choose_id
==
f
.
choose_id
;
teid
==
f
.
teid
;
ipv4_address
.
s_addr
=
f
.
ipv4_address
.
s_addr
;
ipv6_address
=
f
.
ipv6_address
;
//ipv6_address.s6_addr32[0] == f.ipv6_address.s6_addr32[0];
//ipv6_address.s6_addr32[1] == f.ipv6_address.s6_addr32[1];
//ipv6_address.s6_addr32[2] == f.ipv6_address.s6_addr32[2];
//ipv6_address.s6_addr32[3] == f.ipv6_address.s6_addr32[3];
}
std
::
string
toString
()
const
{
std
::
string
s
=
{
};
if
((
v4
)
||
(
v6
))
{
s
.
append
(
"TEID="
).
append
(
std
::
to_string
(
teid
));
if
(
v4
)
{
s
.
append
(
", IPv4="
).
append
(
conv
::
toString
(
ipv4_address
));
}
if
(
v6
)
{
s
.
append
(
", IPv6="
).
append
(
conv
::
toString
(
ipv6_address
));
}
}
else
{
s
.
append
(
"null_fteid"
);
}
return
s
;
}
bool
is_zero
()
const
{
return
((
!
v4
)
and
(
!
v6
));
}
...
...
src/common/smf.h
View file @
36d4db36
...
...
@@ -204,5 +204,8 @@ constexpr auto CURL_MIME_BOUNDARY = "----Boundary";
//for PFCP
constexpr
uint64_t
SECONDS_SINCE_FIRST_EPOCH
=
2208988800
;
//8.22 Fully Qualified TEID (F-TEID) - 3GPP TS 29.274 V16.0.0
#define TEID_GRE_KEY_LENGTH 4
#endif
src/smf_app/smf_context.cpp
View file @
36d4db36
...
...
@@ -2131,25 +2131,24 @@ void smf_context::handle_pdu_session_update_sm_context_request(
}
//store AN Tunnel Info + list of accepted QFIs
fteid_t
dl_teid
=
{
};
pfcp
::
fteid_t
dl_teid
=
{
};
memcpy
(
&
dl_teid
.
teid
_gre_key
,
&
dl_teid
.
teid
,
decoded_msg
->
dLQosFlowPerTNLInformation
.
uPTransportLayerInformation
.
choice
.
gTPTunnel
->
gTP_TEID
.
buf
,
sizeof
(
struct
in_addr
)
);
TEID_GRE_KEY_LENGTH
);
memcpy
(
&
dl_teid
.
ipv4_address
,
decoded_msg
->
dLQosFlowPerTNLInformation
.
uPTransportLayerInformation
.
choice
.
gTPTunnel
->
transportLayerAddress
.
buf
,
4
);
dl_teid
.
teid_gre_key
=
ntohl
(
dl_teid
.
teid_gre_key
);
dl_teid
.
interface_type
=
S1_U_ENODEB_GTP_U
;
dl_teid
.
teid
=
ntohl
(
dl_teid
.
teid
);
dl_teid
.
v4
=
1
;
//Only V4 for now
smreq
->
req
.
set_dl_fteid
(
dl_teid
);
Logger
::
smf_app
().
debug
(
"DL GTP F-TEID (AN F-TEID) "
"0x%"
PRIx32
" "
,
dl_teid
.
teid
_gre_key
);
dl_teid
.
teid
);
Logger
::
smf_app
().
debug
(
"uPTransportLayerInformation (AN IP Addr) %s"
,
conv
::
toString
(
dl_teid
.
ipv4_address
).
c_str
());
...
...
@@ -2252,20 +2251,19 @@ void smf_context::handle_pdu_session_update_sm_context_request(
//see section 8.2.3 (PDU Session Resource Modify) @3GPP TS 38.413
//if dL_NGU_UP_TNLInformation is included, it shall be considered as the new DL transport layer addr for the PDU session (should be verified)
//TODO: may include uL_NGU_UP_TNLInformation (mapping between each new DL transport layer address and the corresponding UL transport layer address)
fteid_t
dl_teid
;
pfcp
::
fteid_t
dl_teid
;
memcpy
(
&
dl_teid
.
teid
_gre_key
,
&
dl_teid
.
teid
,
decoded_msg
->
dL_NGU_UP_TNLInformation
->
choice
.
gTPTunnel
->
gTP_TEID
.
buf
,
sizeof
(
struct
in_addr
)
);
TEID_GRE_KEY_LENGTH
);
memcpy
(
&
dl_teid
.
ipv4_address
,
decoded_msg
->
dL_NGU_UP_TNLInformation
->
choice
.
gTPTunnel
->
transportLayerAddress
.
buf
,
4
);
dl_teid
.
teid_gre_key
=
ntohl
(
dl_teid
.
teid_gre_key
);
dl_teid
.
interface_type
=
S1_U_ENODEB_GTP_U
;
dl_teid
.
teid
=
ntohl
(
dl_teid
.
teid
);
dl_teid
.
v4
=
1
;
//Only v4 for now
smreq
->
req
.
set_dl_fteid
(
dl_teid
);
...
...
src/smf_app/smf_context.hpp
View file @
36d4db36
...
...
@@ -104,8 +104,8 @@ class smf_qos_flow {
std
::
string
toString
()
const
;
pfcp
::
qfi_t
qfi
;
//QoS Flow Identifier
fteid_t
ul_fteid
;
//fteid of UPF
fteid_t
dl_fteid
;
//fteid of AN
pfcp
::
fteid_t
ul_fteid
;
//fteid of UPF
pfcp
::
fteid_t
dl_fteid
;
//fteid of AN
pfcp
::
pdr_id_t
pdr_id_ul
;
// Packet Detection Rule ID, UL
pfcp
::
pdr_id_t
pdr_id_dl
;
// Packet Detection Rule ID, DL
pfcp
::
precedence_t
precedence
;
...
...
src/smf_app/smf_msg.cpp
View file @
36d4db36
...
...
@@ -44,12 +44,12 @@ void qos_flow_context_updated::set_qfi(const pfcp::qfi_t &q) {
}
//-----------------------------------------------------------------------------
void
qos_flow_context_updated
::
set_ul_fteid
(
const
fteid_t
&
teid
)
{
void
qos_flow_context_updated
::
set_ul_fteid
(
const
pfcp
::
fteid_t
&
teid
)
{
ul_fteid
=
teid
;
}
//-----------------------------------------------------------------------------
void
qos_flow_context_updated
::
set_dl_fteid
(
const
fteid_t
&
teid
)
{
void
qos_flow_context_updated
::
set_dl_fteid
(
const
pfcp
::
fteid_t
&
teid
)
{
dl_fteid
=
teid
;
}
...
...
@@ -385,12 +385,12 @@ void pdu_session_update_sm_context_request::get_qfis(
}
//-----------------------------------------------------------------------------
void
pdu_session_update_sm_context_request
::
set_dl_fteid
(
const
fteid_t
&
t
)
{
void
pdu_session_update_sm_context_request
::
set_dl_fteid
(
const
pfcp
::
fteid_t
&
t
)
{
dl_fteid
=
t
;
}
//-----------------------------------------------------------------------------
void
pdu_session_update_sm_context_request
::
get_dl_fteid
(
fteid_t
&
t
)
{
void
pdu_session_update_sm_context_request
::
get_dl_fteid
(
pfcp
::
fteid_t
&
t
)
{
t
=
dl_fteid
;
}
...
...
src/smf_app/smf_msg.hpp
View file @
36d4db36
...
...
@@ -76,16 +76,16 @@ class qos_flow_context_updated {
void
set_cause
(
const
uint8_t
cause
);
void
set_qfi
(
const
pfcp
::
qfi_t
&
q
);
void
set_ul_fteid
(
const
fteid_t
&
teid
);
void
set_dl_fteid
(
const
fteid_t
&
teid
);
void
set_ul_fteid
(
const
pfcp
::
fteid_t
&
teid
);
void
set_dl_fteid
(
const
pfcp
::
fteid_t
&
teid
);
void
add_qos_rule
(
const
QOSRulesIE
&
rule
);
void
set_qos_profile
(
const
qos_profile_t
&
profile
);
void
set_priority_level
(
uint8_t
p
);
uint8_t
cause_value
;
pfcp
::
qfi_t
qfi
;
fteid_t
ul_fteid
;
fteid_t
dl_fteid
;
pfcp
::
fteid_t
ul_fteid
;
pfcp
::
fteid_t
dl_fteid
;
std
::
map
<
uint8_t
,
QOSRulesIE
>
qos_rules
;
qos_profile_t
qos_profile
;
bool
to_be_removed
;
...
...
@@ -342,8 +342,8 @@ class pdu_session_update_sm_context_request :
void
add_qfi
(
const
pfcp
::
qfi_t
&
qfi
);
void
add_qfi
(
const
uint8_t
&
qfi
);
void
get_qfis
(
std
::
vector
<
pfcp
::
qfi_t
>
&
q
);
void
set_dl_fteid
(
const
fteid_t
&
t
);
void
get_dl_fteid
(
fteid_t
&
t
);
void
set_dl_fteid
(
const
pfcp
::
fteid_t
&
t
);
void
get_dl_fteid
(
pfcp
::
fteid_t
&
t
);
void
set_upCnx_state
(
const
std
::
string
&
value
);
bool
upCnx_state_is_set
()
const
;
void
set_rat_type
(
const
std
::
string
&
value
);
...
...
@@ -355,7 +355,7 @@ class pdu_session_update_sm_context_request :
private:
std
::
vector
<
pfcp
::
qfi_t
>
qfis
;
fteid_t
dl_fteid
;
//AN Tunnel Info
pfcp
::
fteid_t
dl_fteid
;
//AN Tunnel Info
std
::
string
m_nf_instanceId
;
std
::
string
m_an_type
;
bool
m_an_type_is_set
;
...
...
src/smf_app/smf_n2.cpp
View file @
36d4db36
This diff is collapsed.
Click to expand it.
src/smf_app/smf_procedure.cpp
View file @
36d4db36
...
...
@@ -263,8 +263,7 @@ int session_create_sm_context_procedure::run(
qos_rule
.
qosflowidentifer
=
flow
.
qfi
.
qfi
;
sps
->
add_qos_rule
(
qos_rule
);
smf_qos_flow
flow2
=
flow
;
sps
->
add_qos_flow
(
flow2
);
sps
->
add_qos_flow
(
flow
);
sps
->
set_default_qos_flow
(
flow
.
qfi
);
// for finding procedure when receiving response
...
...
@@ -305,15 +304,10 @@ void session_create_sm_context_procedure::handle_itti_msg(
if
(
it
.
get
(
pdr_id
))
{
smf_qos_flow
flow
=
{
};
if
(
sps
->
get_qos_flow
(
pdr_id
,
flow
))
{
pfcp
::
fteid_t
local_up_fteid
=
{
};
if
(
it
.
get
(
local_up_fteid
))
{
//set tunnel id
xgpp_conv
::
pfcp_to_core_fteid
(
local_up_fteid
,
flow
.
ul_fteid
);
//TODO: should be updated to 5G N3/N9 interface
flow
.
ul_fteid
.
interface_type
=
S1_U_SGW_GTP_U
;
//UPF's N3 interface
//pfcp::fteid_t local_up_fteid = { };
if
(
it
.
get
(
flow
.
ul_fteid
))
{
//Update Qos Flow
smf_qos_flow
flow2
=
flow
;
sps
->
add_qos_flow
(
flow2
);
sps
->
add_qos_flow
(
flow
);
}
}
else
{
Logger
::
smf_app
().
error
(
"Could not get QoS Flow for created_pdr %d"
,
...
...
@@ -523,7 +517,7 @@ int session_update_sm_context_procedure::run(
case
session_management_procedures_type_e
:
:
PDU_SESSION_MODIFICATION_AN_REQUESTED
:
case
session_management_procedures_type_e
:
:
PDU_SESSION_MODIFICATION_UE_INITIATED_STEP2
:
{
::
fteid_t
dl_fteid
=
{
};
pfcp
::
fteid_t
dl_fteid
=
{
};
sm_context_req_msg
.
get_dl_fteid
(
dl_fteid
);
//eNB's fteid
for
(
auto
qfi
:
list_of_qfis_to_be_modified
)
{
...
...
@@ -565,7 +559,7 @@ int session_update_sm_context_procedure::run(
update_far
.
set
(
flow
.
far_id_dl
.
second
);
outer_header_creation
.
outer_header_creation_description
=
OUTER_HEADER_CREATION_GTPU_UDP_IPV4
;
outer_header_creation
.
teid
=
dl_fteid
.
teid
_gre_key
;
outer_header_creation
.
teid
=
dl_fteid
.
teid
;
outer_header_creation
.
ipv4_address
.
s_addr
=
dl_fteid
.
ipv4_address
.
s_addr
;
update_forwarding_parameters
.
set
(
outer_header_creation
);
...
...
@@ -608,7 +602,7 @@ int session_update_sm_context_procedure::run(
forwarding_parameters
.
set
(
destination_interface
);
outer_header_creation
.
outer_header_creation_description
=
OUTER_HEADER_CREATION_GTPU_UDP_IPV4
;
outer_header_creation
.
teid
=
dl_fteid
.
teid
_gre_key
;
outer_header_creation
.
teid
=
dl_fteid
.
teid
;
outer_header_creation
.
ipv4_address
.
s_addr
=
dl_fteid
.
ipv4_address
.
s_addr
;
forwarding_parameters
.
set
(
outer_header_creation
);
...
...
@@ -748,8 +742,7 @@ int session_update_sm_context_procedure::run(
if
(
not
flow
.
dl_fteid
.
is_zero
())
{
}
// may be modified
smf_qos_flow
flow2
=
flow
;
sps
->
add_qos_flow
(
flow2
);
sps
->
add_qos_flow
(
flow
);
qos_flow_context_updated
qcu
=
{
};
qcu
.
set_cause
(
REQUEST_ACCEPTED
);
...
...
@@ -816,8 +809,7 @@ int session_update_sm_context_procedure::run(
//update in the PDU Session
flow
.
mark_as_released
();
smf_qos_flow
flow2
=
flow
;
sps
->
add_qos_flow
(
flow2
);
sps
->
add_qos_flow
(
flow
);
}
}
break
;
...
...
@@ -885,11 +877,11 @@ void session_update_sm_context_procedure::handle_itti_msg(
case
session_management_procedures_type_e
:
:
SERVICE_REQUEST_UE_TRIGGERED_STEP2
:
case
session_management_procedures_type_e
:
:
PDU_SESSION_MODIFICATION_UE_INITIATED_STEP2
:
{
::
fteid_t
dl_fteid
=
{
};
pfcp
::
fteid_t
dl_fteid
=
{
};
n11_trigger
->
req
.
get_dl_fteid
(
dl_fteid
);
Logger
::
smf_app
().
debug
(
"AN F-TEID ID"
"0x%"
PRIx32
", IP Addr %s"
,
dl_fteid
.
teid
_gre_key
,
dl_fteid
.
teid
,
conv
::
toString
(
dl_fteid
.
ipv4_address
).
c_str
());
std
::
map
<
uint8_t
,
qos_flow_context_updated
>
qos_flow_context_to_be_updateds
=
...
...
@@ -910,12 +902,7 @@ void session_update_sm_context_procedure::handle_itti_msg(
Logger
::
smf_app
().
debug
(
"QoS Flow, QFI %d"
,
flow
.
qfi
.
qfi
);
for
(
auto
it
:
qos_flow_context_to_be_updateds
)
{
flow
.
dl_fteid
=
dl_fteid
;
flow
.
dl_fteid
.
interface_type
=
S1_U_ENODEB_GTP_U
;
//eNB's N3 interface
// flow.ul_fteid = it.second.ul_fteid;
pfcp
::
fteid_t
local_up_fteid
=
{
};
if
(
it_created_pdr
.
get
(
local_up_fteid
))
{
xgpp_conv
::
pfcp_to_core_fteid
(
local_up_fteid
,
flow
.
ul_fteid
);
flow
.
ul_fteid
.
interface_type
=
S1_U_SGW_GTP_U
;
//UPF's N3 interface, TODO: should be modified
if
(
it_created_pdr
.
get
(
flow
.
ul_fteid
))
{
Logger
::
smf_app
().
debug
(
"Got local_up_fteid from created_pdr %s"
,
flow
.
ul_fteid
.
toString
().
c_str
());
...
...
@@ -926,15 +913,7 @@ void session_update_sm_context_procedure::handle_itti_msg(
}
flow
.
released
=
false
;
smf_qos_flow
flow2
=
flow
;
sps
->
add_qos_flow
(
flow2
);
/*
//add another flow for testing purpose, TODO: SHOULD BE REMOVED
smf_qos_flow flow3 = flow;
flow3.qfi = 7;
sps->add_qos_flow(flow3);
*/
sps
->
add_qos_flow
(
flow
);
qos_flow_context_updated
qcu
=
{
};
qcu
.
set_cause
(
REQUEST_ACCEPTED
);
...
...
@@ -964,8 +943,7 @@ void session_update_sm_context_procedure::handle_itti_msg(
for
(
auto
it
:
qos_flow_context_to_be_updateds
)
{
if
(
it
.
first
==
flow
.
qfi
.
qfi
)
{
flow
.
dl_fteid
=
dl_fteid
;
smf_qos_flow
flow2
=
flow
;
sps
->
add_qos_flow
(
flow2
);
sps
->
add_qos_flow
(
flow
);
qos_flow_context_updated
qcu
=
{
};
qcu
.
set_cause
(
REQUEST_ACCEPTED
);
...
...
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