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
92741a25
Commit
92741a25
authored
Apr 02, 2019
by
gauthier
Browse files
Options
Browse Files
Download
Plain Diff
Merge SXAB tweaks into develop
parents
a1fda70f
323be096
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
132 additions
and
137 deletions
+132
-137
etc/spgw_c.conf
etc/spgw_c.conf
+5
-8
src/common/3gpp_29.244.h
src/common/3gpp_29.244.h
+31
-5
src/gtpv2c/3gpp_29.274.hpp
src/gtpv2c/3gpp_29.274.hpp
+1
-1
src/pgwc/pgw_app.cpp
src/pgwc/pgw_app.cpp
+2
-2
src/pgwc/pgw_config.cpp
src/pgwc/pgw_config.cpp
+0
-12
src/pgwc/pgw_config.hpp
src/pgwc/pgw_config.hpp
+0
-1
src/pgwc/pgw_context.cpp
src/pgwc/pgw_context.cpp
+22
-17
src/pgwc/pgw_context.hpp
src/pgwc/pgw_context.hpp
+6
-2
src/pgwc/pgw_paa_dynamic.hpp
src/pgwc/pgw_paa_dynamic.hpp
+15
-6
src/pgwc/pgwc_procedure.cpp
src/pgwc/pgwc_procedure.cpp
+47
-80
src/pgwc/pgwc_procedure.hpp
src/pgwc/pgwc_procedure.hpp
+0
-3
src/spgwu/simpleswitch/pfcp_switch.cpp
src/spgwu/simpleswitch/pfcp_switch.cpp
+3
-0
No files found.
etc/spgw_c.conf
View file @
92741a25
...
...
@@ -176,9 +176,6 @@ P-GW =
# Normally no more than 96 pools allowed, but for non OVS GTP solution, only one pool allowed (TODO).
IP_ADDRESS_POOL
:
{
ARP_UE
=
"@ARP_UE@"
;
# String, {"no", "linux", 'oai'}, respond to incoming ARP for UE IP addresses on SGi interface
# 'linux' use arp executable (comes with your linux distribution)
# 'oai' can only be used with OVS
IPV4_LIST
= (
{
RANGE
=
"12.1.1.2 - 12.1.1.128"
;},
# STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE.
{
RANGE
=
"12.1.1.129 - 12.1.1.224"
;},
# STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE.
...
...
@@ -195,11 +192,11 @@ P-GW =
APN_LIST
= (
# IPV4_POOL, IPV6_POOL are index in IPV4_LIST, IPV6_LIST, PDN_TYPE choice in {IPv4, IPv6, IPv4v6}
{
APN_NI
=
"default"
;
PDN_TYPE
=
"IPv4"
;
IPV4_POOL
=
0
;
IPV6_POOL
= -
1
;
SNAT
=
"no"
},
{
APN_NI
=
"apn1"
;
PDN_TYPE
=
"IPv4"
;
IPV4_POOL
=
1
;
IPV6_POOL
= -
1
;
SNAT
=
"no"
},
{
APN_NI
=
"apn2"
;
PDN_TYPE
=
"IPv4"
;
IPV4_POOL
=
2
;
IPV6_POOL
= -
1
;
SNAT
=
"no"
},
{
APN_NI
=
"apn3"
;
PDN_TYPE
=
"IPv4"
;
IPV4_POOL
=
3
;
IPV6_POOL
= -
1
;
SNAT
=
"no"
},
{
APN_NI
=
"apn2"
;
PDN_TYPE
=
"IPv4"
;
IPV4_POOL
=
4
;
IPV6_POOL
= -
1
;
SNAT
=
"no"
}
{
APN_NI
=
"default"
;
PDN_TYPE
=
"IPv4"
;
IPV4_POOL
=
0
;
IPV6_POOL
= -
1
},
{
APN_NI
=
"apn1"
;
PDN_TYPE
=
"IPv4"
;
IPV4_POOL
=
1
;
IPV6_POOL
= -
1
},
{
APN_NI
=
"apn2"
;
PDN_TYPE
=
"IPv4"
;
IPV4_POOL
=
2
;
IPV6_POOL
= -
1
},
{
APN_NI
=
"apn3"
;
PDN_TYPE
=
"IPv4"
;
IPV4_POOL
=
3
;
IPV6_POOL
= -
1
},
{
APN_NI
=
"apn2"
;
PDN_TYPE
=
"IPv4"
;
IPV4_POOL
=
4
;
IPV6_POOL
= -
1
}
);
# DNS address communicated to UEs
...
...
src/common/3gpp_29.244.h
View file @
92741a25
...
...
@@ -372,7 +372,7 @@ namespace pfcp {
//-------------------------------------
// 8.2.3 F-TEID
typedef
struct
fteid_s
{
struct
fteid_s
{
uint8_t
chid
:
1
;
uint8_t
ch
:
1
;
uint8_t
v4
:
1
;
...
...
@@ -381,8 +381,25 @@ namespace pfcp {
struct
in_addr
ipv4_address
;
struct
in6_addr
ipv6_address
;
uint8_t
choose_id
;
}
fteid_t
;
bool
operator
==
(
const
struct
fteid_s
&
f
)
const
{
return
(
teid
==
f
.
teid
)
and
(
ipv4_address
.
s_addr
==
f
.
ipv4_address
.
s_addr
)
and
(
chid
==
f
.
chid
)
and
(
ch
==
f
.
ch
)
and
(
choose_id
==
f
.
choose_id
)
and
(
ipv6_address
.
s6_addr32
[
0
]
==
f
.
ipv6_address
.
s6_addr32
[
0
])
and
(
ipv6_address
.
s6_addr32
[
1
]
==
f
.
ipv6_address
.
s6_addr32
[
1
])
and
(
ipv6_address
.
s6_addr32
[
2
]
==
f
.
ipv6_address
.
s6_addr32
[
2
])
and
(
ipv6_address
.
s6_addr32
[
3
]
==
f
.
ipv6_address
.
s6_addr32
[
3
])
and
(
v4
==
f
.
v4
)
and
(
v6
==
f
.
v6
);
}
bool
is_zero
()
const
{
return
((
!
v4
)
and
(
!
v6
));}
}
;
typedef
struct
fteid_s
fteid_t
;
//-------------------------------------
// 8.2.4 Network Instance
typedef
struct
network_instance_s
{
...
...
@@ -734,6 +751,9 @@ namespace pfcp {
// 8.2.36 Packet Detection Rule ID (PDR ID)
typedef
struct
pdr_id_s
{
uint16_t
rule_id
;
pdr_id_s
()
:
rule_id
(
0
)
{}
pdr_id_s
(
const
uint8_t
&
p
)
:
rule_id
(
p
)
{}
pdr_id_s
(
const
struct
pdr_id_s
&
p
)
:
rule_id
(
p
.
rule_id
)
{}
bool
operator
==
(
const
struct
pdr_id_s
&
i
)
const
{
return
(
i
.
rule_id
==
rule_id
);
};
...
...
@@ -1145,10 +1165,16 @@ namespace pfcp {
//-------------------------------------
// 8.2.74 FAR ID
typedef
struct
far_id_s
{
struct
far_id_s
{
uint32_t
far_id
;
}
far_id_t
;
far_id_s
()
:
far_id
(
0
)
{}
far_id_s
(
const
uint8_t
&
f
)
:
far_id
(
f
)
{}
far_id_s
(
const
struct
far_id_s
&
f
)
:
far_id
(
f
.
far_id
)
{}
bool
operator
==
(
const
struct
far_id_s
&
i
)
const
{
return
(
i
.
far_id
==
far_id
);
};
}
;
typedef
struct
far_id_s
far_id_t
;
//-------------------------------------
// 8.2.75 QER ID
typedef
struct
qer_id_s
{
...
...
src/gtpv2c/3gpp_29.274.hpp
View file @
92741a25
...
...
@@ -361,7 +361,7 @@ public:
void
add_ie
(
std
::
shared_ptr
<
gtpv2c_ie
>
ie
)
{
ies
.
push_back
(
ie
);
std
::
cout
<<
std
::
dec
<<
" add_ie = "
<<
get_message_length
()
<<
" -> "
<<
get_message_length
()
+
gtpv2c_tlv
::
tlv_ie_length
+
ie
.
get
()
->
tlv
.
get_length
()
<<
std
::
endl
;
//
std::cout << std::dec<< " add_ie = " << get_message_length() << " -> "<< get_message_length() + gtpv2c_tlv::tlv_ie_length + ie.get()->tlv.get_length() << std::endl;
set_message_length
(
get_message_length
()
+
gtpv2c_tlv
::
tlv_ie_length
+
ie
.
get
()
->
tlv
.
get_length
());
}
...
...
src/pgwc/pgw_app.cpp
View file @
92741a25
...
...
@@ -59,11 +59,11 @@ int pgw_app::apply_config (const pgw_config& cfg)
if
(
cfg
.
apn
[
ia
].
pool_id_iv4
>=
0
)
{
int
pool_id
=
cfg
.
apn
[
ia
].
pool_id_iv4
;
int
range
=
be32toh
(
cfg
.
ue_pool_range_high
[
pool_id
].
s_addr
)
-
be32toh
(
cfg
.
ue_pool_range_low
[
pool_id
].
s_addr
)
;
paa_dynamic
::
get_instance
().
add_pool
(
cfg
.
apn
[
ia
].
apn
,
pool_id
,
cfg
.
ue_pool_range_low
[
pool_id
],
range
);
paa_dynamic
::
get_instance
().
add_pool
(
cfg
.
apn
[
ia
].
apn
_label
,
pool_id
,
cfg
.
ue_pool_range_low
[
pool_id
],
range
);
}
if
(
cfg
.
apn
[
ia
].
pool_id_iv6
>=
0
)
{
int
pool_id
=
cfg
.
apn
[
ia
].
pool_id_iv6
;
paa_dynamic
::
get_instance
().
add_pool
(
cfg
.
apn
[
ia
].
apn
,
pool_id
,
cfg
.
paa_pool6_prefix
[
pool_id
],
cfg
.
paa_pool6_prefix_len
[
pool_id
]);
paa_dynamic
::
get_instance
().
add_pool
(
cfg
.
apn
[
ia
].
apn
_label
,
pool_id
,
cfg
.
paa_pool6_prefix
[
pool_id
],
cfg
.
paa_pool6_prefix_len
[
pool_id
]);
}
}
...
...
src/pgwc/pgw_config.cpp
View file @
92741a25
...
...
@@ -467,18 +467,6 @@ bool pgw_config::is_dotted_apn_handled(const string& apn, const pdn_type_t& pdn_
}
return
false
;
}
//------------------------------------------------------------------------------
int
pgw_config
::
get_pa_pool_id
(
const
std
::
string
&
apn
,
int
&
pool_id_ipv4
,
int
&
pool_id_ipv6
)
{
for
(
int
i
=
0
;
i
<
pgw_cfg
.
num_apn
;
i
++
)
{
if
(
0
==
apn
.
compare
(
pgw_cfg
.
apn
[
i
].
apn_label
))
{
pool_id_ipv4
=
pgw_cfg
.
apn
[
i
].
pool_id_iv4
;
pool_id_ipv6
=
pgw_cfg
.
apn
[
i
].
pool_id_iv6
;
return
RETURNok
;
}
}
return
RETURNerror
;
}
//------------------------------------------------------------------------------
int
pgw_config
::
get_pfcp_node_id
(
pfcp
::
node_id_t
&
node_id
)
...
...
src/pgwc/pgw_config.hpp
View file @
92741a25
...
...
@@ -231,7 +231,6 @@ public:
int
finalize
();
void
display
();
bool
is_dotted_apn_handled
(
const
std
::
string
&
apn
,
const
pdn_type_t
&
pdn_type
);
int
get_pa_pool_id
(
const
std
::
string
&
apn
,
int
&
pool_id_ipv4
,
int
&
pool_id_ipv6
);
int
get_pfcp_node_id
(
pfcp
::
node_id_t
&
node_id
);
int
get_pfcp_fseid
(
pfcp
::
fseid_t
&
fseid
);
}
;
...
...
src/pgwc/pgw_context.cpp
View file @
92741a25
...
...
@@ -46,8 +46,6 @@ extern pgwc::pgw_config pgw_cfg;
void
pgw_eps_bearer
::
release_access_bearer
()
{
released
=
true
;
pdr_id_ul
=
{};
far_id_ul
=
{};
}
//------------------------------------------------------------------------------
std
::
string
pgw_eps_bearer
::
toString
()
const
...
...
@@ -160,20 +158,27 @@ void pgw_pdn_connection::generate_seid()
}
//------------------------------------------------------------------------------
// TODO check if prd_id should be uniq in the (S)PGW-U or in the context of a pdn connection
void
pgw_pdn_connection
::
generate_far_id
(
pfcp
::
far_id_t
&
far_id
)
{
far_id
.
far_id
=
far_id_generator
.
get_uid
();
}
//------------------------------------------------------------------------------
// TODO check if prd_id should be uniq in the (S)PGW-U or in the context of a pdn connection
void
pgw_pdn_connection
::
release_far_id
(
const
pfcp
::
far_id_t
&
far_id
)
{
far_id_generator
.
free_uid
(
far_id
.
far_id
);
}
//------------------------------------------------------------------------------
// TODO check if prd_id should be uniq in the (S)PGW-U or in the context of a pdn connection
void
pgw_pdn_connection
::
generate_pdr_id
(
pfcp
::
pdr_id_t
&
pdr_id
)
{
// make things simple, will write a more robust generator once scope of rule_id will be known
uint16_t
r
=
++
prd_id_generator
;
if
(
r
==
0
)
{
r
=
++
prd_id_generator
;
}
pdr_id
.
rule_id
=
r
;
pdr_id
.
rule_id
=
pdr_id_generator
.
get_uid
();
}
//------------------------------------------------------------------------------
// TODO check if prd_id should be uniq in the (S)PGW-U or in the context of a pdn connection
void
pgw_pdn_connection
::
release_pdr_id
(
const
pfcp
::
pdr_id_t
&
pdr_id
)
{
// TODO
pdr_id_generator
.
free_uid
(
pdr_id
.
rule_id
);
}
//------------------------------------------------------------------------------
...
...
@@ -483,8 +488,8 @@ void pgw_context::handle_itti_msg (std::shared_ptr<itti_s5s8_create_session_requ
// paa.pdn_type = sp->pdn_type;
// bool paa_res = csreq->gtp_ies.get(paa);
// if ((not paa_res) || (not paa.is_ip_assigned())) {
//
int ret
= paa_dynamic::get_instance().get_free_paa (sa->apn_in_use, paa);
// if (
ret == RETURNok
) {
//
bool success
= paa_dynamic::get_instance().get_free_paa (sa->apn_in_use, paa);
// if (
success
) {
// set_paa = true;
// } else {
// cause.cause_value = PREFERRED_PDN_TYPE_NOT_SUPPORTED;
...
...
@@ -530,8 +535,8 @@ void pgw_context::handle_itti_msg (std::shared_ptr<itti_s5s8_create_session_requ
if
(
!
pco_ids
.
ci_ipv4_address_allocation_via_dhcpv4
)
{
bool
paa_res
=
csreq
->
gtp_ies
.
get
(
paa
);
if
((
not
paa_res
)
||
(
not
paa
.
is_ip_assigned
()))
{
int
ret
=
paa_dynamic
::
get_instance
().
get_free_paa
(
sa
->
apn_in_use
,
paa
);
if
(
ret
==
RETURNok
)
{
bool
success
=
paa_dynamic
::
get_instance
().
get_free_paa
(
sa
->
apn_in_use
,
paa
);
if
(
success
)
{
set_paa
=
true
;
}
else
{
cause
.
cause_value
=
ALL_DYNAMIC_ADDRESSES_ARE_OCCUPIED
;
...
...
@@ -547,8 +552,8 @@ void pgw_context::handle_itti_msg (std::shared_ptr<itti_s5s8_create_session_requ
case
PDN_TYPE_E_IPV6
:
{
bool
paa_res
=
csreq
->
gtp_ies
.
get
(
paa
);
if
((
not
paa_res
)
||
(
not
paa
.
is_ip_assigned
()))
{
int
ret
=
paa_dynamic
::
get_instance
().
get_free_paa
(
sa
->
apn_in_use
,
paa
);
if
(
ret
==
RETURNok
)
{
bool
success
=
paa_dynamic
::
get_instance
().
get_free_paa
(
sa
->
apn_in_use
,
paa
);
if
(
success
)
{
set_paa
=
true
;
}
else
{
cause
.
cause_value
=
ALL_DYNAMIC_ADDRESSES_ARE_OCCUPIED
;
...
...
@@ -561,8 +566,8 @@ void pgw_context::handle_itti_msg (std::shared_ptr<itti_s5s8_create_session_requ
case
PDN_TYPE_E_IPV4V6
:
{
bool
paa_res
=
csreq
->
gtp_ies
.
get
(
paa
);
if
((
not
paa_res
)
||
(
not
paa
.
is_ip_assigned
()))
{
int
ret
=
paa_dynamic
::
get_instance
().
get_free_paa
(
sa
->
apn_in_use
,
paa
);
if
(
ret
==
RETURNok
)
{
bool
success
=
paa_dynamic
::
get_instance
().
get_free_paa
(
sa
->
apn_in_use
,
paa
);
if
(
success
)
{
set_paa
=
true
;
}
else
{
cause
.
cause_value
=
ALL_DYNAMIC_ADDRESSES_ARE_OCCUPIED
;
...
...
src/pgwc/pgw_context.hpp
View file @
92741a25
...
...
@@ -28,6 +28,7 @@
#ifndef FILE_PGW_EPS_BEARER_CONTEXT_HPP_SEEN
#define FILE_PGW_EPS_BEARER_CONTEXT_HPP_SEEN
#include <map>
#include <mutex>
#include <memory>
#include <shared_mutex>
...
...
@@ -39,6 +40,7 @@
#include "common_root_types.h"
#include "itti_msg_s5s8.hpp"
#include "pgwc_procedure.hpp"
#include "uint_generator.hpp"
namespace
pgwc
{
...
...
@@ -176,6 +178,8 @@ public:
void
generate_seid
();
void
generate_pdr_id
(
pfcp
::
pdr_id_t
&
pdr_id
);
void
release_pdr_id
(
const
pfcp
::
pdr_id_t
&
pdr_id
);
void
generate_far_id
(
pfcp
::
far_id_t
&
far_id
);
void
release_far_id
(
const
pfcp
::
far_id_t
&
far_id
);
void
create_procedure
(
itti_s5s8_create_session_response
&
m
);
void
insert_procedure
(
pgw_procedure
*
proc
);
...
...
@@ -227,8 +231,8 @@ public:
uint64_t
seid
;
pfcp
::
fseid_t
up_fseid
;
//
u
int16_t
prd
_id_generator
;
u
til
::
uint_generator
<
uint16_t
>
pdr
_id_generator
;
util
::
uint_generator
<
uint32_t
>
far_id_generator
;
};
...
...
src/pgwc/pgw_paa_dynamic.hpp
View file @
92741a25
...
...
@@ -29,6 +29,8 @@
#ifndef FILE_PGW_PAA_DYNAMIC_HPP_SEEN
#define FILE_PGW_PAA_DYNAMIC_HPP_SEEN
#include "logger.hpp"
#include <map>
#include <bitset>
...
...
@@ -185,7 +187,7 @@ public:
paa_dynamic
(
paa_dynamic
const
&
)
=
delete
;
void
operator
=
(
paa_dynamic
const
&
)
=
delete
;
void
add_pool
(
const
std
::
string
&
apn
,
const
int
pool_id
,
const
struct
in_addr
&
first
,
const
int
range
)
void
add_pool
(
const
std
::
string
&
apn
_label
,
const
int
pool_id
,
const
struct
in_addr
&
first
,
const
int
range
)
{
if
(
pool_id
>=
0
)
{
uint32_t
uint32pool_id
=
uint32_t
(
pool_id
);
...
...
@@ -193,15 +195,15 @@ public:
ipv4_pool
pool
(
first
,
range
);
ipv4_pools
[
uint32pool_id
]
=
pool
;
}
if
(
!
apns
.
count
(
apn
))
{
if
(
!
apns
.
count
(
apn
_label
))
{
apn_dynamic_pools
adp
=
{};
adp
.
add_ipv4_pool_id
(
uint32pool_id
);
apns
[
apn
]
=
adp
;
apns
[
apn
_label
]
=
adp
;
}
}
}
void
add_pool
(
const
std
::
string
&
apn
,
const
int
pool_id
,
const
struct
in6_addr
&
prefix
,
const
int
prefix_len
)
void
add_pool
(
const
std
::
string
&
apn
_label
,
const
int
pool_id
,
const
struct
in6_addr
&
prefix
,
const
int
prefix_len
)
{
if
(
pool_id
>=
0
)
{
uint32_t
uint32pool_id
=
uint32_t
(
pool_id
);
...
...
@@ -209,10 +211,10 @@ public:
ipv6_pool
pool
(
prefix
,
prefix_len
);
ipv6_pools
[
uint32pool_id
]
=
pool
;
}
if
(
!
apns
.
count
(
apn
))
{
if
(
!
apns
.
count
(
apn
_label
))
{
apn_dynamic_pools
adp
=
{};
adp
.
add_ipv6_pool_id
(
uint32pool_id
);
apns
[
apn
]
=
adp
;
apns
[
apn
_label
]
=
adp
;
}
}
}
...
...
@@ -227,6 +229,7 @@ public:
return
true
;
}
}
Logger
::
pgwc_app
().
warn
(
"Could not get PAA PDN_TYPE_E_IPV4 for APN %s"
,
apn_label
.
c_str
());
return
false
;
}
else
if
(
paa
.
pdn_type
.
pdn_type
==
PDN_TYPE_E_IPV4V6
)
{
bool
success
=
false
;
...
...
@@ -244,6 +247,7 @@ public:
}
ipv4_pools
[
*
it4
].
free_address
(
paa
.
ipv4_address
);
}
Logger
::
pgwc_app
().
warn
(
"Could not get PAA PDN_TYPE_E_IPV4V6 for APN %s"
,
apn_label
.
c_str
());
return
false
;
}
else
if
(
paa
.
pdn_type
.
pdn_type
==
PDN_TYPE_E_IPV6
)
{
for
(
std
::
vector
<
uint32_t
>::
const_iterator
it6
=
apn_pool
.
ipv6_pool_ids
.
begin
();
it6
!=
apn_pool
.
ipv6_pool_ids
.
end
();
++
it6
)
{
...
...
@@ -251,11 +255,14 @@ public:
return
true
;
}
}
Logger
::
pgwc_app
().
warn
(
"Could not get PAA PDN_TYPE_E_IPV6 for APN %s"
,
apn_label
.
c_str
());
return
false
;
}
}
Logger
::
pgwc_app
().
warn
(
"Could not get PAA for APN %s"
,
apn_label
.
c_str
());
return
false
;
}
bool
release_paa
(
const
std
::
string
&
apn_label
,
const
paa_t
&
paa
)
{
if
(
apns
.
count
(
apn_label
))
{
...
...
@@ -280,6 +287,7 @@ public:
return
true
;
}
}
Logger
::
pgwc_app
().
warn
(
"Could not release PAA for APN %s"
,
apn_label
.
c_str
());
return
false
;
}
...
...
@@ -293,6 +301,7 @@ public:
}
}
}
Logger
::
pgwc_app
().
warn
(
"Could not release PAA for APN %s"
,
apn_label
.
c_str
());
return
false
;
}
...
...
src/pgwc/pgwc_procedure.cpp
View file @
92741a25
...
...
@@ -44,30 +44,6 @@ extern itti_mw *itti_inst;
extern
pgwc
::
pgw_app
*
pgw_app_inst
;
extern
pgwc
::
pgw_config
pgw_cfg
;
//------------------------------------------------------------------------------
#define EBI2PDR_ID_DL_BEARER true
#define EBI2PDR_ID_UL_BEARER false
// TODO better than this (uid generator)?
void
pgwc
::
ebi2pdr_id
(
const
ebi_t
&
ebi
,
pfcp
::
pdr_id_t
&
pdr_id
,
const
bool
is_dl_bearer
)
{
if
(
is_dl_bearer
)
{
pdr_id
.
rule_id
=
(
2
*
ebi
.
ebi
)
|
0x2000
;
}
else
{
pdr_id
.
rule_id
=
(
2
*
ebi
.
ebi
)
|
0x1000
;
}
}
//------------------------------------------------------------------------------
#define EBI2FAR_ID_DL_BEARER true
#define EBI2FAR_ID_UL_BEARER false
// TODO better than this (uid generator)?
void
pgwc
::
ebi2far_id
(
const
ebi_t
&
ebi
,
pfcp
::
far_id_t
&
far_id
,
const
bool
is_dl_bearer
)
{
if
(
is_dl_bearer
)
{
far_id
.
far_id
=
(
2
*
ebi
.
ebi
)
|
0x00022000
;
}
else
{
far_id
.
far_id
=
(
2
*
ebi
.
ebi
)
+
1
|
0x00011000
;
}
}
//------------------------------------------------------------------------------
int
sx_session_restore_procedure
::
run
()
{
...
...
@@ -165,8 +141,7 @@ int session_establishment_procedure::run(std::shared_ptr<itti_s5s8_create_sessio
//pfcp::traffic_endpoint_id_t linked_traffic_endpoint_id_t = {};
//pfcp::proxying_t proxying = {};
// DOIT simple ?
ebi2far_id
(
it
.
eps_bearer_id
,
far_id
,
EBI2FAR_ID_UL_BEARER
);
ppc
->
generate_far_id
(
far_id
);
apply_action
.
forw
=
1
;
destination_interface
.
interface_value
=
pfcp
::
INTERFACE_VALUE_CORE
;
// ACCESS is for downlink, CORE for uplink
...
...
@@ -207,7 +182,7 @@ int session_establishment_procedure::run(std::shared_ptr<itti_s5s8_create_sessio
// DOIT simple
// shall uniquely identify the PDR among all the PDRs configured for that PFCP session.
ebi2pdr_id
(
it
.
eps_bearer_id
,
pdr_id
,
EBI2PDR_ID_UL_BEARER
);
ppc
->
generate_pdr_id
(
pdr_id
);
precedence
.
precedence
=
it
.
bearer_level_qos
.
pl
;
pdi
.
set
(
source_interface
);
...
...
@@ -253,8 +228,6 @@ int session_establishment_procedure::run(std::shared_ptr<itti_s5s8_create_sessio
//------------------------------------------------------------------------------
void
session_establishment_procedure
::
handle_itti_msg
(
itti_sxab_session_establishment_response
&
resp
)
{
bool
bearer_context_found
=
false
;
pfcp
::
cause_t
cause
=
{};
resp
.
pfcp_ies
.
get
(
cause
);
if
(
cause
.
cause_value
==
pfcp
::
CAUSE_VALUE_REQUEST_ACCEPTED
)
{
...
...
@@ -263,38 +236,11 @@ void session_establishment_procedure::handle_itti_msg (itti_sxab_session_establi
for
(
auto
it
:
resp
.
pfcp_ies
.
created_pdrs
)
{
pfcp
::
pdr_id_t
pdr_id
=
{};
pfcp
::
far_id_t
far_id
=
{};
if
(
it
.
get
(
pdr_id
))
{
pgw_eps_bearer
b
=
{};
if
(
not
ppc
->
get_eps_bearer
(
pdr_id
,
b
))
{
bearer_context_found
=
false
;
for
(
auto
it
:
s5_trigger
->
gtp_ies
.
bearer_contexts_to_be_created
)
{
pfcp
::
pdr_id_t
conv_pdr_id
;
ebi2pdr_id
(
it
.
eps_bearer_id
,
conv_pdr_id
,
EBI2PDR_ID_UL_BEARER
);
if
(
conv_pdr_id
.
rule_id
==
pdr_id
.
rule_id
)
{
pfcp
::
far_id_t
far_id
=
{};
ebi2far_id
(
it
.
eps_bearer_id
,
far_id
,
EBI2FAR_ID_UL_BEARER
);
pfcp
::
create_far
create_far
=
{};
if
(
sx_triggered
->
pfcp_ies
.
get
(
far_id
,
create_far
))
{
b
.
far_id_ul
.
first
=
true
;
b
.
far_id_ul
.
second
=
far_id
;
}
b
.
ebi
=
it
.
eps_bearer_id
;
b
.
tft
=
it
.
tft
;
b
.
eps_bearer_qos
=
it
.
bearer_level_qos
;
b
.
pdr_id_ul
=
pdr_id
;
bearer_context_found
=
true
;
break
;
}
}
}
else
{
bearer_context_found
=
true
;
}
pfcp
::
fteid_t
local_up_fteid
=
{};
if
(
bearer_context_found
)
{
if
(
ppc
->
get_eps_bearer
(
pdr_id
,
b
))
{
pfcp
::
fteid_t
local_up_fteid
=
{};
if
(
it
.
get
(
local_up_fteid
))
{
xgpp_conv
::
pfcp_to_core_fteid
(
local_up_fteid
,
b
.
pgw_fteid_s5_s8_up
);
b
.
pgw_fteid_s5_s8_up
.
interface_type
=
S5_S8_PGW_GTP_U
;
...
...
@@ -302,9 +248,10 @@ void session_establishment_procedure::handle_itti_msg (itti_sxab_session_establi
pgw_eps_bearer
b2
=
b
;
ppc
->
add_eps_bearer
(
b2
);
}
// uncomment if SPGW-C allocate up fteid
// ppc->add_eps_bearer(b);
// uncomment if SPGW-C allocate up fteid
// ppc->add_eps_bearer(b);
}
else
{
Logger
::
pgwc_app
().
error
(
"Could not get EPS bearer for created_pdr %d"
,
pdr_id
.
rule_id
);
}
}
else
{
Logger
::
pgwc_app
().
error
(
"Could not get pdr_id for created_pdr in %s"
,
resp
.
pfcp_ies
.
get_msg_name
());
...
...
@@ -379,7 +326,7 @@ int modify_bearer_procedure::run(std::shared_ptr<itti_s5s8_modify_bearer_request
::
fteid_t
v
=
{};
pgw_eps_bearer
&
peb
=
ppc
->
get_eps_bearer
(
it
.
eps_bearer_id
);
if
(
peb
.
ebi
.
ebi
!=
it
.
eps_bearer_id
.
ebi
)
{
// target is to test EPS_BEARER_IDENTITY_UNASSIGNED
if
(
peb
.
ebi
!=
it
.
eps_bearer_id
)
{
// target is to test EPS_BEARER_IDENTITY_UNASSIGNED
// TODO something (bearer not there)
Logger
::
pgwc_app
().
error
(
"modify_bearer_procedure: missing pgw_eps_bearer ebi %d"
,
it
.
eps_bearer_id
.
ebi
);
::
cause_t
cause
=
{};
...
...
@@ -456,8 +403,7 @@ int modify_bearer_procedure::run(std::shared_ptr<itti_s5s8_modify_bearer_request
//pfcp::traffic_endpoint_id_t linked_traffic_endpoint_id_t = {};
//pfcp::proxying_t proxying = {};
// DOIT simple ?
ebi2far_id
(
it
.
eps_bearer_id
,
far_id
,
EBI2FAR_ID_DL_BEARER
);
ppc
->
generate_far_id
(
far_id
);
apply_action
.
forw
=
1
;
destination_interface
.
interface_value
=
pfcp
::
INTERFACE_VALUE_ACCESS
;
// ACCESS is for downlink, CORE for uplink
...
...
@@ -520,7 +466,7 @@ int modify_bearer_procedure::run(std::shared_ptr<itti_s5s8_modify_bearer_request
// DOIT simple
// shall uniquely identify the PDR among all the PDRs configured for that PFCP session.
ebi2pdr_id
(
it
.
eps_bearer_id
,
pdr_id
,
EBI2PDR_ID_DL_BEARER
);
ppc
->
generate_pdr_id
(
pdr_id
);
precedence
.
precedence
=
peb
.
eps_bearer_qos
.
pl
;
pdi
.
set
(
source_interface
);
...
...
@@ -539,6 +485,21 @@ int modify_bearer_procedure::run(std::shared_ptr<itti_s5s8_modify_bearer_request
send_sx
=
true
;
peb
.
pdr_id_dl
=
pdr_id
;
}
else
{
// Update FAR
far_id
.
far_id
=
peb
.
far_id_ul
.
second
.
far_id
;
pfcp
::
update_far
update_far
=
{};
pfcp
::
apply_action_t
apply_action
=
{};
update_far
.
set
(
peb
.
far_id_ul
.
second
);
apply_action
.
forw
=
1
;
update_far
.
set
(
apply_action
);
sx_smr
->
pfcp_ies
.
set
(
update_far
);
send_sx
=
true
;
peb
.
far_id_dl
.
first
=
true
;
}
}
...
...
@@ -567,8 +528,7 @@ int modify_bearer_procedure::run(std::shared_ptr<itti_s5s8_modify_bearer_request
//pfcp::traffic_endpoint_id_t linked_traffic_endpoint_id_t = {};
//pfcp::proxying_t proxying = {};
// DOIT simple ?
ebi2far_id
(
it
.
eps_bearer_id
,
far_id
,
EBI2FAR_ID_UL_BEARER
);
ppc
->
generate_far_id
(
far_id
);
apply_action
.
forw
=
1
;
destination_interface
.
interface_value
=
pfcp
::
INTERFACE_VALUE_CORE
;
// ACCESS is for downlink, CORE for uplink
...
...
@@ -619,7 +579,7 @@ int modify_bearer_procedure::run(std::shared_ptr<itti_s5s8_modify_bearer_request
// DOIT simple
// shall uniquely identify the PDR among all the PDRs configured for that PFCP session.
ebi2pdr_id
(
it
.
eps_bearer_id
,
pdr_id
,
EBI2PDR_ID_UL_BEARER
);
ppc
->
generate_pdr_id
(
pdr_id
);
precedence
.
precedence
=
peb
.
eps_bearer_qos
.
pl
;
pdi
.
set
(
source_interface
);
...
...
@@ -687,7 +647,8 @@ void modify_bearer_procedure::handle_itti_msg (itti_sxab_session_modification_re
if
(
it_created_pdr
.
get
(
pdr_id
))
{
pgw_eps_bearer
b
=
{};
if
(
ppc
->
get_eps_bearer
(
pdr_id
,
b
))
{
for
(
auto
it_to_be_modified
:
s5_trigger
->
gtp_ies
.
bearer_contexts_to_be_modified
)
{
for
(
std
::
vector
<
gtpv2c
::
bearer_context_to_be_modified_within_modify_bearer_request
>::
const_iterator
it_to_be_modified
=
s5_trigger
->
gtp_ies
.
bearer_contexts_to_be_modified
.
begin
();
it_to_be_modified
!=
s5_trigger
->
gtp_ies
.
bearer_contexts_to_be_modified
.
end
();
++
it_to_be_modified
)
{
//pfcp::pdr_id_t conv_pdr_id = {};
//ebi2pdr_id(it_to_be_modified.eps_bearer_id, conv_pdr_id, EBI2PDR_ID_DL_BEARER);
...
...
@@ -695,14 +656,17 @@ void modify_bearer_procedure::handle_itti_msg (itti_sxab_session_modification_re
//if (conv_pdr_id.rule_id == pdr_id.rule_id) {
bearer_context_found
=
true
;
// can try the two till SGW not split (depends on developer convention to fake PGW)
it_to_be_modified
.
get_s5_s8_u_sgw_fteid
(
b
.
sgw_fteid_s5_s8_up
);
it_to_be_modified
.
get_s1_u_enb_fteid
(
b
.
sgw_fteid_s5_s8_up
);
it_to_be_modified
->
get_s5_s8_u_sgw_fteid
(
b
.
sgw_fteid_s5_s8_up
);
it_to_be_modified
->
get_s1_u_enb_fteid
(
b
.
sgw_fteid_s5_s8_up
);
pfcp
::
fteid_t
local_up_fteid
=
{};
if
(
it_created_pdr
.
get
(
local_up_fteid
))
{
xgpp_conv
::
pfcp_
from
_core_fteid
(
local_up_fteid
,
b
.
pgw_fteid_s5_s8_up
);
xgpp_conv
::
pfcp_
to
_core_fteid
(
local_up_fteid
,
b
.
pgw_fteid_s5_s8_up
);
b
.
pgw_fteid_s5_s8_up
.
interface_type
=
S5_S8_PGW_GTP_U
;
// comment if SPGW-C allocate up fteid
Logger
::
pgwc_app
().
error
(
"got local_up_fteid from created_pdr %s"
,
b
.
pgw_fteid_s5_s8_up
.
toString
().
c_str
());
}
else
{
Logger
::
pgwc_app
().
error
(
"Could not get local_up_fteid from created_pdr"
);
}
b
.
released
=
false
;
pgw_eps_bearer
b2
=
b
;
...
...
@@ -714,6 +678,9 @@ void modify_bearer_procedure::handle_itti_msg (itti_sxab_session_modification_re
bcc
.
set
(
b
.
ebi
);
bcc
.
set
(
bcc_cause
);
s5_triggered_pending
->
gtp_ies
.
add_bearer_context_modified
(
bcc
);
// Avoid duplicate with update fars
s5_trigger
->
gtp_ies
.
bearer_contexts_to_be_modified
.
erase
(
it_to_be_modified
);
break
;
//}
}
...
...
@@ -755,6 +722,7 @@ void modify_bearer_procedure::handle_itti_msg (itti_sxab_session_modification_re
}
}
// TODO NOT GOOD since we removed the bearer from s5_trigger->gtp_ies.bearer_contexts_to_be_modified
// check we got all responses
for
(
auto
it
:
s5_trigger
->
gtp_ies
.
bearer_contexts_to_be_modified
)
{
ebi_t
ebi_tobe
;
...
...
@@ -821,7 +789,6 @@ int release_access_bearers_procedure::run(std::shared_ptr<itti_s5s8_release_acce
//-------------------
pfcp
::
update_far
far
=
{};
pfcp
::
far_id_t
far_id
=
{};
pfcp
::
apply_action_t
apply_action
=
{};
// pfcp::update_forwarding_parameters forwarding_parameters = {};
// pfcp::update_duplicating_parameters duplicating_parameters = {};
// pfcp::bar_id_t bar_id = {};
...
...
@@ -841,6 +808,7 @@ int release_access_bearers_procedure::run(std::shared_ptr<itti_s5s8_release_acce
if
(
peb
.
far_id_dl
.
first
)
{
far_id
.
far_id
=
peb
.
far_id_dl
.
second
.
far_id
;
//apply_action.buff = 1;
pfcp
::
apply_action_t
apply_action
=
{};
apply_action
.
nocp
=
1
;
far
.
set
(
far_id
);
...
...
@@ -853,17 +821,16 @@ int release_access_bearers_procedure::run(std::shared_ptr<itti_s5s8_release_acce
Logger
::
pgwc_app
().
info
(
"release_access_bearers_procedure , could not get FAR ID of EPS bearer %d"
,
peb
.
ebi
.
ebi
);
}
if
(
peb
.
far_id_ul
.
first
)
{
pfcp
::
remov
e_far
far
=
{};
pfcp
::
updat
e_far
far
=
{};
pfcp
::
far_id_t
far_id
=
{};
far_id
.
far_id
=
peb
.
far_id_ul
.
second
.
far_id
;
pfcp
::
apply_action_t
apply_action
=
{};
apply_action
.
drop
=
1
;
far
.
set
(
far_id
);
far
.
set
(
apply_action
);
sx_smr
->
pfcp_ies
.
set
(
far
);
}
pfcp
::
remove_pdr
pdr
=
{};
pfcp
::
pdr_id_t
pdr_id
=
{};
pdr_id
.
rule_id
=
peb
.
pdr_id_ul
.
rule_id
;
pdr
.
set
(
pdr_id
);
sx_smr
->
pfcp_ies
.
set
(
pdr
);
peb
.
release_access_bearer
();
pgw_eps_bearer
b2
=
peb
;
...
...
src/pgwc/pgwc_procedure.hpp
View file @
92741a25
...
...
@@ -47,9 +47,6 @@ class apn_context;
class
pgw_context
;
class
pgw_pdn_connection
;
void
ebi2pdr_id
(
const
ebi_t
&
ebi
,
pfcp
::
pdr_id_t
&
pdr_id
,
const
bool
is_dl_bearer
);
void
ebi2far_id
(
const
ebi_t
&
ebi
,
pfcp
::
far_id_t
&
far_id
,
const
bool
is_dl_bearer
);
//------------------------------------------------------------------------------
class
pgw_procedure
{
private:
...
...
src/spgwu/simpleswitch/pfcp_switch.cpp
View file @
92741a25
...
...
@@ -670,6 +670,9 @@ void pfcp_switch::handle_pfcp_session_modification_request(std::shared_ptr<itti_
}
pfcp
::
created_pdr
created_pdr
=
{};
created_pdr
.
set
(
cr_pdr
.
pdr_id
.
second
);
if
(
not
allocated_fteid
.
is_zero
())
{
created_pdr
.
set
(
allocated_fteid
);
}
resp
->
pfcp_ies
.
set
(
created_pdr
);
}
}
...
...
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