Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-AMF
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
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-AMF
Commits
0d62a2be
Unverified
Commit
0d62a2be
authored
3 years ago
by
kharade
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use psc->smf_port for sm_context setup
parent
613b7d11
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
19 deletions
+26
-19
src/amf-app/amf_n11.cpp
src/amf-app/amf_n11.cpp
+24
-17
src/amf-app/amf_n11.hpp
src/amf-app/amf_n11.hpp
+2
-2
No files found.
src/amf-app/amf_n11.cpp
View file @
0d62a2be
...
...
@@ -205,12 +205,14 @@ void amf_n11::handle_itti_message(
}
std
::
string
smf_addr
=
{};
std
::
string
smf_port
=
{};
std
::
string
smf_api_version
=
{};
if
(
!
psc
.
get
()
->
smf_available
)
{
Logger
::
amf_n11
().
error
(
"No SMF is available for this PDU session"
);
}
else
{
smf_addr
=
psc
->
smf_addr
;
smf_port
=
psc
->
smf_port
;
smf_api_version
=
psc
->
smf_api_version
;
}
...
...
@@ -228,7 +230,8 @@ void amf_n11::handle_itti_message(
if
(
found
!=
std
::
string
::
npos
)
remote_uri
=
psc
.
get
()
->
smf_context_location
+
"/modify"
;
else
remote_uri
=
smf_addr
+
psc
.
get
()
->
smf_context_location
+
"/modify"
;
remote_uri
=
smf_addr
+
":"
+
smf_port
+
psc
.
get
()
->
smf_context_location
+
"/modify"
;
Logger
::
amf_n11
().
debug
(
"SMF URI: %s"
,
remote_uri
.
c_str
());
...
...
@@ -253,7 +256,7 @@ void amf_n11::handle_itti_message(
std
::
string
json_part
=
pdu_session_update_request
.
dump
();
uint8_t
http_version
=
1
;
//
if (amf_cfg.support_features.use_http2) http_version = 2;
if
(
amf_cfg
.
support_features
.
use_http2
)
http_version
=
2
;
curl_http_client
(
remote_uri
,
json_part
,
""
,
n2SmMsg
,
supi
,
itti_msg
.
pdu_session_id
,
...
...
@@ -334,8 +337,8 @@ void amf_n11::handle_itti_message(itti_nsmf_pdusession_create_sm_context& smf) {
psc
.
get
()
->
dnn
=
dnn
;
std
::
string
smf_addr
=
{};
std
::
string
smf_port
=
{};
std
::
string
smf_api_version
=
{};
std
::
string
smf_port
=
"80"
;
// Set to default port number
if
(
!
psc
.
get
()
->
smf_available
)
{
if
(
amf_cfg
.
support_features
.
enable_nrf_selection
)
{
if
(
!
discover_smf_from_nsi_info
(
...
...
@@ -376,7 +379,7 @@ void amf_n11::handle_itti_message(itti_nsmf_pdusession_create_sm_context& smf) {
"Decoded PTI for PDUSessionEstablishmentRequest(0x%x)"
,
pti
);
psc
.
get
()
->
isn2sm_avaliable
=
false
;
handle_pdu_session_initial_request
(
supi
,
psc
,
smf_addr
,
smf_api_version
,
smf
.
sm_msg
,
dnn
);
supi
,
psc
,
smf_addr
,
smf_api_version
,
smf
_port
,
smf
.
sm_msg
,
dnn
);
}
break
;
case
EXISTING_PDU_SESSION
:
{
// TODO:
...
...
@@ -399,8 +402,8 @@ void amf_n11::send_pdu_session_update_sm_context_request(
std
::
string
smf_addr
,
bstring
sm_msg
,
std
::
string
dnn
)
{
Logger
::
amf_n11
().
debug
(
"Send PDU Session Update SM Context Request to SMF (SUPI %s, PDU Session "
"ID %d)"
,
supi
.
c_str
(),
psc
.
get
()
->
pdu_session_id
);
"ID %d
, %s
)"
,
supi
.
c_str
(),
psc
.
get
()
->
pdu_session_id
,
smf_addr
.
c_str
()
);
std
::
string
smf_ip_addr
=
{};
std
::
string
remote_uri
=
{};
...
...
@@ -427,7 +430,7 @@ void amf_n11::send_pdu_session_update_sm_context_request(
octet_stream_2_hex_stream
((
uint8_t
*
)
bdata
(
sm_msg
),
blength
(
sm_msg
),
n1SmMsg
);
uint8_t
http_version
=
1
;
if
(
amf_cfg
.
support_features
.
use_http2
)
http_version
=
2
;
//
if (amf_cfg.support_features.use_http2) http_version = 2;
curl_http_client
(
remote_uri
,
json_part
,
n1SmMsg
,
""
,
supi
,
psc
.
get
()
->
pdu_session_id
,
...
...
@@ -437,15 +440,20 @@ void amf_n11::send_pdu_session_update_sm_context_request(
//------------------------------------------------------------------------------
void
amf_n11
::
handle_pdu_session_initial_request
(
std
::
string
supi
,
std
::
shared_ptr
<
pdu_session_context
>
psc
,
std
::
string
smf_addr
,
std
::
string
smf_api_version
,
bstring
sm_msg
,
std
::
string
dnn
)
{
std
::
string
smf_addr
,
std
::
string
smf_api_version
,
std
::
string
smf_port
,
bstring
sm_msg
,
std
::
string
dnn
)
{
Logger
::
amf_n11
().
debug
(
"Handle PDU Session Establishment Request (SUPI %s, PDU Session ID %d)"
,
supi
.
c_str
(),
psc
.
get
()
->
pdu_session_id
);
// TODO: Remove hardcoded values
std
::
string
remote_uri
=
smf_addr
+
"/nsmf-pdusession/"
+
smf_api_version
+
"/sm-contexts"
;
std
::
string
amf_port
=
to_string
(
amf_cfg
.
n11
.
port
);
if
(
amf_cfg
.
support_features
.
use_http2
)
amf_port
=
to_string
(
amf_cfg
.
sbi_http2_port
);
std
::
string
remote_uri
=
smf_addr
+
":"
+
smf_port
+
"/nsmf-pdusession/"
+
smf_api_version
+
"/sm-contexts"
;
nlohmann
::
json
pdu_session_establishment_request
;
pdu_session_establishment_request
[
"supi"
]
=
supi
.
c_str
();
pdu_session_establishment_request
[
"pei"
]
=
"imei-200000000000001"
;
...
...
@@ -465,8 +473,8 @@ void amf_n11::handle_pdu_session_initial_request(
pdu_session_establishment_request
[
"anType"
]
=
"3GPP_ACCESS"
;
// TODO
pdu_session_establishment_request
[
"smContextStatusUri"
]
=
"http://"
+
std
::
string
(
inet_ntoa
(
*
((
struct
in_addr
*
)
&
amf_cfg
.
n11
.
addr4
)))
+
"/nsmf-pdusession/callback/"
+
supi
+
"/"
+
std
::
string
(
inet_ntoa
(
*
((
struct
in_addr
*
)
&
amf_cfg
.
n11
.
addr4
)))
+
":"
+
amf_port
+
"/nsmf-pdusession/callback/"
+
supi
+
"/"
+
std
::
to_string
(
psc
.
get
()
->
pdu_session_id
);
pdu_session_establishment_request
[
"n1MessageContainer"
][
"n1MessageClass"
]
=
...
...
@@ -482,7 +490,7 @@ void amf_n11::handle_pdu_session_initial_request(
octet_stream_2_hex_stream
((
uint8_t
*
)
bdata
(
sm_msg
),
blength
(
sm_msg
),
n1SmMsg
);
uint8_t
http_version
=
1
;
//
if (amf_cfg.support_features.use_http2) http_version = 2;
if
(
amf_cfg
.
support_features
.
use_http2
)
http_version
=
2
;
curl_http_client
(
remote_uri
,
json_part
,
n1SmMsg
,
""
,
supi
,
psc
.
get
()
->
pdu_session_id
,
...
...
@@ -1172,10 +1180,9 @@ bool amf_n11::discover_smf(
if
(
result
)
break
;
}
}
if
(
smf_port
.
empty
())
smf_port
=
'
80
'
;
Logger
::
amf_n11
().
debug
(
"NFDiscovery, SMF Addr: %s, SMF Api Version: %s, SMF Port: %
d
"
,
smf_addr
.
c_str
(),
smf_api_version
.
c_str
(),
smf_port
);
"NFDiscovery, SMF Addr: %s, SMF Api Version: %s, SMF Port: %
s
"
,
smf_addr
.
c_str
(),
smf_api_version
.
c_str
(),
smf_port
.
c_str
()
);
}
else
{
Logger
::
amf_n11
().
warn
(
"NFDiscovery, could not get response from NRF"
);
result
=
false
;
...
...
This diff is collapsed.
Click to expand it.
src/amf-app/amf_n11.hpp
View file @
0d62a2be
...
...
@@ -53,8 +53,8 @@ class amf_n11 {
void
handle_itti_message
(
itti_nsmf_pdusession_create_sm_context
&
);
void
handle_pdu_session_initial_request
(
std
::
string
supi
,
std
::
shared_ptr
<
pdu_session_context
>
psc
,
std
::
string
smf_addr
,
std
::
string
smf_api_version
,
bstring
sm_msg
,
std
::
string
dnn
);
std
::
string
smf_addr
,
std
::
string
smf_api_version
,
std
::
string
smf_port
,
bstring
sm_msg
,
std
::
string
dnn
);
void
handle_itti_message
(
itti_nsmf_pdusession_update_sm_context
&
itti_msg
);
void
handle_itti_message
(
itti_nsmf_pdusession_release_sm_context
&
itti_msg
);
void
handle_itti_message
(
itti_pdu_session_resource_setup_response
&
itti_msg
);
...
...
This diff is collapsed.
Click to expand it.
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