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}
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
73 self.trust_indicator = trust_indicator if trust_indicator else TI(0)
77 class ResultUpdateRequest(models.ModelBase):
79 @property trust_indicator:
80 @ptype trust_indicator: L{TI}
82 def __init__(self, trust_indicator=None):
83 self.trust_indicator = trust_indicator
87 class TestResult(models.ModelBase):
89 @property trust_indicator: used for long duration test case
90 @ptype trust_indicator: L{TI}
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):
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
111 self.trust_indicator = trust_indicator
115 return {'trust_indicator': TI}
119 class TestResults(models.ModelBase):
122 @ptype results: C{list} of L{TestResult}
125 self.results = list()
129 return {'results': TestResult}