Newer
Older
module EdgePlatformApplicationEnablementAPI_Functions {
// JSON
import from JSON all;
// LibCommon
import from LibCommon_BasicTypesAndValues all;
import from LibCommon_Time all;
import from LibCommon_VerdictControl all;
import from LibCommon_Sync all;
// LibHttp
import from LibItsHttp_TypesAndValues all;
import from LibItsHttp_Functions all;
import from LibItsHttp_Templates all;
import from LibItsHttp_JsonTemplates all;
import from LibItsHttp_TestSystem all;
// LibMec/EdgePlatformApplicationEnablementAPI
import from EdgePlatformApplicationEnablementAPI_TypesAndValues all;
import from EdgePlatformApplicationEnablementAPI_Templates all;
import from EdgePlatformApplicationEnablementAPI_Pixits all;
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
// LibMec
import from LibMec_Templates all;
import from LibMec_Functions all;
import from LibMec_Pics all;
import from LibMec_Pixits all;
function f_create_service_info(
out ServiceInfo p_service_info,
out Headers p_headers
) runs on HttpComponent {
var Headers v_headers;
var HttpMessage v_response;
var universal charstring v_service_name := oct2unichar(char2oct("service_" & int2str(f_get_current_timestamp_utc())));
f_init_default_headers_list(-, -, v_headers);
httpPort.send(
m_http_request(
m_http_request_post(
PICS_ROOT_API & PX_MEC_SVC_MGMT_APPS_URI & "/" & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/services",
v_headers,
m_http_message_body_json(
m_body_json_service_info(
m_service_info(
v_service_name,
-, -, -,
m_service_info_link("m_service_info_link"),
-, -, //-,
m_transport_info(
"transportId1",
"ETSI MEC-011 Conformance test",
REST_HTTP,
"HTTP",
"2.0",
m_end_point_uris({"/meMp1/service/MyEntryPoint"}),
m_security_info
)))))));
tc_ac.start;
alt {
[] httpPort.receive(
mw_http_response(
mw_http_response_201_created(
mw_http_message_body_json(
mw_body_json_service_info(
mw_service_info(
v_service_name //serName
)))))) -> value v_response {
tc_ac.stop;
p_service_info := v_response.response.body.json_body.serviceInfo;
p_headers := v_response.response.header;
log("f_create_service_info: INFO: IUT successfully responds to the subscription: ", p_service_info);
}
[] tc_ac.timeout {
log("f_create_service_info: INCONC: Expected message not received");
}
} // End of 'alt' statement
} // End of function f_create_service_info
function f_delete_service_info(
in ServiceInfo p_service_info
) runs on HttpComponent {
var Headers v_headers;
f_init_default_headers_list(-, -, v_headers);
httpPort.send(
m_http_request(
m_http_request_delete(
PICS_ROOT_API & PX_MEC_SVC_MGMT_APPS_URI & "/" & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/services/" & oct2char(unichar2oct(p_service_info.serName)),
v_headers
)));
tc_ac.start;
alt {
[] httpPort.receive(
mw_http_response(
mw_http_response_204_no_content
)) {
tc_ac.stop;
}
[] tc_ac.timeout {
log("f_delete_service_info: INCONC: Expected message not received");
}
} // End of 'alt' statement
} // End of function f_delete_service_info
function f_create_ser_availability_notification_subscription(
out SerAvailabilityNotificationSubscription p_ser_availability_notification_subscription
) runs on HttpComponent {
var Headers v_headers;
var HttpMessage v_response;
f_init_default_headers_list(-, -, v_headers);
httpPort.send(
m_http_request(
m_http_request_post(
PICS_ROOT_API & PX_MEC_SVC_MGMT_APPS_URI & "/" & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/subscriptions",
v_headers,
m_http_message_body_json(
m_body_json_srv_avail_notif_subscription(
m_srv_avail_notif_subscription(
PX_SRV_AVAIL_NOTIF_CALLBACK_URI
))))));
tc_ac.start;
alt {
[] httpPort.receive(
mw_http_response(
mw_http_response_201_created(
mw_http_message_body_json(
mw_body_json_srv_avail_notif_subscription(
mw_srv_avail_notif_subscription(
PX_SRV_AVAIL_NOTIF_CALLBACK_URI
)))))) -> value v_response {
tc_ac.stop;
p_ser_availability_notification_subscription := v_response.response.body.json_body.serAvailabilityNotificationSubscription
log("f_create_ser_availability_notification_subscription: INFO: IUT successfully responds to the subscription: ", p_ser_availability_notification_subscription);
}
[] tc_ac.timeout {
log("f_create_ser_availability_notification_subscription: INCONC: Expected message not received");
}
} // End of 'alt' statement
} // End of function f_create_ser_availability_notification_subscription
function f_delete_ser_availability_notification_subscription(
in SerAvailabilityNotificationSubscription p_ser_availability_notification_subscription
) runs on HttpComponent {
var Headers v_headers;
var charstring v_uri := regexp(
oct2char(unichar2oct(p_ser_availability_notification_subscription.links.self_.href)),
"?+(" & PX_MEC_SVC_MGMT_APPS_URI & "/?*)",
0
);
f_init_default_headers_list(-, -, v_headers);
httpPort.send(
m_http_request(
m_http_request_delete(
PICS_ROOT_API & v_uri,
v_headers
)));
tc_ac.start;
alt {
[] httpPort.receive(
mw_http_response(
mw_http_response_204_no_content
)) {
tc_ac.stop;
}
[] tc_ac.timeout {
log("f_delete_ser_availability_notification_subscription: INCONC: Expected message not received");
}
} // End of 'alt' statement
} // End of function f_delete_ser_availability_notification_subscription
} // End of module EdgePlatformApplicationEnablementAPI_Functions