David Paterson | d6babc5 | 2014-10-14 00:11:56 -0400 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | |
David Paterson | e41ebca | 2015-04-09 05:40:12 -0400 | [diff] [blame] | 3 | # Copyright 2015 Dell Inc. |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 6 | # not use this file except in compliance with the License. You may obtain |
| 7 | # a copy of the License at |
| 8 | # |
David Paterson | e41ebca | 2015-04-09 05:40:12 -0400 | [diff] [blame] | 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 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, WITHOUT |
| 13 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 14 | # License for the specific language governing permissions and limitations |
| 15 | # under the License. |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 16 | |
Doug Hellmann | 583ce2c | 2015-03-11 14:55:46 +0000 | [diff] [blame] | 17 | from oslo_log import log as logging |
| 18 | |
ghanshyam | 009a1f6 | 2017-08-08 10:22:57 +0300 | [diff] [blame] | 19 | from tempest import clients |
Andrea Frittoli (andreaf) | 290b3e1 | 2015-10-08 10:25:02 +0100 | [diff] [blame] | 20 | from tempest.common import credentials_factory as credentials |
Ken'ichi Ohmichi | 6ea3f98 | 2015-11-09 12:41:13 +0000 | [diff] [blame] | 21 | from tempest.common import identity |
Andrea Frittoli | cd36841 | 2017-08-14 21:37:56 +0100 | [diff] [blame] | 22 | from tempest.common import utils |
Attila Fazekas | d7e08a6 | 2016-10-07 13:05:05 +0200 | [diff] [blame] | 23 | from tempest.common.utils import net_info |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 24 | from tempest import config |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 25 | |
| 26 | LOG = logging.getLogger(__name__) |
| 27 | CONF = config.CONF |
| 28 | |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 29 | CONF_FLAVORS = None |
| 30 | CONF_IMAGES = None |
David Paterson | d6babc5 | 2014-10-14 00:11:56 -0400 | [diff] [blame] | 31 | CONF_NETWORKS = [] |
| 32 | CONF_PRIV_NETWORK_NAME = None |
| 33 | CONF_PUB_NETWORK = None |
| 34 | CONF_PUB_ROUTER = None |
Arx Cruz | 05fe4bc | 2017-10-20 10:48:28 +0200 | [diff] [blame] | 35 | CONF_PROJECTS = None |
David Paterson | d6babc5 | 2014-10-14 00:11:56 -0400 | [diff] [blame] | 36 | CONF_USERS = None |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 37 | |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 38 | IS_CINDER = None |
| 39 | IS_GLANCE = None |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 40 | IS_NEUTRON = None |
| 41 | IS_NOVA = None |
| 42 | |
| 43 | |
| 44 | def init_conf(): |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 45 | global CONF_FLAVORS |
| 46 | global CONF_IMAGES |
David Paterson | d6babc5 | 2014-10-14 00:11:56 -0400 | [diff] [blame] | 47 | global CONF_NETWORKS |
| 48 | global CONF_PRIV_NETWORK |
| 49 | global CONF_PRIV_NETWORK_NAME |
| 50 | global CONF_PUB_NETWORK |
| 51 | global CONF_PUB_ROUTER |
Arx Cruz | 05fe4bc | 2017-10-20 10:48:28 +0200 | [diff] [blame] | 52 | global CONF_PROJECTS |
David Paterson | d6babc5 | 2014-10-14 00:11:56 -0400 | [diff] [blame] | 53 | global CONF_USERS |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 54 | global IS_CINDER |
| 55 | global IS_GLANCE |
| 56 | global IS_HEAT |
| 57 | global IS_NEUTRON |
| 58 | global IS_NOVA |
| 59 | |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 60 | IS_CINDER = CONF.service_available.cinder |
| 61 | IS_GLANCE = CONF.service_available.glance |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 62 | IS_NEUTRON = CONF.service_available.neutron |
| 63 | IS_NOVA = CONF.service_available.nova |
| 64 | |
David Paterson | d6babc5 | 2014-10-14 00:11:56 -0400 | [diff] [blame] | 65 | CONF_FLAVORS = [CONF.compute.flavor_ref, CONF.compute.flavor_ref_alt] |
| 66 | CONF_IMAGES = [CONF.compute.image_ref, CONF.compute.image_ref_alt] |
| 67 | CONF_PRIV_NETWORK_NAME = CONF.compute.fixed_network_name |
| 68 | CONF_PUB_NETWORK = CONF.network.public_network_id |
| 69 | CONF_PUB_ROUTER = CONF.network.public_router_id |
Arx Cruz | 05fe4bc | 2017-10-20 10:48:28 +0200 | [diff] [blame] | 70 | CONF_PROJECTS = [CONF.auth.admin_project_name] |
Jeffrey Zhang | b5e2321 | 2016-07-06 14:18:53 +0800 | [diff] [blame] | 71 | CONF_USERS = [CONF.auth.admin_username] |
David Paterson | d6babc5 | 2014-10-14 00:11:56 -0400 | [diff] [blame] | 72 | |
| 73 | if IS_NEUTRON: |
David Paterson | 8223402 | 2015-04-12 14:07:40 -0400 | [diff] [blame] | 74 | CONF_PRIV_NETWORK = _get_network_id(CONF.compute.fixed_network_name, |
Daniel Mellado | d4d0b93 | 2016-04-08 08:57:29 +0000 | [diff] [blame] | 75 | CONF.auth.admin_project_name) |
David Paterson | d6babc5 | 2014-10-14 00:11:56 -0400 | [diff] [blame] | 76 | CONF_NETWORKS = [CONF_PUB_NETWORK, CONF_PRIV_NETWORK] |
| 77 | |
| 78 | |
Daniel Mellado | d4d0b93 | 2016-04-08 08:57:29 +0000 | [diff] [blame] | 79 | def _get_network_id(net_name, project_name): |
ghanshyam | 009a1f6 | 2017-08-08 10:22:57 +0300 | [diff] [blame] | 80 | am = clients.Manager( |
| 81 | credentials.get_configured_admin_credentials()) |
John Warren | 94d8faf | 2015-09-15 12:22:24 -0400 | [diff] [blame] | 82 | net_cl = am.networks_client |
Arx Cruz | 05fe4bc | 2017-10-20 10:48:28 +0200 | [diff] [blame] | 83 | pr_cl = am.projects_client |
David Paterson | d6babc5 | 2014-10-14 00:11:56 -0400 | [diff] [blame] | 84 | |
David Kranz | 34e8812 | 2014-12-11 15:24:05 -0500 | [diff] [blame] | 85 | networks = net_cl.list_networks() |
Arx Cruz | 05fe4bc | 2017-10-20 10:48:28 +0200 | [diff] [blame] | 86 | project = identity.get_project_by_name(pr_cl, project_name) |
| 87 | p_id = project['id'] |
David Paterson | d6babc5 | 2014-10-14 00:11:56 -0400 | [diff] [blame] | 88 | n_id = None |
| 89 | for net in networks['networks']: |
Arx Cruz | 05fe4bc | 2017-10-20 10:48:28 +0200 | [diff] [blame] | 90 | if (net['project_id'] == p_id and net['name'] == net_name): |
David Paterson | d6babc5 | 2014-10-14 00:11:56 -0400 | [diff] [blame] | 91 | n_id = net['id'] |
| 92 | break |
| 93 | return n_id |
| 94 | |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 95 | |
| 96 | class BaseService(object): |
| 97 | def __init__(self, kwargs): |
| 98 | self.client = None |
| 99 | for key, value in kwargs.items(): |
| 100 | setattr(self, key, value) |
| 101 | |
David Paterson | 8223402 | 2015-04-12 14:07:40 -0400 | [diff] [blame] | 102 | self.tenant_filter = {} |
| 103 | if hasattr(self, 'tenant_id'): |
Martin Kopec | b37903c | 2019-01-20 21:39:58 +0000 | [diff] [blame] | 104 | self.tenant_filter['project_id'] = self.tenant_id |
David Paterson | 8223402 | 2015-04-12 14:07:40 -0400 | [diff] [blame] | 105 | |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 106 | def _filter_by_tenant_id(self, item_list): |
Federico Ressi | 2d6bcaa | 2018-04-11 12:37:36 +0200 | [diff] [blame] | 107 | if (item_list is None or |
| 108 | not item_list or |
| 109 | not hasattr(self, 'tenant_id') or |
| 110 | self.tenant_id is None or |
| 111 | 'tenant_id' not in item_list[0]): |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 112 | return item_list |
| 113 | |
David Paterson | d6babc5 | 2014-10-14 00:11:56 -0400 | [diff] [blame] | 114 | return [item for item in item_list |
| 115 | if item['tenant_id'] == self.tenant_id] |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 116 | |
| 117 | def list(self): |
| 118 | pass |
| 119 | |
| 120 | def delete(self): |
| 121 | pass |
| 122 | |
| 123 | def dry_run(self): |
| 124 | pass |
| 125 | |
| 126 | def save_state(self): |
| 127 | pass |
| 128 | |
| 129 | def run(self): |
| 130 | if self.is_dry_run: |
| 131 | self.dry_run() |
| 132 | elif self.is_save_state: |
| 133 | self.save_state() |
| 134 | else: |
| 135 | self.delete() |
| 136 | |
| 137 | |
| 138 | class SnapshotService(BaseService): |
| 139 | |
| 140 | def __init__(self, manager, **kwargs): |
| 141 | super(SnapshotService, self).__init__(kwargs) |
ghanshyam | 5992895 | 2017-10-26 01:38:45 +0000 | [diff] [blame] | 142 | self.client = manager.snapshots_client_latest |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 143 | |
| 144 | def list(self): |
| 145 | client = self.client |
David Paterson | 07661de | 2015-10-29 20:15:04 -0700 | [diff] [blame] | 146 | snaps = client.list_snapshots()['snapshots'] |
Martin Kopec | 5a884bf | 2019-02-11 18:10:55 +0000 | [diff] [blame^] | 147 | if not self.is_save_state: |
| 148 | # recreate list removing saved snapshots |
| 149 | snaps = [snap for snap in snaps if snap['id'] |
| 150 | not in self.saved_state_json['snapshots'].keys()] |
Jordan Pittier | 525ec71 | 2016-12-07 17:51:26 +0100 | [diff] [blame] | 151 | LOG.debug("List count, %s Snapshots", len(snaps)) |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 152 | return snaps |
| 153 | |
| 154 | def delete(self): |
| 155 | snaps = self.list() |
| 156 | client = self.client |
| 157 | for snap in snaps: |
| 158 | try: |
| 159 | client.delete_snapshot(snap['id']) |
David Paterson | e41ebca | 2015-04-09 05:40:12 -0400 | [diff] [blame] | 160 | except Exception: |
| 161 | LOG.exception("Delete Snapshot exception.") |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 162 | |
| 163 | def dry_run(self): |
| 164 | snaps = self.list() |
| 165 | self.data['snapshots'] = snaps |
| 166 | |
Martin Kopec | 5a884bf | 2019-02-11 18:10:55 +0000 | [diff] [blame^] | 167 | def save_state(self): |
| 168 | snaps = self.list() |
| 169 | self.data['snapshots'] = {} |
| 170 | for snap in snaps: |
| 171 | self.data['snapshots'][snap['id']] = snap['name'] |
| 172 | |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 173 | |
| 174 | class ServerService(BaseService): |
| 175 | def __init__(self, manager, **kwargs): |
| 176 | super(ServerService, self).__init__(kwargs) |
| 177 | self.client = manager.servers_client |
David Paterson | 07661de | 2015-10-29 20:15:04 -0700 | [diff] [blame] | 178 | self.server_groups_client = manager.server_groups_client |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 179 | |
| 180 | def list(self): |
| 181 | client = self.client |
David Kranz | ae99b9a | 2015-02-16 13:37:01 -0500 | [diff] [blame] | 182 | servers_body = client.list_servers() |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 183 | servers = servers_body['servers'] |
Martin Kopec | 5a884bf | 2019-02-11 18:10:55 +0000 | [diff] [blame^] | 184 | if not self.is_save_state: |
| 185 | # recreate list removing saved servers |
| 186 | servers = [server for server in servers if server['id'] |
| 187 | not in self.saved_state_json['servers'].keys()] |
Jordan Pittier | 525ec71 | 2016-12-07 17:51:26 +0100 | [diff] [blame] | 188 | LOG.debug("List count, %s Servers", len(servers)) |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 189 | return servers |
| 190 | |
| 191 | def delete(self): |
| 192 | client = self.client |
| 193 | servers = self.list() |
| 194 | for server in servers: |
| 195 | try: |
| 196 | client.delete_server(server['id']) |
David Paterson | e41ebca | 2015-04-09 05:40:12 -0400 | [diff] [blame] | 197 | except Exception: |
| 198 | LOG.exception("Delete Server exception.") |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 199 | |
| 200 | def dry_run(self): |
| 201 | servers = self.list() |
| 202 | self.data['servers'] = servers |
| 203 | |
Martin Kopec | 5a884bf | 2019-02-11 18:10:55 +0000 | [diff] [blame^] | 204 | def save_state(self): |
| 205 | servers = self.list() |
| 206 | self.data['servers'] = {} |
| 207 | for server in servers: |
| 208 | self.data['servers'][server['id']] = server['name'] |
| 209 | |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 210 | |
| 211 | class ServerGroupService(ServerService): |
| 212 | |
| 213 | def list(self): |
David Paterson | 07661de | 2015-10-29 20:15:04 -0700 | [diff] [blame] | 214 | client = self.server_groups_client |
ghanshyam | 2dc1345 | 2015-08-24 17:39:25 +0900 | [diff] [blame] | 215 | sgs = client.list_server_groups()['server_groups'] |
Martin Kopec | 5a884bf | 2019-02-11 18:10:55 +0000 | [diff] [blame^] | 216 | if not self.is_save_state: |
| 217 | # recreate list removing saved server_groups |
| 218 | sgs = [sg for sg in sgs if sg['id'] |
| 219 | not in self.saved_state_json['server_groups'].keys()] |
Jordan Pittier | 525ec71 | 2016-12-07 17:51:26 +0100 | [diff] [blame] | 220 | LOG.debug("List count, %s Server Groups", len(sgs)) |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 221 | return sgs |
| 222 | |
| 223 | def delete(self): |
Martin Kopec | 5a884bf | 2019-02-11 18:10:55 +0000 | [diff] [blame^] | 224 | client = self.server_groups_client |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 225 | sgs = self.list() |
| 226 | for sg in sgs: |
| 227 | try: |
| 228 | client.delete_server_group(sg['id']) |
David Paterson | e41ebca | 2015-04-09 05:40:12 -0400 | [diff] [blame] | 229 | except Exception: |
| 230 | LOG.exception("Delete Server Group exception.") |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 231 | |
| 232 | def dry_run(self): |
| 233 | sgs = self.list() |
| 234 | self.data['server_groups'] = sgs |
| 235 | |
Martin Kopec | 5a884bf | 2019-02-11 18:10:55 +0000 | [diff] [blame^] | 236 | def save_state(self): |
| 237 | sgs = self.list() |
| 238 | self.data['server_groups'] = {} |
| 239 | for sg in sgs: |
| 240 | self.data['server_groups'][sg['id']] = sg['name'] |
| 241 | |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 242 | |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 243 | class KeyPairService(BaseService): |
| 244 | def __init__(self, manager, **kwargs): |
| 245 | super(KeyPairService, self).__init__(kwargs) |
| 246 | self.client = manager.keypairs_client |
| 247 | |
| 248 | def list(self): |
| 249 | client = self.client |
ghanshyam | dee01f2 | 2015-08-17 11:41:47 +0900 | [diff] [blame] | 250 | keypairs = client.list_keypairs()['keypairs'] |
Martin Kopec | 5a884bf | 2019-02-11 18:10:55 +0000 | [diff] [blame^] | 251 | if not self.is_save_state: |
| 252 | # recreate list removing saved keypairs |
| 253 | keypairs = [keypair for keypair in keypairs |
| 254 | if keypair['keypair']['name'] |
| 255 | not in self.saved_state_json['keypairs'].keys()] |
Jordan Pittier | 525ec71 | 2016-12-07 17:51:26 +0100 | [diff] [blame] | 256 | LOG.debug("List count, %s Keypairs", len(keypairs)) |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 257 | return keypairs |
| 258 | |
| 259 | def delete(self): |
| 260 | client = self.client |
| 261 | keypairs = self.list() |
| 262 | for k in keypairs: |
| 263 | try: |
| 264 | name = k['keypair']['name'] |
| 265 | client.delete_keypair(name) |
David Paterson | e41ebca | 2015-04-09 05:40:12 -0400 | [diff] [blame] | 266 | except Exception: |
| 267 | LOG.exception("Delete Keypairs exception.") |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 268 | |
| 269 | def dry_run(self): |
| 270 | keypairs = self.list() |
| 271 | self.data['keypairs'] = keypairs |
| 272 | |
Martin Kopec | 5a884bf | 2019-02-11 18:10:55 +0000 | [diff] [blame^] | 273 | def save_state(self): |
| 274 | keypairs = self.list() |
| 275 | self.data['keypairs'] = {} |
| 276 | for keypair in keypairs: |
| 277 | keypair = keypair['keypair'] |
| 278 | self.data['keypairs'][keypair['name']] = keypair |
| 279 | |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 280 | |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 281 | class VolumeService(BaseService): |
| 282 | def __init__(self, manager, **kwargs): |
| 283 | super(VolumeService, self).__init__(kwargs) |
ghanshyam | 5992895 | 2017-10-26 01:38:45 +0000 | [diff] [blame] | 284 | self.client = manager.volumes_client_latest |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 285 | |
| 286 | def list(self): |
| 287 | client = self.client |
John Warren | 6177c9e | 2015-08-19 20:00:17 +0000 | [diff] [blame] | 288 | vols = client.list_volumes()['volumes'] |
Martin Kopec | 5a884bf | 2019-02-11 18:10:55 +0000 | [diff] [blame^] | 289 | if not self.is_save_state: |
| 290 | # recreate list removing saved volumes |
| 291 | vols = [vol for vol in vols if vol['id'] |
| 292 | not in self.saved_state_json['volumes'].keys()] |
Jordan Pittier | 525ec71 | 2016-12-07 17:51:26 +0100 | [diff] [blame] | 293 | LOG.debug("List count, %s Volumes", len(vols)) |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 294 | return vols |
| 295 | |
| 296 | def delete(self): |
| 297 | client = self.client |
| 298 | vols = self.list() |
| 299 | for v in vols: |
| 300 | try: |
| 301 | client.delete_volume(v['id']) |
David Paterson | e41ebca | 2015-04-09 05:40:12 -0400 | [diff] [blame] | 302 | except Exception: |
| 303 | LOG.exception("Delete Volume exception.") |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 304 | |
| 305 | def dry_run(self): |
| 306 | vols = self.list() |
| 307 | self.data['volumes'] = vols |
| 308 | |
Martin Kopec | 5a884bf | 2019-02-11 18:10:55 +0000 | [diff] [blame^] | 309 | def save_state(self): |
| 310 | vols = self.list() |
| 311 | self.data['volumes'] = {} |
| 312 | for vol in vols: |
| 313 | self.data['volumes'][vol['id']] = vol['name'] |
| 314 | |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 315 | |
David Paterson | 35c8df0 | 2015-04-05 04:35:31 -0400 | [diff] [blame] | 316 | class VolumeQuotaService(BaseService): |
| 317 | def __init__(self, manager, **kwargs): |
| 318 | super(VolumeQuotaService, self).__init__(kwargs) |
ghanshyam | 6c682ff | 2018-08-06 09:54:45 +0000 | [diff] [blame] | 319 | self.client = manager.volume_quotas_client_latest |
David Paterson | 35c8df0 | 2015-04-05 04:35:31 -0400 | [diff] [blame] | 320 | |
| 321 | def delete(self): |
| 322 | client = self.client |
| 323 | try: |
Martin Kopec | b37903c | 2019-01-20 21:39:58 +0000 | [diff] [blame] | 324 | client.delete_quota_set(self.project_id) |
David Paterson | e41ebca | 2015-04-09 05:40:12 -0400 | [diff] [blame] | 325 | except Exception: |
| 326 | LOG.exception("Delete Volume Quotas exception.") |
David Paterson | 35c8df0 | 2015-04-05 04:35:31 -0400 | [diff] [blame] | 327 | |
| 328 | def dry_run(self): |
Ken'ichi Ohmichi | 3cf9eaf | 2016-07-29 11:05:21 -0700 | [diff] [blame] | 329 | quotas = self.client.show_quota_set( |
Martin Kopec | b37903c | 2019-01-20 21:39:58 +0000 | [diff] [blame] | 330 | self.project_id, params={'usage': True})['quota_set'] |
David Paterson | 35c8df0 | 2015-04-05 04:35:31 -0400 | [diff] [blame] | 331 | self.data['volume_quotas'] = quotas |
| 332 | |
| 333 | |
| 334 | class NovaQuotaService(BaseService): |
| 335 | def __init__(self, manager, **kwargs): |
| 336 | super(NovaQuotaService, self).__init__(kwargs) |
| 337 | self.client = manager.quotas_client |
| 338 | self.limits_client = manager.limits_client |
| 339 | |
| 340 | def delete(self): |
| 341 | client = self.client |
| 342 | try: |
Martin Kopec | b37903c | 2019-01-20 21:39:58 +0000 | [diff] [blame] | 343 | client.delete_quota_set(self.project_id) |
David Paterson | e41ebca | 2015-04-09 05:40:12 -0400 | [diff] [blame] | 344 | except Exception: |
| 345 | LOG.exception("Delete Quotas exception.") |
David Paterson | 35c8df0 | 2015-04-05 04:35:31 -0400 | [diff] [blame] | 346 | |
| 347 | def dry_run(self): |
| 348 | client = self.limits_client |
ghanshyam | 8a59949 | 2015-08-24 15:55:59 +0900 | [diff] [blame] | 349 | quotas = client.show_limits()['limits'] |
Ken'ichi Ohmichi | b93e676 | 2015-06-15 07:11:29 +0000 | [diff] [blame] | 350 | self.data['compute_quotas'] = quotas['absolute'] |
David Paterson | 35c8df0 | 2015-04-05 04:35:31 -0400 | [diff] [blame] | 351 | |
| 352 | |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 353 | # Begin network service classes |
Martin Kopec | 5a884bf | 2019-02-11 18:10:55 +0000 | [diff] [blame^] | 354 | class BaseNetworkService(BaseService): |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 355 | def __init__(self, manager, **kwargs): |
Martin Kopec | 5a884bf | 2019-02-11 18:10:55 +0000 | [diff] [blame^] | 356 | super(BaseNetworkService, self).__init__(kwargs) |
John Warren | 94d8faf | 2015-09-15 12:22:24 -0400 | [diff] [blame] | 357 | self.networks_client = manager.networks_client |
John Warren | 3961acd | 2015-10-02 14:38:53 -0400 | [diff] [blame] | 358 | self.subnets_client = manager.subnets_client |
John Warren | 49c0fe5 | 2015-10-22 12:35:54 -0400 | [diff] [blame] | 359 | self.ports_client = manager.ports_client |
John Warren | fbf2a89 | 2015-11-17 12:36:14 -0500 | [diff] [blame] | 360 | self.floating_ips_client = manager.floating_ips_client |
John Warren | 6d0083a | 2015-11-30 18:12:30 -0500 | [diff] [blame] | 361 | self.metering_labels_client = manager.metering_labels_client |
John Warren | dd20b3e | 2015-12-03 13:11:28 -0500 | [diff] [blame] | 362 | self.metering_label_rules_client = manager.metering_label_rules_client |
John Warren | f9606e9 | 2015-12-10 12:12:42 -0500 | [diff] [blame] | 363 | self.security_groups_client = manager.security_groups_client |
ghanshyam | a25c419 | 2016-03-11 18:38:12 +0900 | [diff] [blame] | 364 | self.routers_client = manager.routers_client |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 365 | |
David Paterson | d6babc5 | 2014-10-14 00:11:56 -0400 | [diff] [blame] | 366 | def _filter_by_conf_networks(self, item_list): |
| 367 | if not item_list or not all(('network_id' in i for i in item_list)): |
| 368 | return item_list |
| 369 | |
| 370 | return [item for item in item_list if item['network_id'] |
| 371 | not in CONF_NETWORKS] |
| 372 | |
Martin Kopec | 5a884bf | 2019-02-11 18:10:55 +0000 | [diff] [blame^] | 373 | |
| 374 | class NetworkService(BaseNetworkService): |
| 375 | |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 376 | def list(self): |
John Warren | 94d8faf | 2015-09-15 12:22:24 -0400 | [diff] [blame] | 377 | client = self.networks_client |
David Paterson | 8223402 | 2015-04-12 14:07:40 -0400 | [diff] [blame] | 378 | networks = client.list_networks(**self.tenant_filter) |
| 379 | networks = networks['networks'] |
Martin Kopec | 5a884bf | 2019-02-11 18:10:55 +0000 | [diff] [blame^] | 380 | |
| 381 | if not self.is_save_state: |
| 382 | # recreate list removing saved networks |
| 383 | networks = [network for network in networks if network['id'] |
| 384 | not in self.saved_state_json['networks'].keys()] |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 385 | # filter out networks declared in tempest.conf |
| 386 | if self.is_preserve: |
| 387 | networks = [network for network in networks |
David Paterson | d6babc5 | 2014-10-14 00:11:56 -0400 | [diff] [blame] | 388 | if network['id'] not in CONF_NETWORKS] |
Jordan Pittier | 525ec71 | 2016-12-07 17:51:26 +0100 | [diff] [blame] | 389 | LOG.debug("List count, %s Networks", networks) |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 390 | return networks |
| 391 | |
| 392 | def delete(self): |
John Warren | 94d8faf | 2015-09-15 12:22:24 -0400 | [diff] [blame] | 393 | client = self.networks_client |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 394 | networks = self.list() |
| 395 | for n in networks: |
| 396 | try: |
| 397 | client.delete_network(n['id']) |
David Paterson | e41ebca | 2015-04-09 05:40:12 -0400 | [diff] [blame] | 398 | except Exception: |
| 399 | LOG.exception("Delete Network exception.") |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 400 | |
| 401 | def dry_run(self): |
| 402 | networks = self.list() |
| 403 | self.data['networks'] = networks |
| 404 | |
Martin Kopec | 5a884bf | 2019-02-11 18:10:55 +0000 | [diff] [blame^] | 405 | def save_state(self): |
| 406 | networks = self.list() |
| 407 | self.data['networks'] = {} |
| 408 | for network in networks: |
| 409 | self.data['networks'][network['id']] = network |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 410 | |
Martin Kopec | 5a884bf | 2019-02-11 18:10:55 +0000 | [diff] [blame^] | 411 | |
| 412 | class NetworkFloatingIpService(BaseNetworkService): |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 413 | |
| 414 | def list(self): |
John Warren | fbf2a89 | 2015-11-17 12:36:14 -0500 | [diff] [blame] | 415 | client = self.floating_ips_client |
David Paterson | 8223402 | 2015-04-12 14:07:40 -0400 | [diff] [blame] | 416 | flips = client.list_floatingips(**self.tenant_filter) |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 417 | flips = flips['floatingips'] |
Martin Kopec | 5a884bf | 2019-02-11 18:10:55 +0000 | [diff] [blame^] | 418 | |
| 419 | if not self.is_save_state: |
| 420 | # recreate list removing saved flips |
| 421 | flips = [flip for flip in flips if flip['id'] |
| 422 | not in self.saved_state_json['floatingips'].keys()] |
Jordan Pittier | 525ec71 | 2016-12-07 17:51:26 +0100 | [diff] [blame] | 423 | LOG.debug("List count, %s Network Floating IPs", len(flips)) |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 424 | return flips |
| 425 | |
| 426 | def delete(self): |
Martin Kopec | 5a884bf | 2019-02-11 18:10:55 +0000 | [diff] [blame^] | 427 | client = self.floating_ips_client |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 428 | flips = self.list() |
| 429 | for flip in flips: |
| 430 | try: |
| 431 | client.delete_floatingip(flip['id']) |
David Paterson | e41ebca | 2015-04-09 05:40:12 -0400 | [diff] [blame] | 432 | except Exception: |
| 433 | LOG.exception("Delete Network Floating IP exception.") |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 434 | |
| 435 | def dry_run(self): |
| 436 | flips = self.list() |
Martin Kopec | 5a884bf | 2019-02-11 18:10:55 +0000 | [diff] [blame^] | 437 | self.data['floatingips'] = flips |
| 438 | |
| 439 | def save_state(self): |
| 440 | flips = self.list() |
| 441 | self.data['floatingips'] = {} |
| 442 | for flip in flips: |
| 443 | self.data['floatingips'][flip['id']] = flip |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 444 | |
| 445 | |
Martin Kopec | 5a884bf | 2019-02-11 18:10:55 +0000 | [diff] [blame^] | 446 | class NetworkRouterService(BaseNetworkService): |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 447 | |
| 448 | def list(self): |
Ken'ichi Ohmichi | e35f472 | 2015-12-22 04:57:11 +0000 | [diff] [blame] | 449 | client = self.routers_client |
David Paterson | 8223402 | 2015-04-12 14:07:40 -0400 | [diff] [blame] | 450 | routers = client.list_routers(**self.tenant_filter) |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 451 | routers = routers['routers'] |
Martin Kopec | 5a884bf | 2019-02-11 18:10:55 +0000 | [diff] [blame^] | 452 | |
| 453 | if not self.is_save_state: |
| 454 | # recreate list removing saved routers |
| 455 | routers = [router for router in routers if router['id'] |
| 456 | not in self.saved_state_json['routers'].keys()] |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 457 | if self.is_preserve: |
| 458 | routers = [router for router in routers |
| 459 | if router['id'] != CONF_PUB_ROUTER] |
| 460 | |
Jordan Pittier | 525ec71 | 2016-12-07 17:51:26 +0100 | [diff] [blame] | 461 | LOG.debug("List count, %s Routers", len(routers)) |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 462 | return routers |
| 463 | |
| 464 | def delete(self): |
Ken'ichi Ohmichi | e35f472 | 2015-12-22 04:57:11 +0000 | [diff] [blame] | 465 | client = self.routers_client |
Ken'ichi Ohmichi | f3110f0 | 2016-03-21 12:29:03 -0700 | [diff] [blame] | 466 | ports_client = self.ports_client |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 467 | routers = self.list() |
| 468 | for router in routers: |
| 469 | try: |
| 470 | rid = router['id'] |
David Paterson | 8223402 | 2015-04-12 14:07:40 -0400 | [diff] [blame] | 471 | ports = [port for port |
Ken'ichi Ohmichi | f3110f0 | 2016-03-21 12:29:03 -0700 | [diff] [blame] | 472 | in ports_client.list_ports(device_id=rid)['ports'] |
Attila Fazekas | d7e08a6 | 2016-10-07 13:05:05 +0200 | [diff] [blame] | 473 | if net_info.is_router_interface_port(port)] |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 474 | for port in ports: |
piyush110786 | 94aca95 | 2015-12-17 12:54:44 +0530 | [diff] [blame] | 475 | client.remove_router_interface(rid, port_id=port['id']) |
David Paterson | d6babc5 | 2014-10-14 00:11:56 -0400 | [diff] [blame] | 476 | client.delete_router(rid) |
David Paterson | e41ebca | 2015-04-09 05:40:12 -0400 | [diff] [blame] | 477 | except Exception: |
| 478 | LOG.exception("Delete Router exception.") |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 479 | |
| 480 | def dry_run(self): |
| 481 | routers = self.list() |
| 482 | self.data['routers'] = routers |
| 483 | |
Martin Kopec | 5a884bf | 2019-02-11 18:10:55 +0000 | [diff] [blame^] | 484 | def save_state(self): |
| 485 | routers = self.list() |
| 486 | self.data['routers'] = {} |
| 487 | for router in routers: |
| 488 | self.data['routers'][router['id']] = router['name'] |
| 489 | |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 490 | |
Alexander Gubanov | 13379bb | 2015-05-19 18:57:32 +0300 | [diff] [blame] | 491 | class NetworkMeteringLabelRuleService(NetworkService): |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 492 | |
| 493 | def list(self): |
John Warren | dd20b3e | 2015-12-03 13:11:28 -0500 | [diff] [blame] | 494 | client = self.metering_label_rules_client |
David Kranz | 34e8812 | 2014-12-11 15:24:05 -0500 | [diff] [blame] | 495 | rules = client.list_metering_label_rules() |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 496 | rules = rules['metering_label_rules'] |
| 497 | rules = self._filter_by_tenant_id(rules) |
Martin Kopec | 5a884bf | 2019-02-11 18:10:55 +0000 | [diff] [blame^] | 498 | |
| 499 | if not self.is_save_state: |
| 500 | saved_rules = self.saved_state_json['metering_label_rules'].keys() |
| 501 | # recreate list removing saved rules |
| 502 | rules = [rule for rule in rules if rule['id'] not in saved_rules] |
Jordan Pittier | 525ec71 | 2016-12-07 17:51:26 +0100 | [diff] [blame] | 503 | LOG.debug("List count, %s Metering Label Rules", len(rules)) |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 504 | return rules |
| 505 | |
| 506 | def delete(self): |
John Warren | dd20b3e | 2015-12-03 13:11:28 -0500 | [diff] [blame] | 507 | client = self.metering_label_rules_client |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 508 | rules = self.list() |
| 509 | for rule in rules: |
| 510 | try: |
| 511 | client.delete_metering_label_rule(rule['id']) |
David Paterson | e41ebca | 2015-04-09 05:40:12 -0400 | [diff] [blame] | 512 | except Exception: |
| 513 | LOG.exception("Delete Metering Label Rule exception.") |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 514 | |
| 515 | def dry_run(self): |
| 516 | rules = self.list() |
Martin Kopec | 5a884bf | 2019-02-11 18:10:55 +0000 | [diff] [blame^] | 517 | self.data['metering_label_rules'] = rules |
| 518 | |
| 519 | def save_state(self): |
| 520 | rules = self.list() |
| 521 | self.data['metering_label_rules'] = {} |
| 522 | for rule in rules: |
| 523 | self.data['metering_label_rules'][rule['id']] = rule |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 524 | |
| 525 | |
Martin Kopec | 5a884bf | 2019-02-11 18:10:55 +0000 | [diff] [blame^] | 526 | class NetworkMeteringLabelService(BaseNetworkService): |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 527 | |
| 528 | def list(self): |
John Warren | 6d0083a | 2015-11-30 18:12:30 -0500 | [diff] [blame] | 529 | client = self.metering_labels_client |
David Kranz | 34e8812 | 2014-12-11 15:24:05 -0500 | [diff] [blame] | 530 | labels = client.list_metering_labels() |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 531 | labels = labels['metering_labels'] |
| 532 | labels = self._filter_by_tenant_id(labels) |
Martin Kopec | 5a884bf | 2019-02-11 18:10:55 +0000 | [diff] [blame^] | 533 | |
| 534 | if not self.is_save_state: |
| 535 | # recreate list removing saved labels |
| 536 | labels = [label for label in labels if label['id'] |
| 537 | not in self.saved_state_json['metering_labels'].keys()] |
Jordan Pittier | 525ec71 | 2016-12-07 17:51:26 +0100 | [diff] [blame] | 538 | LOG.debug("List count, %s Metering Labels", len(labels)) |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 539 | return labels |
| 540 | |
| 541 | def delete(self): |
John Warren | 6d0083a | 2015-11-30 18:12:30 -0500 | [diff] [blame] | 542 | client = self.metering_labels_client |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 543 | labels = self.list() |
| 544 | for label in labels: |
| 545 | try: |
| 546 | client.delete_metering_label(label['id']) |
David Paterson | e41ebca | 2015-04-09 05:40:12 -0400 | [diff] [blame] | 547 | except Exception: |
| 548 | LOG.exception("Delete Metering Label exception.") |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 549 | |
| 550 | def dry_run(self): |
| 551 | labels = self.list() |
Martin Kopec | 5a884bf | 2019-02-11 18:10:55 +0000 | [diff] [blame^] | 552 | self.data['metering_labels'] = labels |
| 553 | |
| 554 | def save_state(self): |
| 555 | labels = self.list() |
| 556 | self.data['metering_labels'] = {} |
| 557 | for label in labels: |
| 558 | self.data['metering_labels'][label['id']] = label['name'] |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 559 | |
| 560 | |
Martin Kopec | 5a884bf | 2019-02-11 18:10:55 +0000 | [diff] [blame^] | 561 | class NetworkPortService(BaseNetworkService): |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 562 | |
| 563 | def list(self): |
John Warren | 49c0fe5 | 2015-10-22 12:35:54 -0400 | [diff] [blame] | 564 | client = self.ports_client |
David Paterson | 8223402 | 2015-04-12 14:07:40 -0400 | [diff] [blame] | 565 | ports = [port for port in |
| 566 | client.list_ports(**self.tenant_filter)['ports'] |
| 567 | if port["device_owner"] == "" or |
| 568 | port["device_owner"].startswith("compute:")] |
| 569 | |
Martin Kopec | 5a884bf | 2019-02-11 18:10:55 +0000 | [diff] [blame^] | 570 | if not self.is_save_state: |
| 571 | # recreate list removing saved ports |
| 572 | ports = [port for port in ports if port['id'] |
| 573 | not in self.saved_state_json['ports'].keys()] |
David Paterson | d6babc5 | 2014-10-14 00:11:56 -0400 | [diff] [blame] | 574 | if self.is_preserve: |
| 575 | ports = self._filter_by_conf_networks(ports) |
David Paterson | 8223402 | 2015-04-12 14:07:40 -0400 | [diff] [blame] | 576 | |
Jordan Pittier | 525ec71 | 2016-12-07 17:51:26 +0100 | [diff] [blame] | 577 | LOG.debug("List count, %s Ports", len(ports)) |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 578 | return ports |
| 579 | |
| 580 | def delete(self): |
John Warren | 49c0fe5 | 2015-10-22 12:35:54 -0400 | [diff] [blame] | 581 | client = self.ports_client |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 582 | ports = self.list() |
| 583 | for port in ports: |
| 584 | try: |
| 585 | client.delete_port(port['id']) |
David Paterson | e41ebca | 2015-04-09 05:40:12 -0400 | [diff] [blame] | 586 | except Exception: |
| 587 | LOG.exception("Delete Port exception.") |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 588 | |
| 589 | def dry_run(self): |
| 590 | ports = self.list() |
| 591 | self.data['ports'] = ports |
| 592 | |
Martin Kopec | 5a884bf | 2019-02-11 18:10:55 +0000 | [diff] [blame^] | 593 | def save_state(self): |
| 594 | ports = self.list() |
| 595 | self.data['ports'] = {} |
| 596 | for port in ports: |
| 597 | self.data['ports'][port['id']] = port['name'] |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 598 | |
Martin Kopec | 5a884bf | 2019-02-11 18:10:55 +0000 | [diff] [blame^] | 599 | |
| 600 | class NetworkSecGroupService(BaseNetworkService): |
David Paterson | 8223402 | 2015-04-12 14:07:40 -0400 | [diff] [blame] | 601 | def list(self): |
John Warren | f9606e9 | 2015-12-10 12:12:42 -0500 | [diff] [blame] | 602 | client = self.security_groups_client |
David Paterson | 8223402 | 2015-04-12 14:07:40 -0400 | [diff] [blame] | 603 | filter = self.tenant_filter |
| 604 | # cannot delete default sec group so never show it. |
| 605 | secgroups = [secgroup for secgroup in |
| 606 | client.list_security_groups(**filter)['security_groups'] |
| 607 | if secgroup['name'] != 'default'] |
| 608 | |
Martin Kopec | 5a884bf | 2019-02-11 18:10:55 +0000 | [diff] [blame^] | 609 | if not self.is_save_state: |
| 610 | # recreate list removing saved security_groups |
| 611 | secgroups = [secgroup for secgroup in secgroups if secgroup['id'] |
| 612 | not in self.saved_state_json['security_groups'].keys() |
| 613 | ] |
David Paterson | 8223402 | 2015-04-12 14:07:40 -0400 | [diff] [blame] | 614 | if self.is_preserve: |
Martin Kopec | 5a884bf | 2019-02-11 18:10:55 +0000 | [diff] [blame^] | 615 | secgroups = [secgroup for secgroup in secgroups |
| 616 | if secgroup['security_group_rules'][0]['project_id'] |
| 617 | not in CONF_PROJECTS] |
Jordan Pittier | 525ec71 | 2016-12-07 17:51:26 +0100 | [diff] [blame] | 618 | LOG.debug("List count, %s security_groups", len(secgroups)) |
David Paterson | 8223402 | 2015-04-12 14:07:40 -0400 | [diff] [blame] | 619 | return secgroups |
| 620 | |
| 621 | def delete(self): |
Martin Kopec | 5a884bf | 2019-02-11 18:10:55 +0000 | [diff] [blame^] | 622 | client = self.security_groups_client |
David Paterson | 8223402 | 2015-04-12 14:07:40 -0400 | [diff] [blame] | 623 | secgroups = self.list() |
| 624 | for secgroup in secgroups: |
| 625 | try: |
Martin Kopec | 5a884bf | 2019-02-11 18:10:55 +0000 | [diff] [blame^] | 626 | client.delete_security_group(secgroup['id']) |
David Paterson | 8223402 | 2015-04-12 14:07:40 -0400 | [diff] [blame] | 627 | except Exception: |
| 628 | LOG.exception("Delete security_group exception.") |
| 629 | |
| 630 | def dry_run(self): |
| 631 | secgroups = self.list() |
Martin Kopec | 5a884bf | 2019-02-11 18:10:55 +0000 | [diff] [blame^] | 632 | self.data['security_groups'] = secgroups |
| 633 | |
| 634 | def save_state(self): |
| 635 | secgroups = self.list() |
| 636 | self.data['security_groups'] = {} |
| 637 | for secgroup in secgroups: |
| 638 | self.data['security_groups'][secgroup['id']] = secgroup['name'] |
David Paterson | 8223402 | 2015-04-12 14:07:40 -0400 | [diff] [blame] | 639 | |
| 640 | |
Martin Kopec | 5a884bf | 2019-02-11 18:10:55 +0000 | [diff] [blame^] | 641 | class NetworkSubnetService(BaseNetworkService): |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 642 | |
| 643 | def list(self): |
John Warren | 3961acd | 2015-10-02 14:38:53 -0400 | [diff] [blame] | 644 | client = self.subnets_client |
David Paterson | 8223402 | 2015-04-12 14:07:40 -0400 | [diff] [blame] | 645 | subnets = client.list_subnets(**self.tenant_filter) |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 646 | subnets = subnets['subnets'] |
Martin Kopec | 5a884bf | 2019-02-11 18:10:55 +0000 | [diff] [blame^] | 647 | if not self.is_save_state: |
| 648 | # recreate list removing saved subnets |
| 649 | subnets = [subnet for subnet in subnets if subnet['id'] |
| 650 | not in self.saved_state_json['subnets'].keys()] |
David Paterson | d6babc5 | 2014-10-14 00:11:56 -0400 | [diff] [blame] | 651 | if self.is_preserve: |
| 652 | subnets = self._filter_by_conf_networks(subnets) |
Jordan Pittier | 525ec71 | 2016-12-07 17:51:26 +0100 | [diff] [blame] | 653 | LOG.debug("List count, %s Subnets", len(subnets)) |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 654 | return subnets |
| 655 | |
| 656 | def delete(self): |
John Warren | 3961acd | 2015-10-02 14:38:53 -0400 | [diff] [blame] | 657 | client = self.subnets_client |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 658 | subnets = self.list() |
| 659 | for subnet in subnets: |
| 660 | try: |
| 661 | client.delete_subnet(subnet['id']) |
David Paterson | e41ebca | 2015-04-09 05:40:12 -0400 | [diff] [blame] | 662 | except Exception: |
| 663 | LOG.exception("Delete Subnet exception.") |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 664 | |
| 665 | def dry_run(self): |
| 666 | subnets = self.list() |
| 667 | self.data['subnets'] = subnets |
| 668 | |
Martin Kopec | 5a884bf | 2019-02-11 18:10:55 +0000 | [diff] [blame^] | 669 | def save_state(self): |
| 670 | subnets = self.list() |
| 671 | self.data['subnets'] = {} |
| 672 | for subnet in subnets: |
| 673 | self.data['subnets'][subnet['id']] = subnet['name'] |
| 674 | |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 675 | |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 676 | # begin global services |
| 677 | class FlavorService(BaseService): |
| 678 | def __init__(self, manager, **kwargs): |
| 679 | super(FlavorService, self).__init__(kwargs) |
| 680 | self.client = manager.flavors_client |
| 681 | |
| 682 | def list(self): |
| 683 | client = self.client |
ghanshyam | 19973be | 2015-08-18 15:46:42 +0900 | [diff] [blame] | 684 | flavors = client.list_flavors({"is_public": None})['flavors'] |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 685 | if not self.is_save_state: |
| 686 | # recreate list removing saved flavors |
| 687 | flavors = [flavor for flavor in flavors if flavor['id'] |
| 688 | not in self.saved_state_json['flavors'].keys()] |
| 689 | |
| 690 | if self.is_preserve: |
| 691 | flavors = [flavor for flavor in flavors |
| 692 | if flavor['id'] not in CONF_FLAVORS] |
Jordan Pittier | 525ec71 | 2016-12-07 17:51:26 +0100 | [diff] [blame] | 693 | LOG.debug("List count, %s Flavors after reconcile", len(flavors)) |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 694 | return flavors |
| 695 | |
| 696 | def delete(self): |
| 697 | client = self.client |
| 698 | flavors = self.list() |
| 699 | for flavor in flavors: |
| 700 | try: |
| 701 | client.delete_flavor(flavor['id']) |
David Paterson | e41ebca | 2015-04-09 05:40:12 -0400 | [diff] [blame] | 702 | except Exception: |
| 703 | LOG.exception("Delete Flavor exception.") |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 704 | |
| 705 | def dry_run(self): |
| 706 | flavors = self.list() |
| 707 | self.data['flavors'] = flavors |
| 708 | |
| 709 | def save_state(self): |
| 710 | flavors = self.list() |
gordon chung | c15f1bc | 2015-02-23 18:00:41 -0500 | [diff] [blame] | 711 | self.data['flavors'] = {} |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 712 | for flavor in flavors: |
gordon chung | c15f1bc | 2015-02-23 18:00:41 -0500 | [diff] [blame] | 713 | self.data['flavors'][flavor['id']] = flavor['name'] |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 714 | |
| 715 | |
| 716 | class ImageService(BaseService): |
| 717 | def __init__(self, manager, **kwargs): |
| 718 | super(ImageService, self).__init__(kwargs) |
zhufl | 66275c2 | 2018-03-28 15:32:14 +0800 | [diff] [blame] | 719 | self.client = manager.image_client_v2 |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 720 | |
| 721 | def list(self): |
| 722 | client = self.client |
zhufl | 66275c2 | 2018-03-28 15:32:14 +0800 | [diff] [blame] | 723 | images = client.list_images(params={"all_tenants": True})['images'] |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 724 | if not self.is_save_state: |
| 725 | images = [image for image in images if image['id'] |
| 726 | not in self.saved_state_json['images'].keys()] |
| 727 | if self.is_preserve: |
| 728 | images = [image for image in images |
| 729 | if image['id'] not in CONF_IMAGES] |
Jordan Pittier | 525ec71 | 2016-12-07 17:51:26 +0100 | [diff] [blame] | 730 | LOG.debug("List count, %s Images after reconcile", len(images)) |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 731 | return images |
| 732 | |
| 733 | def delete(self): |
| 734 | client = self.client |
| 735 | images = self.list() |
| 736 | for image in images: |
| 737 | try: |
| 738 | client.delete_image(image['id']) |
David Paterson | e41ebca | 2015-04-09 05:40:12 -0400 | [diff] [blame] | 739 | except Exception: |
| 740 | LOG.exception("Delete Image exception.") |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 741 | |
| 742 | def dry_run(self): |
| 743 | images = self.list() |
| 744 | self.data['images'] = images |
| 745 | |
| 746 | def save_state(self): |
gordon chung | c15f1bc | 2015-02-23 18:00:41 -0500 | [diff] [blame] | 747 | self.data['images'] = {} |
David Paterson | 8223402 | 2015-04-12 14:07:40 -0400 | [diff] [blame] | 748 | images = self.list() |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 749 | for image in images: |
gordon chung | c15f1bc | 2015-02-23 18:00:41 -0500 | [diff] [blame] | 750 | self.data['images'][image['id']] = image['name'] |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 751 | |
| 752 | |
Daniel Mellado | 82c83a5 | 2015-12-09 15:16:49 +0000 | [diff] [blame] | 753 | class UserService(BaseService): |
| 754 | |
| 755 | def __init__(self, manager, **kwargs): |
| 756 | super(UserService, self).__init__(kwargs) |
Arx Cruz | 05fe4bc | 2017-10-20 10:48:28 +0200 | [diff] [blame] | 757 | self.client = manager.users_v3_client |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 758 | |
| 759 | def list(self): |
Daniel Mellado | 82c83a5 | 2015-12-09 15:16:49 +0000 | [diff] [blame] | 760 | users = self.client.list_users()['users'] |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 761 | |
| 762 | if not self.is_save_state: |
| 763 | users = [user for user in users if user['id'] |
| 764 | not in self.saved_state_json['users'].keys()] |
| 765 | |
| 766 | if self.is_preserve: |
| 767 | users = [user for user in users if user['name'] |
| 768 | not in CONF_USERS] |
| 769 | |
| 770 | elif not self.is_save_state: # Never delete admin user |
| 771 | users = [user for user in users if user['name'] != |
David Paterson | 07661de | 2015-10-29 20:15:04 -0700 | [diff] [blame] | 772 | CONF.auth.admin_username] |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 773 | |
Jordan Pittier | 525ec71 | 2016-12-07 17:51:26 +0100 | [diff] [blame] | 774 | LOG.debug("List count, %s Users after reconcile", len(users)) |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 775 | return users |
| 776 | |
| 777 | def delete(self): |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 778 | users = self.list() |
| 779 | for user in users: |
| 780 | try: |
Daniel Mellado | 82c83a5 | 2015-12-09 15:16:49 +0000 | [diff] [blame] | 781 | self.client.delete_user(user['id']) |
David Paterson | e41ebca | 2015-04-09 05:40:12 -0400 | [diff] [blame] | 782 | except Exception: |
| 783 | LOG.exception("Delete User exception.") |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 784 | |
| 785 | def dry_run(self): |
| 786 | users = self.list() |
| 787 | self.data['users'] = users |
| 788 | |
| 789 | def save_state(self): |
| 790 | users = self.list() |
gordon chung | c15f1bc | 2015-02-23 18:00:41 -0500 | [diff] [blame] | 791 | self.data['users'] = {} |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 792 | for user in users: |
gordon chung | c15f1bc | 2015-02-23 18:00:41 -0500 | [diff] [blame] | 793 | self.data['users'][user['id']] = user['name'] |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 794 | |
| 795 | |
Daniel Mellado | b83ea56 | 2015-12-18 09:12:49 +0000 | [diff] [blame] | 796 | class RoleService(BaseService): |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 797 | |
Daniel Mellado | 6b16b92 | 2015-12-07 12:43:08 +0000 | [diff] [blame] | 798 | def __init__(self, manager, **kwargs): |
| 799 | super(RoleService, self).__init__(kwargs) |
| 800 | self.client = manager.roles_client |
| 801 | |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 802 | def list(self): |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 803 | try: |
Daniel Mellado | 6b16b92 | 2015-12-07 12:43:08 +0000 | [diff] [blame] | 804 | roles = self.client.list_roles()['roles'] |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 805 | # reconcile roles with saved state and never list admin role |
| 806 | if not self.is_save_state: |
| 807 | roles = [role for role in roles if |
| 808 | (role['id'] not in |
Federico Ressi | 2d6bcaa | 2018-04-11 12:37:36 +0200 | [diff] [blame] | 809 | self.saved_state_json['roles'].keys() and |
| 810 | role['name'] != CONF.identity.admin_role)] |
Jordan Pittier | 525ec71 | 2016-12-07 17:51:26 +0100 | [diff] [blame] | 811 | LOG.debug("List count, %s Roles after reconcile", len(roles)) |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 812 | return roles |
David Paterson | e41ebca | 2015-04-09 05:40:12 -0400 | [diff] [blame] | 813 | except Exception: |
| 814 | LOG.exception("Cannot retrieve Roles.") |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 815 | return [] |
| 816 | |
| 817 | def delete(self): |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 818 | roles = self.list() |
| 819 | for role in roles: |
| 820 | try: |
Daniel Mellado | 6b16b92 | 2015-12-07 12:43:08 +0000 | [diff] [blame] | 821 | self.client.delete_role(role['id']) |
David Paterson | e41ebca | 2015-04-09 05:40:12 -0400 | [diff] [blame] | 822 | except Exception: |
| 823 | LOG.exception("Delete Role exception.") |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 824 | |
| 825 | def dry_run(self): |
| 826 | roles = self.list() |
| 827 | self.data['roles'] = roles |
| 828 | |
| 829 | def save_state(self): |
| 830 | roles = self.list() |
gordon chung | c15f1bc | 2015-02-23 18:00:41 -0500 | [diff] [blame] | 831 | self.data['roles'] = {} |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 832 | for role in roles: |
gordon chung | c15f1bc | 2015-02-23 18:00:41 -0500 | [diff] [blame] | 833 | self.data['roles'][role['id']] = role['name'] |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 834 | |
| 835 | |
Arx Cruz | 05fe4bc | 2017-10-20 10:48:28 +0200 | [diff] [blame] | 836 | class ProjectService(BaseService): |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 837 | |
Daniel Mellado | b04da90 | 2015-11-20 17:43:12 +0100 | [diff] [blame] | 838 | def __init__(self, manager, **kwargs): |
Arx Cruz | 05fe4bc | 2017-10-20 10:48:28 +0200 | [diff] [blame] | 839 | super(ProjectService, self).__init__(kwargs) |
| 840 | self.client = manager.projects_client |
Daniel Mellado | b04da90 | 2015-11-20 17:43:12 +0100 | [diff] [blame] | 841 | |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 842 | def list(self): |
Arx Cruz | 05fe4bc | 2017-10-20 10:48:28 +0200 | [diff] [blame] | 843 | projects = self.client.list_projects()['projects'] |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 844 | if not self.is_save_state: |
Federico Ressi | 2d6bcaa | 2018-04-11 12:37:36 +0200 | [diff] [blame] | 845 | project_ids = self.saved_state_json['projects'] |
| 846 | projects = [project |
| 847 | for project in projects |
| 848 | if (project['id'] not in project_ids and |
| 849 | project['name'] != CONF.auth.admin_project_name)] |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 850 | |
| 851 | if self.is_preserve: |
Federico Ressi | 2d6bcaa | 2018-04-11 12:37:36 +0200 | [diff] [blame] | 852 | projects = [project |
| 853 | for project in projects |
| 854 | if project['name'] not in CONF_PROJECTS] |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 855 | |
Arx Cruz | 05fe4bc | 2017-10-20 10:48:28 +0200 | [diff] [blame] | 856 | LOG.debug("List count, %s Projects after reconcile", len(projects)) |
| 857 | return projects |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 858 | |
| 859 | def delete(self): |
Arx Cruz | 05fe4bc | 2017-10-20 10:48:28 +0200 | [diff] [blame] | 860 | projects = self.list() |
| 861 | for project in projects: |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 862 | try: |
Arx Cruz | 05fe4bc | 2017-10-20 10:48:28 +0200 | [diff] [blame] | 863 | self.client.delete_project(project['id']) |
David Paterson | e41ebca | 2015-04-09 05:40:12 -0400 | [diff] [blame] | 864 | except Exception: |
Arx Cruz | 05fe4bc | 2017-10-20 10:48:28 +0200 | [diff] [blame] | 865 | LOG.exception("Delete project exception.") |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 866 | |
| 867 | def dry_run(self): |
Arx Cruz | 05fe4bc | 2017-10-20 10:48:28 +0200 | [diff] [blame] | 868 | projects = self.list() |
| 869 | self.data['projects'] = projects |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 870 | |
| 871 | def save_state(self): |
Arx Cruz | 05fe4bc | 2017-10-20 10:48:28 +0200 | [diff] [blame] | 872 | projects = self.list() |
| 873 | self.data['projects'] = {} |
| 874 | for project in projects: |
| 875 | self.data['projects'][project['id']] = project['name'] |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 876 | |
| 877 | |
| 878 | class DomainService(BaseService): |
| 879 | |
| 880 | def __init__(self, manager, **kwargs): |
| 881 | super(DomainService, self).__init__(kwargs) |
Daniel Mellado | 91a26b6 | 2016-02-11 11:13:04 +0000 | [diff] [blame] | 882 | self.client = manager.domains_client |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 883 | |
| 884 | def list(self): |
| 885 | client = self.client |
Thomas Bechtold | 48268a0 | 2015-08-30 19:37:46 +0200 | [diff] [blame] | 886 | domains = client.list_domains()['domains'] |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 887 | if not self.is_save_state: |
| 888 | domains = [domain for domain in domains if domain['id'] |
| 889 | not in self.saved_state_json['domains'].keys()] |
| 890 | |
Jordan Pittier | 525ec71 | 2016-12-07 17:51:26 +0100 | [diff] [blame] | 891 | LOG.debug("List count, %s Domains after reconcile", len(domains)) |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 892 | return domains |
| 893 | |
| 894 | def delete(self): |
| 895 | client = self.client |
| 896 | domains = self.list() |
| 897 | for domain in domains: |
| 898 | try: |
| 899 | client.update_domain(domain['id'], enabled=False) |
| 900 | client.delete_domain(domain['id']) |
David Paterson | e41ebca | 2015-04-09 05:40:12 -0400 | [diff] [blame] | 901 | except Exception: |
| 902 | LOG.exception("Delete Domain exception.") |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 903 | |
| 904 | def dry_run(self): |
| 905 | domains = self.list() |
| 906 | self.data['domains'] = domains |
| 907 | |
| 908 | def save_state(self): |
| 909 | domains = self.list() |
gordon chung | c15f1bc | 2015-02-23 18:00:41 -0500 | [diff] [blame] | 910 | self.data['domains'] = {} |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 911 | for domain in domains: |
gordon chung | c15f1bc | 2015-02-23 18:00:41 -0500 | [diff] [blame] | 912 | self.data['domains'][domain['id']] = domain['name'] |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 913 | |
| 914 | |
Arx Cruz | 05fe4bc | 2017-10-20 10:48:28 +0200 | [diff] [blame] | 915 | def get_project_cleanup_services(): |
| 916 | project_services = [] |
ghanshyam | e4796f8 | 2016-04-13 15:49:22 +0900 | [diff] [blame] | 917 | # TODO(gmann): Tempest should provide some plugin hook for cleanup |
| 918 | # script extension to plugin tests also. |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 919 | if IS_NOVA: |
Arx Cruz | 05fe4bc | 2017-10-20 10:48:28 +0200 | [diff] [blame] | 920 | project_services.append(ServerService) |
| 921 | project_services.append(KeyPairService) |
Arx Cruz | 05fe4bc | 2017-10-20 10:48:28 +0200 | [diff] [blame] | 922 | project_services.append(ServerGroupService) |
Arx Cruz | 05fe4bc | 2017-10-20 10:48:28 +0200 | [diff] [blame] | 923 | project_services.append(NovaQuotaService) |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 924 | if IS_NEUTRON: |
Arx Cruz | 05fe4bc | 2017-10-20 10:48:28 +0200 | [diff] [blame] | 925 | project_services.append(NetworkFloatingIpService) |
Andrea Frittoli | cd36841 | 2017-08-14 21:37:56 +0100 | [diff] [blame] | 926 | if utils.is_extension_enabled('metering', 'network'): |
Arx Cruz | 05fe4bc | 2017-10-20 10:48:28 +0200 | [diff] [blame] | 927 | project_services.append(NetworkMeteringLabelRuleService) |
| 928 | project_services.append(NetworkMeteringLabelService) |
| 929 | project_services.append(NetworkRouterService) |
| 930 | project_services.append(NetworkPortService) |
| 931 | project_services.append(NetworkSubnetService) |
| 932 | project_services.append(NetworkService) |
| 933 | project_services.append(NetworkSecGroupService) |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 934 | if IS_CINDER: |
Arx Cruz | 05fe4bc | 2017-10-20 10:48:28 +0200 | [diff] [blame] | 935 | project_services.append(SnapshotService) |
| 936 | project_services.append(VolumeService) |
| 937 | project_services.append(VolumeQuotaService) |
| 938 | return project_services |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 939 | |
| 940 | |
| 941 | def get_global_cleanup_services(): |
| 942 | global_services = [] |
| 943 | if IS_NOVA: |
| 944 | global_services.append(FlavorService) |
| 945 | if IS_GLANCE: |
| 946 | global_services.append(ImageService) |
| 947 | global_services.append(UserService) |
Arx Cruz | 05fe4bc | 2017-10-20 10:48:28 +0200 | [diff] [blame] | 948 | global_services.append(ProjectService) |
David Paterson | ce78149 | 2014-09-18 01:07:01 -0400 | [diff] [blame] | 949 | global_services.append(DomainService) |
| 950 | global_services.append(RoleService) |
| 951 | return global_services |