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
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-SMF
Commits
9dddb5c1
Commit
9dddb5c1
authored
May 04, 2020
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix issues for encoding/decoding QoS Rules (PDU Session Modification)
parent
878e3e11
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
432 additions
and
316 deletions
+432
-316
src/nas/ies/QOSRules.c
src/nas/ies/QOSRules.c
+164
-130
src/smf_app/smf_context.cpp
src/smf_app/smf_context.cpp
+121
-181
src/smf_app/smf_procedure.cpp
src/smf_app/smf_procedure.cpp
+3
-3
src/test/amf_client/amf-client.cpp
src/test/amf_client/amf-client.cpp
+144
-2
No files found.
src/nas/ies/QOSRules.c
View file @
9dddb5c1
This diff is collapsed.
Click to expand it.
src/smf_app/smf_context.cpp
View file @
9dddb5c1
This diff is collapsed.
Click to expand it.
src/smf_app/smf_procedure.cpp
View file @
9dddb5c1
...
@@ -1123,13 +1123,13 @@ void session_update_sm_context_procedure::handle_itti_msg(
...
@@ -1123,13 +1123,13 @@ void session_update_sm_context_procedure::handle_itti_msg(
//N1 SM
//N1 SM
smf_n1_n2_inst
.
create_n1_sm_container
(
smf_n1_n2_inst
.
create_n1_sm_container
(
n11_triggered_pending
->
res
,
PDU_SESSION_MODIFICATION_
COMMAND
,
n11_triggered_pending
->
res
,
PDU_SESSION_MODIFICATION_
REQUEST
,
n1_sm_msg
,
cause_value_5gsm_e
::
CAUSE_0_UNKNOWN
);
n1_sm_msg
,
cause_value_5gsm_e
::
CAUSE_0_UNKNOWN
);
smf_app_inst
->
convert_string_2_hex
(
n1_sm_msg
,
n1_sm_msg_hex
);
smf_app_inst
->
convert_string_2_hex
(
n1_sm_msg
,
n1_sm_msg_hex
);
n11_triggered_pending
->
res
.
set_n1_sm_message
(
n1_sm_msg_hex
);
n11_triggered_pending
->
res
.
set_n1_sm_message
(
n1_sm_msg_hex
);
//N2 SM Information
//N2 SM Information
smf_n1_n2_inst
.
create_n2_sm_information
(
smf_n1_n2_inst
.
create_n2_sm_information
(
n11_triggered_pending
->
res
,
1
,
n2_sm_info_type_e
::
PDU_RES_
REL_RSP
,
n11_triggered_pending
->
res
,
1
,
n2_sm_info_type_e
::
PDU_RES_
MOD_REQ
,
n2_sm_info
);
n2_sm_info
);
smf_app_inst
->
convert_string_2_hex
(
n2_sm_info
,
n2_sm_info_hex
);
smf_app_inst
->
convert_string_2_hex
(
n2_sm_info
,
n2_sm_info_hex
);
n11_triggered_pending
->
res
.
set_n2_sm_information
(
n2_sm_info_hex
);
n11_triggered_pending
->
res
.
set_n2_sm_information
(
n2_sm_info_hex
);
...
@@ -1138,7 +1138,7 @@ void session_update_sm_context_procedure::handle_itti_msg(
...
@@ -1138,7 +1138,7 @@ void session_update_sm_context_procedure::handle_itti_msg(
n11_triggered_pending
->
res
.
sm_context_updated_data
=
n11_triggered_pending
->
res
.
sm_context_updated_data
=
sm_context_updated_data
;
sm_context_updated_data
;
n11_triggered_pending
->
res
.
sm_context_updated_data
[
"n2InfoContainer"
][
"smInfo"
][
"n2InfoContent"
][
"ngapIeType"
]
=
n11_triggered_pending
->
res
.
sm_context_updated_data
[
"n2InfoContainer"
][
"smInfo"
][
"n2InfoContent"
][
"ngapIeType"
]
=
"PDU_RES_
REL_RSP
"
;
//NGAP message
"PDU_RES_
MOD_REQ
"
;
//NGAP message
}
}
break
;
break
;
...
...
src/test/amf_client/amf-client.cpp
View file @
9dddb5c1
...
@@ -383,6 +383,142 @@ void send_pdu_session_update_sm_context_establishment(
...
@@ -383,6 +383,142 @@ void send_pdu_session_update_sm_context_establishment(
free
(
buffer
);
free
(
buffer
);
}
}
//------------------------------------------------------------------------------
void
send_pdu_session_modification_request_step1
(
std
::
string
smf_ip_address
)
{
std
::
cout
<<
"[AMF N11] PDU Session Modification Request (SM Context Update, Step 1)"
<<
std
::
endl
;
nlohmann
::
json
pdu_session_modification_request
;
//encode PDU Session Modification Request
/*
0000 2e 01 01 d1 00 00 00 00 00 00 00 00 00 00 00 00
*/
size_t
buffer_size
=
128
;
char
*
buffer
=
(
char
*
)
calloc
(
1
,
buffer_size
);
int
size
=
0
;
ENCODE_U8
(
buffer
,
0x2e
,
size
);
//ExtendedProtocolDiscriminator
ENCODE_U8
(
buffer
+
size
,
0x01
,
size
);
//PDUSessionIdentity
ENCODE_U8
(
buffer
+
size
,
0x01
,
size
);
//ProcedureTransactionIdentity
ENCODE_U8
(
buffer
+
size
,
0xc9
,
size
);
//MessageType - PDU Session Modification Request
ENCODE_U8
(
buffer
+
size
,
0x28
,
size
);
//_5GSMCapability
ENCODE_U8
(
buffer
+
size
,
0x01
,
size
);
//_5GSMCapability
ENCODE_U8
(
buffer
+
size
,
0x00
,
size
);
//_5GSMCapability
ENCODE_U8
(
buffer
+
size
,
0x59
,
size
);
//_5GSMCause
ENCODE_U8
(
buffer
+
size
,
0x00
,
size
);
//_5GSMCause
ENCODE_U8
(
buffer
+
size
,
0x7a
,
size
);
//_5GSMCause
ENCODE_U8
(
buffer
+
size
,
0x00
,
size
);
//_5GSMCause
ENCODE_U8
(
buffer
+
size
,
0x09
,
size
);
//_5GSMCause
ENCODE_U8
(
buffer
+
size
,
0x01
,
size
);
//_5GSMCause
ENCODE_U8
(
buffer
+
size
,
0x00
,
size
);
//_5GSMCause
ENCODE_U8
(
buffer
+
size
,
0x06
,
size
);
//_5GSMCause
ENCODE_U8
(
buffer
+
size
,
0x31
,
size
);
//_5GSMCause
ENCODE_U8
(
buffer
+
size
,
0x31
,
size
);
//_5GSMCause
ENCODE_U8
(
buffer
+
size
,
0x01
,
size
);
//_5GSMCause
ENCODE_U8
(
buffer
+
size
,
0x01
,
size
);
//_5GSMCause
ENCODE_U8
(
buffer
+
size
,
0x01
,
size
);
//_5GSMCause
ENCODE_U8
(
buffer
+
size
,
0x3c
,
size
);
//_5GSMCause
// ENCODE_U8(buffer + size, 0x00, size); //MaximumNumberOfSupportedPacketFilters
// ENCODE_U8(buffer + size, 0x01, size); //MaximumNumberOfSupportedPacketFilters
/*
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
PDUSessionIdentity pdusessionidentity;
ProcedureTransactionIdentity proceduretransactionidentity;
MessageType messagetype;
uint16_t presence;
_5GSMCapability _5gsmcapability;
_5GSMCause _5gsmcause;
MaximumNumberOfSupportedPacketFilters maximumnumberofsupportedpacketfilters;
AlwaysonPDUSessionRequested alwaysonpdusessionrequested;
IntergrityProtectionMaximumDataRate intergrityprotectionmaximumdatarate;
QOSRules qosrules;
QOSFlowDescriptions qosflowdescriptions;
MappedEPSBearerContexts mappedepsbearercontexts;
ExtendedProtocolConfigurationOptions extendedprotocolconfigurationoptions;
*/
std
::
cout
<<
"Buffer: "
<<
std
::
endl
;
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
printf
(
"%02x "
,
buffer
[
i
]);
}
std
::
cout
<<
"Buffer: "
<<
std
::
endl
;
std
::
string
url
=
std
::
string
(
"http://"
);
url
.
append
(
smf_ip_address
);
url
.
append
(
std
::
string
(
"/nsmf-pdusession/v2/sm-contexts/1/modify"
));
//Fill the json part
pdu_session_modification_request
[
"pduSessionId"
]
=
1
;
pdu_session_modification_request
[
"n1SmMsg"
][
"contentId"
]
=
"n1SmMsg"
;
// NAS
std
::
string
body
;
std
::
string
boundary
=
"----Boundary"
;
std
::
string
json_part
=
pdu_session_modification_request
.
dump
();
std
::
string
n1_msg
(
reinterpret_cast
<
const
char
*>
(
buffer
),
size
);
create_multipart_related_content
(
body
,
json_part
,
boundary
,
n1_msg
,
multipart_related_content_part_e
::
NAS
);
unsigned
char
*
data
=
(
unsigned
char
*
)
malloc
(
body
.
length
()
+
1
);
memset
(
data
,
0
,
body
.
length
()
+
1
);
memcpy
((
void
*
)
data
,
(
void
*
)
body
.
c_str
(),
body
.
length
());
curl_global_init
(
CURL_GLOBAL_ALL
);
CURL
*
curl
=
curl
=
curl_easy_init
();
if
(
curl
)
{
CURLcode
res
=
{
};
struct
curl_slist
*
headers
=
nullptr
;
//headers = curl_slist_append(headers, "charsets: utf-8");
headers
=
curl_slist_append
(
headers
,
"content-type: multipart/related; boundary=----Boundary"
);
curl_easy_setopt
(
curl
,
CURLOPT_HTTPHEADER
,
headers
);
curl_easy_setopt
(
curl
,
CURLOPT_URL
,
url
.
c_str
());
curl_easy_setopt
(
curl
,
CURLOPT_HTTPGET
,
1
);
curl_easy_setopt
(
curl
,
CURLOPT_TIMEOUT_MS
,
100L
);
//curl_easy_setopt(curl, CURLOPT_INTERFACE, "eno1:amf"); //hardcoded
// Response information.
long
httpCode
=
{
0
};
std
::
unique_ptr
<
std
::
string
>
httpData
(
new
std
::
string
());
curl_easy_setopt
(
curl
,
CURLOPT_WRITEFUNCTION
,
&
callback
);
curl_easy_setopt
(
curl
,
CURLOPT_WRITEDATA
,
httpData
.
get
());
curl_easy_setopt
(
curl
,
CURLOPT_POSTFIELDSIZE
,
body
.
length
());
curl_easy_setopt
(
curl
,
CURLOPT_POSTFIELDS
,
data
);
res
=
curl_easy_perform
(
curl
);
curl_easy_getinfo
(
curl
,
CURLINFO_RESPONSE_CODE
,
&
httpCode
);
//get cause from the response
nlohmann
::
json
response_data
;
try
{
response_data
=
nlohmann
::
json
::
parse
(
*
httpData
.
get
());
}
catch
(
nlohmann
::
json
::
exception
&
e
)
{
std
::
cout
<<
"Could not get json data from the response"
<<
std
::
endl
;
}
std
::
cout
<<
"[AMF N11] PDU Session Modification Request, response from SMF, Http Code "
<<
httpCode
<<
std
::
endl
;
curl_easy_cleanup
(
curl
);
}
curl_global_cleanup
();
free
(
buffer
);
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
send_pdu_session_release_request
(
std
::
string
smf_ip_address
)
{
void
send_pdu_session_release_request
(
std
::
string
smf_ip_address
)
{
...
@@ -879,16 +1015,22 @@ int main(int argc, char *argv[]) {
...
@@ -879,16 +1015,22 @@ int main(int argc, char *argv[]) {
usleep
(
100000
);
usleep
(
100000
);
send_pdu_session_update_sm_context_establishment
(
smf_ip_address
);
send_pdu_session_update_sm_context_establishment
(
smf_ip_address
);
usleep
(
200000
);
usleep
(
200000
);
//UE-initiated Service Request
/*
//UE-initiated Service Request
send_pdu_session_update_sm_context_ue_service_request(smf_ip_address);
send_pdu_session_update_sm_context_ue_service_request(smf_ip_address);
usleep(200000);
usleep(200000);
send_pdu_session_update_sm_context_ue_service_request_step2(smf_ip_address);
send_pdu_session_update_sm_context_ue_service_request_step2(smf_ip_address);
usleep(200000);
*/
//PDU Session Modification
send_pdu_session_modification_request_step1
(
smf_ip_address
);
//PDU Session Release procedure
//PDU Session Release procedure
send_pdu_session_release_request
(
smf_ip_address
);
/*
send_pdu_session_release_request(smf_ip_address);
usleep(200000);
usleep(200000);
send_pdu_session_release_resource_release_ack(smf_ip_address);
send_pdu_session_release_resource_release_ack(smf_ip_address);
usleep(200000);
usleep(200000);
send_pdu_session_release_complete(smf_ip_address);
send_pdu_session_release_complete(smf_ip_address);
usleep(200000);
*/
return
0
;
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