Remove compass4nfv weekly danube job
[releng.git] / utils / test / testapi / opnfv_testapi / models / result_models.py
1 ##############################################################################
2 # Copyright (c) 2015 Orange
3 # guyrodrigue.koffi@orange.com / koffirodrigue@gmail.com
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
9 from opnfv_testapi.models import base_models
10 from opnfv_testapi.tornado_swagger import swagger
11
12
13 @swagger.model()
14 class TIHistory(base_models.ModelBase):
15     """
16         @ptype step: L{float}
17     """
18     def __init__(self, date=None, step=0):
19         self.date = date
20         self.step = step
21
22
23 @swagger.model()
24 class TI(base_models.ModelBase):
25     """
26         @property histories: trust_indicator update histories
27         @ptype histories: C{list} of L{TIHistory}
28         @ptype current: L{float}
29     """
30     def __init__(self, current=0):
31         self.current = current
32         self.histories = list()
33
34     @staticmethod
35     def attr_parser():
36         return {'histories': TIHistory}
37
38
39 @swagger.model()
40 class ResultCreateRequest(base_models.ModelBase):
41     """
42         @property trust_indicator:
43         @ptype trust_indicator: L{TI}
44     """
45     def __init__(self,
46                  pod_name=None,
47                  project_name=None,
48                  case_name=None,
49                  installer=None,
50                  version=None,
51                  start_date=None,
52                  stop_date=None,
53                  details=None,
54                  build_tag=None,
55                  scenario=None,
56                  criteria=None,
57                  user=None,
58                  public="true",
59                  trust_indicator=None):
60         self.pod_name = pod_name
61         self.project_name = project_name
62         self.case_name = case_name
63         self.installer = installer
64         self.version = version
65         self.start_date = start_date
66         self.stop_date = stop_date
67         self.details = details
68         self.build_tag = build_tag
69         self.scenario = scenario
70         self.criteria = criteria
71         self.user = user
72         self.public = public
73         self.trust_indicator = trust_indicator if trust_indicator else TI(0)
74
75
76 @swagger.model()
77 class ResultUpdateRequest(base_models.ModelBase):
78     """
79         @property trust_indicator:
80         @ptype trust_indicator: L{TI}
81     """
82     def __init__(self, trust_indicator=None):
83         self.trust_indicator = trust_indicator
84
85
86 @swagger.model()
87 class TestResult(base_models.ModelBase):
88     """
89         @property trust_indicator: used for long duration test case
90         @ptype trust_indicator: L{TI}
91     """
92     def __init__(self, _id=None, case_name=None, project_name=None,
93                  pod_name=None, installer=None, version=None,
94                  start_date=None, stop_date=None, details=None,
95                  build_tag=None, scenario=None, criteria=None,
96                  user=None, public="true", trust_indicator=None):
97         self._id = _id
98         self.case_name = case_name
99         self.project_name = project_name
100         self.pod_name = pod_name
101         self.installer = installer
102         self.version = version
103         self.start_date = start_date
104         self.stop_date = stop_date
105         self.details = details
106         self.build_tag = build_tag
107         self.scenario = scenario
108         self.criteria = criteria
109         self.user = user
110         self.public = public
111         self.trust_indicator = trust_indicator
112
113     @staticmethod
114     def attr_parser():
115         return {'trust_indicator': TI}
116
117
118 @swagger.model()
119 class TestResults(base_models.ModelBase):
120     """
121         @property results:
122         @ptype results: C{list} of L{TestResult}
123     """
124     def __init__(self):
125         self.results = list()
126
127     @staticmethod
128     def attr_parser():
129         return {'results': TestResult}