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
27b9f1d2
Commit
27b9f1d2
authored
Mar 25, 2020
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update AMF, UDM for testing purpose
parent
d7f7bbf3
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
144 additions
and
16 deletions
+144
-16
src/test/amf/api/N1N2MessageCollectionDocumentApi.cpp
src/test/amf/api/N1N2MessageCollectionDocumentApi.cpp
+10
-3
src/test/amf_client/amf-client.cpp
src/test/amf_client/amf-client.cpp
+125
-4
src/test/udm/impl/SessionManagementSubscriptionDataRetrievalApiImpl.cpp
...mpl/SessionManagementSubscriptionDataRetrievalApiImpl.cpp
+8
-8
src/test/udm/udm-api-server.cpp
src/test/udm/udm-api-server.cpp
+1
-1
No files found.
src/test/amf/api/N1N2MessageCollectionDocumentApi.cpp
View file @
27b9f1d2
...
@@ -43,9 +43,15 @@ void N1N2MessageCollectionDocumentApi::n1_n2_message_transfer_handler(const Pist
...
@@ -43,9 +43,15 @@ void N1N2MessageCollectionDocumentApi::n1_n2_message_transfer_handler(const Pist
std
::
cout
<<
"Received a N1N2MessageTrasfer request with ueID "
<<
ueContextId
.
c_str
()
<<
std
::
endl
;
std
::
cout
<<
"Received a N1N2MessageTrasfer request with ueID "
<<
ueContextId
.
c_str
()
<<
std
::
endl
;
// Getting the body param
// Getting the body param
//N1N2MessageTransferReqData n1N2MessageTransferReqData;
nlohmann
::
json
response_data
;
response_data
[
"cause"
]
=
"504 Gateway Timeout"
;
response_data
.
dump
().
c_str
();
response
.
headers
().
add
<
Pistache
::
Http
::
Header
::
ContentType
>
(
Pistache
::
Http
::
Mime
::
MediaType
(
"application/json"
));
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
response_data
.
dump
().
c_str
());
N1N2MessageTransferReqData
n1N2MessageTransferReqData
;
/*
try {
try {
nlohmann::json::parse(request.body()).get_to(n1N2MessageTransferReqData);
nlohmann::json::parse(request.body()).get_to(n1N2MessageTransferReqData);
this->n1_n2_message_transfer(ueContextId, n1N2MessageTransferReqData, response);
this->n1_n2_message_transfer(ueContextId, n1N2MessageTransferReqData, response);
...
@@ -58,6 +64,7 @@ void N1N2MessageCollectionDocumentApi::n1_n2_message_transfer_handler(const Pist
...
@@ -58,6 +64,7 @@ void N1N2MessageCollectionDocumentApi::n1_n2_message_transfer_handler(const Pist
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
return;
return;
}
}
*/
}
}
...
...
src/test/amf_client/amf-client.cpp
View file @
27b9f1d2
...
@@ -175,9 +175,9 @@ void send_pdu_session_establishment_request()
...
@@ -175,9 +175,9 @@ void send_pdu_session_establishment_request()
}
}
void
send_pdu_session_
modification
()
void
send_pdu_session_
update_sm_context_establishment
()
{
{
std
::
cout
<<
"[AMF N11]
PDU Session Modification
"
<<
std
::
endl
;
std
::
cout
<<
"[AMF N11]
send_pdu_session_update_sm_context_establishment
"
<<
std
::
endl
;
nlohmann
::
json
pdu_session_modification_request
;
nlohmann
::
json
pdu_session_modification_request
;
std
::
string
n2_msg
=
"0003e0ac0a0501000000010000"
;
std
::
string
n2_msg
=
"0003e0ac0a0501000000010000"
;
...
@@ -308,13 +308,134 @@ void send_pdu_session_modification()
...
@@ -308,13 +308,134 @@ void send_pdu_session_modification()
}
}
}
}
void
send_pdu_session_update_sm_context_modification
()
{
std
::
cout
<<
"[AMF N11] send_pdu_session_update_sm_context_modification"
<<
std
::
endl
;
nlohmann
::
json
pdu_session_modification_request
;
std
::
string
n2_msg
=
"0003e0ac0a0501000000010000"
;
//format string as hex
unsigned
char
*
n2_msg_hex
=
format_string_as_hex
(
n2_msg
);
//encode
size_t
buffer_size
=
128
;
char
*
buffer
=
(
char
*
)
calloc
(
1
,
buffer_size
);
int
size
=
0
;
ENCODE_U8
(
buffer
,
0x2e
,
size
);
ENCODE_U8
(
buffer
+
size
,
0x01
,
size
);
ENCODE_U8
(
buffer
+
size
,
0x01
,
size
);
ENCODE_U8
(
buffer
+
size
,
0xc1
,
size
);
ENCODE_U8
(
buffer
+
size
,
0xff
,
size
);
ENCODE_U8
(
buffer
+
size
,
0xff
,
size
);
ENCODE_U8
(
buffer
+
size
,
0x95
,
size
);
////step 1.a,UE-initiated: SM Context ID + N1 (PDU Session Modification Request)
std
::
cout
<<
"Buffer: "
<<
std
::
endl
;
for
(
int
i
=
0
;
i
<
2
;
i
++
)
{
printf
(
"%02x "
,
buffer
[
i
]);
}
std
::
cout
<<
"Buffer: "
<<
std
::
endl
;
//Fill Json part
//get supi and put into URL
std
::
string
supi_str
;
//std::string url = std::string("http://172.16.1.101/nsmf-pdusession/v2/sm-contexts");
//std::string url = std::string("http://172.16.1.101/nsmf-pdusession/v2/sm-contexts/imsi-200000000000001/modify");
std
::
string
url
=
std
::
string
(
"http://172.16.1.101/nsmf-pdusession/v2/sm-contexts/1/modify"
);
//Fill the json part
pdu_session_modification_request
[
"n1SmMsg"
][
"contentId"
]
=
"n1SmMsg"
;
//part 2
//N1SM
//pdu_session_establishment_request["n1SmMsg"] = "SM";
//pdu_session_establishment_request["n1SmMsg"]["contentId"] = "n1SmMsg"; //part 2
CURL
*
curl
=
curl_easy_init
();
//N1N2MessageTransfer Notification URI??
std
::
string
json_part
=
pdu_session_modification_request
.
dump
();
std
::
cout
<<
" Sending message to SMF....
\n
"
;
if
(
curl
)
{
std
::
cout
<<
"send curl command"
<<
std
::
endl
;
CURLcode
res
;
struct
curl_slist
*
headers
=
nullptr
;
struct
curl_slist
*
slist
=
nullptr
;
curl_mime
*
mime
;
curl_mime
*
alt
;
curl_mimepart
*
part
;
headers
=
curl_slist_append
(
headers
,
"charsets: utf-8"
);
headers
=
curl_slist_append
(
headers
,
"content-type: multipart/related"
);
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
);
mime
=
curl_mime_init
(
curl
);
alt
=
curl_mime_init
(
curl
);
//part with N1N2MessageTransferReqData (JsonData)
part
=
curl_mime_addpart
(
mime
);
curl_mime_data
(
part
,
json_part
.
c_str
(),
CURL_ZERO_TERMINATED
);
curl_mime_type
(
part
,
"application/json"
);
part
=
curl_mime_addpart
(
mime
);
curl_mime_data
(
part
,
reinterpret_cast
<
const
char
*>
(
buffer
),
size
);
//curl_mime_data(part, "\x00\x03\xe0\xac\x0a\x05\x01\x01\x01\x01\x01\x00\x00", CURL_ZERO_TERMINATED);
//curl_mime_data(part, "\x2e\x01\x01\xc1\xff\xff\x95", CURL_ZERO_TERMINATED);
curl_mime_type
(
part
,
"application/vnd.3gpp.5gnas"
);
curl_mime_name
(
part
,
"n1SmMsg"
);
curl_easy_setopt
(
curl
,
CURLOPT_MIMEPOST
,
mime
);
//res = curl_easy_perform(curl);
// Response information.
long
httpCode
(
0
);
std
::
unique_ptr
<
std
::
string
>
httpData
(
new
std
::
string
());
// Hook up data handling function.
curl_easy_setopt
(
curl
,
CURLOPT_WRITEFUNCTION
,
&
callback
);
curl_easy_setopt
(
curl
,
CURLOPT_WRITEDATA
,
httpData
.
get
());
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 the cause from the response"
<<
std
::
endl
;
//Set the default Cause
response_data
[
"cause"
]
=
"504 Gateway Timeout"
;
}
std
::
cout
<<
"[AMF N11] PDU session modification request, response from SMF, Http Code "
<<
httpCode
<<
" cause "
<<
response_data
[
"cause"
].
dump
().
c_str
()
<<
std
::
endl
;
curl_slist_free_all
(
headers
);
curl_easy_cleanup
(
curl
);
curl_mime_free
(
mime
);
}
}
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
{
{
send_pdu_session_establishment_request
();
send_pdu_session_establishment_request
();
usleep
(
10000
);
usleep
(
10000
);
send_pdu_session_modification
();
//send_pdu_session_update_sm_context_establishment
();
send_pdu_session_update_sm_context_modification
();
return
0
;
return
0
;
}
}
src/test/udm/impl/SessionManagementSubscriptionDataRetrievalApiImpl.cpp
View file @
27b9f1d2
...
@@ -44,14 +44,14 @@ void SessionManagementSubscriptionDataRetrievalApiImpl::get_sm_data(const std::s
...
@@ -44,14 +44,14 @@ void SessionManagementSubscriptionDataRetrievalApiImpl::get_sm_data(const std::s
nlohmann
::
json
jsonData
;
nlohmann
::
json
jsonData
;
jsonData
[
"singleNssai"
][
"sst"
]
=
222
;
jsonData
[
"singleNssai"
][
"sst"
]
=
222
;
jsonData
[
"singleNssai"
][
"sd"
]
=
123
;
jsonData
[
"singleNssai"
][
"sd"
]
=
123
;
jsonData
[
"dnnConfigurations"
][
"
default
"
][
"pduSessionTypes"
][
"defaultSessionType"
]
=
"IPV4"
;
jsonData
[
"dnnConfigurations"
][
"
carrier.com
"
][
"pduSessionTypes"
][
"defaultSessionType"
]
=
"IPV4"
;
jsonData
[
"dnnConfigurations"
][
"
default
"
][
"sscModes"
][
"defaultSscMode"
]
=
"SSC_MODE_1"
;
jsonData
[
"dnnConfigurations"
][
"
carrier.com
"
][
"sscModes"
][
"defaultSscMode"
]
=
"SSC_MODE_1"
;
jsonData
[
"dnnConfigurations"
][
"
default"
][
"5gQosProfile"
][
"5qi"
]
=
8
0
;
jsonData
[
"dnnConfigurations"
][
"
carrier.com"
][
"5gQosProfile"
][
"5qi"
]
=
6
0
;
jsonData
[
"dnnConfigurations"
][
"
default
"
][
"5gQosProfile"
][
"arp"
][
"priorityLevel"
]
=
1
;
jsonData
[
"dnnConfigurations"
][
"
carrier.com
"
][
"5gQosProfile"
][
"arp"
][
"priorityLevel"
]
=
1
;
jsonData
[
"dnnConfigurations"
][
"
default
"
][
"5gQosProfile"
][
"arp"
][
"preemptCap"
]
=
"NOT_PREEMPT"
;
jsonData
[
"dnnConfigurations"
][
"
carrier.com
"
][
"5gQosProfile"
][
"arp"
][
"preemptCap"
]
=
"NOT_PREEMPT"
;
jsonData
[
"dnnConfigurations"
][
"
default
"
][
"5gQosProfile"
][
"arp"
][
"preemptVuln"
]
=
"NOT_PREEMPTABLE"
;
jsonData
[
"dnnConfigurations"
][
"
carrier.com
"
][
"5gQosProfile"
][
"arp"
][
"preemptVuln"
]
=
"NOT_PREEMPTABLE"
;
jsonData
[
"dnnConfigurations"
][
"
default
"
][
"sessionAmbr"
][
"uplink"
]
=
"10Mbps"
;
jsonData
[
"dnnConfigurations"
][
"
carrier.com
"
][
"sessionAmbr"
][
"uplink"
]
=
"10Mbps"
;
jsonData
[
"dnnConfigurations"
][
"
default
"
][
"sessionAmbr"
][
"downlink"
]
=
"11Mbps"
;
jsonData
[
"dnnConfigurations"
][
"
carrier.com
"
][
"sessionAmbr"
][
"downlink"
]
=
"11Mbps"
;
/*
/*
SessionManagementSubscriptionData subscriptionData;
SessionManagementSubscriptionData subscriptionData;
...
...
src/test/udm/udm-api-server.cpp
View file @
27b9f1d2
...
@@ -82,7 +82,7 @@ int main() {
...
@@ -82,7 +82,7 @@ int main() {
std
::
vector
<
int
>
sigs
{
SIGQUIT
,
SIGINT
,
SIGTERM
,
SIGHUP
};
std
::
vector
<
int
>
sigs
{
SIGQUIT
,
SIGINT
,
SIGTERM
,
SIGHUP
};
setUpUnixSignals
(
sigs
);
setUpUnixSignals
(
sigs
);
#endif
#endif
Pistache
::
Address
addr
(
"1
27.0.
0.1"
,
Pistache
::
Port
(
8181
));
Pistache
::
Address
addr
(
"1
92.168.20
0.1"
,
Pistache
::
Port
(
8181
));
httpEndpoint
=
new
Pistache
::
Http
::
Endpoint
((
addr
));
httpEndpoint
=
new
Pistache
::
Http
::
Endpoint
((
addr
));
auto
router
=
std
::
make_shared
<
Pistache
::
Rest
::
Router
>
();
auto
router
=
std
::
make_shared
<
Pistache
::
Rest
::
Router
>
();
...
...
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