Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-AUSF
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-AUSF
Commits
0f32e538
Commit
0f32e538
authored
Jun 29, 2021
by
Raphael Defosseux
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'api_version' into 'develop'
Api version See merge request oai/cn5g/oai-cn5g-ausf!5
parents
7adf5f8d
4b299810
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
100 additions
and
78 deletions
+100
-78
src/api_server/api/DefaultApi.cpp
src/api_server/api/DefaultApi.cpp
+1
-4
src/api_server/impl/DefaultApiImpl.cpp
src/api_server/impl/DefaultApiImpl.cpp
+6
-10
src/ausf_app/ausf_app.cpp
src/ausf_app/ausf_app.cpp
+60
-53
src/ausf_app/ausf_client.cpp
src/ausf_app/ausf_client.cpp
+4
-9
src/ausf_app/ausf_config.cpp
src/ausf_app/ausf_config.cpp
+2
-2
src/common/ausf.h
src/common/ausf.h
+27
-0
No files found.
src/api_server/api/DefaultApi.cpp
View file @
0f32e538
...
...
@@ -147,7 +147,6 @@ void DefaultApi::ue_authentications_auth_ctx_id5g_aka_confirmation_put_handler(
try
{
nlohmann
::
json
::
parse
(
request
.
body
()).
get_to
(
confirmationData
);
Logger
::
ausf_server
().
debug
(
"Json parsed"
);
this
->
ue_authentications_auth_ctx_id5g_aka_confirmation_put
(
authCtxId
,
confirmationData
,
response
);
}
catch
(
nlohmann
::
detail
::
exception
&
e
)
{
...
...
@@ -193,15 +192,13 @@ void DefaultApi::ue_authentications_deregister_post_handler(
void
DefaultApi
::
ue_authentications_post_handler
(
const
Pistache
::
Rest
::
Request
&
request
,
Pistache
::
Http
::
ResponseWriter
response
)
{
Logger
::
ausf_server
().
info
(
"Received ue-authentications post Request"
);
Logger
::
ausf_server
().
info
(
"Received ue_authentications_post Request"
);
// Getting the body param
AuthenticationInfo
authenticationInfo
;
try
{
nlohmann
::
json
::
parse
(
request
.
body
()).
get_to
(
authenticationInfo
);
Logger
::
ausf_server
().
debug
(
"Json parsed"
);
this
->
ue_authentications_post
(
authenticationInfo
,
response
);
}
catch
(
nlohmann
::
detail
::
exception
&
e
)
{
// send a 400 error
...
...
src/api_server/impl/DefaultApiImpl.cpp
View file @
0f32e538
...
...
@@ -99,8 +99,8 @@ void DefaultApiImpl::ue_authentications_auth_ctx_id5g_aka_confirmation_put(
"5g-aka-confirmation response:
\n
%s"
,
json_data
.
dump
().
c_str
());
Logger
::
ausf_server
().
info
(
"Send 5g-aka-confirmation response to SEAF (Code
200)"
);
response
.
send
(
code
,
json_data
.
dump
());
"Send 5g-aka-confirmation response to SEAF (Code
%d)"
,
code
);
response
.
send
(
code
,
json_data
.
dump
()
.
c_str
()
);
}
void
DefaultApiImpl
::
ue_authentications_deregister_post
(
...
...
@@ -115,12 +115,9 @@ void DefaultApiImpl::ue_authentications_deregister_post(
void
DefaultApiImpl
::
ue_authentications_post
(
const
AuthenticationInfo
&
authenticationInfo
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
Logger
::
ausf_server
().
debug
(
"ue_authentications_post"
);
// Getting params
std
::
string
reponse_from_udm
;
std
::
string
location
;
// uint16_t http_response_code = 0;
std
::
string
reponse_from_udm
=
{};
std
::
string
location
=
{};
UEAuthenticationCtx
ue_auth_ctx
=
{};
nlohmann
::
json
UEAuthCtx_json
=
{};
Pistache
::
Http
::
Code
code
=
{};
...
...
@@ -131,10 +128,9 @@ void DefaultApiImpl::ue_authentications_post(
Logger
::
ausf_server
().
debug
(
"Auth response:
\n
%s"
,
UEAuthCtx_json
.
dump
().
c_str
());
Logger
::
ausf_server
().
info
(
"Send Auth response to SEAF (Code
201)"
);
Logger
::
ausf_server
().
info
(
"Send Auth response to SEAF (Code
%d)"
,
code
);
response
.
headers
().
add
<
Pistache
::
Http
::
Header
::
Location
>
(
location
);
response
.
send
(
code
,
UEAuthCtx_json
.
dump
());
// Type: json object to string
response
.
send
(
code
,
UEAuthCtx_json
.
dump
().
c_str
());
}
}
// namespace api
...
...
src/ausf_app/ausf_app.cpp
View file @
0f32e538
This diff is collapsed.
Click to expand it.
src/ausf_app/ausf_client.cpp
View file @
0f32e538
...
...
@@ -103,8 +103,6 @@ void ausf_client::curl_http_client(
curl_easy_setopt
(
curl
,
CURLOPT_TIMEOUT_MS
,
CURL_TIMEOUT_MS
);
curl_easy_setopt
(
curl
,
CURLOPT_TCP_KEEPALIVE
,
1
);
curl_easy_setopt
(
curl
,
CURLOPT_INTERFACE
,
ausf_cfg
.
sbi
.
if_name
.
c_str
());
Logger
::
ausf_app
().
info
(
"Request sent by interface "
+
ausf_cfg
.
sbi
.
if_name
);
// Response information.
long
httpCode
=
{
0
};
...
...
@@ -140,8 +138,9 @@ void ausf_client::curl_http_client(
nlohmann
::
json
response_data
=
{};
if
(
httpCode
!=
200
&&
httpCode
!=
201
&&
httpCode
!=
204
)
{
// TODO: remove hardcoded values
if
(
httpCode
!=
HTTP_RESPONSE_CODE_OK
&&
httpCode
!=
HTTP_RESPONSE_CODE_CREATED
&&
httpCode
!=
HTTP_RESPONSE_CODE_NO_CONTENT
)
{
is_response_ok
=
false
;
if
(
response
.
size
()
<
1
)
{
Logger
::
ausf_app
().
info
(
"There's no content in the response"
);
...
...
@@ -152,10 +151,6 @@ void ausf_client::curl_http_client(
return
;
}
else
{
// httpCode = 200 || httpCode = 201 || httpCode = 204
response
=
*
httpData
.
get
();
}
if
(
!
is_response_ok
)
{
try
{
response_data
=
nlohmann
::
json
::
parse
(
response
);
...
...
@@ -182,5 +177,5 @@ void ausf_client::curl_http_client(
free
(
body_data
);
body_data
=
NULL
;
}
fflush
(
stdout
)
;
return
;
}
src/ausf_app/ausf_config.cpp
View file @
0f32e538
...
...
@@ -55,7 +55,7 @@ using namespace libconfig;
namespace
config
{
//------------------------------------------------------------------------------
ausf_config
::
ausf_config
()
:
sbi
()
{
ausf_config
::
ausf_config
()
:
sbi
()
,
ausf_name
(),
pid_dir
(),
instance
()
{
udm_addr
.
ipv4_addr
.
s_addr
=
INADDR_ANY
;
udm_addr
.
port
=
80
;
udm_addr
.
api_version
=
"v1"
;
...
...
@@ -186,7 +186,7 @@ int ausf_config::load(const std::string& config_file) {
//------------------------------------------------------------------------------
void
ausf_config
::
display
()
{
Logger
::
config
().
info
(
"========
AUSF
======="
);
Logger
::
config
().
info
(
"========
========= AUSF ==========
======="
);
Logger
::
config
().
info
(
"Configuration AUSF:"
);
Logger
::
config
().
info
(
"- Instance................: %d"
,
instance
);
Logger
::
config
().
info
(
"- PID dir.................: %s"
,
pid_dir
.
c_str
());
...
...
src/common/ausf.h
View file @
0f32e538
...
...
@@ -83,4 +83,31 @@ typedef struct {
typedef
uint64_t
supi64_t
;
// 3GPP TS 29.571 (Common data)
enum
http_response_codes_e
{
HTTP_RESPONSE_CODE_OK
=
200
,
HTTP_RESPONSE_CODE_CREATED
=
201
,
HTTP_RESPONSE_CODE_ACCEPTED
=
202
,
HTTP_RESPONSE_CODE_NO_CONTENT
=
204
,
HTTP_RESPONSE_CODE_BAD_REQUEST
=
400
,
HTTP_RESPONSE_CODE_UNAUTHORIZED
=
401
,
HTTP_RESPONSE_CODE_FORBIDDEN
=
403
,
HTTP_RESPONSE_CODE_NOT_FOUND
=
404
,
HTTP_RESPONSE_CODE_METHOD_NOT_ALLOWED
=
405
,
HTTP_RESPONSE_CODE_REQUEST_TIMEOUT
=
408
,
HTTP_RESPONSE_CODE_406_NOT_ACCEPTED
=
406
,
HTTP_RESPONSE_CODE_CONFLICT
=
409
,
HTTP_RESPONSE_CODE_GONE
=
410
,
HTTP_RESPONSE_CODE_LENGTH_REQUIRED
=
411
,
HTTP_RESPONSE_CODE_PRECONDITION_FAILED
=
412
,
HTTP_RESPONSE_CODE_PAYLOAD_TOO_LARGE
=
413
,
HTTP_RESPONSE_CODE_URI_TOO_LONG
=
414
,
HTTP_RESPONSE_CODE_UNSUPPORTED_MEDIA_TYPE
=
415
,
HTTP_RESPONSE_CODE_TOO_MANY_REQUESTS
=
429
,
HTTP_RESPONSE_CODE_INTERNAL_SERVER_ERROR
=
500
,
HTTP_RESPONSE_CODE_NOT_IMPLEMENTED
=
501
,
HTTP_RESPONSE_CODE_SERVICE_UNAVAILABLE
=
503
,
HTTP_RESPONSE_CODE_GATEWAY_TIMEOUT
=
504
};
#endif
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