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
f8300c31
Commit
f8300c31
authored
Sep 04, 2020
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'pfcp_source_port_8805' into 'develop'
Pfcp source port 8805 See merge request oai/cn5g/oai-cn5g-smf!21
parents
d0f0f33c
bfdf5757
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
106 additions
and
102 deletions
+106
-102
build/scripts/smf_conf.sh
build/scripts/smf_conf.sh
+5
-11
build/scripts/smf_local_conf.sh
build/scripts/smf_local_conf.sh
+41
-0
etc/smf.conf
etc/smf.conf
+2
-9
src/pfcp/pfcp.cpp
src/pfcp/pfcp.cpp
+27
-9
src/smf_app/smf_app.cpp
src/smf_app/smf_app.cpp
+12
-9
src/smf_app/smf_config.cpp
src/smf_app/smf_config.cpp
+0
-23
src/smf_app/smf_config.hpp
src/smf_app/smf_config.hpp
+0
-13
src/smf_app/smf_context.cpp
src/smf_app/smf_context.cpp
+3
-0
src/smf_app/smf_n4.cpp
src/smf_app/smf_n4.cpp
+10
-2
src/smf_app/smf_procedure.cpp
src/smf_app/smf_procedure.cpp
+6
-26
No files found.
build/scripts/smf_conf.sh
View file @
f8300c31
# prompt has been removed for easier Ctrl+C Ctrl+V
# prompt has been removed for easier Ctrl+C Ctrl+V
sudo
ifconfig eno1:smf 172.16.1.101 up
# SMF
# please update the following information according to your configuration
sudo
ifconfig eno1:amf 172.16.1.102 up
# AMF
sudo
ifconfig eno1:udm 172.16.1.103 up
# UDM
sudo
ifconfig eno1:sn4 172.16.2.101 up
# SMF N4 interface
sudo
ifconfig eno1:un4 172.16.2.102 up
# UPF N4 interface
INSTANCE
=
1
INSTANCE
=
1
PREFIX
=
'/usr/local/etc/oai'
PREFIX
=
'/usr/local/etc/oai'
...
@@ -17,20 +12,19 @@ SMF_CONF[@INSTANCE@]=$INSTANCE
...
@@ -17,20 +12,19 @@ SMF_CONF[@INSTANCE@]=$INSTANCE
SMF_CONF[@PREFIX@]
=
$PREFIX
SMF_CONF[@PREFIX@]
=
$PREFIX
SMF_CONF[@PID_DIRECTORY@]
=
'/var/run'
SMF_CONF[@PID_DIRECTORY@]
=
'/var/run'
SMF_CONF[@SMF_INTERFACE_NAME_FOR_N4@]
=
'en
o1:sn4
'
SMF_CONF[@SMF_INTERFACE_NAME_FOR_N4@]
=
'en
s3
'
SMF_CONF[@SMF_INTERFACE_NAME_FOR_SBI@]
=
'en
o1:smf
'
SMF_CONF[@SMF_INTERFACE_NAME_FOR_SBI@]
=
'en
s3
'
SMF_CONF[@SMF_INTERFACE_IPV4_ADDRESS_FOR_SBI@]
=
'172.16.1.101'
SMF_CONF[@SMF_INTERFACE_PORT_FOR_SBI@]
=
'80'
SMF_CONF[@SMF_INTERFACE_PORT_FOR_SBI@]
=
'80'
SMF_CONF[@SMF_INTERFACE_HTTP2_PORT_FOR_SBI@]
=
'9090'
SMF_CONF[@SMF_INTERFACE_HTTP2_PORT_FOR_SBI@]
=
'9090'
SMF_CONF[@UDM_IPV4_ADDRESS@]
=
'172.16.1.103'
SMF_CONF[@UDM_IPV4_ADDRESS@]
=
'172.16.1.103'
SMF_CONF[@UDM_PORT@]
=
'80'
SMF_CONF[@UDM_PORT@]
=
'80'
SMF_CONF[@AMF_IPV4_ADDRESS@]
=
'1
72.16.1.102
'
SMF_CONF[@AMF_IPV4_ADDRESS@]
=
'1
92.168.122.183
'
SMF_CONF[@AMF_PORT@]
=
'80'
SMF_CONF[@AMF_PORT@]
=
'80'
SMF_CONF[@UPF_IPV4_ADDRESS@]
=
'1
72.16.2.102
'
SMF_CONF[@UPF_IPV4_ADDRESS@]
=
'1
92.168.122.151
'
SMF_CONF[@DEFAULT_DNS_IPV4_ADDRESS@]
=
'8.8.8.8'
SMF_CONF[@DEFAULT_DNS_IPV4_ADDRESS@]
=
'8.8.8.8'
SMF_CONF[@DEFAULT_DNS_SEC_IPV4_ADDRESS@]
=
'4.4.4.4'
SMF_CONF[@DEFAULT_DNS_SEC_IPV4_ADDRESS@]
=
'4.4.4.4'
...
...
build/scripts/smf_local_conf.sh
0 → 100755
View file @
f8300c31
# prompt has been removed for easier Ctrl+C Ctrl+V
sudo
ifconfig eno1:smf 172.16.1.101 up
# SMF
sudo
ifconfig eno1:amf 172.16.1.102 up
# AMF
sudo
ifconfig eno1:udm 172.16.1.103 up
# UDM
sudo
ifconfig eno1:sn4 172.16.2.101 up
# SMF N4 interface
sudo
ifconfig eno1:un4 172.16.2.102 up
# UPF N4 interface
INSTANCE
=
1
PREFIX
=
'/usr/local/etc/oai'
sudo mkdir
-m
0777
-p
$PREFIX
cp
../../etc/smf.conf
$PREFIX
declare
-A
SMF_CONF
SMF_CONF[@INSTANCE@]
=
$INSTANCE
SMF_CONF[@PREFIX@]
=
$PREFIX
SMF_CONF[@PID_DIRECTORY@]
=
'/var/run'
SMF_CONF[@SMF_INTERFACE_NAME_FOR_N4@]
=
'eno1:sn4'
SMF_CONF[@SMF_INTERFACE_NAME_FOR_SBI@]
=
'eno1:smf'
SMF_CONF[@SMF_INTERFACE_IPV4_ADDRESS_FOR_SBI@]
=
'172.16.1.101'
SMF_CONF[@SMF_INTERFACE_PORT_FOR_SBI@]
=
'80'
SMF_CONF[@SMF_INTERFACE_HTTP2_PORT_FOR_SBI@]
=
'9090'
SMF_CONF[@UDM_IPV4_ADDRESS@]
=
'172.16.1.103'
SMF_CONF[@UDM_PORT@]
=
'80'
SMF_CONF[@AMF_IPV4_ADDRESS@]
=
'172.16.1.102'
SMF_CONF[@AMF_PORT@]
=
'80'
SMF_CONF[@UPF_IPV4_ADDRESS@]
=
'172.16.2.102'
SMF_CONF[@DEFAULT_DNS_IPV4_ADDRESS@]
=
'8.8.8.8'
SMF_CONF[@DEFAULT_DNS_SEC_IPV4_ADDRESS@]
=
'4.4.4.4'
for
K
in
"
${
!SMF_CONF[@]
}
"
;
do
egrep
-lRZ
"
$K
"
$PREFIX
| xargs
-0
-l
sed
-i
-e
"s|
$K
|
${
SMF_CONF
[
$K
]
}
|g"
ret
=
$?
;
[[
ret
-ne
0
]]
&&
echo
"Tried to replace
$K
with
${
SMF_CONF
[
$K
]
}
"
done
etc/smf.conf
View file @
f8300c31
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
# For more information about the OpenAirInterface (OAI) Software Alliance:
# For more information about the OpenAirInterface (OAI) Software Alliance:
# contact@openairinterface.org
# contact@openairinterface.org
################################################################################
################################################################################
SMF
=
SMF
=
{
{
INSTANCE
= @
INSTANCE
@;
# 0 is the default
INSTANCE
= @
INSTANCE
@;
# 0 is the default
...
@@ -40,14 +41,7 @@ SMF =
...
@@ -40,14 +41,7 @@ SMF =
IPV4_ADDRESS
=
"read"
;
IPV4_ADDRESS
=
"read"
;
PORT
= @
SMF_INTERFACE_PORT_FOR_SBI
@;
#Normally we don't need this (default port 80)
PORT
= @
SMF_INTERFACE_PORT_FOR_SBI
@;
#Normally we don't need this (default port 80)
HTTP2_PORT
= @
SMF_INTERFACE_HTTP2_PORT_FOR_SBI
@;
HTTP2_PORT
= @
SMF_INTERFACE_HTTP2_PORT_FOR_SBI
@;
};
};
TEST_UPF
:
#for BUPT test only!
{
# P-GW binded interface for SX communication
IS_TEST
=
"0"
;
# 0: no test,1:test
GNB_IPV4_ADDRESS
=
"192.168.20.136"
;
# STRING,gnb_ip
};
};
};
...
@@ -120,4 +114,3 @@ SMF =
...
@@ -120,4 +114,3 @@ SMF =
};
};
src/pfcp/pfcp.cpp
View file @
f8300c31
...
@@ -49,7 +49,7 @@ pfcp_l4_stack::pfcp_l4_stack(const string& ip_address, const unsigned short port
...
@@ -49,7 +49,7 @@ pfcp_l4_stack::pfcp_l4_stack(const string& ip_address, const unsigned short port
timespec
ts
;
timespec
ts
;
clock_gettime
(
CLOCK_REALTIME
,
&
ts
);
clock_gettime
(
CLOCK_REALTIME
,
&
ts
);
seq_num
=
(
uint32_t
)
ts
.
tv_nsec
&
0x7FFFFFFF
;
seq_num
=
0
;
//
(uint32_t)ts.tv_nsec & 0x7FFFFFFF;
restart_counter
=
0
;
restart_counter
=
0
;
udp_s_8805
.
start_receive
(
this
,
sched_params
);
udp_s_8805
.
start_receive
(
this
,
sched_params
);
udp_s_allocated
.
start_receive
(
this
,
sched_params
);
udp_s_allocated
.
start_receive
(
this
,
sched_params
);
...
@@ -229,7 +229,8 @@ uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const pfcp_heartbeat_
...
@@ -229,7 +229,8 @@ uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const pfcp_heartbeat_
pending_procedures
.
insert
(
std
::
pair
<
uint32_t
,
pfcp_procedure
>
(
msg
.
get_sequence_number
(),
proc
));
pending_procedures
.
insert
(
std
::
pair
<
uint32_t
,
pfcp_procedure
>
(
msg
.
get_sequence_number
(),
proc
));
trxn_id2seq_num
.
insert
(
std
::
pair
<
uint64_t
,
uint32_t
>
(
proc
.
trxn_id
,
msg
.
get_sequence_number
()));
trxn_id2seq_num
.
insert
(
std
::
pair
<
uint64_t
,
uint32_t
>
(
proc
.
trxn_id
,
msg
.
get_sequence_number
()));
udp_s_allocated
.
async_send_to
(
reinterpret_cast
<
const
char
*>
(
bstream
.
c_str
()),
bstream
.
length
(),
dest
);
//udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
udp_s_8805
.
async_send_to
(
reinterpret_cast
<
const
char
*>
(
bstream
.
c_str
()),
bstream
.
length
(),
dest
);
return
msg
.
get_sequence_number
();
return
msg
.
get_sequence_number
();
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
...
@@ -254,7 +255,11 @@ uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const pfcp_associatio
...
@@ -254,7 +255,11 @@ uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const pfcp_associatio
pending_procedures
.
insert
(
std
::
pair
<
uint32_t
,
pfcp_procedure
>
(
msg
.
get_sequence_number
(),
proc
));
pending_procedures
.
insert
(
std
::
pair
<
uint32_t
,
pfcp_procedure
>
(
msg
.
get_sequence_number
(),
proc
));
trxn_id2seq_num
.
insert
(
std
::
pair
<
uint64_t
,
uint32_t
>
(
proc
.
trxn_id
,
msg
.
get_sequence_number
()));
trxn_id2seq_num
.
insert
(
std
::
pair
<
uint64_t
,
uint32_t
>
(
proc
.
trxn_id
,
msg
.
get_sequence_number
()));
udp_s_allocated
.
async_send_to
(
reinterpret_cast
<
const
char
*>
(
bstream
.
c_str
()),
bstream
.
length
(),
dest
);
//TTN: temporary fix to be able to work with UPF from dsTester (should be removed later)
//TTN: temporary fix to be able to work with UPF from dsTester (should be removed later)
//udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
udp_s_8805
.
async_send_to
(
reinterpret_cast
<
const
char
*>
(
bstream
.
c_str
()),
bstream
.
length
(),
dest
);
return
msg
.
get_sequence_number
();
return
msg
.
get_sequence_number
();
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
...
@@ -279,7 +284,10 @@ uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const pfcp_associatio
...
@@ -279,7 +284,10 @@ uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const pfcp_associatio
pending_procedures
.
insert
(
std
::
pair
<
uint32_t
,
pfcp_procedure
>
(
msg
.
get_sequence_number
(),
proc
));
pending_procedures
.
insert
(
std
::
pair
<
uint32_t
,
pfcp_procedure
>
(
msg
.
get_sequence_number
(),
proc
));
trxn_id2seq_num
.
insert
(
std
::
pair
<
uint64_t
,
uint32_t
>
(
proc
.
trxn_id
,
msg
.
get_sequence_number
()));
trxn_id2seq_num
.
insert
(
std
::
pair
<
uint64_t
,
uint32_t
>
(
proc
.
trxn_id
,
msg
.
get_sequence_number
()));
udp_s_allocated
.
async_send_to
(
reinterpret_cast
<
const
char
*>
(
bstream
.
c_str
()),
bstream
.
length
(),
dest
);
//TTN: temporary fix to be able to work with UPF from dsTester (should be removed later)
//udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
udp_s_8805
.
async_send_to
(
reinterpret_cast
<
const
char
*>
(
bstream
.
c_str
()),
bstream
.
length
(),
dest
);
return
msg
.
get_sequence_number
();
return
msg
.
get_sequence_number
();
}
}
////------------------------------------------------------------------------------
////------------------------------------------------------------------------------
...
@@ -356,7 +364,9 @@ uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const uint64_t seid,
...
@@ -356,7 +364,9 @@ uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const uint64_t seid,
pending_procedures
.
insert
(
std
::
pair
<
uint32_t
,
pfcp_procedure
>
(
msg
.
get_sequence_number
(),
proc
));
pending_procedures
.
insert
(
std
::
pair
<
uint32_t
,
pfcp_procedure
>
(
msg
.
get_sequence_number
(),
proc
));
trxn_id2seq_num
.
insert
(
std
::
pair
<
uint64_t
,
uint32_t
>
(
proc
.
trxn_id
,
msg
.
get_sequence_number
()));
trxn_id2seq_num
.
insert
(
std
::
pair
<
uint64_t
,
uint32_t
>
(
proc
.
trxn_id
,
msg
.
get_sequence_number
()));
udp_s_allocated
.
async_send_to
(
reinterpret_cast
<
const
char
*>
(
bstream
.
c_str
()),
bstream
.
length
(),
dest
);
//TTN: temporary fix to be able to work with UPF from dsTester (should be removed later)
//udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
udp_s_8805
.
async_send_to
(
reinterpret_cast
<
const
char
*>
(
bstream
.
c_str
()),
bstream
.
length
(),
dest
);
return
msg
.
get_sequence_number
();
return
msg
.
get_sequence_number
();
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
...
@@ -382,7 +392,9 @@ uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const uint64_t seid,
...
@@ -382,7 +392,9 @@ uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const uint64_t seid,
pending_procedures
.
insert
(
std
::
pair
<
uint32_t
,
pfcp_procedure
>
(
msg
.
get_sequence_number
(),
proc
));
pending_procedures
.
insert
(
std
::
pair
<
uint32_t
,
pfcp_procedure
>
(
msg
.
get_sequence_number
(),
proc
));
trxn_id2seq_num
.
insert
(
std
::
pair
<
uint64_t
,
uint32_t
>
(
proc
.
trxn_id
,
msg
.
get_sequence_number
()));
trxn_id2seq_num
.
insert
(
std
::
pair
<
uint64_t
,
uint32_t
>
(
proc
.
trxn_id
,
msg
.
get_sequence_number
()));
udp_s_allocated
.
async_send_to
(
reinterpret_cast
<
const
char
*>
(
bstream
.
c_str
()),
bstream
.
length
(),
dest
);
//TTN: temporary fix to be able to work with UPF from dsTester (should be removed later)
//udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
udp_s_8805
.
async_send_to
(
reinterpret_cast
<
const
char
*>
(
bstream
.
c_str
()),
bstream
.
length
(),
dest
);
return
msg
.
get_sequence_number
();
return
msg
.
get_sequence_number
();
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
...
@@ -408,7 +420,9 @@ uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const uint64_t seid,
...
@@ -408,7 +420,9 @@ uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const uint64_t seid,
pending_procedures
.
insert
(
std
::
pair
<
uint32_t
,
pfcp_procedure
>
(
msg
.
get_sequence_number
(),
proc
));
pending_procedures
.
insert
(
std
::
pair
<
uint32_t
,
pfcp_procedure
>
(
msg
.
get_sequence_number
(),
proc
));
trxn_id2seq_num
.
insert
(
std
::
pair
<
uint64_t
,
uint32_t
>
(
proc
.
trxn_id
,
msg
.
get_sequence_number
()));
trxn_id2seq_num
.
insert
(
std
::
pair
<
uint64_t
,
uint32_t
>
(
proc
.
trxn_id
,
msg
.
get_sequence_number
()));
udp_s_allocated
.
async_send_to
(
reinterpret_cast
<
const
char
*>
(
bstream
.
c_str
()),
bstream
.
length
(),
dest
);
//TTN: temporary fix to be able to work with UPF from dsTester (should be removed later)
//udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
udp_s_8805
.
async_send_to
(
reinterpret_cast
<
const
char
*>
(
bstream
.
c_str
()),
bstream
.
length
(),
dest
);
return
msg
.
get_sequence_number
();
return
msg
.
get_sequence_number
();
}
}
////------------------------------------------------------------------------------
////------------------------------------------------------------------------------
...
@@ -460,7 +474,9 @@ uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const uint64_t seid,
...
@@ -460,7 +474,9 @@ uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const uint64_t seid,
pending_procedures
.
insert
(
std
::
pair
<
uint32_t
,
pfcp_procedure
>
(
msg
.
get_sequence_number
(),
proc
));
pending_procedures
.
insert
(
std
::
pair
<
uint32_t
,
pfcp_procedure
>
(
msg
.
get_sequence_number
(),
proc
));
trxn_id2seq_num
.
insert
(
std
::
pair
<
uint64_t
,
uint32_t
>
(
proc
.
trxn_id
,
msg
.
get_sequence_number
()));
trxn_id2seq_num
.
insert
(
std
::
pair
<
uint64_t
,
uint32_t
>
(
proc
.
trxn_id
,
msg
.
get_sequence_number
()));
udp_s_allocated
.
async_send_to
(
reinterpret_cast
<
const
char
*>
(
bstream
.
c_str
()),
bstream
.
length
(),
dest
);
//TTN: temporary fix to be able to work with UPF from dsTester (should be removed later)
//udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
udp_s_8805
.
async_send_to
(
reinterpret_cast
<
const
char
*>
(
bstream
.
c_str
()),
bstream
.
length
(),
dest
);
return
msg
.
get_sequence_number
();
return
msg
.
get_sequence_number
();
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
...
@@ -486,7 +502,9 @@ uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const uint64_t seid,
...
@@ -486,7 +502,9 @@ uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const uint64_t seid,
pending_procedures
.
insert
(
std
::
pair
<
uint32_t
,
pfcp_procedure
>
(
msg
.
get_sequence_number
(),
proc
));
pending_procedures
.
insert
(
std
::
pair
<
uint32_t
,
pfcp_procedure
>
(
msg
.
get_sequence_number
(),
proc
));
trxn_id2seq_num
.
insert
(
std
::
pair
<
uint64_t
,
uint32_t
>
(
proc
.
trxn_id
,
msg
.
get_sequence_number
()));
trxn_id2seq_num
.
insert
(
std
::
pair
<
uint64_t
,
uint32_t
>
(
proc
.
trxn_id
,
msg
.
get_sequence_number
()));
udp_s_allocated
.
async_send_to
(
reinterpret_cast
<
const
char
*>
(
bstream
.
c_str
()),
bstream
.
length
(),
dest
);
//TTN: temporary fix to be able to work with UPF from dsTester (should be removed later)
//udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
udp_s_8805
.
async_send_to
(
reinterpret_cast
<
const
char
*>
(
bstream
.
c_str
()),
bstream
.
length
(),
dest
);
return
msg
.
get_sequence_number
();
return
msg
.
get_sequence_number
();
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
...
...
src/smf_app/smf_app.cpp
View file @
f8300c31
...
@@ -503,7 +503,7 @@ void smf_app::handle_itti_msg(itti_n11_create_sm_context_response &m) {
...
@@ -503,7 +503,7 @@ void smf_app::handle_itti_msg(itti_n11_create_sm_context_response &m) {
Logger
::
smf_app
().
debug
(
Logger
::
smf_app
().
debug
(
"PDU Session Create SM Context: Set promise with ID %d to ready"
,
m
.
pid
);
"PDU Session Create SM Context: Set promise with ID %d to ready"
,
m
.
pid
);
pdu_session_create_sm_context_response
sm_context_response
=
{
};
pdu_session_create_sm_context_response
sm_context_response
=
{
};
std
::
shared
_lock
lock
(
m_sm_context_create_promises
);
std
::
unique
_lock
lock
(
m_sm_context_create_promises
);
if
(
sm_context_create_promises
.
count
(
m
.
pid
)
>
0
){
if
(
sm_context_create_promises
.
count
(
m
.
pid
)
>
0
){
sm_context_create_promises
[
m
.
pid
]
->
set_value
(
m
.
res
);
sm_context_create_promises
[
m
.
pid
]
->
set_value
(
m
.
res
);
//Remove this promise from list
//Remove this promise from list
...
@@ -516,7 +516,7 @@ void smf_app::handle_itti_msg(itti_n11_update_sm_context_response &m) {
...
@@ -516,7 +516,7 @@ void smf_app::handle_itti_msg(itti_n11_update_sm_context_response &m) {
Logger
::
smf_app
().
debug
(
Logger
::
smf_app
().
debug
(
"PDU Session Update SM Context: Set promise with ID %d to ready"
,
m
.
pid
);
"PDU Session Update SM Context: Set promise with ID %d to ready"
,
m
.
pid
);
pdu_session_update_sm_context_response
sm_context_response
=
{
};
pdu_session_update_sm_context_response
sm_context_response
=
{
};
std
::
shared
_lock
lock
(
m_sm_context_update_promises
);
std
::
unique
_lock
lock
(
m_sm_context_update_promises
);
if
(
sm_context_update_promises
.
count
(
m
.
pid
)
>
0
){
if
(
sm_context_update_promises
.
count
(
m
.
pid
)
>
0
){
sm_context_update_promises
[
m
.
pid
]
->
set_value
(
m
.
res
);
sm_context_update_promises
[
m
.
pid
]
->
set_value
(
m
.
res
);
//Remove this promise from list
//Remove this promise from list
...
@@ -529,7 +529,7 @@ void smf_app::handle_itti_msg(itti_n11_release_sm_context_response &m) {
...
@@ -529,7 +529,7 @@ void smf_app::handle_itti_msg(itti_n11_release_sm_context_response &m) {
Logger
::
smf_app
().
debug
(
Logger
::
smf_app
().
debug
(
"PDU Session Release SM Context: Set promise with ID %d to ready"
,
m
.
pid
);
"PDU Session Release SM Context: Set promise with ID %d to ready"
,
m
.
pid
);
pdu_session_release_sm_context_response
sm_context_response
=
{
};
pdu_session_release_sm_context_response
sm_context_response
=
{
};
std
::
shared
_lock
lock
(
m_sm_context_release_promises
);
std
::
unique
_lock
lock
(
m_sm_context_release_promises
);
if
(
sm_context_release_promises
.
count
(
m
.
pid
)
>
0
){
if
(
sm_context_release_promises
.
count
(
m
.
pid
)
>
0
){
sm_context_release_promises
[
m
.
pid
]
->
set_value
(
m
.
res
);
sm_context_release_promises
[
m
.
pid
]
->
set_value
(
m
.
res
);
//Remove this promise from list
//Remove this promise from list
...
@@ -781,11 +781,14 @@ void smf_app::handle_pdu_session_create_sm_context_request(
...
@@ -781,11 +781,14 @@ void smf_app::handle_pdu_session_create_sm_context_request(
Logger
::
smf_app
().
warn
(
Logger
::
smf_app
().
warn
(
"PDU Session already existed (SUPI "
SUPI_64_FMT
", DNN %s, NSSAI (sst %d, sd %s), PDU Session ID %d)"
,
"PDU Session already existed (SUPI "
SUPI_64_FMT
", DNN %s, NSSAI (sst %d, sd %s), PDU Session ID %d)"
,
supi64
,
dnn
.
c_str
(),
snssai
.
sST
,
snssai
.
sD
.
c_str
(),
pdu_session_id
);
supi64
,
dnn
.
c_str
(),
snssai
.
sST
,
snssai
.
sD
.
c_str
(),
pdu_session_id
);
//TODO: temporary disable this action to test with AMF
/*
//trigger to send reply to AMF
//trigger to send reply to AMF
trigger_http_response
(
trigger_http_response(
http_status_code_e::HTTP_STATUS_CODE_406_NOT_ACCEPTABLE, smreq->pid,
http_status_code_e::HTTP_STATUS_CODE_406_NOT_ACCEPTABLE, smreq->pid,
N11_SESSION_CREATE_SM_CONTEXT_RESPONSE);
N11_SESSION_CREATE_SM_CONTEXT_RESPONSE);
return;
return;
*/
}
}
//Step 5. create a context for this supi if not existed, otherwise update
//Step 5. create a context for this supi if not existed, otherwise update
...
@@ -1142,14 +1145,14 @@ std::shared_ptr<smf_context> smf_app::supi_2_smf_context(
...
@@ -1142,14 +1145,14 @@ std::shared_ptr<smf_context> smf_app::supi_2_smf_context(
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
smf_app
::
set_supi_2_smf_context
(
const
supi64_t
&
supi
,
void
smf_app
::
set_supi_2_smf_context
(
const
supi64_t
&
supi
,
std
::
shared_ptr
<
smf_context
>
sc
)
{
std
::
shared_ptr
<
smf_context
>
sc
)
{
std
::
shared
_lock
lock
(
m_supi2smf_context
);
std
::
unique
_lock
lock
(
m_supi2smf_context
);
supi2smf_context
[
supi
]
=
sc
;
supi2smf_context
[
supi
]
=
sc
;
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
smf_app
::
set_scid_2_smf_context
(
const
scid_t
&
id
,
void
smf_app
::
set_scid_2_smf_context
(
const
scid_t
&
id
,
std
::
shared_ptr
<
smf_context_ref
>
scf
)
{
std
::
shared_ptr
<
smf_context_ref
>
scf
)
{
std
::
shared
_lock
lock
(
m_scid2smf_context
);
std
::
unique
_lock
lock
(
m_scid2smf_context
);
scid2smf_context
[
id
]
=
scf
;
scid2smf_context
[
id
]
=
scf
;
}
}
...
@@ -1465,7 +1468,7 @@ bool smf_app::get_session_management_subscription_data(
...
@@ -1465,7 +1468,7 @@ bool smf_app::get_session_management_subscription_data(
void
smf_app
::
add_promise
(
void
smf_app
::
add_promise
(
uint32_t
id
,
uint32_t
id
,
boost
::
shared_ptr
<
boost
::
promise
<
pdu_session_create_sm_context_response
>
>
&
p
)
{
boost
::
shared_ptr
<
boost
::
promise
<
pdu_session_create_sm_context_response
>
>
&
p
)
{
std
::
shared
_lock
lock
(
m_sm_context_create_promises
);
std
::
unique
_lock
lock
(
m_sm_context_create_promises
);
sm_context_create_promises
.
emplace
(
id
,
p
);
sm_context_create_promises
.
emplace
(
id
,
p
);
}
}
...
@@ -1473,7 +1476,7 @@ void smf_app::add_promise(
...
@@ -1473,7 +1476,7 @@ void smf_app::add_promise(
void
smf_app
::
add_promise
(
void
smf_app
::
add_promise
(
uint32_t
id
,
uint32_t
id
,
boost
::
shared_ptr
<
boost
::
promise
<
pdu_session_update_sm_context_response
>
>
&
p
)
{
boost
::
shared_ptr
<
boost
::
promise
<
pdu_session_update_sm_context_response
>
>
&
p
)
{
std
::
shared
_lock
lock
(
m_sm_context_update_promises
);
std
::
unique
_lock
lock
(
m_sm_context_update_promises
);
sm_context_update_promises
.
emplace
(
id
,
p
);
sm_context_update_promises
.
emplace
(
id
,
p
);
}
}
...
@@ -1481,7 +1484,7 @@ void smf_app::add_promise(
...
@@ -1481,7 +1484,7 @@ void smf_app::add_promise(
void
smf_app
::
add_promise
(
void
smf_app
::
add_promise
(
uint32_t
id
,
uint32_t
id
,
boost
::
shared_ptr
<
boost
::
promise
<
pdu_session_release_sm_context_response
>
>
&
p
)
{
boost
::
shared_ptr
<
boost
::
promise
<
pdu_session_release_sm_context_response
>
>
&
p
)
{
std
::
shared
_lock
lock
(
m_sm_context_release_promises
);
std
::
unique
_lock
lock
(
m_sm_context_release_promises
);
sm_context_release_promises
.
emplace
(
id
,
p
);
sm_context_release_promises
.
emplace
(
id
,
p
);
}
}
...
...
src/smf_app/smf_config.cpp
View file @
f8300c31
...
@@ -231,22 +231,6 @@ int smf_config::load_interface(const Setting &if_cfg, interface_cfg_t &cfg) {
...
@@ -231,22 +231,6 @@ int smf_config::load_interface(const Setting &if_cfg, interface_cfg_t &cfg) {
return
RETURNok
;
return
RETURNok
;
}
}
//------------------------------------------------------------------------------
int
smf_config
::
load_upf_config
(
const
Setting
&
if_cfg
,
test_upf_cfg_t
&
cfg
)
{
std
::
string
is_test
=
{
};
if_cfg
.
lookupValue
(
SMF_CONFIG_STRING_TEST_UPF_IS_TEST
,
is_test
);
util
::
trim
(
is_test
);
if
(
not
boost
::
iequals
(
is_test
,
"none"
))
{
cfg
.
is_test
=
atoi
(
is_test
.
c_str
());
std
::
string
address
=
{
};
if_cfg
.
lookupValue
(
SMF_CONFIG_STRING_TEST_UPF_GNB_IPV4_ADDRESS
,
address
);
util
::
trim
(
address
);
inet_aton
(
address
.
c_str
(),
&
cfg
.
gnb_addr4
);
}
return
RETURNok
;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
int
smf_config
::
load
(
const
string
&
config_file
)
{
int
smf_config
::
load
(
const
string
&
config_file
)
{
Config
cfg
;
Config
cfg
;
...
@@ -775,13 +759,6 @@ void smf_config::display() {
...
@@ -775,13 +759,6 @@ void smf_config::display() {
inet_ntoa
(
*
((
struct
in_addr
*
)
&
udm_addr
.
ipv4_addr
)));
inet_ntoa
(
*
((
struct
in_addr
*
)
&
udm_addr
.
ipv4_addr
)));
Logger
::
smf_app
().
info
(
" UDM Port ..........: %lu "
,
udm_addr
.
port
);
Logger
::
smf_app
().
info
(
" UDM Port ..........: %lu "
,
udm_addr
.
port
);
Logger
::
smf_app
().
info
(
"- UPF support (test upf)"
);
Logger
::
smf_app
().
info
(
" UPF is test ..........: %lu "
,
test_upf_cfg
.
is_test
);
Logger
::
smf_app
().
info
(
" Gnb Address ..........: %s"
,
inet_ntoa
(
*
((
struct
in_addr
*
)
&
test_upf_cfg
.
gnb_addr4
)));
if
(
local_configuration
)
{
if
(
local_configuration
)
{
Logger
::
smf_app
().
info
(
Logger
::
smf_app
().
info
(
"- "
SMF_CONFIG_STRING_SESSION_MANAGEMENT_SUBSCRIPTION_LIST
":"
);
"- "
SMF_CONFIG_STRING_SESSION_MANAGEMENT_SUBSCRIPTION_LIST
":"
);
...
...
src/smf_app/smf_config.hpp
View file @
f8300c31
...
@@ -108,11 +108,6 @@
...
@@ -108,11 +108,6 @@
#define SMF_CONFIG_STRING_UDM_IPV4_ADDRESS "IPV4_ADDRESS"
#define SMF_CONFIG_STRING_UDM_IPV4_ADDRESS "IPV4_ADDRESS"
#define SMF_CONFIG_STRING_UDM_PORT "PORT"
#define SMF_CONFIG_STRING_UDM_PORT "PORT"
//test_upf
#define SMF_CONFIG_STRING_TEST_UPF "TEST_UPF"
#define SMF_CONFIG_STRING_TEST_UPF_IS_TEST "IS_TEST"
#define SMF_CONFIG_STRING_TEST_UPF_GNB_IPV4_ADDRESS "GNB_IPV4_ADDRESS"
#define SMF_CONFIG_STRING_UPF_LIST "UPF_LIST"
#define SMF_CONFIG_STRING_UPF_LIST "UPF_LIST"
#define SMF_CONFIG_STRING_UPF_IPV4_ADDRESS "IPV4_ADDRESS"
#define SMF_CONFIG_STRING_UPF_IPV4_ADDRESS "IPV4_ADDRESS"
...
@@ -146,11 +141,6 @@ typedef struct interface_cfg_s {
...
@@ -146,11 +141,6 @@ typedef struct interface_cfg_s {
util
::
thread_sched_params
thread_rd_sched_params
;
util
::
thread_sched_params
thread_rd_sched_params
;
}
interface_cfg_t
;
}
interface_cfg_t
;
typedef
struct
test_upf_cfg_s
{
uint8_t
is_test
;
struct
in_addr
gnb_addr4
;
}
test_upf_cfg_t
;
typedef
struct
itti_cfg_s
{
typedef
struct
itti_cfg_s
{
util
::
thread_sched_params
itti_timer_sched_params
;
util
::
thread_sched_params
itti_timer_sched_params
;
util
::
thread_sched_params
n4_sched_params
;
util
::
thread_sched_params
n4_sched_params
;
...
@@ -161,7 +151,6 @@ typedef struct itti_cfg_s {
...
@@ -161,7 +151,6 @@ typedef struct itti_cfg_s {
class
smf_config
{
class
smf_config
{
private:
private:
int
load_itti
(
const
libconfig
::
Setting
&
itti_cfg
,
itti_cfg_t
&
cfg
);
int
load_itti
(
const
libconfig
::
Setting
&
itti_cfg
,
itti_cfg_t
&
cfg
);
int
load_upf_config
(
const
libconfig
::
Setting
&
if_cfg
,
test_upf_cfg_t
&
cfg
);
int
load_interface
(
const
libconfig
::
Setting
&
if_cfg
,
interface_cfg_t
&
cfg
);
int
load_interface
(
const
libconfig
::
Setting
&
if_cfg
,
interface_cfg_t
&
cfg
);
int
load_thread_sched_params
(
int
load_thread_sched_params
(
const
libconfig
::
Setting
&
thread_sched_params_cfg
,
const
libconfig
::
Setting
&
thread_sched_params_cfg
,
...
@@ -177,7 +166,6 @@ class smf_config {
...
@@ -177,7 +166,6 @@ class smf_config {
interface_cfg_t
sbi
;
interface_cfg_t
sbi
;
unsigned
int
sbi_http2_port
;
unsigned
int
sbi_http2_port
;
itti_cfg_t
itti
;
itti_cfg_t
itti
;
test_upf_cfg_t
test_upf_cfg
;
struct
in_addr
default_dnsv4
;
struct
in_addr
default_dnsv4
;
struct
in_addr
default_dns_secv4
;
struct
in_addr
default_dns_secv4
;
...
@@ -286,7 +274,6 @@ class smf_config {
...
@@ -286,7 +274,6 @@ class smf_config {
local_configuration
=
false
;
local_configuration
=
false
;
num_session_management_subscription
=
0
;
num_session_management_subscription
=
0
;
test_upf_cfg
=
{};
for
(
int
i
=
0
;
i
<
SMF_NUM_SESSION_MANAGEMENT_SUBSCRIPTION_MAX
;
i
++
)
{
for
(
int
i
=
0
;
i
<
SMF_NUM_SESSION_MANAGEMENT_SUBSCRIPTION_MAX
;
i
++
)
{
session_management_subscription
[
i
]
=
{};
session_management_subscription
[
i
]
=
{};
...
...
src/smf_app/smf_context.cpp
View file @
f8300c31
...
@@ -1228,11 +1228,14 @@ void smf_context::handle_pdu_session_create_sm_context_request(
...
@@ -1228,11 +1228,14 @@ void smf_context::handle_pdu_session_create_sm_context_request(
sd
->
insert_pdu_session
(
sp
);
sd
->
insert_pdu_session
(
sp
);
}
else
{
}
else
{
Logger
::
smf_app
().
debug
(
"PDU session is already existed!"
);
Logger
::
smf_app
().
debug
(
"PDU session is already existed!"
);
//TODO: temporary disable this action to test with AMF
/*
//trigger to send reply to AMF
//trigger to send reply to AMF
smf_app_inst->trigger_http_response(
smf_app_inst->trigger_http_response(
http_status_code_e::HTTP_STATUS_CODE_406_NOT_ACCEPTABLE, smreq->pid,
http_status_code_e::HTTP_STATUS_CODE_406_NOT_ACCEPTABLE, smreq->pid,
N11_SESSION_CREATE_SM_CONTEXT_RESPONSE);
N11_SESSION_CREATE_SM_CONTEXT_RESPONSE);
return;
return;
*/
}
}
//TODO: if "Integrity Protection is required", check UE Integrity Protection Maximum Data Rate
//TODO: if "Integrity Protection is required", check UE Integrity Protection Maximum Data Rate
...
...
src/smf_app/smf_n4.cpp
View file @
f8300c31
...
@@ -215,8 +215,13 @@ smf_n4::smf_n4()
...
@@ -215,8 +215,13 @@ smf_n4::smf_n4()
std
::
chrono
::
system_clock
::
now
();
std
::
chrono
::
system_clock
::
now
();
std
::
time_t
now_c
=
std
::
chrono
::
system_clock
::
to_time_t
(
now
);
std
::
time_t
now_c
=
std
::
chrono
::
system_clock
::
to_time_t
(
now
);
std
::
time_t
ellapsed
=
now_c
-
time_epoch
;
std
::
time_t
ellapsed
=
now_c
-
time_epoch
;
recovery_time_stamp
=
ellapsed
;
//
recovery_time_stamp = ellapsed;
//test new way to calculate recovery_time_stamp
std
::
time_t
time_epoch_ntp
=
std
::
time
(
nullptr
);
uint64_t
tv_ntp
=
time_epoch_ntp
+
SECONDS_SINCE_FIRST_EPOCH
;
recovery_time_stamp
=
tv_ntp
;
// TODO may load this from config
// TODO may load this from config
cp_function_features
=
{
};
cp_function_features
=
{
};
cp_function_features
.
ovrl
=
0
;
cp_function_features
.
ovrl
=
0
;
...
@@ -560,9 +565,12 @@ void smf_n4::send_n4_msg(itti_n4_session_report_response &i) {
...
@@ -560,9 +565,12 @@ void smf_n4::send_n4_msg(itti_n4_session_report_response &i) {
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
smf_n4
::
send_heartbeat_request
(
std
::
shared_ptr
<
pfcp_association
>
&
a
)
{
void
smf_n4
::
send_heartbeat_request
(
std
::
shared_ptr
<
pfcp_association
>
&
a
)
{
std
::
time_t
time_epoch
=
std
::
time
(
nullptr
);
uint64_t
tv_ntp
=
time_epoch
+
SECONDS_SINCE_FIRST_EPOCH
;
pfcp
::
pfcp_heartbeat_request
h
=
{
};
pfcp
::
pfcp_heartbeat_request
h
=
{
};
pfcp
::
recovery_time_stamp_t
r
=
{
.
recovery_time_stamp
=
pfcp
::
recovery_time_stamp_t
r
=
{
.
recovery_time_stamp
=
(
uint32_t
)
recovery_time_stam
p
};
(
uint32_t
)
tv_nt
p
};
h
.
set
(
r
);
h
.
set
(
r
);
pfcp
::
node_id_t
&
node_id
=
a
->
node_id
;
pfcp
::
node_id_t
&
node_id
=
a
->
node_id
;
...
...
src/smf_app/smf_procedure.cpp
View file @
f8300c31
...
@@ -154,27 +154,9 @@ int session_create_sm_context_procedure::run(
...
@@ -154,27 +154,9 @@ int session_create_sm_context_procedure::run(
sps
->
generate_far_id
(
far_id
);
sps
->
generate_far_id
(
far_id
);
apply_action
.
forw
=
1
;
//forward the packets
apply_action
.
forw
=
1
;
//forward the packets
//wys-test-add
destination_interface
.
interface_value
=
pfcp
::
INTERFACE_VALUE_CORE
;
// ACCESS is for downlink, CORE for uplink
pfcp
::
outer_header_creation_t
outer_header_creation
=
{
};
forwarding_parameters
.
set
(
destination_interface
);
if
(
smf_cfg
.
test_upf_cfg
.
is_test
)
{
//wys-test-add
destination_interface
.
interface_value
=
pfcp
::
INTERFACE_VALUE_ACCESS
;
// ACCESS is for downlink, CORE for uplink
outer_header_creation
.
teid
=
1
;
//inet_aton("192.168.20.136", &outer_header_creation.ipv4_address);
outer_header_creation
.
ipv4_address
=
smf_cfg
.
test_upf_cfg
.
gnb_addr4
;
outer_header_creation
.
outer_header_creation_description
=
pfcp
::
OUTER_HEADER_CREATION_GTPU_UDP_IPV4
;
forwarding_parameters
.
set
(
outer_header_creation
);
forwarding_parameters
.
set
(
destination_interface
);
}
else
{
destination_interface
.
interface_value
=
pfcp
::
INTERFACE_VALUE_CORE
;
// ACCESS is for downlink, CORE for uplink
forwarding_parameters
.
set
(
destination_interface
);
}
//destination_interface.interface_value = pfcp::INTERFACE_VALUE_CORE; // ACCESS is for downlink, CORE for uplink
//forwarding_parameters.set(destination_interface);
//TODO
//TODO
//Network instance
//Network instance
...
@@ -236,10 +218,6 @@ int session_create_sm_context_procedure::run(
...
@@ -236,10 +218,6 @@ int session_create_sm_context_procedure::run(
create_pdr
.
set
(
pdr_id
);
create_pdr
.
set
(
pdr_id
);
create_pdr
.
set
(
precedence
);
create_pdr
.
set
(
precedence
);
create_pdr
.
set
(
pdi
);
create_pdr
.
set
(
pdi
);
//wys-add-test
//if (smf_cfg.test_upf_cfg.is_test)
// create_pdr.set(outer_header_removal);
create_pdr
.
set
(
outer_header_removal
);
create_pdr
.
set
(
outer_header_removal
);
create_pdr
.
set
(
far_id
);
create_pdr
.
set
(
far_id
);
...
@@ -1346,9 +1324,11 @@ void session_release_sm_context_procedure::handle_itti_msg(
...
@@ -1346,9 +1324,11 @@ void session_release_sm_context_procedure::handle_itti_msg(
problem_details
.
setCause
(
problem_details
.
setCause
(
pdu_session_application_error_e2str
[
PDU_SESSION_APPLICATION_ERROR_NETWORK_FAILURE
]);
pdu_session_application_error_e2str
[
PDU_SESSION_APPLICATION_ERROR_NETWORK_FAILURE
]);
//trigger to send reply to AMF
//trigger to send reply to AMF
/*
smf_app_inst->trigger_http_response(
smf_app_inst->trigger_http_response(
http_status_code_e
::
HTTP_STATUS_CODE_406_NOT_ACCEPTABLE
,
http_status_code_e::HTTP_STATUS_CODE_406_NOT_ACCEPTABLE,
n11_triggered_pending
->
pid
,
N11_SESSION_RELEASE_SM_CONTEXT_RESPONSE
);
n11_triggered_pending->pid, N11_SESSION_RELEASE_SM_CONTEXT_RESPONSE);
*/
}
}
//TODO:
//TODO:
...
...
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