Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-SMF-Simple
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
CommunityXG
OpenXG-SMF-Simple
Commits
59a46d6e
Commit
59a46d6e
authored
Jun 13, 2020
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update AMF client to allow testing different scenarios
parent
f86d7e29
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
142 additions
and
55 deletions
+142
-55
src/test/amf_client/amf-client.cpp
src/test/amf_client/amf-client.cpp
+142
-55
No files found.
src/test/amf_client/amf-client.cpp
View file @
59a46d6e
...
...
@@ -4,6 +4,7 @@
#include <string>
#include <unistd.h>
#include <stdexcept>
#include <thread>
#ifndef CURLPIPE_MULTIPLEX
#define CURLPIPE_MULTIPLEX 0
...
...
@@ -1476,6 +1477,143 @@ void send_release_sm_context_request(uint8_t pid, uint8_t context_id,
}
//------------------------------------------------------------------------------
bool
pdu_session_establishment
(
uint8_t
pid
,
uint8_t
context_id
,
std
::
string
smf_ip_address
,
uint8_t
http_version
,
std
::
string
port
)
{
bool
status
=
false
;
if
(
send_pdu_session_establishment_request
(
pid
,
smf_ip_address
,
http_version
,
port
))
{
usleep
(
100000
);
status
=
send_pdu_session_update_sm_context_establishment
(
context_id
,
smf_ip_address
,
http_version
,
port
);
}
return
status
;
}
//------------------------------------------------------------------------------
void
test_all_procedures_for_one_session
(
uint8_t
pid
,
uint8_t
context_id
,
std
::
string
smf_ip_address
,
uint8_t
http_version
,
std
::
string
port
)
{
bool
status
=
false
;
if
(
send_pdu_session_establishment_request
(
pid
,
smf_ip_address
,
http_version
,
port
))
{
usleep
(
100000
);
status
=
send_pdu_session_update_sm_context_establishment
(
context_id
,
smf_ip_address
,
http_version
,
port
);
}
if
(
status
)
{
usleep
(
200000
);
//UE-initiated Service Request
send_pdu_session_update_sm_context_ue_service_request
(
context_id
,
smf_ip_address
,
http_version
,
port
);
usleep
(
200000
);
send_pdu_session_update_sm_context_ue_service_request_step2
(
context_id
,
smf_ip_address
,
http_version
,
port
);
usleep
(
200000
);
//PDU Session Modification
send_pdu_session_modification_request_step1
(
pid
,
context_id
,
smf_ip_address
,
http_version
,
port
);
usleep
(
200000
);
send_pdu_session_modification_request_step2
(
context_id
,
smf_ip_address
,
http_version
,
port
);
usleep
(
200000
);
send_pdu_session_modification_complete
(
pid
,
context_id
,
smf_ip_address
,
http_version
,
port
);
usleep
(
200000
);
//PDU Session Release procedure
send_pdu_session_release_request
(
pid
,
context_id
,
smf_ip_address
,
http_version
,
port
);
usleep
(
200000
);
send_pdu_session_release_resource_release_ack
(
context_id
,
smf_ip_address
,
http_version
,
port
);
usleep
(
200000
);
send_pdu_session_release_complete
(
pid
,
context_id
,
smf_ip_address
,
http_version
,
port
);
usleep
(
200000
);
//Release SM context
//send_release_sm_context_request(pid, smf_ip_address, http_version, port);
}
}
//------------------------------------------------------------------------------
void
test_session_establishment_multiple_threads
(
std
::
string
smf_ip_address
,
uint8_t
http_version
,
std
::
string
port
)
{
std
::
vector
<
std
::
thread
>
pdu_threads
;
for
(
int
i
=
0
;
i
<
10
;
i
++
)
{
std
::
thread
session_establishment
(
&
pdu_session_establishment
,
i
,
i
,
smf_ip_address
,
http_version
,
port
);
pdu_threads
.
push_back
(
std
::
move
(
session_establishment
));
}
for
(
auto
&
t
:
pdu_threads
)
{
t
.
join
();
}
}
//------------------------------------------------------------------------------
void
test_all_procedures_for_multiple_threads
(
std
::
string
smf_ip_address
,
uint8_t
http_version
,
std
::
string
port
)
{
uint8_t
pid
=
1
;
uint8_t
context_id
=
1
;
//bool status = false;
std
::
thread
t1
(
&
send_pdu_session_establishment_request
,
pid
,
smf_ip_address
,
http_version
,
port
);
std
::
thread
t2
(
&
send_pdu_session_update_sm_context_establishment
,
context_id
,
smf_ip_address
,
http_version
,
port
);
std
::
thread
t3
(
&
send_pdu_session_update_sm_context_ue_service_request
,
context_id
,
smf_ip_address
,
http_version
,
port
);
std
::
thread
t4
(
&
send_pdu_session_update_sm_context_ue_service_request_step2
,
context_id
,
smf_ip_address
,
http_version
,
port
);
std
::
thread
t5
(
&
send_pdu_session_modification_request_step1
,
pid
,
context_id
,
smf_ip_address
,
http_version
,
port
);
std
::
thread
t6
(
&
send_pdu_session_modification_request_step2
,
context_id
,
smf_ip_address
,
http_version
,
port
);
std
::
thread
t7
(
&
send_pdu_session_modification_complete
,
pid
,
context_id
,
smf_ip_address
,
http_version
,
port
);
//PDU Session Release procedure
std
::
thread
t8
(
&
send_pdu_session_release_request
,
pid
,
context_id
,
smf_ip_address
,
http_version
,
port
);
std
::
thread
t9
(
&
send_pdu_session_release_resource_release_ack
,
context_id
,
smf_ip_address
,
http_version
,
port
);
std
::
thread
t10
(
&
send_pdu_session_release_complete
,
pid
,
context_id
,
smf_ip_address
,
http_version
,
port
);
//Release SM context
//send_release_sm_context_request(pid, smf_ip_address, http_version, port);
t1
.
join
();
t2
.
join
();
t3
.
join
();
t4
.
join
();
t5
.
join
();
t6
.
join
();
t7
.
join
();
t8
.
join
();
t9
.
join
();
t10
.
join
();
}
//------------------------------------------------------------------------------
int
main
(
int
argc
,
char
*
argv
[])
{
std
::
string
smf_ip_address
;
...
...
@@ -1524,62 +1662,11 @@ int main(int argc, char *argv[]) {
uint8_t
context_id
=
1
;
uint8_t
pid
=
1
;
/*//Check multiple sessions
for (int i=1; i< 10; i++){
//PDU Session Establishment procedure
if (send_pdu_session_establishment_request(i, smf_ip_address, http_version, port)) {
usleep(100000);
cont = send_pdu_session_update_sm_context_establishment(i, smf_ip_address, http_version,
port);
}
}
*/
if
(
send_pdu_session_establishment_request
(
pid
,
smf_ip_address
,
http_version
,
port
))
{
usleep
(
100000
);
cont
=
send_pdu_session_update_sm_context_establishment
(
context_id
,
smf_ip_address
,
http_version
,
port
);
}
if
(
cont
)
{
usleep
(
200000
);
//UE-initiated Service Request
send_pdu_session_update_sm_context_ue_service_request
(
context_id
,
smf_ip_address
,
http_version
,
port
);
usleep
(
200000
);
send_pdu_session_update_sm_context_ue_service_request_step2
(
context_id
,
smf_ip_address
,
http_version
,
port
);
usleep
(
200000
);
//PDU Session Modification
send_pdu_session_modification_request_step1
(
pid
,
context_id
,
smf_ip_address
,
http_version
,
port
);
usleep
(
200000
);
send_pdu_session_modification_request_step2
(
context_id
,
smf_ip_address
,
http_version
,
port
);
usleep
(
200000
);
send_pdu_session_modification_complete
(
pid
,
context_id
,
smf_ip_address
,
http_version
,
port
);
usleep
(
200000
);
//PDU Session Release procedure
send_pdu_session_release_request
(
pid
,
context_id
,
smf_ip_address
,
http_version
,
port
);
usleep
(
200000
);
send_pdu_session_release_resource_release_ack
(
context_id
,
smf_ip_address
,
http_version
,
port
);
usleep
(
200000
);
send_pdu_session_release_complete
(
pid
,
context_id
,
smf_ip_address
,
test_all_procedures_for_one_session
(
pid
,
context_id
,
smf_ip_address
,
http_version
,
port
);
}
usleep
(
200000
);
//Release SM context
//send_release_sm_context_request(pid, smf_ip_address, http_version, port);
//test_session_establishment_multiple_threads(smf_ip_address, http_version, port);
//test_all_procedures_for_multiple_threads(smf_ip_address, http_version,
// port);
return
0
;
}
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