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-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-AMF-Simple
Commits
e93b4cab
Commit
e93b4cab
authored
Aug 18, 2020
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
store smf created location
parent
624cdca0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
5 deletions
+29
-5
src/amf-app/amf_n11.cpp
src/amf-app/amf_n11.cpp
+24
-1
src/contexts/pdu_session_context.hpp
src/contexts/pdu_session_context.hpp
+1
-0
src/sbi/amf_server/impl/N1N2MessageCollectionDocumentApiImpl.cpp
.../amf_server/impl/N1N2MessageCollectionDocumentApiImpl.cpp
+4
-4
No files found.
src/amf-app/amf_n11.cpp
View file @
e93b4cab
...
...
@@ -160,7 +160,9 @@ void amf_n11::handle_itti_message(itti_nsmf_pdusession_update_sm_context &itti_m
smf_selection_from_context
(
smf_addr
);
}
//TODO:Remove hardcoded value (1 - SCID)
std
::
string
remote_uri
=
smf_addr
+
"/nsmf-pdusession/v1/sm-contexts/"
+
"imsi-208950000000031-1"
+
"/modify"
;
//scid
//std::string remote_uri = smf_addr + "/nsmf-pdusession/v1/sm-contexts/" + "imsi-208950000000031-1" + "/modify"; //scid
std
::
string
remote_uri
=
smf_addr
+
psc
.
get
()
->
smf_context_location
+
"/modify"
;
//scid
nlohmann
::
json
pdu_session_update_request
;
pdu_session_update_request
[
"n2SmInfoType"
]
=
"PDU_RES_SETUP_RSP"
;
pdu_session_update_request
[
"n2SmInfo"
][
"contentId"
]
=
"n2SmMsg"
;
...
...
@@ -316,6 +318,15 @@ void amf_n11::handle_post_sm_context_response_error(long code, std::string cause
//------------------------------------------------------------------------------
void
amf_n11
::
curl_http_client
(
std
::
string
remoteUri
,
std
::
string
jsonData
,
std
::
string
n1SmMsg
,
std
::
string
n2SmMsg
,
std
::
string
supi
,
uint8_t
pdu_session_id
)
{
Logger
::
amf_n11
().
debug
(
"Call SMF service: %s"
,
remoteUri
.
c_str
());
std
::
shared_ptr
<
pdu_session_context
>
psc
;
if
(
is_supi_to_pdu_ctx
(
supi
))
{
psc
=
supi_to_pdu_ctx
(
supi
);
}
else
{
Logger
::
amf_n11
().
warn
(
"PDU Session context for SUPI %s doesn't exit!"
,
supi
.
c_str
());
//TODO:
}
CURL
*
curl
=
curl_easy_init
();
if
(
curl
)
{
CURLcode
res
;
...
...
@@ -362,10 +373,12 @@ void amf_n11::curl_http_client(std::string remoteUri, std::string jsonData, std:
// Response information.
long
httpCode
(
0
);
std
::
unique_ptr
<
std
::
string
>
httpData
(
new
std
::
string
());
std
::
unique_ptr
<
std
::
string
>
httpHeaderData
(
new
std
::
string
());
// Hook up data handling function.
curl_easy_setopt
(
curl
,
CURLOPT_WRITEFUNCTION
,
&
callback
);
curl_easy_setopt
(
curl
,
CURLOPT_WRITEDATA
,
httpData
.
get
());
curl_easy_setopt
(
curl
,
CURLOPT_HEADERDATA
,
httpHeaderData
.
get
());
res
=
curl_easy_perform
(
curl
);
curl_easy_getinfo
(
curl
,
CURLINFO_RESPONSE_CODE
,
&
httpCode
);
...
...
@@ -388,6 +401,16 @@ void amf_n11::curl_http_client(std::string remoteUri, std::string jsonData, std:
if
(
!
(
multipart_parser
(
response
,
jsonData
,
n1sm
,
n2sm
)))
{
Logger
::
amf_n11
().
error
(
"Could not get the cause from the response"
);
}
}
else
{
//TODO: store location of created context
std
::
string
header_response
=
*
httpHeaderData
.
get
();
std
::
string
CRLF
=
"
\r\n
"
;
std
::
size_t
location_pos
=
header_response
.
find
(
"Location"
);
std
::
size_t
crlf_pos
=
header_response
.
find
(
CRLF
,
location_pos
);
std
::
string
location
=
header_response
.
substr
(
location_pos
+
8
,
crlf_pos
-
(
location_pos
+
8
));
Logger
::
amf_n11
().
info
(
"Location: %s"
,
location
.
c_str
());
psc
.
get
()
->
smf_context_location
=
location
;
}
nlohmann
::
json
response_data
;
bstring
n1sm_hex
;
...
...
src/contexts/pdu_session_context.hpp
View file @
e93b4cab
...
...
@@ -48,5 +48,6 @@ class pdu_session_context {
bool
smf_available
;
snssai_t
snssai
;
plmn_t
plmn
;
std
::
string
smf_context_location
;
};
#endif
src/sbi/amf_server/impl/N1N2MessageCollectionDocumentApiImpl.cpp
View file @
e93b4cab
...
...
@@ -36,7 +36,7 @@ N1N2MessageCollectionDocumentApiImpl::N1N2MessageCollectionDocumentApiImpl(std::
void
N1N2MessageCollectionDocumentApiImpl
::
n1_n2_message_transfer
(
const
std
::
string
&
ueContextId
,
const
N1N2MessageTransferReqData
&
n1N2MessageTransferReqData
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
Logger
::
amf_server
().
debug
(
"Response OK"
);
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
"N1N2MessageCollectionDocumentApiImpl::n1_n2_message_transfer API has not been implemented yet!
\n
"
);
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
"N1N2MessageCollectionDocumentApiImpl::n1_n2_message_transfer API has not been implemented yet!"
);
}
void
N1N2MessageCollectionDocumentApiImpl
::
n1_n2_message_transfer
(
const
std
::
string
&
ueContextId
,
const
N1N2MessageTransferReqData
&
n1N2MessageTransferReqData
,
std
::
string
&
n1sm_str
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
...
...
@@ -45,7 +45,7 @@ void N1N2MessageCollectionDocumentApiImpl::n1_n2_message_transfer(const std::str
bstring
n1sm
;
msg_str_2_msg_hex
(
n1sm_str
,
n1sm
);
print_buffer
(
"amf_server"
,
"Received N1 SM"
,
(
uint8_t
*
)
bdata
(
n1sm
),
blength
(
n1sm
));
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
"N1N2MessageCollectionDocumentApiImpl::n1_n2_message_transfer API has not been implemented yet!
\n
"
);
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
"N1N2MessageCollectionDocumentApiImpl::n1_n2_message_transfer API has not been implemented yet!"
);
}
void
N1N2MessageCollectionDocumentApiImpl
::
n1_n2_message_transfer
(
const
std
::
string
&
ueContextId
,
const
N1N2MessageTransferReqData
&
n1N2MessageTransferReqData
,
std
::
string
&
n1sm_str
,
std
::
string
&
n2sm_str
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
...
...
@@ -53,12 +53,12 @@ void N1N2MessageCollectionDocumentApiImpl::n1_n2_message_transfer(const std::str
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
"OK"
);
std
::
string
supi
=
ueContextId
;
Logger
::
amf_server
().
debug
(
"Key for PDU Session context:
supi
(%s)"
,
supi
.
c_str
());
Logger
::
amf_server
().
debug
(
"Key for PDU Session context:
SUPI
(%s)"
,
supi
.
c_str
());
std
::
shared_ptr
<
pdu_session_context
>
psc
;
if
(
amf_n11_inst
->
is_supi_to_pdu_ctx
(
supi
)){
psc
=
amf_n11_inst
->
supi_to_pdu_ctx
(
supi
);
}
else
{
Logger
::
amf_server
().
error
(
"Cannot get pdu_session_context with
supi
(%s)"
,
supi
.
c_str
());
Logger
::
amf_server
().
error
(
"Cannot get pdu_session_context with
SUPI
(%s)"
,
supi
.
c_str
());
}
bstring
n1sm
;
...
...
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