Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-UDM
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-UDM
Commits
fe588a4c
Commit
fe588a4c
authored
Feb 08, 2021
by
lanzhongwen
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://git.opensource5g.org/openxg/udm
parents
1f378dec
9477c7e6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
1 deletion
+48
-1
src/impl/SubscriptionCreationApiImpl.cpp
src/impl/SubscriptionCreationApiImpl.cpp
+48
-1
No files found.
src/impl/SubscriptionCreationApiImpl.cpp
View file @
fe588a4c
...
@@ -12,6 +12,12 @@
...
@@ -12,6 +12,12 @@
*/
*/
#include "SubscriptionCreationApiImpl.h"
#include "SubscriptionCreationApiImpl.h"
#include "udm_config.hpp"
#include "logger.hpp"
#include "curl.hpp"
using
namespace
config
;
extern
config
::
udm_config
udm_cfg
;
namespace
oai
{
namespace
oai
{
namespace
udm
{
namespace
udm
{
...
@@ -26,7 +32,48 @@ SubscriptionCreationApiImpl::SubscriptionCreationApiImpl(
...
@@ -26,7 +32,48 @@ SubscriptionCreationApiImpl::SubscriptionCreationApiImpl(
void
SubscriptionCreationApiImpl
::
subscribe
(
void
SubscriptionCreationApiImpl
::
subscribe
(
const
std
::
string
&
supi
,
const
SdmSubscription
&
sdmSubscription
,
const
std
::
string
&
supi
,
const
SdmSubscription
&
sdmSubscription
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
Pistache
::
Http
::
ResponseWriter
&
response
)
{
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
"Do some magic
\n
"
);
std
::
string
udr_ip
=
std
::
string
(
inet_ntoa
(
*
((
struct
in_addr
*
)
&
udm_cfg
.
nudr
.
addr4
)));
std
::
string
udr_port
=
std
::
to_string
(
udm_cfg
.
nudr
.
port
);
std
::
string
remoteUri
;
std
::
string
Method
;
std
::
string
msgBody
;
std
::
string
Response
;
nlohmann
::
json
j_ProblemDetails
;
ProblemDetails
m_ProblemDetails
;
// UDR GET interface ----- get 3gpp_registration related info--------------------
remoteUri
=
udr_ip
+
":"
+
udr_port
+
"/nudr-dr/v2/subscription-data/"
+
supi
+
"/context-data/sdm-subscriptions"
;
Logger
::
udm_uecm
().
debug
(
"POST Request:"
+
remoteUri
);
Method
=
"POST"
;
nlohmann
::
json
sdmSubscription_j
;
to_json
(
sdmSubscription_j
,
sdmSubscription
);
long
http_code
;
http_code
=
Curl
::
curl_http_client
(
remoteUri
,
Method
,
sdmSubscription_j
.
dump
(),
Response
);
nlohmann
::
json
response_data
=
{};
try
{
Logger
::
udm_uecm
().
debug
(
"POST Reponse:"
+
Response
);
response_data
=
nlohmann
::
json
::
parse
(
Response
.
c_str
());
}
catch
(
nlohmann
::
json
::
exception
&
e
)
{
// error handling
Logger
::
udm_uecm
().
info
(
"Could not get Json content from UDR response"
);
m_ProblemDetails
.
setCause
(
"USER_NOT_FOUND"
);
m_ProblemDetails
.
setStatus
(
404
);
m_ProblemDetails
.
setDetail
(
"User "
+
supi
+
" not found in Database"
);
to_json
(
j_ProblemDetails
,
m_ProblemDetails
);
Logger
::
udm_uecm
().
error
(
"User "
+
supi
+
" not found in Database"
);
Logger
::
udm_uecm
().
info
(
"Send 404 Not_Found response to client"
);
response
.
send
(
Pistache
::
Http
::
Code
::
Not_Found
,
j_ProblemDetails
.
dump
());
return
;
}
Logger
::
udm_uecm
().
debug
(
"http reponse code %d.
\n
"
,
http_code
);
response
.
send
(
static_cast
<
Pistache
::
Http
::
Code
>
(
http_code
),
sdmSubscription_j
.
dump
());
}
}
}
// namespace api
}
// namespace api
...
...
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