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
92b8a6b5
Commit
92b8a6b5
authored
Dec 07, 2020
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Example for NF registration
parent
ff4d54ef
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
90 additions
and
21 deletions
+90
-21
src/api-server/api/NFInstanceIDDocumentApi.cpp
src/api-server/api/NFInstanceIDDocumentApi.cpp
+1
-0
src/api-server/api/NFInstancesStoreApi.h
src/api-server/api/NFInstancesStoreApi.h
+1
-1
src/api-server/api/StoredSearchDocumentApi.h
src/api-server/api/StoredSearchDocumentApi.h
+1
-1
src/api-server/api/SubscriptionIDDocumentApi.h
src/api-server/api/SubscriptionIDDocumentApi.h
+1
-1
src/api-server/api/SubscriptionsCollectionApi.h
src/api-server/api/SubscriptionsCollectionApi.h
+1
-1
src/api-server/impl/NFInstanceIDDocumentApiImpl.cpp
src/api-server/impl/NFInstanceIDDocumentApiImpl.cpp
+11
-1
src/api-server/nrf-api-server.cpp
src/api-server/nrf-api-server.cpp
+3
-2
src/api-server/nrf-api-server.h
src/api-server/nrf-api-server.h
+13
-3
src/nrf_app/nrf_app.cpp
src/nrf_app/nrf_app.cpp
+15
-5
src/nrf_app/nrf_app.hpp
src/nrf_app/nrf_app.hpp
+12
-5
src/nrf_app/nrf_config.hpp
src/nrf_app/nrf_config.hpp
+1
-1
yaml/cmd.txt
yaml/cmd.txt
+1
-0
yaml/registration.json
yaml/registration.json
+29
-0
No files found.
src/api-server/api/NFInstanceIDDocumentApi.cpp
View file @
92b8a6b5
...
...
@@ -13,6 +13,7 @@
#include "NFInstanceIDDocumentApi.h"
#include "Helpers.h"
#include "nrf_config.hpp"
#include "logger.hpp"
extern
oai
::
nrf
::
nrf_config
nrf_cfg
;
...
...
src/api-server/api/NFInstancesStoreApi.h
View file @
92b8a6b5
...
...
@@ -57,7 +57,7 @@ public:
virtual
~
NFInstancesStoreApi
()
{}
void
init
();
const
std
::
string
base
=
"/nnrf-disc/
v1
"
;
const
std
::
string
base
=
"/nnrf-disc/"
;
private:
void
setupRoutes
();
...
...
src/api-server/api/StoredSearchDocumentApi.h
View file @
92b8a6b5
...
...
@@ -40,7 +40,7 @@ public:
virtual
~
StoredSearchDocumentApi
()
{}
void
init
();
const
std
::
string
base
=
"/nnrf-disc/
v1
"
;
const
std
::
string
base
=
"/nnrf-disc/"
;
private:
void
setupRoutes
();
...
...
src/api-server/api/SubscriptionIDDocumentApi.h
View file @
92b8a6b5
...
...
@@ -43,7 +43,7 @@ public:
virtual
~
SubscriptionIDDocumentApi
()
{}
void
init
();
const
std
::
string
base
=
"/nnrf-nfm/
v1
"
;
const
std
::
string
base
=
"/nnrf-nfm/"
;
private:
void
setupRoutes
();
...
...
src/api-server/api/SubscriptionsCollectionApi.h
View file @
92b8a6b5
...
...
@@ -40,7 +40,7 @@ public:
virtual
~
SubscriptionsCollectionApi
()
{}
void
init
();
const
std
::
string
base
=
"/nnrf-nfm/
v1
"
;
const
std
::
string
base
=
"/nnrf-nfm/"
;
private:
void
setupRoutes
();
...
...
src/api-server/impl/NFInstanceIDDocumentApiImpl.cpp
View file @
92b8a6b5
...
...
@@ -11,6 +11,8 @@
*/
#include "NFInstanceIDDocumentApiImpl.h"
#include "logger.hpp"
#include "nrf_app.hpp"
namespace
oai
{
namespace
nrf
{
...
...
@@ -32,7 +34,15 @@ void NFInstanceIDDocumentApiImpl::get_nf_instance(const std::string &nfInstanceI
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
"Do some magic
\n
"
);
}
void
NFInstanceIDDocumentApiImpl
::
register_nf_instance
(
const
std
::
string
&
nfInstanceID
,
const
NFProfile
&
nFProfile
,
const
Pistache
::
Optional
<
Pistache
::
Http
::
Header
::
Raw
>
&
contentEncoding
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
"Do some magic
\n
"
);
Logger
::
nrf_sbi
().
info
(
"Got a request to register an NF instance, Instance ID: %s"
,
nfInstanceID
.
c_str
());
NFProfile
nf_profile
=
nFProfile
;
int
http_code
=
0
;
m_nrf_app
->
handle_nf_instance_registration_request
(
nfInstanceID
,
nf_profile
,
http_code
,
1
);
nlohmann
::
json
json_data
=
{
};
to_json
(
json_data
,
nf_profile
);
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
json_data
.
dump
().
c_str
());
}
void
NFInstanceIDDocumentApiImpl
::
update_nf_instance
(
const
std
::
string
&
nfInstanceID
,
const
std
::
vector
<
PatchItem
>
&
patchItem
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
"Do some magic
\n
"
);
...
...
src/api-server/nrf-api-server.cpp
View file @
92b8a6b5
...
...
@@ -83,8 +83,9 @@ void NRFApiServer::init(size_t thr) {
m_completeStoredSearchDocumentApiImpl
->
init
();
m_nfInstancesStoreApiImpl
->
init
();
m_storedSearchDocumentApiImpl
->
init
();
m_nfInstanceIDDocumentApiImpl
->
init
();
m_subscriptionIDDocumentApiImpl
->
init
();
m_subscriptionsCollectionApiImpl
->
init
();
}
void
NRFApiServer
::
start
()
{
Logger
::
nrf_sbi
().
info
(
"HTTP1 server started"
);
...
...
src/api-server/nrf-api-server.h
View file @
92b8a6b5
...
...
@@ -46,6 +46,10 @@
#include "CompleteStoredSearchDocumentApiImpl.h"
#include "NFInstancesStoreApiImpl.h"
#include "StoredSearchDocumentApiImpl.h"
#include "NFInstanceIDDocumentApiImpl.h"
#include "SubscriptionIDDocumentApiImpl.h"
#include "SubscriptionsCollectionApiImpl.h"
#include "nrf_app.hpp"
using
namespace
oai
::
nrf
::
api
;
...
...
@@ -63,20 +67,26 @@ class NRFApiServer {
m_router
,
nrf_app_inst
,
m_address
);
m_storedSearchDocumentApiImpl
=
std
::
make_shared
<
StoredSearchDocumentApiImpl
>
(
m_router
,
nrf_app_inst
,
m_address
);
m_nfInstanceIDDocumentApiImpl
=
std
::
make_shared
<
NFInstanceIDDocumentApiImpl
>
(
m_router
,
nrf_app_inst
,
m_address
);
m_subscriptionIDDocumentApiImpl
=
std
::
make_shared
<
SubscriptionIDDocumentApiImpl
>
(
m_router
,
nrf_app_inst
,
m_address
);
m_subscriptionsCollectionApiImpl
=
std
::
make_shared
<
SubscriptionsCollectionApiImpl
>
(
m_router
,
nrf_app_inst
,
m_address
);
}
void
init
(
size_t
thr
=
1
);
void
start
();
void
shutdown
();
private:
std
::
shared_ptr
<
Pistache
::
Http
::
Endpoint
>
m_httpEndpoint
;
std
::
shared_ptr
<
Pistache
::
Rest
::
Router
>
m_router
;
std
::
shared_ptr
<
CompleteStoredSearchDocumentApiImpl
>
m_completeStoredSearchDocumentApiImpl
;
std
::
shared_ptr
<
NFInstancesStoreApiImpl
>
m_nfInstancesStoreApiImpl
;
std
::
shared_ptr
<
StoredSearchDocumentApiImpl
>
m_storedSearchDocumentApiImpl
;
std
::
shared_ptr
<
NFInstanceIDDocumentApiImpl
>
m_nfInstanceIDDocumentApiImpl
;
std
::
shared_ptr
<
SubscriptionIDDocumentApiImpl
>
m_subscriptionIDDocumentApiImpl
;
std
::
shared_ptr
<
SubscriptionsCollectionApiImpl
>
m_subscriptionsCollectionApiImpl
;
std
::
string
m_address
;
};
...
...
src/nrf_app/nrf_app.cpp
View file @
92b8a6b5
...
...
@@ -21,10 +21,10 @@
/*! \file nrf_app.cpp
\brief
\author
Lionel GAUTHIER,
Tien-Thinh NGUYEN
\author Tien-Thinh NGUYEN
\company Eurecom
\date 20
19
\email:
lionel.gauthier@eurecom.fr,
tien-thinh.nguyen@eurecom.fr
\date 20
20
\email: tien-thinh.nguyen@eurecom.fr
*/
#include "nrf_app.hpp"
...
...
@@ -38,9 +38,19 @@ extern nrf_app *nrf_app_inst;
extern
nrf_config
nrf_cfg
;
//------------------------------------------------------------------------------
nrf_app
::
nrf_app
(
const
std
::
string
&
config_file
)
{
nrf_app
::
nrf_app
(
const
std
::
string
&
config_file
)
{
Logger
::
nrf_app
().
startup
(
"Starting..."
);
Logger
::
nrf_app
().
startup
(
"Started"
);
}
void
nrf_app
::
handle_nf_instance_registration_request
(
const
std
::
string
&
nfInstanceID
,
oai
::
nrf
::
model
::
NFProfile
&
nf_profile
,
int
&
http_code
,
const
uint8_t
http_version
)
{
Logger
::
nrf_app
().
info
(
"Handle a NF Instance Registration Request (HTTP version %d)"
,
http_version
);
}
src/nrf_app/nrf_app.hpp
View file @
92b8a6b5
...
...
@@ -19,20 +19,21 @@
* contact@openairinterface.org
*/
/*! \file
sm
f_app.hpp
/*! \file
nr
f_app.hpp
\brief
\author
Lionel GAUTHIER,
Tien-Thinh NGUYEN
\author Tien-Thinh NGUYEN
\company Eurecom
\date 20
19
\email:
lionel.gauthier@eurecom.fr,
tien-thinh.nguyen@eurecom.fr
\date 20
20
\email: tien-thinh.nguyen@eurecom.fr
*/
#ifndef FILE_NRF_APP_HPP_SEEN
#define FILE_NRF_APP_HPP_SEEN
#include <string>
#include "NFProfile.h"
namespace
oai
{
namespace
oai
{
namespace
nrf
{
class
nrf_config
;
class
nrf_app
{
...
...
@@ -42,6 +43,12 @@ class nrf_app {
nrf_app
(
nrf_app
const
&
)
=
delete
;
void
operator
=
(
nrf_app
const
&
)
=
delete
;
void
handle_nf_instance_registration_request
(
const
std
::
string
&
nfInstanceID
,
oai
::
nrf
::
model
::
NFProfile
&
nf_profile
,
int
&
http_code
,
const
uint8_t
http_version
);
};
}
}
...
...
src/nrf_app/nrf_config.hpp
View file @
92b8a6b5
...
...
@@ -23,7 +23,7 @@
* \brief
\author Lionel GAUTHIER, Tien-Thinh NGUYEN
\company Eurecom
\date 20
19
\date 20
20
\email: lionel.gauthier@eurecom.fr, tien-thinh.nguyen@eurecom.fr
*/
...
...
yaml/cmd.txt
0 → 100644
View file @
92b8a6b5
curl -X PUT -H "Content-Type: application/json" -d @registration.json http://192.168.1.88/nnrf-nfm/v1/nf-instances/343a924e-6494-4927-860b-d45692c95c2d
yaml/registration.json
0 → 100644
View file @
92b8a6b5
{
"_comment"
:
"NRF Profile"
,
"nfInstanceId"
:
"343a924e-6494-4927-860b-d45692c95c2d"
,
"nfType"
:
"AMF"
,
"nfStatus"
:
"REGISTERED"
,
"heartBeatTimer"
:
10
,
"amfInfo"
:
{
"amfSetId"
:
"1a1a"
,
"amfRegionId"
:
"AA"
,
"guamiList"
:
[
{
"plmnId"
:
{
"mcc"
:
"208"
,
"mnc"
:
"95"
},
"amfId"
:
"AAAAAA"
}
]
}
}
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