Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-NRF
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-NRF
Commits
ff4d54ef
Commit
ff4d54ef
authored
Dec 07, 2020
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add API version
parent
f2a28bd2
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
71 additions
and
88 deletions
+71
-88
src/api-server/api/CompleteStoredSearchDocumentApi.cpp
src/api-server/api/CompleteStoredSearchDocumentApi.cpp
+4
-1
src/api-server/api/CompleteStoredSearchDocumentApi.h
src/api-server/api/CompleteStoredSearchDocumentApi.h
+1
-1
src/api-server/api/NFInstanceIDDocumentApi.cpp
src/api-server/api/NFInstanceIDDocumentApi.cpp
+7
-4
src/api-server/api/NFInstanceIDDocumentApi.h
src/api-server/api/NFInstanceIDDocumentApi.h
+1
-1
src/api-server/api/NFInstancesStoreApi.cpp
src/api-server/api/NFInstancesStoreApi.cpp
+4
-1
src/api-server/api/StoredSearchDocumentApi.cpp
src/api-server/api/StoredSearchDocumentApi.cpp
+4
-1
src/api-server/api/SubscriptionIDDocumentApi.cpp
src/api-server/api/SubscriptionIDDocumentApi.cpp
+5
-2
src/api-server/api/SubscriptionsCollectionApi.cpp
src/api-server/api/SubscriptionsCollectionApi.cpp
+4
-1
src/oai-nrf/main.cpp
src/oai-nrf/main.cpp
+41
-76
No files found.
src/api-server/api/CompleteStoredSearchDocumentApi.cpp
View file @
ff4d54ef
...
...
@@ -12,6 +12,9 @@
#include "CompleteStoredSearchDocumentApi.h"
#include "Helpers.h"
#include "nrf_config.hpp"
extern
oai
::
nrf
::
nrf_config
nrf_cfg
;
namespace
oai
{
namespace
nrf
{
...
...
@@ -31,7 +34,7 @@ void CompleteStoredSearchDocumentApi::init() {
void
CompleteStoredSearchDocumentApi
::
setupRoutes
()
{
using
namespace
Pistache
::
Rest
;
Routes
::
Get
(
*
router
,
base
+
"/searches/:searchId/complete"
,
Routes
::
bind
(
&
CompleteStoredSearchDocumentApi
::
retrieve_complete_search_handler
,
this
));
Routes
::
Get
(
*
router
,
base
+
nrf_cfg
.
sbi_api_version
+
"/searches/:searchId/complete"
,
Routes
::
bind
(
&
CompleteStoredSearchDocumentApi
::
retrieve_complete_search_handler
,
this
));
// Default handler, called when a route is not found
router
->
addCustomHandler
(
Routes
::
bind
(
&
CompleteStoredSearchDocumentApi
::
complete_stored_search_document_api_default_handler
,
this
));
...
...
src/api-server/api/CompleteStoredSearchDocumentApi.h
View file @
ff4d54ef
...
...
@@ -40,7 +40,7 @@ public:
virtual
~
CompleteStoredSearchDocumentApi
()
{}
void
init
();
const
std
::
string
base
=
"/nnrf-disc/
v1
"
;
const
std
::
string
base
=
"/nnrf-disc/"
;
private:
void
setupRoutes
();
...
...
src/api-server/api/NFInstanceIDDocumentApi.cpp
View file @
ff4d54ef
...
...
@@ -12,6 +12,9 @@
#include "NFInstanceIDDocumentApi.h"
#include "Helpers.h"
#include "nrf_config.hpp"
extern
oai
::
nrf
::
nrf_config
nrf_cfg
;
namespace
oai
{
namespace
nrf
{
...
...
@@ -31,10 +34,10 @@ void NFInstanceIDDocumentApi::init() {
void
NFInstanceIDDocumentApi
::
setupRoutes
()
{
using
namespace
Pistache
::
Rest
;
Routes
::
Delete
(
*
router
,
base
+
"/nf-instances/:nfInstanceID"
,
Routes
::
bind
(
&
NFInstanceIDDocumentApi
::
deregister_nf_instance_handler
,
this
));
Routes
::
Get
(
*
router
,
base
+
"/nf-instances/:nfInstanceID"
,
Routes
::
bind
(
&
NFInstanceIDDocumentApi
::
get_nf_instance_handler
,
this
));
Routes
::
Put
(
*
router
,
base
+
"/nf-instances/:nfInstanceID"
,
Routes
::
bind
(
&
NFInstanceIDDocumentApi
::
register_nf_instance_handler
,
this
));
Routes
::
Patch
(
*
router
,
base
+
"/nf-instances/:nfInstanceID"
,
Routes
::
bind
(
&
NFInstanceIDDocumentApi
::
update_nf_instance_handler
,
this
));
Routes
::
Delete
(
*
router
,
base
+
nrf_cfg
.
sbi_api_version
+
"/nf-instances/:nfInstanceID"
,
Routes
::
bind
(
&
NFInstanceIDDocumentApi
::
deregister_nf_instance_handler
,
this
));
Routes
::
Get
(
*
router
,
base
+
nrf_cfg
.
sbi_api_version
+
"/nf-instances/:nfInstanceID"
,
Routes
::
bind
(
&
NFInstanceIDDocumentApi
::
get_nf_instance_handler
,
this
));
Routes
::
Put
(
*
router
,
base
+
nrf_cfg
.
sbi_api_version
+
"/nf-instances/:nfInstanceID"
,
Routes
::
bind
(
&
NFInstanceIDDocumentApi
::
register_nf_instance_handler
,
this
));
Routes
::
Patch
(
*
router
,
base
+
nrf_cfg
.
sbi_api_version
+
"/nf-instances/:nfInstanceID"
,
Routes
::
bind
(
&
NFInstanceIDDocumentApi
::
update_nf_instance_handler
,
this
));
// Default handler, called when a route is not found
router
->
addCustomHandler
(
Routes
::
bind
(
&
NFInstanceIDDocumentApi
::
nf_instance_id_document_api_default_handler
,
this
));
...
...
src/api-server/api/NFInstanceIDDocumentApi.h
View file @
ff4d54ef
...
...
@@ -43,7 +43,7 @@ public:
virtual
~
NFInstanceIDDocumentApi
()
{}
void
init
();
const
std
::
string
base
=
"/nnrf-nfm/
v1
"
;
const
std
::
string
base
=
"/nnrf-nfm/"
;
private:
void
setupRoutes
();
...
...
src/api-server/api/NFInstancesStoreApi.cpp
View file @
ff4d54ef
...
...
@@ -12,6 +12,9 @@
#include "NFInstancesStoreApi.h"
#include "Helpers.h"
#include "nrf_config.hpp"
extern
oai
::
nrf
::
nrf_config
nrf_cfg
;
namespace
oai
{
namespace
nrf
{
...
...
@@ -31,7 +34,7 @@ void NFInstancesStoreApi::init() {
void
NFInstancesStoreApi
::
setupRoutes
()
{
using
namespace
Pistache
::
Rest
;
Routes
::
Get
(
*
router
,
base
+
"/nf-instances"
,
Routes
::
bind
(
&
NFInstancesStoreApi
::
search_nf_instances_handler
,
this
));
Routes
::
Get
(
*
router
,
base
+
nrf_cfg
.
sbi_api_version
+
"/nf-instances"
,
Routes
::
bind
(
&
NFInstancesStoreApi
::
search_nf_instances_handler
,
this
));
// Default handler, called when a route is not found
router
->
addCustomHandler
(
Routes
::
bind
(
&
NFInstancesStoreApi
::
nf_instances_store_api_default_handler
,
this
));
...
...
src/api-server/api/StoredSearchDocumentApi.cpp
View file @
ff4d54ef
...
...
@@ -12,6 +12,9 @@
#include "StoredSearchDocumentApi.h"
#include "Helpers.h"
#include "nrf_config.hpp"
extern
oai
::
nrf
::
nrf_config
nrf_cfg
;
namespace
oai
{
namespace
nrf
{
...
...
@@ -31,7 +34,7 @@ void StoredSearchDocumentApi::init() {
void
StoredSearchDocumentApi
::
setupRoutes
()
{
using
namespace
Pistache
::
Rest
;
Routes
::
Get
(
*
router
,
base
+
"/searches/:searchId"
,
Routes
::
bind
(
&
StoredSearchDocumentApi
::
retrieve_stored_search_handler
,
this
));
Routes
::
Get
(
*
router
,
base
+
nrf_cfg
.
sbi_api_version
+
"/searches/:searchId"
,
Routes
::
bind
(
&
StoredSearchDocumentApi
::
retrieve_stored_search_handler
,
this
));
// Default handler, called when a route is not found
router
->
addCustomHandler
(
Routes
::
bind
(
&
StoredSearchDocumentApi
::
stored_search_document_api_default_handler
,
this
));
...
...
src/api-server/api/SubscriptionIDDocumentApi.cpp
View file @
ff4d54ef
...
...
@@ -12,6 +12,9 @@
#include "SubscriptionIDDocumentApi.h"
#include "Helpers.h"
#include "nrf_config.hpp"
extern
oai
::
nrf
::
nrf_config
nrf_cfg
;
namespace
oai
{
namespace
nrf
{
...
...
@@ -31,8 +34,8 @@ void SubscriptionIDDocumentApi::init() {
void
SubscriptionIDDocumentApi
::
setupRoutes
()
{
using
namespace
Pistache
::
Rest
;
Routes
::
Delete
(
*
router
,
base
+
"/subscriptions/:subscriptionID"
,
Routes
::
bind
(
&
SubscriptionIDDocumentApi
::
remove_subscription_handler
,
this
));
Routes
::
Patch
(
*
router
,
base
+
"/subscriptions/:subscriptionID"
,
Routes
::
bind
(
&
SubscriptionIDDocumentApi
::
update_subscription_handler
,
this
));
Routes
::
Delete
(
*
router
,
base
+
nrf_cfg
.
sbi_api_version
+
"/subscriptions/:subscriptionID"
,
Routes
::
bind
(
&
SubscriptionIDDocumentApi
::
remove_subscription_handler
,
this
));
Routes
::
Patch
(
*
router
,
base
+
nrf_cfg
.
sbi_api_version
+
"/subscriptions/:subscriptionID"
,
Routes
::
bind
(
&
SubscriptionIDDocumentApi
::
update_subscription_handler
,
this
));
// Default handler, called when a route is not found
router
->
addCustomHandler
(
Routes
::
bind
(
&
SubscriptionIDDocumentApi
::
subscription_id_document_api_default_handler
,
this
));
...
...
src/api-server/api/SubscriptionsCollectionApi.cpp
View file @
ff4d54ef
...
...
@@ -12,6 +12,9 @@
#include "SubscriptionsCollectionApi.h"
#include "Helpers.h"
#include "nrf_config.hpp"
extern
oai
::
nrf
::
nrf_config
nrf_cfg
;
namespace
oai
{
namespace
nrf
{
...
...
@@ -31,7 +34,7 @@ void SubscriptionsCollectionApi::init() {
void
SubscriptionsCollectionApi
::
setupRoutes
()
{
using
namespace
Pistache
::
Rest
;
Routes
::
Post
(
*
router
,
base
+
"/subscriptions"
,
Routes
::
bind
(
&
SubscriptionsCollectionApi
::
create_subscription_handler
,
this
));
Routes
::
Post
(
*
router
,
base
+
nrf_cfg
.
sbi_api_version
+
"/subscriptions"
,
Routes
::
bind
(
&
SubscriptionsCollectionApi
::
create_subscription_handler
,
this
));
// Default handler, called when a route is not found
router
->
addCustomHandler
(
Routes
::
bind
(
&
SubscriptionsCollectionApi
::
subscriptions_collection_api_default_handler
,
this
));
...
...
src/oai-nrf/main.cpp
View file @
ff4d54ef
/*
* Copyright (c) 2017 Sprint
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
* Copyright (c) 2017 Sprint
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "nrf_app.hpp"
#include "nrf-api-server.h"
...
...
@@ -35,71 +35,46 @@
using
namespace
oai
::
nrf
;
using
namespace
util
;
using
namespace
std
;
//using namespace oai::nrf_server::api;
nrf_app
*
nrf_app_inst
=
nullptr
;
nrf_config
nrf_cfg
;
void
send_heartbeat_to_tasks
(
const
uint32_t
sequence
);
NRFApiServer
*
api_server
=
nullptr
;
//------------------------------------------------------------------------------
void
send_heartbeat_to_tasks
(
const
uint32_t
sequence
)
{
/* itti_msg_ping *itti_msg = new itti_msg_ping(TASK_SMF_APP, TASK_ALL, sequence);
std::shared_ptr<itti_msg_ping> i = std::shared_ptr<itti_msg_ping>(itti_msg);
int ret = itti_inst->send_broadcast_msg(i);
if (RETURNok != ret) {
Logger::nrf_app().error( "Could not send ITTI message %s to task TASK_ALL", i->get_msg_name());
}
*/
}
void
my_app_signal_handler
(
int
s
)
{
//------------------------------------------------------------------------------
void
my_app_signal_handler
(
int
s
)
{
/*
std
::
cout
<<
"Caught signal "
<<
s
<<
std
::
endl
;
Logger::system().startup( "exiting" );
itti_inst->send_terminate_msg(TASK_SMF_APP);
itti_inst->wait_tasks_end();
Logger
::
system
().
startup
(
"exiting"
);
std
::
cout
<<
"Freeing Allocated memory..."
<<
std
::
endl
;
if (async_shell_cmd_inst) delete async_shell_cmd_inst; async_shell_cmd_inst = nullptr;
std::cout << "Async Shell CMD memory done." << std::endl;
if (nrf_api_server_1) {
nrf_api_server_1->shutdown();
delete nrf_api_server_1;
nrf_api_server_1 = nullptr;
}
if (nrf_api_server_2) {
nrf_api_server_2->stop();
delete nrf_api_server_2;
nrf_api_server_2 = nullptr;
if
(
api_server
)
{
api_server
->
shutdown
();
delete
api_server
;
api_server
=
nullptr
;
}
std::cout << "SMF API Server memory done." << std::endl;
if (itti_inst) delete itti_inst; itti_inst = nullptr;
std::cout << "ITTI memory done." << std::endl;
if (nrf_app_inst) delete nrf_app_inst; nrf_app_inst = nullptr;
std::cout << "SMF APP memory done." << std::endl;
std
::
cout
<<
"NRF API Server memory done."
<<
std
::
endl
;
if
(
nrf_app_inst
)
delete
nrf_app_inst
;
nrf_app_inst
=
nullptr
;
std
::
cout
<<
"NRF APP memory done."
<<
std
::
endl
;
std
::
cout
<<
"Freeing Allocated memory done"
<<
std
::
endl
;
*/
exit
(
0
);
}
//------------------------------------------------------------------------------
int
main
(
int
argc
,
char
**
argv
)
{
int
main
(
int
argc
,
char
**
argv
)
{
srand
(
time
(
NULL
));
// Command line options
if
(
!
Options
::
parse
(
argc
,
argv
)
)
if
(
!
Options
::
parse
(
argc
,
argv
)
)
{
std
::
cout
<<
"Options::parse() failed"
<<
std
::
endl
;
return
1
;
std
::
cout
<<
"Options::parse() failed"
<<
std
::
endl
;
return
1
;
}
// Logger
Logger
::
init
(
"nrf"
,
Options
::
getlogStdout
()
,
Options
::
getlogRotFilelog
());
Logger
::
nrf_app
().
startup
(
"Options parsed"
);
struct
sigaction
sigIntHandler
;
...
...
@@ -112,33 +87,23 @@ int main(int argc, char **argv)
nrf_cfg
.
load
(
Options
::
getlibconfigConfig
());
nrf_cfg
.
display
();
// Inter task Interface
// itti_inst = new itti_mw();
// itti_inst->start(nrf_cfg.itti.itti_timer_sched_params);
// system command
// async_shell_cmd_inst = new async_shell_cmd(nrf_cfg.itti.async_cmd_sched_params);
// SMF application layer
nrf_app_inst
=
new
nrf_app
(
Options
::
getlibconfigConfig
());
// NRF application layer
nrf_app_inst
=
new
nrf_app
(
Options
::
getlibconfigConfig
());
// PID file
// Currently hard-coded value. TODO: add as config option.
string
pid_file_name
=
get_exe_absolute_path
(
"/var/run"
,
nrf_cfg
.
instance
);
string
pid_file_name
=
get_exe_absolute_path
(
"/var/run"
,
nrf_cfg
.
instance
);
if
(
!
is_pid_file_lock_success
(
pid_file_name
.
c_str
()))
{
Logger
::
nrf_app
().
error
(
"Lock PID file %s failed
\n
"
,
pid_file_name
.
c_str
());
exit
(
-
EDEADLK
);
}
/*
//SMF Pistache API server (HTTP1)
//NRF Pistache API server (HTTP1)
Pistache
::
Address
addr
(
std
::
string
(
inet_ntoa
(
*
((
struct
in_addr
*
)
&
nrf_cfg
.
sbi
.
addr4
)))
,
Pistache
::
Port
(
nrf_cfg
.
sbi
.
port
));
nrf_api_server_1 = new SMFApiServer(addr, nrf_app_inst);
nrf_api_server_1->init(2);
//nrf_api_server_1->start();
std::thread nrf_http1_manager(&SMFApiServer::start, nrf_api_server_1);
nrf_http1_manager.join();
*/
api_server
=
new
NRFApiServer
(
addr
,
nrf_app_inst
);
api_server
->
init
(
2
);
std
::
thread
nrf_manager
(
&
NRFApiServer
::
start
,
api_server
);
nrf_manager
.
join
();
FILE
*
fp
=
NULL
;
std
::
string
filename
=
fmt
::
format
(
"/tmp/nrf_{}.status"
,
getpid
());
...
...
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