update from RIFT as of 696b75d2fe9fb046261b08c616f1bcf6c0b54a9b second try
[osm/SO.git] / rwcal / plugins / vala / rwcal_vsphere / rwcal_vsphere.py
1
2 #
3 # Copyright 2016 RIFT.IO Inc
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 #
17
18 import logging
19 from gi import require_version
20 require_version('RwCal', '1.0')
21
22 from gi.repository import (
23 GObject,
24 RwCal,
25 RwTypes,
26 RwcalYang)
27
28 import rw_status
29 import rwlogger
30
31 logger = logging.getLogger('rwcal.vsphere')
32
33 class UnknownAccountError(Exception):
34 pass
35
36
37 class MissingFileError(Exception):
38 pass
39
40
41 class ImageLocationError(Exception):
42 pass
43
44
45 rwstatus = rw_status.rwstatus_from_exc_map({
46 IndexError: RwTypes.RwStatus.NOTFOUND,
47 KeyError: RwTypes.RwStatus.NOTFOUND,
48 UnknownAccountError: RwTypes.RwStatus.NOTFOUND,
49 MissingFileError: RwTypes.RwStatus.NOTFOUND,
50 })
51
52
53 class RwcalVspherePlugin(GObject.Object, RwCal.Cloud):
54 """This class implements the CAL VALA methods for Vsphere.
55 """
56
57 def __init__(self):
58 GObject.Object.__init__(self)
59
60 @rwstatus
61 def do_init(self, rwlog_ctx):
62 if not any(isinstance(h, rwlogger.RwLogger) for h in logger.handlers):
63 logger.addHandler(
64 rwlogger.RwLogger(
65 category="rw-cal-log",
66 subcategory="vsphere",
67 log_hdl=rwlog_ctx,
68 )
69 )
70
71 @rwstatus(ret_on_failure=[None])
72 def do_get_management_network(self, account):
73 raise NotImplementedError()
74
75 @rwstatus
76 def do_create_tenant(self, account, name):
77 raise NotImplementedError()
78
79 @rwstatus
80 def do_delete_tenant(self, account, tenant_id):
81 raise NotImplementedError()
82
83 @rwstatus(ret_on_failure=[[]])
84 def do_get_tenant_list(self, account):
85 raise NotImplementedError()
86
87 @rwstatus
88 def do_create_role(self, account, name):
89 raise NotImplementedError()
90
91 @rwstatus
92 def do_delete_role(self, account, role_id):
93 raise NotImplementedError()
94
95 @rwstatus(ret_on_failure=[[]])
96 def do_get_role_list(self, account):
97 raise NotImplementedError()
98
99 @rwstatus(ret_on_failure=[None])
100 def do_create_image(self, account, image):
101 raise NotImplementedError()
102
103
104 @rwstatus
105 def do_delete_image(self, account, image_id):
106 raise NotImplementedError()
107
108 @rwstatus(ret_on_failure=[None])
109 def do_get_image(self, account, image_id):
110 raise NotImplementedError()
111
112 @rwstatus(ret_on_failure=[[]])
113 def do_get_image_list(self, account):
114 raise NotImplementedError()
115
116 @rwstatus
117 def do_create_vm(self, account, vm):
118 raise NotImplementedError()
119
120 @rwstatus
121 def do_start_vm(self, account, vm_id):
122 raise NotImplementedError()
123
124 @rwstatus
125 def do_stop_vm(self, account, vm_id):
126 raise NotImplementedError()
127
128 @rwstatus
129 def do_delete_vm(self, account, vm_id):
130 raise NotImplementedError()
131
132 @rwstatus
133 def do_reboot_vm(self, account, vm_id):
134 raise NotImplementedError()
135
136 @rwstatus(ret_on_failure=[[]])
137 def do_get_vm_list(self, account):
138 raise NotImplementedError()
139
140 @rwstatus
141 def do_create_flavor(self, account, flavor):
142 raise NotImplementedError()
143
144 @rwstatus
145 def do_delete_flavor(self, account, flavor_id):
146 raise NotImplementedError()
147
148 @rwstatus(ret_on_failure=[None])
149 def do_get_flavor(self, account, flavor_id):
150 raise NotImplementedError()
151
152 @rwstatus(ret_on_failure=[[]])
153 def do_get_flavor_list(self, account):
154 raise NotImplementedError()
155
156 @rwstatus
157 def do_add_host(self, account, host):
158 raise NotImplementedError()
159
160 @rwstatus
161 def do_remove_host(self, account, host_id):
162 raise NotImplementedError()
163
164 @rwstatus(ret_on_failure=[None])
165 def do_get_host(self, account, host_id):
166 raise NotImplementedError()
167
168 @rwstatus(ret_on_failure=[[]])
169 def do_get_host_list(self, account):
170 raise NotImplementedError()
171
172 @rwstatus
173 def do_create_port(self, account, port):
174 raise NotImplementedError()
175
176 @rwstatus
177 def do_delete_port(self, account, port_id):
178 raise NotImplementedError()
179
180 @rwstatus(ret_on_failure=[None])
181 def do_get_port(self, account, port_id):
182 raise NotImplementedError()
183
184 @rwstatus(ret_on_failure=[[]])
185 def do_get_port_list(self, account):
186 raise NotImplementedError()
187
188 @rwstatus
189 def do_create_network(self, account, network):
190 raise NotImplementedError()
191
192 @rwstatus
193 def do_delete_network(self, account, network_id):
194 raise NotImplementedError()
195
196 @rwstatus(ret_on_failure=[None])
197 def do_get_network(self, account, network_id):
198 raise NotImplementedError()
199
200 @rwstatus(ret_on_failure=[[]])
201 def do_get_network_list(self, account):
202 raise NotImplementedError()
203
204 @rwstatus(ret_on_failure=[""])
205 def do_create_virtual_link(self, account, link_params):
206 raise NotImplementedError()
207
208 @rwstatus
209 def do_delete_virtual_link(self, account, link_id):
210 raise NotImplementedError()
211
212 @rwstatus(ret_on_failure=[None])
213 def do_get_virtual_link(self, account, link_id):
214 raise NotImplementedError()
215
216 @rwstatus(ret_on_failure=[None])
217 def do_get_virtual_link_by_name(self, account, link_name):
218 raise NotImplementedError()
219
220 @rwstatus(ret_on_failure=[""])
221 def do_get_virtual_link_list(self, account):
222 raise NotImplementedError()
223
224 @rwstatus(ret_on_failure=[""])
225 def do_create_vdu(self, account, vdu_init):
226 raise NotImplementedError()
227
228 @rwstatus
229 def do_modify_vdu(self, account, vdu_modify):
230 raise NotImplementedError()
231
232 @rwstatus
233 def do_delete_vdu(self, account, vdu_id):
234 raise NotImplementedError()
235
236 @rwcalstatus(ret_on_failure=[None])
237 def do_get_vdu(self, account, vdu_id, mgmt_network):
238 # mgmt_network - Added due to need for mgmt network.
239 # TO DO: Investigate the need for aws.
240 raise NotImplementedError()
241
242 @rwcalstatus(ret_on_failure=[None])
243 def do_get_vdu_list(self, account):
244 raise NotImplementedError()