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.tornado_swagger import swagger
11 # name: name of the POD e.g. zte-1
12 # mode: metal or virtual
14 # role: ci-pod or community-pod or single-node
18 class PodCreateRequest(object):
19 def __init__(self, name, mode='', details='', role=""):
22 self.details = details
29 "details": self.details,
35 class Pod(PodCreateRequest):
37 name='', mode='', details='',
38 role="", _id='', create_date=''):
39 super(Pod, self).__init__(name, mode, details, role)
41 self.creation_date = create_date
44 def from_dict(pod_dict):
49 p._id = pod_dict.get('_id')
50 p.creation_date = str(pod_dict.get('creation_date'))
51 p.name = pod_dict.get('name')
52 p.mode = pod_dict.get('mode')
53 p.details = pod_dict.get('details')
54 p.role = pod_dict.get('role')
58 f = super(Pod, self).format()
59 f['creation_date'] = str(self.creation_date)
62 def format_http(self):
64 f['_id'] = str(self._id)
72 @ptype pods: C{list} of L{Pod}
78 def from_dict(res_dict):
83 for pod in res_dict.get('pods'):
84 res.pods.append(Pod.from_dict(pod))