Sean Dague | 7011236 | 2012-04-03 13:48:49 -0400 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | |
| 3 | # vim: tabstop=4 shiftwidth=4 softtabstop=4 |
| 4 | |
| 5 | # Copyright 2011 Quanta Research Cambridge, Inc. |
| 6 | # |
| 7 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | # you may not use this file except in compliance with the License. |
| 9 | # You may obtain a copy of the License at |
| 10 | # |
| 11 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | # |
| 13 | # Unless required by applicable law or agreed to in writing, software |
| 14 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | # See the License for the specific language governing permissions and |
| 17 | # limitations under the License. |
| 18 | |
| 19 | from novaclient.v1_1 import client |
| 20 | import tempest.config |
| 21 | |
| 22 | # get the environment variables for credentials |
| 23 | identity = tempest.config.TempestConfig().identity |
Sean Dague | 7011236 | 2012-04-03 13:48:49 -0400 | [diff] [blame] | 24 | |
Attila Fazekas | cadcb1f | 2013-01-21 23:10:53 +0100 | [diff] [blame] | 25 | nt = client.Client(identity.username, identity.password, |
| 26 | identity.tenant_name, identity.uri) |
Sean Dague | 7011236 | 2012-04-03 13:48:49 -0400 | [diff] [blame] | 27 | |
| 28 | flavor_list = nt.flavors.list() |
| 29 | server_list = nt.servers.list() |
| 30 | images_list = nt.images.list() |
| 31 | keypairs_list = nt.keypairs.list() |
| 32 | floating_ips_list = nt.floating_ips.list() |
David Kranz | 779c7f8 | 2012-05-01 16:50:32 -0400 | [diff] [blame] | 33 | volumes_list = nt.volumes.list() |
Sean Dague | 7011236 | 2012-04-03 13:48:49 -0400 | [diff] [blame] | 34 | |
| 35 | print "total servers: %3d, total flavors: %3d, total images: %3d," % \ |
| 36 | (len(server_list), |
| 37 | len(flavor_list), |
| 38 | len(images_list)), |
| 39 | |
| 40 | print "total keypairs: %3d, total floating ips: %3d" % \ |
| 41 | (len(keypairs_list), |
| 42 | len(floating_ips_list)) |
| 43 | |
| 44 | print "deleting all servers" |
| 45 | for s in server_list: |
| 46 | s.delete() |
| 47 | |
| 48 | print "deleting all keypairs" |
| 49 | for s in keypairs_list: |
| 50 | s.delete() |
| 51 | |
| 52 | print "deleting all floating_ips" |
| 53 | for s in floating_ips_list: |
| 54 | s.delete() |
David Kranz | 779c7f8 | 2012-05-01 16:50:32 -0400 | [diff] [blame] | 55 | |
| 56 | print "deleting all volumes" |
| 57 | for s in volumes_list: |
| 58 | s.delete() |