3 # Copyright 2016 RIFT.IO Inc
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
9 # http://www.apache.org/licenses/LICENSE-2.0
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.
19 from gi
import require_version
20 require_version('RwCal', '1.0')
22 from gi
.repository
import (
31 logger
= logging
.getLogger('rwcal.openmano')
33 class UnknownAccountError(Exception):
37 class MissingFileError(Exception):
41 class ImageLocationError(Exception):
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
,
53 class RwcalOpenmanoPlugin(GObject
.Object
, RwCal
.Cloud
):
54 """Stub implementation the CAL VALA methods for Openmano. """
57 GObject
.Object
.__init
__(self
)
60 def do_init(self
, rwlog_ctx
):
61 if not any(isinstance(h
, rwlogger
.RwLogger
) for h
in logger
.handlers
):
64 category
="rw-cal-log",
65 subcategory
="openmano",
70 @rwstatus(ret_on_failure
=[None])
71 def do_validate_cloud_creds(self
, account
):
73 Validates the cloud account credentials for the specified account.
74 If creds are not valid, returns an error code & reason string
76 account - a cloud account to validate
79 Validation Code and Details String
81 status
= RwcalYang
.CloudConnectionStatus(
85 print("Returning status: %s", str(status
))
88 @rwstatus(ret_on_failure
=[None])
89 def do_get_management_network(self
, account
):
90 raise NotImplementedError()
93 def do_create_tenant(self
, account
, name
):
94 raise NotImplementedError()
97 def do_delete_tenant(self
, account
, tenant_id
):
98 raise NotImplementedError()
100 @rwstatus(ret_on_failure
=[[]])
101 def do_get_tenant_list(self
, account
):
102 raise NotImplementedError()
105 def do_create_role(self
, account
, name
):
106 raise NotImplementedError()
109 def do_delete_role(self
, account
, role_id
):
110 raise NotImplementedError()
112 @rwstatus(ret_on_failure
=[[]])
113 def do_get_role_list(self
, account
):
114 raise NotImplementedError()
116 @rwstatus(ret_on_failure
=[None])
117 def do_create_image(self
, account
, image
):
118 logger
.warning("Creating image on openmano not supported")
121 def do_delete_image(self
, account
, image_id
):
122 raise NotImplementedError()
124 @rwstatus(ret_on_failure
=[None])
125 def do_get_image(self
, account
, image_id
):
126 raise NotImplementedError()
128 @rwstatus(ret_on_failure
=[[]])
129 def do_get_image_list(self
, account
):
130 raise NotImplementedError()
133 def do_create_vm(self
, account
, vm
):
134 raise NotImplementedError()
137 def do_start_vm(self
, account
, vm_id
):
138 raise NotImplementedError()
141 def do_stop_vm(self
, account
, vm_id
):
142 raise NotImplementedError()
145 def do_delete_vm(self
, account
, vm_id
):
146 raise NotImplementedError()
149 def do_reboot_vm(self
, account
, vm_id
):
150 raise NotImplementedError()
152 @rwstatus(ret_on_failure
=[[]])
153 def do_get_vm_list(self
, account
):
154 return RwcalYang
.VimResources()
157 def do_create_flavor(self
, account
, flavor
):
158 raise NotImplementedError()
161 def do_delete_flavor(self
, account
, flavor_id
):
162 raise NotImplementedError()
164 @rwstatus(ret_on_failure
=[None])
165 def do_get_flavor(self
, account
, flavor_id
):
166 raise NotImplementedError()
168 @rwstatus(ret_on_failure
=[[]])
169 def do_get_flavor_list(self
, account
):
170 raise NotImplementedError()
173 def do_add_host(self
, account
, host
):
174 raise NotImplementedError()
177 def do_remove_host(self
, account
, host_id
):
178 raise NotImplementedError()
180 @rwstatus(ret_on_failure
=[None])
181 def do_get_host(self
, account
, host_id
):
182 raise NotImplementedError()
184 @rwstatus(ret_on_failure
=[[]])
185 def do_get_host_list(self
, account
):
186 raise NotImplementedError()
189 def do_create_port(self
, account
, port
):
190 raise NotImplementedError()
193 def do_delete_port(self
, account
, port_id
):
194 raise NotImplementedError()
196 @rwstatus(ret_on_failure
=[None])
197 def do_get_port(self
, account
, port_id
):
198 raise NotImplementedError()
200 @rwstatus(ret_on_failure
=[[]])
201 def do_get_port_list(self
, account
):
202 return RwcalYang
.VimResources()
205 def do_create_network(self
, account
, network
):
206 raise NotImplementedError()
209 def do_delete_network(self
, account
, network_id
):
210 raise NotImplementedError()
212 @rwstatus(ret_on_failure
=[None])
213 def do_get_network(self
, account
, network_id
):
214 raise NotImplementedError()
216 @rwstatus(ret_on_failure
=[[]])
217 def do_get_network_list(self
, account
):
218 return RwcalYang
.VimResources()
220 @rwstatus(ret_on_failure
=[""])
221 def do_create_virtual_link(self
, account
, link_params
):
222 raise NotImplementedError()
225 def do_delete_virtual_link(self
, account
, link_id
):
226 raise NotImplementedError()
228 @rwstatus(ret_on_failure
=[None])
229 def do_get_virtual_link(self
, account
, link_id
):
230 raise NotImplementedError()
232 @rwstatus(ret_on_failure
=[""])
233 def do_get_virtual_link_list(self
, account
):
234 raise NotImplementedError()
236 @rwstatus(ret_on_failure
=[""])
237 def do_create_vdu(self
, account
, vdu_init
):
238 raise NotImplementedError()
241 def do_modify_vdu(self
, account
, vdu_modify
):
242 raise NotImplementedError()
245 def do_delete_vdu(self
, account
, vdu_id
):
246 raise NotImplementedError()
248 @rwstatus(ret_on_failure
=[None])
249 def do_get_vdu(self
, account
, vdu_id
):
250 raise NotImplementedError()
252 @rwstatus(ret_on_failure
=[""])
253 def do_get_vdu_list(self
, account
):
254 raise NotImplementedError()