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.resources import models
10 from opnfv_testapi.tornado_swagger import swagger
14 class TIHistory(models.ModelBase):
18 def __init__(self, date=None, step=0):
24 class TI(models.ModelBase):
26 @property histories: trust_indicator update histories
27 @ptype histories: C{list} of L{TIHistory}
28 @ptype current: L{float}
30 def __init__(self, current=0):
31 self.current = current
32 self.histories = list()
36 return {'histories': TIHistory}
40 class ResultCreateRequest(models.ModelBase):
42 @property trust_indicator:
43 @ptype trust_indicator: L{TI}
57 trust_indicator=None):
58 self.pod_name = pod_name
59 self.project_name = project_name
60 self.case_name = case_name
61 self.installer = installer
62 self.version = version
63 self.start_date = start_date
64 self.stop_date = stop_date
65 self.details = details
66 self.build_tag = build_tag
67 self.scenario = scenario
68 self.criteria = criteria
69 self.trust_indicator = trust_indicator if trust_indicator else TI(0)
73 class ResultUpdateRequest(models.ModelBase):
75 @property trust_indicator:
76 @ptype trust_indicator: L{TI}
78 def __init__(self, trust_indicator=None):
79 self.trust_indicator = trust_indicator
83 class TestResult(models.ModelBase):
85 @property trust_indicator: used for long duration test case
86 @ptype trust_indicator: L{TI}
88 def __init__(self, _id=None, case_name=None, project_name=None,
89 pod_name=None, installer=None, version=None,
90 start_date=None, stop_date=None, details=None,
91 build_tag=None, scenario=None, criteria=None,
92 trust_indicator=None):
94 self.case_name = case_name
95 self.project_name = project_name
96 self.pod_name = pod_name
97 self.installer = installer
98 self.version = version
99 self.start_date = start_date
100 self.stop_date = stop_date
101 self.details = details
102 self.build_tag = build_tag
103 self.scenario = scenario
104 self.criteria = criteria
105 self.trust_indicator = trust_indicator
109 return {'trust_indicator': TI}
113 class TestResults(models.ModelBase):
116 @ptype results: C{list} of L{TestResult}
119 self.results = list()
123 return {'results': TestResult}