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
b9a2d19e
Commit
b9a2d19e
authored
Jan 17, 2022
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update N1MessageNotifyHandler
parent
a83f7e5e
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
41 additions
and
13 deletions
+41
-13
src/amf-app/amf_app.cpp
src/amf-app/amf_app.cpp
+4
-2
src/amf-app/amf_app.hpp
src/amf-app/amf_app.hpp
+2
-2
src/itti/msgs/itti_msg_sbi.hpp
src/itti/msgs/itti_msg_sbi.hpp
+4
-0
src/sbi/amf_server/api/N1MessageNotifyApi.cpp
src/sbi/amf_server/api/N1MessageNotifyApi.cpp
+25
-3
src/sbi/amf_server/api/N1MessageNotifyApi.h
src/sbi/amf_server/api/N1MessageNotifyApi.h
+1
-1
src/sbi/amf_server/impl/N1MessageNotifyApiImpl.cpp
src/sbi/amf_server/impl/N1MessageNotifyApiImpl.cpp
+4
-4
src/sbi/amf_server/impl/N1MessageNotifyApiImpl.h
src/sbi/amf_server/impl/N1MessageNotifyApiImpl.h
+1
-1
No files found.
src/amf-app/amf_app.cpp
View file @
b9a2d19e
...
@@ -482,12 +482,13 @@ bool amf_app::handle_event_exposure_delete(const std::string& subscription_id) {
...
@@ -482,12 +482,13 @@ bool amf_app::handle_event_exposure_delete(const std::string& subscription_id) {
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
bool
amf_app
::
handle_nf_status_notification
(
bool
amf_app
::
handle_nf_status_notification
(
std
::
shared_ptr
<
itti_sbi_notification_data
>&
msg
,
std
::
shared_ptr
<
itti_sbi_notification_data
>&
msg
,
oai
::
amf
::
model
::
ProblemDetails
&
problem_details
,
uint
8
_t
&
http_code
)
{
oai
::
amf
::
model
::
ProblemDetails
&
problem_details
,
uint
32
_t
&
http_code
)
{
Logger
::
amf_app
().
info
(
Logger
::
amf_app
().
info
(
"Handle a NF status notification from NRF (HTTP version "
"Handle a NF status notification from NRF (HTTP version "
"%d)"
,
"%d)"
,
msg
->
http_version
);
msg
->
http_version
);
// TODO
// TODO
http_code
=
204
;
// HTTP_STATUS_CODE_204_NO_CONTENT;
return
true
;
return
true
;
}
}
...
@@ -496,10 +497,11 @@ bool amf_app::handle_n1_message_notification(
...
@@ -496,10 +497,11 @@ bool amf_app::handle_n1_message_notification(
std
::
shared_ptr
<
itti_sbi_n1_message_notification
>&
msg
,
std
::
shared_ptr
<
itti_sbi_n1_message_notification
>&
msg
,
oai
::
amf
::
model
::
ProblemDetails
&
problem_details
,
uint32_t
&
http_code
)
{
oai
::
amf
::
model
::
ProblemDetails
&
problem_details
,
uint32_t
&
http_code
)
{
Logger
::
amf_app
().
info
(
Logger
::
amf_app
().
info
(
"Handle a N
F status notification from NR
F (HTTP version "
"Handle a N
1 Message Notification from the initial AM
F (HTTP version "
"%d)"
,
"%d)"
,
msg
->
http_version
);
msg
->
http_version
);
// TODO
// TODO
http_code
=
204
;
// HTTP_STATUS_CODE_204_NO_CONTENT;
return
true
;
return
true
;
}
}
...
...
src/amf-app/amf_app.hpp
View file @
b9a2d19e
...
@@ -154,12 +154,12 @@ class amf_app {
...
@@ -154,12 +154,12 @@ class amf_app {
* Handle NF status notification (e.g., when an UPF becomes available)
* Handle NF status notification (e.g., when an UPF becomes available)
* @param [std::shared_ptr<itti_sbi_notification_data>& ] msg: message
* @param [std::shared_ptr<itti_sbi_notification_data>& ] msg: message
* @param [oai::amf::model::ProblemDetails& ] problem_details
* @param [oai::amf::model::ProblemDetails& ] problem_details
* @param [uint
8
_t&] http_code
* @param [uint
32
_t&] http_code
* @return true if handle sucessfully, otherwise return false
* @return true if handle sucessfully, otherwise return false
*/
*/
bool
handle_nf_status_notification
(
bool
handle_nf_status_notification
(
std
::
shared_ptr
<
itti_sbi_notification_data
>&
msg
,
std
::
shared_ptr
<
itti_sbi_notification_data
>&
msg
,
oai
::
amf
::
model
::
ProblemDetails
&
problem_details
,
uint
8
_t
&
http_code
);
oai
::
amf
::
model
::
ProblemDetails
&
problem_details
,
uint
32
_t
&
http_code
);
/*
/*
* Handle N1 Message Notification
* Handle N1 Message Notification
...
...
src/itti/msgs/itti_msg_sbi.hpp
View file @
b9a2d19e
...
@@ -124,11 +124,13 @@ class itti_sbi_n1_message_notification : public itti_sbi_msg {
...
@@ -124,11 +124,13 @@ class itti_sbi_n1_message_notification : public itti_sbi_msg {
:
itti_sbi_msg
(
SBI_N1_MESSAGE_NOTIFICATION
,
orig
,
dest
),
:
itti_sbi_msg
(
SBI_N1_MESSAGE_NOTIFICATION
,
orig
,
dest
),
notification_msg
(),
notification_msg
(),
ue_id
(),
ue_id
(),
n1sm
(),
http_version
(
1
)
{}
http_version
(
1
)
{}
itti_sbi_n1_message_notification
(
const
itti_sbi_n1_message_notification
&
i
)
itti_sbi_n1_message_notification
(
const
itti_sbi_n1_message_notification
&
i
)
:
itti_sbi_msg
(
i
),
:
itti_sbi_msg
(
i
),
notification_msg
(
i
.
notification_msg
),
notification_msg
(
i
.
notification_msg
),
ue_id
(
i
.
ue_id
),
ue_id
(
i
.
ue_id
),
n1sm
(
i
.
n1sm
),
http_version
(
1
)
{}
http_version
(
1
)
{}
itti_sbi_n1_message_notification
(
itti_sbi_n1_message_notification
(
const
itti_sbi_n1_message_notification
&
i
,
const
task_id_t
orig
,
const
itti_sbi_n1_message_notification
&
i
,
const
task_id_t
orig
,
...
@@ -136,10 +138,12 @@ class itti_sbi_n1_message_notification : public itti_sbi_msg {
...
@@ -136,10 +138,12 @@ class itti_sbi_n1_message_notification : public itti_sbi_msg {
:
itti_sbi_msg
(
i
,
orig
,
dest
),
:
itti_sbi_msg
(
i
,
orig
,
dest
),
notification_msg
(
i
.
notification_msg
),
notification_msg
(
i
.
notification_msg
),
ue_id
(
i
.
ue_id
),
ue_id
(
i
.
ue_id
),
n1sm
(
i
.
n1sm
),
http_version
(
i
.
http_version
)
{}
http_version
(
i
.
http_version
)
{}
const
char
*
get_msg_name
()
{
return
"SBI_N1_MESSAGE_NOTIFICATION"
;
};
const
char
*
get_msg_name
()
{
return
"SBI_N1_MESSAGE_NOTIFICATION"
;
};
oai
::
amf
::
model
::
N1MessageNotification
notification_msg
;
oai
::
amf
::
model
::
N1MessageNotification
notification_msg
;
std
::
string
ue_id
;
std
::
string
ue_id
;
std
::
string
n1sm
;
uint8_t
http_version
;
uint8_t
http_version
;
};
};
...
...
src/sbi/amf_server/api/N1MessageNotifyApi.cpp
View file @
b9a2d19e
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
#include "mime_parser.hpp"
#include "mime_parser.hpp"
#include "logger.hpp"
#include "logger.hpp"
#include "amf_config.hpp"
#include "amf_config.hpp"
#include "mime_parser.hpp"
extern
config
::
amf_config
amf_cfg
;
extern
config
::
amf_config
amf_cfg
;
...
@@ -58,12 +59,33 @@ void N1MessageNotifyApi::n1_message_notify_handler(
...
@@ -58,12 +59,33 @@ void N1MessageNotifyApi::n1_message_notify_handler(
"Received a N1MessageNotification with ue_ctx_id %s"
,
"Received a N1MessageNotification with ue_ctx_id %s"
,
ueContextId
.
c_str
());
ueContextId
.
c_str
());
N1MessageNotification
n1MessageNotification
;
N1MessageNotification
n1MessageNotification
=
{};
// simple parser
mime_parser
sp
=
{};
sp
.
parse
(
request
.
body
());
std
::
vector
<
mime_part
>
parts
=
{};
sp
.
get_mime_parts
(
parts
);
uint8_t
size
=
parts
.
size
();
Logger
::
amf_server
().
debug
(
"Number of MIME parts %d"
,
size
);
// 2 parts for Json data and N1
if
(
size
!=
2
)
{
response
.
send
(
Pistache
::
Http
::
Code
::
Bad_Request
);
Logger
::
amf_server
().
debug
(
"Bad request: should have 2 MIME parts"
);
return
;
}
Logger
::
amf_server
().
debug
(
"Request body, part 1:
\n
%s"
,
parts
[
0
].
body
.
c_str
());
Logger
::
amf_server
().
debug
(
"Request body, part 2:
\n
%s"
,
parts
[
1
].
body
.
c_str
());
try
{
try
{
nlohmann
::
json
::
parse
(
request
.
body
()).
get_to
(
n1MessageNotification
);
nlohmann
::
json
::
parse
(
parts
[
0
].
body
.
c_str
()).
get_to
(
n1MessageNotification
);
this
->
receive_n1_message_notification
(
this
->
receive_n1_message_notification
(
ueContextId
,
n1MessageNotification
,
response
);
ueContextId
,
n1MessageNotification
,
parts
[
1
].
body
,
response
);
}
catch
(
nlohmann
::
detail
::
exception
&
e
)
{
}
catch
(
nlohmann
::
detail
::
exception
&
e
)
{
// send a 400 error
// send a 400 error
response
.
send
(
Pistache
::
Http
::
Code
::
Bad_Request
,
e
.
what
());
response
.
send
(
Pistache
::
Http
::
Code
::
Bad_Request
,
e
.
what
());
...
...
src/sbi/amf_server/api/N1MessageNotifyApi.h
View file @
b9a2d19e
...
@@ -56,7 +56,7 @@ class N1MessageNotifyApi {
...
@@ -56,7 +56,7 @@ class N1MessageNotifyApi {
virtual
void
receive_n1_message_notification
(
virtual
void
receive_n1_message_notification
(
const
std
::
string
&
ueContextId
,
const
std
::
string
&
ueContextId
,
const
N1MessageNotification
&
notificationData
,
const
N1MessageNotification
&
notificationData
,
std
::
string
&
n1sm_str
,
Pistache
::
Http
::
ResponseWriter
&
response
)
=
0
;
Pistache
::
Http
::
ResponseWriter
&
response
)
=
0
;
};
};
...
...
src/sbi/amf_server/impl/N1MessageNotifyApiImpl.cpp
View file @
b9a2d19e
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
#include "N1MessageNotifyApiImpl.h"
#include "N1MessageNotifyApiImpl.h"
#include "itti_msg_sbi.hpp"
#include "itti_msg_sbi.hpp"
#include "conversions.hpp"
using
namespace
amf_application
;
using
namespace
amf_application
;
namespace
oai
{
namespace
oai
{
...
@@ -28,12 +29,10 @@ N1MessageNotifyApiImpl::N1MessageNotifyApiImpl(
...
@@ -28,12 +29,10 @@ N1MessageNotifyApiImpl::N1MessageNotifyApiImpl(
void
N1MessageNotifyApiImpl
::
receive_n1_message_notification
(
void
N1MessageNotifyApiImpl
::
receive_n1_message_notification
(
const
std
::
string
&
ueContextId
,
const
std
::
string
&
ueContextId
,
const
N1MessageNotification
&
notificationData
,
const
N1MessageNotification
&
notificationData
,
std
::
string
&
n1sm_str
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
Pistache
::
Http
::
ResponseWriter
&
response
)
{
Logger
::
amf_server
().
debug
(
"Receive N1MessageNotify, handling..."
);
Logger
::
amf_server
().
debug
(
"Receive N1MessageNotify, handling..."
);
Pistache
::
Http
::
Code
code
=
Pistache
::
Http
::
Code
::
Ok
;
std
::
string
supi
=
ueContextId
;
std
::
string
supi
=
ueContextId
;
Logger
::
amf_server
().
debug
(
"SUPI (%s)"
,
supi
.
c_str
());
Logger
::
amf_server
().
debug
(
"SUPI (%s)"
,
supi
.
c_str
());
...
@@ -43,13 +42,14 @@ void N1MessageNotifyApiImpl::receive_n1_message_notification(
...
@@ -43,13 +42,14 @@ void N1MessageNotifyApiImpl::receive_n1_message_notification(
TASK_AMF_SBI
,
TASK_AMF_APP
);
TASK_AMF_SBI
,
TASK_AMF_APP
);
itti_msg
->
notification_msg
=
notificationData
;
itti_msg
->
notification_msg
=
notificationData
;
itti_msg
->
ue_id
=
supi
;
itti_msg
->
ue_id
=
supi
;
itti_msg
->
n1sm
=
n1sm_str
;
itti_msg
->
http_version
=
1
;
itti_msg
->
http_version
=
1
;
oai
::
amf
::
model
::
ProblemDetails
problem_details
=
{};
oai
::
amf
::
model
::
ProblemDetails
problem_details
=
{};
uint32_t
http_code
=
{
0
};
uint32_t
http_code
=
{
0
};
if
(
m_amf_app
->
handle_n1_message_notification
(
if
(
m_amf_app
->
handle_n1_message_notification
(
itti_msg
,
problem_details
,
http_code
))
{
itti_msg
,
problem_details
,
http_code
))
{
response
.
send
(
Pistache
::
Http
::
Code
(
204
));
response
.
send
(
Pistache
::
Http
::
Code
(
http_code
));
}
else
{
}
else
{
response
.
headers
().
add
<
Pistache
::
Http
::
Header
::
ContentType
>
(
response
.
headers
().
add
<
Pistache
::
Http
::
Header
::
ContentType
>
(
Pistache
::
Http
::
Mime
::
MediaType
(
"application/problem+json"
));
Pistache
::
Http
::
Mime
::
MediaType
(
"application/problem+json"
));
...
...
src/sbi/amf_server/impl/N1MessageNotifyApiImpl.h
View file @
b9a2d19e
...
@@ -49,7 +49,7 @@ class N1MessageNotifyApiImpl : public N1MessageNotifyApi {
...
@@ -49,7 +49,7 @@ class N1MessageNotifyApiImpl : public N1MessageNotifyApi {
void
receive_n1_message_notification
(
void
receive_n1_message_notification
(
const
std
::
string
&
ueContextId
,
const
std
::
string
&
ueContextId
,
const
N1MessageNotification
&
notificationData
,
const
N1MessageNotification
&
notificationData
,
std
::
string
&
n1sm_str
,
Pistache
::
Http
::
ResponseWriter
&
response
);
Pistache
::
Http
::
ResponseWriter
&
response
);
private:
private:
...
...
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