TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 1 | import argparse |
| 2 | import os |
| 3 | from werkzeug import secure_filename |
| 4 | from flask import Flask, render_template, request |
| 5 | from time import sleep |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 6 | import time |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 7 | import sys |
| 8 | import json |
| 9 | from flask import Flask |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 10 | |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 11 | app = Flask(__name__) |
| 12 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 13 | #Server info |
| 14 | HOST_IP = "0.0.0.0" |
| 15 | HOST_PORT = 2222 |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 16 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 17 | sftp_hosts=[] |
| 18 | sftp_ports=[] |
| 19 | ftps_hosts=[] |
| 20 | ftps_ports=[] |
| 21 | num_ftp_servers=0 |
| 22 | |
| 23 | def sumList(ctrArray): |
| 24 | tmp=0 |
| 25 | for i in range(len(ctrArray)): |
| 26 | tmp=tmp+ctrArray[i]; |
| 27 | |
| 28 | return str(tmp); |
| 29 | |
| 30 | def sumListLength(ctrArray): |
| 31 | tmp=0 |
| 32 | for i in range(len(ctrArray)): |
| 33 | tmp=tmp+len(ctrArray[i]); |
| 34 | |
| 35 | return str(tmp); |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 36 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 37 | #Test function to check server running |
| 38 | @app.route('/', |
| 39 | methods=['GET']) |
| 40 | def index(): |
| 41 | return 'Hello world' |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 42 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 43 | #Returns the list of configured groups |
| 44 | @app.route('/groups', |
| 45 | methods=['GET']) |
| 46 | def group_ids(): |
| 47 | global configuredGroups |
| 48 | return configuredGroups |
| 49 | |
| 50 | #Returns the list of configured changeids |
| 51 | @app.route('/changeids', |
| 52 | methods=['GET']) |
| 53 | def change_ids(): |
| 54 | global configuredChangeIds |
| 55 | return configuredChangeIds |
| 56 | |
| 57 | #Returns the list of configured fileprefixes |
| 58 | @app.route('/fileprefixes', |
| 59 | methods=['GET']) |
| 60 | def fileprefixes(): |
| 61 | global configuredPrefixes |
| 62 | return configuredPrefixes |
| 63 | |
| 64 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 65 | #Returns number of polls |
| 66 | @app.route('/ctr_requests', |
| 67 | methods=['GET']) |
| 68 | def counter_requests(): |
| 69 | global ctr_requests |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 70 | return sumList(ctr_requests) |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 71 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 72 | #Returns number of polls for all groups |
| 73 | @app.route('/groups/ctr_requests', |
| 74 | methods=['GET']) |
| 75 | def 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']) |
| 88 | def 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 |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 94 | @app.route('/ctr_responses', |
| 95 | methods=['GET']) |
| 96 | def counter_responses(): |
| 97 | global ctr_responses |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 98 | return sumList(ctr_responses) |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 99 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 100 | #Returns number of poll replies for all groups |
| 101 | @app.route('/groups/ctr_responses', |
| 102 | methods=['GET']) |
| 103 | def 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']) |
| 116 | def 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 |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 122 | @app.route('/ctr_files', |
| 123 | methods=['GET']) |
| 124 | def counter_files(): |
| 125 | global ctr_files |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 126 | return sumList(ctr_files) |
| 127 | |
| 128 | #Returns the total number of file for all groups |
| 129 | @app.route('/groups/ctr_files', |
| 130 | methods=['GET']) |
| 131 | def 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']) |
| 144 | def counter_files_group(groupId): |
| 145 | global ctr_files |
| 146 | global groupNameIndexes |
| 147 | return str(ctr_files[groupNameIndexes[groupId]]) |
| 148 | |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 149 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 150 | #Returns number of unique files |
| 151 | @app.route('/ctr_unique_files', |
| 152 | methods=['GET']) |
| 153 | def counter_uniquefiles(): |
| 154 | global fileMap |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 155 | return sumListLength(fileMap) |
| 156 | |
| 157 | #Returns number of unique files for all groups |
| 158 | @app.route('/groups/ctr_unique_files', |
| 159 | methods=['GET']) |
| 160 | def 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']) |
| 173 | def counter_uniquefiles_group(groupId): |
| 174 | global fileMap |
| 175 | global groupNameIndexes |
| 176 | return str(len(fileMap[groupNameIndexes[groupId]])) |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 177 | |
| 178 | #Returns tc info |
| 179 | @app.route('/tc_info', |
| 180 | methods=['GET']) |
| 181 | def testcase_info(): |
| 182 | global tc_num |
| 183 | return tc_num |
| 184 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 185 | #Returns number of events |
| 186 | @app.route('/ctr_events', |
| 187 | methods=['GET']) |
| 188 | def counter_events(): |
| 189 | global ctr_events |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 190 | return sumList(ctr_events) |
| 191 | |
| 192 | #Returns number of events for all groups |
| 193 | @app.route('/groups/ctr_events', |
| 194 | methods=['GET']) |
| 195 | def 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']) |
| 208 | def counter_events_group(groupId): |
| 209 | global ctr_events |
| 210 | global groupNameIndexes |
| 211 | return str(ctr_events[groupNameIndexes[groupId]]) |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 212 | |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 213 | #Returns execution time in mm:ss |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 214 | @app.route('/execution_time', |
| 215 | methods=['GET']) |
| 216 | def exe_time(): |
| 217 | global startTime |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 218 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 219 | stopTime = time.time() |
| 220 | minutes, seconds = divmod(stopTime-startTime, 60) |
| 221 | return "{:0>2}:{:0>2}".format(int(minutes),int(seconds)) |
| 222 | |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 223 | #Returns the timestamp for first poll |
| 224 | @app.route('/exe_time_first_poll', |
| 225 | methods=['GET']) |
| 226 | def exe_time_first_poll(): |
| 227 | global firstPollTime |
| 228 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 229 | tmp = 0 |
| 230 | for i in range(len(groupNames)): |
| 231 | if (firstPollTime[i] > tmp): |
| 232 | tmp = firstPollTime[i] |
| 233 | |
| 234 | if (tmp == 0): |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 235 | return "--:--" |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 236 | 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']) |
| 242 | def 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']) |
| 260 | def 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) |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 267 | return "{:0>2}:{:0>2}".format(int(minutes),int(seconds)) |
| 268 | |
| 269 | #Starts event delivery |
| 270 | @app.route('/start', |
| 271 | methods=['GET']) |
| 272 | def start(): |
| 273 | global runningState |
| 274 | runningState="Started" |
| 275 | return runningState |
| 276 | |
| 277 | #Stops event delivery |
| 278 | @app.route('/stop', |
| 279 | methods=['GET']) |
| 280 | def stop(): |
| 281 | global runningState |
| 282 | runningState="Stopped" |
| 283 | return runningState |
| 284 | |
| 285 | #Returns the running state |
| 286 | @app.route('/status', |
| 287 | methods=['GET']) |
| 288 | def status(): |
| 289 | global runningState |
| 290 | return runningState |
| 291 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 292 | #Returns number of unique PNFs |
| 293 | @app.route('/ctr_unique_PNFs', |
| 294 | methods=['GET']) |
| 295 | def counter_uniquePNFs(): |
| 296 | global pnfMap |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 297 | return sumListLength(pnfMap) |
| 298 | |
| 299 | #Returns number of unique PNFs for all groups |
| 300 | @app.route('/groups/ctr_unique_PNFs', |
| 301 | methods=['GET']) |
| 302 | def 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']) |
| 315 | def counter_uniquePNFs_group(groupId): |
| 316 | global pnfMap |
| 317 | global groupNameIndexes |
| 318 | return str(len(pnfMap[groupNameIndexes[groupId]])) |
| 319 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 320 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 321 | #Messages polling function |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 322 | @app.route( |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 323 | "/events/unauthenticated.VES_NOTIFICATION_OUTPUT/<consumerGroup>/<consumerId>", |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 324 | methods=['GET']) |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 325 | def MR_reply(consumerGroup, consumerId): |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 326 | global ctr_requests |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 327 | global ctr_responses |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 328 | global args |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 329 | global runningState |
| 330 | global firstPollTime |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 331 | global groupNameIndexes |
| 332 | global changeIds |
| 333 | global filePrefixes |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 334 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 335 | groupIndex = groupNameIndexes[consumerGroup] |
| 336 | print("Setting groupIndex: " + str(groupIndex)) |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 337 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 338 | 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])) |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 349 | |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 350 | if (runningState == "Stopped"): |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 351 | ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 352 | return buildOkResponse("[]") |
| 353 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 354 | |
| 355 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 356 | if args.tc100: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 357 | return tc100(groupIndex, changeId, filePrefix, "sftp", "1MB") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 358 | elif args.tc101: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 359 | return tc100(groupIndex, changeId, filePrefix, "sftp", "5MB") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 360 | elif args.tc102: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 361 | return tc100(groupIndex, changeId, filePrefix, "sftp", "50MB") |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 362 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 363 | elif args.tc110: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 364 | return tc110(groupIndex, changeId, filePrefix, "sftp") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 365 | elif args.tc111: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 366 | return tc111(groupIndex, changeId, filePrefix, "sftp") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 367 | elif args.tc112: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 368 | return tc112(groupIndex, changeId, filePrefix, "sftp") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 369 | elif args.tc113: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 370 | return tc113(groupIndex, changeId, filePrefix, "sftp") |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 371 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 372 | elif args.tc120: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 373 | return tc120(groupIndex, changeId, filePrefix, "sftp") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 374 | elif args.tc121: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 375 | return tc121(groupIndex, changeId, filePrefix, "sftp") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 376 | elif args.tc122: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 377 | return tc122(groupIndex, changeId, filePrefix, "sftp") |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 378 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 379 | elif args.tc1000: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 380 | return tc1000(groupIndex, changeId, filePrefix, "sftp") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 381 | elif args.tc1001: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 382 | return tc1001(groupIndex, changeId, filePrefix, "sftp") |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 383 | |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 384 | elif args.tc1100: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 385 | return tc1100(groupIndex, changeId, filePrefix, "sftp","1MB") |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 386 | elif args.tc1101: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 387 | return tc1100(groupIndex, changeId, filePrefix, "sftp","50MB") |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 388 | elif args.tc1102: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 389 | return tc1100(groupIndex, changeId, filePrefix, "sftp","50MB") |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 390 | elif args.tc1200: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 391 | return tc1200(groupIndex, changeId, filePrefix, "sftp","1MB") |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 392 | elif args.tc1201: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 393 | return tc1200(groupIndex, changeId, filePrefix, "sftp","5MB") |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 394 | elif args.tc1202: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 395 | return tc1200(groupIndex, changeId, filePrefix, "sftp","50MB") |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 396 | elif args.tc1300: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 397 | return tc1300(groupIndex, changeId, filePrefix, "sftp","1MB") |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 398 | elif args.tc1301: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 399 | return tc1300(groupIndex, changeId, filePrefix, "sftp","5MB") |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 400 | elif args.tc1302: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 401 | return tc1300(groupIndex, changeId, filePrefix, "sftp","50MB") |
| 402 | |
| 403 | elif args.tc1500: |
| 404 | return tc1500(groupIndex, changeId, filePrefix, "sftp","1MB") |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 405 | |
| 406 | elif args.tc500: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 407 | return tc500(groupIndex, changeId, filePrefix, "sftp","1MB") |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 408 | elif args.tc501: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 409 | return tc500(groupIndex, changeId, filePrefix, "sftp","5MB") |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 410 | elif args.tc502: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 411 | return tc500(groupIndex, changeId, filePrefix, "sftp","50MB") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 412 | elif args.tc510: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 413 | return tc510(groupIndex, changeId, filePrefix, "sftp", "1MB") |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 414 | elif args.tc511: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 415 | return tc511(groupIndex, changeId, filePrefix, "sftp", "1KB") |
| 416 | |
| 417 | elif args.tc550: |
| 418 | return tc510(groupIndex, changeId, filePrefix, "sftp", "50MB") |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 419 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 420 | elif args.tc710: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 421 | return tc710(groupIndex, changeId, filePrefix, "sftp") |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 422 | |
| 423 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 424 | elif args.tc200: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 425 | return tc100(groupIndex, changeId, filePrefix, "ftps", "1MB") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 426 | elif args.tc201: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 427 | return tc100(groupIndex, changeId, filePrefix, "ftps", "5MB") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 428 | elif args.tc202: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 429 | return tc100(groupIndex, changeId, filePrefix, "ftps", "50MB") |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 430 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 431 | elif args.tc210: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 432 | return tc110(groupIndex, changeId, filePrefix, "ftps") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 433 | elif args.tc211: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 434 | return tc111(groupIndex, changeId, filePrefix, "ftps") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 435 | elif args.tc212: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 436 | return tc112(groupIndex, changeId, filePrefix, "ftps") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 437 | elif args.tc213: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 438 | return tc113(groupIndex, changeId, filePrefix, "ftps") |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 439 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 440 | elif args.tc220: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 441 | return tc120(groupIndex, changeId, filePrefix, "ftps") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 442 | elif args.tc221: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 443 | return tc121(groupIndex, changeId, filePrefix, "ftps") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 444 | elif args.tc222: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 445 | return tc122(groupIndex, changeId, filePrefix, "ftps") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 446 | |
| 447 | elif args.tc2000: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 448 | return tc1000(groupIndex, changeId, filePrefix, "ftps") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 449 | elif args.tc2001: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 450 | return tc1001(groupIndex, changeId, filePrefix, "ftps") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 451 | |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 452 | elif args.tc2100: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 453 | return tc1100(groupIndex, changeId, filePrefix, "ftps","1MB") |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 454 | elif args.tc2101: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 455 | return tc1100(groupIndex, changeId, filePrefix, "ftps","50MB") |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 456 | elif args.tc2102: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 457 | return tc1100(groupIndex, changeId, filePrefix, "ftps","50MB") |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 458 | elif args.tc2200: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 459 | return tc1200(groupIndex, changeId, filePrefix, "ftps","1MB") |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 460 | elif args.tc2201: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 461 | return tc1200(groupIndex, changeId, filePrefix, "ftps","5MB") |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 462 | elif args.tc2202: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 463 | return tc1200(groupIndex, changeId, filePrefix, "ftps","50MB") |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 464 | elif args.tc2300: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 465 | return tc1300(groupIndex, changeId, filePrefix, "ftps","1MB") |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 466 | elif args.tc2301: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 467 | return tc1300(groupIndex, changeId, filePrefix, "ftps","5MB") |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 468 | elif args.tc2302: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 469 | return tc1300(groupIndex, changeId, filePrefix, "ftps","50MB") |
| 470 | |
| 471 | elif args.tc2500: |
| 472 | return tc1500(groupIndex, changeId, filePrefix, "ftps","1MB") |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 473 | |
| 474 | elif args.tc600: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 475 | return tc500(groupIndex, changeId, filePrefix, "ftps","1MB") |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 476 | elif args.tc601: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 477 | return tc500(groupIndex, changeId, filePrefix, "ftps","5MB") |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 478 | elif args.tc602: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 479 | return tc500(groupIndex, changeId, filePrefix, "ftps","50MB") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 480 | elif args.tc610: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 481 | return tc510(groupIndex, changeId, filePrefix, "ftps", "1MB") |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 482 | elif args.tc611: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 483 | return tc511(groupIndex, changeId, filePrefix, "ftps", "1KB") |
| 484 | elif args.tc650: |
| 485 | return tc510(groupIndex, changeId, filePrefix, "ftps", "50MB") |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 486 | elif args.tc810: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 487 | return tc710(groupIndex, changeId, filePrefix, "ftps") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 488 | |
| 489 | |
| 490 | #### Test case functions |
| 491 | |
| 492 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 493 | def tc100(groupIndex, changeId, filePrefix, ftpType, fileSize): |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 494 | global ctr_responses |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 495 | global ctr_events |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 496 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 497 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 498 | ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 |
| 499 | |
| 500 | if (ctr_responses[groupIndex] > 1): |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 501 | return buildOkResponse("[]") |
| 502 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 503 | 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 |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 510 | return buildOkResponse("["+msg+"]") |
| 511 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 512 | #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 | |
| 546 | def tc110(groupIndex, changeId, filePrefix, ftpType): |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 547 | global ctr_responses |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 548 | global ctr_events |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 549 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 550 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 551 | ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 |
| 552 | |
| 553 | if (ctr_responses[groupIndex] > 100): |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 554 | return buildOkResponse("[]") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 555 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 556 | 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 |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 563 | return buildOkResponse("["+msg+"]") |
| 564 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 565 | def tc111(groupIndex, changeId, filePrefix, ftpType): |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 566 | global ctr_responses |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 567 | global ctr_events |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 568 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 569 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 570 | ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 |
| 571 | |
| 572 | if (ctr_responses[groupIndex] > 100): |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 573 | return buildOkResponse("[]") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 574 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 575 | nodeIndex=0 |
| 576 | nodeName = createNodeName(nodeIndex) |
| 577 | msg = getEventHead(groupIndex, changeId, nodeName) |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 578 | |
| 579 | for i in range(100): |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 580 | seqNr = i+(ctr_responses[groupIndex]-1) |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 581 | if i != 0: msg = msg + "," |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 582 | fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, "1MB") |
| 583 | msg = msg + getEventName(fileName,ftpType,"onap","pano",nodeIndex) |
| 584 | fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 585 | |
| 586 | msg = msg + getEventEnd() |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 587 | ctr_events[groupIndex] = ctr_events[groupIndex]+1 |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 588 | |
| 589 | return buildOkResponse("["+msg+"]") |
| 590 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 591 | def tc112(groupIndex, changeId, filePrefix, ftpType): |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 592 | global ctr_responses |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 593 | global ctr_events |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 594 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 595 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 596 | ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 |
| 597 | |
| 598 | if (ctr_responses[groupIndex] > 100): |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 599 | return buildOkResponse("[]") |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 600 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 601 | nodeIndex=0 |
| 602 | nodeName = createNodeName(nodeIndex) |
| 603 | msg = getEventHead(groupIndex, changeId, nodeName) |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 604 | |
| 605 | for i in range(100): |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 606 | seqNr = i+(ctr_responses[groupIndex]-1) |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 607 | if i != 0: msg = msg + "," |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 608 | fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, "5MB") |
| 609 | msg = msg + getEventName(fileName,ftpType,"onap","pano",nodeIndex) |
| 610 | fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 611 | |
| 612 | msg = msg + getEventEnd() |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 613 | ctr_events[groupIndex] = ctr_events[groupIndex]+1 |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 614 | |
| 615 | return buildOkResponse("["+msg+"]") |
| 616 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 617 | def tc113(groupIndex, changeId, filePrefix, ftpType): |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 618 | global ctr_responses |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 619 | global ctr_events |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 620 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 621 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 622 | ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 |
| 623 | |
| 624 | if (ctr_responses[groupIndex] > 1): |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 625 | return buildOkResponse("[]") |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 626 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 627 | nodeIndex=0 |
| 628 | nodeName = createNodeName(nodeIndex) |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 629 | msg = "" |
| 630 | |
| 631 | for evts in range(100): # build 100 evts |
| 632 | if (evts > 0): |
| 633 | msg = msg + "," |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 634 | msg = msg + getEventHead(groupIndex, changeId, nodeName) |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 635 | for i in range(100): # build 100 files |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 636 | seqNr = i+evts+100*(ctr_responses[groupIndex]-1) |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 637 | if i != 0: msg = msg + "," |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 638 | fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, "1MB") |
| 639 | msg = msg + getEventName(fileName,ftpType,"onap","pano",nodeIndex) |
| 640 | fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 641 | |
| 642 | msg = msg + getEventEnd() |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 643 | ctr_events[groupIndex] = ctr_events[groupIndex]+1 |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 644 | |
| 645 | return buildOkResponse("["+msg+"]") |
| 646 | |
| 647 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 648 | def tc120(groupIndex, changeId, filePrefix, ftpType): |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 649 | global ctr_responses |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 650 | global ctr_events |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 651 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 652 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 653 | ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 654 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 655 | nodeIndex=0 |
| 656 | nodeName = createNodeName(nodeIndex) |
| 657 | |
| 658 | if (ctr_responses[groupIndex] > 100): |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 659 | return buildOkResponse("[]") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 660 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 661 | if (ctr_responses[groupIndex] % 10 == 2): |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 662 | return # Return nothing |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 663 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 664 | if (ctr_responses[groupIndex] % 10 == 3): |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 665 | return buildOkResponse("") # Return empty message |
| 666 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 667 | if (ctr_responses[groupIndex] % 10 == 4): |
| 668 | return buildOkResponse(getEventHead(groupIndex, changeId, nodeName)) # Return part of a json event |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 669 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 670 | if (ctr_responses[groupIndex] % 10 == 5): |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 671 | return buildEmptyResponse(404) # Return empty message with status code |
| 672 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 673 | if (ctr_responses[groupIndex] % 10 == 6): |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 674 | sleep(60) |
| 675 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 676 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 677 | msg = getEventHead(groupIndex, changeId, nodeName) |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 678 | |
| 679 | for i in range(100): |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 680 | seqNr = i+(ctr_responses[groupIndex]-1) |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 681 | if i != 0: msg = msg + "," |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 682 | fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, "1MB") |
| 683 | msg = msg + getEventName(fileName,ftpType,"onap","pano",nodeIndex) |
| 684 | fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 685 | |
| 686 | msg = msg + getEventEnd() |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 687 | ctr_events[groupIndex] = ctr_events[groupIndex]+1 |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 688 | |
| 689 | return buildOkResponse("["+msg+"]") |
| 690 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 691 | def tc121(groupIndex, changeId, filePrefix, ftpType): |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 692 | global ctr_responses |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 693 | global ctr_events |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 694 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 695 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 696 | ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 |
| 697 | |
| 698 | if (ctr_responses[groupIndex] > 100): |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 699 | return buildOkResponse("[]") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 700 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 701 | nodeIndex=0 |
| 702 | nodeName = createNodeName(nodeIndex) |
| 703 | msg = getEventHead(groupIndex, changeId, nodeName) |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 704 | |
| 705 | fileName = "" |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 706 | for i in range(100): |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 707 | seqNr = i+(ctr_responses[groupIndex]-1) |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 708 | if (seqNr%10 == 0): # Every 10th file is "missing" |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 709 | fileName = createMissingFileName(groupIndex, filePrefix, nodeName, seqNr, "1MB") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 710 | else: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 711 | fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, "1MB") |
| 712 | fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 713 | |
| 714 | if i != 0: msg = msg + "," |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 715 | msg = msg + getEventName(fileName,ftpType,"onap","pano",nodeIndex) |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 716 | |
| 717 | msg = msg + getEventEnd() |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 718 | ctr_events[groupIndex] = ctr_events[groupIndex]+1 |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 719 | |
| 720 | return buildOkResponse("["+msg+"]") |
| 721 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 722 | def tc122(groupIndex, changeId, filePrefix, ftpType): |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 723 | global ctr_responses |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 724 | global ctr_events |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 725 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 726 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 727 | ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 |
| 728 | |
| 729 | if (ctr_responses[groupIndex] > 100): |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 730 | return buildOkResponse("[]") |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 731 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 732 | nodeIndex=0 |
| 733 | nodeName = createNodeName(nodeIndex) |
| 734 | msg = getEventHead(groupIndex, changeId, nodeName) |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 735 | |
| 736 | for i in range(100): |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 737 | fileName = createFileName(groupIndex, filePrefix, nodeName, 0, "1MB") # All files identical names |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 738 | if i != 0: msg = msg + "," |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 739 | msg = msg + getEventName(fileName,ftpType,"onap","pano", nodeIndex) |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 740 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 741 | fileMap[groupIndex][0] = 0 |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 742 | msg = msg + getEventEnd() |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 743 | ctr_events[groupIndex] = ctr_events[groupIndex]+1 |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 744 | |
| 745 | return buildOkResponse("["+msg+"]") |
| 746 | |
| 747 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 748 | def tc1000(groupIndex, changeId, filePrefix, ftpType): |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 749 | global ctr_responses |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 750 | global ctr_events |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 751 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 752 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 753 | ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 |
| 754 | |
| 755 | nodeIndex=0 |
| 756 | nodeName = createNodeName(nodeIndex) |
| 757 | msg = getEventHead(groupIndex, changeId, nodeName) |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 758 | |
| 759 | for i in range(100): |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 760 | seqNr = i+(ctr_responses[groupIndex]-1) |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 761 | if i != 0: msg = msg + "," |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 762 | fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, "1MB") |
| 763 | msg = msg + getEventName(fileName,ftpType,"onap","pano",nodeIndex) |
| 764 | fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 765 | |
| 766 | msg = msg + getEventEnd() |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 767 | ctr_events[groupIndex] = ctr_events[groupIndex]+1 |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 768 | |
| 769 | return buildOkResponse("["+msg+"]") |
| 770 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 771 | def tc1001(groupIndex, changeId, filePrefix, ftpType): |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 772 | global ctr_responses |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 773 | global ctr_events |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 774 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 775 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 776 | ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 |
| 777 | |
| 778 | nodeIndex=0 |
| 779 | nodeName = createNodeName(nodeIndex) |
| 780 | msg = getEventHead(groupIndex, changeId, nodeName) |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 781 | |
| 782 | for i in range(100): |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 783 | seqNr = i+(ctr_responses[groupIndex]-1) |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 784 | if i != 0: msg = msg + "," |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 785 | fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, "5MB") |
| 786 | msg = msg + getEventName(fileName,ftpType,"onap","pano",nodeIndex) |
| 787 | fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 788 | |
| 789 | msg = msg + getEventEnd() |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 790 | ctr_events[groupIndex] = ctr_events[groupIndex]+1 |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 791 | |
| 792 | return buildOkResponse("["+msg+"]") |
| 793 | |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 794 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 795 | def tc1100(groupIndex, changeId, filePrefix, ftpType, filesize): |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 796 | global ctr_responses |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 797 | global ctr_events |
| 798 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 799 | |
| 800 | ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 801 | |
| 802 | msg = "" |
| 803 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 804 | batch = (ctr_responses[groupIndex]-1)%20; |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 805 | |
| 806 | for pnfs in range(35): # build events for 35 PNFs at a time. 20 batches -> 700 |
| 807 | if (pnfs > 0): |
| 808 | msg = msg + "," |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 809 | nodeIndex=pnfs + batch*35 |
| 810 | nodeName = createNodeName(nodeIndex) |
| 811 | msg = msg + getEventHead(groupIndex, changeId, nodeName) |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 812 | |
| 813 | for i in range(100): # 100 files per event |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 814 | seqNr = i + int((ctr_responses[groupIndex]-1)/20); |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 815 | if i != 0: msg = msg + "," |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 816 | fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, filesize) |
| 817 | msg = msg + getEventName(fileName,ftpType,"onap","pano",nodeIndex) |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 818 | seqNr = seqNr + (pnfs+batch*35)*1000000 #Create unique id for this node and file |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 819 | fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 820 | |
| 821 | msg = msg + getEventEnd() |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 822 | ctr_events[groupIndex] = ctr_events[groupIndex]+1 |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 823 | |
| 824 | return buildOkResponse("["+msg+"]") |
| 825 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 826 | def tc1200(groupIndex, changeId, filePrefix, ftpType, filesize): |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 827 | global ctr_responses |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 828 | global ctr_events |
| 829 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 830 | |
| 831 | ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 832 | |
| 833 | msg = "" |
| 834 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 835 | batch = (ctr_responses[groupIndex]-1)%20; |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 836 | |
| 837 | for pnfs in range(35): # build events for 35 PNFs at a time. 20 batches -> 700 |
| 838 | if (pnfs > 0): |
| 839 | msg = msg + "," |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 840 | nodeIndex=pnfs + batch*35 |
| 841 | nodeName = createNodeName(nodeIndex) |
| 842 | msg = msg + getEventHead(groupIndex, changeId, nodeName) |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 843 | |
| 844 | for i in range(100): # 100 files per event, all new files |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 845 | seqNr = i+100 * int((ctr_responses[groupIndex]-1)/20); |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 846 | if i != 0: msg = msg + "," |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 847 | fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, filesize) |
| 848 | msg = msg + getEventName(fileName,ftpType,"onap","pano",nodeIndex) |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 849 | seqNr = seqNr + (pnfs+batch*35)*1000000 #Create unique id for this node and file |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 850 | fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 851 | |
| 852 | msg = msg + getEventEnd() |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 853 | ctr_events[groupIndex] = ctr_events[groupIndex]+1 |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 854 | |
| 855 | return buildOkResponse("["+msg+"]") |
| 856 | |
| 857 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 858 | def tc1300(groupIndex, changeId, filePrefix, ftpType, filesize): |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 859 | global ctr_responses |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 860 | global ctr_events |
| 861 | global rop_counter |
| 862 | global rop_timestamp |
| 863 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 864 | if (rop_counter == 0): |
| 865 | rop_timestamp = time.time() |
| 866 | |
| 867 | ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 868 | |
| 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: |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 874 | 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 | |
| 903 | def 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: |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 951 | 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 + "," |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 963 | nodeIndex=pnfs + batch*35 |
| 964 | nodeName = createNodeName(nodeIndex) |
| 965 | msg = msg + getEventHead(groupIndex, changeId, nodeName) |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 966 | |
| 967 | for i in range(100): # 100 files per event |
| 968 | seqNr = i + int((rop_counter-1)/20); |
| 969 | if i != 0: msg = msg + "," |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 970 | fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, filesize) |
| 971 | msg = msg + getEventName(fileName,ftpType,"onap","pano", nodeIndex) |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 972 | seqNr = seqNr + (pnfs+batch*35)*1000000 #Create unique id for this node and file |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 973 | fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 974 | |
| 975 | msg = msg + getEventEnd() |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 976 | ctr_events[groupIndex] = ctr_events[groupIndex]+1 |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 977 | |
| 978 | return buildOkResponse("["+msg+"]") |
| 979 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 980 | def tc500(groupIndex, changeId, filePrefix, ftpType, filesize): |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 981 | global ctr_responses |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 982 | global ctr_events |
| 983 | |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 984 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 985 | ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 |
| 986 | |
| 987 | if (ctr_responses[groupIndex] > 1): |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 988 | return buildOkResponse("[]") |
| 989 | |
| 990 | msg = "" |
| 991 | |
| 992 | |
| 993 | for pnfs in range(700): |
| 994 | if (pnfs > 0): |
| 995 | msg = msg + "," |
| 996 | nodeName = createNodeName(pnfs) |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 997 | msg = msg + getEventHead(groupIndex, changeId, nodeName) |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 998 | |
| 999 | for i in range(2): |
| 1000 | seqNr = i; |
| 1001 | if i != 0: msg = msg + "," |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1002 | fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, filesize) |
| 1003 | msg = msg + getEventName(fileName,ftpType,"onap","pano",pnfs) |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1004 | seqNr = seqNr + pnfs*1000000 #Create unique id for this node and file |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1005 | fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1006 | |
| 1007 | msg = msg + getEventEnd() |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1008 | ctr_events[groupIndex] = ctr_events[groupIndex]+1 |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1009 | |
| 1010 | return buildOkResponse("["+msg+"]") |
| 1011 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1012 | def tc510(groupIndex, changeId, filePrefix, ftpType, fileSize): |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1013 | global ctr_responses |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1014 | global ctr_events |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1015 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1016 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1017 | ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 |
| 1018 | |
| 1019 | if (ctr_responses[groupIndex] > 5): |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1020 | return buildOkResponse("[]") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1021 | |
| 1022 | msg = "" |
| 1023 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1024 | for pnfs in range(700): # build events for 700 MEs |
| 1025 | if (pnfs > 0): |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1026 | msg = msg + "," |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1027 | nodeName = createNodeName(pnfs) |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1028 | 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) |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1032 | seqNr = seqNr + pnfs*1000000 #Create unique id for this node and file |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1033 | fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1034 | msg = msg + getEventEnd() |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1035 | ctr_events[groupIndex] = ctr_events[groupIndex]+1 |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1036 | |
| 1037 | return buildOkResponse("["+msg+"]") |
| 1038 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1039 | def tc511(groupIndex, changeId, filePrefix, ftpType, fileSize): |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1040 | global ctr_responses |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1041 | global ctr_events |
| 1042 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1043 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1044 | ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 |
| 1045 | |
| 1046 | if (ctr_responses[groupIndex] > 5): |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1047 | return buildOkResponse("[]") |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1048 | |
| 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) |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1055 | 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) |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1059 | seqNr = seqNr + pnfs*1000000 #Create unique id for this node and file |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1060 | fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1061 | msg = msg + getEventEnd() |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1062 | ctr_events[groupIndex] = ctr_events[groupIndex]+1 |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1063 | |
| 1064 | return buildOkResponse("["+msg+"]") |
| 1065 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1066 | def tc710(groupIndex, changeId, filePrefix, ftpType): |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1067 | global ctr_responses |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1068 | global ctr_events |
| 1069 | |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1070 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1071 | ctr_responses[groupIndex] = ctr_responses[groupIndex] + 1 |
| 1072 | |
| 1073 | if (ctr_responses[groupIndex] > 100): |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1074 | return buildOkResponse("[]") |
| 1075 | |
| 1076 | msg = "" |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1077 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1078 | batch = (ctr_responses[groupIndex]-1)%20; |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1079 | |
| 1080 | for pnfs in range(35): # build events for 35 PNFs at a time. 20 batches -> 700 |
| 1081 | if (pnfs > 0): |
| 1082 | msg = msg + "," |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1083 | nodeIndex=pnfs + batch*35 |
| 1084 | nodeName = createNodeName(nodeIndex) |
| 1085 | msg = msg + getEventHead(groupIndex, changeId, nodeName) |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1086 | |
| 1087 | for i in range(100): # 100 files per event |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1088 | seqNr = i + int((ctr_responses[groupIndex]-1)/20); |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1089 | if i != 0: msg = msg + "," |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1090 | fileName = createFileName(groupIndex, filePrefix, nodeName, seqNr, "1MB") |
| 1091 | msg = msg + getEventName(fileName,ftpType,"onap","pano",nodeIndex) |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1092 | seqNr = seqNr + (pnfs+batch*35)*1000000 #Create unique id for this node and file |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1093 | fileMap[groupIndex][seqNr*hash(filePrefix)] = seqNr |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1094 | |
| 1095 | msg = msg + getEventEnd() |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1096 | ctr_events[groupIndex] = ctr_events[groupIndex]+1 |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1097 | |
| 1098 | return buildOkResponse("["+msg+"]") |
| 1099 | |
| 1100 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1101 | #### Functions to build json messages and respones #### |
| 1102 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1103 | def createNodeName(index): |
| 1104 | return "PNF"+str(index); |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1105 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1106 | def createFileName(groupIndex, filePrefix, nodeName, index, size): |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1107 | global ctr_files |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1108 | ctr_files[groupIndex] = ctr_files[groupIndex] + 1 |
| 1109 | return filePrefix+"20000626.2315+0200-2330+0200_" + nodeName + "-" + str(index) + "-" +size + ".tar.gz"; |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1110 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1111 | def createMissingFileName(groupIndex, filePrefix, nodeName, index, size): |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1112 | global ctr_files |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1113 | ctr_files[groupIndex] = ctr_files[groupIndex] + 1 |
| 1114 | return filePrefix+"MissingFile_" + nodeName + "-" + str(index) + "-" +size + ".tar.gz"; |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1115 | |
| 1116 | |
| 1117 | # Function to build fixed beginning of an event |
| 1118 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1119 | def getEventHead(groupIndex, changeId, nodename): |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1120 | global pnfMap |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1121 | pnfMap[groupIndex].add(nodename) |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1122 | headStr = """ |
| 1123 | { |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 1124 | "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", |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1134 | "reportingEntityName": \"""" + nodename + """", |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 1135 | "sequence": 0, |
| 1136 | "domain": "notification", |
| 1137 | "lastEpochMicrosec": 8745745764578, |
| 1138 | "eventName": "Noti_RnNode-Ericsson_FileReady", |
| 1139 | "vesEventListenerVersion": "7.0.1", |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1140 | "sourceName": \"""" + nodename + """" |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 1141 | }, |
| 1142 | "notificationFields": { |
| 1143 | "notificationFieldsVersion": "2.0", |
| 1144 | "changeType": "FileReady", |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1145 | "changeIdentifier": \"""" + changeId + """", |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 1146 | "arrayOfNamedHashMap": [ |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1147 | """ |
| 1148 | return headStr |
| 1149 | |
| 1150 | # Function to build the variable part of an event |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1151 | def getEventName(fn,type,user,passwd, nodeIndex): |
| 1152 | nodeIndex=nodeIndex%num_ftp_servers |
| 1153 | port = sftp_ports[nodeIndex] |
| 1154 | ip = sftp_hosts[nodeIndex] |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1155 | if (type == "ftps"): |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1156 | port = ftps_ports[nodeIndex] |
| 1157 | ip = ftps_hosts[nodeIndex] |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1158 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1159 | nameStr = """{ |
| 1160 | "name": \"""" + fn + """", |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 1161 | "hashMap": { |
| 1162 | "fileFormatType": "org.3GPP.32.435#measCollec", |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1163 | "location": \"""" + type + """://""" + user + """:""" + passwd + """@""" + ip + """:""" + str(port) + """/""" + fn + """", |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 1164 | "fileFormatVersion": "V10", |
| 1165 | "compression": "gzip" |
| 1166 | } |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1167 | } """ |
| 1168 | return nameStr |
| 1169 | |
| 1170 | # Function to build fixed end of an event |
| 1171 | def getEventEnd(): |
| 1172 | endStr = """ |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 1173 | ] |
| 1174 | } |
| 1175 | } |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1176 | } |
| 1177 | """ |
| 1178 | return endStr |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 1179 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1180 | # Function to build an OK reponse from a message string |
| 1181 | def buildOkResponse(msg): |
| 1182 | response = app.response_class( |
| 1183 | response=str.encode(msg), |
| 1184 | status=200, |
| 1185 | mimetype='application/json') |
| 1186 | return response |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 1187 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1188 | # Function to build an empty message with status |
| 1189 | def buildEmptyResponse(status_code): |
| 1190 | response = app.response_class( |
| 1191 | response=str.encode(""), |
| 1192 | status=status_code, |
| 1193 | mimetype='application/json') |
| 1194 | return response |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 1195 | |
| 1196 | |
| 1197 | if __name__ == "__main__": |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1198 | |
| 1199 | # IP addresses to use for ftp servers, using localhost if not env var is set |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1200 | 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) |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1234 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1235 | #Counters |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1236 | ctr_responses = [] |
| 1237 | ctr_requests = [] |
| 1238 | ctr_files=[] |
| 1239 | ctr_events = [] |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1240 | startTime = time.time() |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1241 | firstPollTime = [] |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1242 | runningState = "Started" |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1243 | #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 |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1248 | rop_counter = 0 |
| 1249 | rop_timestamp = time.time() |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1250 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1251 | #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 = {} |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1263 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1264 | 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] |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1296 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1297 | tc_num = "Not set" |
| 1298 | tc_help = "Not set" |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 1299 | |
| 1300 | parser = argparse.ArgumentParser() |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1301 | |
| 1302 | #SFTP TCs with single ME |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 1303 | parser.add_argument( |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1304 | '--tc100', |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 1305 | action='store_true', |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1306 | help='TC100 - One ME, SFTP, 1 1MB file, 1 event') |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 1307 | parser.add_argument( |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1308 | '--tc101', |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 1309 | action='store_true', |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1310 | help='TC101 - One ME, SFTP, 1 5MB file, 1 event') |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 1311 | parser.add_argument( |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1312 | '--tc102', |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 1313 | action='store_true', |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1314 | help='TC102 - One ME, SFTP, 1 50MB file, 1 event') |
| 1315 | |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 1316 | parser.add_argument( |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1317 | '--tc110', |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 1318 | action='store_true', |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1319 | 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( |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1357 | '--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( |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1372 | '--tc510', |
| 1373 | action='store_true', |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1374 | help='TC510 - 700 MEs, SFTP, 1MB files, 1 file per event, 3500 events, 700 event per poll.') |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1375 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1376 | 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.') |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1380 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1381 | parser.add_argument( |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1382 | '--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( |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1387 | '--tc710', |
| 1388 | action='store_true', |
| 1389 | help='TC710 - 700 MEs, SFTP, 1MB files, 100 files per event, 3500 events, 35 event per poll.') |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1390 | |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1391 | 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 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1430 | 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') |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1434 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1435 | # 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', |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1486 | 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( |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1529 | '--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( |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1534 | '--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.') |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1547 | |
| 1548 | parser.add_argument( |
| 1549 | '--tc610', |
| 1550 | action='store_true', |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1551 | 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( |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1559 | '--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( |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1564 | '--tc810', |
| 1565 | action='store_true', |
| 1566 | help='TC810 - 700 MEs, FTPS, 1MB files, 100 files per event, 3500 events, 35 event per poll.') |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 1567 | |
| 1568 | args = parser.parse_args() |
| 1569 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1570 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1571 | |
| 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 | |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1600 | 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 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1619 | elif args.tc1500: |
| 1620 | tc_num = "TC# 1500" |
| 1621 | |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1622 | 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" |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1628 | elif args.tc510: |
| 1629 | tc_num = "TC# 510" |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1630 | elif args.tc511: |
| 1631 | tc_num = "TC# 511" |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1632 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1633 | elif args.tc550: |
| 1634 | tc_num = "TC# 550" |
| 1635 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1636 | elif args.tc710: |
| 1637 | tc_num = "TC# 710" |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1638 | |
| 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 | |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1667 | 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" |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1685 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1686 | elif args.tc2500: |
| 1687 | tc_num = "TC# 2500" |
| 1688 | |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1689 | 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" |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1695 | elif args.tc610: |
| 1696 | tc_num = "TC# 610" |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1697 | elif args.tc611: |
| 1698 | tc_num = "TC# 611" |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1699 | elif args.tc650: |
| 1700 | tc_num = "TC# 650" |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1701 | elif args.tc810: |
| 1702 | tc_num = "TC# 810" |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 1703 | |
| 1704 | else: |
| 1705 | print("No TC was defined") |
| 1706 | print("use --help for usage info") |
| 1707 | sys.exit() |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1708 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1709 | print("TC num: " + tc_num) |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1710 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1711 | 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.") |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1718 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1719 | app.run(port=HOST_PORT, host=HOST_IP) |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1720 | |