aboutsummaryrefslogtreecommitdiffstats
path: root/test/mocks/datafilecollector-testharness/mr-sim
diff options
context:
space:
mode:
Diffstat (limited to 'test/mocks/datafilecollector-testharness/mr-sim')
-rw-r--r--test/mocks/datafilecollector-testharness/mr-sim/README.md8
-rw-r--r--test/mocks/datafilecollector-testharness/mr-sim/mr-sim.py68
2 files changed, 72 insertions, 4 deletions
diff --git a/test/mocks/datafilecollector-testharness/mr-sim/README.md b/test/mocks/datafilecollector-testharness/mr-sim/README.md
index a8d2b7aaa..11f53df95 100644
--- a/test/mocks/datafilecollector-testharness/mr-sim/README.md
+++ b/test/mocks/datafilecollector-testharness/mr-sim/README.md
@@ -33,7 +33,9 @@ The following envrionment vaiables are used:
- **FTPES_SIMS** - A comma-separated list of hostname:port for the FTP servers to generate ftpes file urls for. If not set MR sim will assume 'localhost:21'. Minimum 1 and maximum 5 host-port pairs can be given.
- **SFTP_SIMS** - A comma-separated list of hostname:port for the FTP servers to generate sftp file urls for. If not set MR sim will assume 'localhost:1022'. Minimum 1 and maximum 5 host-port pairs can be given.
- **HTTP_SIMS** - A comma-separated list of hostname:port for the HTTP servers to generate http file urls for. If not set MR sim will assume 'localhost:81'. Minimum 1 and maximum 5 host-port pairs can be given.
+- **HTTP_JWT_SIMS** - A comma-separated list of hostname:port for the HTTP servers (using JWT token for authentication) to generate http file urls for. If not set MR sim will assume 'localhost:32000'. Minimum 1 and maximum 5 host-port pairs can be given.
- **HTTPS_SIMS** - A comma-separated list of hostname:port for the HTTPS servers (configured for client certificate authentication and basic authentication; certificates were obtained using CMPv2 server) to generate http file urls for. If not set MR sim will assume 'localhost:444'. Minimum 1 and maximum 5 host-port pairs can be given.
+- **HTTPS_JWT_SIMS** - A comma-separated list of hostname:port for the HTTPS servers (using JWT token for authentication) to generate http file urls for. If not set MR sim will assume 'localhost:32100'. Minimum 1 and maximum 5 host-port pairs can be given.
- **HTTPS_SIMS_NO_AUTH** - A comma-separated list of hostname:port for the HTTPS servers with no autorization to generate http file urls for. If not set MR sim will assume 'localhost:8081'. Minimum 1 and maximum 5 host-port pairs can be given.
- **NUM_FTP_SERVERS** - Number of FTP servers to use out of those specified in the envrioment variables above. The number shall be in the range 1-5.
- **NUM_HTTP_SERVERS** - Number of HTTP/HTTPS/HTTPS with no authorization servers to use out of those specified in the envrioment variables above. The number shall be in the range 1-5.
@@ -183,7 +185,7 @@ Changing the first digit in tc number will change the test case to run FTPES or
TC2XX is same as TC1XX but with FTPES, TC3XX is same as TC1XX but with HTTP, TC4XX is same as TC1XX but with HTTPS
(with basic authorization). Note, in the case of HTTPS, some tests may not have direct correspondence in FTP tests
-(TC403, TC404 described in the end of this section).
+(TC303, TC403, TC404, TC405 described in the end of this section).
TC6XX is same as TC5XX but with FTPES
@@ -191,10 +193,14 @@ TC8XX is same as TC7XX but with FTPES
TC2XXX is same as TC1XXX but with FTPES
+TC303 - One ME, HTTP with JWT authentication, 1 1MB file, 1 event
+
TC403 - One ME, HTTPS with client certificate authentication, 1 1MB file, 1 event
TC404 - One ME, HTTPS with no client authentication, 1 1MB file, 1 event
+TC405 - One ME, HTTPS with JWT authentication, 1 1MB file, 1 event
+
## Developer workflow
1. `sudo apt install python3-venv`
diff --git a/test/mocks/datafilecollector-testharness/mr-sim/mr-sim.py b/test/mocks/datafilecollector-testharness/mr-sim/mr-sim.py
index 323dde618..cdf9bad4a 100644
--- a/test/mocks/datafilecollector-testharness/mr-sim/mr-sim.py
+++ b/test/mocks/datafilecollector-testharness/mr-sim/mr-sim.py
@@ -30,8 +30,12 @@ ftpes_hosts = []
ftpes_ports = []
http_hosts = []
http_ports = []
+http_jwt_hosts = []
+http_jwt_ports = []
https_hosts = []
https_ports = []
+https_jwt_hosts = []
+https_jwt_ports = []
https_hosts_no_auth = []
https_ports_no_auth = []
num_ftp_servers = 1
@@ -538,6 +542,8 @@ def MR_reply(consumerGroup, consumerId):
return tc100(groupIndex, changeId, filePrefix, "http", "5MB")
elif args.tc302:
return tc100(groupIndex, changeId, filePrefix, "http", "50MB")
+ elif args.tc303:
+ return tc100(groupIndex, changeId, filePrefix, "httpJWT", "1MB")
elif args.tc400:
return tc100(groupIndex, changeId, filePrefix, "https", "1MB")
@@ -549,6 +555,8 @@ def MR_reply(consumerGroup, consumerId):
return tc100(groupIndex, changeId, filePrefix, "httpsCAuth", "1MB")
elif args.tc404:
return tc100(groupIndex, changeId, filePrefix, "httpsNoAuth", "1MB")
+ elif args.tc405:
+ return tc100(groupIndex, changeId, filePrefix, "httpsJWT", "1MB")
#### Test case functions
@@ -573,6 +581,9 @@ def tc100(groupIndex, changeId, filePrefix, schemeType, fileSize):
or (schemeType == "httpsCAuth") or (schemeType == "httpsNoAuth"):
msg = getEventHead(groupIndex, changeId, nodeName) + getEventName(fileName, schemeType, "demo", "demo123456!",
nodeIndex) + getEventEnd()
+ if (schemeType == "httpJWT") or (schemeType == "httpsJWT"):
+ msg = getEventHead(groupIndex, changeId, nodeName) + getEventName(fileName, schemeType, "", "",
+ nodeIndex) + getEventEnd()
fileMap[groupIndex][seqNr * hash(filePrefix)] = seqNr
ctr_events[groupIndex] = ctr_events[groupIndex] + 1
return buildOkResponse("[" + msg + "]")
@@ -1220,6 +1231,7 @@ def getEventName(fn, type, user, passwd, nodeIndex):
port = sftp_ports[nodeIndex]
ip = sftp_hosts[nodeIndex]
location_variant = type + """://""" + user + """:""" + passwd + """@""" + ip + """:""" + str(port)
+ token = ""
if type == "ftpes":
port = ftpes_ports[nodeIndex]
ip = ftpes_hosts[nodeIndex]
@@ -1229,11 +1241,25 @@ def getEventName(fn, type, user, passwd, nodeIndex):
port = http_ports[nodeIndex]
ip = http_hosts[nodeIndex]
location_variant = type + """://""" + user + """:""" + passwd + """@""" + ip + """:""" + str(port)
+ elif type == "httpJWT":
+ alt_type = "http"
+ nodeIndex = nodeIndex % num_http_servers
+ port = http_jwt_ports[nodeIndex]
+ ip = http_jwt_hosts[nodeIndex]
+ location_variant = alt_type + """://""" + ip + """:""" + str(port)
+ token = "?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwidXNlciI6Imp3dFVzZXIiLCJpc3MiOiJvbmFwIiwiaWF0IjoxNTE2MjM5MDIyLCJleHAiOjk5OTk5OTk5OTksIm5iZiI6MTUxNjIzOTAyMn0.dZUtnGlr6Z42MehhZTGHYSVFaAggRjob9GyvnGpEc6o"
elif type == "https":
nodeIndex = nodeIndex % num_http_servers
port = https_ports[nodeIndex]
ip = https_hosts[nodeIndex]
location_variant = type + """://""" + user + """:""" + passwd + """@""" + ip + """:""" + str(port)
+ elif type == "httpsJWT":
+ alt_type = "https"
+ nodeIndex = nodeIndex % num_http_servers
+ port = https_jwt_ports[nodeIndex]
+ ip = https_jwt_hosts[nodeIndex]
+ location_variant = alt_type + """://""" + ip + """:""" + str(port)
+ token = "?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJkZW1vIiwiaWF0IjoxNTE2MjM5MDIyLCJleHAiOjk5OTk5OTk5OTksIm5iZiI6MTUxNjIzOTAyMH0.vyktOJyCMVvJXEfImBuZCTaEifrvH0kXeAPpnHakffA"
elif type == "httpsCAuth":
alt_type = "https"
port = https_ports[nodeIndex]
@@ -1249,7 +1275,7 @@ def getEventName(fn, type, user, passwd, nodeIndex):
"name": \"""" + fn + """",
"hashMap": {
"fileFormatType": "org.3GPP.32.435#measCollec",
- "location": \"""" + location_variant + """/""" + fn + """",
+ "location": \"""" + location_variant + """/""" + fn + token + """",
"fileFormatVersion": "V10",
"compression": "gzip"
}
@@ -1292,18 +1318,22 @@ if __name__ == "__main__":
sftp_sims = os.environ.get('SFTP_SIMS', 'localhost:1022')
ftpes_sims = os.environ.get('FTPES_SIMS', 'localhost:21')
http_sims = os.environ.get('HTTP_SIMS', 'localhost:81')
+ http_jwt_sims = os.environ.get('HTTP_JWT_SIMS', 'localhost:32000')
https_sims = os.environ.get('HTTPS_SIMS', 'localhost:444')
https_sims_no_auth = os.environ.get('HTTPS_SIMS_NO_AUTH', 'localhost:8081')
+ https_jwt_sims = os.environ.get('HTTPS_JWT_SIMS', 'localhost:32100')
num_ftp_servers = int(os.environ.get('NUM_FTP_SERVERS', 1))
num_http_servers = int(os.environ.get('NUM_HTTP_SERVERS', 1))
print("Configured sftp sims: " + sftp_sims)
print("Configured ftpes sims: " + ftpes_sims)
print("Configured http sims: " + http_sims)
+ print("Configured http JWT sims: " + http_jwt_sims)
print("Configured https sims: " + https_sims)
print("Configured https with no authorization sims: " + https_sims_no_auth)
+ print("Configured https JWT sims: " + https_jwt_sims)
print("Configured number of ftp servers: " + str(num_ftp_servers))
- print("Configured number of http/https/https with no auth servers: " + str(num_http_servers) + " each")
+ print("Configured number of http/https/https with no auth/JWT servers: " + str(num_http_servers) + " each")
tmp = sftp_sims.split(',')
for i in range(len(tmp)):
@@ -1323,12 +1353,24 @@ if __name__ == "__main__":
http_hosts.append(hp[0])
http_ports.append(hp[1])
+ tmp = http_jwt_sims.split(',')
+ for i in range(len(tmp)):
+ hp = tmp[i].split(':')
+ http_jwt_hosts.append(hp[0])
+ http_jwt_ports.append(hp[1])
+
tmp = https_sims.split(',')
for i in range(len(tmp)):
hp = tmp[i].split(':')
https_hosts.append(hp[0])
https_ports.append(hp[1])
+ tmp = https_jwt_sims.split(',')
+ for i in range(len(tmp)):
+ hp = tmp[i].split(':')
+ https_jwt_hosts.append(hp[0])
+ https_jwt_ports.append(hp[1])
+
tmp = https_sims_no_auth.split(',')
for i in range(len(tmp)):
hp = tmp[i].split(':')
@@ -1697,6 +1739,10 @@ if __name__ == "__main__":
'--tc302',
action='store_true',
help='TC302 - One ME, HTTP, 1 50MB file, 1 event')
+ parser.add_argument(
+ '--tc303',
+ action='store_true',
+ help='TC303 - One ME, HTTP JWT, 1 1MB file, 1 event')
# HTTPS TCs with single ME
parser.add_argument(
@@ -1719,6 +1765,10 @@ if __name__ == "__main__":
'--tc404',
action='store_true',
help='TC404 - One ME, HTTPS no client authentication, 1 1MB file, 1 event')
+ parser.add_argument(
+ '--tc405',
+ action='store_true',
+ help='TC405 - One ME, HTTPS JWT, 1 1MB file, 1 event')
args = parser.parse_args()
@@ -1860,6 +1910,8 @@ if __name__ == "__main__":
tc_num = "TC# 301"
elif args.tc302:
tc_num = "TC# 302"
+ elif args.tc303:
+ tc_num = "TC# 303"
elif args.tc400:
tc_num = "TC# 400"
@@ -1871,6 +1923,8 @@ if __name__ == "__main__":
tc_num = "TC# 403"
elif args.tc404:
tc_num = "TC# 404"
+ elif args.tc405:
+ tc_num = "TC# 405"
else:
print("No TC was defined")
@@ -1891,6 +1945,10 @@ if __name__ == "__main__":
print("Using " + str(http_hosts[i]) + ":" + str(http_ports[i]) + " for http server with index " + str(
i) + " for http server address and port in file urls.")
+ for i in range(len(http_jwt_hosts)):
+ print("Using " + str(http_jwt_hosts[i]) + ":" + str(http_jwt_ports[i]) + " for http jwt server with index " + str(
+ i) + " for http jwt server address and port in file urls.")
+
for i in range(len(https_hosts)):
print("Using " + str(https_hosts[i]) + ":" + str(https_ports[i]) + " for https server with index " + str(
i) + " for https server address and port in file urls.")
@@ -1900,9 +1958,13 @@ if __name__ == "__main__":
+ " for https server with no authentication with index " + str(i)
+ " for https server address and port in file urls.")
+ for i in range(len(https_jwt_hosts)):
+ print("Using " + str(https_jwt_hosts[i]) + ":" + str(https_jwt_ports[i]) + " for https jwt server with index " + str(
+ i) + " for https jwt server address and port in file urls.")
+
print("Using up to " + str(num_ftp_servers) + " ftp servers, for each protocol for PNFs.")
print("Using up to " + str(num_http_servers)
- + " http/https/https with no auth servers, for each protocol for PNFs.")
+ + " http/https/https with no auth/jwt servers, for each protocol for PNFs.")
def https_app(**kwargs):