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
4a0e1afd
Commit
4a0e1afd
authored
Jan 12, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issue for multi curl
parent
14dcfd4d
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
85 additions
and
67 deletions
+85
-67
src/common/nrf.h
src/common/nrf.h
+3
-1
src/nrf_app/nrf_app.cpp
src/nrf_app/nrf_app.cpp
+8
-0
src/nrf_app/nrf_app.hpp
src/nrf_app/nrf_app.hpp
+1
-6
src/nrf_app/nrf_client.cpp
src/nrf_app/nrf_client.cpp
+62
-53
src/nrf_app/nrf_client.hpp
src/nrf_app/nrf_client.hpp
+7
-4
test/cmd.txt
test/cmd.txt
+4
-3
No files found.
src/common/nrf.h
View file @
4a0e1afd
...
@@ -79,6 +79,8 @@ typedef uint32_t evsub_id_t;
...
@@ -79,6 +79,8 @@ typedef uint32_t evsub_id_t;
#define NNRF_NFM_BASE "/nnrf-nfm/"
#define NNRF_NFM_BASE "/nnrf-nfm/"
#define NNRF_NFM_NF_INSTANCE "/nf-instances/"
#define NNRF_NFM_NF_INSTANCE "/nf-instances/"
#define MAX_WAIT_MSECS 1000 //1 second
#define NF_CURL_TIMEOUT_MS 1000L
#define MAX_WAIT_MSECS 20000 //1 second
#endif
#endif
src/nrf_app/nrf_app.cpp
View file @
4a0e1afd
...
@@ -80,6 +80,14 @@ nrf_app::nrf_app(const std::string &config_file, nrf_event &ev)
...
@@ -80,6 +80,14 @@ nrf_app::nrf_app(const std::string &config_file, nrf_event &ev)
Logger
::
nrf_app
().
startup
(
"Started"
);
Logger
::
nrf_app
().
startup
(
"Started"
);
}
}
nrf_app
::~
nrf_app
()
{
Logger
::
nrf_app
().
debug
(
"Delete NRF_APP instance..."
);
for
(
auto
i
:
connections
)
{
if
(
i
.
connected
())
i
.
disconnect
();
}
if
(
nrf_client_inst
)
delete
nrf_client_inst
;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
nrf_app
::
generate_uuid
()
{
void
nrf_app
::
generate_uuid
()
{
nrf_instance_id
=
to_string
(
boost
::
uuids
::
random_generator
()());
nrf_instance_id
=
to_string
(
boost
::
uuids
::
random_generator
()());
...
...
src/nrf_app/nrf_app.hpp
View file @
4a0e1afd
...
@@ -54,12 +54,7 @@ class nrf_app {
...
@@ -54,12 +54,7 @@ class nrf_app {
nrf_app
(
nrf_app
const
&
)
=
delete
;
nrf_app
(
nrf_app
const
&
)
=
delete
;
void
operator
=
(
nrf_app
const
&
)
=
delete
;
void
operator
=
(
nrf_app
const
&
)
=
delete
;
virtual
~
nrf_app
()
{
virtual
~
nrf_app
();
Logger
::
nrf_app
().
debug
(
"Delete NRF_APP instance..."
);
for
(
auto
i
:
connections
)
{
if
(
i
.
connected
())
i
.
disconnect
();
}
}
/*
/*
* Generate a random UUID for NRF instance
* Generate a random UUID for NRF instance
...
...
src/nrf_app/nrf_client.cpp
View file @
4a0e1afd
This diff is collapsed.
Click to expand it.
src/nrf_app/nrf_client.hpp
View file @
4a0e1afd
...
@@ -43,6 +43,7 @@ class nrf_client {
...
@@ -43,6 +43,7 @@ class nrf_client {
private:
private:
CURLM
*
curl_multi
;
CURLM
*
curl_multi
;
std
::
vector
<
CURL
*>
handles
;
std
::
vector
<
CURL
*>
handles
;
struct
curl_slist
*
headers
;
nrf_event
&
m_event_sub
;
nrf_event
&
m_event_sub
;
bs2
::
connection
bs2
::
connection
task_connection
;
// connection for performing curl_multi every 1ms
task_connection
;
// connection for performing curl_multi every 1ms
...
@@ -50,6 +51,7 @@ class nrf_client {
...
@@ -50,6 +51,7 @@ class nrf_client {
public:
public:
nrf_client
(
nrf_event
&
ev
);
nrf_client
(
nrf_event
&
ev
);
virtual
~
nrf_client
();
virtual
~
nrf_client
();
nrf_client
(
nrf_client
const
&
)
=
delete
;
nrf_client
(
nrf_client
const
&
)
=
delete
;
void
operator
=
(
nrf_client
const
&
)
=
delete
;
void
operator
=
(
nrf_client
const
&
)
=
delete
;
...
@@ -62,16 +64,17 @@ class nrf_client {
...
@@ -62,16 +64,17 @@ class nrf_client {
void
notify_subscribed_event
(
const
std
::
shared_ptr
<
nrf_profile
>
&
profile
,
void
notify_subscribed_event
(
const
std
::
shared_ptr
<
nrf_profile
>
&
profile
,
const
std
::
string
&
uri
);
const
std
::
string
&
uri
);
/*
/*
* Send Notification for the associated event to the subscriber
* Send Notification for the associated event to the subscriber
* @param [const std::shared_ptr<nrf_profile> &] profile: NF profile
* @param [const std::shared_ptr<nrf_profile> &] profile: NF profile
* @param [const std::string &] uri: URI of the subscribed NF
* @param [const std::string &] uri: URI of the subscribed NF
* @return void
* @return void
*/
*/
/* void notify_subscribed_event_with_curl
_multi(
void
notify_subscribed_event
_multi
(
const
std
::
shared_ptr
<
nrf_profile
>
&
profile
,
const
uint8_t
&
event_type
,
const
std
::
shared_ptr
<
nrf_profile
>
&
profile
,
const
uint8_t
&
event_type
,
const
std
::
vector
<
std
::
string
>
&
uris
);
const
std
::
vector
<
std
::
string
>
&
uris
);
*/
/*
/*
* Send Notification for the associated event to the subscribers
* Send Notification for the associated event to the subscribers
...
...
test/cmd.txt
View file @
4a0e1afd
...
@@ -9,17 +9,18 @@ curl -X GET "http://192.168.1.23/nnrf-nfm/v1/nf-instances/
...
@@ -9,17 +9,18 @@ curl -X GET "http://192.168.1.23/nnrf-nfm/v1/nf-instances/
#Update
#Update
curl -X PATCH -H "Content-Type: application/json" http://192.168.1.23/nnrf-nfm/v1/nf-instances/343a924e-6494-4927-860b-d45692c95c2d -d '[{"op":"replace","path":"/nfInstanceName", "value": "NEW NAME"}]'
curl -X PATCH -H "Content-Type: application/json" http://192.168.1.23/nnrf-nfm/v1/nf-instances/343a924e-6494-4927-860b-d45692c95c2d -d '[{"op":"replace","path":"/nfInstanceName", "value": "NEW NAME"}]'
curl -X POST http://192.168.1.23
/nnrf-nfm/v1/subscriptions -d '{"nfStatusNotificationUri":"http://192.168.1.23/nnrf-nfm/v1/nf-instances/343a924e-6494-4927-860b-d45692c95c2d", "subscrCond": {"NfTypeCond": {"nfType":"A
MF"} } }'
curl -X POST http://192.168.1.23
:8080/nnrf-nfm/v1/subscriptions -d '{"nfStatusNotificationUri":"http://192.168.1.23:8080/nnrf-nfm/v1/nf-instances/343a924e-6494-4927-860b-d45692c95c2d", "subscrCond": {"NfTypeCond": {"nfType":"S
MF"} } }'
curl -X POST http://192.168.1.23/nnrf-nfm/v1/subscriptions -d '{"nfStatusNotificationUri":"http://192.168.1.23/nnrf-nfm/v1/nf-instances/343a924e-6494-4927-860b-d45692c95c2d", "subscrCond": {"NfInstanceIdCond": {"nfInstanceId":"AMF"} } }'
curl -X POST http://192.168.1.23/nnrf-nfm/v1/subscriptions -d '{"nfStatusNotificationUri":"http://192.168.1.23/nnrf-nfm/v1/nf-instances/343a924e-6494-4927-860b-d45692c95c2d", "subscrCond": {"NfInstanceIdCond": {"nfInstanceId":"AMF"} } }'
curl -X POST http://192.168.1.23/nnrf-nfm/v1/subscriptions -d '{"nfStatusNotificationUri":"http://192.168.1.23/nnrf-nfm/v1/nf-instances/343a924e-6494-4927-860b-d45692c95c2d", "subscrCond": {"NfTypeCond": {"nfType":"AMF"} } }'
curl -X POST http://192.168.1.23/nnrf-nfm/v1/subscriptions -d '{"nfStatusNotificationUri":"http://192.168.1.23/nnrf-nfm/v1/nf-instances/343a924e-6494-4927-860b-d45692c95c2d", "subscrCond": {"NfTypeCond": {"nfType":"AMF"} } }'
curl -X POST -H "Content-Type: application/json" "http://192.168.1.23/nnrf-nfm/v1/subscriptions" -d '{"nfStatusNotificationUri":"http://192.168.1.23/nnrf-nfm/v1/nf-instances/343a924e-6494-4927-860b-d45692c95c2d", "subscrCond": {"NfTypeCond": {"nfType":"AMF"}}, "reqNotifEvents":["NF_REGISTERED", "NF_DEREGISTERED"], "validityTime":"20020131T235959" }'
#Suscription
curl -X POST -H "Content-Type: application/json" "http://192.168.1.23:8080/nnrf-nfm/v1/subscriptions" -d '{"nfStatusNotificationUri":"http://192.168.1.23/nnrf-disc/v1/nf-instances?target-nf-type=SMF&requester-nf-type=AMF", "subscrCond": {"NfTypeCond": {"nfType":"SMF"}}, "reqNotifEvents":["NF_REGISTERED", "NF_DEREGISTERED"], "validityTime":"20210531T235959" }'
curl -X PATCH -H "Content-Type: application/json" http://192.168.1.23/nnrf-nfm/v1/subscriptions/1 -d '[{"op":"replace","path":"/validityTime", "value": "20201231T235959"}]'
curl -X PATCH -H "Content-Type: application/json" http://192.168.1.23/nnrf-nfm/v1/subscriptions/1 -d '[{"op":"replace","path":"/validityTime", "value": "20201231T235959"}]'
#Discovery
#Discovery
curl -X GET "http://192.168.1.23/nnrf-disc/v1/nf-instances?target-nf-type=
"SMF"&requester-nf-type="AMF"
"
curl -X GET "http://192.168.1.23/nnrf-disc/v1/nf-instances?target-nf-type=
SMF&requester-nf-type=AMF
"
#Access Token
#Access Token
curl -d "grant_type=client_credentials&nfInstanceId=343a924e-6494-4927-860b-d45692c95c2d&scope=nsmf-pdusession" -H "Content-Type: application/x-www-form-urlencoded" -X POST http://192.168.1.23/oauth2/token
curl -d "grant_type=client_credentials&nfInstanceId=343a924e-6494-4927-860b-d45692c95c2d&scope=nsmf-pdusession" -H "Content-Type: application/x-www-form-urlencoded" -X POST http://192.168.1.23/oauth2/token
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