blob: eefc61e1d3257c5c92c99c15adb685df18fe4dc5 [file] [log] [blame]
TamasBakai9b780332019-02-15 08:38:16 +00001import argparse
2import os
3from werkzeug import secure_filename
4from flask import Flask, render_template, request
5from time import sleep
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00006import time
TamasBakai9b780332019-02-15 08:38:16 +00007import sys
8import json
9from flask import Flask
BjornMagnussonXAf4e18362019-04-10 13:04:08 +000010
TamasBakai9b780332019-02-15 08:38:16 +000011app = Flask(__name__)
12
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +000013#Server info
14HOST_IP = "0.0.0.0"
15HOST_PORT = 2222
TamasBakai9b780332019-02-15 08:38:16 +000016
BjornMagnussonXAa79a0432019-07-17 08:26:50 +000017sftp_hosts=[]
18sftp_ports=[]
19ftps_hosts=[]
20ftps_ports=[]
21num_ftp_servers=0
22
23def sumList(ctrArray):
24 tmp=0
25 for i in range(len(ctrArray)):
26 tmp=tmp+ctrArray[i];
27
28 return str(tmp);
29
30def sumListLength(ctrArray):
31 tmp=0
32 for i in range(len(ctrArray)):
33 tmp=tmp+len(ctrArray[i]);
34
35 return str(tmp);
BjornMagnussonXAf4e18362019-04-10 13:04:08 +000036
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +000037#Test function to check server running
38@app.route('/',
39 methods=['GET'])
40def index():
41 return 'Hello world'
TamasBakai9b780332019-02-15 08:38:16 +000042
BjornMagnussonXAa79a0432019-07-17 08:26:50 +000043#Returns the list of configured groups
44@app.route('/groups',
45 methods=['GET'])
46def group_ids():
47 global configuredGroups
48 return configuredGroups
49
50#Returns the list of configured changeids
51@app.route('/changeids',
52 methods=['GET'])
53def change_ids():
54 global configuredChangeIds
55 return configuredChangeIds
56
57#Returns the list of configured fileprefixes
58@app.route('/fileprefixes',
59 methods=['GET'])
60def fileprefixes():
61 global configuredPrefixes
62 return configuredPrefixes
63
64
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +000065#Returns number of polls
66@app.route('/ctr_requests',
67 methods=['GET'])
68def counter_requests():
69 global ctr_requests
BjornMagnussonXAa79a0432019-07-17 08:26:50 +000070 return sumList(ctr_requests)
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +000071
BjornMagnussonXAa79a0432019-07-17 08:26:50 +000072#Returns number of polls for all groups
73@app.route('/groups/ctr_requests',
74 methods=['GET'])
75def group_counter_requests():
76 global ctr_requests
77 global groupNames
78 tmp=''
79 for i in range(len(groupNames)):
80 if (i > 0):
81 tmp=tmp+','
82 tmp=tmp+str(ctr_requests[i])
83 return tmp
84
85#Returns the total number of polls for a group
86@app.route('/ctr_requests/<groupId>',
87 methods=['GET'])
88def counter_requests_group(groupId):
89 global ctr_requests
90 global groupNameIndexes
91 return str(ctr_requests[groupNameIndexes[groupId]])
92
93#Returns number of poll replies
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +000094@app.route('/ctr_responses',
95 methods=['GET'])
96def counter_responses():
97 global ctr_responses
BjornMagnussonXAa79a0432019-07-17 08:26:50 +000098 return sumList(ctr_responses)
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +000099
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000100#Returns number of poll replies for all groups
101@app.route('/groups/ctr_responses',
102 methods=['GET'])
103def group_counter_responses():
104 global ctr_responses
105 global groupNames
106 tmp=''
107 for i in range(len(groupNames)):
108 if (i > 0):
109 tmp=tmp+','
110 tmp=tmp+str(ctr_responses[i])
111 return tmp
112
113#Returns the total number of poll replies for a group
114@app.route('/ctr_responses/<groupId>',
115 methods=['GET'])
116def counter_responses_group(groupId):
117 global ctr_responses
118 global groupNameIndexes
119 return str(ctr_responses[groupNameIndexes[groupId]])
120
121#Returns the total number of files
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000122@app.route('/ctr_files',
123 methods=['GET'])
124def counter_files():
125 global ctr_files
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000126 return sumList(ctr_files)
127
128#Returns the total number of file for all groups
129@app.route('/groups/ctr_files',
130 methods=['GET'])
131def group_counter_files():
132 global ctr_files
133 global groupNames
134 tmp=''
135 for i in range(len(groupNames)):
136 if (i > 0):
137 tmp=tmp+','
138 tmp=tmp+str(ctr_files[i])
139 return tmp
140
141#Returns the total number of files for a group
142@app.route('/ctr_files/<groupId>',
143 methods=['GET'])
144def counter_files_group(groupId):
145 global ctr_files
146 global groupNameIndexes
147 return str(ctr_files[groupNameIndexes[groupId]])
148
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000149
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000150#Returns number of unique files
151@app.route('/ctr_unique_files',
152 methods=['GET'])
153def counter_uniquefiles():
154 global fileMap
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000155 return sumListLength(fileMap)
156
157#Returns number of unique files for all groups
158@app.route('/groups/ctr_unique_files',
159 methods=['GET'])
160def group_counter_uniquefiles():
161 global fileMap
162 global groupNames
163 tmp=''
164 for i in range(len(groupNames)):
165 if (i > 0):
166 tmp=tmp+','
167 tmp=tmp+str(len(fileMap[i]))
168 return tmp
169
170#Returns the total number of unique files for a group
171@app.route('/ctr_unique_files/<groupId>',
172 methods=['GET'])
173def counter_uniquefiles_group(groupId):
174 global fileMap
175 global groupNameIndexes
176 return str(len(fileMap[groupNameIndexes[groupId]]))
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000177
178#Returns tc info
179@app.route('/tc_info',
180 methods=['GET'])
181def testcase_info():
182 global tc_num
183 return tc_num
184
BjornMagnussonXAf4e18362019-04-10 13:04:08 +0000185#Returns number of events
186@app.route('/ctr_events',
187 methods=['GET'])
188def counter_events():
189 global ctr_events
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000190 return sumList(ctr_events)
191
192#Returns number of events for all groups
193@app.route('/groups/ctr_events',
194 methods=['GET'])
195def group_counter_events():
196 global ctr_events
197 global groupNames
198 tmp=''
199 for i in range(len(groupNames)):
200 if (i > 0):
201 tmp=tmp+','
202 tmp=tmp+str(ctr_events[i])
203 return tmp
204
205#Returns the total number of events for a group
206@app.route('/ctr_events/<groupId>',
207 methods=['GET'])
208def counter_events_group(groupId):
209 global ctr_events
210 global groupNameIndexes
211 return str(ctr_events[groupNameIndexes[groupId]])
BjornMagnussonXAf4e18362019-04-10 13:04:08 +0000212
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000213#Returns execution time in mm:ss
BjornMagnussonXAf4e18362019-04-10 13:04:08 +0000214@app.route('/execution_time',
215 methods=['GET'])
216def exe_time():
217 global startTime
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000218
BjornMagnussonXAf4e18362019-04-10 13:04:08 +0000219 stopTime = time.time()
220 minutes, seconds = divmod(stopTime-startTime, 60)
221 return "{:0>2}:{:0>2}".format(int(minutes),int(seconds))
222
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000223#Returns the timestamp for first poll
224@app.route('/exe_time_first_poll',
225 methods=['GET'])
226def exe_time_first_poll():
227 global firstPollTime
228
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000229 tmp = 0
230 for i in range(len(groupNames)):
231 if (firstPollTime[i] > tmp):
232 tmp = firstPollTime[i]
233
234 if (tmp == 0):
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000235 return "--:--"
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000236 minutes, seconds = divmod(time.time()-tmp, 60)
237 return "{:0>2}:{:0>2}".format(int(minutes),int(seconds))
238
239#Returns the timestamp for first poll for all groups
240@app.route('/groups/exe_time_first_poll',
241 methods=['GET'])
242def group_exe_time_first_poll():
243 global firstPollTime
244 global groupNames
245
246 tmp=''
247 for i in range(len(groupNames)):
248 if (i > 0):
249 tmp=tmp+','
250 if (firstPollTime[i] == 0):
251 tmp=tmp+ "--:--"
252 else:
253 minutes, seconds = divmod(time.time()-firstPollTime[i], 60)
254 tmp=tmp+"{:0>2}:{:0>2}".format(int(minutes),int(seconds))
255 return tmp
256
257#Returns the timestamp for first poll for a group
258@app.route('/exe_time_first_poll/<groupId>',
259 methods=['GET'])
260def exe_time_first_poll_group(groupId):
261 global ctr_requests
262 global groupNameIndexes
263
264 if (firstPollTime[groupNameIndexes[groupId]] == 0):
265 return "--:--"
266 minutes, seconds = divmod(time.time()-firstPollTime[groupNameIndexes[groupId]], 60)
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000267 return "{:0>2}:{:0>2}".format(int(minutes),int(seconds))
268
269#Starts event delivery
270@app.route('/start',
271 methods=['GET'])
272def start():
273 global runningState
274 runningState="Started"
275 return runningState
276
277#Stops event delivery
278@app.route('/stop',
279 methods=['GET'])
280def stop():
281 global runningState
282 runningState="Stopped"
283 return runningState
284
285#Returns the running state
286@app.route('/status',
287 methods=['GET'])
288def status():
289 global runningState
290 return runningState
291
BjornMagnussonXAf4e18362019-04-10 13:04:08 +0000292#Returns number of unique PNFs
293@app.route('/ctr_unique_PNFs',
294 methods=['GET'])
295def counter_uniquePNFs():
296 global pnfMap
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000297 return sumListLength(pnfMap)
298
299#Returns number of unique PNFs for all groups
300@app.route('/groups/ctr_unique_PNFs',
301 methods=['GET'])
302def group_counter_uniquePNFs():
303 global pnfMap
304 global groupNames
305 tmp=''
306 for i in range(len(groupNames)):
307 if (i > 0):
308 tmp=tmp+','
309 tmp=tmp+str(len(pnfMap[i]))
310 return tmp
311
312#Returns the unique PNFs for a group
313@app.route('/ctr_unique_PNFs/<groupId>',
314 methods=['GET'])
315def counter_uniquePNFs_group(groupId):
316 global pnfMap
317 global groupNameIndexes
318 return str(len(pnfMap[groupNameIndexes[groupId]]))
319
BjornMagnussonXAf4e18362019-04-10 13:04:08 +0000320
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000321#Messages polling function
TamasBakai9b780332019-02-15 08:38:16 +0000322@app.route(
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000323 "/events/unauthenticated.VES_NOTIFICATION_OUTPUT/<consumerGroup>/<consumerId>",
TamasBakai9b780332019-02-15 08:38:16 +0000324 methods=['GET'])
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000325def MR_reply(consumerGroup, consumerId):
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000326 global ctr_requests
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000327 global ctr_responses
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000328 global args
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000329 global runningState
330 global firstPollTime
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000331 global groupNameIndexes
332 global changeIds
333 global filePrefixes
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000334
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000335 groupIndex = groupNameIndexes[consumerGroup]
336 print("Setting groupIndex: " + str(groupIndex))
TamasBakai9b780332019-02-15 08:38:16 +0000337
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000338 reqCtr = ctr_requests[groupIndex]
339 changeId = changeIds[groupIndex][reqCtr%len(changeIds[groupIndex])]
340 print("Setting changeid: " + changeId)
341 filePrefix = filePrefixes[changeId]
342 print("Setting file name prefix: " + filePrefix)
343
344 if (firstPollTime[groupIndex] == 0):
345 firstPollTime[groupIndex] = time.time()
346
347 ctr_requests[groupIndex] = ctr_requests[groupIndex] + 1
348 print("MR: poll request#: " + str(ctr_requests[groupIndex]))
TamasBakai9b780332019-02-15 08:38:16 +0000349
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000350 if (runningState == "Stopped"):
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000351 ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000352 return buildOkResponse("[]")
353
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000354
355
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000356 if args.tc100:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000357 return tc100(groupIndex, changeId, filePrefix, "sftp", "1MB")
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000358 elif args.tc101:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000359 return tc100(groupIndex, changeId, filePrefix, "sftp", "5MB")
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000360 elif args.tc102:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000361 return tc100(groupIndex, changeId, filePrefix, "sftp", "50MB")
TamasBakai9b780332019-02-15 08:38:16 +0000362
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000363 elif args.tc110:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000364 return tc110(groupIndex, changeId, filePrefix, "sftp")
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000365 elif args.tc111:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000366 return tc111(groupIndex, changeId, filePrefix, "sftp")
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000367 elif args.tc112:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000368 return tc112(groupIndex, changeId, filePrefix, "sftp")
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000369 elif args.tc113:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000370 return tc113(groupIndex, changeId, filePrefix, "sftp")
TamasBakai9b780332019-02-15 08:38:16 +0000371
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000372 elif args.tc120:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000373 return tc120(groupIndex, changeId, filePrefix, "sftp")
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000374 elif args.tc121:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000375 return tc121(groupIndex, changeId, filePrefix, "sftp")
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000376 elif args.tc122:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000377 return tc122(groupIndex, changeId, filePrefix, "sftp")
TamasBakai9b780332019-02-15 08:38:16 +0000378
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000379 elif args.tc1000:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000380 return tc1000(groupIndex, changeId, filePrefix, "sftp")
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000381 elif args.tc1001:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000382 return tc1001(groupIndex, changeId, filePrefix, "sftp")
TamasBakai9b780332019-02-15 08:38:16 +0000383
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000384 elif args.tc1100:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000385 return tc1100(groupIndex, changeId, filePrefix, "sftp","1MB")
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000386 elif args.tc1101:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000387 return tc1100(groupIndex, changeId, filePrefix, "sftp","50MB")
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000388 elif args.tc1102:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000389 return tc1100(groupIndex, changeId, filePrefix, "sftp","50MB")
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000390 elif args.tc1200:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000391 return tc1200(groupIndex, changeId, filePrefix, "sftp","1MB")
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000392 elif args.tc1201:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000393 return tc1200(groupIndex, changeId, filePrefix, "sftp","5MB")
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000394 elif args.tc1202:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000395 return tc1200(groupIndex, changeId, filePrefix, "sftp","50MB")
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000396 elif args.tc1300:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000397 return tc1300(groupIndex, changeId, filePrefix, "sftp","1MB")
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000398 elif args.tc1301:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000399 return tc1300(groupIndex, changeId, filePrefix, "sftp","5MB")
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000400 elif args.tc1302:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000401 return tc1300(groupIndex, changeId, filePrefix, "sftp","50MB")
402
403 elif args.tc1500:
404 return tc1500(groupIndex, changeId, filePrefix, "sftp","1MB")
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000405
406 elif args.tc500:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000407 return tc500(groupIndex, changeId, filePrefix, "sftp","1MB")
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000408 elif args.tc501:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000409 return tc500(groupIndex, changeId, filePrefix, "sftp","5MB")
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000410 elif args.tc502:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000411 return tc500(groupIndex, changeId, filePrefix, "sftp","50MB")
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000412 elif args.tc510:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000413 return tc510(groupIndex, changeId, filePrefix, "sftp", "1MB")
BjornMagnussonXAf4e18362019-04-10 13:04:08 +0000414 elif args.tc511:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000415 return tc511(groupIndex, changeId, filePrefix, "sftp", "1KB")
416
417 elif args.tc550:
418 return tc510(groupIndex, changeId, filePrefix, "sftp", "50MB")
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000419
BjornMagnussonXAf4e18362019-04-10 13:04:08 +0000420 elif args.tc710:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000421 return tc710(groupIndex, changeId, filePrefix, "sftp")
TamasBakai9b780332019-02-15 08:38:16 +0000422
423
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000424 elif args.tc200:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000425 return tc100(groupIndex, changeId, filePrefix, "ftps", "1MB")
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000426 elif args.tc201:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000427 return tc100(groupIndex, changeId, filePrefix, "ftps", "5MB")
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000428 elif args.tc202:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000429 return tc100(groupIndex, changeId, filePrefix, "ftps", "50MB")
TamasBakai9b780332019-02-15 08:38:16 +0000430
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000431 elif args.tc210:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000432 return tc110(groupIndex, changeId, filePrefix, "ftps")
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000433 elif args.tc211:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000434 return tc111(groupIndex, changeId, filePrefix, "ftps")
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000435 elif args.tc212:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000436 return tc112(groupIndex, changeId, filePrefix, "ftps")
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000437 elif args.tc213:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000438 return tc113(groupIndex, changeId, filePrefix, "ftps")
TamasBakai9b780332019-02-15 08:38:16 +0000439
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000440 elif args.tc220:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000441 return tc120(groupIndex, changeId, filePrefix, "ftps")
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000442 elif args.tc221:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000443 return tc121(groupIndex, changeId, filePrefix, "ftps")
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000444 elif args.tc222:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000445 return tc122(groupIndex, changeId, filePrefix, "ftps")
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000446
447 elif args.tc2000:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000448 return tc1000(groupIndex, changeId, filePrefix, "ftps")
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000449 elif args.tc2001:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000450 return tc1001(groupIndex, changeId, filePrefix, "ftps")
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000451
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000452 elif args.tc2100:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000453 return tc1100(groupIndex, changeId, filePrefix, "ftps","1MB")
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000454 elif args.tc2101:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000455 return tc1100(groupIndex, changeId, filePrefix, "ftps","50MB")
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000456 elif args.tc2102:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000457 return tc1100(groupIndex, changeId, filePrefix, "ftps","50MB")
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000458 elif args.tc2200:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000459 return tc1200(groupIndex, changeId, filePrefix, "ftps","1MB")
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000460 elif args.tc2201:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000461 return tc1200(groupIndex, changeId, filePrefix, "ftps","5MB")
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000462 elif args.tc2202:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000463 return tc1200(groupIndex, changeId, filePrefix, "ftps","50MB")
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000464 elif args.tc2300:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000465 return tc1300(groupIndex, changeId, filePrefix, "ftps","1MB")
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000466 elif args.tc2301:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000467 return tc1300(groupIndex, changeId, filePrefix, "ftps","5MB")
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000468 elif args.tc2302:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000469 return tc1300(groupIndex, changeId, filePrefix, "ftps","50MB")
470
471 elif args.tc2500:
472 return tc1500(groupIndex, changeId, filePrefix, "ftps","1MB")
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000473
474 elif args.tc600:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000475 return tc500(groupIndex, changeId, filePrefix, "ftps","1MB")
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000476 elif args.tc601:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000477 return tc500(groupIndex, changeId, filePrefix, "ftps","5MB")
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000478 elif args.tc602:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000479 return tc500(groupIndex, changeId, filePrefix, "ftps","50MB")
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000480 elif args.tc610:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000481 return tc510(groupIndex, changeId, filePrefix, "ftps", "1MB")
BjornMagnussonXAf4e18362019-04-10 13:04:08 +0000482 elif args.tc611:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000483 return tc511(groupIndex, changeId, filePrefix, "ftps", "1KB")
484 elif args.tc650:
485 return tc510(groupIndex, changeId, filePrefix, "ftps", "50MB")
BjornMagnussonXAf4e18362019-04-10 13:04:08 +0000486 elif args.tc810:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000487 return tc710(groupIndex, changeId, filePrefix, "ftps")
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000488
489
490#### Test case functions
491
492
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000493def tc100(groupIndex, changeId, filePrefix, ftpType, fileSize):
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000494 global ctr_responses
BjornMagnussonXAf4e18362019-04-10 13:04:08 +0000495 global ctr_events
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000496
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000497
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000498 ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1
499
500 if (ctr_responses[groupIndex] > 1):
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000501 return buildOkResponse("[]")
502
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000503 seqNr = (ctr_responses[groupIndex]-1)
504 nodeIndex=0
505 nodeName = createNodeName(nodeIndex)
506 fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, fileSize)
507 msg = getEventHead(groupIndex, changeId, nodeName) + getEventName(fileName,ftpType,"onap","pano",nodeIndex) + getEventEnd()
508 fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr
509 ctr_events[groupIndex] = ctr_events[groupIndex]+1
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000510 return buildOkResponse("["+msg+"]")
511
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000512#def tc101(groupIndex, ftpType):
513# global ctr_responses
514# global ctr_events
515#
516# ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1
517#
518# if (ctr_responses[groupIndex] > 1):
519# return buildOkResponse("[]")
520#
521# seqNr = (ctr_responses[groupIndex]-1)
522# nodeName = createNodeName(0)
523# fileName = createFileName(groupIndex, nodeName, seqNr, "5MB")
524# msg = getEventHead(groupIndex, nodeName) + getEventName(fileName,ftpType,"onap","pano") + getEventEnd()
525# fileMap[groupIndex][seqNr] = seqNr
526# ctr_events[groupIndex] = ctr_events[groupIndex]+1
527# return buildOkResponse("["+msg+"]")
528#
529#def tc102(groupIndex, ftpType):
530# global ctr_responses
531# global ctr_events
532#
533# ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1
534#
535# if (ctr_responses[groupIndex] > 1):
536# return buildOkResponse("[]")
537#
538# seqNr = (ctr_responses[groupIndex]-1)
539# nodeName = createNodeName(0)
540# fileName = createFileName(groupIndex, nodeName, seqNr, "50MB")
541# msg = getEventHead(groupIndex, nodeName) + getEventName(fileName,ftpType,"onap","pano") + getEventEnd()
542# fileMap[groupIndex][seqNr] = seqNr
543# ctr_events[groupIndex] = ctr_events[groupIndex]+1
544# return buildOkResponse("["+msg+"]")
545
546def tc110(groupIndex, changeId, filePrefix, ftpType):
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000547 global ctr_responses
BjornMagnussonXAf4e18362019-04-10 13:04:08 +0000548 global ctr_events
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000549
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000550
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000551 ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1
552
553 if (ctr_responses[groupIndex] > 100):
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000554 return buildOkResponse("[]")
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000555
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000556 seqNr = (ctr_responses[groupIndex]-1)
557 nodeIndex=0
558 nodeName = createNodeName(nodeIndex)
559 fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, "1MB")
560 msg = getEventHead(groupIndex, changeId, nodeName) + getEventName(fileName,ftpType,"onap","pano",nodeIndex) + getEventEnd()
561 fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr
562 ctr_events[groupIndex] = ctr_events[groupIndex]+1
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000563 return buildOkResponse("["+msg+"]")
564
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000565def tc111(groupIndex, changeId, filePrefix, ftpType):
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000566 global ctr_responses
BjornMagnussonXAf4e18362019-04-10 13:04:08 +0000567 global ctr_events
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000568
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000569
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000570 ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1
571
572 if (ctr_responses[groupIndex] > 100):
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000573 return buildOkResponse("[]")
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000574
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000575 nodeIndex=0
576 nodeName = createNodeName(nodeIndex)
577 msg = getEventHead(groupIndex, changeId, nodeName)
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000578
579 for i in range(100):
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000580 seqNr = i+(ctr_responses[groupIndex]-1)
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000581 if i != 0: msg = msg + ","
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000582 fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, "1MB")
583 msg = msg + getEventName(fileName,ftpType,"onap","pano",nodeIndex)
584 fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000585
586 msg = msg + getEventEnd()
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000587 ctr_events[groupIndex] = ctr_events[groupIndex]+1
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000588
589 return buildOkResponse("["+msg+"]")
590
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000591def tc112(groupIndex, changeId, filePrefix, ftpType):
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000592 global ctr_responses
BjornMagnussonXAf4e18362019-04-10 13:04:08 +0000593 global ctr_events
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000594
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000595
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000596 ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1
597
598 if (ctr_responses[groupIndex] > 100):
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000599 return buildOkResponse("[]")
BjornMagnussonXAf4e18362019-04-10 13:04:08 +0000600
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000601 nodeIndex=0
602 nodeName = createNodeName(nodeIndex)
603 msg = getEventHead(groupIndex, changeId, nodeName)
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000604
605 for i in range(100):
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000606 seqNr = i+(ctr_responses[groupIndex]-1)
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000607 if i != 0: msg = msg + ","
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000608 fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, "5MB")
609 msg = msg + getEventName(fileName,ftpType,"onap","pano",nodeIndex)
610 fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000611
612 msg = msg + getEventEnd()
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000613 ctr_events[groupIndex] = ctr_events[groupIndex]+1
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000614
615 return buildOkResponse("["+msg+"]")
616
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000617def tc113(groupIndex, changeId, filePrefix, ftpType):
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000618 global ctr_responses
BjornMagnussonXAf4e18362019-04-10 13:04:08 +0000619 global ctr_events
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000620
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000621
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000622 ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1
623
624 if (ctr_responses[groupIndex] > 1):
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000625 return buildOkResponse("[]")
BjornMagnussonXAf4e18362019-04-10 13:04:08 +0000626
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000627 nodeIndex=0
628 nodeName = createNodeName(nodeIndex)
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000629 msg = ""
630
631 for evts in range(100): # build 100 evts
632 if (evts > 0):
633 msg = msg + ","
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000634 msg = msg + getEventHead(groupIndex, changeId, nodeName)
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000635 for i in range(100): # build 100 files
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000636 seqNr = i+evts+100*(ctr_responses[groupIndex]-1)
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000637 if i != 0: msg = msg + ","
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000638 fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, "1MB")
639 msg = msg + getEventName(fileName,ftpType,"onap","pano",nodeIndex)
640 fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000641
642 msg = msg + getEventEnd()
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000643 ctr_events[groupIndex] = ctr_events[groupIndex]+1
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000644
645 return buildOkResponse("["+msg+"]")
646
647
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000648def tc120(groupIndex, changeId, filePrefix, ftpType):
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000649 global ctr_responses
BjornMagnussonXAf4e18362019-04-10 13:04:08 +0000650 global ctr_events
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000651
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000652
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000653 ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1
BjornMagnussonXAf4e18362019-04-10 13:04:08 +0000654
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000655 nodeIndex=0
656 nodeName = createNodeName(nodeIndex)
657
658 if (ctr_responses[groupIndex] > 100):
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000659 return buildOkResponse("[]")
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000660
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000661 if (ctr_responses[groupIndex] % 10 == 2):
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000662 return # Return nothing
BjornMagnussonXAf4e18362019-04-10 13:04:08 +0000663
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000664 if (ctr_responses[groupIndex] % 10 == 3):
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000665 return buildOkResponse("") # Return empty message
666
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000667 if (ctr_responses[groupIndex] % 10 == 4):
668 return buildOkResponse(getEventHead(groupIndex, changeId, nodeName)) # Return part of a json event
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000669
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000670 if (ctr_responses[groupIndex] % 10 == 5):
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000671 return buildEmptyResponse(404) # Return empty message with status code
672
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000673 if (ctr_responses[groupIndex] % 10 == 6):
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000674 sleep(60)
675
BjornMagnussonXAf4e18362019-04-10 13:04:08 +0000676
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000677 msg = getEventHead(groupIndex, changeId, nodeName)
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000678
679 for i in range(100):
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000680 seqNr = i+(ctr_responses[groupIndex]-1)
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000681 if i != 0: msg = msg + ","
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000682 fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, "1MB")
683 msg = msg + getEventName(fileName,ftpType,"onap","pano",nodeIndex)
684 fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000685
686 msg = msg + getEventEnd()
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000687 ctr_events[groupIndex] = ctr_events[groupIndex]+1
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000688
689 return buildOkResponse("["+msg+"]")
690
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000691def tc121(groupIndex, changeId, filePrefix, ftpType):
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000692 global ctr_responses
BjornMagnussonXAf4e18362019-04-10 13:04:08 +0000693 global ctr_events
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000694
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000695
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000696 ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1
697
698 if (ctr_responses[groupIndex] > 100):
BjornMagnussonXAf4e18362019-04-10 13:04:08 +0000699 return buildOkResponse("[]")
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000700
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000701 nodeIndex=0
702 nodeName = createNodeName(nodeIndex)
703 msg = getEventHead(groupIndex, changeId, nodeName)
BjornMagnussonXAf4e18362019-04-10 13:04:08 +0000704
705 fileName = ""
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000706 for i in range(100):
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000707 seqNr = i+(ctr_responses[groupIndex]-1)
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000708 if (seqNr%10 == 0): # Every 10th file is "missing"
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000709 fileName = createMissingFileName(groupIndex, filePrefix, nodeName, seqNr, "1MB")
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000710 else:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000711 fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, "1MB")
712 fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000713
714 if i != 0: msg = msg + ","
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000715 msg = msg + getEventName(fileName,ftpType,"onap","pano",nodeIndex)
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000716
717 msg = msg + getEventEnd()
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000718 ctr_events[groupIndex] = ctr_events[groupIndex]+1
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000719
720 return buildOkResponse("["+msg+"]")
721
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000722def tc122(groupIndex, changeId, filePrefix, ftpType):
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000723 global ctr_responses
BjornMagnussonXAf4e18362019-04-10 13:04:08 +0000724 global ctr_events
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000725
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000726
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000727 ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1
728
729 if (ctr_responses[groupIndex] > 100):
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000730 return buildOkResponse("[]")
BjornMagnussonXAf4e18362019-04-10 13:04:08 +0000731
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000732 nodeIndex=0
733 nodeName = createNodeName(nodeIndex)
734 msg = getEventHead(groupIndex, changeId, nodeName)
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000735
736 for i in range(100):
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000737 fileName = createFileName(groupIndex, filePrefix, nodeName, 0, "1MB") # All files identical names
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000738 if i != 0: msg = msg + ","
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000739 msg = msg + getEventName(fileName,ftpType,"onap","pano", nodeIndex)
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000740
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000741 fileMap[groupIndex][0] = 0
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000742 msg = msg + getEventEnd()
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000743 ctr_events[groupIndex] = ctr_events[groupIndex]+1
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000744
745 return buildOkResponse("["+msg+"]")
746
747
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000748def tc1000(groupIndex, changeId, filePrefix, ftpType):
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000749 global ctr_responses
BjornMagnussonXAf4e18362019-04-10 13:04:08 +0000750 global ctr_events
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000751
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000752
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000753 ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1
754
755 nodeIndex=0
756 nodeName = createNodeName(nodeIndex)
757 msg = getEventHead(groupIndex, changeId, nodeName)
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000758
759 for i in range(100):
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000760 seqNr = i+(ctr_responses[groupIndex]-1)
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000761 if i != 0: msg = msg + ","
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000762 fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, "1MB")
763 msg = msg + getEventName(fileName,ftpType,"onap","pano",nodeIndex)
764 fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000765
766 msg = msg + getEventEnd()
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000767 ctr_events[groupIndex] = ctr_events[groupIndex]+1
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000768
769 return buildOkResponse("["+msg+"]")
770
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000771def tc1001(groupIndex, changeId, filePrefix, ftpType):
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000772 global ctr_responses
BjornMagnussonXAf4e18362019-04-10 13:04:08 +0000773 global ctr_events
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000774
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000775
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000776 ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1
777
778 nodeIndex=0
779 nodeName = createNodeName(nodeIndex)
780 msg = getEventHead(groupIndex, changeId, nodeName)
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000781
782 for i in range(100):
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000783 seqNr = i+(ctr_responses[groupIndex]-1)
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000784 if i != 0: msg = msg + ","
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000785 fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, "5MB")
786 msg = msg + getEventName(fileName,ftpType,"onap","pano",nodeIndex)
787 fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000788
789 msg = msg + getEventEnd()
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000790 ctr_events[groupIndex] = ctr_events[groupIndex]+1
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +0000791
792 return buildOkResponse("["+msg+"]")
793
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000794
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000795def tc1100(groupIndex, changeId, filePrefix, ftpType, filesize):
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000796 global ctr_responses
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000797 global ctr_events
798
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000799
800 ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000801
802 msg = ""
803
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000804 batch = (ctr_responses[groupIndex]-1)%20;
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000805
806 for pnfs in range(35): # build events for 35 PNFs at a time. 20 batches -> 700
807 if (pnfs > 0):
808 msg = msg + ","
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000809 nodeIndex=pnfs + batch*35
810 nodeName = createNodeName(nodeIndex)
811 msg = msg + getEventHead(groupIndex, changeId, nodeName)
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000812
813 for i in range(100): # 100 files per event
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000814 seqNr = i + int((ctr_responses[groupIndex]-1)/20);
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000815 if i != 0: msg = msg + ","
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000816 fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, filesize)
817 msg = msg + getEventName(fileName,ftpType,"onap","pano",nodeIndex)
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000818 seqNr = seqNr + (pnfs+batch*35)*1000000 #Create unique id for this node and file
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000819 fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000820
821 msg = msg + getEventEnd()
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000822 ctr_events[groupIndex] = ctr_events[groupIndex]+1
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000823
824 return buildOkResponse("["+msg+"]")
825
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000826def tc1200(groupIndex, changeId, filePrefix, ftpType, filesize):
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000827 global ctr_responses
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000828 global ctr_events
829
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000830
831 ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000832
833 msg = ""
834
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000835 batch = (ctr_responses[groupIndex]-1)%20;
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000836
837 for pnfs in range(35): # build events for 35 PNFs at a time. 20 batches -> 700
838 if (pnfs > 0):
839 msg = msg + ","
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000840 nodeIndex=pnfs + batch*35
841 nodeName = createNodeName(nodeIndex)
842 msg = msg + getEventHead(groupIndex, changeId, nodeName)
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000843
844 for i in range(100): # 100 files per event, all new files
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000845 seqNr = i+100 * int((ctr_responses[groupIndex]-1)/20);
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000846 if i != 0: msg = msg + ","
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000847 fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, filesize)
848 msg = msg + getEventName(fileName,ftpType,"onap","pano",nodeIndex)
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000849 seqNr = seqNr + (pnfs+batch*35)*1000000 #Create unique id for this node and file
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000850 fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000851
852 msg = msg + getEventEnd()
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000853 ctr_events[groupIndex] = ctr_events[groupIndex]+1
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000854
855 return buildOkResponse("["+msg+"]")
856
857
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000858def tc1300(groupIndex, changeId, filePrefix, ftpType, filesize):
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000859 global ctr_responses
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000860 global ctr_events
861 global rop_counter
862 global rop_timestamp
863
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000864 if (rop_counter == 0):
865 rop_timestamp = time.time()
866
867 ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000868
869 #Start a event deliver for all 700 nodes every 15min
870 rop = time.time()-rop_timestamp
871 if ((rop < 900) & (rop_counter%20 == 0) & (rop_counter != 0)):
872 return buildOkResponse("[]")
873 else:
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000874 if (rop_counter%20 == 0) & (rop_counter > 0):
875 rop_timestamp = rop_timestamp+900
876
877 rop_counter = rop_counter+1
878
879 msg = ""
880
881 batch = (rop_counter-1)%20;
882
883 for pnfs in range(35): # build events for 35 PNFs at a time. 20 batches -> 700
884 if (pnfs > 0):
885 msg = msg + ","
886 nodeIndex=pnfs + batch*35
887 nodeName = createNodeName(nodeIndex)
888 msg = msg + getEventHead(groupIndex, changeId, nodeName)
889
890 for i in range(100): # 100 files per event
891 seqNr = i + int((rop_counter-1)/20);
892 if i != 0: msg = msg + ","
893 fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, filesize)
894 msg = msg + getEventName(fileName,ftpType,"onap","pano",nodeIndex)
895 seqNr = seqNr + (pnfs+batch*35)*1000000 #Create unique id for this node and file
896 fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr
897
898 msg = msg + getEventEnd()
899 ctr_events[groupIndex] = ctr_events[groupIndex]+1
900
901 return buildOkResponse("["+msg+"]")
902
903def tc1500(groupIndex, changeId, filePrefix, ftpType, filesize):
904 global ctr_responses
905 global ctr_events
906 global rop_counter
907 global rop_timestamp
908
909 if (rop_counter == 0):
910 rop_timestamp = time.time()
911
912 ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1
913
914 if (ctr_responses[groupIndex] <= 2000 ): #first 25h of event doess not care of 15min rop timer
915
916 msg = ""
917
918 batch = (ctr_responses[groupIndex]-1)%20;
919
920 for pnfs in range(35): # build events for 35 PNFs at a time. 20 batches -> 700
921 if (pnfs > 0):
922 msg = msg + ","
923
924 nodeIndex=pnfs + batch*35
925 nodeName = createNodeName(nodeIndex)
926 msg = msg + getEventHead(groupIndex, changeId, nodeName)
927
928 for i in range(100): # 100 files per event
929 seqNr = i + int((ctr_responses[groupIndex]-1)/20);
930 if i != 0: msg = msg + ","
931 if (seqNr < 100):
932 fileName = createMissingFileName(groupIndex, filePrefix, nodeName, seqNr, "1MB")
933 else:
934 fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, "1MB")
935 seqNr = seqNr + (pnfs+batch*35)*1000000 #Create unique id for this node and file
936 fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr
937 msg = msg + getEventName(fileName,ftpType,"onap","pano",nodeIndex)
938
939
940 msg = msg + getEventEnd()
941 ctr_events[groupIndex] = ctr_events[groupIndex]+1
942
943 rop_counter = rop_counter+1
944 return buildOkResponse("["+msg+"]")
945
946 #Start an event delivery for all 700 nodes every 15min
947 rop = time.time()-rop_timestamp
948 if ((rop < 900) & (rop_counter%20 == 0) & (rop_counter != 0)):
949 return buildOkResponse("[]")
950 else:
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000951 if (rop_counter%20 == 0):
952 rop_timestamp = time.time()
953
954 rop_counter = rop_counter+1
955
956 msg = ""
957
958 batch = (rop_counter-1)%20;
959
960 for pnfs in range(35): # build events for 35 PNFs at a time. 20 batches -> 700
961 if (pnfs > 0):
962 msg = msg + ","
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000963 nodeIndex=pnfs + batch*35
964 nodeName = createNodeName(nodeIndex)
965 msg = msg + getEventHead(groupIndex, changeId, nodeName)
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000966
967 for i in range(100): # 100 files per event
968 seqNr = i + int((rop_counter-1)/20);
969 if i != 0: msg = msg + ","
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000970 fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, filesize)
971 msg = msg + getEventName(fileName,ftpType,"onap","pano", nodeIndex)
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000972 seqNr = seqNr + (pnfs+batch*35)*1000000 #Create unique id for this node and file
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000973 fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000974
975 msg = msg + getEventEnd()
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000976 ctr_events[groupIndex] = ctr_events[groupIndex]+1
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000977
978 return buildOkResponse("["+msg+"]")
979
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000980def tc500(groupIndex, changeId, filePrefix, ftpType, filesize):
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000981 global ctr_responses
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000982 global ctr_events
983
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000984
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000985 ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1
986
987 if (ctr_responses[groupIndex] > 1):
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000988 return buildOkResponse("[]")
989
990 msg = ""
991
992
993 for pnfs in range(700):
994 if (pnfs > 0):
995 msg = msg + ","
996 nodeName = createNodeName(pnfs)
BjornMagnussonXAa79a0432019-07-17 08:26:50 +0000997 msg = msg + getEventHead(groupIndex, changeId, nodeName)
BjornMagnussonXA42dcb262019-04-26 19:29:54 +0000998
999 for i in range(2):
1000 seqNr = i;
1001 if i != 0: msg = msg + ","
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001002 fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, filesize)
1003 msg = msg + getEventName(fileName,ftpType,"onap","pano",pnfs)
BjornMagnussonXA42dcb262019-04-26 19:29:54 +00001004 seqNr = seqNr + pnfs*1000000 #Create unique id for this node and file
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001005 fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr
BjornMagnussonXA42dcb262019-04-26 19:29:54 +00001006
1007 msg = msg + getEventEnd()
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001008 ctr_events[groupIndex] = ctr_events[groupIndex]+1
BjornMagnussonXA42dcb262019-04-26 19:29:54 +00001009
1010 return buildOkResponse("["+msg+"]")
1011
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001012def tc510(groupIndex, changeId, filePrefix, ftpType, fileSize):
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001013 global ctr_responses
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001014 global ctr_events
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001015
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001016
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001017 ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1
1018
1019 if (ctr_responses[groupIndex] > 5):
BjornMagnussonXA42dcb262019-04-26 19:29:54 +00001020 return buildOkResponse("[]")
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001021
1022 msg = ""
1023
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001024 for pnfs in range(700): # build events for 700 MEs
1025 if (pnfs > 0):
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001026 msg = msg + ","
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001027 nodeName = createNodeName(pnfs)
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001028 msg = msg + getEventHead(groupIndex, changeId, nodeName)
1029 seqNr = (ctr_responses[groupIndex]-1)
1030 fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, fileSize)
1031 msg = msg + getEventName(fileName,ftpType,"onap","pano",pnfs)
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001032 seqNr = seqNr + pnfs*1000000 #Create unique id for this node and file
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001033 fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001034 msg = msg + getEventEnd()
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001035 ctr_events[groupIndex] = ctr_events[groupIndex]+1
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001036
1037 return buildOkResponse("["+msg+"]")
1038
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001039def tc511(groupIndex, changeId, filePrefix, ftpType, fileSize):
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001040 global ctr_responses
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001041 global ctr_events
1042
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001043
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001044 ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1
1045
1046 if (ctr_responses[groupIndex] > 5):
BjornMagnussonXA42dcb262019-04-26 19:29:54 +00001047 return buildOkResponse("[]")
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001048
1049 msg = ""
1050
1051 for pnfs in range(700): # build events for 700 MEs
1052 if (pnfs > 0):
1053 msg = msg + ","
1054 nodeName = createNodeName(pnfs)
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001055 msg = msg + getEventHead(groupIndex, changeId, nodeName)
1056 seqNr = (ctr_responses[groupIndex]-1)
1057 fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, fileSize)
1058 msg = msg + getEventName(fileName,ftpType,"onap","pano",pnfs)
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001059 seqNr = seqNr + pnfs*1000000 #Create unique id for this node and file
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001060 fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001061 msg = msg + getEventEnd()
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001062 ctr_events[groupIndex] = ctr_events[groupIndex]+1
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001063
1064 return buildOkResponse("["+msg+"]")
1065
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001066def tc710(groupIndex, changeId, filePrefix, ftpType):
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001067 global ctr_responses
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001068 global ctr_events
1069
BjornMagnussonXA42dcb262019-04-26 19:29:54 +00001070
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001071 ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1
1072
1073 if (ctr_responses[groupIndex] > 100):
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001074 return buildOkResponse("[]")
1075
1076 msg = ""
BjornMagnussonXA42dcb262019-04-26 19:29:54 +00001077
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001078 batch = (ctr_responses[groupIndex]-1)%20;
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001079
1080 for pnfs in range(35): # build events for 35 PNFs at a time. 20 batches -> 700
1081 if (pnfs > 0):
1082 msg = msg + ","
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001083 nodeIndex=pnfs + batch*35
1084 nodeName = createNodeName(nodeIndex)
1085 msg = msg + getEventHead(groupIndex, changeId, nodeName)
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001086
1087 for i in range(100): # 100 files per event
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001088 seqNr = i + int((ctr_responses[groupIndex]-1)/20);
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001089 if i != 0: msg = msg + ","
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001090 fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, "1MB")
1091 msg = msg + getEventName(fileName,ftpType,"onap","pano",nodeIndex)
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001092 seqNr = seqNr + (pnfs+batch*35)*1000000 #Create unique id for this node and file
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001093 fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001094
1095 msg = msg + getEventEnd()
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001096 ctr_events[groupIndex] = ctr_events[groupIndex]+1
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001097
1098 return buildOkResponse("["+msg+"]")
1099
1100
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001101#### Functions to build json messages and respones ####
1102
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001103def createNodeName(index):
1104 return "PNF"+str(index);
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001105
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001106def createFileName(groupIndex, filePrefix, nodeName, index, size):
BjornMagnussonXA42dcb262019-04-26 19:29:54 +00001107 global ctr_files
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001108 ctr_files[groupIndex] = ctr_files[groupIndex] + 1
1109 return filePrefix+"20000626.2315+0200-2330+0200_" + nodeName + "-" + str(index) + "-" +size + ".tar.gz";
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001110
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001111def createMissingFileName(groupIndex, filePrefix, nodeName, index, size):
BjornMagnussonXA42dcb262019-04-26 19:29:54 +00001112 global ctr_files
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001113 ctr_files[groupIndex] = ctr_files[groupIndex] + 1
1114 return filePrefix+"MissingFile_" + nodeName + "-" + str(index) + "-" +size + ".tar.gz";
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001115
1116
1117# Function to build fixed beginning of an event
1118
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001119def getEventHead(groupIndex, changeId, nodename):
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001120 global pnfMap
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001121 pnfMap[groupIndex].add(nodename)
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001122 headStr = """
1123 {
TamasBakai9b780332019-02-15 08:38:16 +00001124 "event": {
1125 "commonEventHeader": {
1126 "startEpochMicrosec": 8745745764578,
1127 "eventId": "FileReady_1797490e-10ae-4d48-9ea7-3d7d790b25e1",
1128 "timeZoneOffset": "UTC+05.30",
1129 "internalHeaderFields": {
1130 "collectorTimeStamp": "Tue, 09 18 2018 10:56:52 UTC"
1131 },
1132 "priority": "Normal",
1133 "version": "4.0.1",
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001134 "reportingEntityName": \"""" + nodename + """",
TamasBakai9b780332019-02-15 08:38:16 +00001135 "sequence": 0,
1136 "domain": "notification",
1137 "lastEpochMicrosec": 8745745764578,
1138 "eventName": "Noti_RnNode-Ericsson_FileReady",
1139 "vesEventListenerVersion": "7.0.1",
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001140 "sourceName": \"""" + nodename + """"
TamasBakai9b780332019-02-15 08:38:16 +00001141 },
1142 "notificationFields": {
1143 "notificationFieldsVersion": "2.0",
1144 "changeType": "FileReady",
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001145 "changeIdentifier": \"""" + changeId + """",
TamasBakai9b780332019-02-15 08:38:16 +00001146 "arrayOfNamedHashMap": [
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001147 """
1148 return headStr
1149
1150# Function to build the variable part of an event
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001151def getEventName(fn,type,user,passwd, nodeIndex):
1152 nodeIndex=nodeIndex%num_ftp_servers
1153 port = sftp_ports[nodeIndex]
1154 ip = sftp_hosts[nodeIndex]
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001155 if (type == "ftps"):
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001156 port = ftps_ports[nodeIndex]
1157 ip = ftps_hosts[nodeIndex]
BjornMagnussonXA42dcb262019-04-26 19:29:54 +00001158
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001159 nameStr = """{
1160 "name": \"""" + fn + """",
TamasBakai9b780332019-02-15 08:38:16 +00001161 "hashMap": {
1162 "fileFormatType": "org.3GPP.32.435#measCollec",
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001163 "location": \"""" + type + """://""" + user + """:""" + passwd + """@""" + ip + """:""" + str(port) + """/""" + fn + """",
TamasBakai9b780332019-02-15 08:38:16 +00001164 "fileFormatVersion": "V10",
1165 "compression": "gzip"
1166 }
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001167 } """
1168 return nameStr
1169
1170# Function to build fixed end of an event
1171def getEventEnd():
1172 endStr = """
TamasBakai9b780332019-02-15 08:38:16 +00001173 ]
1174 }
1175 }
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001176 }
1177 """
1178 return endStr
TamasBakai9b780332019-02-15 08:38:16 +00001179
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001180# Function to build an OK reponse from a message string
1181def buildOkResponse(msg):
1182 response = app.response_class(
1183 response=str.encode(msg),
1184 status=200,
1185 mimetype='application/json')
1186 return response
TamasBakai9b780332019-02-15 08:38:16 +00001187
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001188# Function to build an empty message with status
1189def buildEmptyResponse(status_code):
1190 response = app.response_class(
1191 response=str.encode(""),
1192 status=status_code,
1193 mimetype='application/json')
1194 return response
TamasBakai9b780332019-02-15 08:38:16 +00001195
1196
1197if __name__ == "__main__":
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001198
1199 # IP addresses to use for ftp servers, using localhost if not env var is set
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001200 sftp_sims = os.environ.get('SFTP_SIMS', 'localhost:1022')
1201 ftps_sims = os.environ.get('FTPS_SIMS', 'localhost:21')
1202 num_ftp_servers = int(os.environ.get('NUM_FTP_SERVERS', 1))
1203
1204 print("Configured sftp sims: " + sftp_sims)
1205 print("Configured ftps sims: " + ftps_sims)
1206 print("Configured number of ftp servers: " + str(num_ftp_servers))
1207
1208 tmp=sftp_sims.split(',')
1209 for i in range(len(tmp)):
1210 hp=tmp[i].split(':')
1211 sftp_hosts.append(hp[0])
1212 sftp_ports.append(hp[1])
1213
1214 tmp=ftps_sims.split(',')
1215 for i in range(len(tmp)):
1216 hp=tmp[i].split(':')
1217 ftps_hosts.append(hp[0])
1218 ftps_ports.append(hp[1])
1219
1220 groups = os.environ.get('MR_GROUPS', 'OpenDcae-c12:PM_MEAS_FILES')
1221 configuredPrefixes = os.environ.get('MR_FILE_PREFIX_MAPPING', 'PM_MEAS_FILES:A')
1222
1223 if (len(groups) == 0 ):
1224 groups='OpenDcae-c12:PM_MEAS_FILES'
1225 print("Using default group: " + groups)
1226 else:
1227 print("Configured groups: " + groups)
1228
1229 if (len(configuredPrefixes) == 0 ):
1230 configuredPrefixes='PM_MEAS_FILES:A'
1231 print("Using default changeid to file prefix mapping: " + configuredPrefixes)
1232 else:
1233 print("Configured changeid to file prefix mapping: " + configuredPrefixes)
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001234
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001235 #Counters
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001236 ctr_responses = []
1237 ctr_requests = []
1238 ctr_files=[]
1239 ctr_events = []
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001240 startTime = time.time()
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001241 firstPollTime = []
BjornMagnussonXA42dcb262019-04-26 19:29:54 +00001242 runningState = "Started"
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001243 #Keeps all responded file names
1244 fileMap = []
1245 #Keeps all responded PNF names
1246 pnfMap = []
1247 #Handles rop periods for tests that deliveres events every 15 min
BjornMagnussonXA42dcb262019-04-26 19:29:54 +00001248 rop_counter = 0
1249 rop_timestamp = time.time()
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001250
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001251 #List of configured group names
1252 groupNames = []
1253 #Mapping between group name and index in groupNames
1254 groupNameIndexes = {}
1255 #String of configured groups
1256 configuredGroups = ""
1257 #String of configured change identifiers
1258 configuredChangeIds = ""
1259 #List of changed identifiers
1260 changeIds = []
1261 #List of filePrefixes
1262 filePrefixes = {}
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001263
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001264 tmp=groups.split(',')
1265 for i in range(len(tmp)):
1266 g=tmp[i].split(':')
1267 for j in range(len(g)):
1268 g[j] = g[j].strip()
1269 if (j == 0):
1270 if (len(configuredGroups) > 0):
1271 configuredGroups=configuredGroups+","
1272 configuredGroups=configuredGroups+g[0]
1273 groupNames.append(g[0])
1274 groupNameIndexes[g[0]] = i
1275 changeIds.append({})
1276 ctr_responses.append(0)
1277 ctr_requests.append(0)
1278 ctr_files.append(0)
1279 ctr_events.append(0)
1280 firstPollTime.append(0)
1281 pnfMap.append(set())
1282 fileMap.append({})
1283 if (len(configuredChangeIds) > 0):
1284 configuredChangeIds=configuredChangeIds+","
1285 else:
1286 changeIds[i][j-1]=g[j]
1287 if (j > 1):
1288 configuredChangeIds=configuredChangeIds+":"
1289 configuredChangeIds=configuredChangeIds+g[j]
1290
1291 # Create a map between changeid and file name prefix
1292 tmp=configuredPrefixes.split(',')
1293 for i in range(len(tmp)):
1294 p=tmp[i].split(':')
1295 filePrefixes[p[0]] = p[1]
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001296
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001297 tc_num = "Not set"
1298 tc_help = "Not set"
TamasBakai9b780332019-02-15 08:38:16 +00001299
1300 parser = argparse.ArgumentParser()
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001301
1302#SFTP TCs with single ME
TamasBakai9b780332019-02-15 08:38:16 +00001303 parser.add_argument(
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001304 '--tc100',
TamasBakai9b780332019-02-15 08:38:16 +00001305 action='store_true',
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001306 help='TC100 - One ME, SFTP, 1 1MB file, 1 event')
TamasBakai9b780332019-02-15 08:38:16 +00001307 parser.add_argument(
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001308 '--tc101',
TamasBakai9b780332019-02-15 08:38:16 +00001309 action='store_true',
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001310 help='TC101 - One ME, SFTP, 1 5MB file, 1 event')
TamasBakai9b780332019-02-15 08:38:16 +00001311 parser.add_argument(
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001312 '--tc102',
TamasBakai9b780332019-02-15 08:38:16 +00001313 action='store_true',
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001314 help='TC102 - One ME, SFTP, 1 50MB file, 1 event')
1315
TamasBakai9b780332019-02-15 08:38:16 +00001316 parser.add_argument(
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001317 '--tc110',
TamasBakai9b780332019-02-15 08:38:16 +00001318 action='store_true',
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001319 help='TC110 - One ME, SFTP, 1MB files, 1 file per event, 100 events, 1 event per poll.')
1320 parser.add_argument(
1321 '--tc111',
1322 action='store_true',
1323 help='TC111 - One ME, SFTP, 1MB files, 100 files per event, 100 events, 1 event per poll.')
1324 parser.add_argument(
1325 '--tc112',
1326 action='store_true',
1327 help='TC112 - One ME, SFTP, 5MB files, 100 files per event, 100 events, 1 event per poll.')
1328 parser.add_argument(
1329 '--tc113',
1330 action='store_true',
1331 help='TC113 - One ME, SFTP, 1MB files, 100 files per event, 100 events. All events in one poll.')
1332
1333 parser.add_argument(
1334 '--tc120',
1335 action='store_true',
1336 help='TC120 - One ME, SFTP, 1MB files, 100 files per event, 100 events, 1 event per poll. 10% of replies each: no response, empty message, slow response, 404-error, malformed json')
1337 parser.add_argument(
1338 '--tc121',
1339 action='store_true',
1340 help='TC121 - One ME, SFTP, 1MB files, 100 files per event, 100 events, 1 event per poll. 10% missing files')
1341 parser.add_argument(
1342 '--tc122',
1343 action='store_true',
1344 help='TC122 - One ME, SFTP, 1MB files, 100 files per event, 100 events. 1 event per poll. All files with identical name. ')
1345
1346 parser.add_argument(
1347 '--tc1000',
1348 action='store_true',
1349 help='TC1000 - One ME, SFTP, 1MB files, 100 files per event, endless number of events, 1 event per poll')
1350 parser.add_argument(
1351 '--tc1001',
1352 action='store_true',
1353 help='TC1001 - One ME, SFTP, 5MB files, 100 files per event, endless number of events, 1 event per poll')
1354
1355# SFTP TCs with multiple MEs
1356 parser.add_argument(
BjornMagnussonXA42dcb262019-04-26 19:29:54 +00001357 '--tc500',
1358 action='store_true',
1359 help='TC500 - 700 MEs, SFTP, 1MB files, 2 new files per event, 700 events, all event in one poll.')
1360
1361 parser.add_argument(
1362 '--tc501',
1363 action='store_true',
1364 help='TC501 - 700 MEs, SFTP, 5MB files, 2 new files per event, 700 events, all event in one poll.')
1365
1366 parser.add_argument(
1367 '--tc502',
1368 action='store_true',
1369 help='TC502 - 700 MEs, SFTP, 50MB files, 2 new files per event, 700 events, all event in one poll.')
1370
1371 parser.add_argument(
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001372 '--tc510',
1373 action='store_true',
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001374 help='TC510 - 700 MEs, SFTP, 1MB files, 1 file per event, 3500 events, 700 event per poll.')
BjornMagnussonXA42dcb262019-04-26 19:29:54 +00001375
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001376 parser.add_argument(
1377 '--tc511',
1378 action='store_true',
1379 help='TC511 - 700 MEs, SFTP, 1KB files, 1 file per event, 3500 events, 700 event per poll.')
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001380
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001381 parser.add_argument(
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001382 '--tc550',
1383 action='store_true',
1384 help='TC550 - 700 MEs, SFTP, 50MB files, 1 file per event, 3500 events, 700 event per poll.')
1385
1386 parser.add_argument(
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001387 '--tc710',
1388 action='store_true',
1389 help='TC710 - 700 MEs, SFTP, 1MB files, 100 files per event, 3500 events, 35 event per poll.')
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001390
BjornMagnussonXA42dcb262019-04-26 19:29:54 +00001391 parser.add_argument(
1392 '--tc1100',
1393 action='store_true',
1394 help='TC1100 - 700 ME, SFTP, 1MB files, 100 files per event, endless number of events, 35 event per poll')
1395 parser.add_argument(
1396 '--tc1101',
1397 action='store_true',
1398 help='TC1101 - 700 ME, SFTP, 5MB files, 100 files per event, endless number of events, 35 event per poll')
1399 parser.add_argument(
1400 '--tc1102',
1401 action='store_true',
1402 help='TC1102 - 700 ME, SFTP, 50MB files, 100 files per event, endless number of events, 35 event per poll')
1403
1404 parser.add_argument(
1405 '--tc1200',
1406 action='store_true',
1407 help='TC1200 - 700 ME, SFTP, 1MB files, 100 new files per event, endless number of events, 35 event per poll')
1408 parser.add_argument(
1409 '--tc1201',
1410 action='store_true',
1411 help='TC1201 - 700 ME, SFTP, 5MB files, 100 new files per event, endless number of events, 35 event per poll')
1412 parser.add_argument(
1413 '--tc1202',
1414 action='store_true',
1415 help='TC1202 - 700 ME, SFTP, 50MB files, 100 new files per event, endless number of events, 35 event per poll')
1416
1417 parser.add_argument(
1418 '--tc1300',
1419 action='store_true',
1420 help='TC1300 - 700 ME, SFTP, 1MB files, 100 files per event, endless number of events, 35 event per poll, 20 event polls every 15min')
1421 parser.add_argument(
1422 '--tc1301',
1423 action='store_true',
1424 help='TC1301 - 700 ME, SFTP, 5MB files, 100 files per event, endless number of events, 35 event per poll, 20 event polls every 15min')
1425 parser.add_argument(
1426 '--tc1302',
1427 action='store_true',
1428 help='TC1302 - 700 ME, SFTP, 50MB files, 100 files per event, endless number of events, 35 event per poll, 20 event polls every 15min')
1429
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001430 parser.add_argument(
1431 '--tc1500',
1432 action='store_true',
1433 help='TC1500 - 700 ME, SFTP, 1MB files, 100 files per event, 35 events per poll, simulating 25h backlog of decreasing number of outdated files and then 20 event polls every 15min for 1h')
BjornMagnussonXA42dcb262019-04-26 19:29:54 +00001434
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001435# FTPS TCs with single ME
1436 parser.add_argument(
1437 '--tc200',
1438 action='store_true',
1439 help='TC200 - One ME, FTPS, 1 1MB file, 1 event')
1440 parser.add_argument(
1441 '--tc201',
1442 action='store_true',
1443 help='TC201 - One ME, FTPS, 1 5MB file, 1 event')
1444 parser.add_argument(
1445 '--tc202',
1446 action='store_true',
1447 help='TC202 - One ME, FTPS, 1 50MB file, 1 event')
1448
1449 parser.add_argument(
1450 '--tc210',
1451 action='store_true',
1452 help='TC210 - One ME, FTPS, 1MB files, 1 file per event, 100 events, 1 event per poll.')
1453 parser.add_argument(
1454 '--tc211',
1455 action='store_true',
1456 help='TC211 - One ME, FTPS, 1MB files, 100 files per event, 100 events, 1 event per poll.')
1457 parser.add_argument(
1458 '--tc212',
1459 action='store_true',
1460 help='TC212 - One ME, FTPS, 5MB files, 100 files per event, 100 events, 1 event per poll.')
1461 parser.add_argument(
1462 '--tc213',
1463 action='store_true',
1464 help='TC213 - One ME, FTPS, 1MB files, 100 files per event, 100 events. All events in one poll.')
1465
1466 parser.add_argument(
1467 '--tc220',
1468 action='store_true',
1469 help='TC220 - One ME, FTPS, 1MB files, 100 files per event, 100 events, 1 event per poll. 10% of replies each: no response, empty message, slow response, 404-error, malformed json')
1470 parser.add_argument(
1471 '--tc221',
1472 action='store_true',
1473 help='TC221 - One ME, FTPS, 1MB files, 100 files per event, 100 events, 1 event per poll. 10% missing files')
1474 parser.add_argument(
1475 '--tc222',
1476 action='store_true',
1477 help='TC222 - One ME, FTPS, 1MB files, 100 files per event, 100 events. 1 event per poll. All files with identical name. ')
1478
1479 parser.add_argument(
1480 '--tc2000',
1481 action='store_true',
1482 help='TC2000 - One ME, FTPS, 1MB files, 100 files per event, endless number of events, 1 event per poll')
1483 parser.add_argument(
1484 '--tc2001',
1485 action='store_true',
BjornMagnussonXA42dcb262019-04-26 19:29:54 +00001486 help='TC2001 - One ME, FTPS, 5MB files, 100 files per event, endless number of events, 1 event per poll')
1487
1488
1489 parser.add_argument(
1490 '--tc2100',
1491 action='store_true',
1492 help='TC2100 - 700 ME, FTPS, 1MB files, 100 files per event, endless number of events, 35 event per poll')
1493 parser.add_argument(
1494 '--tc2101',
1495 action='store_true',
1496 help='TC2101 - 700 ME, FTPS, 5MB files, 100 files per event, endless number of events, 35 event per poll')
1497 parser.add_argument(
1498 '--tc2102',
1499 action='store_true',
1500 help='TC2102 - 700 ME, FTPS, 50MB files, 100 files per event, endless number of events, 35 event per poll')
1501
1502 parser.add_argument(
1503 '--tc2200',
1504 action='store_true',
1505 help='TC2200 - 700 ME, FTPS, 1MB files, 100 new files per event, endless number of events, 35 event per poll')
1506 parser.add_argument(
1507 '--tc2201',
1508 action='store_true',
1509 help='TC2201 - 700 ME, FTPS, 5MB files, 100 new files per event, endless number of events, 35 event per poll')
1510 parser.add_argument(
1511 '--tc2202',
1512 action='store_true',
1513 help='TC2202 - 700 ME, FTPS, 50MB files, 100 new files per event, endless number of events, 35 event per poll')
1514
1515 parser.add_argument(
1516 '--tc2300',
1517 action='store_true',
1518 help='TC2300 - 700 ME, FTPS, 1MB files, 100 files per event, endless number of events, 35 event per poll, 20 event polls every 15min')
1519 parser.add_argument(
1520 '--tc2301',
1521 action='store_true',
1522 help='TC2301 - 700 ME, FTPS, 5MB files, 100 files per event, endless number of events, 35 event per poll, 20 event polls every 15min')
1523 parser.add_argument(
1524 '--tc2302',
1525 action='store_true',
1526 help='TC2302 - 700 ME, FTPS, 50MB files, 100 files per event, endless number of events, 35 event per poll, 20 event polls every 15min')
1527
1528 parser.add_argument(
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001529 '--tc2500',
1530 action='store_true',
1531 help='TC2500 - 700 ME, FTPS, 1MB files, 100 files per event, 35 events per poll, simulating 25h backlog of decreasing number of outdated files and then 20 event polls every 15min for 1h')
1532
1533 parser.add_argument(
BjornMagnussonXA42dcb262019-04-26 19:29:54 +00001534 '--tc600',
1535 action='store_true',
1536 help='TC600 - 700 MEs, FTPS, 1MB files, 2 new files per event, 700 events, all event in one poll.')
1537
1538 parser.add_argument(
1539 '--tc601',
1540 action='store_true',
1541 help='TC601 - 700 MEs, FTPS, 5MB files, 2 new files per event, 700 events, all event in one poll.')
1542
1543 parser.add_argument(
1544 '--tc602',
1545 action='store_true',
1546 help='TC602 - 700 MEs, FTPS, 50MB files, 2 new files per event, 700 events, all event in one poll.')
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001547
1548 parser.add_argument(
1549 '--tc610',
1550 action='store_true',
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001551 help='TC610 - 700 MEs, FTPS, 1MB files, 1 file per event, 3500 events, 700 event per poll.')
1552
1553 parser.add_argument(
1554 '--tc611',
1555 action='store_true',
1556 help='TC611 - 700 MEs, FTPS, 1KB files, 1 file per event, 3500 events, 700 event per poll.')
1557
1558 parser.add_argument(
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001559 '--tc650',
1560 action='store_true',
1561 help='TC610 - 700 MEs, FTPS, 50MB files, 1 file per event, 3500 events, 700 event per poll.')
1562
1563 parser.add_argument(
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001564 '--tc810',
1565 action='store_true',
1566 help='TC810 - 700 MEs, FTPS, 1MB files, 100 files per event, 3500 events, 35 event per poll.')
TamasBakai9b780332019-02-15 08:38:16 +00001567
1568 args = parser.parse_args()
1569
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001570
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001571
1572 if args.tc100:
1573 tc_num = "TC# 100"
1574 elif args.tc101:
1575 tc_num = "TC# 101"
1576 elif args.tc102:
1577 tc_num = "TC# 102"
1578
1579 elif args.tc110:
1580 tc_num = "TC# 110"
1581 elif args.tc111:
1582 tc_num = "TC# 111"
1583 elif args.tc112:
1584 tc_num = "TC# 112"
1585 elif args.tc113:
1586 tc_num = "TC# 113"
1587
1588 elif args.tc120:
1589 tc_num = "TC# 120"
1590 elif args.tc121:
1591 tc_num = "TC# 121"
1592 elif args.tc122:
1593 tc_num = "TC# 122"
1594
1595 elif args.tc1000:
1596 tc_num = "TC# 1000"
1597 elif args.tc1001:
1598 tc_num = "TC# 1001"
1599
BjornMagnussonXA42dcb262019-04-26 19:29:54 +00001600 elif args.tc1100:
1601 tc_num = "TC# 1100"
1602 elif args.tc1101:
1603 tc_num = "TC# 1101"
1604 elif args.tc1102:
1605 tc_num = "TC# 1102"
1606 elif args.tc1200:
1607 tc_num = "TC# 1200"
1608 elif args.tc1201:
1609 tc_num = "TC# 1201"
1610 elif args.tc1202:
1611 tc_num = "TC# 1202"
1612 elif args.tc1300:
1613 tc_num = "TC# 1300"
1614 elif args.tc1301:
1615 tc_num = "TC# 1301"
1616 elif args.tc1302:
1617 tc_num = "TC# 1302"
1618
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001619 elif args.tc1500:
1620 tc_num = "TC# 1500"
1621
BjornMagnussonXA42dcb262019-04-26 19:29:54 +00001622 elif args.tc500:
1623 tc_num = "TC# 500"
1624 elif args.tc501:
1625 tc_num = "TC# 501"
1626 elif args.tc502:
1627 tc_num = "TC# 502"
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001628 elif args.tc510:
1629 tc_num = "TC# 510"
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001630 elif args.tc511:
1631 tc_num = "TC# 511"
BjornMagnussonXA42dcb262019-04-26 19:29:54 +00001632
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001633 elif args.tc550:
1634 tc_num = "TC# 550"
1635
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001636 elif args.tc710:
1637 tc_num = "TC# 710"
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001638
1639 elif args.tc200:
1640 tc_num = "TC# 200"
1641 elif args.tc201:
1642 tc_num = "TC# 201"
1643 elif args.tc202:
1644 tc_num = "TC# 202"
1645
1646 elif args.tc210:
1647 tc_num = "TC# 210"
1648 elif args.tc211:
1649 tc_num = "TC# 211"
1650 elif args.tc212:
1651 tc_num = "TC# 212"
1652 elif args.tc213:
1653 tc_num = "TC# 213"
1654
1655 elif args.tc220:
1656 tc_num = "TC# 220"
1657 elif args.tc221:
1658 tc_num = "TC# 221"
1659 elif args.tc222:
1660 tc_num = "TC# 222"
1661
1662 elif args.tc2000:
1663 tc_num = "TC# 2000"
1664 elif args.tc2001:
1665 tc_num = "TC# 2001"
1666
BjornMagnussonXA42dcb262019-04-26 19:29:54 +00001667 elif args.tc2100:
1668 tc_num = "TC# 2100"
1669 elif args.tc2101:
1670 tc_num = "TC# 2101"
1671 elif args.tc2102:
1672 tc_num = "TC# 2102"
1673 elif args.tc2200:
1674 tc_num = "TC# 2200"
1675 elif args.tc2201:
1676 tc_num = "TC# 2201"
1677 elif args.tc2202:
1678 tc_num = "TC# 2202"
1679 elif args.tc2300:
1680 tc_num = "TC# 2300"
1681 elif args.tc2301:
1682 tc_num = "TC# 2301"
1683 elif args.tc2302:
1684 tc_num = "TC# 2302"
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001685
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001686 elif args.tc2500:
1687 tc_num = "TC# 2500"
1688
BjornMagnussonXA42dcb262019-04-26 19:29:54 +00001689 elif args.tc600:
1690 tc_num = "TC# 600"
1691 elif args.tc601:
1692 tc_num = "TC# 601"
1693 elif args.tc602:
1694 tc_num = "TC# 602"
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001695 elif args.tc610:
1696 tc_num = "TC# 610"
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001697 elif args.tc611:
1698 tc_num = "TC# 611"
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001699 elif args.tc650:
1700 tc_num = "TC# 650"
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001701 elif args.tc810:
1702 tc_num = "TC# 810"
TamasBakai9b780332019-02-15 08:38:16 +00001703
1704 else:
1705 print("No TC was defined")
1706 print("use --help for usage info")
1707 sys.exit()
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001708
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001709 print("TC num: " + tc_num)
BjornMagnussonXA42dcb262019-04-26 19:29:54 +00001710
BjornMagnussonXAa79a0432019-07-17 08:26:50 +00001711 for i in range(len(sftp_hosts)):
1712 print("Using " + str(sftp_hosts[i]) + ":" + str(sftp_ports[i]) + " for sftp server with index " + str(i) + " for sftp server address and port in file urls.")
1713
1714 for i in range(len(ftps_hosts)):
1715 print("Using " + str(ftps_hosts[i]) + ":" + str(ftps_ports[i]) + " for ftps server with index " + str(i) + " for ftps server address and port in file urls.")
1716
1717 print("Using up to " + str(num_ftp_servers) + " ftp servers, for each protocol for PNFs.")
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001718
BjornMagnussonXAf8b34f02019-03-22 09:48:38 +00001719 app.run(port=HOST_PORT, host=HOST_IP)
BjornMagnussonXAf4e18362019-04-10 13:04:08 +00001720