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=[] |
TamasBakai | fa357df | 2019-08-15 08:25:27 +0000 | [diff] [blame^] | 21 | num_ftp_servers=1 |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 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') |
TamasBakai | fa357df | 2019-08-15 08:25:27 +0000 | [diff] [blame^] | 1221 | print("Groups detected: " + groups ) |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1222 | configuredPrefixes = os.environ.get('MR_FILE_PREFIX_MAPPING', 'PM_MEAS_FILES:A') |
| 1223 | |
| 1224 | if (len(groups) == 0 ): |
| 1225 | groups='OpenDcae-c12:PM_MEAS_FILES' |
| 1226 | print("Using default group: " + groups) |
| 1227 | else: |
| 1228 | print("Configured groups: " + groups) |
| 1229 | |
| 1230 | if (len(configuredPrefixes) == 0 ): |
| 1231 | configuredPrefixes='PM_MEAS_FILES:A' |
| 1232 | print("Using default changeid to file prefix mapping: " + configuredPrefixes) |
| 1233 | else: |
| 1234 | print("Configured changeid to file prefix mapping: " + configuredPrefixes) |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1235 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1236 | #Counters |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1237 | ctr_responses = [] |
| 1238 | ctr_requests = [] |
| 1239 | ctr_files=[] |
| 1240 | ctr_events = [] |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1241 | startTime = time.time() |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1242 | firstPollTime = [] |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1243 | runningState = "Started" |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1244 | #Keeps all responded file names |
| 1245 | fileMap = [] |
| 1246 | #Keeps all responded PNF names |
| 1247 | pnfMap = [] |
| 1248 | #Handles rop periods for tests that deliveres events every 15 min |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1249 | rop_counter = 0 |
| 1250 | rop_timestamp = time.time() |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1251 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1252 | #List of configured group names |
| 1253 | groupNames = [] |
| 1254 | #Mapping between group name and index in groupNames |
| 1255 | groupNameIndexes = {} |
| 1256 | #String of configured groups |
| 1257 | configuredGroups = "" |
| 1258 | #String of configured change identifiers |
| 1259 | configuredChangeIds = "" |
| 1260 | #List of changed identifiers |
| 1261 | changeIds = [] |
| 1262 | #List of filePrefixes |
| 1263 | filePrefixes = {} |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1264 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1265 | tmp=groups.split(',') |
| 1266 | for i in range(len(tmp)): |
| 1267 | g=tmp[i].split(':') |
| 1268 | for j in range(len(g)): |
| 1269 | g[j] = g[j].strip() |
| 1270 | if (j == 0): |
| 1271 | if (len(configuredGroups) > 0): |
| 1272 | configuredGroups=configuredGroups+"," |
| 1273 | configuredGroups=configuredGroups+g[0] |
| 1274 | groupNames.append(g[0]) |
| 1275 | groupNameIndexes[g[0]] = i |
| 1276 | changeIds.append({}) |
| 1277 | ctr_responses.append(0) |
| 1278 | ctr_requests.append(0) |
| 1279 | ctr_files.append(0) |
| 1280 | ctr_events.append(0) |
| 1281 | firstPollTime.append(0) |
| 1282 | pnfMap.append(set()) |
| 1283 | fileMap.append({}) |
| 1284 | if (len(configuredChangeIds) > 0): |
| 1285 | configuredChangeIds=configuredChangeIds+"," |
| 1286 | else: |
| 1287 | changeIds[i][j-1]=g[j] |
| 1288 | if (j > 1): |
| 1289 | configuredChangeIds=configuredChangeIds+":" |
| 1290 | configuredChangeIds=configuredChangeIds+g[j] |
| 1291 | |
| 1292 | # Create a map between changeid and file name prefix |
| 1293 | tmp=configuredPrefixes.split(',') |
| 1294 | for i in range(len(tmp)): |
| 1295 | p=tmp[i].split(':') |
| 1296 | filePrefixes[p[0]] = p[1] |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1297 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1298 | tc_num = "Not set" |
| 1299 | tc_help = "Not set" |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 1300 | |
| 1301 | parser = argparse.ArgumentParser() |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1302 | |
| 1303 | #SFTP TCs with single ME |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 1304 | parser.add_argument( |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1305 | '--tc100', |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 1306 | action='store_true', |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1307 | help='TC100 - One ME, SFTP, 1 1MB file, 1 event') |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 1308 | parser.add_argument( |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1309 | '--tc101', |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 1310 | action='store_true', |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1311 | help='TC101 - One ME, SFTP, 1 5MB file, 1 event') |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 1312 | parser.add_argument( |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1313 | '--tc102', |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 1314 | action='store_true', |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1315 | help='TC102 - One ME, SFTP, 1 50MB file, 1 event') |
| 1316 | |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 1317 | parser.add_argument( |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1318 | '--tc110', |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 1319 | action='store_true', |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1320 | help='TC110 - One ME, SFTP, 1MB files, 1 file per event, 100 events, 1 event per poll.') |
| 1321 | parser.add_argument( |
| 1322 | '--tc111', |
| 1323 | action='store_true', |
| 1324 | help='TC111 - One ME, SFTP, 1MB files, 100 files per event, 100 events, 1 event per poll.') |
| 1325 | parser.add_argument( |
| 1326 | '--tc112', |
| 1327 | action='store_true', |
| 1328 | help='TC112 - One ME, SFTP, 5MB files, 100 files per event, 100 events, 1 event per poll.') |
| 1329 | parser.add_argument( |
| 1330 | '--tc113', |
| 1331 | action='store_true', |
| 1332 | help='TC113 - One ME, SFTP, 1MB files, 100 files per event, 100 events. All events in one poll.') |
| 1333 | |
| 1334 | parser.add_argument( |
| 1335 | '--tc120', |
| 1336 | action='store_true', |
| 1337 | 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') |
| 1338 | parser.add_argument( |
| 1339 | '--tc121', |
| 1340 | action='store_true', |
| 1341 | help='TC121 - One ME, SFTP, 1MB files, 100 files per event, 100 events, 1 event per poll. 10% missing files') |
| 1342 | parser.add_argument( |
| 1343 | '--tc122', |
| 1344 | action='store_true', |
| 1345 | help='TC122 - One ME, SFTP, 1MB files, 100 files per event, 100 events. 1 event per poll. All files with identical name. ') |
| 1346 | |
| 1347 | parser.add_argument( |
| 1348 | '--tc1000', |
| 1349 | action='store_true', |
| 1350 | help='TC1000 - One ME, SFTP, 1MB files, 100 files per event, endless number of events, 1 event per poll') |
| 1351 | parser.add_argument( |
| 1352 | '--tc1001', |
| 1353 | action='store_true', |
| 1354 | help='TC1001 - One ME, SFTP, 5MB files, 100 files per event, endless number of events, 1 event per poll') |
| 1355 | |
| 1356 | # SFTP TCs with multiple MEs |
| 1357 | parser.add_argument( |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1358 | '--tc500', |
| 1359 | action='store_true', |
| 1360 | help='TC500 - 700 MEs, SFTP, 1MB files, 2 new files per event, 700 events, all event in one poll.') |
| 1361 | |
| 1362 | parser.add_argument( |
| 1363 | '--tc501', |
| 1364 | action='store_true', |
| 1365 | help='TC501 - 700 MEs, SFTP, 5MB files, 2 new files per event, 700 events, all event in one poll.') |
| 1366 | |
| 1367 | parser.add_argument( |
| 1368 | '--tc502', |
| 1369 | action='store_true', |
| 1370 | help='TC502 - 700 MEs, SFTP, 50MB files, 2 new files per event, 700 events, all event in one poll.') |
| 1371 | |
| 1372 | parser.add_argument( |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1373 | '--tc510', |
| 1374 | action='store_true', |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1375 | 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] | 1376 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1377 | parser.add_argument( |
| 1378 | '--tc511', |
| 1379 | action='store_true', |
| 1380 | 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] | 1381 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1382 | parser.add_argument( |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1383 | '--tc550', |
| 1384 | action='store_true', |
| 1385 | help='TC550 - 700 MEs, SFTP, 50MB files, 1 file per event, 3500 events, 700 event per poll.') |
| 1386 | |
| 1387 | parser.add_argument( |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1388 | '--tc710', |
| 1389 | action='store_true', |
| 1390 | 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] | 1391 | |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1392 | parser.add_argument( |
| 1393 | '--tc1100', |
| 1394 | action='store_true', |
| 1395 | help='TC1100 - 700 ME, SFTP, 1MB files, 100 files per event, endless number of events, 35 event per poll') |
| 1396 | parser.add_argument( |
| 1397 | '--tc1101', |
| 1398 | action='store_true', |
| 1399 | help='TC1101 - 700 ME, SFTP, 5MB files, 100 files per event, endless number of events, 35 event per poll') |
| 1400 | parser.add_argument( |
| 1401 | '--tc1102', |
| 1402 | action='store_true', |
| 1403 | help='TC1102 - 700 ME, SFTP, 50MB files, 100 files per event, endless number of events, 35 event per poll') |
| 1404 | |
| 1405 | parser.add_argument( |
| 1406 | '--tc1200', |
| 1407 | action='store_true', |
| 1408 | help='TC1200 - 700 ME, SFTP, 1MB files, 100 new files per event, endless number of events, 35 event per poll') |
| 1409 | parser.add_argument( |
| 1410 | '--tc1201', |
| 1411 | action='store_true', |
| 1412 | help='TC1201 - 700 ME, SFTP, 5MB files, 100 new files per event, endless number of events, 35 event per poll') |
| 1413 | parser.add_argument( |
| 1414 | '--tc1202', |
| 1415 | action='store_true', |
| 1416 | help='TC1202 - 700 ME, SFTP, 50MB files, 100 new files per event, endless number of events, 35 event per poll') |
| 1417 | |
| 1418 | parser.add_argument( |
| 1419 | '--tc1300', |
| 1420 | action='store_true', |
| 1421 | help='TC1300 - 700 ME, SFTP, 1MB files, 100 files per event, endless number of events, 35 event per poll, 20 event polls every 15min') |
| 1422 | parser.add_argument( |
| 1423 | '--tc1301', |
| 1424 | action='store_true', |
| 1425 | help='TC1301 - 700 ME, SFTP, 5MB files, 100 files per event, endless number of events, 35 event per poll, 20 event polls every 15min') |
| 1426 | parser.add_argument( |
| 1427 | '--tc1302', |
| 1428 | action='store_true', |
| 1429 | help='TC1302 - 700 ME, SFTP, 50MB files, 100 files per event, endless number of events, 35 event per poll, 20 event polls every 15min') |
| 1430 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1431 | parser.add_argument( |
| 1432 | '--tc1500', |
| 1433 | action='store_true', |
| 1434 | 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] | 1435 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1436 | # FTPS TCs with single ME |
| 1437 | parser.add_argument( |
| 1438 | '--tc200', |
| 1439 | action='store_true', |
| 1440 | help='TC200 - One ME, FTPS, 1 1MB file, 1 event') |
| 1441 | parser.add_argument( |
| 1442 | '--tc201', |
| 1443 | action='store_true', |
| 1444 | help='TC201 - One ME, FTPS, 1 5MB file, 1 event') |
| 1445 | parser.add_argument( |
| 1446 | '--tc202', |
| 1447 | action='store_true', |
| 1448 | help='TC202 - One ME, FTPS, 1 50MB file, 1 event') |
| 1449 | |
| 1450 | parser.add_argument( |
| 1451 | '--tc210', |
| 1452 | action='store_true', |
| 1453 | help='TC210 - One ME, FTPS, 1MB files, 1 file per event, 100 events, 1 event per poll.') |
| 1454 | parser.add_argument( |
| 1455 | '--tc211', |
| 1456 | action='store_true', |
| 1457 | help='TC211 - One ME, FTPS, 1MB files, 100 files per event, 100 events, 1 event per poll.') |
| 1458 | parser.add_argument( |
| 1459 | '--tc212', |
| 1460 | action='store_true', |
| 1461 | help='TC212 - One ME, FTPS, 5MB files, 100 files per event, 100 events, 1 event per poll.') |
| 1462 | parser.add_argument( |
| 1463 | '--tc213', |
| 1464 | action='store_true', |
| 1465 | help='TC213 - One ME, FTPS, 1MB files, 100 files per event, 100 events. All events in one poll.') |
| 1466 | |
| 1467 | parser.add_argument( |
| 1468 | '--tc220', |
| 1469 | action='store_true', |
| 1470 | 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') |
| 1471 | parser.add_argument( |
| 1472 | '--tc221', |
| 1473 | action='store_true', |
| 1474 | help='TC221 - One ME, FTPS, 1MB files, 100 files per event, 100 events, 1 event per poll. 10% missing files') |
| 1475 | parser.add_argument( |
| 1476 | '--tc222', |
| 1477 | action='store_true', |
| 1478 | help='TC222 - One ME, FTPS, 1MB files, 100 files per event, 100 events. 1 event per poll. All files with identical name. ') |
| 1479 | |
| 1480 | parser.add_argument( |
| 1481 | '--tc2000', |
| 1482 | action='store_true', |
| 1483 | help='TC2000 - One ME, FTPS, 1MB files, 100 files per event, endless number of events, 1 event per poll') |
| 1484 | parser.add_argument( |
| 1485 | '--tc2001', |
| 1486 | action='store_true', |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1487 | help='TC2001 - One ME, FTPS, 5MB files, 100 files per event, endless number of events, 1 event per poll') |
| 1488 | |
| 1489 | |
| 1490 | parser.add_argument( |
| 1491 | '--tc2100', |
| 1492 | action='store_true', |
| 1493 | help='TC2100 - 700 ME, FTPS, 1MB files, 100 files per event, endless number of events, 35 event per poll') |
| 1494 | parser.add_argument( |
| 1495 | '--tc2101', |
| 1496 | action='store_true', |
| 1497 | help='TC2101 - 700 ME, FTPS, 5MB files, 100 files per event, endless number of events, 35 event per poll') |
| 1498 | parser.add_argument( |
| 1499 | '--tc2102', |
| 1500 | action='store_true', |
| 1501 | help='TC2102 - 700 ME, FTPS, 50MB files, 100 files per event, endless number of events, 35 event per poll') |
| 1502 | |
| 1503 | parser.add_argument( |
| 1504 | '--tc2200', |
| 1505 | action='store_true', |
| 1506 | help='TC2200 - 700 ME, FTPS, 1MB files, 100 new files per event, endless number of events, 35 event per poll') |
| 1507 | parser.add_argument( |
| 1508 | '--tc2201', |
| 1509 | action='store_true', |
| 1510 | help='TC2201 - 700 ME, FTPS, 5MB files, 100 new files per event, endless number of events, 35 event per poll') |
| 1511 | parser.add_argument( |
| 1512 | '--tc2202', |
| 1513 | action='store_true', |
| 1514 | help='TC2202 - 700 ME, FTPS, 50MB files, 100 new files per event, endless number of events, 35 event per poll') |
| 1515 | |
| 1516 | parser.add_argument( |
| 1517 | '--tc2300', |
| 1518 | action='store_true', |
| 1519 | help='TC2300 - 700 ME, FTPS, 1MB files, 100 files per event, endless number of events, 35 event per poll, 20 event polls every 15min') |
| 1520 | parser.add_argument( |
| 1521 | '--tc2301', |
| 1522 | action='store_true', |
| 1523 | help='TC2301 - 700 ME, FTPS, 5MB files, 100 files per event, endless number of events, 35 event per poll, 20 event polls every 15min') |
| 1524 | parser.add_argument( |
| 1525 | '--tc2302', |
| 1526 | action='store_true', |
| 1527 | help='TC2302 - 700 ME, FTPS, 50MB files, 100 files per event, endless number of events, 35 event per poll, 20 event polls every 15min') |
| 1528 | |
| 1529 | parser.add_argument( |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1530 | '--tc2500', |
| 1531 | action='store_true', |
| 1532 | 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') |
| 1533 | |
| 1534 | parser.add_argument( |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1535 | '--tc600', |
| 1536 | action='store_true', |
| 1537 | help='TC600 - 700 MEs, FTPS, 1MB files, 2 new files per event, 700 events, all event in one poll.') |
| 1538 | |
| 1539 | parser.add_argument( |
| 1540 | '--tc601', |
| 1541 | action='store_true', |
| 1542 | help='TC601 - 700 MEs, FTPS, 5MB files, 2 new files per event, 700 events, all event in one poll.') |
| 1543 | |
| 1544 | parser.add_argument( |
| 1545 | '--tc602', |
| 1546 | action='store_true', |
| 1547 | 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] | 1548 | |
| 1549 | parser.add_argument( |
| 1550 | '--tc610', |
| 1551 | action='store_true', |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1552 | help='TC610 - 700 MEs, FTPS, 1MB files, 1 file per event, 3500 events, 700 event per poll.') |
| 1553 | |
| 1554 | parser.add_argument( |
| 1555 | '--tc611', |
| 1556 | action='store_true', |
| 1557 | help='TC611 - 700 MEs, FTPS, 1KB files, 1 file per event, 3500 events, 700 event per poll.') |
| 1558 | |
| 1559 | parser.add_argument( |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1560 | '--tc650', |
| 1561 | action='store_true', |
| 1562 | help='TC610 - 700 MEs, FTPS, 50MB files, 1 file per event, 3500 events, 700 event per poll.') |
| 1563 | |
| 1564 | parser.add_argument( |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1565 | '--tc810', |
| 1566 | action='store_true', |
| 1567 | 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] | 1568 | |
| 1569 | args = parser.parse_args() |
| 1570 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1571 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1572 | |
| 1573 | if args.tc100: |
| 1574 | tc_num = "TC# 100" |
| 1575 | elif args.tc101: |
| 1576 | tc_num = "TC# 101" |
| 1577 | elif args.tc102: |
| 1578 | tc_num = "TC# 102" |
| 1579 | |
| 1580 | elif args.tc110: |
| 1581 | tc_num = "TC# 110" |
| 1582 | elif args.tc111: |
| 1583 | tc_num = "TC# 111" |
| 1584 | elif args.tc112: |
| 1585 | tc_num = "TC# 112" |
| 1586 | elif args.tc113: |
| 1587 | tc_num = "TC# 113" |
| 1588 | |
| 1589 | elif args.tc120: |
| 1590 | tc_num = "TC# 120" |
| 1591 | elif args.tc121: |
| 1592 | tc_num = "TC# 121" |
| 1593 | elif args.tc122: |
| 1594 | tc_num = "TC# 122" |
| 1595 | |
| 1596 | elif args.tc1000: |
| 1597 | tc_num = "TC# 1000" |
| 1598 | elif args.tc1001: |
| 1599 | tc_num = "TC# 1001" |
| 1600 | |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1601 | elif args.tc1100: |
| 1602 | tc_num = "TC# 1100" |
| 1603 | elif args.tc1101: |
| 1604 | tc_num = "TC# 1101" |
| 1605 | elif args.tc1102: |
| 1606 | tc_num = "TC# 1102" |
| 1607 | elif args.tc1200: |
| 1608 | tc_num = "TC# 1200" |
| 1609 | elif args.tc1201: |
| 1610 | tc_num = "TC# 1201" |
| 1611 | elif args.tc1202: |
| 1612 | tc_num = "TC# 1202" |
| 1613 | elif args.tc1300: |
| 1614 | tc_num = "TC# 1300" |
| 1615 | elif args.tc1301: |
| 1616 | tc_num = "TC# 1301" |
| 1617 | elif args.tc1302: |
| 1618 | tc_num = "TC# 1302" |
| 1619 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1620 | elif args.tc1500: |
| 1621 | tc_num = "TC# 1500" |
| 1622 | |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1623 | elif args.tc500: |
| 1624 | tc_num = "TC# 500" |
| 1625 | elif args.tc501: |
| 1626 | tc_num = "TC# 501" |
| 1627 | elif args.tc502: |
| 1628 | tc_num = "TC# 502" |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1629 | elif args.tc510: |
| 1630 | tc_num = "TC# 510" |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1631 | elif args.tc511: |
| 1632 | tc_num = "TC# 511" |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1633 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1634 | elif args.tc550: |
| 1635 | tc_num = "TC# 550" |
| 1636 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1637 | elif args.tc710: |
| 1638 | tc_num = "TC# 710" |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1639 | |
| 1640 | elif args.tc200: |
| 1641 | tc_num = "TC# 200" |
| 1642 | elif args.tc201: |
| 1643 | tc_num = "TC# 201" |
| 1644 | elif args.tc202: |
| 1645 | tc_num = "TC# 202" |
| 1646 | |
| 1647 | elif args.tc210: |
| 1648 | tc_num = "TC# 210" |
| 1649 | elif args.tc211: |
| 1650 | tc_num = "TC# 211" |
| 1651 | elif args.tc212: |
| 1652 | tc_num = "TC# 212" |
| 1653 | elif args.tc213: |
| 1654 | tc_num = "TC# 213" |
| 1655 | |
| 1656 | elif args.tc220: |
| 1657 | tc_num = "TC# 220" |
| 1658 | elif args.tc221: |
| 1659 | tc_num = "TC# 221" |
| 1660 | elif args.tc222: |
| 1661 | tc_num = "TC# 222" |
| 1662 | |
| 1663 | elif args.tc2000: |
| 1664 | tc_num = "TC# 2000" |
| 1665 | elif args.tc2001: |
| 1666 | tc_num = "TC# 2001" |
| 1667 | |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1668 | elif args.tc2100: |
| 1669 | tc_num = "TC# 2100" |
| 1670 | elif args.tc2101: |
| 1671 | tc_num = "TC# 2101" |
| 1672 | elif args.tc2102: |
| 1673 | tc_num = "TC# 2102" |
| 1674 | elif args.tc2200: |
| 1675 | tc_num = "TC# 2200" |
| 1676 | elif args.tc2201: |
| 1677 | tc_num = "TC# 2201" |
| 1678 | elif args.tc2202: |
| 1679 | tc_num = "TC# 2202" |
| 1680 | elif args.tc2300: |
| 1681 | tc_num = "TC# 2300" |
| 1682 | elif args.tc2301: |
| 1683 | tc_num = "TC# 2301" |
| 1684 | elif args.tc2302: |
| 1685 | tc_num = "TC# 2302" |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1686 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1687 | elif args.tc2500: |
| 1688 | tc_num = "TC# 2500" |
| 1689 | |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1690 | elif args.tc600: |
| 1691 | tc_num = "TC# 600" |
| 1692 | elif args.tc601: |
| 1693 | tc_num = "TC# 601" |
| 1694 | elif args.tc602: |
| 1695 | tc_num = "TC# 602" |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1696 | elif args.tc610: |
| 1697 | tc_num = "TC# 610" |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1698 | elif args.tc611: |
| 1699 | tc_num = "TC# 611" |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1700 | elif args.tc650: |
| 1701 | tc_num = "TC# 650" |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1702 | elif args.tc810: |
| 1703 | tc_num = "TC# 810" |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 1704 | |
| 1705 | else: |
| 1706 | print("No TC was defined") |
| 1707 | print("use --help for usage info") |
| 1708 | sys.exit() |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1709 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1710 | print("TC num: " + tc_num) |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1711 | |
BjornMagnussonXA | a79a043 | 2019-07-17 08:26:50 +0000 | [diff] [blame] | 1712 | for i in range(len(sftp_hosts)): |
| 1713 | 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.") |
| 1714 | |
| 1715 | for i in range(len(ftps_hosts)): |
| 1716 | 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.") |
| 1717 | |
| 1718 | 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] | 1719 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1720 | app.run(port=HOST_PORT, host=HOST_IP) |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1721 | |