Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
MEC - Multi-access Edge Computing
MEC TTCN-3 Test Suite
Commits
5b7d84bb
Commit
5b7d84bb
authored
Jun 16, 2020
by
Yann Garcia
Browse files
Big fixed on MEC-013 Codec
parent
4b41b857
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
99 additions
and
25 deletions
+99
-25
ccsrc/Protocols/Json/json_codec.cc
ccsrc/Protocols/Json/json_codec.cc
+19
-3
ttcn/AtsMec/AtsMec_LocationAPI_TestCases.ttcn
ttcn/AtsMec/AtsMec_LocationAPI_TestCases.ttcn
+12
-13
ttcn/AtsMec/AtsMec_RadioNodeLocationAPI_TestCases.ttcn
ttcn/AtsMec/AtsMec_RadioNodeLocationAPI_TestCases.ttcn
+6
-6
ttcn/LibMec/LocationAPI/ttcn/LocationAPI_Pixits.ttcn
ttcn/LibMec/LocationAPI/ttcn/LocationAPI_Pixits.ttcn
+3
-3
ttcn/LibMec/LocationAPI/ttcn/LocationAPI_Templates.ttcn
ttcn/LibMec/LocationAPI/ttcn/LocationAPI_Templates.ttcn
+30
-0
ttcn/LibMec/LocationAPI/ttcn/LocationAPI_TypesAndValues.ttcn
ttcn/LibMec/LocationAPI/ttcn/LocationAPI_TypesAndValues.ttcn
+16
-0
ttcn/patch_lib_http/LibItsHttp_JsonMessageBodyTypes.ttcn
ttcn/patch_lib_http/LibItsHttp_JsonMessageBodyTypes.ttcn
+1
-0
ttcn/patch_lib_http/LibItsHttp_JsonTemplates.ttcn
ttcn/patch_lib_http/LibItsHttp_JsonTemplates.ttcn
+12
-0
No files found.
ccsrc/Protocols/Json/json_codec.cc
View file @
5b7d84bb
...
...
@@ -105,8 +105,8 @@ int json_codec::decode (const OCTETSTRING& p_data, LibItsHttp__JsonMessageBodyTy
loggers
::
get_instance
().
log
(
"json_codec::decode: decoding_buffer='%c' / '%s'"
,
str
[
0
],
str
.
c_str
());
TTCN_Buffer
decoding_buffer
(
OCTETSTRING
(
str
.
length
(),
(
const
unsigned
char
*
)
str
.
c_str
()));
if
(
it
->
second
.
find
(
"
\"
U
serList
\"
"
)
!=
std
::
string
::
npos
)
{
// Be careful to the order
// TODO To be refined, find("\"userList\"") is not optimal
if
(
it
->
second
.
find
(
"
\"
u
serList
\"
"
)
!=
std
::
string
::
npos
)
{
// Be careful to the order
// TODO To be refined, find("\"userList\"") is not optimal
int
idx_begin
=
it
->
second
.
find
(
":"
);
int
idx_end
=
it
->
second
.
rfind
(
"}"
)
-
1
;
// Remove the last '}'
str
=
it
->
second
.
substr
(
idx_begin
+
1
,
idx_end
-
idx_begin
);
...
...
@@ -120,14 +120,30 @@ int json_codec::decode (const OCTETSTRING& p_data, LibItsHttp__JsonMessageBodyTy
access_point_list
.
decode
(
LocationAPI__TypesAndValues
::
AccessPointList_descr_
,
decoding_buffer
,
TTCN_EncDec
::
CT_JSON
);
msg
.
accessPointList
()
=
access_point_list
;
}
else
if
(
it
->
second
.
find
(
"
\"
userTrackingSubscription
\"
"
)
!=
std
::
string
::
npos
)
{
int
idx_begin
=
it
->
second
.
find
(
":"
);
int
idx_end
=
it
->
second
.
rfind
(
"}"
)
-
1
;
// Remove the last '}'
str
=
it
->
second
.
substr
(
idx_begin
+
1
,
idx_end
-
idx_begin
);
TTCN_Buffer
decoding_buffer
(
OCTETSTRING
(
str
.
length
(),
(
const
unsigned
char
*
)
str
.
c_str
()));
LocationAPI__TypesAndValues
::
UserTrackingSubscription
user_tracking_subscription
;
user_tracking_subscription
.
decode
(
LocationAPI__TypesAndValues
::
UserTrackingSubscription_descr_
,
decoding_buffer
,
TTCN_EncDec
::
CT_JSON
);
msg
.
userTrackingSubscription
()
=
user_tracking_subscription
;
}
else
if
(
it
->
second
.
find
(
"
\"
userInfo
\"
"
)
!=
std
::
string
::
npos
)
{
}
else
if
(
it
->
second
.
find
(
"
\"
periodicTrackingSubscription
\"
"
)
!=
std
::
string
::
npos
)
{
int
idx_begin
=
it
->
second
.
find
(
":"
);
int
idx_end
=
it
->
second
.
rfind
(
"}"
)
-
1
;
// Remove the last '}'
str
=
it
->
second
.
substr
(
idx_begin
+
1
,
idx_end
-
idx_begin
);
TTCN_Buffer
decoding_buffer
(
OCTETSTRING
(
str
.
length
(),
(
const
unsigned
char
*
)
str
.
c_str
()));
LocationAPI__TypesAndValues
::
PeriodicTrackingSubscription
periodic_tracking_subscription
;
periodic_tracking_subscription
.
decode
(
LocationAPI__TypesAndValues
::
PeriodicTrackingSubscription_descr_
,
decoding_buffer
,
TTCN_EncDec
::
CT_JSON
);
msg
.
periodicTrackingSubscription
()
=
periodic_tracking_subscription
;
}
else
if
(
it
->
second
.
find
(
"
\"
accessPointId
\"
"
)
!=
std
::
string
::
npos
)
{
LocationAPI__TypesAndValues
::
UserInfo
user_info
;
user_info
.
decode
(
LocationAPI__TypesAndValues
::
UserInfo_descr_
,
decoding_buffer
,
TTCN_EncDec
::
CT_JSON
);
msg
.
userInfo
()
=
user_info
;
}
else
if
(
it
->
second
.
find
(
"
\"
terminalDistance
\"
"
)
!=
std
::
string
::
npos
)
{
int
idx_begin
=
it
->
second
.
find
(
":"
);
int
idx_end
=
it
->
second
.
rfind
(
"}"
)
-
1
;
// Remove the last '}'
str
=
it
->
second
.
substr
(
idx_begin
+
1
,
idx_end
-
idx_begin
);
TTCN_Buffer
decoding_buffer
(
OCTETSTRING
(
str
.
length
(),
(
const
unsigned
char
*
)
str
.
c_str
()));
LocationAPI__TypesAndValues
::
TerminalDistance
terminal_distance
;
terminal_distance
.
decode
(
LocationAPI__TypesAndValues
::
TerminalDistance_descr_
,
decoding_buffer
,
TTCN_EncDec
::
CT_JSON
);
msg
.
terminalDistance
()
=
terminal_distance
;
...
...
ttcn/AtsMec/AtsMec_LocationAPI_TestCases.ttcn
View file @
5b7d84bb
...
...
@@ -73,13 +73,12 @@ module AtsMec_LocationAPI_TestCases {
mw_http_response
(
mw_http_response_ok
(
mw_http_message_body_json
(
mw_body_json_user_list
(
mw_user_list
(
{
*
,
mw_user_info
(
PX_USER
,
PX_ACCESS_POINT_ID
,
PX_ZONE_ID
,
PX_RESOURCE_URL
),
*
}
mw_body_json_user_info
(
mw_user_info
(
PX_USER
,
PX_ACCESS_POINT_ID
,
PX_ZONE_ID
,
PX_RESOURCE_URL
))))))
{
tc_ac
.
stop
;
...
...
@@ -493,11 +492,11 @@ module AtsMec_LocationAPI_TestCases {
mw_http_response
(
mw_http_response_201_created
(
mw_http_message_body_json
(
mw_body_json_
user
_tracking_subscription
(
mw_user
_tracking_subscription
(
PX_CLIENT_ID
,
PX_CALLBACK_REF_URL
,
PX_USER
mw_body_json_
periodic
_tracking_subscription
(
mw_periodic
_tracking_subscription
(
PX_CLIENT_ID
,
PX_CALLBACK_REF_URL
,
PX_USER
))))))
{
tc_ac
.
stop
;
...
...
@@ -952,7 +951,7 @@ module AtsMec_LocationAPI_TestCases {
httpPort
.
send
(
m_http_request
(
m_http_request_post
(
"/"
&
PICS_ROOT_API
&
"invilad/"
&
PX_ME_APP_Q_USERS_INF_SUB_URI
,
"/"
&
PICS_ROOT_API
&
"
/
invilad/"
&
PX_ME_APP_Q_USERS_INF_SUB_URI
,
v_headers
,
m_http_message_body_json
(
m_body_json_zonal_traffic_subscription
(
...
...
ttcn/AtsMec/AtsMec_RadioNodeLocationAPI_TestCases.ttcn
View file @
5b7d84bb
...
...
@@ -69,7 +69,7 @@ module AtsMec_RadioNodeLocationAPI_TestCases {
httpPort
.
send
(
m_http_request
(
m_http_request_get
(
PX_ME_APP_Q_ZONE_ID_URI
&
"/"
&
oct2char
(
unichar2oct
(
PX_ZONE_ID
,
"UTF-8"
))
&
"/accessPoints"
,
"/"
&
PICS_ROOT_API
&
PX_ME_APP_Q_ZONE_ID_URI
&
"/"
&
oct2char
(
unichar2oct
(
PX_ZONE_ID
,
"UTF-8"
))
&
"/accessPoints"
,
v_headers
)
)
...
...
@@ -562,7 +562,7 @@ module AtsMec_RadioNodeLocationAPI_TestCases {
httpPort
.
send
(
m_http_request
(
m_http_request_post
(
"/"
&
PICS_ROOT_API
&
oct2char
(
unichar2oct
(
PX_
U
E_
DIST_SUB_URI
,
"UTF-8"
))
,
"/"
&
PICS_ROOT_API
&
PX_
M
E_
APP_Q_DIST_URI
,
v_headers
,
m_http_message_body_json
(
m_body_json_distance_notification_subscription
(
...
...
@@ -646,7 +646,7 @@ module AtsMec_RadioNodeLocationAPI_TestCases {
httpPort
.
send
(
m_http_request
(
m_http_request_post
(
"/"
&
PICS_ROOT_API
&
oct2char
(
unichar2oct
(
PX_
U
E_
DIST_SUB_URI
,
"UTF-8"
))
,
"/"
&
PICS_ROOT_API
&
PX_
M
E_
APP_Q_DIST_URI
,
v_headers
,
m_http_message_body_json
(
m_body_json_distance_notification_subscription
(
...
...
@@ -712,7 +712,7 @@ module AtsMec_RadioNodeLocationAPI_TestCases {
httpPort
.
send
(
m_http_request
(
m_http_request_delete
(
"/"
&
PICS_ROOT_API
&
oct2char
(
unichar2oct
(
PX_
U
E_
DIST_SUB_URI
,
"UTF-8"
))
&
oct2char
(
unichar2oct
(
PX_SUBSCRIPTION_ID
,
"UTF-8"
)),
"/"
&
PICS_ROOT_API
&
PX_
M
E_
APP_Q_DIST_URI
&
"/"
&
oct2char
(
unichar2oct
(
PX_SUBSCRIPTION_ID
,
"UTF-8"
)),
v_headers
)
)
...
...
@@ -766,7 +766,7 @@ module AtsMec_RadioNodeLocationAPI_TestCases {
httpPort
.
send
(
m_http_request
(
m_http_request_delete
(
"/"
&
PICS_ROOT_API
&
oct2char
(
unichar2oct
(
PX_
U
E_
DIST_SUB_URI
,
"UTF-8"
))
&
oct2char
(
unichar2oct
(
PX_NON_EXISTENT_SUBSCRIPTION_ID
,
"UTF-8"
)),
"/"
&
PICS_ROOT_API
&
PX_
M
E_
APP_Q_DIST_URI
&
"/"
&
oct2char
(
unichar2oct
(
PX_NON_EXISTENT_SUBSCRIPTION_ID
,
"UTF-8"
)),
v_headers
)
)
...
...
@@ -827,7 +827,7 @@ module AtsMec_RadioNodeLocationAPI_TestCases {
httpPort
.
send
(
m_http_request
(
m_http_request_get
(
"/"
&
PICS_ROOT_API
&
oct2char
(
unichar2oct
(
PX_
U
E_
LOC
_USERS_
URI
))
&
"?address="
&
oct2char
(
unichar2oct
(
PX_ACR_SOME_IP
,
"UTF-8"
))
,
"/"
&
PICS_ROOT_API
&
PX_
M
E_
APP_Q
_USERS_
LIST_URI
,
v_headers
)
)
...
...
ttcn/LibMec/LocationAPI/ttcn/LocationAPI_Pixits.ttcn
View file @
5b7d84bb
...
...
@@ -37,13 +37,13 @@ module LocationAPI_Pixits {
modulepar
CallbackReference
PX_CALLBACK_REF_URL
:=
{
"http://clientApp.example.com/location_notifications/123456"
};
modulepar
CallbackReference
PX_UE_PERIODIC_SUB_CALLBACK_URI
:=
{
""
};
modulepar
CallbackReference
PX_UE_PERIODIC_SUB_CALLBACK_URI
:=
{
"
http://clientApp.example.com/location_notifications/123456
"
};
modulepar
Address
PX_IP_ADDRESS
:=
"acr:10.0.0.3"
;
modulepar
CallbackReference
PX_AREA_SUB_CALLBACK_URI
:=
{
""
};
modulepar
CallbackReference
PX_AREA_SUB_CALLBACK_URI
:=
{
"
http://clientApp.example.com/location_notifications/123456
"
};
modulepar
CallbackReference
PX_UE_DIST_SUB_CALLBACK_URI
:=
{
""
};
modulepar
CallbackReference
PX_UE_DIST_SUB_CALLBACK_URI
:=
{
"
http://clientApp.example.com/location_notifications/123456
"
};
modulepar
Address
PX_UE_MONITORED_IP_ADDRESS
:=
"acr:10.0.0.1"
;
...
...
ttcn/LibMec/LocationAPI/ttcn/LocationAPI_Templates.ttcn
View file @
5b7d84bb
...
...
@@ -174,6 +174,36 @@ module LocationAPI_Templates {
resourceURL
:=
p_resourceURL
}
// End of template mw_user_tracking_subscription
template
(
value
)
PeriodicTrackingSubscription
m_periodic_tracking_subscription
(
in
ClientCorrelator
p_clientCorrelator
,
in
CallbackReference
p_callbackReference
,
in
Address
p_address
:=
PX_USER
,
in
JSON
.
Number
p_frequency
:=
10.0
,
in
JSON
.
Number
p_requestedAccuracy
:=
10.0
)
:=
{
clientCorrelator
:=
p_clientCorrelator
,
callbackReference
:=
p_callbackReference
,
address_
:=
p_address
,
frequency
:=
p_frequency
,
requestedAccuracy
:=
p_requestedAccuracy
,
resourceURL
:=
omit
}
// End of template m_periodic_tracking_subscription
template
(
present
)
PeriodicTrackingSubscription
mw_periodic_tracking_subscription
(
template
(
present
)
ClientCorrelator
p_clientCorrelator
:=
?
,
template
(
present
)
CallbackReference
p_callbackReference
:=
?
,
template
(
present
)
Address
p_address
:=
PX_USER
,
template
(
present
)
JSON
.
Number
p_frequency
:=
?
,
template
(
present
)
JSON
.
Number
p_requestedAccuracy
:=
?
)
:=
{
clientCorrelator
:=
p_clientCorrelator
,
callbackReference
:=
p_callbackReference
,
address_
:=
p_address
,
frequency
:=
p_frequency
,
requestedAccuracy
:=
p_requestedAccuracy
,
resourceURL
:=
*
}
// End of template mw_periodic_tracking_subscription
template
(
value
)
ZonalTrafficSubscription
m_zonal_traffic_subscription
(
in
ClientCorrelator
p_client_correlator
,
in
CallbackReference
p_callback_reference
,
...
...
ttcn/LibMec/LocationAPI/ttcn/LocationAPI_TypesAndValues.ttcn
View file @
5b7d84bb
...
...
@@ -367,6 +367,21 @@ REST_NetAPI_Common].
variant
(
address_
)
"name as 'address'"
;
}
/**
* @desc A type containing periodic tracking subscription.
* @member
*/
type
record
PeriodicTrackingSubscription
{
ClientCorrelator
clientCorrelator
optional
,
CallbackReference
callbackReference
,
Address
address_
,
JSON
.
Number
frequency
,
JSON
.
Number
requestedAccuracy
,
ResourceURL
resourceURL
optional
}
with
{
variant
(
address_
)
"name as 'address'"
;
}
/**
* @desc A type containing zonal presence notification
* @member
...
...
@@ -501,6 +516,7 @@ REST_NetAPI_Common].
type
record
NotificationSubscriptionList
{
ZonalTrafficSubscription
zonalTrafficSubscription
optional
,
UserTrackingSubscription
userTrackingSubscription
optional
,
PeriodicTrackingSubscription
periodicTrackingSubscription
optional
,
ZoneStatusSubscription
zoneStatusSubscription
optional
,
CircleNotificationSubscription
circleNotificationSubscription
optional
,
PeriodicNotificationSubscription
periodicNotificationSubscription
optional
,
...
...
ttcn/patch_lib_http/LibItsHttp_JsonMessageBodyTypes.ttcn
View file @
5b7d84bb
...
...
@@ -40,6 +40,7 @@ module LibItsHttp_JsonMessageBodyTypes {
ZoneInfo
zoneInfo
,
AccessPointList
accessPointList
,
UserTrackingSubscription
userTrackingSubscription
,
PeriodicTrackingSubscription
periodicTrackingSubscription
,
ZonalTrafficSubscription
zonalTrafficSubscription
,
CircleNotificationSubscription
circleNotificationSubscription
,
TerminalDistance
terminalDistance
,
...
...
ttcn/patch_lib_http/LibItsHttp_JsonTemplates.ttcn
View file @
5b7d84bb
...
...
@@ -458,6 +458,18 @@ group ams_api {
userTrackingSubscription
:=
p_user_tracking_subscription
}
// End of template mw_body_json_user_rtracking_subscription
template
(
value
)
JsonBody
m_body_json_periodic_tracking_subscription
(
in
template
(
value
)
PeriodicTrackingSubscription
p_periodic_tracking_subscription
)
:=
{
periodicTrackingSubscription
:=
p_periodic_tracking_subscription
}
// End of template m_body_json_periodic_tracking_subscription
template
(
present
)
JsonBody
mw_body_json_periodic_tracking_subscription
(
template
(
present
)
PeriodicTrackingSubscription
p_periodic_tracking_subscription
:=
?
)
:=
{
periodicTrackingSubscription
:=
p_periodic_tracking_subscription
}
// End of template mw_body_json_periodic_rtracking_subscription
template
(
value
)
JsonBody
m_body_json_zonal_traffic_subscription
(
in
template
(
value
)
ZonalTrafficSubscription
p_zonal_traffic_subscription
)
:=
{
...
...
Yann Garcia
@garciay
mentioned in issue
#11 (closed)
·
Aug 10, 2020
mentioned in issue
#11 (closed)
mentioned in issue #11
Toggle commit list
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