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
b4cdc378
Commit
b4cdc378
authored
Sep 15, 2020
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get API version from configuration file
parent
873ca5a7
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
111 additions
and
39 deletions
+111
-39
build/scripts/smf_conf.sh
build/scripts/smf_conf.sh
+3
-0
ci-scripts/generateConfigFiles.py
ci-scripts/generateConfigFiles.py
+7
-1
etc/smf.conf
etc/smf.conf
+9
-6
src/api-server/api/IndividualPDUSessionHSMFApi.cpp
src/api-server/api/IndividualPDUSessionHSMFApi.cpp
+5
-2
src/api-server/api/IndividualPDUSessionHSMFApi.h
src/api-server/api/IndividualPDUSessionHSMFApi.h
+2
-2
src/api-server/api/IndividualSMContextApi.cpp
src/api-server/api/IndividualSMContextApi.cpp
+6
-3
src/api-server/api/IndividualSMContextApi.h
src/api-server/api/IndividualSMContextApi.h
+1
-1
src/api-server/api/PDUSessionsCollectionApi.cpp
src/api-server/api/PDUSessionsCollectionApi.cpp
+4
-1
src/api-server/api/PDUSessionsCollectionApi.h
src/api-server/api/PDUSessionsCollectionApi.h
+1
-1
src/api-server/api/SMContextsCollectionApi.cpp
src/api-server/api/SMContextsCollectionApi.cpp
+4
-1
src/api-server/api/SMContextsCollectionApi.h
src/api-server/api/SMContextsCollectionApi.h
+1
-1
src/api-server/smf-http2-server.cpp
src/api-server/smf-http2-server.cpp
+6
-3
src/common/smf.h
src/common/smf.h
+8
-5
src/smf_app/smf_config.cpp
src/smf_app/smf_config.cpp
+38
-10
src/smf_app/smf_config.hpp
src/smf_app/smf_config.hpp
+10
-2
src/smf_app/smf_context.cpp
src/smf_app/smf_context.cpp
+3
-0
src/smf_app/smf_n10.cpp
src/smf_app/smf_n10.cpp
+1
-0
src/smf_app/smf_procedure.cpp
src/smf_app/smf_procedure.cpp
+2
-0
No files found.
build/scripts/smf_conf.sh
View file @
b4cdc378
...
...
@@ -17,12 +17,15 @@ SMF_CONF[@SMF_INTERFACE_NAME_FOR_SBI@]='ens3'
SMF_CONF[@SMF_INTERFACE_PORT_FOR_SBI@]
=
'80'
SMF_CONF[@SMF_INTERFACE_HTTP2_PORT_FOR_SBI@]
=
'9090'
SMF_CONF[@SMF_API_VERSION@]
=
'v1'
SMF_CONF[@UDM_IPV4_ADDRESS@]
=
'172.16.1.103'
SMF_CONF[@UDM_PORT@]
=
'80'
SMF_CONF[@UDM_API_VERSION@]
=
'v2'
SMF_CONF[@AMF_IPV4_ADDRESS@]
=
'192.168.122.183'
SMF_CONF[@AMF_PORT@]
=
'80'
SMF_CONF[@AMF_API_VERSION@]
=
'v1'
SMF_CONF[@UPF_IPV4_ADDRESS@]
=
'192.168.122.151'
...
...
ci-scripts/generateConfigFiles.py
View file @
b4cdc378
...
...
@@ -30,11 +30,14 @@ class smfConfigGen():
self
.
sbi_name
=
''
self
.
sbi_port
=
'80'
self
.
sbi_http2_port
=
'9090'
self
.
sbi_api_version
=
'v1'
self
.
n4_name
=
''
self
.
amf_ip_addr
=
''
self
.
amf_port
=
'80'
self
.
amf_api_version
=
'v1'
self
.
udm_ip_addr
=
''
self
.
udm_port
=
'80'
self
.
udm_api_version
=
'v2'
self
.
upf_ip_addr
=
''
self
.
apn
=
'carrier.com'
self
.
dns1_ip
=
'192.168.18.129'
...
...
@@ -71,14 +74,17 @@ class smfConfigGen():
smfFile
.
write
(
'SMF_CONF[@SMF_INTERFACE_NAME_FOR_SBI@]=
\'
'
+
self
.
sbi_name
+
'
\'\n
'
)
smfFile
.
write
(
'SMF_CONF[@SMF_INTERFACE_PORT_FOR_SBI@]='
+
self
.
sbi_port
+
'
\n
'
)
smfFile
.
write
(
'SMF_CONF[@SMF_INTERFACE_HTTP2_PORT_FOR_SBI@]='
+
self
.
sbi_http2_port
+
'
\n
'
)
smfFile
.
write
(
'SMF_CONF[@SMF_INTERFACE_NAME_FOR_N4@]=
\'
'
+
self
.
n4_name
+
'
\'\n
'
)
smfFile
.
write
(
'SMF_CONF[@SMF_INTERFACE_NAME_FOR_SBI@]=
\'
'
+
self
.
sbi_name
+
'
\'\n
'
)
smfFile
.
write
(
'SMF_CONF[@SMF_API_VERSION@]=
\'
'
+
self
.
sbi_api_version
+
'
\'\n
'
)
smfFile
.
write
(
'SMF_CONF[@DEFAULT_DNS_IPV4_ADDRESS@]=$MY_PRIMARY_DNS
\n
'
)
smfFile
.
write
(
'SMF_CONF[@DEFAULT_DNS_SEC_IPV4_ADDRESS@]=$MY_SECONDARY_DNS
\n
'
)
#smfFile.write('SMF_CONF[@DEFAULT_APN@]=$MY_APN\n')
smfFile
.
write
(
'SMF_CONF[@AMF_IPV4_ADDRESS@]=
\'
'
+
self
.
amf_ip_addr
+
'
\'\n
'
)
smfFile
.
write
(
'SMF_CONF[@AMF_PORT@]='
+
self
.
amf_port
+
'
\n
'
)
smfFile
.
write
(
'SMF_CONF[@AMF_API_VERSION@]=
\'
'
+
self
.
amf_api_version
+
'
\'\n
'
)
smfFile
.
write
(
'SMF_CONF[@UDM_IPV4_ADDRESS@]=
\'
'
+
self
.
udm_ip_addr
+
'
\'\n
'
)
smfFile
.
write
(
'SMF_CONF[@UDM_PORT@]='
+
self
.
udm_port
+
'
\n
'
)
smfFile
.
write
(
'SMF_CONF[@UDM_API_VERSION@]=
\'
'
+
self
.
udm_api_version
+
'
\'\n
'
)
smfFile
.
write
(
'SMF_CONF[@UPF_IPV4_ADDRESS@]=
\'
'
+
self
.
upf_ip_addr
+
'
\'\n
'
)
smfFile
.
write
(
'
\n
'
)
smfFile
.
write
(
'for K in "${!SMF_CONF[@]}"; do
\n
'
)
...
...
etc/smf.conf
View file @
b4cdc378
...
...
@@ -40,6 +40,7 @@ SMF =
IPV4_ADDRESS
=
"read"
;
PORT
= @
SMF_INTERFACE_PORT_FOR_SBI
@;
# YOUR NETWORK CONFIG HERE (default: 80)
HTTP2_PORT
= @
SMF_INTERFACE_HTTP2_PORT_FOR_SBI
@;
# YOUR NETWORK CONFIG HERE
API_VERSION
=
"@SMF_API_VERSION@"
;
# YOUR SMF API VERSION CONFIG HERE
};
};
...
...
@@ -84,25 +85,27 @@ SMF =
AMF
:
{
IPV4_ADDRESS
=
"@AMF_IPV4_ADDRESS@"
;
# YOUR AMF CONFIG HERE
PORT
= @
AMF_PORT
@;
# YOUR AMF CONFIG HERE (default: 80)
IPV4_ADDRESS
=
"@AMF_IPV4_ADDRESS@"
;
# YOUR AMF CONFIG HERE
PORT
= @
AMF_PORT
@;
# YOUR AMF CONFIG HERE (default: 80)
API_VERSION
=
"@AMF_API_VERSION@"
;
# YOUR SMF API VERSION FOR SBI CONFIG HERE
};
UDM
:
{
IPV4_ADDRESS
=
"@UDM_IPV4_ADDRESS@"
;
# YOUR UDM CONFIG HERE
PORT
= @
UDM_PORT
@;
# YOUR UDM CONFIG HERE (default: 80)
IPV4_ADDRESS
=
"@UDM_IPV4_ADDRESS@"
;
# YOUR UDM CONFIG HERE
PORT
= @
UDM_PORT
@;
# YOUR UDM CONFIG HERE (default: 80)
API_VERSION
=
"@UDM_API_VERSION@"
;
# YOUR UDM API VERSION FOR SBI CONFIG HERE
};
UPF_LIST
= (
{
IPV4_ADDRESS
=
"@UPF_IPV4_ADDRESS@"
;}
# YOUR UPF CONFIG HERE
{
IPV4_ADDRESS
=
"@UPF_IPV4_ADDRESS@"
;}
# YOUR UPF CONFIG HERE
);
LOCAL_CONFIGURATION
:
{
USE_LOCAL_CONFIGURATION
=
"yes"
;
SESSION_MANAGEMENT_SUBSCRIPTION_LIST
= (
{
NSSAI_SST
=
222
;
NSSAI_SD
=
"123"
,
DNN
=
"default"
,
DEFAULT_SESSION_TYPE
=
"IPV4"
,
DEFAULT_SSC_MODE
=
1
,
{
NSSAI_SST
=
222
,
NSSAI_SD
=
"123"
,
DNN
=
"default"
,
DEFAULT_SESSION_TYPE
=
"IPV4"
,
DEFAULT_SSC_MODE
=
1
,
QOS_PROFILE_5QI
=
6
,
QOS_PROFILE_PRIORITY_LEVEL
=
1
,
QOS_PROFILE_ARP_PRIORITY_LEVEL
=
1
,
QOS_PROFILE_ARP_PREEMPTCAP
=
"NOT_PREEMPT"
,
QOS_PROFILE_ARP_PREEMPTVULN
=
"NOT_PREEMPTABLE"
,
SESSION_AMBR_UL
=
"20Mbps"
,
SESSION_AMBR_DL
=
"22Mbps"
},
{
NSSAI_SST
=
222
;
NSSAI_SD
=
"123"
,
DNN
=
"carrier.com"
,
DEFAULT_SESSION_TYPE
=
"IPV4"
,
DEFAULT_SSC_MODE
=
1
,
...
...
src/api-server/api/IndividualPDUSessionHSMFApi.cpp
View file @
b4cdc378
...
...
@@ -12,6 +12,9 @@
#include "IndividualPDUSessionHSMFApi.h"
#include "Helpers.h"
#include "smf_config.hpp"
extern
smf
::
smf_config
smf_cfg
;
namespace
oai
{
namespace
smf_server
{
...
...
@@ -34,12 +37,12 @@ void IndividualPDUSessionHSMFApi::setupRoutes() {
Routes
::
Post
(
*
router
,
base
+
"/pdu-sessions/:pduSessionRef/release"
,
base
+
smf_cfg
.
sbi_api_version
+
"/pdu-sessions/:pduSessionRef/release"
,
Routes
::
bind
(
&
IndividualPDUSessionHSMFApi
::
release_pdu_session_handler
,
this
));
Routes
::
Post
(
*
router
,
base
+
"/pdu-sessions/:pduSessionRef/modify"
,
base
+
smf_cfg
.
sbi_api_version
+
"/pdu-sessions/:pduSessionRef/modify"
,
Routes
::
bind
(
&
IndividualPDUSessionHSMFApi
::
update_pdu_session_handler
,
this
));
...
...
src/api-server/api/IndividualPDUSessionHSMFApi.h
View file @
b4cdc378
...
...
@@ -18,6 +18,7 @@
#ifndef IndividualPDUSessionHSMFApi_H_
#define IndividualPDUSessionHSMFApi_H_
#include <string>
#include <pistache/http.h>
#include <pistache/router.h>
#include <pistache/http_headers.h>
...
...
@@ -28,7 +29,6 @@
#include "HsmfUpdatedData.h"
#include "ProblemDetails.h"
#include "ReleaseData.h"
#include <string>
namespace
oai
{
namespace
smf_server
{
...
...
@@ -43,7 +43,7 @@ class IndividualPDUSessionHSMFApi {
}
void
init
();
const
std
::
string
base
=
"/nsmf-pdusession/
v2
"
;
const
std
::
string
base
=
"/nsmf-pdusession/"
;
private:
void
setupRoutes
();
...
...
src/api-server/api/IndividualSMContextApi.cpp
View file @
b4cdc378
...
...
@@ -44,6 +44,9 @@
#include "logger.hpp"
#include "Helpers.h"
#include "mime_parser.hpp"
#include "smf_config.hpp"
extern
smf
::
smf_config
smf_cfg
;
namespace
oai
{
namespace
smf_server
{
...
...
@@ -65,13 +68,13 @@ void IndividualSMContextApi::setupRoutes() {
using
namespace
Pistache
::
Rest
;
Routes
::
Post
(
*
router
,
base
+
"/sm-contexts/:smContextRef/release"
,
*
router
,
base
+
smf_cfg
.
sbi_api_version
+
"/sm-contexts/:smContextRef/release"
,
Routes
::
bind
(
&
IndividualSMContextApi
::
release_sm_context_handler
,
this
));
Routes
::
Post
(
*
router
,
base
+
"/sm-contexts/:smContextRef/retrieve"
,
*
router
,
base
+
smf_cfg
.
sbi_api_version
+
"/sm-contexts/:smContextRef/retrieve"
,
Routes
::
bind
(
&
IndividualSMContextApi
::
retrieve_sm_context_handler
,
this
));
Routes
::
Post
(
*
router
,
base
+
"/sm-contexts/:smContextRef/modify"
,
*
router
,
base
+
smf_cfg
.
sbi_api_version
+
"/sm-contexts/:smContextRef/modify"
,
Routes
::
bind
(
&
IndividualSMContextApi
::
update_sm_context_handler
,
this
));
// Default handler, called when a route is not found
...
...
src/api-server/api/IndividualSMContextApi.h
View file @
b4cdc378
...
...
@@ -71,7 +71,7 @@ class IndividualSMContextApi {
}
void
init
();
const
std
::
string
base
=
"/nsmf-pdusession/
v2
"
;
const
std
::
string
base
=
"/nsmf-pdusession/"
;
private:
void
setupRoutes
();
...
...
src/api-server/api/PDUSessionsCollectionApi.cpp
View file @
b4cdc378
...
...
@@ -12,6 +12,9 @@
#include "PDUSessionsCollectionApi.h"
#include "Helpers.h"
#include "smf_config.hpp"
extern
smf
::
smf_config
smf_cfg
;
namespace
oai
{
namespace
smf_server
{
...
...
@@ -33,7 +36,7 @@ void PDUSessionsCollectionApi::setupRoutes() {
using
namespace
Pistache
::
Rest
;
Routes
::
Post
(
*
router
,
base
+
"/pdu-sessions"
,
*
router
,
base
+
smf_cfg
.
sbi_api_version
+
"/pdu-sessions"
,
Routes
::
bind
(
&
PDUSessionsCollectionApi
::
post_pdu_sessions_handler
,
this
));
// Default handler, called when a route is not found
...
...
src/api-server/api/PDUSessionsCollectionApi.h
View file @
b4cdc378
...
...
@@ -41,7 +41,7 @@ class PDUSessionsCollectionApi {
}
void
init
();
const
std
::
string
base
=
"/nsmf-pdusession/
v2
"
;
const
std
::
string
base
=
"/nsmf-pdusession/"
;
private:
void
setupRoutes
();
...
...
src/api-server/api/SMContextsCollectionApi.cpp
View file @
b4cdc378
...
...
@@ -44,6 +44,9 @@
#include "logger.hpp"
#include "Helpers.h"
#include "mime_parser.hpp"
#include "smf_config.hpp"
extern
smf
::
smf_config
smf_cfg
;
namespace
oai
{
namespace
smf_server
{
...
...
@@ -65,7 +68,7 @@ void SMContextsCollectionApi::setupRoutes() {
using
namespace
Pistache
::
Rest
;
Routes
::
Post
(
*
router
,
base
+
"/sm-contexts"
,
*
router
,
base
+
smf_cfg
.
sbi_api_version
+
"/sm-contexts"
,
Routes
::
bind
(
&
SMContextsCollectionApi
::
post_sm_contexts_handler
,
this
));
// Default handler, called when a route is not found
...
...
src/api-server/api/SMContextsCollectionApi.h
View file @
b4cdc378
...
...
@@ -62,7 +62,7 @@ class SMContextsCollectionApi {
}
void
init
();
const
std
::
string
base
=
"/nsmf-pdusession/
v2
"
;
const
std
::
string
base
=
"/nsmf-pdusession/"
;
private:
void
setupRoutes
();
...
...
src/api-server/smf-http2-server.cpp
View file @
b4cdc378
...
...
@@ -40,18 +40,21 @@
#include "3gpp_29.502.h"
#include "mime_parser.hpp"
#include "3gpp_29.500.h"
#include "smf_config.hpp"
using
namespace
nghttp2
::
asio_http2
;
using
namespace
nghttp2
::
asio_http2
::
server
;
using
namespace
oai
::
smf_server
::
model
;
extern
smf
::
smf_config
smf_cfg
;
//------------------------------------------------------------------------------
void
smf_http2_server
::
start
()
{
boost
::
system
::
error_code
ec
;
Logger
::
smf_api_server
().
info
(
"HTTP2 server started"
);
//Create SM Context Request
server
.
handle
(
NSMF_PDU_SESSION_SM_CONTEXT_CREATE_URL
,
server
.
handle
(
NSMF_PDU_SESSION_
BASE
+
smf_cfg
.
sbi_api_version
+
NSMF_PDU_SESSION_
SM_CONTEXT_CREATE_URL
,
[
&
](
const
request
&
request
,
const
response
&
response
)
{
request
.
on_data
([
&
](
const
uint8_t
*
data
,
std
::
size_t
len
)
{
...
...
@@ -131,7 +134,7 @@ void smf_http2_server::start() {
});
//Update SM Context Request
server
.
handle
(
NSMF_PDU_SESSION_SM_CONTEXT_UPDATE_URL
,
server
.
handle
(
NSMF_PDU_SESSION_
BASE
+
smf_cfg
.
sbi_api_version
+
NSMF_PDU_SESSION_
SM_CONTEXT_UPDATE_URL
,
[
&
](
const
request
&
request
,
const
response
&
response
)
{
request
.
on_data
([
&
](
const
uint8_t
*
data
,
std
::
size_t
len
)
{
...
...
@@ -292,7 +295,7 @@ void smf_http2_server::create_sm_contexts_handler(
//set api root to be used as location header in HTTP response
sm_context_req_msg
.
set_api_root
(
m_address
+
":"
+
std
::
to_string
(
m_port
)
+
"/nsmf-pdusession/
v2
/sm-context"
);
+
"/nsmf-pdusession/
"
+
smf_cfg
.
sbi_api_version
+
"
/sm-context"
);
//supi
supi_t
supi
=
{
.
length
=
0
};
...
...
src/common/smf.h
View file @
b4cdc378
...
...
@@ -179,14 +179,17 @@ typedef struct qos_profile_s {
}
qos_profile_t
;
//URL, N1, N2 (may get from configuration file)
#define NAMF_COMMUNICATION_N1N2_MESSAGE_TRANSFER_URL "/namf-comm/v2/ue-contexts/{}/n1-n2-messages" //context id
#define NUDM_SDM_GET_SM_DATA_URL "/nudm-sdm/v2/{}/sm-data" //ue Id
#define NAMF_COMMUNICATION_BASE "/namf-comm/"
#define NAMF_COMMUNICATION_N1N2_MESSAGE_TRANSFER_URL "/ue-contexts/{}/n1-n2-messages" //context id
#define NUDM_SDM_BASE "/nudm-sdm/"
#define NUDM_SDM_GET_SM_DATA_URL "/{}/sm-data" //ue Id
#define N1_SM_CONTENT_ID "n1SmMsg"
#define N1N2_MESSAGE_CLASS "SM"
#define N2_SM_CONTENT_ID "n2msg"
#define NSMF_CALLBACK_N1N2_MESSAGE_TRANSFER_FAILURE "/nsmf-pdusession/v2/callback/N1N2MsgTxfrFailureNotification/{}" //UE Id
#define NSMF_PDU_SESSION_SM_CONTEXT_CREATE_URL "/nsmf-pdusession/v2/sm-contexts"
#define NSMF_PDU_SESSION_SM_CONTEXT_UPDATE_URL "/nsmf-pdusession/v2/sm-contexts/"
#define NSMF_PDU_SESSION_BASE "/nsmf-pdusession/"
#define NSMF_CALLBACK_N1N2_MESSAGE_TRANSFER_FAILURE "/callback/N1N2MsgTxfrFailureNotification/{}" //UE Id
#define NSMF_PDU_SESSION_SM_CONTEXT_CREATE_URL "/sm-contexts"
#define NSMF_PDU_SESSION_SM_CONTEXT_UPDATE_URL "/sm-contexts/"
//for CURL
...
...
src/smf_app/smf_config.cpp
View file @
b4cdc378
...
...
@@ -286,15 +286,21 @@ int smf_config::load(const string &config_file) {
const
Setting
&
n4_cfg
=
nw_if_cfg
[
SMF_CONFIG_STRING_INTERFACE_N4
];
load_interface
(
n4_cfg
,
n4
);
const
Setting
&
n11
_cfg
=
nw_if_cfg
[
SMF_CONFIG_STRING_INTERFACE_SBI
];
load_interface
(
n11
_cfg
,
sbi
);
const
Setting
&
sbi
_cfg
=
nw_if_cfg
[
SMF_CONFIG_STRING_INTERFACE_SBI
];
load_interface
(
sbi
_cfg
,
sbi
);
//HTTP2 port
if
(
!
(
n11
_cfg
.
lookupValue
(
SMF_CONFIG_STRING_SBI_HTTP2_PORT
,
sbi_http2_port
)))
{
if
(
!
(
sbi
_cfg
.
lookupValue
(
SMF_CONFIG_STRING_SBI_HTTP2_PORT
,
sbi_http2_port
)))
{
Logger
::
smf_app
().
error
(
SMF_CONFIG_STRING_SBI_HTTP2_PORT
"failed"
);
throw
(
SMF_CONFIG_STRING_SBI_HTTP2_PORT
"failed"
);
}
//SBI API VERSION
if
(
!
(
sbi_cfg
.
lookupValue
(
SMF_CONFIG_STRING_API_VERSION
,
sbi_api_version
)))
{
Logger
::
smf_app
().
error
(
SMF_CONFIG_STRING_API_VERSION
"failed"
);
throw
(
SMF_CONFIG_STRING_API_VERSION
"failed"
);
}
}
catch
(
const
SettingNotFoundException
&
nfex
)
{
Logger
::
smf_app
().
error
(
"%s : %s"
,
nfex
.
what
(),
nfex
.
getPath
());
return
RETURNerror
;
...
...
@@ -495,9 +501,11 @@ int smf_config::load(const string &config_file) {
}
smf_cfg
.
lookupValue
(
SMF_CONFIG_STRING_UE_MTU
,
ue_mtu
);
//AMF
const
Setting
&
amf_cfg
=
smf_cfg
[
SMF_CONFIG_STRING_AMF
];
struct
in_addr
amf_ipv4_addr
;
unsigned
int
amf_port
=
0
;
std
::
string
amf_api_version
;
amf_cfg
.
lookupValue
(
SMF_CONFIG_STRING_AMF_IPV4_ADDRESS
,
astring
);
IPV4_STR_ADDR_TO_INADDR
(
util
::
trim
(
astring
).
c_str
(),
amf_ipv4_addr
,
"BAD IPv4 ADDRESS FORMAT FOR AMF !"
);
...
...
@@ -508,9 +516,17 @@ int smf_config::load(const string &config_file) {
}
amf_addr
.
port
=
amf_port
;
if
(
!
(
amf_cfg
.
lookupValue
(
SMF_CONFIG_STRING_API_VERSION
,
amf_api_version
)))
{
Logger
::
smf_app
().
error
(
SMF_CONFIG_STRING_API_VERSION
"failed"
);
throw
(
SMF_CONFIG_STRING_API_VERSION
"failed"
);
}
amf_addr
.
api_version
=
amf_api_version
;
//UDM
const
Setting
&
udm_cfg
=
smf_cfg
[
SMF_CONFIG_STRING_UDM
];
struct
in_addr
udm_ipv4_addr
;
unsigned
int
udm_port
=
0
;
std
::
string
udm_api_version
;
udm_cfg
.
lookupValue
(
SMF_CONFIG_STRING_UDM_IPV4_ADDRESS
,
astring
);
IPV4_STR_ADDR_TO_INADDR
(
util
::
trim
(
astring
).
c_str
(),
udm_ipv4_addr
,
"BAD IPv4 ADDRESS FORMAT FOR UDM !"
);
...
...
@@ -521,6 +537,13 @@ int smf_config::load(const string &config_file) {
}
udm_addr
.
port
=
udm_port
;
if
(
!
(
udm_cfg
.
lookupValue
(
SMF_CONFIG_STRING_API_VERSION
,
udm_api_version
)))
{
Logger
::
smf_app
().
error
(
SMF_CONFIG_STRING_API_VERSION
"failed"
);
throw
(
SMF_CONFIG_STRING_API_VERSION
"failed"
);
}
udm_addr
.
api_version
=
udm_api_version
;
//UPF list
unsigned
char
buf_in_addr
[
sizeof
(
struct
in_addr
)
+
1
];
const
Setting
&
upf_list_cfg
=
smf_cfg
[
SMF_CONFIG_STRING_UPF_LIST
];
...
...
@@ -746,17 +769,22 @@ void smf_config::display() {
}
}
Logger
::
smf_app
().
info
(
"- AMF:"
);
Logger
::
smf_app
().
info
(
" Address..........: %s"
,
inet_ntoa
(
*
((
struct
in_addr
*
)
&
amf_addr
.
ipv4_addr
)));
Logger
::
smf_app
().
info
(
" Port ..........: %lu "
,
amf_addr
.
port
);
Logger
::
smf_app
().
info
(
" API Version.....: %s "
,
amf_addr
.
api_version
);
Logger
::
smf_app
().
info
(
"- UDM:"
);
Logger
::
smf_app
().
info
(
" Address ..........: %s"
,
inet_ntoa
(
*
((
struct
in_addr
*
)
&
udm_addr
.
ipv4_addr
)));
Logger
::
smf_app
().
info
(
" Port ..........: %lu "
,
udm_addr
.
port
);
Logger
::
smf_app
().
info
(
" API Version.....: %s "
,
udm_addr
.
api_version
);
Logger
::
smf_app
().
info
(
"- Helpers:"
);
Logger
::
smf_app
().
info
(
" Push PCO (DNS+MTU) ........: %s"
,
force_push_pco
==
0
?
"false"
:
"true"
);
Logger
::
smf_app
().
info
(
" AMF Address..........: %s"
,
inet_ntoa
(
*
((
struct
in_addr
*
)
&
amf_addr
.
ipv4_addr
)));
Logger
::
smf_app
().
info
(
" AMF Port ..........: %lu "
,
amf_addr
.
port
);
Logger
::
smf_app
().
info
(
" UDM ..........: %s"
,
inet_ntoa
(
*
((
struct
in_addr
*
)
&
udm_addr
.
ipv4_addr
)));
Logger
::
smf_app
().
info
(
" UDM Port ..........: %lu "
,
udm_addr
.
port
);
if
(
local_configuration
)
{
Logger
::
smf_app
().
info
(
"- "
SMF_CONFIG_STRING_SESSION_MANAGEMENT_SUBSCRIPTION_LIST
":"
);
...
...
src/smf_app/smf_config.hpp
View file @
b4cdc378
...
...
@@ -54,6 +54,8 @@
#define SMF_CONFIG_STRING_INTERFACE_N4 "N4"
#define SMF_CONFIG_STRING_INTERFACE_SBI "SBI"
#define SMF_CONFIG_STRING_SBI_HTTP2_PORT "HTTP2_PORT"
#define SMF_CONFIG_STRING_API_VERSION "API_VERSION"
#define SMF_CONFIG_STRING_NAS_FORCE_PUSH_PCO "FORCE_PUSH_PROTOCOL_CONFIGURATION_OPTIONS"
...
...
@@ -161,6 +163,7 @@ class smf_config {
interface_cfg_t
n4
;
interface_cfg_t
sbi
;
unsigned
int
sbi_http2_port
;
std
::
string
sbi_api_version
;
itti_cfg_t
itti
;
struct
in_addr
default_dnsv4
;
...
...
@@ -198,11 +201,13 @@ class smf_config {
struct
{
struct
in_addr
ipv4_addr
;
unsigned
int
port
;
std
::
string
api_version
;
}
amf_addr
;
struct
{
struct
in_addr
ipv4_addr
;
unsigned
int
port
;
std
::
string
api_version
;
}
udm_addr
;
std
::
vector
<
pfcp
::
node_id_t
>
upfs
;
...
...
@@ -265,8 +270,10 @@ class smf_config {
amf_addr
.
ipv4_addr
.
s_addr
=
INADDR_ANY
;
amf_addr
.
port
=
80
;
amf_addr
.
ipv4_addr
.
s_addr
=
INADDR_ANY
;
amf_addr
.
api_version
=
"v1"
;
udm_addr
.
ipv4_addr
.
s_addr
=
INADDR_ANY
;
udm_addr
.
port
=
80
;
udm_addr
.
api_version
=
"v1"
;
local_configuration
=
false
;
num_session_management_subscription
=
0
;
...
...
@@ -274,7 +281,8 @@ class smf_config {
for
(
int
i
=
0
;
i
<
SMF_NUM_SESSION_MANAGEMENT_SUBSCRIPTION_MAX
;
i
++
)
{
session_management_subscription
[
i
]
=
{};
}
sbi_http2_port
=
0
;
sbi_http2_port
=
8080
;
sbi_api_version
=
"v1"
;
}
;
...
...
src/smf_app/smf_context.cpp
View file @
b4cdc378
...
...
@@ -709,6 +709,7 @@ void smf_context::handle_itti_msg(
std
::
string
url
=
std
::
string
(
inet_ntoa
(
*
((
struct
in_addr
*
)
&
smf_cfg
.
amf_addr
.
ipv4_addr
)))
+
":"
+
std
::
to_string
(
smf_cfg
.
amf_addr
.
port
)
+
NAMF_COMMUNICATION_BASE
+
smf_cfg
.
amf_addr
.
api_version
+
fmt
::
format
(
NAMF_COMMUNICATION_N1N2_MESSAGE_TRANSFER_URL
,
supi_str
.
c_str
());
session_report_msg
.
set_amf_url
(
url
);
...
...
@@ -1461,6 +1462,7 @@ void smf_context::handle_pdu_session_create_sm_context_request(
std
::
string
url
=
std
::
string
(
inet_ntoa
(
*
((
struct
in_addr
*
)
&
smf_cfg
.
amf_addr
.
ipv4_addr
)))
+
":"
+
std
::
to_string
(
smf_cfg
.
amf_addr
.
port
)
+
NAMF_COMMUNICATION_BASE
+
smf_cfg
.
amf_addr
.
api_version
+
fmt
::
format
(
NAMF_COMMUNICATION_N1N2_MESSAGE_TRANSFER_URL
,
supi_str
.
c_str
());
sm_context_resp_pending
->
res
.
set_amf_url
(
url
);
...
...
@@ -2650,6 +2652,7 @@ void smf_context::handle_pdu_session_modification_network_requested(
std
::
string
url
=
std
::
string
(
inet_ntoa
(
*
((
struct
in_addr
*
)
&
smf_cfg
.
amf_addr
.
ipv4_addr
)))
+
":"
+
std
::
to_string
(
smf_cfg
.
amf_addr
.
port
)
+
NAMF_COMMUNICATION_BASE
+
smf_cfg
.
amf_addr
.
api_version
+
fmt
::
format
(
NAMF_COMMUNICATION_N1N2_MESSAGE_TRANSFER_URL
,
supi_str
.
c_str
());
itti_msg
->
msg
.
set_amf_url
(
url
);
...
...
src/smf_app/smf_n10.cpp
View file @
b4cdc378
...
...
@@ -117,6 +117,7 @@ bool smf_n10::get_sm_data(
std
::
string
url
=
std
::
string
(
inet_ntoa
(
*
((
struct
in_addr
*
)
&
smf_cfg
.
udm_addr
.
ipv4_addr
)))
+
":"
+
std
::
to_string
(
smf_cfg
.
udm_addr
.
port
)
+
NUDM_SDM_BASE
+
smf_cfg
.
udm_addr
.
api_version
+
fmt
::
format
(
NUDM_SDM_GET_SM_DATA_URL
,
std
::
to_string
(
supi
));
Logger
::
smf_n10
().
debug
(
"UDM's URL: %s "
,
url
.
c_str
());
...
...
src/smf_app/smf_procedure.cpp
View file @
b4cdc378
...
...
@@ -425,6 +425,7 @@ void session_create_sm_context_procedure::handle_itti_msg(
std
::
string
url
=
std
::
string
(
inet_ntoa
(
*
((
struct
in_addr
*
)
&
smf_cfg
.
amf_addr
.
ipv4_addr
)))
+
":"
+
std
::
to_string
(
smf_cfg
.
amf_addr
.
port
)
+
NAMF_COMMUNICATION_BASE
+
smf_cfg
.
amf_addr
.
api_version
+
fmt
::
format
(
NAMF_COMMUNICATION_N1N2_MESSAGE_TRANSFER_URL
,
supi_str
.
c_str
());
n11_triggered_pending
->
res
.
set_amf_url
(
url
);
...
...
@@ -459,6 +460,7 @@ void session_create_sm_context_procedure::handle_itti_msg(
std
::
string
callback_uri
=
std
::
string
(
inet_ntoa
(
*
((
struct
in_addr
*
)
&
smf_cfg
.
amf_addr
.
ipv4_addr
)))
+
":"
+
std
::
to_string
(
smf_cfg
.
amf_addr
.
port
)
+
NSMF_PDU_SESSION_BASE
+
smf_cfg
.
sbi_api_version
+
fmt
::
format
(
NSMF_CALLBACK_N1N2_MESSAGE_TRANSFER_FAILURE
,
supi_str
.
c_str
());
json_data
[
"n1n2FailureTxfNotifURI"
]
=
callback_uri
.
c_str
();
...
...
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