Merge "Create API to get log for each task"
[functest.git] / functest / api / urls.py
1 #!/usr/bin/env python
2
3 # Copyright (c) 2017 Huawei Technologies Co.,Ltd and others.
4 #
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9
10 """
11 Define multiple URLs
12 """
13
14
15 class Url(object):  # pylint: disable=too-few-public-methods
16     """ Url Class """
17
18     def __init__(self, url, target):
19         super(Url, self).__init__()
20         self.url = url
21         self.target = target
22
23
24 URLPATTERNS = [
25     # GET /api/v1/functest/envs => GET environment
26     Url('/api/v1/functest/envs', 'v1_envs'),
27
28     # POST /api/v1/functest/envs/action
29     # {"action":"prepare"} => Prepare environment
30     # {"action":"update_hosts", "args": {}} => Update hosts info
31     Url('/api/v1/functest/envs/action', 'v1_envs'),
32
33     # GET /api/v1/functest/openstack/credentials => GET credentials
34     Url('/api/v1/functest/openstack/credentials', 'v1_creds'),
35
36     # POST /api/v1/functest/openstack/action
37     # {"action":"update_openrc", "args": {"openrc": {}}} => Update openrc
38     Url('/api/v1/functest/openstack/action', 'v1_creds'),
39
40     # GET /api/v1/functest/testcases => GET all testcases
41     Url('/api/v1/functest/testcases', 'v1_test_cases'),
42
43     # GET /api/v1/functest/testcases/<testcase_name>
44     # => GET the info of one testcase
45     Url('/api/v1/functest/testcases/<testcase_name>', 'v1_testcase'),
46
47     # POST /api/v1/functest/testcases/action
48     # {"action":"run_test_case", "args": {"opts": {}, "testcase": "vping_ssh"}}
49     # => Run a testcase
50     Url('/api/v1/functest/testcases/action', 'v1_testcase'),
51
52     # GET /api/v1/functest/testcases => GET all tiers
53     Url('/api/v1/functest/tiers', 'v1_tiers'),
54
55     # GET /api/v1/functest/tiers/<tier_name>
56     # => GET the info of one tier
57     Url('/api/v1/functest/tiers/<tier_name>', 'v1_tier'),
58
59     # GET /api/v1/functest/tiers/<tier_name>/testcases
60     # => GET all testcases within given tier
61     Url('/api/v1/functest/tiers/<tier_name>/testcases',
62         'v1_testcases_in_tier'),
63
64     # GET /api/v1/functest/tasks/<task_id>
65     # => GET the result of the task id
66     Url('/api/v1/functest/tasks/<task_id>', 'v1_task'),
67
68     # GET /api/v1/functest/tasks/<task_id>/log
69     # => GET the log of the task
70     Url('/api/v1/functest/tasks/<task_id>/log', 'v1_task_log')
71 ]