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 | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 17 | SFTP_PORT = 1022 |
| 18 | FTPS_PORT = 21 |
| 19 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 20 | #Test function to check server running |
| 21 | @app.route('/', |
| 22 | methods=['GET']) |
| 23 | def index(): |
| 24 | return 'Hello world' |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 25 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 26 | #Returns number of polls |
| 27 | @app.route('/ctr_requests', |
| 28 | methods=['GET']) |
| 29 | def counter_requests(): |
| 30 | global ctr_requests |
| 31 | return str(ctr_requests) |
| 32 | |
| 33 | #Returns number of replies |
| 34 | @app.route('/ctr_responses', |
| 35 | methods=['GET']) |
| 36 | def counter_responses(): |
| 37 | global ctr_responses |
| 38 | return str(ctr_responses) |
| 39 | |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 40 | #Returns the total number of file |
| 41 | @app.route('/ctr_files', |
| 42 | methods=['GET']) |
| 43 | def counter_files(): |
| 44 | global ctr_files |
| 45 | return str(ctr_files) |
| 46 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 47 | #Returns number of unique files |
| 48 | @app.route('/ctr_unique_files', |
| 49 | methods=['GET']) |
| 50 | def counter_uniquefiles(): |
| 51 | global fileMap |
| 52 | return str(len(fileMap)) |
| 53 | |
| 54 | #Returns tc info |
| 55 | @app.route('/tc_info', |
| 56 | methods=['GET']) |
| 57 | def testcase_info(): |
| 58 | global tc_num |
| 59 | return tc_num |
| 60 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 61 | #Returns number of events |
| 62 | @app.route('/ctr_events', |
| 63 | methods=['GET']) |
| 64 | def counter_events(): |
| 65 | global ctr_events |
| 66 | return str(ctr_events) |
| 67 | |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 68 | #Returns execution time in mm:ss |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 69 | @app.route('/execution_time', |
| 70 | methods=['GET']) |
| 71 | def exe_time(): |
| 72 | global startTime |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 73 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 74 | stopTime = time.time() |
| 75 | minutes, seconds = divmod(stopTime-startTime, 60) |
| 76 | return "{:0>2}:{:0>2}".format(int(minutes),int(seconds)) |
| 77 | |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 78 | #Returns the timestamp for first poll |
| 79 | @app.route('/exe_time_first_poll', |
| 80 | methods=['GET']) |
| 81 | def exe_time_first_poll(): |
| 82 | global firstPollTime |
| 83 | |
| 84 | if (firstPollTime == 0): |
| 85 | return "--:--" |
| 86 | minutes, seconds = divmod(time.time()-firstPollTime, 60) |
| 87 | return "{:0>2}:{:0>2}".format(int(minutes),int(seconds)) |
| 88 | |
| 89 | #Starts event delivery |
| 90 | @app.route('/start', |
| 91 | methods=['GET']) |
| 92 | def start(): |
| 93 | global runningState |
| 94 | runningState="Started" |
| 95 | return runningState |
| 96 | |
| 97 | #Stops event delivery |
| 98 | @app.route('/stop', |
| 99 | methods=['GET']) |
| 100 | def stop(): |
| 101 | global runningState |
| 102 | runningState="Stopped" |
| 103 | return runningState |
| 104 | |
| 105 | #Returns the running state |
| 106 | @app.route('/status', |
| 107 | methods=['GET']) |
| 108 | def status(): |
| 109 | global runningState |
| 110 | return runningState |
| 111 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 112 | #Returns number of unique PNFs |
| 113 | @app.route('/ctr_unique_PNFs', |
| 114 | methods=['GET']) |
| 115 | def counter_uniquePNFs(): |
| 116 | global pnfMap |
| 117 | return str(len(pnfMap)) |
| 118 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 119 | #Messages polling function |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 120 | @app.route( |
| 121 | "/events/unauthenticated.VES_NOTIFICATION_OUTPUT/OpenDcae-c12/C12", |
| 122 | methods=['GET']) |
| 123 | def MR_reply(): |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 124 | global ctr_requests |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 125 | global ctr_responses |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 126 | global args |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 127 | global runningState |
| 128 | global firstPollTime |
| 129 | |
| 130 | if (firstPollTime == 0): |
| 131 | firstPollTime = time.time() |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 132 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 133 | ctr_requests = ctr_requests + 1 |
| 134 | print("MR: poll request#: " + str(ctr_requests)) |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 135 | |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 136 | if (runningState == "Stopped"): |
| 137 | ctr_responses = ctr_responses + 1 |
| 138 | return buildOkResponse("[]") |
| 139 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 140 | if args.tc100: |
| 141 | return tc100("sftp") |
| 142 | elif args.tc101: |
| 143 | return tc101("sftp") |
| 144 | elif args.tc102: |
| 145 | return tc102("sftp") |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 146 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 147 | elif args.tc110: |
| 148 | return tc110("sftp") |
| 149 | elif args.tc111: |
| 150 | return tc111("sftp") |
| 151 | elif args.tc112: |
| 152 | return tc112("sftp") |
| 153 | elif args.tc113: |
| 154 | return tc113("sftp") |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 155 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 156 | elif args.tc120: |
| 157 | return tc120("sftp") |
| 158 | elif args.tc121: |
| 159 | return tc121("sftp") |
| 160 | elif args.tc122: |
| 161 | return tc122("sftp") |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 162 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 163 | elif args.tc1000: |
| 164 | return tc1000("sftp") |
| 165 | elif args.tc1001: |
| 166 | return tc1001("sftp") |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 167 | |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 168 | elif args.tc1100: |
| 169 | return tc1100("sftp","1MB") |
| 170 | elif args.tc1101: |
| 171 | return tc1100("sftp","50MB") |
| 172 | elif args.tc1102: |
| 173 | return tc1100("sftp","50MB") |
| 174 | elif args.tc1200: |
| 175 | return tc1200("sftp","1MB") |
| 176 | elif args.tc1201: |
| 177 | return tc1200("sftp","5MB") |
| 178 | elif args.tc1202: |
| 179 | return tc1200("sftp","50MB") |
| 180 | elif args.tc1300: |
| 181 | return tc1300("sftp","1MB") |
| 182 | elif args.tc1301: |
| 183 | return tc1300("sftp","5MB") |
| 184 | elif args.tc1302: |
| 185 | return tc1300("sftp","50MB") |
| 186 | |
| 187 | elif args.tc500: |
| 188 | return tc500("sftp","1MB") |
| 189 | elif args.tc501: |
| 190 | return tc500("sftp","5MB") |
| 191 | elif args.tc502: |
| 192 | return tc500("sftp","50MB") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 193 | elif args.tc510: |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 194 | return tc510("sftp") |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 195 | elif args.tc511: |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 196 | return tc511("sftp") |
| 197 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 198 | elif args.tc710: |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 199 | return tc710("sftp") |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 200 | |
| 201 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 202 | elif args.tc200: |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 203 | return tc100("ftps") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 204 | elif args.tc201: |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 205 | return tc101("ftps") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 206 | elif args.tc202: |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 207 | return tc102("ftps") |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 208 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 209 | elif args.tc210: |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 210 | return tc110("ftps") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 211 | elif args.tc211: |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 212 | return tc111("ftps") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 213 | elif args.tc212: |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 214 | return tc112("ftps") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 215 | elif args.tc213: |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 216 | return tc113("ftps") |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 217 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 218 | elif args.tc220: |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 219 | return tc120("ftps") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 220 | elif args.tc221: |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 221 | return tc121("ftps") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 222 | elif args.tc222: |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 223 | return tc122("ftps") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 224 | |
| 225 | elif args.tc2000: |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 226 | return tc1000("ftps") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 227 | elif args.tc2001: |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 228 | return tc1001("ftps") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 229 | |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 230 | elif args.tc2100: |
| 231 | return tc1100("ftps","1MB") |
| 232 | elif args.tc2101: |
| 233 | return tc1100("ftps","50MB") |
| 234 | elif args.tc2102: |
| 235 | return tc1100("ftps","50MB") |
| 236 | elif args.tc2200: |
| 237 | return tc1200("ftps","1MB") |
| 238 | elif args.tc2201: |
| 239 | return tc1200("ftps","5MB") |
| 240 | elif args.tc2202: |
| 241 | return tc1200("ftps","50MB") |
| 242 | elif args.tc2300: |
| 243 | return tc1300("ftps","1MB") |
| 244 | elif args.tc2301: |
| 245 | return tc1300("ftps","5MB") |
| 246 | elif args.tc2302: |
| 247 | return tc1300("ftps","50MB") |
| 248 | |
| 249 | elif args.tc600: |
| 250 | return tc500("ftps","1MB") |
| 251 | elif args.tc601: |
| 252 | return tc500("ftps","5MB") |
| 253 | elif args.tc602: |
| 254 | return tc500("ftps","50MB") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 255 | elif args.tc610: |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 256 | return tc510("ftps") |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 257 | elif args.tc611: |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 258 | return tc511("ftps") |
| 259 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 260 | elif args.tc810: |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 261 | return tc710("ftps") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 262 | |
| 263 | |
| 264 | #### Test case functions |
| 265 | |
| 266 | |
| 267 | def tc100(ftptype): |
| 268 | global ctr_responses |
| 269 | global ctr_unique_files |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 270 | global ctr_events |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 271 | |
| 272 | ctr_responses = ctr_responses + 1 |
| 273 | |
| 274 | if (ctr_responses > 1): |
| 275 | return buildOkResponse("[]") |
| 276 | |
| 277 | seqNr = (ctr_responses-1) |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 278 | nodeName = createNodeName(0) |
| 279 | fileName = createFileName(nodeName, seqNr, "1MB") |
| 280 | msg = getEventHead(nodeName) + getEventName(fileName,ftptype,"onap","pano") + getEventEnd() |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 281 | fileMap[seqNr] = seqNr |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 282 | ctr_events = ctr_events+1 |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 283 | return buildOkResponse("["+msg+"]") |
| 284 | |
| 285 | def tc101(ftptype): |
| 286 | global ctr_responses |
| 287 | global ctr_unique_files |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 288 | global ctr_events |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 289 | |
| 290 | ctr_responses = ctr_responses + 1 |
| 291 | |
| 292 | if (ctr_responses > 1): |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 293 | return buildOkResponse("[]") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 294 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 295 | seqNr = (ctr_responses-1) |
| 296 | nodeName = createNodeName(0) |
| 297 | fileName = createFileName(nodeName, seqNr, "5MB") |
| 298 | msg = getEventHead(nodeName) + getEventName(fileName,ftptype,"onap","pano") + getEventEnd() |
| 299 | fileMap[seqNr] = seqNr |
| 300 | ctr_events = ctr_events+1 |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 301 | return buildOkResponse("["+msg+"]") |
| 302 | |
| 303 | def tc102(ftptype): |
| 304 | global ctr_responses |
| 305 | global ctr_unique_files |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 306 | global ctr_events |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 307 | |
| 308 | ctr_responses = ctr_responses + 1 |
| 309 | |
| 310 | if (ctr_responses > 1): |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 311 | return buildOkResponse("[]") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 312 | |
| 313 | seqNr = (ctr_responses-1) |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 314 | nodeName = createNodeName(0) |
| 315 | fileName = createFileName(nodeName, seqNr, "50MB") |
| 316 | msg = getEventHead(nodeName) + getEventName(fileName,ftptype,"onap","pano") + getEventEnd() |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 317 | fileMap[seqNr] = seqNr |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 318 | ctr_events = ctr_events+1 |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 319 | return buildOkResponse("["+msg+"]") |
| 320 | |
| 321 | def tc110(ftptype): |
| 322 | global ctr_responses |
| 323 | global ctr_unique_files |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 324 | global ctr_events |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 325 | |
| 326 | ctr_responses = ctr_responses + 1 |
| 327 | |
| 328 | if (ctr_responses > 100): |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 329 | return buildOkResponse("[]") |
| 330 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 331 | seqNr = (ctr_responses-1) |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 332 | nodeName = createNodeName(0) |
| 333 | fileName = createFileName(nodeName, seqNr, "1MB") |
| 334 | msg = getEventHead(nodeName) + getEventName(fileName,ftptype,"onap","pano") + getEventEnd() |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 335 | fileMap[seqNr] = seqNr |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 336 | ctr_events = ctr_events+1 |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 337 | return buildOkResponse("["+msg+"]") |
| 338 | |
| 339 | def tc111(ftptype): |
| 340 | global ctr_responses |
| 341 | global ctr_unique_files |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 342 | global ctr_events |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 343 | |
| 344 | ctr_responses = ctr_responses + 1 |
| 345 | |
| 346 | if (ctr_responses > 100): |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 347 | return buildOkResponse("[]") |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 348 | |
| 349 | nodeName = createNodeName(0) |
| 350 | msg = getEventHead(nodeName) |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 351 | |
| 352 | for i in range(100): |
| 353 | seqNr = i+(ctr_responses-1) |
| 354 | if i != 0: msg = msg + "," |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 355 | fileName = createFileName(nodeName, seqNr, "1MB") |
| 356 | msg = msg + getEventName(fileName,ftptype,"onap","pano") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 357 | fileMap[seqNr] = seqNr |
| 358 | |
| 359 | msg = msg + getEventEnd() |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 360 | ctr_events = ctr_events+1 |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 361 | |
| 362 | return buildOkResponse("["+msg+"]") |
| 363 | |
| 364 | def tc112(ftptype): |
| 365 | global ctr_responses |
| 366 | global ctr_unique_files |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 367 | global ctr_events |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 368 | |
| 369 | ctr_responses = ctr_responses + 1 |
| 370 | |
| 371 | if (ctr_responses > 100): |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 372 | return buildOkResponse("[]") |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 373 | |
| 374 | nodeName = createNodeName(0) |
| 375 | msg = getEventHead(nodeName) |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 376 | |
| 377 | for i in range(100): |
| 378 | seqNr = i+(ctr_responses-1) |
| 379 | if i != 0: msg = msg + "," |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 380 | fileName = createFileName(nodeName, seqNr, "5MB") |
| 381 | msg = msg + getEventName(fileName,ftptype,"onap","pano") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 382 | fileMap[seqNr] = seqNr |
| 383 | |
| 384 | msg = msg + getEventEnd() |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 385 | ctr_events = ctr_events+1 |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 386 | |
| 387 | return buildOkResponse("["+msg+"]") |
| 388 | |
| 389 | def tc113(ftptype): |
| 390 | global ctr_responses |
| 391 | global ctr_unique_files |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 392 | global ctr_events |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 393 | |
| 394 | ctr_responses = ctr_responses + 1 |
| 395 | |
| 396 | if (ctr_responses > 1): |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 397 | return buildOkResponse("[]") |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 398 | |
| 399 | nodeName = createNodeName(0) |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 400 | msg = "" |
| 401 | |
| 402 | for evts in range(100): # build 100 evts |
| 403 | if (evts > 0): |
| 404 | msg = msg + "," |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 405 | msg = msg + getEventHead(nodeName) |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 406 | for i in range(100): # build 100 files |
| 407 | seqNr = i+evts+100*(ctr_responses-1) |
| 408 | if i != 0: msg = msg + "," |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 409 | fileName = createFileName(nodeName, seqNr, "1MB") |
| 410 | msg = msg + getEventName(fileName,ftptype,"onap","pano") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 411 | fileMap[seqNr] = seqNr |
| 412 | |
| 413 | msg = msg + getEventEnd() |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 414 | ctr_events = ctr_events+1 |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 415 | |
| 416 | return buildOkResponse("["+msg+"]") |
| 417 | |
| 418 | |
| 419 | def tc120(ftptype): |
| 420 | global ctr_responses |
| 421 | global ctr_unique_files |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 422 | global ctr_events |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 423 | |
| 424 | ctr_responses = ctr_responses + 1 |
| 425 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 426 | nodeName = createNodeName(0) |
| 427 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 428 | if (ctr_responses > 100): |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 429 | return buildOkResponse("[]") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 430 | |
| 431 | if (ctr_responses % 10 == 2): |
| 432 | return # Return nothing |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 433 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 434 | if (ctr_responses % 10 == 3): |
| 435 | return buildOkResponse("") # Return empty message |
| 436 | |
| 437 | if (ctr_responses % 10 == 4): |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 438 | return buildOkResponse(getEventHead(nodeName)) # Return part of a json event |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 439 | |
| 440 | if (ctr_responses % 10 == 5): |
| 441 | return buildEmptyResponse(404) # Return empty message with status code |
| 442 | |
| 443 | if (ctr_responses % 10 == 6): |
| 444 | sleep(60) |
| 445 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 446 | |
| 447 | msg = getEventHead(nodeName) |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 448 | |
| 449 | for i in range(100): |
| 450 | seqNr = i+(ctr_responses-1) |
| 451 | if i != 0: msg = msg + "," |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 452 | fileName = createFileName(nodeName, seqNr, "1MB") |
| 453 | msg = msg + getEventName(fileName,ftptype,"onap","pano") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 454 | fileMap[seqNr] = seqNr |
| 455 | |
| 456 | msg = msg + getEventEnd() |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 457 | ctr_events = ctr_events+1 |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 458 | |
| 459 | return buildOkResponse("["+msg+"]") |
| 460 | |
| 461 | def tc121(ftptype): |
| 462 | global ctr_responses |
| 463 | global ctr_unique_files |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 464 | global ctr_events |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 465 | |
| 466 | ctr_responses = ctr_responses + 1 |
| 467 | |
| 468 | if (ctr_responses > 100): |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 469 | return buildOkResponse("[]") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 470 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 471 | nodeName = createNodeName(0) |
| 472 | msg = getEventHead(nodeName) |
| 473 | |
| 474 | fileName = "" |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 475 | for i in range(100): |
| 476 | seqNr = i+(ctr_responses-1) |
| 477 | if (seqNr%10 == 0): # Every 10th file is "missing" |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 478 | fileName = createMissingFileName(nodeName, seqNr, "1MB") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 479 | else: |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 480 | fileName = createFileName(nodeName, seqNr, "1MB") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 481 | fileMap[seqNr] = seqNr |
| 482 | |
| 483 | if i != 0: msg = msg + "," |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 484 | msg = msg + getEventName(fileName,ftptype,"onap","pano") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 485 | |
| 486 | msg = msg + getEventEnd() |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 487 | ctr_events = ctr_events+1 |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 488 | |
| 489 | return buildOkResponse("["+msg+"]") |
| 490 | |
| 491 | def tc122(ftptype): |
| 492 | global ctr_responses |
| 493 | global ctr_unique_files |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 494 | global ctr_events |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 495 | |
| 496 | ctr_responses = ctr_responses + 1 |
| 497 | |
| 498 | if (ctr_responses > 100): |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 499 | return buildOkResponse("[]") |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 500 | |
| 501 | nodeName = createNodeName(0) |
| 502 | msg = getEventHead(nodeName) |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 503 | |
| 504 | for i in range(100): |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 505 | fileName = createFileName(nodeName, 0, "1MB") # All files identical names |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 506 | if i != 0: msg = msg + "," |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 507 | msg = msg + getEventName(fileName,ftptype,"onap","pano") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 508 | |
| 509 | fileMap[0] = 0 |
| 510 | msg = msg + getEventEnd() |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 511 | ctr_events = ctr_events+1 |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 512 | |
| 513 | return buildOkResponse("["+msg+"]") |
| 514 | |
| 515 | |
| 516 | def tc1000(ftptype): |
| 517 | global ctr_responses |
| 518 | global ctr_unique_files |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 519 | global ctr_events |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 520 | |
| 521 | ctr_responses = ctr_responses + 1 |
| 522 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 523 | nodeName = createNodeName(0) |
| 524 | msg = getEventHead(nodeName) |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 525 | |
| 526 | for i in range(100): |
| 527 | seqNr = i+(ctr_responses-1) |
| 528 | if i != 0: msg = msg + "," |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 529 | fileName = createFileName(nodeName, seqNr, "1MB") |
| 530 | msg = msg + getEventName(fileName,ftptype,"onap","pano") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 531 | fileMap[seqNr] = seqNr |
| 532 | |
| 533 | msg = msg + getEventEnd() |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 534 | ctr_events = ctr_events+1 |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 535 | |
| 536 | return buildOkResponse("["+msg+"]") |
| 537 | |
| 538 | def tc1001(ftptype): |
| 539 | global ctr_responses |
| 540 | global ctr_unique_files |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 541 | global ctr_events |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 542 | |
| 543 | ctr_responses = ctr_responses + 1 |
| 544 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 545 | nodeName = createNodeName(0) |
| 546 | msg = getEventHead(nodeName) |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 547 | |
| 548 | for i in range(100): |
| 549 | seqNr = i+(ctr_responses-1) |
| 550 | if i != 0: msg = msg + "," |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 551 | fileName = createFileName(nodeName, seqNr, "5MB") |
| 552 | msg = msg + getEventName(fileName,ftptype,"onap","pano") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 553 | fileMap[seqNr] = seqNr |
| 554 | |
| 555 | msg = msg + getEventEnd() |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 556 | ctr_events = ctr_events+1 |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 557 | |
| 558 | return buildOkResponse("["+msg+"]") |
| 559 | |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 560 | |
| 561 | def tc1100(ftptype, filesize): |
| 562 | global ctr_responses |
| 563 | global ctr_unique_files |
| 564 | global ctr_events |
| 565 | |
| 566 | ctr_responses = ctr_responses + 1 |
| 567 | |
| 568 | msg = "" |
| 569 | |
| 570 | batch = (ctr_responses-1)%20; |
| 571 | |
| 572 | for pnfs in range(35): # build events for 35 PNFs at a time. 20 batches -> 700 |
| 573 | if (pnfs > 0): |
| 574 | msg = msg + "," |
| 575 | nodeName = createNodeName(pnfs + batch*35) |
| 576 | msg = msg + getEventHead(nodeName) |
| 577 | |
| 578 | for i in range(100): # 100 files per event |
| 579 | seqNr = i + int((ctr_responses-1)/20); |
| 580 | if i != 0: msg = msg + "," |
| 581 | fileName = createFileName(nodeName, seqNr, filesize) |
| 582 | msg = msg + getEventName(fileName,ftptype,"onap","pano") |
| 583 | seqNr = seqNr + (pnfs+batch*35)*1000000 #Create unique id for this node and file |
| 584 | fileMap[seqNr] = seqNr |
| 585 | |
| 586 | msg = msg + getEventEnd() |
| 587 | ctr_events = ctr_events+1 |
| 588 | |
| 589 | return buildOkResponse("["+msg+"]") |
| 590 | |
| 591 | def tc1200(ftptype, filesize): |
| 592 | global ctr_responses |
| 593 | global ctr_unique_files |
| 594 | global ctr_events |
| 595 | |
| 596 | ctr_responses = ctr_responses + 1 |
| 597 | |
| 598 | msg = "" |
| 599 | |
| 600 | batch = (ctr_responses-1)%20; |
| 601 | |
| 602 | for pnfs in range(35): # build events for 35 PNFs at a time. 20 batches -> 700 |
| 603 | if (pnfs > 0): |
| 604 | msg = msg + "," |
| 605 | nodeName = createNodeName(pnfs + batch*35) |
| 606 | msg = msg + getEventHead(nodeName) |
| 607 | |
| 608 | for i in range(100): # 100 files per event, all new files |
| 609 | seqNr = i+100 * int((ctr_responses-1)/20); |
| 610 | if i != 0: msg = msg + "," |
| 611 | fileName = createFileName(nodeName, seqNr, filesize) |
| 612 | msg = msg + getEventName(fileName,ftptype,"onap","pano") |
| 613 | seqNr = seqNr + (pnfs+batch*35)*1000000 #Create unique id for this node and file |
| 614 | fileMap[seqNr] = seqNr |
| 615 | |
| 616 | msg = msg + getEventEnd() |
| 617 | ctr_events = ctr_events+1 |
| 618 | |
| 619 | return buildOkResponse("["+msg+"]") |
| 620 | |
| 621 | |
| 622 | def tc1300(ftptype, filesize): |
| 623 | global ctr_responses |
| 624 | global ctr_unique_files |
| 625 | global ctr_events |
| 626 | global rop_counter |
| 627 | global rop_timestamp |
| 628 | |
| 629 | ctr_responses = ctr_responses + 1 |
| 630 | |
| 631 | #Start a event deliver for all 700 nodes every 15min |
| 632 | rop = time.time()-rop_timestamp |
| 633 | if ((rop < 900) & (rop_counter%20 == 0) & (rop_counter != 0)): |
| 634 | return buildOkResponse("[]") |
| 635 | else: |
| 636 | if (rop_counter%20 == 0): |
| 637 | rop_timestamp = time.time() |
| 638 | |
| 639 | rop_counter = rop_counter+1 |
| 640 | |
| 641 | msg = "" |
| 642 | |
| 643 | batch = (rop_counter-1)%20; |
| 644 | |
| 645 | for pnfs in range(35): # build events for 35 PNFs at a time. 20 batches -> 700 |
| 646 | if (pnfs > 0): |
| 647 | msg = msg + "," |
| 648 | nodeName = createNodeName(pnfs + batch*35) |
| 649 | msg = msg + getEventHead(nodeName) |
| 650 | |
| 651 | for i in range(100): # 100 files per event |
| 652 | seqNr = i + int((rop_counter-1)/20); |
| 653 | if i != 0: msg = msg + "," |
| 654 | fileName = createFileName(nodeName, seqNr, filesize) |
| 655 | msg = msg + getEventName(fileName,ftptype,"onap","pano") |
| 656 | seqNr = seqNr + (pnfs+batch*35)*1000000 #Create unique id for this node and file |
| 657 | fileMap[seqNr] = seqNr |
| 658 | |
| 659 | msg = msg + getEventEnd() |
| 660 | ctr_events = ctr_events+1 |
| 661 | |
| 662 | return buildOkResponse("["+msg+"]") |
| 663 | |
| 664 | def tc500(ftptype, filesize): |
| 665 | global ctr_responses |
| 666 | global ctr_unique_files |
| 667 | global ctr_events |
| 668 | |
| 669 | ctr_responses = ctr_responses + 1 |
| 670 | |
| 671 | if (ctr_responses > 1): |
| 672 | return buildOkResponse("[]") |
| 673 | |
| 674 | msg = "" |
| 675 | |
| 676 | |
| 677 | for pnfs in range(700): |
| 678 | if (pnfs > 0): |
| 679 | msg = msg + "," |
| 680 | nodeName = createNodeName(pnfs) |
| 681 | msg = msg + getEventHead(nodeName) |
| 682 | |
| 683 | for i in range(2): |
| 684 | seqNr = i; |
| 685 | if i != 0: msg = msg + "," |
| 686 | fileName = createFileName(nodeName, seqNr, filesize) |
| 687 | msg = msg + getEventName(fileName,ftptype,"onap","pano") |
| 688 | seqNr = seqNr + pnfs*1000000 #Create unique id for this node and file |
| 689 | fileMap[seqNr] = seqNr |
| 690 | |
| 691 | msg = msg + getEventEnd() |
| 692 | ctr_events = ctr_events+1 |
| 693 | |
| 694 | return buildOkResponse("["+msg+"]") |
| 695 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 696 | def tc510(ftptype): |
| 697 | global ctr_responses |
| 698 | global ctr_unique_files |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 699 | global ctr_events |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 700 | |
| 701 | ctr_responses = ctr_responses + 1 |
| 702 | |
| 703 | if (ctr_responses > 5): |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 704 | return buildOkResponse("[]") |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 705 | |
| 706 | msg = "" |
| 707 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 708 | for pnfs in range(700): # build events for 700 MEs |
| 709 | if (pnfs > 0): |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 710 | msg = msg + "," |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 711 | nodeName = createNodeName(pnfs) |
| 712 | msg = msg + getEventHead(nodeName) |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 713 | seqNr = (ctr_responses-1) |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 714 | fileName = createFileName(nodeName, seqNr, "1MB") |
| 715 | msg = msg + getEventName(fileName,ftptype,"onap","pano") |
| 716 | seqNr = seqNr + pnfs*1000000 #Create unique id for this node and file |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 717 | fileMap[seqNr] = seqNr |
| 718 | msg = msg + getEventEnd() |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 719 | ctr_events = ctr_events+1 |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 720 | |
| 721 | return buildOkResponse("["+msg+"]") |
| 722 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 723 | def tc511(ftptype): |
| 724 | global ctr_responses |
| 725 | global ctr_unique_files |
| 726 | global ctr_events |
| 727 | |
| 728 | ctr_responses = ctr_responses + 1 |
| 729 | |
| 730 | if (ctr_responses > 5): |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 731 | return buildOkResponse("[]") |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 732 | |
| 733 | msg = "" |
| 734 | |
| 735 | for pnfs in range(700): # build events for 700 MEs |
| 736 | if (pnfs > 0): |
| 737 | msg = msg + "," |
| 738 | nodeName = createNodeName(pnfs) |
| 739 | msg = msg + getEventHead(nodeName) |
| 740 | seqNr = (ctr_responses-1) |
| 741 | fileName = createFileName(nodeName, seqNr, "1KB") |
| 742 | msg = msg + getEventName(fileName,ftptype,"onap","pano") |
| 743 | seqNr = seqNr + pnfs*1000000 #Create unique id for this node and file |
| 744 | fileMap[seqNr] = seqNr |
| 745 | msg = msg + getEventEnd() |
| 746 | ctr_events = ctr_events+1 |
| 747 | |
| 748 | return buildOkResponse("["+msg+"]") |
| 749 | |
| 750 | def tc710(ftptype): |
| 751 | global ctr_responses |
| 752 | global ctr_unique_files |
| 753 | global ctr_events |
| 754 | |
| 755 | ctr_responses = ctr_responses + 1 |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 756 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 757 | if (ctr_responses > 100): |
| 758 | return buildOkResponse("[]") |
| 759 | |
| 760 | msg = "" |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 761 | |
| 762 | batch = (ctr_responses-1)%20; |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 763 | |
| 764 | for pnfs in range(35): # build events for 35 PNFs at a time. 20 batches -> 700 |
| 765 | if (pnfs > 0): |
| 766 | msg = msg + "," |
| 767 | nodeName = createNodeName(pnfs + batch*35) |
| 768 | msg = msg + getEventHead(nodeName) |
| 769 | |
| 770 | for i in range(100): # 100 files per event |
| 771 | seqNr = i + int((ctr_responses-1)/20); |
| 772 | if i != 0: msg = msg + "," |
| 773 | fileName = createFileName(nodeName, seqNr, "1MB") |
| 774 | msg = msg + getEventName(fileName,ftptype,"onap","pano") |
| 775 | seqNr = seqNr + (pnfs+batch*35)*1000000 #Create unique id for this node and file |
| 776 | fileMap[seqNr] = seqNr |
| 777 | |
| 778 | msg = msg + getEventEnd() |
| 779 | ctr_events = ctr_events+1 |
| 780 | |
| 781 | return buildOkResponse("["+msg+"]") |
| 782 | |
| 783 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 784 | #### Functions to build json messages and respones #### |
| 785 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 786 | def createNodeName(index): |
| 787 | return "PNF"+str(index); |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 788 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 789 | def createFileName(nodeName, index, size): |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 790 | global ctr_files |
| 791 | ctr_files = ctr_files + 1 |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 792 | return "A20000626.2315+0200-2330+0200_" + nodeName + "-" + str(index) + "-" +size + ".tar.gz"; |
| 793 | |
| 794 | def createMissingFileName(nodeName, index, size): |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 795 | global ctr_files |
| 796 | ctr_files = ctr_files + 1 |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 797 | return "AMissingFile_" + nodeName + "-" + str(index) + "-" +size + ".tar.gz"; |
| 798 | |
| 799 | |
| 800 | # Function to build fixed beginning of an event |
| 801 | |
| 802 | def getEventHead(nodename): |
| 803 | global pnfMap |
| 804 | pnfMap.add(nodename) |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 805 | headStr = """ |
| 806 | { |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 807 | "event": { |
| 808 | "commonEventHeader": { |
| 809 | "startEpochMicrosec": 8745745764578, |
| 810 | "eventId": "FileReady_1797490e-10ae-4d48-9ea7-3d7d790b25e1", |
| 811 | "timeZoneOffset": "UTC+05.30", |
| 812 | "internalHeaderFields": { |
| 813 | "collectorTimeStamp": "Tue, 09 18 2018 10:56:52 UTC" |
| 814 | }, |
| 815 | "priority": "Normal", |
| 816 | "version": "4.0.1", |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 817 | "reportingEntityName": \"""" + nodename + """", |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 818 | "sequence": 0, |
| 819 | "domain": "notification", |
| 820 | "lastEpochMicrosec": 8745745764578, |
| 821 | "eventName": "Noti_RnNode-Ericsson_FileReady", |
| 822 | "vesEventListenerVersion": "7.0.1", |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 823 | "sourceName": \"""" + nodename + """" |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 824 | }, |
| 825 | "notificationFields": { |
| 826 | "notificationFieldsVersion": "2.0", |
| 827 | "changeType": "FileReady", |
| 828 | "changeIdentifier": "PM_MEAS_FILES", |
| 829 | "arrayOfNamedHashMap": [ |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 830 | """ |
| 831 | return headStr |
| 832 | |
| 833 | # Function to build the variable part of an event |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 834 | def getEventName(fn,type,user,passwd): |
| 835 | port = SFTP_PORT |
| 836 | ip = sftp_ip |
| 837 | if (type == "ftps"): |
| 838 | port = FTPS_PORT |
| 839 | ip = ftps_ip |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 840 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 841 | nameStr = """{ |
| 842 | "name": \"""" + fn + """", |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 843 | "hashMap": { |
| 844 | "fileFormatType": "org.3GPP.32.435#measCollec", |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 845 | "location": \"""" + type + """://""" + user + """:""" + passwd + """@""" + ip + """:""" + str(port) + """/""" + fn + """", |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 846 | "fileFormatVersion": "V10", |
| 847 | "compression": "gzip" |
| 848 | } |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 849 | } """ |
| 850 | return nameStr |
| 851 | |
| 852 | # Function to build fixed end of an event |
| 853 | def getEventEnd(): |
| 854 | endStr = """ |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 855 | ] |
| 856 | } |
| 857 | } |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 858 | } |
| 859 | """ |
| 860 | return endStr |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 861 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 862 | # Function to build an OK reponse from a message string |
| 863 | def buildOkResponse(msg): |
| 864 | response = app.response_class( |
| 865 | response=str.encode(msg), |
| 866 | status=200, |
| 867 | mimetype='application/json') |
| 868 | return response |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 869 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 870 | # Function to build an empty message with status |
| 871 | def buildEmptyResponse(status_code): |
| 872 | response = app.response_class( |
| 873 | response=str.encode(""), |
| 874 | status=status_code, |
| 875 | mimetype='application/json') |
| 876 | return response |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 877 | |
| 878 | |
| 879 | if __name__ == "__main__": |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 880 | |
| 881 | # IP addresses to use for ftp servers, using localhost if not env var is set |
| 882 | sftp_ip = os.environ.get('SFTP_SIM_IP', 'localhost') |
| 883 | ftps_ip = os.environ.get('FTPS_SIM_IP', 'localhost') |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 884 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 885 | #Counters |
| 886 | ctr_responses = 0 |
| 887 | ctr_requests = 0 |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 888 | ctr_files=0 |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 889 | ctr_unique_files = 0 |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 890 | ctr_events = 0 |
| 891 | startTime = time.time() |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 892 | firstPollTime = 0 |
| 893 | runningState = "Started" |
| 894 | rop_counter = 0 |
| 895 | rop_timestamp = time.time() |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 896 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 897 | #Keeps all responded file names |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 898 | fileMap = {} |
| 899 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 900 | #Keeps all responded PNF names |
| 901 | pnfMap = set() |
| 902 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 903 | tc_num = "Not set" |
| 904 | tc_help = "Not set" |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 905 | |
| 906 | parser = argparse.ArgumentParser() |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 907 | |
| 908 | #SFTP TCs with single ME |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 909 | parser.add_argument( |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 910 | '--tc100', |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 911 | action='store_true', |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 912 | help='TC100 - One ME, SFTP, 1 1MB file, 1 event') |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 913 | parser.add_argument( |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 914 | '--tc101', |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 915 | action='store_true', |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 916 | help='TC101 - One ME, SFTP, 1 5MB file, 1 event') |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 917 | parser.add_argument( |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 918 | '--tc102', |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 919 | action='store_true', |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 920 | help='TC102 - One ME, SFTP, 1 50MB file, 1 event') |
| 921 | |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 922 | parser.add_argument( |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 923 | '--tc110', |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 924 | action='store_true', |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 925 | help='TC110 - One ME, SFTP, 1MB files, 1 file per event, 100 events, 1 event per poll.') |
| 926 | parser.add_argument( |
| 927 | '--tc111', |
| 928 | action='store_true', |
| 929 | help='TC111 - One ME, SFTP, 1MB files, 100 files per event, 100 events, 1 event per poll.') |
| 930 | parser.add_argument( |
| 931 | '--tc112', |
| 932 | action='store_true', |
| 933 | help='TC112 - One ME, SFTP, 5MB files, 100 files per event, 100 events, 1 event per poll.') |
| 934 | parser.add_argument( |
| 935 | '--tc113', |
| 936 | action='store_true', |
| 937 | help='TC113 - One ME, SFTP, 1MB files, 100 files per event, 100 events. All events in one poll.') |
| 938 | |
| 939 | parser.add_argument( |
| 940 | '--tc120', |
| 941 | action='store_true', |
| 942 | 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') |
| 943 | parser.add_argument( |
| 944 | '--tc121', |
| 945 | action='store_true', |
| 946 | help='TC121 - One ME, SFTP, 1MB files, 100 files per event, 100 events, 1 event per poll. 10% missing files') |
| 947 | parser.add_argument( |
| 948 | '--tc122', |
| 949 | action='store_true', |
| 950 | help='TC122 - One ME, SFTP, 1MB files, 100 files per event, 100 events. 1 event per poll. All files with identical name. ') |
| 951 | |
| 952 | parser.add_argument( |
| 953 | '--tc1000', |
| 954 | action='store_true', |
| 955 | help='TC1000 - One ME, SFTP, 1MB files, 100 files per event, endless number of events, 1 event per poll') |
| 956 | parser.add_argument( |
| 957 | '--tc1001', |
| 958 | action='store_true', |
| 959 | help='TC1001 - One ME, SFTP, 5MB files, 100 files per event, endless number of events, 1 event per poll') |
| 960 | |
| 961 | # SFTP TCs with multiple MEs |
| 962 | parser.add_argument( |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 963 | '--tc500', |
| 964 | action='store_true', |
| 965 | help='TC500 - 700 MEs, SFTP, 1MB files, 2 new files per event, 700 events, all event in one poll.') |
| 966 | |
| 967 | parser.add_argument( |
| 968 | '--tc501', |
| 969 | action='store_true', |
| 970 | help='TC501 - 700 MEs, SFTP, 5MB files, 2 new files per event, 700 events, all event in one poll.') |
| 971 | |
| 972 | parser.add_argument( |
| 973 | '--tc502', |
| 974 | action='store_true', |
| 975 | help='TC502 - 700 MEs, SFTP, 50MB files, 2 new files per event, 700 events, all event in one poll.') |
| 976 | |
| 977 | parser.add_argument( |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 978 | '--tc510', |
| 979 | action='store_true', |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 980 | 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] | 981 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 982 | parser.add_argument( |
| 983 | '--tc511', |
| 984 | action='store_true', |
| 985 | 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] | 986 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 987 | parser.add_argument( |
| 988 | '--tc710', |
| 989 | action='store_true', |
| 990 | 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] | 991 | |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 992 | parser.add_argument( |
| 993 | '--tc1100', |
| 994 | action='store_true', |
| 995 | help='TC1100 - 700 ME, SFTP, 1MB files, 100 files per event, endless number of events, 35 event per poll') |
| 996 | parser.add_argument( |
| 997 | '--tc1101', |
| 998 | action='store_true', |
| 999 | help='TC1101 - 700 ME, SFTP, 5MB files, 100 files per event, endless number of events, 35 event per poll') |
| 1000 | parser.add_argument( |
| 1001 | '--tc1102', |
| 1002 | action='store_true', |
| 1003 | help='TC1102 - 700 ME, SFTP, 50MB files, 100 files per event, endless number of events, 35 event per poll') |
| 1004 | |
| 1005 | parser.add_argument( |
| 1006 | '--tc1200', |
| 1007 | action='store_true', |
| 1008 | help='TC1200 - 700 ME, SFTP, 1MB files, 100 new files per event, endless number of events, 35 event per poll') |
| 1009 | parser.add_argument( |
| 1010 | '--tc1201', |
| 1011 | action='store_true', |
| 1012 | help='TC1201 - 700 ME, SFTP, 5MB files, 100 new files per event, endless number of events, 35 event per poll') |
| 1013 | parser.add_argument( |
| 1014 | '--tc1202', |
| 1015 | action='store_true', |
| 1016 | help='TC1202 - 700 ME, SFTP, 50MB files, 100 new files per event, endless number of events, 35 event per poll') |
| 1017 | |
| 1018 | parser.add_argument( |
| 1019 | '--tc1300', |
| 1020 | action='store_true', |
| 1021 | help='TC1300 - 700 ME, SFTP, 1MB files, 100 files per event, endless number of events, 35 event per poll, 20 event polls every 15min') |
| 1022 | parser.add_argument( |
| 1023 | '--tc1301', |
| 1024 | action='store_true', |
| 1025 | help='TC1301 - 700 ME, SFTP, 5MB files, 100 files per event, endless number of events, 35 event per poll, 20 event polls every 15min') |
| 1026 | parser.add_argument( |
| 1027 | '--tc1302', |
| 1028 | action='store_true', |
| 1029 | help='TC1302 - 700 ME, SFTP, 50MB files, 100 files per event, endless number of events, 35 event per poll, 20 event polls every 15min') |
| 1030 | |
| 1031 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1032 | # FTPS TCs with single ME |
| 1033 | parser.add_argument( |
| 1034 | '--tc200', |
| 1035 | action='store_true', |
| 1036 | help='TC200 - One ME, FTPS, 1 1MB file, 1 event') |
| 1037 | parser.add_argument( |
| 1038 | '--tc201', |
| 1039 | action='store_true', |
| 1040 | help='TC201 - One ME, FTPS, 1 5MB file, 1 event') |
| 1041 | parser.add_argument( |
| 1042 | '--tc202', |
| 1043 | action='store_true', |
| 1044 | help='TC202 - One ME, FTPS, 1 50MB file, 1 event') |
| 1045 | |
| 1046 | parser.add_argument( |
| 1047 | '--tc210', |
| 1048 | action='store_true', |
| 1049 | help='TC210 - One ME, FTPS, 1MB files, 1 file per event, 100 events, 1 event per poll.') |
| 1050 | parser.add_argument( |
| 1051 | '--tc211', |
| 1052 | action='store_true', |
| 1053 | help='TC211 - One ME, FTPS, 1MB files, 100 files per event, 100 events, 1 event per poll.') |
| 1054 | parser.add_argument( |
| 1055 | '--tc212', |
| 1056 | action='store_true', |
| 1057 | help='TC212 - One ME, FTPS, 5MB files, 100 files per event, 100 events, 1 event per poll.') |
| 1058 | parser.add_argument( |
| 1059 | '--tc213', |
| 1060 | action='store_true', |
| 1061 | help='TC213 - One ME, FTPS, 1MB files, 100 files per event, 100 events. All events in one poll.') |
| 1062 | |
| 1063 | parser.add_argument( |
| 1064 | '--tc220', |
| 1065 | action='store_true', |
| 1066 | 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') |
| 1067 | parser.add_argument( |
| 1068 | '--tc221', |
| 1069 | action='store_true', |
| 1070 | help='TC221 - One ME, FTPS, 1MB files, 100 files per event, 100 events, 1 event per poll. 10% missing files') |
| 1071 | parser.add_argument( |
| 1072 | '--tc222', |
| 1073 | action='store_true', |
| 1074 | help='TC222 - One ME, FTPS, 1MB files, 100 files per event, 100 events. 1 event per poll. All files with identical name. ') |
| 1075 | |
| 1076 | parser.add_argument( |
| 1077 | '--tc2000', |
| 1078 | action='store_true', |
| 1079 | help='TC2000 - One ME, FTPS, 1MB files, 100 files per event, endless number of events, 1 event per poll') |
| 1080 | parser.add_argument( |
| 1081 | '--tc2001', |
| 1082 | action='store_true', |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1083 | help='TC2001 - One ME, FTPS, 5MB files, 100 files per event, endless number of events, 1 event per poll') |
| 1084 | |
| 1085 | |
| 1086 | parser.add_argument( |
| 1087 | '--tc2100', |
| 1088 | action='store_true', |
| 1089 | help='TC2100 - 700 ME, FTPS, 1MB files, 100 files per event, endless number of events, 35 event per poll') |
| 1090 | parser.add_argument( |
| 1091 | '--tc2101', |
| 1092 | action='store_true', |
| 1093 | help='TC2101 - 700 ME, FTPS, 5MB files, 100 files per event, endless number of events, 35 event per poll') |
| 1094 | parser.add_argument( |
| 1095 | '--tc2102', |
| 1096 | action='store_true', |
| 1097 | help='TC2102 - 700 ME, FTPS, 50MB files, 100 files per event, endless number of events, 35 event per poll') |
| 1098 | |
| 1099 | parser.add_argument( |
| 1100 | '--tc2200', |
| 1101 | action='store_true', |
| 1102 | help='TC2200 - 700 ME, FTPS, 1MB files, 100 new files per event, endless number of events, 35 event per poll') |
| 1103 | parser.add_argument( |
| 1104 | '--tc2201', |
| 1105 | action='store_true', |
| 1106 | help='TC2201 - 700 ME, FTPS, 5MB files, 100 new files per event, endless number of events, 35 event per poll') |
| 1107 | parser.add_argument( |
| 1108 | '--tc2202', |
| 1109 | action='store_true', |
| 1110 | help='TC2202 - 700 ME, FTPS, 50MB files, 100 new files per event, endless number of events, 35 event per poll') |
| 1111 | |
| 1112 | parser.add_argument( |
| 1113 | '--tc2300', |
| 1114 | action='store_true', |
| 1115 | help='TC2300 - 700 ME, FTPS, 1MB files, 100 files per event, endless number of events, 35 event per poll, 20 event polls every 15min') |
| 1116 | parser.add_argument( |
| 1117 | '--tc2301', |
| 1118 | action='store_true', |
| 1119 | help='TC2301 - 700 ME, FTPS, 5MB files, 100 files per event, endless number of events, 35 event per poll, 20 event polls every 15min') |
| 1120 | parser.add_argument( |
| 1121 | '--tc2302', |
| 1122 | action='store_true', |
| 1123 | help='TC2302 - 700 ME, FTPS, 50MB files, 100 files per event, endless number of events, 35 event per poll, 20 event polls every 15min') |
| 1124 | |
| 1125 | parser.add_argument( |
| 1126 | '--tc600', |
| 1127 | action='store_true', |
| 1128 | help='TC600 - 700 MEs, FTPS, 1MB files, 2 new files per event, 700 events, all event in one poll.') |
| 1129 | |
| 1130 | parser.add_argument( |
| 1131 | '--tc601', |
| 1132 | action='store_true', |
| 1133 | help='TC601 - 700 MEs, FTPS, 5MB files, 2 new files per event, 700 events, all event in one poll.') |
| 1134 | |
| 1135 | parser.add_argument( |
| 1136 | '--tc602', |
| 1137 | action='store_true', |
| 1138 | 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] | 1139 | |
| 1140 | parser.add_argument( |
| 1141 | '--tc610', |
| 1142 | action='store_true', |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1143 | help='TC610 - 700 MEs, FTPS, 1MB files, 1 file per event, 3500 events, 700 event per poll.') |
| 1144 | |
| 1145 | parser.add_argument( |
| 1146 | '--tc611', |
| 1147 | action='store_true', |
| 1148 | help='TC611 - 700 MEs, FTPS, 1KB files, 1 file per event, 3500 events, 700 event per poll.') |
| 1149 | |
| 1150 | parser.add_argument( |
| 1151 | '--tc810', |
| 1152 | action='store_true', |
| 1153 | 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] | 1154 | |
| 1155 | args = parser.parse_args() |
| 1156 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1157 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1158 | |
| 1159 | if args.tc100: |
| 1160 | tc_num = "TC# 100" |
| 1161 | elif args.tc101: |
| 1162 | tc_num = "TC# 101" |
| 1163 | elif args.tc102: |
| 1164 | tc_num = "TC# 102" |
| 1165 | |
| 1166 | elif args.tc110: |
| 1167 | tc_num = "TC# 110" |
| 1168 | elif args.tc111: |
| 1169 | tc_num = "TC# 111" |
| 1170 | elif args.tc112: |
| 1171 | tc_num = "TC# 112" |
| 1172 | elif args.tc113: |
| 1173 | tc_num = "TC# 113" |
| 1174 | |
| 1175 | elif args.tc120: |
| 1176 | tc_num = "TC# 120" |
| 1177 | elif args.tc121: |
| 1178 | tc_num = "TC# 121" |
| 1179 | elif args.tc122: |
| 1180 | tc_num = "TC# 122" |
| 1181 | |
| 1182 | elif args.tc1000: |
| 1183 | tc_num = "TC# 1000" |
| 1184 | elif args.tc1001: |
| 1185 | tc_num = "TC# 1001" |
| 1186 | |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1187 | elif args.tc1100: |
| 1188 | tc_num = "TC# 1100" |
| 1189 | elif args.tc1101: |
| 1190 | tc_num = "TC# 1101" |
| 1191 | elif args.tc1102: |
| 1192 | tc_num = "TC# 1102" |
| 1193 | elif args.tc1200: |
| 1194 | tc_num = "TC# 1200" |
| 1195 | elif args.tc1201: |
| 1196 | tc_num = "TC# 1201" |
| 1197 | elif args.tc1202: |
| 1198 | tc_num = "TC# 1202" |
| 1199 | elif args.tc1300: |
| 1200 | tc_num = "TC# 1300" |
| 1201 | elif args.tc1301: |
| 1202 | tc_num = "TC# 1301" |
| 1203 | elif args.tc1302: |
| 1204 | tc_num = "TC# 1302" |
| 1205 | |
| 1206 | elif args.tc500: |
| 1207 | tc_num = "TC# 500" |
| 1208 | elif args.tc501: |
| 1209 | tc_num = "TC# 501" |
| 1210 | elif args.tc502: |
| 1211 | tc_num = "TC# 502" |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1212 | elif args.tc510: |
| 1213 | tc_num = "TC# 510" |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1214 | elif args.tc511: |
| 1215 | tc_num = "TC# 511" |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1216 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1217 | elif args.tc710: |
| 1218 | tc_num = "TC# 710" |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1219 | |
| 1220 | elif args.tc200: |
| 1221 | tc_num = "TC# 200" |
| 1222 | elif args.tc201: |
| 1223 | tc_num = "TC# 201" |
| 1224 | elif args.tc202: |
| 1225 | tc_num = "TC# 202" |
| 1226 | |
| 1227 | elif args.tc210: |
| 1228 | tc_num = "TC# 210" |
| 1229 | elif args.tc211: |
| 1230 | tc_num = "TC# 211" |
| 1231 | elif args.tc212: |
| 1232 | tc_num = "TC# 212" |
| 1233 | elif args.tc213: |
| 1234 | tc_num = "TC# 213" |
| 1235 | |
| 1236 | elif args.tc220: |
| 1237 | tc_num = "TC# 220" |
| 1238 | elif args.tc221: |
| 1239 | tc_num = "TC# 221" |
| 1240 | elif args.tc222: |
| 1241 | tc_num = "TC# 222" |
| 1242 | |
| 1243 | elif args.tc2000: |
| 1244 | tc_num = "TC# 2000" |
| 1245 | elif args.tc2001: |
| 1246 | tc_num = "TC# 2001" |
| 1247 | |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1248 | elif args.tc2100: |
| 1249 | tc_num = "TC# 2100" |
| 1250 | elif args.tc2101: |
| 1251 | tc_num = "TC# 2101" |
| 1252 | elif args.tc2102: |
| 1253 | tc_num = "TC# 2102" |
| 1254 | elif args.tc2200: |
| 1255 | tc_num = "TC# 2200" |
| 1256 | elif args.tc2201: |
| 1257 | tc_num = "TC# 2201" |
| 1258 | elif args.tc2202: |
| 1259 | tc_num = "TC# 2202" |
| 1260 | elif args.tc2300: |
| 1261 | tc_num = "TC# 2300" |
| 1262 | elif args.tc2301: |
| 1263 | tc_num = "TC# 2301" |
| 1264 | elif args.tc2302: |
| 1265 | tc_num = "TC# 2302" |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1266 | |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1267 | elif args.tc600: |
| 1268 | tc_num = "TC# 600" |
| 1269 | elif args.tc601: |
| 1270 | tc_num = "TC# 601" |
| 1271 | elif args.tc602: |
| 1272 | tc_num = "TC# 602" |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1273 | elif args.tc610: |
| 1274 | tc_num = "TC# 610" |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1275 | elif args.tc611: |
| 1276 | tc_num = "TC# 611" |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1277 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1278 | elif args.tc810: |
| 1279 | tc_num = "TC# 810" |
TamasBakai | 9b78033 | 2019-02-15 08:38:16 +0000 | [diff] [blame] | 1280 | |
| 1281 | else: |
| 1282 | print("No TC was defined") |
| 1283 | print("use --help for usage info") |
| 1284 | sys.exit() |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1285 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1286 | print("TC num: " + tc_num) |
BjornMagnussonXA | 42dcb26 | 2019-04-26 19:29:54 +0000 | [diff] [blame] | 1287 | |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1288 | print("Using " + sftp_ip + " for sftp server address in file urls.") |
| 1289 | print("Using " + ftps_ip + " for ftps server address in file urls.") |
| 1290 | |
BjornMagnussonXA | f8b34f0 | 2019-03-22 09:48:38 +0000 | [diff] [blame] | 1291 | app.run(port=HOST_PORT, host=HOST_IP) |
BjornMagnussonXA | f4e1836 | 2019-04-10 13:04:08 +0000 | [diff] [blame] | 1292 | |