Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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
177
178
179
180
181
182
183
184
185
186
187
188
189
module TrafficManagementAPI_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/TrafficManagementAPI
import from TrafficManagementAPI_TypesAndValues all;
import from TrafficManagementAPI_Templates all;
import from TrafficManagementAPI_Pixits all;
// LibMec
import from LibMec_Templates all;
import from LibMec_Functions all;
import from LibMec_Pics all;
import from LibMec_Pixits all;
function f_create_bw_allocation_resource(
in JSON.String p_app_instance_id,
out charstring p_bw_allocation_id,
out BwInfo p_bw_info
) runs on HttpComponent {
var Headers v_headers;
var HttpMessage v_response;
p_bw_allocation_id := "";
f_init_default_headers_list(-, -, v_headers);
httpPort.send(
m_http_request(
m_http_request_post(
PX_ME_BWM_URI,
v_headers,
m_http_message_body_json(
m_body_json_bw_info(
m_bw_info(
p_app_instance_id,
APPLICATION_SPECIFIC_BW_ALLOCATION, // Request type
"1024", // FixedAllocation
Downlink // AllocationDirection
))))));
tc_ac.start;
alt {
[] httpPort.receive(
mw_http_response(
mw_http_response_ok(
mw_http_message_body_json(
mw_body_json_bw_info(
mw_bw_info(
p_app_instance_id
)))))) -> value v_response {
var charstring_list v_bw_allocation_id;
tc_ac.stop;
log("f_create_bw_allocation_resource: BwInfo recsource created: ", v_response);
f_get_header(valueof(v_response.response.header), "Location", v_bw_allocation_id);
if (lengthof(v_bw_allocation_id) != 0) {
p_bw_allocation_id := v_bw_allocation_id[0];
p_bw_info := v_response.response.body.json_body.bwInfo;
}
}
[] tc_ac.timeout {
log("f_create_bw_allocation_resource: Expected message not received");
}
} // End of 'alt' statement
} // End of function f_create_bw_allocation_resource
function f_delete_bw_allocation_resource(
in JSON.String p_app_instance_id,
in charstring p_bw_allocation_id
) runs on HttpComponent {
var Headers v_headers;
f_init_default_headers_list(-, -, v_headers);
httpPort.send(
m_http_request(
m_http_request_delete(
PX_ME_BWM_URI & "/" & p_bw_allocation_id,
v_headers
)));
tc_ac.start;
alt {
[] httpPort.receive(
mw_http_response(
mw_http_response_204_no_content
)) {
}
[] tc_ac.timeout {
log("f_delete_bw_allocation_resource: Expected message not received");
}
} // End of 'alt' statement
} // End of function f_delete_bw_allocation_resource
function f_create_mts_session_info_resource(
in JSON.String p_app_instance_id,
out charstring p_mts_session_id,
out MtsSessionInfo p_mts_session_info
) runs on HttpComponent {
var Headers v_headers;
var HttpMessage v_response;
p_mts_session_id := "";
f_init_default_headers_list(-, -, v_headers);
httpPort.send(
m_http_request(
m_http_request_post(
PX_ME_MTS_SESSIONS_URI,
v_headers,
m_http_message_body_json(
m_body_json_mts_session_info(
m_mts_session_info(
PX_APP_INSTANCE_ID,
APPLICATION_SPECIFIC_MTS_ALLOCATION, // Request type
m_qosd, // QoS
LowCost, // MtsMode
Downlink, // TrafficDirection
{
m_session_filter(
"10.10.10.10",
{"1010"}
)
} // FlowFilter
))))));
tc_ac.start;
alt {
[] httpPort.receive(
mw_http_response(
mw_http_response_ok(
mw_http_message_body_json(
mw_body_json_mts_session_info(
mw_mts_session_info(
p_app_instance_id
)))))) -> value v_response {
var charstring_list v_mts_session_info_id;
tc_ac.stop;
log("f_create_mts_session_info_resource: BwInfo recsource created: ", v_response);
f_get_header(valueof(v_response.response.header), "Location", v_mts_session_info_id);
if (lengthof(v_mts_session_info_id) != 0) {
p_mts_session_id := v_mts_session_info_id[0];
p_mts_session_info := v_response.response.body.json_body.mtsSessionInfo;
}
}
[] tc_ac.timeout {
log("f_create_mts_session_info_resource: Expected message not received");
}
} // End of 'alt' statement
} // End of function f_create_mts_session_info_resource
function f_delete_mts_session_info_resource(
in JSON.String p_app_instance_id,
in charstring p_mts_session_id
) runs on HttpComponent {
var Headers v_headers;
f_init_default_headers_list(-, -, v_headers);
httpPort.send(
m_http_request(
m_http_request_delete(
PX_ME_MTS_SESSIONS_URI & "/" & p_mts_session_id,
v_headers
)));
tc_ac.start;
alt {
[] httpPort.receive(
mw_http_response(
mw_http_response_204_no_content
)) {
}
[] tc_ac.timeout {
log("f_delete_mts_session_info_resource: Expected message not received");
}
} // End of 'alt' statement
} // End of function f_delete_mts_session_info_resource
} // End of module TrafficManagementAPI_Functions