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
c1f61317
Commit
c1f61317
authored
Feb 08, 2021
by
Fang-WANG
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://git.opensource5g.org/openxg/udm
parents
008d8bb5
4d9570e7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
3 deletions
+44
-3
README.md
README.md
+1
-2
src/impl/SliceSelectionSubscriptionDataRetrievalApiImpl.cpp
src/impl/SliceSelectionSubscriptionDataRetrievalApiImpl.cpp
+43
-1
No files found.
README.md
View file @
c1f61317
# OpenXG-UDM
OpenXG-UDM Arch
```
├── build: Build directory, contains targets and object files generated by compilation of network functions.
...
...
src/impl/SliceSelectionSubscriptionDataRetrievalApiImpl.cpp
View file @
c1f61317
...
...
@@ -12,6 +12,12 @@
*/
#include "SliceSelectionSubscriptionDataRetrievalApiImpl.h"
#include "udm_config.hpp"
#include "logger.hpp"
#include "curl.hpp"
using
namespace
config
;
extern
config
::
udm_config
udm_cfg
;
namespace
oai
{
namespace
udm
{
...
...
@@ -31,7 +37,43 @@ void SliceSelectionSubscriptionDataRetrievalApiImpl::get_nssai(
const
Pistache
::
Optional
<
Pistache
::
Http
::
Header
::
Raw
>
&
ifNoneMatch
,
const
Pistache
::
Optional
<
Pistache
::
Http
::
Header
::
Raw
>
&
ifModifiedSince
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
"Do some magic
\n
"
);
// 1. populate remote uri for udp request
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 remote_uri = udr_ip + ":" + udr_port + "/nudr-dr/v2/subscription-data/"+supi+plmnId+"/provisioned-data/am-data";
std
::
string
remote_uri
=
udr_ip
+
":"
+
udr_port
+
"/nudr-dr/v2/subscription-data/"
+
supi
+
"/456789/provisioned-data/sm-data"
;
std
::
string
method
(
"GET"
);
std
::
string
body
(
""
);
std
::
string
response_get
;
Logger
::
udm_sdm
().
debug
(
"UDR: GET Request: "
+
remote_uri
);
// 2. invoke curl to get response from udr
long
http_code
=
Curl
::
curl_http_client
(
remote_uri
,
method
,
body
,
response_get
);
// 3. process response
nlohmann
::
json
response_data_json
=
{};
nlohmann
::
json
return_response_data_json
=
{};
try
{
Logger
::
udm_sdm
().
debug
(
"subscription-data: GET Response: "
+
response_get
);
response_data_json
=
nlohmann
::
json
::
parse
(
response_get
.
c_str
());
// TODO: 1. shall check if "singleNassai" is existing or not, if not, raise exception
// TODO: 2. return_response_data_json: need to check if here is required to allocate memory first. Or check json code to confirm, otherwise codedump might happen
return_response_data_json
[
"singleNssai"
]
=
response_data_json
[
"singleNssai"
];
}
catch
(
nlohmann
::
json
::
exception
&
e
)
{
Logger
::
udm_sdm
().
info
(
"Could not get json content from UDR response"
);
ProblemDetails
problem_details
;
nlohmann
::
json
json_problem_details
;
problem_details
.
setCause
(
"USER_NOT_FOUND"
);
problem_details
.
setStatus
(
404
);
problem_details
.
setDetail
(
"User "
+
supi
+
" not found in Database"
);
to_json
(
json_problem_details
,
problem_details
);
Logger
::
udm_sdm
().
error
(
"User "
+
supi
+
" not found in Database"
);
Logger
::
udm_sdm
().
info
(
"Send 404 Not_Found response to client"
);
response
.
send
(
Pistache
::
Http
::
Code
::
Not_Found
,
json_problem_details
.
dump
());
return
;
}
Logger
::
udm_sdm
().
debug
(
"http reponse code %d.
\n
"
,
http_code
);
response
.
send
(
static_cast
<
Pistache
::
Http
::
Code
>
(
http_code
),
return_response_data_json
.
dump
());
}
}
// 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