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
b3b67fbe
Commit
b3b67fbe
authored
Sep 08, 2021
by
yangjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update push to smf agent
parent
fcc61f82
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
258 additions
and
0 deletions
+258
-0
etc/smf-unicom-nwdaf.conf
etc/smf-unicom-nwdaf.conf
+137
-0
src/smf_app/smf_config.cpp
src/smf_app/smf_config.cpp
+22
-0
src/smf_app/smf_config.hpp
src/smf_app/smf_config.hpp
+10
-0
src/smf_app/smf_procedure.cpp
src/smf_app/smf_procedure.cpp
+89
-0
No files found.
etc/smf-unicom-nwdaf.conf
0 → 100644
View file @
b3b67fbe
################################################################################
# Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The OpenAirInterface Software Alliance licenses this file to You under
# the OAI Public License, Version 1.1 (the "License"); you may not use this file
# except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.openairinterface.org/?page_id=698
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#-------------------------------------------------------------------------------
# For more information about the OpenAirInterface (OAI) Software Alliance:
# contact@openairinterface.org
################################################################################
SMF
=
{
INSTANCE
=
10
;
# 0 is the default
PID_DIRECTORY
=
"/var/run"
;
# /var/run is the default
INTERFACES
:
{
N4
:
{
# SMF binded interface for N4 communication (UPF)
INTERFACE_NAME
=
"ens32"
;
# YOUR NETWORK CONFIG HERE
IPV4_ADDRESS
=
"read"
;
PORT
=
8805
;
};
SBI
:
{
# SMF binded interface for SBI interface (e.g., communication with AMF, UDM)
INTERFACE_NAME
=
"ens32"
;
# YOUR NETWORK CONFIG HERE
IPV4_ADDRESS
=
"read"
;
PORT
=
8889
;
# YOUR NETWORK CONFIG HERE (default: 80)
HTTP2_PORT
=
8890
;
# YOUR NETWORK CONFIG HERE
API_VERSION
=
"v2"
;
# YOUR SMF API VERSION CONFIG HERE
};
};
# Pool of UE assigned IP addresses
# Do not make IP pools overlap
# first IPv4 address X.Y.Z.1 is reserved for GTP network device on UPF
IP_ADDRESS_POOL
:
{
IPV4_LIST
= (
{
RANGE
=
"192.169.0.200 - 192.169.0.253"
;},
# STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE.
{
RANGE
=
"192.169.0.3 - 192.169.255.253"
;}
# STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE.
);
IPV6_LIST
= (
{
PREFIX
=
"2001:1:2::/64"
;},
# STRING, IPv6 prefix, YOUR NETWORK CONFIG HERE.
{
PREFIX
=
"3001:1:2::/64"
;}
# STRING, IPv6 prefix, YOUR NETWORK CONFIG HERE.
);
};
DNN_LIST
= (
# IPV4_POOL, IPV6_POOL are index in IPV4_LIST, IPV6_LIST, PDU_SESSION_TYPE choice in {IPv4, IPv6, IPv4v6}
{
DNN_NI
=
"IMS"
;
PDU_SESSION_TYPE
=
"IPv4v6"
;
IPV4_POOL
=
0
;
IPV6_POOL
=
0
},
{
DNN_NI
=
"internet"
;
PDU_SESSION_TYPE
=
"IPv4"
;
IPV4_POOL
=
1
;
IPV6_POOL
= -
1
},
{
DNN_NI
=
"ctnet"
;
PDU_SESSION_TYPE
=
"IPv4v6"
;
IPV4_POOL
=
1
;
IPV6_POOL
=
1
}
);
# DNS address communicated to UEs
DEFAULT_DNS_IPV4_ADDRESS
=
"114.114.114.114"
;
# YOUR DNS CONFIG HERE
DEFAULT_DNS_SEC_IPV4_ADDRESS
=
"114.114.114.114"
;
# YOUR DNS CONFIG HERE
DEFAULT_DNS_IPV6_ADDRESS
=
"2001:4860:4860::8888"
;
# YOUR DNS CONFIG HERE
DEFAULT_DNS_SEC_IPV6_ADDRESS
=
"2001:4860:4860::8844"
;
# YOUR DNS CONFIG HERE
SUPPORT_FEATURES
:
{
# STRING, {"yes", "no"},
REGISTER_NRF
=
"no"
;
# Set to yes if SMF resgisters to an NRF
DISCOVER_UPF
=
"no"
;
# Set to yes to enable UPF discovery and selection
FORCE_PUSH_PROTOCOL_CONFIGURATION_OPTIONS
=
"no"
;
# Non standard feature, normally should be set to "no",
# but you may need to set to yes for UE that do not explicitly request a PDN address through NAS signalling
USE_LOCAL_SUBSCRIPTION_INFO
=
"yes"
;
# Set to yes if SMF uses local subscription information instead of from an UDM
}
AMF
:
{
IPV4_ADDRESS
=
"192.168.2.35"
;
# YOUR AMF CONFIG HERE
PORT
=
8282
;
# YOUR AMF CONFIG HERE (default: 80)
API_VERSION
=
"v2"
;
# YOUR AMF API VERSION FOR SBI CONFIG HERE
};
UDM
:
{
IPV4_ADDRESS
=
"192.168.2.35"
;
# YOUR UDM CONFIG HERE
PORT
=
8181
;
# YOUR UDM CONFIG HERE (default: 80)
API_VERSION
=
"v2"
;
# YOUR UDM API VERSION FOR SBI CONFIG HERE
};
NRF
:
{
IPV4_ADDRESS
=
"192.168.12.100"
;
# YOUR NRF CONFIG HERE
PORT
=
80
;
# YOUR NRF CONFIG HERE (default: 80)
API_VERSION
=
"v1"
;
# YOUR NRF API VERSION FOR SBI CONFIG HERE
};
AGENT
:
{
ENABLE
=
0
;
# enable: (0, enable; 1: not enable)
URL
=
"http://192.168.2.35:10001/namf-event-exposure/bridge"
;
# YOUR AGENT URL
};
UPF_LIST
= (
{
IPV4_ADDRESS
=
"192.168.10.10"
;}
# YOUR UPF CONFIG HERE
);
LOCAL_CONFIGURATION
:
{
USE_LOCAL_CONFIGURATION
=
"yes"
;
SESSION_MANAGEMENT_SUBSCRIPTION_LIST
= (
{
NSSAI_SST
=
1
,
NSSAI_SD
=
"0"
,
DNN
=
"IMS"
,
DEFAULT_SESSION_TYPE
=
"IPV4V6"
,
DEFAULT_SSC_MODE
=
1
,
QOS_PROFILE_5QI
=
5
,
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
=
1
,
NSSAI_SD
=
"0"
,
DNN
=
"ctnet"
,
DEFAULT_SESSION_TYPE
=
"IPV4V6"
,
DEFAULT_SSC_MODE
=
1
,
QOS_PROFILE_5QI
=
9
,
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
=
"100Mbps"
,
SESSION_AMBR_DL
=
"110Mbps"
},
{
NSSAI_SST
=
1
;
NSSAI_SD
=
"0"
,
DNN
=
"internet"
,
DEFAULT_SESSION_TYPE
=
"IPV4"
,
DEFAULT_SSC_MODE
=
1
,
QOS_PROFILE_5QI
=
9
,
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
=
"100Mbps"
,
SESSION_AMBR_DL
=
"110Mbps"
}
);
};
};
src/smf_app/smf_config.cpp
View file @
b3b67fbe
...
...
@@ -632,6 +632,28 @@ int smf_config::load(const string& config_file) {
}
udm_addr
.
api_version
=
udm_api_version
;
//AGENT
const
Setting
&
agent_cfg
=
smf_cfg
[
SMF_CONFIG_STRING_AGENT
];
unsigned
int
agent_enable
=
0
;
std
::
string
agent_url
;
//enable
if
(
!
(
agent_cfg
.
lookupValue
(
SMF_CONFIG_STRING_AGENT_ENABLE
,
agent_enable
)))
{
Logger
::
smf_app
().
error
(
SMF_CONFIG_STRING_AGENT_ENABLE
"failed"
);
throw
(
SMF_CONFIG_STRING_AGENT_ENABLE
"failed"
);
}
agent
.
enable
=
agent_enable
;
//URL
if
(
!
(
agent_cfg
.
lookupValue
(
SMF_CONFIG_STRING_AGENT_URL
,
agent_url
)))
{
Logger
::
smf_app
().
error
(
SMF_CONFIG_STRING_AGENT_URL
"failed"
);
throw
(
SMF_CONFIG_STRING_AGENT_URL
"failed"
);
}
agent
.
url
=
agent_url
;
// UPF list
unsigned
char
buf_in_addr
[
sizeof
(
struct
in_addr
)
+
1
];
const
Setting
&
upf_list_cfg
=
smf_cfg
[
SMF_CONFIG_STRING_UPF_LIST
];
...
...
src/smf_app/smf_config.hpp
View file @
b3b67fbe
...
...
@@ -106,6 +106,10 @@
#define SMF_CONFIG_STRING_UPF_LIST "UPF_LIST"
#define SMF_CONFIG_STRING_UPF_IPV4_ADDRESS "IPV4_ADDRESS"
#define SMF_CONFIG_STRING_AGENT "AGENT"
#define SMF_CONFIG_STRING_AGENT_ENABLE "ENABLE"
#define SMF_CONFIG_STRING_AGENT_URL "URL"
#define SMF_CONFIG_STRING_NRF "NRF"
#define SMF_CONFIG_STRING_NRF_IPV4_ADDRESS "IPV4_ADDRESS"
#define SMF_CONFIG_STRING_NRF_PORT "PORT"
...
...
@@ -238,6 +242,12 @@ class smf_config {
std
::
string
api_version
;
}
nrf_addr
;
struct
{
unsigned
int
enable
;
//default 0
std
::
string
url
;
}
agent
;
#define SMF_NUM_SESSION_MANAGEMENT_SUBSCRIPTION_MAX 5
struct
{
snssai_t
single_nssai
;
...
...
src/smf_app/smf_procedure.cpp
View file @
b3b67fbe
...
...
@@ -58,6 +58,14 @@ extern itti_mw* itti_inst;
extern
smf
::
smf_app
*
smf_app_inst
;
extern
smf
::
smf_config
smf_cfg
;
static
std
::
size_t
agent_http_callback
(
const
char
*
in
,
std
::
size_t
size
,
std
::
size_t
num
,
std
::
string
*
out
)
{
const
std
::
size_t
totalBytes
(
size
*
num
);
out
->
append
(
in
,
totalBytes
);
return
totalBytes
;
}
//------------------------------------------------------------------------------
int
n4_session_restore_procedure
::
run
()
{
if
(
pending_sessions
.
size
())
{
...
...
@@ -504,6 +512,87 @@ void session_create_sm_context_procedure::handle_itti_msg(
"Could not send ITTI message %s to task TASK_SMF_SBI"
,
n11_triggered_pending
->
get_msg_name
());
}
if
(
smf_cfg
.
agent
.
enable
)
{
//add it to nwdaf->agent in 20210906
nlohmann
::
json
smf_agent_json_data
=
{};
smf_agent_json_data
[
"supi"
]
=
supi_str
.
c_str
();
struct
in_addr
ue_addr
=
n11_triggered_pending
->
res
.
get_paa
().
ipv4_address
;
smf_agent_json_data
[
"adIpv4Addr"
]
=
(
char
*
)
inet_ntoa
(
ue_addr
);
smf_agent_json_data
[
"pduSeId"
]
=
n11_triggered_pending
->
res
.
get_pdu_session_id
();
if
(
n11_triggered_pending
->
res
.
get_pdu_session_type
()
==
PDU_SESSION_TYPE_E_IPV4
||
n11_triggered_pending
->
res
.
get_pdu_session_type
()
==
PDU_SESSION_TYPE_E_IPV4V6
)
smf_agent_json_data
[
"pduSessType"
]
=
"Ipv4"
;
//If no DNN information from UE, set to default value
std
::
string
dnn
=
n11_trigger
.
get
()
->
req
.
get_dnn
();
if
(
dnn
.
length
()
==
0
)
{
dnn
=
smf_cfg
.
get_default_dnn
();
}
smf_agent_json_data
[
"dnn"
]
=
dnn
.
c_str
();
std
::
string
agent_req_data
=
smf_agent_json_data
.
dump
();
std
::
string
agent_http_url
=
"http://192.168.2.170:9999"
;
unsigned
char
*
data
=
(
unsigned
char
*
)
malloc
(
agent_req_data
.
length
()
+
1
);
memset
(
data
,
0
,
agent_req_data
.
length
()
+
1
);
memcpy
((
void
*
)
data
,
(
void
*
)
agent_req_data
.
c_str
(),
agent_req_data
.
length
());
curl_global_init
(
CURL_GLOBAL_ALL
);
CURL
*
curl
=
curl
=
curl_easy_init
();
if
(
curl
)
{
CURLcode
res
=
{};
struct
curl_slist
*
headers
=
nullptr
;
// headers = curl_slist_append(headers, "charsets: utf-8");
headers
=
curl_slist_append
(
headers
,
"content-type: multipart/related; boundary=----Boundary"
);
curl_easy_setopt
(
curl
,
CURLOPT_HTTPHEADER
,
headers
);
curl_easy_setopt
(
curl
,
CURLOPT_URL
,
agent_http_url
.
c_str
());
curl_easy_setopt
(
curl
,
CURLOPT_HTTPGET
,
1
);
curl_easy_setopt
(
curl
,
CURLOPT_TIMEOUT_MS
,
100L
);
// curl_easy_setopt(curl, CURLOPT_INTERFACE, "eno1:amf"); //hardcoded
// Response information.
long
httpCode
=
{
0
};
std
::
unique_ptr
<
std
::
string
>
httpData
(
new
std
::
string
());
curl_easy_setopt
(
curl
,
CURLOPT_WRITEFUNCTION
,
&
agent_http_callback
);
curl_easy_setopt
(
curl
,
CURLOPT_WRITEDATA
,
httpData
.
get
());
curl_easy_setopt
(
curl
,
CURLOPT_POSTFIELDSIZE
,
agent_req_data
.
length
());
curl_easy_setopt
(
curl
,
CURLOPT_POSTFIELDS
,
data
);
res
=
curl_easy_perform
(
curl
);
curl_easy_getinfo
(
curl
,
CURLINFO_RESPONSE_CODE
,
&
httpCode
);
// get cause from the response
nlohmann
::
json
response_data
;
try
{
response_data
=
nlohmann
::
json
::
parse
(
*
httpData
.
get
());
}
catch
(
nlohmann
::
json
::
exception
&
e
)
{
std
::
cout
<<
"Could not get json data from the response"
<<
std
::
endl
;
}
std
::
cout
<<
"[AGENT ] , response from "
"AGENT, Http Code "
<<
httpCode
<<
std
::
endl
;
curl_easy_cleanup
(
curl
);
}
curl_global_cleanup
();
free
(
data
);
}
}
//------------------------------------------------------------------------------
...
...
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