aboutsummaryrefslogtreecommitdiffstats
path: root/moonv4/tests/send_authz.py
blob: b4ed1d2fe973351c494a14c2c98697d44220028d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from importlib.machinery import SourceFileLoader
from python_moonclient import config, parse, models, policies, pdp, authz


if __name__ == "__main__":
    args = parse.parse()
    consul_host = args.consul_host
    consul_port = args.consul_port

    models.init(consul_host, consul_port)
    policies.init(consul_host, consul_port)
    pdp.init(consul_host, consul_port)

    if args.filename:
        print("Loading: {}".format(args.filename[0]))
    m = SourceFileLoader("scenario", args.filename[0])
    scenario = m.load_module()

    keystone_project_id = pdp.get_keystone_id(args.pdp)
    time_data = authz.send_requests(
        scenario,
        args.authz_host,
        args.authz_port,
        keystone_project_id,
        request_second=args.request_second,
        limit=args.limit,
        dry_run=args.dry_run,
        stress_test=args.stress_test,
        destination=args.destination
    )
    if not args.dry_run:
        authz.save_data(args.write, time_data)