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
99c5366b
Commit
99c5366b
authored
Aug 13, 2021
by
kharade
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
handle nfmanagement service
parent
e962a573
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
608 additions
and
0 deletions
+608
-0
src/api-server/CMakeLists.txt
src/api-server/CMakeLists.txt
+1
-0
src/api-server/nrf-http2-server.cpp
src/api-server/nrf-http2-server.cpp
+496
-0
src/api-server/nrf-http2-server.h
src/api-server/nrf-http2-server.h
+87
-0
src/common/nrf.h
src/common/nrf.h
+1
-0
src/common/utils/conversions.cpp
src/common/utils/conversions.cpp
+12
-0
src/oai-nrf/main.cpp
src/oai-nrf/main.cpp
+11
-0
No files found.
src/api-server/CMakeLists.txt
View file @
99c5366b
...
...
@@ -32,6 +32,7 @@ include_directories(${SRC_TOP_DIR}/../build/ext/spdlog/include)
file
(
GLOB NRF_API_SERVER_src_files
${
NRF_API_SERVER_DIR
}
/nrf-api-server.cpp
${
NRF_API_SERVER_DIR
}
/nrf-http2-server.cpp
${
NRF_API_SERVER_DIR
}
/model/*.cpp
${
NRF_API_SERVER_DIR
}
/api/*.cpp
${
NRF_API_SERVER_DIR
}
/impl/*.cpp
...
...
src/api-server/nrf-http2-server.cpp
0 → 100644
View file @
99c5366b
This diff is collapsed.
Click to expand it.
src/api-server/nrf-http2-server.h
0 → 100644
View file @
99c5366b
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (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.openairinterface.org/?page_id=698
*
* 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.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file smf_http2-server.h
\brief
\author Tien-Thinh NGUYEN
\company Eurecom
\date 2020
\email: tien-thinh.nguyen@eurecom.fr
*/
#ifndef FILE_NRF_HTTP2_SERVER_SEEN
#define FILE_NRF_HTTP2_SERVER_SEEN
#include "conversions.hpp"
//#include "nrf.h"
#include "nrf_app.hpp"
#include "uint_generator.hpp"
#include <nghttp2/asio_http2_server.h>
using
namespace
nghttp2
::
asio_http2
;
using
namespace
nghttp2
::
asio_http2
::
server
;
using
namespace
oai
::
nrf
::
model
;
using
namespace
oai
::
nrf
::
app
;
class
nrf_http2_server
{
public:
nrf_http2_server
(
std
::
string
addr
,
uint32_t
port
,
nrf_app
*
nrf_app_inst
)
:
m_address
(
addr
),
m_port
(
port
),
server
(),
m_nrf_app
(
nrf_app_inst
)
{}
void
start
();
void
init
(
size_t
thr
)
{}
void
register_nf_instance_handler
(
const
NFProfile
&
NFProfiledata
,
const
response
&
response
);
void
deregister_nf_instance_handler
(
const
std
::
string
&
nfInstanceID
,
const
response
&
response
);
void
get_nf_instance_handler
(
const
std
::
string
&
nfInstanceID
,
const
response
&
response
);
void
get_nf_instances_handler
(
const
std
::
string
&
nfInstanceID
,
const
response
&
response
);
void
update_instance_handler
(
const
std
::
string
&
nfInstanceID
,
const
std
::
vector
<
PatchItem
>&
patchItem
,
const
response
&
response
);
void
create_subscription_handler
(
const
SubscriptionData
&
subscriptionData
,
const
response
&
response
);
void
update_subscription_handler
(
const
std
::
string
&
subscriptionID
,
const
std
::
vector
<
PatchItem
>&
patchItem
,
const
response
&
response
);
void
remove_subscription_handler
(
const
std
::
string
&
subscriptionID
,
const
response
&
response
);
void
search_nf_instances_handler
(
const
SubscriptionData
&
subscriptionData
,
const
response
&
response
);
void
access_token_request_handler
(
const
SubscriptionData
&
subscriptionData
,
const
response
&
response
);
void
stop
();
private:
util
::
uint_generator
<
uint32_t
>
m_promise_id_generator
;
std
::
string
m_address
;
uint32_t
m_port
;
http2
server
;
nrf_app
*
m_nrf_app
;
protected:
static
uint64_t
generate_promise_id
()
{
return
util
::
uint_uid_generator
<
uint64_t
>::
get_instance
().
get_uid
();
}
};
#endif
src/common/nrf.h
View file @
99c5366b
...
...
@@ -78,6 +78,7 @@ typedef uint32_t evsub_id_t;
#define NNRF_NFM_BASE "/nnrf-nfm/"
#define NNRF_NFM_NF_INSTANCE "/nf-instances/"
#define NNRF_NFM_STATUS_SUBSCRIBE_URL "/subscriptions"
#define NF_CURL_TIMEOUT_MS 1000L
...
...
src/common/utils/conversions.cpp
View file @
99c5366b
...
...
@@ -92,3 +92,15 @@ int conv::ascii_to_hex(uint8_t* dst, const char* h) {
dst
[
i
++
]
=
(
high
<<
4
)
|
low
;
}
}
std
::
string
conv
::
toString
(
const
struct
in_addr
&
inaddr
)
{
std
::
string
s
=
{};
char
str
[
INET6_ADDRSTRLEN
]
=
{};
if
(
inet_ntop
(
AF_INET
,
(
const
void
*
)
&
inaddr
,
str
,
INET6_ADDRSTRLEN
)
==
NULL
)
{
s
.
append
(
"Error in_addr"
);
}
else
{
s
.
append
(
str
);
}
return
s
;
}
\ No newline at end of file
src/oai-nrf/main.cpp
View file @
99c5366b
...
...
@@ -16,10 +16,12 @@
#include "logger.hpp"
#include "nrf-api-server.h"
#include "nrf-http2-server.h"
#include "nrf_app.hpp"
#include "nrf_client.hpp"
#include "options.hpp"
#include "pid_file.hpp"
#include "conversions.hpp"
#include "pistache/endpoint.h"
#include "pistache/http.h"
...
...
@@ -39,6 +41,7 @@ using namespace std;
nrf_app
*
nrf_app_inst
=
nullptr
;
nrf_config
nrf_cfg
;
NRFApiServer
*
api_server
=
nullptr
;
nrf_http2_server
*
nrf_api_server_2
=
nullptr
;
//------------------------------------------------------------------------------
void
my_app_signal_handler
(
int
s
)
{
...
...
@@ -112,7 +115,15 @@ int main(int argc, char** argv) {
api_server
=
new
NRFApiServer
(
addr
,
nrf_app_inst
);
api_server
->
init
(
2
);
std
::
thread
nrf_manager
(
&
NRFApiServer
::
start
,
api_server
);
// NRF NGHTTP API server (HTTP2)
nrf_api_server_2
=
new
nrf_http2_server
(
conv
::
toString
(
nrf_cfg
.
sbi
.
addr4
),
nrf_cfg
.
sbi_http2_port
,
nrf_app_inst
);
std
::
thread
nrf_http2_manager
(
&
nrf_http2_server
::
start
,
nrf_api_server_2
);
nrf_manager
.
join
();
nrf_http2_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